hexsha stringlengths 40 40 | size int64 5 1.05M | ext stringclasses 588
values | lang stringclasses 305
values | max_stars_repo_path stringlengths 3 363 | max_stars_repo_name stringlengths 5 118 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 10 | max_stars_count float64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringdate 2015-01-01 00:00:35 2022-03-31 23:43:49 ⌀ | max_stars_repo_stars_event_max_datetime stringdate 2015-01-01 12:37:38 2022-03-31 23:59:52 ⌀ | max_issues_repo_path stringlengths 3 363 | max_issues_repo_name stringlengths 5 118 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count float64 1 134k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 3 363 | max_forks_repo_name stringlengths 5 135 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 10 | max_forks_count float64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringdate 2015-01-01 00:01:02 2022-03-31 23:27:27 ⌀ | max_forks_repo_forks_event_max_datetime stringdate 2015-01-03 08:55:07 2022-03-31 23:59:24 ⌀ | content stringlengths 5 1.05M | avg_line_length float64 1.13 1.04M | max_line_length int64 1 1.05M | alphanum_fraction float64 0 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
e448a7384464ec54aea52d08cdb6be78a6cb9396 | 804 | h | C | chrome/browser/ui/webui/policy_indicator_localized_strings_provider.h | zealoussnow/chromium | fd8a8914ca0183f0add65ae55f04e287543c7d4a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 14,668 | 2015-01-01T01:57:10.000Z | 2022-03-31T23:33:32.000Z | chrome/browser/ui/webui/policy_indicator_localized_strings_provider.h | zealoussnow/chromium | fd8a8914ca0183f0add65ae55f04e287543c7d4a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 395 | 2020-04-18T08:22:18.000Z | 2021-12-08T13:04:49.000Z | chrome/browser/ui/webui/policy_indicator_localized_strings_provider.h | zealoussnow/chromium | fd8a8914ca0183f0add65ae55f04e287543c7d4a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 5,941 | 2015-01-02T11:32:21.000Z | 2022-03-31T16:35:46.000Z | // Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_WEBUI_POLICY_INDICATOR_LOCALIZED_STRINGS_PROVIDER_H_
#define CHROME_BROWSER_UI_WEBUI_POLICY_INDICATOR_LOCALIZED_STRINGS_PROVIDER_H_
namespace content {
class WebUIDataSource;
}
namespace policy_indicator {
// Adds the strings needed for policy indicators to |html_source|. This function
// causes |html_source| to expose a strings.js file from its source which
// contains a mapping from string's name to its translated value.
void AddLocalizedStrings(content::WebUIDataSource* html_source);
} // namespace policy_indicator
#endif // CHROME_BROWSER_UI_WEBUI_POLICY_INDICATOR_LOCALIZED_STRINGS_PROVIDER_H_
| 36.545455 | 81 | 0.828358 |
6fb3371c63cf3db535ea84cd6d62c31445b8c4f2 | 12,253 | h | C | SOFTWARE/A64-TERES/linux-a64/fs/xfs/xfs_da_btree.h | xloem/DIY-LAPTOP | f2a410706f7a919ac644de073c570629d5601203 | [
"Apache-2.0"
] | 2 | 2017-10-30T12:25:44.000Z | 2019-08-25T09:01:38.000Z | SOFTWARE/A64-TERES/linux-a64/fs/xfs/xfs_da_btree.h | xloem/DIY-LAPTOP | f2a410706f7a919ac644de073c570629d5601203 | [
"Apache-2.0"
] | null | null | null | SOFTWARE/A64-TERES/linux-a64/fs/xfs/xfs_da_btree.h | xloem/DIY-LAPTOP | f2a410706f7a919ac644de073c570629d5601203 | [
"Apache-2.0"
] | 4 | 2020-05-26T12:40:11.000Z | 2021-07-15T06:46:33.000Z | /*
* Copyright (c) 2000,2002,2005 Silicon Graphics, Inc.
* Copyright (c) 2013 Red Hat, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it would be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __XFS_DA_BTREE_H__
#define __XFS_DA_BTREE_H__
struct xfs_bmap_free;
struct xfs_inode;
struct xfs_trans;
struct zone;
/*========================================================================
* Directory Structure when greater than XFS_LBSIZE(mp) bytes.
*========================================================================*/
/*
* This structure is common to both leaf nodes and non-leaf nodes in the Btree.
*
* It is used to manage a doubly linked list of all blocks at the same
* level in the Btree, and to identify which type of block this is.
*/
#define XFS_DA_NODE_MAGIC 0xfebe /* magic number: non-leaf blocks */
#define XFS_ATTR_LEAF_MAGIC 0xfbee /* magic number: attribute leaf blks */
#define XFS_DIR2_LEAF1_MAGIC 0xd2f1 /* magic number: v2 dirlf single blks */
#define XFS_DIR2_LEAFN_MAGIC 0xd2ff /* magic number: v2 dirlf multi blks */
typedef struct xfs_da_blkinfo {
__be32 forw; /* previous block in list */
__be32 back; /* following block in list */
__be16 magic; /* validity check on block */
__be16 pad; /* unused */
} xfs_da_blkinfo_t;
/*
* CRC enabled directory structure types
*
* The headers change size for the additional verification information, but
* otherwise the tree layouts and contents are unchanged. Hence the da btree
* code can use the struct xfs_da_blkinfo for manipulating the tree links and
* magic numbers without modification for both v2 and v3 nodes.
*/
#define XFS_DA3_NODE_MAGIC 0x3ebe /* magic number: non-leaf blocks */
#define XFS_ATTR3_LEAF_MAGIC 0x3bee /* magic number: attribute leaf blks */
#define XFS_DIR3_LEAF1_MAGIC 0x3df1 /* magic number: v2 dirlf single blks */
#define XFS_DIR3_LEAFN_MAGIC 0x3dff /* magic number: v2 dirlf multi blks */
struct xfs_da3_blkinfo {
/*
* the node link manipulation code relies on the fact that the first
* element of this structure is the struct xfs_da_blkinfo so it can
* ignore the differences in the rest of the structures.
*/
struct xfs_da_blkinfo hdr;
__be32 crc; /* CRC of block */
__be64 blkno; /* first block of the buffer */
__be64 lsn; /* sequence number of last write */
uuid_t uuid; /* filesystem we belong to */
__be64 owner; /* inode that owns the block */
};
/*
* This is the structure of the root and intermediate nodes in the Btree.
* The leaf nodes are defined above.
*
* Entries are not packed.
*
* Since we have duplicate keys, use a binary search but always follow
* all match in the block, not just the first match found.
*/
#define XFS_DA_NODE_MAXDEPTH 5 /* max depth of Btree */
typedef struct xfs_da_node_hdr {
struct xfs_da_blkinfo info; /* block type, links, etc. */
__be16 __count; /* count of active entries */
__be16 __level; /* level above leaves (leaf == 0) */
} xfs_da_node_hdr_t;
struct xfs_da3_node_hdr {
struct xfs_da3_blkinfo info; /* block type, links, etc. */
__be16 __count; /* count of active entries */
__be16 __level; /* level above leaves (leaf == 0) */
__be32 __pad32;
};
#define XFS_DA3_NODE_CRC_OFF (offsetof(struct xfs_da3_node_hdr, info.crc))
typedef struct xfs_da_node_entry {
__be32 hashval; /* hash value for this descendant */
__be32 before; /* Btree block before this key */
} xfs_da_node_entry_t;
typedef struct xfs_da_intnode {
struct xfs_da_node_hdr hdr;
struct xfs_da_node_entry __btree[];
} xfs_da_intnode_t;
struct xfs_da3_intnode {
struct xfs_da3_node_hdr hdr;
struct xfs_da_node_entry __btree[];
};
/*
* In-core version of the node header to abstract the differences in the v2 and
* v3 disk format of the headers. Callers need to convert to/from disk format as
* appropriate.
*/
struct xfs_da3_icnode_hdr {
__uint32_t forw;
__uint32_t back;
__uint16_t magic;
__uint16_t count;
__uint16_t level;
};
extern void xfs_da3_node_hdr_from_disk(struct xfs_da3_icnode_hdr *to,
struct xfs_da_intnode *from);
extern void xfs_da3_node_hdr_to_disk(struct xfs_da_intnode *to,
struct xfs_da3_icnode_hdr *from);
static inline int
xfs_da3_node_hdr_size(struct xfs_da_intnode *dap)
{
if (dap->hdr.info.magic == cpu_to_be16(XFS_DA3_NODE_MAGIC))
return sizeof(struct xfs_da3_node_hdr);
return sizeof(struct xfs_da_node_hdr);
}
static inline struct xfs_da_node_entry *
xfs_da3_node_tree_p(struct xfs_da_intnode *dap)
{
if (dap->hdr.info.magic == cpu_to_be16(XFS_DA3_NODE_MAGIC)) {
struct xfs_da3_intnode *dap3 = (struct xfs_da3_intnode *)dap;
return dap3->__btree;
}
return dap->__btree;
}
extern void xfs_da3_intnode_from_disk(struct xfs_da3_icnode_hdr *to,
struct xfs_da_intnode *from);
extern void xfs_da3_intnode_to_disk(struct xfs_da_intnode *to,
struct xfs_da3_icnode_hdr *from);
#define XFS_LBSIZE(mp) (mp)->m_sb.sb_blocksize
/*========================================================================
* Btree searching and modification structure definitions.
*========================================================================*/
/*
* Search comparison results
*/
enum xfs_dacmp {
XFS_CMP_DIFFERENT, /* names are completely different */
XFS_CMP_EXACT, /* names are exactly the same */
XFS_CMP_CASE /* names are same but differ in case */
};
/*
* Structure to ease passing around component names.
*/
typedef struct xfs_da_args {
const __uint8_t *name; /* string (maybe not NULL terminated) */
int namelen; /* length of string (maybe no NULL) */
__uint8_t *value; /* set of bytes (maybe contain NULLs) */
int valuelen; /* length of value */
int flags; /* argument flags (eg: ATTR_NOCREATE) */
xfs_dahash_t hashval; /* hash value of name */
xfs_ino_t inumber; /* input/output inode number */
struct xfs_inode *dp; /* directory inode to manipulate */
xfs_fsblock_t *firstblock; /* ptr to firstblock for bmap calls */
struct xfs_bmap_free *flist; /* ptr to freelist for bmap_finish */
struct xfs_trans *trans; /* current trans (changes over time) */
xfs_extlen_t total; /* total blocks needed, for 1st bmap */
int whichfork; /* data or attribute fork */
xfs_dablk_t blkno; /* blkno of attr leaf of interest */
int index; /* index of attr of interest in blk */
xfs_dablk_t rmtblkno; /* remote attr value starting blkno */
int rmtblkcnt; /* remote attr value block count */
xfs_dablk_t blkno2; /* blkno of 2nd attr leaf of interest */
int index2; /* index of 2nd attr in blk */
xfs_dablk_t rmtblkno2; /* remote attr value starting blkno */
int rmtblkcnt2; /* remote attr value block count */
int op_flags; /* operation flags */
enum xfs_dacmp cmpresult; /* name compare result for lookups */
} xfs_da_args_t;
/*
* Operation flags:
*/
#define XFS_DA_OP_JUSTCHECK 0x0001 /* check for ok with no space */
#define XFS_DA_OP_RENAME 0x0002 /* this is an atomic rename op */
#define XFS_DA_OP_ADDNAME 0x0004 /* this is an add operation */
#define XFS_DA_OP_OKNOENT 0x0008 /* lookup/add op, ENOENT ok, else die */
#define XFS_DA_OP_CILOOKUP 0x0010 /* lookup to return CI name if found */
#define XFS_DA_OP_FLAGS \
{ XFS_DA_OP_JUSTCHECK, "JUSTCHECK" }, \
{ XFS_DA_OP_RENAME, "RENAME" }, \
{ XFS_DA_OP_ADDNAME, "ADDNAME" }, \
{ XFS_DA_OP_OKNOENT, "OKNOENT" }, \
{ XFS_DA_OP_CILOOKUP, "CILOOKUP" }
/*
* Storage for holding state during Btree searches and split/join ops.
*
* Only need space for 5 intermediate nodes. With a minimum of 62-way
* fanout to the Btree, we can support over 900 million directory blocks,
* which is slightly more than enough.
*/
typedef struct xfs_da_state_blk {
struct xfs_buf *bp; /* buffer containing block */
xfs_dablk_t blkno; /* filesystem blkno of buffer */
xfs_daddr_t disk_blkno; /* on-disk blkno (in BBs) of buffer */
int index; /* relevant index into block */
xfs_dahash_t hashval; /* last hash value in block */
int magic; /* blk's magic number, ie: blk type */
} xfs_da_state_blk_t;
typedef struct xfs_da_state_path {
int active; /* number of active levels */
xfs_da_state_blk_t blk[XFS_DA_NODE_MAXDEPTH];
} xfs_da_state_path_t;
typedef struct xfs_da_state {
xfs_da_args_t *args; /* filename arguments */
struct xfs_mount *mp; /* filesystem mount point */
unsigned int blocksize; /* logical block size */
unsigned int node_ents; /* how many entries in danode */
xfs_da_state_path_t path; /* search/split paths */
xfs_da_state_path_t altpath; /* alternate path for join */
unsigned char inleaf; /* insert into 1->lf, 0->splf */
unsigned char extravalid; /* T/F: extrablk is in use */
unsigned char extraafter; /* T/F: extrablk is after new */
xfs_da_state_blk_t extrablk; /* for double-splits on leaves */
/* for dirv2 extrablk is data */
} xfs_da_state_t;
/*
* Utility macros to aid in logging changed structure fields.
*/
#define XFS_DA_LOGOFF(BASE, ADDR) ((char *)(ADDR) - (char *)(BASE))
#define XFS_DA_LOGRANGE(BASE, ADDR, SIZE) \
(uint)(XFS_DA_LOGOFF(BASE, ADDR)), \
(uint)(XFS_DA_LOGOFF(BASE, ADDR)+(SIZE)-1)
/*
* Name ops for directory and/or attr name operations
*/
struct xfs_nameops {
xfs_dahash_t (*hashname)(struct xfs_name *);
enum xfs_dacmp (*compname)(struct xfs_da_args *,
const unsigned char *, int);
};
/*========================================================================
* Function prototypes.
*========================================================================*/
/*
* Routines used for growing the Btree.
*/
int xfs_da3_node_create(struct xfs_da_args *args, xfs_dablk_t blkno,
int level, struct xfs_buf **bpp, int whichfork);
int xfs_da3_split(xfs_da_state_t *state);
/*
* Routines used for shrinking the Btree.
*/
int xfs_da3_join(xfs_da_state_t *state);
void xfs_da3_fixhashpath(struct xfs_da_state *state,
struct xfs_da_state_path *path_to_to_fix);
/*
* Routines used for finding things in the Btree.
*/
int xfs_da3_node_lookup_int(xfs_da_state_t *state, int *result);
int xfs_da3_path_shift(xfs_da_state_t *state, xfs_da_state_path_t *path,
int forward, int release, int *result);
/*
* Utility routines.
*/
int xfs_da3_blk_link(xfs_da_state_t *state, xfs_da_state_blk_t *old_blk,
xfs_da_state_blk_t *new_blk);
int xfs_da3_node_read(struct xfs_trans *tp, struct xfs_inode *dp,
xfs_dablk_t bno, xfs_daddr_t mappedbno,
struct xfs_buf **bpp, int which_fork);
extern const struct xfs_buf_ops xfs_da3_node_buf_ops;
/*
* Utility routines.
*/
int xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno);
int xfs_da_grow_inode_int(struct xfs_da_args *args, xfs_fileoff_t *bno,
int count);
int xfs_da_get_buf(struct xfs_trans *trans, struct xfs_inode *dp,
xfs_dablk_t bno, xfs_daddr_t mappedbno,
struct xfs_buf **bp, int whichfork);
int xfs_da_read_buf(struct xfs_trans *trans, struct xfs_inode *dp,
xfs_dablk_t bno, xfs_daddr_t mappedbno,
struct xfs_buf **bpp, int whichfork,
const struct xfs_buf_ops *ops);
xfs_daddr_t xfs_da_reada_buf(struct xfs_trans *trans, struct xfs_inode *dp,
xfs_dablk_t bno, xfs_daddr_t mapped_bno,
int whichfork, const struct xfs_buf_ops *ops);
int xfs_da_shrink_inode(xfs_da_args_t *args, xfs_dablk_t dead_blkno,
struct xfs_buf *dead_buf);
uint xfs_da_hashname(const __uint8_t *name_string, int name_length);
enum xfs_dacmp xfs_da_compname(struct xfs_da_args *args,
const unsigned char *name, int len);
xfs_da_state_t *xfs_da_state_alloc(void);
void xfs_da_state_free(xfs_da_state_t *state);
extern struct kmem_zone *xfs_da_state_zone;
extern const struct xfs_nameops xfs_default_nameops;
#endif /* __XFS_DA_BTREE_H__ */
| 36.35905 | 80 | 0.709377 |
8d9b4b47a633a51719077bda3b78faa06d816642 | 6,260 | h | C | tf_big/cc/big_tensor.h | tf-encrypted/big-tensors | 386184eb5aaa3db82781f78883339340de93b6f1 | [
"Apache-2.0"
] | 11 | 2019-06-14T13:56:49.000Z | 2021-04-13T12:55:57.000Z | tf_big/cc/big_tensor.h | tf-encrypted/big-tensors | 386184eb5aaa3db82781f78883339340de93b6f1 | [
"Apache-2.0"
] | 50 | 2019-06-24T16:48:10.000Z | 2020-07-30T09:45:08.000Z | tf_big/cc/big_tensor.h | tf-encrypted/big-tensors | 386184eb5aaa3db82781f78883339340de93b6f1 | [
"Apache-2.0"
] | 2 | 2019-08-08T22:46:19.000Z | 2020-12-10T09:15:30.000Z | #ifndef TF_BIG_CC_BIG_TENSOR_H_
#define TF_BIG_CC_BIG_TENSOR_H_
#include <fcntl.h>
#include <gmp.h>
#include <gmpxx.h>
#include <unistd.h>
#include <string>
#include "Eigen/Core"
#include "Eigen/Dense"
#include "tensorflow/core/framework/op.h"
#include "tensorflow/core/framework/op_kernel.h"
#include "tensorflow/core/framework/shape_inference.h"
#include "tensorflow/core/framework/variant.h"
#include "tensorflow/core/framework/variant_encode_decode.h"
#include "tensorflow/core/framework/variant_op_registry.h"
#include "tensorflow/core/framework/variant_tensor_data.h"
using Eigen::Dynamic;
using Eigen::Index;
using Eigen::Matrix;
using namespace tensorflow; // NOLINT
namespace Eigen {
template <>
struct NumTraits<mpz_class> : GenericNumTraits<mpz_class> {
typedef mpz_class Real;
typedef mpz_class NonInteger;
typedef mpz_class Nested;
static inline Real epsilon() { return 0; }
static inline Real dummy_precision() { return 0; }
static inline int digits10() { return 0; }
enum {
IsInteger = 0,
IsSigned = 1,
IsComplex = 0,
RequireInitialization = 1,
ReadCost = 6,
AddCost = 150,
MulCost = 100
};
};
} // namespace Eigen
typedef Matrix<mpz_class, Dynamic, Dynamic> MatrixXm;
namespace tf_big {
namespace gmp_utils {
inline void reseed(unsigned long& seed) {
int file;
/* re-seed random number generator */
if ((file = open("/dev/urandom", O_RDONLY)) == -1) {
(void)fprintf(stderr, "Error opening /dev/urandom\n");
} else {
if (read(file, &seed, sizeof seed) == -1) {
(void)fprintf(stderr, "Error reading from /dev/urandom\n");
(void)close(file);
}
}
}
inline void init_randstate(gmp_randstate_t& state) {
gmp_randinit_mt(state);
unsigned long seed;
reseed(seed);
gmp_randseed_ui(state, seed);
}
} // namespace gmp_utils
inline void encode_length(uint8_t* buffer, unsigned int len) {
buffer[0] = len & 0xFF;
buffer[1] = (len >> 8) & 0xFF;
buffer[2] = (len >> 16) & 0xFF;
buffer[3] = (len >> 24) & 0xFF;
}
inline unsigned int decode_length(const uint8_t* buffer) {
return buffer[0] + 0x100 * buffer[1] + 0x10000 * buffer[2] +
0x1000000 * buffer[3];
}
struct BigTensor {
BigTensor() {}
BigTensor(const BigTensor& other);
explicit BigTensor(mpz_class m);
explicit BigTensor(const MatrixXm& mat);
static const char kTypeName[];
string TypeName() const { return kTypeName; }
void Encode(VariantTensorData* data) const;
bool Decode(const VariantTensorData& data);
string DebugString() const { return "BigTensor"; }
template <typename T>
void FromTensor(const Tensor& t) {
auto rows = t.dim_size(0);
auto cols = t.dim_size(1);
value = MatrixXm(rows, cols);
auto mat = t.matrix<T>();
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
value(i, j) = mpz_class(mat(i, j));
}
}
}
template <typename T>
void ToTensor(Tensor* t) const {
auto rows = value.rows();
auto cols = value.cols();
if ((rows == 1) && (cols == 1)) {
auto mat = t->scalar<T>();
mat(0) = value(0, 0).get_str();
} else {
auto mat = t->matrix<T>();
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
mat(i, j) = value(i, j).get_str();
}
}
}
}
template <typename T>
void LimbsFromTensor(const Tensor& t) {
int rows = t.dim_size(0);
int cols = t.dim_size(1);
size_t num_real_limbs =
t.dim_size(2) * sizeof(T) - 4; // get rid of header length
value = MatrixXm(rows, cols);
auto input_tensor = t.flat<T>();
const uint8_t* buffer =
reinterpret_cast<const uint8_t*>(input_tensor.data());
size_t pointer = 0;
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
unsigned int length = decode_length(buffer + pointer);
pointer += 4;
mpz_import(value(i, j).get_mpz_t(), length, 1, sizeof(uint8_t), 0, 0,
buffer + pointer);
pointer += num_real_limbs;
}
}
}
BigTensor& operator+=(const BigTensor& rhs) {
this->value += rhs.value;
return *this;
}
// friend makes this a non-member
friend BigTensor operator+(BigTensor lhs, const BigTensor& rhs) {
lhs += rhs;
return lhs;
}
BigTensor& operator-=(const BigTensor& rhs) {
this->value -= rhs.value;
return *this;
}
// friend makes this a non-member
friend BigTensor operator-(BigTensor lhs, const BigTensor& rhs) {
lhs -= rhs;
return lhs;
}
BigTensor& operator*=(const BigTensor& rhs) {
this->value *= rhs.value;
return *this;
}
// friend makes this a non-member
friend BigTensor operator*(BigTensor lhs, const BigTensor& rhs) {
lhs *= rhs;
return lhs;
}
mpz_class operator()(Index i, Index j) const { return value(i, j); }
BigTensor cwiseProduct(const BigTensor& rhs) const {
return BigTensor(this->value.cwiseProduct(rhs.value));
}
BigTensor cwiseQuotient(const BigTensor& rhs) const {
return BigTensor(this->value.cwiseQuotient(rhs.value));
}
Index rows() const { return value.rows(); }
Index cols() const { return value.cols(); }
TensorShape shape() const { return TensorShape{value.rows(), value.cols()}; }
MatrixXm value;
};
template <>
inline void BigTensor::ToTensor<int32>(Tensor* t) const {
auto rows = value.rows();
auto cols = value.cols();
auto mat = t->matrix<int32>();
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
mat(i, j) = value(i, j).get_si();
}
}
}
template <>
inline void BigTensor::ToTensor<uint8>(Tensor* t) const {
auto rows = value.rows();
auto cols = value.cols();
auto mat = t->matrix<uint8>();
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
mat(i, j) = (uint8)value(i, j).get_si();
}
}
}
template <>
inline void BigTensor::FromTensor<tstring>(const Tensor& t) {
auto rows = t.dim_size(0);
auto cols = t.dim_size(1);
value = MatrixXm(rows, cols);
auto mat = t.matrix<tstring>();
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
value(i, j) = mpz_class(mat(i, j), 10);
}
}
}
} // namespace tf_big
#endif // TF_BIG_CC_BIG_TENSOR_H_
| 24.743083 | 79 | 0.62524 |
a52c319c63280a5468c742b314d86e1bd067580a | 25,947 | h | C | sdk/js/include/mozIStorageStatement.h | qianxj/XExplorer | 00e326da03ffcaa21115a2345275452607c6bab5 | [
"MIT"
] | null | null | null | sdk/js/include/mozIStorageStatement.h | qianxj/XExplorer | 00e326da03ffcaa21115a2345275452607c6bab5 | [
"MIT"
] | null | null | null | sdk/js/include/mozIStorageStatement.h | qianxj/XExplorer | 00e326da03ffcaa21115a2345275452607c6bab5 | [
"MIT"
] | null | null | null | /*
* DO NOT EDIT. THIS FILE IS GENERATED FROM d:/firefox-5.0.1/mozilla-release/storage/public/mozIStorageStatement.idl
*/
#ifndef __gen_mozIStorageStatement_h__
#define __gen_mozIStorageStatement_h__
#ifndef __gen_mozIStorageBaseStatement_h__
#include "mozIStorageBaseStatement.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
/* starting interface: mozIStorageStatement */
#define MOZISTORAGESTATEMENT_IID_STR "57ec7be1-36cf-4510-b938-7d1c9ee8cec5"
#define MOZISTORAGESTATEMENT_IID \
{0x57ec7be1, 0x36cf, 0x4510, \
{ 0xb9, 0x38, 0x7d, 0x1c, 0x9e, 0xe8, 0xce, 0xc5 }}
/**
* A SQL statement that can be used for both synchronous and asynchronous
* purposes.
*/
class NS_SCRIPTABLE mozIStorageStatement : public mozIStorageBaseStatement {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(MOZISTORAGESTATEMENT_IID)
/**
* Create a clone of this statement, by initializing a new statement
* with the same connection and same SQL statement as this one. It
* does not preserve statement state; that is, if a statement is
* being executed when it is cloned, the new statement will not be
* executing.
*/
/* mozIStorageStatement clone (); */
NS_SCRIPTABLE NS_IMETHOD Clone(mozIStorageStatement **_retval NS_OUTPARAM) = 0;
/* readonly attribute unsigned long parameterCount; */
NS_SCRIPTABLE NS_IMETHOD GetParameterCount(PRUint32 *aParameterCount) = 0;
/**
* Name of nth parameter, if given
*/
/* AUTF8String getParameterName (in unsigned long aParamIndex); */
NS_SCRIPTABLE NS_IMETHOD GetParameterName(PRUint32 aParamIndex, nsACString & _retval NS_OUTPARAM) = 0;
/**
* Returns the index of the named parameter.
*
* @param aName
* The name of the parameter you want the index for. This does not
* include the leading ':'.
* @return the index of the named parameter.
*/
/* unsigned long getParameterIndex (in AUTF8String aName); */
NS_SCRIPTABLE NS_IMETHOD GetParameterIndex(const nsACString & aName, PRUint32 *_retval NS_OUTPARAM) = 0;
/**
* Number of columns returned
*/
/* readonly attribute unsigned long columnCount; */
NS_SCRIPTABLE NS_IMETHOD GetColumnCount(PRUint32 *aColumnCount) = 0;
/**
* Name of nth column
*/
/* AUTF8String getColumnName (in unsigned long aColumnIndex); */
NS_SCRIPTABLE NS_IMETHOD GetColumnName(PRUint32 aColumnIndex, nsACString & _retval NS_OUTPARAM) = 0;
/**
* Obtains the index of the column with the specified name.
*
* @param aName
* The name of the column.
* @return The index of the column with the specified name.
*/
/* unsigned long getColumnIndex (in AUTF8String aName); */
NS_SCRIPTABLE NS_IMETHOD GetColumnIndex(const nsACString & aName, PRUint32 *_retval NS_OUTPARAM) = 0;
/**
* Obtains the declared column type of a prepared statement.
*
* @param aParamIndex
* The zero-based index of the column who's declared type we are
* interested in.
* @return the declared index type.
*/
/* AUTF8String getColumnDecltype (in unsigned long aParamIndex); */
NS_SCRIPTABLE NS_IMETHOD GetColumnDecltype(PRUint32 aParamIndex, nsACString & _retval NS_OUTPARAM) = 0;
/**
* Reset parameters/statement execution
*/
/* void reset (); */
NS_SCRIPTABLE NS_IMETHOD Reset(void) = 0;
/**
* Execute the query, ignoring any results. This is accomplished by
* calling executeStep() once, and then calling reset().
*
* Error and last insert info, etc. are available from
* the mozStorageConnection.
*/
/* void execute (); */
NS_SCRIPTABLE NS_IMETHOD Execute(void) = 0;
/**
* Execute a query, using any currently-bound parameters. Reset
* must be called on the statement after the last call of
* executeStep.
*
* @return a boolean indicating whether there are more rows or not;
* row data may be accessed using mozIStorageValueArray methods on
* the statement.
*/
/* boolean executeStep (); */
NS_SCRIPTABLE NS_IMETHOD ExecuteStep(PRBool *_retval NS_OUTPARAM) = 0;
/**
* Execute a query, using any currently-bound parameters. Reset is called
* when no more data is returned. This method is only available to JavaScript
* consumers.
*
* @deprecated As of Mozilla 1.9.2 in favor of executeStep().
*
* @return a boolean indicating whether there are more rows or not.
*
* [deprecated] boolean step();
*/
/**
* Obtains the current list of named parameters, which are settable. This
* property is only available to JavaScript consumers.
*
* readonly attribute mozIStorageStatementParams params;
*/
/**
* Obtains the current row, with access to all the data members by name. This
* property is only available to JavaScript consumers.
*
* readonly attribute mozIStorageStatementRow row;
*/
/**
* These type values are returned by getTypeOfIndex
* to indicate what type of value is present at
* a given column.
*/
enum { VALUE_TYPE_NULL = 0 };
enum { VALUE_TYPE_INTEGER = 1 };
enum { VALUE_TYPE_FLOAT = 2 };
enum { VALUE_TYPE_TEXT = 3 };
enum { VALUE_TYPE_BLOB = 4 };
/**
* The number of entries in the array (each corresponding to a column in the
* database row)
*/
/* readonly attribute unsigned long numEntries; */
NS_SCRIPTABLE NS_IMETHOD GetNumEntries(PRUint32 *aNumEntries) = 0;
/**
* Indicate the data type of the current result row for the the given column.
* SQLite will perform type conversion if you ask for a value as a different
* type than it is stored as.
*
* @param aIndex
* 0-based column index.
* @return The type of the value at the given column index; one of
* VALUE_TYPE_NULL, VALUE_TYPE_INTEGER, VALUE_TYPE_FLOAT,
* VALUE_TYPE_TEXT, VALUE_TYPE_BLOB.
*/
/* long getTypeOfIndex (in unsigned long aIndex); */
NS_SCRIPTABLE NS_IMETHOD GetTypeOfIndex(PRUint32 aIndex, PRInt32 *_retval NS_OUTPARAM) = 0;
/**
* Retrieve the contents of a column from the current result row as an
* integer.
*
* @param aIndex
* 0-based colummn index.
* @return Column value interpreted as an integer per type conversion rules.
* @{
*/
/* long getInt32 (in unsigned long aIndex); */
NS_SCRIPTABLE NS_IMETHOD GetInt32(PRUint32 aIndex, PRInt32 *_retval NS_OUTPARAM) = 0;
/* long long getInt64 (in unsigned long aIndex); */
NS_SCRIPTABLE NS_IMETHOD GetInt64(PRUint32 aIndex, PRInt64 *_retval NS_OUTPARAM) = 0;
/** @} */
/**
* Retrieve the contents of a column from the current result row as a
* floating point double.
*
* @param aIndex
* 0-based colummn index.
* @return Column value interpreted as a double per type conversion rules.
*/
/* double getDouble (in unsigned long aIndex); */
NS_SCRIPTABLE NS_IMETHOD GetDouble(PRUint32 aIndex, double *_retval NS_OUTPARAM) = 0;
/**
* Retrieve the contents of a column from the current result row as a
* string.
*
* @param aIndex
* 0-based colummn index.
* @return The value for the result column interpreted as a string. If the
* stored value was NULL, you will get an empty string with IsVoid set
* to distinguish it from an explicitly set empty string.
* @{
*/
/* AUTF8String getUTF8String (in unsigned long aIndex); */
NS_SCRIPTABLE NS_IMETHOD GetUTF8String(PRUint32 aIndex, nsACString & _retval NS_OUTPARAM) = 0;
/* AString getString (in unsigned long aIndex); */
NS_SCRIPTABLE NS_IMETHOD GetString(PRUint32 aIndex, nsAString & _retval NS_OUTPARAM) = 0;
/** @} */
/**
* Retrieve the contents of a column from the current result row as a
* blob.
*
* @param aIndex
* 0-based colummn index.
* @param[out] aDataSize
* The number of bytes in the blob.
* @param[out] aData
* The contents of the BLOB. This will be NULL if aDataSize == 0.
*/
/* void getBlob (in unsigned long aIndex, out unsigned long aDataSize, [array, size_is (aDataSize)] out octet aData); */
NS_SCRIPTABLE NS_IMETHOD GetBlob(PRUint32 aIndex, PRUint32 *aDataSize NS_OUTPARAM, PRUint8 **aData NS_OUTPARAM) = 0;
/**
* Check whether the given column in the current result row is NULL.
*
* @param aIndex
* 0-based colummn index.
* @return true if the value for the result column is null.
*/
/* boolean getIsNull (in unsigned long aIndex); */
NS_SCRIPTABLE NS_IMETHOD GetIsNull(PRUint32 aIndex, PRBool *_retval NS_OUTPARAM) = 0;
/**
* Returns a shared string pointer
*/
/* [noscript] void getSharedUTF8String (in unsigned long aIndex, out unsigned long aLength, [shared, retval] out string aResult); */
NS_IMETHOD GetSharedUTF8String(PRUint32 aIndex, PRUint32 *aLength NS_OUTPARAM, const char **aResult NS_OUTPARAM) = 0;
/* [noscript] void getSharedString (in unsigned long aIndex, out unsigned long aLength, [shared, retval] out wstring aResult); */
NS_IMETHOD GetSharedString(PRUint32 aIndex, PRUint32 *aLength NS_OUTPARAM, const PRUnichar **aResult NS_OUTPARAM) = 0;
/* [noscript] void getSharedBlob (in unsigned long aIndex, out unsigned long aLength, [shared, retval] out octetPtr aResult); */
NS_IMETHOD GetSharedBlob(PRUint32 aIndex, PRUint32 *aLength NS_OUTPARAM, const PRUint8 **aResult NS_OUTPARAM) = 0;
/**
* Getters for native code that return their values as
* the return type, for convenience and sanity.
*
* Not virtual; no vtable bloat.
*/
inline PRInt32 AsInt32(PRUint32 idx) {
PRInt32 v = 0;
nsresult rv = GetInt32(idx, &v);
NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv) || IsNull(idx),
"Getting value failed, wrong column index?");
return v;
}
inline PRInt64 AsInt64(PRUint32 idx) {
PRInt64 v = 0;
nsresult rv = GetInt64(idx, &v);
NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv) || IsNull(idx),
"Getting value failed, wrong column index?");
return v;
}
inline double AsDouble(PRUint32 idx) {
double v = 0.0;
nsresult rv = GetDouble(idx, &v);
NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv) || IsNull(idx),
"Getting value failed, wrong column index?");
return v;
}
inline const char* AsSharedUTF8String(PRUint32 idx, PRUint32 *len) {
const char *str = nsnull;
*len = 0;
nsresult rv = GetSharedUTF8String(idx, len, &str);
NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv) || IsNull(idx),
"Getting value failed, wrong column index?");
return str;
}
inline const PRUnichar* AsSharedWString(PRUint32 idx, PRUint32 *len) {
const PRUnichar *str = nsnull;
*len = 0;
nsresult rv = GetSharedString(idx, len, &str);
NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv) || IsNull(idx),
"Getting value failed, wrong column index?");
return str;
}
inline const PRUint8* AsSharedBlob(PRUint32 idx, PRUint32 *len) {
const PRUint8 *blob = nsnull;
*len = 0;
nsresult rv = GetSharedBlob(idx, len, &blob);
NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv) || IsNull(idx),
"Getting value failed, wrong column index?");
return blob;
}
inline PRBool IsNull(PRUint32 idx) {
PRBool b = PR_FALSE;
nsresult rv = GetIsNull(idx, &b);
NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv),
"Getting value failed, wrong column index?");
return b;
}
};
NS_DEFINE_STATIC_IID_ACCESSOR(mozIStorageStatement, MOZISTORAGESTATEMENT_IID)
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_MOZISTORAGESTATEMENT \
NS_SCRIPTABLE NS_IMETHOD Clone(mozIStorageStatement **_retval NS_OUTPARAM); \
NS_SCRIPTABLE NS_IMETHOD GetParameterCount(PRUint32 *aParameterCount); \
NS_SCRIPTABLE NS_IMETHOD GetParameterName(PRUint32 aParamIndex, nsACString & _retval NS_OUTPARAM); \
NS_SCRIPTABLE NS_IMETHOD GetParameterIndex(const nsACString & aName, PRUint32 *_retval NS_OUTPARAM); \
NS_SCRIPTABLE NS_IMETHOD GetColumnCount(PRUint32 *aColumnCount); \
NS_SCRIPTABLE NS_IMETHOD GetColumnName(PRUint32 aColumnIndex, nsACString & _retval NS_OUTPARAM); \
NS_SCRIPTABLE NS_IMETHOD GetColumnIndex(const nsACString & aName, PRUint32 *_retval NS_OUTPARAM); \
NS_SCRIPTABLE NS_IMETHOD GetColumnDecltype(PRUint32 aParamIndex, nsACString & _retval NS_OUTPARAM); \
NS_SCRIPTABLE NS_IMETHOD Reset(void); \
NS_SCRIPTABLE NS_IMETHOD Execute(void); \
NS_SCRIPTABLE NS_IMETHOD ExecuteStep(PRBool *_retval NS_OUTPARAM); \
NS_SCRIPTABLE NS_IMETHOD GetNumEntries(PRUint32 *aNumEntries); \
NS_SCRIPTABLE NS_IMETHOD GetTypeOfIndex(PRUint32 aIndex, PRInt32 *_retval NS_OUTPARAM); \
NS_SCRIPTABLE NS_IMETHOD GetInt32(PRUint32 aIndex, PRInt32 *_retval NS_OUTPARAM); \
NS_SCRIPTABLE NS_IMETHOD GetInt64(PRUint32 aIndex, PRInt64 *_retval NS_OUTPARAM); \
NS_SCRIPTABLE NS_IMETHOD GetDouble(PRUint32 aIndex, double *_retval NS_OUTPARAM); \
NS_SCRIPTABLE NS_IMETHOD GetUTF8String(PRUint32 aIndex, nsACString & _retval NS_OUTPARAM); \
NS_SCRIPTABLE NS_IMETHOD GetString(PRUint32 aIndex, nsAString & _retval NS_OUTPARAM); \
NS_SCRIPTABLE NS_IMETHOD GetBlob(PRUint32 aIndex, PRUint32 *aDataSize NS_OUTPARAM, PRUint8 **aData NS_OUTPARAM); \
NS_SCRIPTABLE NS_IMETHOD GetIsNull(PRUint32 aIndex, PRBool *_retval NS_OUTPARAM); \
NS_IMETHOD GetSharedUTF8String(PRUint32 aIndex, PRUint32 *aLength NS_OUTPARAM, const char **aResult NS_OUTPARAM); \
NS_IMETHOD GetSharedString(PRUint32 aIndex, PRUint32 *aLength NS_OUTPARAM, const PRUnichar **aResult NS_OUTPARAM); \
NS_IMETHOD GetSharedBlob(PRUint32 aIndex, PRUint32 *aLength NS_OUTPARAM, const PRUint8 **aResult NS_OUTPARAM); \
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_MOZISTORAGESTATEMENT(_to) \
NS_SCRIPTABLE NS_IMETHOD Clone(mozIStorageStatement **_retval NS_OUTPARAM) { return _to Clone(_retval); } \
NS_SCRIPTABLE NS_IMETHOD GetParameterCount(PRUint32 *aParameterCount) { return _to GetParameterCount(aParameterCount); } \
NS_SCRIPTABLE NS_IMETHOD GetParameterName(PRUint32 aParamIndex, nsACString & _retval NS_OUTPARAM) { return _to GetParameterName(aParamIndex, _retval); } \
NS_SCRIPTABLE NS_IMETHOD GetParameterIndex(const nsACString & aName, PRUint32 *_retval NS_OUTPARAM) { return _to GetParameterIndex(aName, _retval); } \
NS_SCRIPTABLE NS_IMETHOD GetColumnCount(PRUint32 *aColumnCount) { return _to GetColumnCount(aColumnCount); } \
NS_SCRIPTABLE NS_IMETHOD GetColumnName(PRUint32 aColumnIndex, nsACString & _retval NS_OUTPARAM) { return _to GetColumnName(aColumnIndex, _retval); } \
NS_SCRIPTABLE NS_IMETHOD GetColumnIndex(const nsACString & aName, PRUint32 *_retval NS_OUTPARAM) { return _to GetColumnIndex(aName, _retval); } \
NS_SCRIPTABLE NS_IMETHOD GetColumnDecltype(PRUint32 aParamIndex, nsACString & _retval NS_OUTPARAM) { return _to GetColumnDecltype(aParamIndex, _retval); } \
NS_SCRIPTABLE NS_IMETHOD Reset(void) { return _to Reset(); } \
NS_SCRIPTABLE NS_IMETHOD Execute(void) { return _to Execute(); } \
NS_SCRIPTABLE NS_IMETHOD ExecuteStep(PRBool *_retval NS_OUTPARAM) { return _to ExecuteStep(_retval); } \
NS_SCRIPTABLE NS_IMETHOD GetNumEntries(PRUint32 *aNumEntries) { return _to GetNumEntries(aNumEntries); } \
NS_SCRIPTABLE NS_IMETHOD GetTypeOfIndex(PRUint32 aIndex, PRInt32 *_retval NS_OUTPARAM) { return _to GetTypeOfIndex(aIndex, _retval); } \
NS_SCRIPTABLE NS_IMETHOD GetInt32(PRUint32 aIndex, PRInt32 *_retval NS_OUTPARAM) { return _to GetInt32(aIndex, _retval); } \
NS_SCRIPTABLE NS_IMETHOD GetInt64(PRUint32 aIndex, PRInt64 *_retval NS_OUTPARAM) { return _to GetInt64(aIndex, _retval); } \
NS_SCRIPTABLE NS_IMETHOD GetDouble(PRUint32 aIndex, double *_retval NS_OUTPARAM) { return _to GetDouble(aIndex, _retval); } \
NS_SCRIPTABLE NS_IMETHOD GetUTF8String(PRUint32 aIndex, nsACString & _retval NS_OUTPARAM) { return _to GetUTF8String(aIndex, _retval); } \
NS_SCRIPTABLE NS_IMETHOD GetString(PRUint32 aIndex, nsAString & _retval NS_OUTPARAM) { return _to GetString(aIndex, _retval); } \
NS_SCRIPTABLE NS_IMETHOD GetBlob(PRUint32 aIndex, PRUint32 *aDataSize NS_OUTPARAM, PRUint8 **aData NS_OUTPARAM) { return _to GetBlob(aIndex, aDataSize, aData); } \
NS_SCRIPTABLE NS_IMETHOD GetIsNull(PRUint32 aIndex, PRBool *_retval NS_OUTPARAM) { return _to GetIsNull(aIndex, _retval); } \
NS_IMETHOD GetSharedUTF8String(PRUint32 aIndex, PRUint32 *aLength NS_OUTPARAM, const char **aResult NS_OUTPARAM) { return _to GetSharedUTF8String(aIndex, aLength, aResult); } \
NS_IMETHOD GetSharedString(PRUint32 aIndex, PRUint32 *aLength NS_OUTPARAM, const PRUnichar **aResult NS_OUTPARAM) { return _to GetSharedString(aIndex, aLength, aResult); } \
NS_IMETHOD GetSharedBlob(PRUint32 aIndex, PRUint32 *aLength NS_OUTPARAM, const PRUint8 **aResult NS_OUTPARAM) { return _to GetSharedBlob(aIndex, aLength, aResult); } \
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_MOZISTORAGESTATEMENT(_to) \
NS_SCRIPTABLE NS_IMETHOD Clone(mozIStorageStatement **_retval NS_OUTPARAM) { return !_to ? NS_ERROR_NULL_POINTER : _to->Clone(_retval); } \
NS_SCRIPTABLE NS_IMETHOD GetParameterCount(PRUint32 *aParameterCount) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetParameterCount(aParameterCount); } \
NS_SCRIPTABLE NS_IMETHOD GetParameterName(PRUint32 aParamIndex, nsACString & _retval NS_OUTPARAM) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetParameterName(aParamIndex, _retval); } \
NS_SCRIPTABLE NS_IMETHOD GetParameterIndex(const nsACString & aName, PRUint32 *_retval NS_OUTPARAM) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetParameterIndex(aName, _retval); } \
NS_SCRIPTABLE NS_IMETHOD GetColumnCount(PRUint32 *aColumnCount) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetColumnCount(aColumnCount); } \
NS_SCRIPTABLE NS_IMETHOD GetColumnName(PRUint32 aColumnIndex, nsACString & _retval NS_OUTPARAM) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetColumnName(aColumnIndex, _retval); } \
NS_SCRIPTABLE NS_IMETHOD GetColumnIndex(const nsACString & aName, PRUint32 *_retval NS_OUTPARAM) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetColumnIndex(aName, _retval); } \
NS_SCRIPTABLE NS_IMETHOD GetColumnDecltype(PRUint32 aParamIndex, nsACString & _retval NS_OUTPARAM) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetColumnDecltype(aParamIndex, _retval); } \
NS_SCRIPTABLE NS_IMETHOD Reset(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->Reset(); } \
NS_SCRIPTABLE NS_IMETHOD Execute(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->Execute(); } \
NS_SCRIPTABLE NS_IMETHOD ExecuteStep(PRBool *_retval NS_OUTPARAM) { return !_to ? NS_ERROR_NULL_POINTER : _to->ExecuteStep(_retval); } \
NS_SCRIPTABLE NS_IMETHOD GetNumEntries(PRUint32 *aNumEntries) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetNumEntries(aNumEntries); } \
NS_SCRIPTABLE NS_IMETHOD GetTypeOfIndex(PRUint32 aIndex, PRInt32 *_retval NS_OUTPARAM) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetTypeOfIndex(aIndex, _retval); } \
NS_SCRIPTABLE NS_IMETHOD GetInt32(PRUint32 aIndex, PRInt32 *_retval NS_OUTPARAM) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetInt32(aIndex, _retval); } \
NS_SCRIPTABLE NS_IMETHOD GetInt64(PRUint32 aIndex, PRInt64 *_retval NS_OUTPARAM) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetInt64(aIndex, _retval); } \
NS_SCRIPTABLE NS_IMETHOD GetDouble(PRUint32 aIndex, double *_retval NS_OUTPARAM) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetDouble(aIndex, _retval); } \
NS_SCRIPTABLE NS_IMETHOD GetUTF8String(PRUint32 aIndex, nsACString & _retval NS_OUTPARAM) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetUTF8String(aIndex, _retval); } \
NS_SCRIPTABLE NS_IMETHOD GetString(PRUint32 aIndex, nsAString & _retval NS_OUTPARAM) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetString(aIndex, _retval); } \
NS_SCRIPTABLE NS_IMETHOD GetBlob(PRUint32 aIndex, PRUint32 *aDataSize NS_OUTPARAM, PRUint8 **aData NS_OUTPARAM) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetBlob(aIndex, aDataSize, aData); } \
NS_SCRIPTABLE NS_IMETHOD GetIsNull(PRUint32 aIndex, PRBool *_retval NS_OUTPARAM) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetIsNull(aIndex, _retval); } \
NS_IMETHOD GetSharedUTF8String(PRUint32 aIndex, PRUint32 *aLength NS_OUTPARAM, const char **aResult NS_OUTPARAM) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetSharedUTF8String(aIndex, aLength, aResult); } \
NS_IMETHOD GetSharedString(PRUint32 aIndex, PRUint32 *aLength NS_OUTPARAM, const PRUnichar **aResult NS_OUTPARAM) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetSharedString(aIndex, aLength, aResult); } \
NS_IMETHOD GetSharedBlob(PRUint32 aIndex, PRUint32 *aLength NS_OUTPARAM, const PRUint8 **aResult NS_OUTPARAM) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetSharedBlob(aIndex, aLength, aResult); } \
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class _MYCLASS_ : public mozIStorageStatement
{
public:
NS_DECL_ISUPPORTS
NS_DECL_MOZISTORAGESTATEMENT
_MYCLASS_();
private:
~_MYCLASS_();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(_MYCLASS_, mozIStorageStatement)
_MYCLASS_::_MYCLASS_()
{
/* member initializers and constructor code */
}
_MYCLASS_::~_MYCLASS_()
{
/* destructor code */
}
/* mozIStorageStatement clone (); */
NS_IMETHODIMP _MYCLASS_::Clone(mozIStorageStatement **_retval NS_OUTPARAM)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute unsigned long parameterCount; */
NS_IMETHODIMP _MYCLASS_::GetParameterCount(PRUint32 *aParameterCount)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* AUTF8String getParameterName (in unsigned long aParamIndex); */
NS_IMETHODIMP _MYCLASS_::GetParameterName(PRUint32 aParamIndex, nsACString & _retval NS_OUTPARAM)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* unsigned long getParameterIndex (in AUTF8String aName); */
NS_IMETHODIMP _MYCLASS_::GetParameterIndex(const nsACString & aName, PRUint32 *_retval NS_OUTPARAM)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute unsigned long columnCount; */
NS_IMETHODIMP _MYCLASS_::GetColumnCount(PRUint32 *aColumnCount)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* AUTF8String getColumnName (in unsigned long aColumnIndex); */
NS_IMETHODIMP _MYCLASS_::GetColumnName(PRUint32 aColumnIndex, nsACString & _retval NS_OUTPARAM)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* unsigned long getColumnIndex (in AUTF8String aName); */
NS_IMETHODIMP _MYCLASS_::GetColumnIndex(const nsACString & aName, PRUint32 *_retval NS_OUTPARAM)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* AUTF8String getColumnDecltype (in unsigned long aParamIndex); */
NS_IMETHODIMP _MYCLASS_::GetColumnDecltype(PRUint32 aParamIndex, nsACString & _retval NS_OUTPARAM)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void reset (); */
NS_IMETHODIMP _MYCLASS_::Reset()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void execute (); */
NS_IMETHODIMP _MYCLASS_::Execute()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* boolean executeStep (); */
NS_IMETHODIMP _MYCLASS_::ExecuteStep(PRBool *_retval NS_OUTPARAM)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute unsigned long numEntries; */
NS_IMETHODIMP _MYCLASS_::GetNumEntries(PRUint32 *aNumEntries)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* long getTypeOfIndex (in unsigned long aIndex); */
NS_IMETHODIMP _MYCLASS_::GetTypeOfIndex(PRUint32 aIndex, PRInt32 *_retval NS_OUTPARAM)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* long getInt32 (in unsigned long aIndex); */
NS_IMETHODIMP _MYCLASS_::GetInt32(PRUint32 aIndex, PRInt32 *_retval NS_OUTPARAM)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* long long getInt64 (in unsigned long aIndex); */
NS_IMETHODIMP _MYCLASS_::GetInt64(PRUint32 aIndex, PRInt64 *_retval NS_OUTPARAM)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* double getDouble (in unsigned long aIndex); */
NS_IMETHODIMP _MYCLASS_::GetDouble(PRUint32 aIndex, double *_retval NS_OUTPARAM)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* AUTF8String getUTF8String (in unsigned long aIndex); */
NS_IMETHODIMP _MYCLASS_::GetUTF8String(PRUint32 aIndex, nsACString & _retval NS_OUTPARAM)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* AString getString (in unsigned long aIndex); */
NS_IMETHODIMP _MYCLASS_::GetString(PRUint32 aIndex, nsAString & _retval NS_OUTPARAM)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void getBlob (in unsigned long aIndex, out unsigned long aDataSize, [array, size_is (aDataSize)] out octet aData); */
NS_IMETHODIMP _MYCLASS_::GetBlob(PRUint32 aIndex, PRUint32 *aDataSize NS_OUTPARAM, PRUint8 **aData NS_OUTPARAM)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* boolean getIsNull (in unsigned long aIndex); */
NS_IMETHODIMP _MYCLASS_::GetIsNull(PRUint32 aIndex, PRBool *_retval NS_OUTPARAM)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* [noscript] void getSharedUTF8String (in unsigned long aIndex, out unsigned long aLength, [shared, retval] out string aResult); */
NS_IMETHODIMP _MYCLASS_::GetSharedUTF8String(PRUint32 aIndex, PRUint32 *aLength NS_OUTPARAM, const char **aResult NS_OUTPARAM)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* [noscript] void getSharedString (in unsigned long aIndex, out unsigned long aLength, [shared, retval] out wstring aResult); */
NS_IMETHODIMP _MYCLASS_::GetSharedString(PRUint32 aIndex, PRUint32 *aLength NS_OUTPARAM, const PRUnichar **aResult NS_OUTPARAM)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* [noscript] void getSharedBlob (in unsigned long aIndex, out unsigned long aLength, [shared, retval] out octetPtr aResult); */
NS_IMETHODIMP _MYCLASS_::GetSharedBlob(PRUint32 aIndex, PRUint32 *aLength NS_OUTPARAM, const PRUint8 **aResult NS_OUTPARAM)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_mozIStorageStatement_h__ */
| 44.736207 | 210 | 0.744903 |
8b11ee0482e3f0dc34f870063b266d54dfeacae9 | 15,473 | c | C | src/ARPACK/arpack-ng/EXAMPLES/NONSYM/sndrv1.c | wo80/vs-arpack | ee095e9abde0688f70c49ed22b84a1b91c736b53 | [
"BSD-3-Clause"
] | null | null | null | src/ARPACK/arpack-ng/EXAMPLES/NONSYM/sndrv1.c | wo80/vs-arpack | ee095e9abde0688f70c49ed22b84a1b91c736b53 | [
"BSD-3-Clause"
] | 3 | 2018-09-22T14:16:29.000Z | 2020-06-30T23:56:20.000Z | src/ARPACK/arpack-ng/EXAMPLES/NONSYM/sndrv1.c | wo80/vs-arpack | ee095e9abde0688f70c49ed22b84a1b91c736b53 | [
"BSD-3-Clause"
] | 1 | 2021-11-15T02:21:42.000Z | 2021-11-15T02:21:42.000Z | /* EXAMPLES\NONSYM\sndrv1.f -- translated by f2c (version 20100827). */
#include <stdlib.h>
#include "arpack.h"
/**
* \BeginDoc
*
* Example program to illustrate the idea of reverse communication
* for a standard nonsymmetric eigenvalue problem.
*
* We implement example one of ex-nonsym.doc in DOCUMENTS directory
*
* \Example-1
* ... Suppose we want to solve A*x = lambda*x in regular mode,
* where A is obtained from the standard central difference
* discretization of the convection-diffusion operator
* (Laplacian u) + rho*(du / dx)
* on the unit square [0,1]x[0,1] with zero Dirichlet boundary
* condition.
*
* ... OP = A and B = I.
*
* ... Assume "call av (nx,x,y)" computes y = A*x.c
*
* ... Use mode 1 of SNAUPD.
*
* \EndDoc
*
* \BeginLib
*
* \Routines called:
* snaupd ARPACK reverse communication interface routine.
* sneupd ARPACK routine that returns Ritz values and (optionally)
* Ritz vectors.
* slapy2 LAPACK routine to compute sqrt(x**2+y**2) carefully.
* saxpy Level 1 BLAS that computes y <- alpha*x+y.
* snrm2 Level 1 BLAS that computes the norm of a vector.
* av Matrix vector multiplication routine that computes A*x.
* tv Matrix vector multiplication routine that computes T*x,
* where T is a tridiagonal matrix. It is used in routine
* av.
*
* \EndLib
*/
int sndrv1()
{
/* System generated locals */
float r__1;
/* Local variables */
float d[90] /* (3 * MAXNCV) */;
float workev[90];
float sigmar, sigmai;
int j;
int ierr, nconv;
int ishfts, maxitr, mode;
int ipntr[14];
int iparam[11];
bool select[30];
bool first, rvec;
/* Define maximum dimensions for all arrays. */
const int MAXN = 256; /* Maximum dimension of the A allowed. */
const int MAXNEV = 12; /* Maximum NEV allowed */
const int MAXNCV = 30; /* Maximum NCV allowed */
/* ------------------------------------------------ */
/* The number NX is the number of interior points */
/* in the discretization of the 2-dimensional */
/* convection-diffusion operator on the unit */
/* square with zero Dirichlet boundary condition. */
/* The number N(=NX*NX) is the dimension of the */
/* matrix. A standard eigenvalue problem is */
/* solved (BMAT = 'I'). NEV is the number of */
/* eigenvalues to be approximated. The user can */
/* modify NX, NEV, NCV, WHICH to solve problems of */
/* different sizes, and to get different parts of */
/* the spectrum. However, The following */
/* conditions must be satisfied: */
/* N <= MAXN */
/* NEV <= MAXNEV */
/* NEV + 2 <= NCV <= MAXNCV */
/* ------------------------------------------------ */
int nx = 10;
int n = nx * nx;
int nev = 4;
int ncv = 20;
if (n > 256)
{
printf(" ERROR with _NDRV1: N is greater than MAXN \n");
return 0;
}
else if (nev > 12)
{
printf(" ERROR with _NDRV1: NEV is greater than MAXNEV \n");
return 0;
}
else if (ncv > 30)
{
printf(" ERROR with _NDRV1: NCV is greater than MAXNCV \n");
return 0;
}
char* bmat = "I";
char* which = "SM";
/* --------------------------------------------------- */
/* The work array WORKL is used in SNAUPD as */
/* workspace. Its dimension LWORKL is set as */
/* illustrated below. The parameter TOL determines */
/* the stopping criterion. If TOL<=0, machine */
/* precision is used. The variable IDO is used for */
/* reverse communication, and is initially set to 0. */
/* Setting INFO=0 indicates that a random vector is */
/* generated in SNAUPD to start the Arnoldi iteration. */
/* --------------------------------------------------- */
int lworkl = ncv * ncv * 3 + ncv * 6;
float tol = 0.0f;
int ido = 0;
int info = 0;
float* ax = (float*)malloc(n * sizeof(float));
float* resid = (float*)malloc(n * sizeof(float));
float* v = (float*)malloc(n * ncv * sizeof(float));
float* workl = (float*)malloc(lworkl * sizeof(float));
float* workd = (float*)malloc(3 * n * sizeof(float));
/* ------------------------------------------------- */
/* This program uses exact shifts with respect to */
/* the current Hessenberg matrix (IPARAM(1) = 1). */
/* IPARAM(3) specifies the maximum number of Arnoldi */
/* iterations allowed. Mode 1 of SNAUPD is used */
/* (IPARAM(7) = 1). All these options can be changed */
/* by the user. For details see the documentation in */
/* SNAUPD. */
/* ------------------------------------------------- */
ishfts = 1;
maxitr = 300;
mode = 1;
iparam[0] = ishfts;
iparam[2] = maxitr;
iparam[6] = mode;
/* ----------------------------------------- */
/* M A I N L O O P (Reverse communication) */
/* ----------------------------------------- */
L10:
/* ------------------------------------------- */
/* Repeatedly call the routine SNAUPD and take */
/* actions indicated by parameter IDO until */
/* either convergence is indicated or maxitr */
/* has been exceeded. */
/* ------------------------------------------- */
snaupd_(&ido, bmat, &n, which, &nev, &tol, resid, &ncv, v, &n, iparam, ipntr, workd, workl, &lworkl, &info);
if (ido == -1 || ido == 1)
{
/* ----------------------------------------- */
/* Perform matrix vector multiplication */
/* y <--- OP*x */
/* The user should supply his/her own */
/* matrix vector multiplication routine here */
/* that takes workd(ipntr(1)) as the input */
/* vector, and return the matrix vector */
/* product to workd(ipntr(2)). */
/* ----------------------------------------- */
sndrv1_av_(nx, &workd[ipntr[0] - 1], &workd[ipntr[1] - 1]);
/* --------------------------------------- */
/* L O O P B A C K to call SNAUPD again. */
/* --------------------------------------- */
goto L10;
}
/* -------------------------------------- */
/* Either we have convergence or there is */
/* an error. */
/* -------------------------------------- */
if (info < 0)
{
/* ------------------------ */
/* Error message, check the */
/* documentation in SNAUPD. */
/* ------------------------ */
printf(" \n");
printf(" Error with _naupd info = %d\n", info);
printf(" Check the documentation of _naupd.\n");
printf(" \n");
ierr = info;
goto EXIT;
}
/* ----------------------------------------- */
/* No fatal errors occurred. */
/* Post-Process using SNEUPD. */
/* */
/* Computed eigenvalues may be extracted. */
/* */
/* Eigenvectors may also be computed now if */
/* desired. (indicated by rvec = .true.) */
/* ----------------------------------------- */
rvec = true;
sneupd_(&rvec, "A", select, d, &d[30], v, &n, &sigmar, &sigmai, workev, bmat, &n, which, &nev, &tol, resid, &ncv, v, &n, iparam, ipntr, workd, workl, &lworkl, &ierr);
/* --------------------------------------------- */
/* The real part of the eigenvalue is returned */
/* in the first column of the two dimensional */
/* array D, and the imaginary part is returned */
/* in the second column of D. The corresponding */
/* eigenvectors are returned in the first NEV */
/* columns of the two dimensional array V if */
/* requested. Otherwise, an orthogonal basis */
/* for the invariant subspace corresponding to */
/* the eigenvalues in D is returned in V. */
/* --------------------------------------------- */
if (ierr != 0)
{
/* ---------------------------------- */
/* Error condition: */
/* Check the documentation of SNEUPD. */
/* ---------------------------------- */
printf(" \n");
printf(" Error with _neupd info = %d\n", ierr);
printf(" Check the documentation of _neupd. \n");
printf(" \n");
goto EXIT;
}
first = true;
nconv = iparam[4];
for (j = 1; j <= nconv; ++j)
{
int k = (j - 1) * n;
/* ------------------------- */
/* Compute the residual norm */
/* */
/* || A*x - lambda*x || */
/* */
/* for the NCONV accurately */
/* computed eigenvalues and */
/* eigenvectors. (iparam(5) */
/* indicates how many are */
/* accurate to the requested */
/* tolerance) */
/* ------------------------- */
if (d[j + 29] == 0.0f)
{
/* ------------------ */
/* Ritz value is real */
/* ------------------ */
sndrv1_av_(nx, &v[k], ax);
r__1 = -d[j - 1];
saxpy_(&n, &r__1, &v[k], &c__1, ax, &c__1);
d[j + 59] = snrm2_(&n, ax, &c__1);
d[j + 59] /= (r__1 = d[j - 1], dabs(r__1));
}
else if (first)
{
/* ---------------------- */
/* Ritz value is complex. */
/* Residual of one Ritz */
/* value of the conjugate */
/* pair is computed. */
/* ---------------------- */
sndrv1_av_(nx, &v[k], ax);
r__1 = -d[j - 1];
saxpy_(&n, &r__1, &v[k], &c__1, ax, &c__1);
saxpy_(&n, &d[j + 29], &v[j * n], &c__1, ax, &c__1);
d[j + 59] = snrm2_(&n, ax, &c__1);
sndrv1_av_(nx, &v[j * n], ax);
r__1 = -d[j + 29];
saxpy_(&n, &r__1, &v[k], &c__1, ax, &c__1);
r__1 = -d[j - 1];
saxpy_(&n, &r__1, &v[j * n], &c__1, ax, &c__1);
r__1 = snrm2_(&n, ax, &c__1);
d[j + 59] = slapy2_(&d[j + 59], &r__1);
d[j + 59] /= slapy2_(&d[j - 1], &d[j + 29]);
d[j + 60] = d[j + 59];
first = false;
}
else
{
first = true;
}
}
/* --------------------------- */
/* Display computed residuals. */
/* --------------------------- */
smout_(&nconv, &c__3, d, &c__30, &c_n6, "Ritz values (Real,Imag) and relative residuals");
/* ----------------------------------------- */
/* Print additional convergence information. */
/* ----------------------------------------- */
if (info == 1)
{
printf(" \n");
printf(" Maximum number of iterations reached.\n");
printf(" \n");
}
else if (info == 3)
{
printf(" \n");
printf(" No shifts could be applied during implicit\n");
printf(" Arnoldi update try increasing NCV.\n");
printf(" \n");
}
printf(" \n");
printf(" _NDRV1 \n");
printf(" ====== \n");
printf(" \n");
printf(" Size of the matrix is %d\n", n);
printf(" The number of Ritz values requested is %d\n", nev);
printf(" The number of Arnoldi vectors generated (NCV) is %d\n", ncv);
printf(" What portion of the spectrum: %s\n", which);
printf(" The number of converged Ritz values is %d\n", nconv);
printf(" The number of Implicit Arnoldi update iterations taken is %d\n", iparam[2]);
printf(" The number of OP*x is %d\n", iparam[8]);
printf(" The convergence criterion is %e\n", tol);
printf(" \n");
EXIT:
free(ax);
free(resid);
free(v);
free(workl);
free(workd);
/* ------------------------- */
/* Done with program sndrv1. */
/* ------------------------- */
return ierr;
}
/* ========================================================================== */
/* matrix vector subroutine */
/* The matrix used is the 2 dimensional convection-diffusion */
/* operator discretized using central difference. */
int sndrv1_av_(const int nx, float *v, float *w)
{
/* System generated locals */
int i__1;
float r__1;
/* Local variables */
int j;
float h2;
int lo;
/* Computes w <--- OP*v, where OP is the nx*nx by nx*nx block */
/* tridiagonal matrix */
/* | T -I | */
/* |-I T -I | */
/* OP = | -I T | */
/* | ... -I| */
/* | -I T| */
/* derived from the standard central difference discretization */
/* of the 2 dimensional convection-diffusion operator */
/* (Laplacian u) + rho*(du/dx) on a unit square with zero boundary */
/* condition. */
/* When rho*h/2 <= 1, the discrete convection-diffusion operator */
/* has real eigenvalues. When rho*h/2 > 1, it has COMPLEX */
/* eigenvalues. */
/* The subroutine TV is called to compute y<---T*x. */
/* Parameter adjustments */
--w;
--v;
/* Function Body */
h2 = 1.0f / (float) ((nx + 1) * (nx + 1));
sndrv1_tv_(nx, &v[1], &w[1]);
r__1 = -1.0f / h2;
saxpy_(&nx, &r__1, &v[nx + 1], &c__1, &w[1], &c__1);
i__1 = nx - 1;
for (j = 2; j <= i__1; ++j)
{
lo = (j - 1) * nx;
sndrv1_tv_(nx, &v[lo + 1], &w[lo + 1]);
r__1 = -1.0f / h2;
saxpy_(&nx, &r__1, &v[lo - nx + 1], &c__1, &w[lo + 1], &c__1);
r__1 = -1.0f / h2;
saxpy_(&nx, &r__1, &v[lo + nx + 1], &c__1, &w[lo + 1], &c__1);
}
lo = (nx - 1) * nx;
sndrv1_tv_(nx, &v[lo + 1], &w[lo + 1]);
r__1 = -1.0f / h2;
saxpy_(&nx, &r__1, &v[lo - nx + 1], &c__1, &w[lo + 1], &c__1);
return 0;
} /* av_ */
/* ========================================================================= */
int sndrv1_tv_(const int nx, float *x, float *y)
{
/* System generated locals */
int i__1;
/* Local variables */
float h;
int j;
float h2, dd, dl, du;
/* Compute the matrix vector multiplication y<---T*x */
/* where T is a nx by nx tridiagonal matrix with DD on the */
/* diagonal, DL on the subdiagonal, and DU on the superdiagonal. */
/* When rho*h/2 <= 1, the discrete convection-diffusion operator */
/* has real eigenvalues. When rho*h/2 > 1, it has COMPLEX */
/* eigenvalues. */
/* Parameter adjustments */
--y;
--x;
/* Function Body */
h = 1.0f / (float) (nx + 1);
h2 = h * h;
dd = 4.0f / h2;
dl = -1.0f / h2 - 0.0f / h;
du = -1.0f / h2 + 0.0f / h;
y[1] = dd * x[1] + du * x[2];
i__1 = nx - 1;
for (j = 2; j <= i__1; ++j)
{
y[j] = dl * x[j - 1] + dd * x[j] + du * x[j + 1];
}
y[nx] = dl * x[nx - 1] + dd * x[nx];
return 0;
} /* tv_ */
| 32.712474 | 170 | 0.437342 |
5b31822302a4d9765015aa4eaeb0fcfe9fa8f632 | 1,888 | h | C | src/internal.h | Palem1988/libwally-core | eadc2479dfcab2532195bd2c1a91d9f5bbe7f4d7 | [
"MIT"
] | null | null | null | src/internal.h | Palem1988/libwally-core | eadc2479dfcab2532195bd2c1a91d9f5bbe7f4d7 | [
"MIT"
] | null | null | null | src/internal.h | Palem1988/libwally-core | eadc2479dfcab2532195bd2c1a91d9f5bbe7f4d7 | [
"MIT"
] | null | null | null | #ifndef LIBWALLY_INTERNAL_H
#define LIBWALLY_INTERNAL_H
#include <include/wally_core.h>
#include "secp256k1/include/secp256k1.h"
#include "secp256k1/include/secp256k1_recovery.h"
#include <config.h>
#include <string.h>
/* Fetch an internal secp context */
const secp256k1_context *secp_ctx(void);
#define secp256k1_context_destroy(c) _do_not_destroy_shared_ctx_pointers(c)
#define pubkey_create secp256k1_ec_pubkey_create
#define pubkey_parse secp256k1_ec_pubkey_parse
#define pubkey_tweak_add secp256k1_ec_pubkey_tweak_add
#define pubkey_serialize secp256k1_ec_pubkey_serialize
#define privkey_tweak_add secp256k1_ec_privkey_tweak_add
#define PUBKEY_COMPRESSED SECP256K1_EC_COMPRESSED
#define PUBKEY_UNCOMPRESSED SECP256K1_EC_UNCOMPRESSED
void wally_clear(void *p, size_t len);
void wally_clear_2(void *p, size_t len, void *p2, size_t len2);
void wally_clear_3(void *p, size_t len, void *p2, size_t len2,
void *p3, size_t len3);
void wally_clear_4(void *p, size_t len, void *p2, size_t len2,
void *p3, size_t len3, void *p4, size_t len4);
void wally_clear_5(void *p, size_t len, void *p2, size_t len2,
void *p3, size_t len3, void *p4, size_t len4,
void *p5, size_t len5);
void wally_clear_6(void *p, size_t len, void *p2, size_t len2,
void *p3, size_t len3, void *p4, size_t len4,
void *p5, size_t len5, void *p6, size_t len6);
/* Fetch our internal operations function pointers */
const struct wally_operations *wally_ops(void);
void *wally_malloc(size_t size);
void wally_free(void *ptr);
char *wally_strdup(const char *str);
#define malloc(size) __use_wally_malloc_internally__
#define free(ptr) __use_wally_free_internally__
#ifdef strdup
#undef strdup
#endif
#define strdup(ptr) __use_wally_strdup_internally__
#endif /* LIBWALLY_INTERNAL_H */
| 35.622642 | 75 | 0.747881 |
1262d98c6fbe4d53f97d13fcaf53597e7a3088d8 | 20 | c | C | game/items/i.a.r.c | max-dark/amulet-review | 7e9a6d460d269854f56aa466736599c64e78410f | [
"MIT"
] | 5 | 2017-12-31T23:46:31.000Z | 2022-02-15T01:22:38.000Z | game/items/i.a.r.c | maslanin/amulet-review | 7e9a6d460d269854f56aa466736599c64e78410f | [
"MIT"
] | null | null | null | game/items/i.a.r.c | maslanin/amulet-review | 7e9a6d460d269854f56aa466736599c64e78410f | [
"MIT"
] | 5 | 2019-01-01T10:00:37.000Z | 2021-11-08T13:09:11.000Z | черная рубашка|12|0| | 20 | 20 | 0.8 |
126458b19cedae6806ddc11d0945e012ee4969b6 | 432 | h | C | Nano/Classes/WatchDog/Trace/NanoLog/NanoLog.h | steven0610/Nano | 314b038c7bdb9b95f43ae3f3e193837c78316704 | [
"MIT"
] | null | null | null | Nano/Classes/WatchDog/Trace/NanoLog/NanoLog.h | steven0610/Nano | 314b038c7bdb9b95f43ae3f3e193837c78316704 | [
"MIT"
] | null | null | null | Nano/Classes/WatchDog/Trace/NanoLog/NanoLog.h | steven0610/Nano | 314b038c7bdb9b95f43ae3f3e193837c78316704 | [
"MIT"
] | null | null | null | //
// NanoLog.h
// NanoDemo
//
// Created by steven on 2018/8/28.
// Copyright © 2018年 Steven. All rights reserved.
//
#import <Foundation/Foundation.h>
@protocol NanoLogProtocol <NSObject>
- (void)nanoLogDelegateWithLogs:(NSString*)log; //如果需要写入定制的日志系统,可以通过此处获得
@end
@interface NanoLog : NSObject
@property(nonatomic,weak)id<NanoLogProtocol> delegate;
+ (NanoLog *)shareInstance;
-(void)printLogs:(NSString*)logs;
@end
| 18 | 73 | 0.729167 |
0ef1309346bbd48a69fef3be99b50f387915b1b1 | 496 | c | C | EngineHacks/CoreHacks/StrMagChaSplit/OffsetGetter/OffsetGetter.c | MokhaLeee/FE16re-Proto | a3bf9ea299f117de0dc90aa4b139bd4f8167418e | [
"MIT"
] | 5 | 2021-11-28T19:51:03.000Z | 2021-12-25T06:15:13.000Z | EngineHacks/CoreHacks/StrMagChaSplit/OffsetGetter/OffsetGetter.c | MokhaLeee/FE16re-Proto | a3bf9ea299f117de0dc90aa4b139bd4f8167418e | [
"MIT"
] | null | null | null | EngineHacks/CoreHacks/StrMagChaSplit/OffsetGetter/OffsetGetter.c | MokhaLeee/FE16re-Proto | a3bf9ea299f117de0dc90aa4b139bd4f8167418e | [
"MIT"
] | null | null | null | #include "gbafe.h"
#include "StrMagCha.h"
s8* GetMagAt(Unit* unit){
return ( (s8*)unit + 0x3A );
}
s8* GetChaAt(Unit* unit){
return ( (s8*)unit + 0x3B );
}
s8* GetBu_ChangeMagAt(struct BattleUnit* bu){
return &bu->changeCon;
}
s8* GetBu_ChangeChaAt(struct BattleUnit* bu){
return ( (s8*)bu + 0x7F );
}
s8 GetClassMaxMag(Unit* unit){
return gpClassMagicTable[unit->pClassData->number].Cap;
}
s8 GetClassMaxCha(Unit* unit){
return gpClassCharmTable[unit->pClassData->number].Cap;
}
| 16 | 56 | 0.691532 |
164c4caa9ba230b42329748dabb84afddb4ecfc6 | 23,336 | h | C | TsunamiObjects.h | dgrzan/TsunamiSquaresDavid | 99645be8f4e66a268557506c5971128f24e2b94b | [
"MIT"
] | null | null | null | TsunamiObjects.h | dgrzan/TsunamiSquaresDavid | 99645be8f4e66a268557506c5971128f24e2b94b | [
"MIT"
] | null | null | null | TsunamiObjects.h | dgrzan/TsunamiSquaresDavid | 99645be8f4e66a268557506c5971128f24e2b94b | [
"MIT"
] | null | null | null | // Copyright (c) 2015-2019 John M. Wilson, Kasey W. Schultz
//
// 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.
#define UNDEFINED_ELEMENT_ID UINT_MAX
#include <string.h>
#include <fstream>
#include <map>
#include <stdlib.h>
#include "TsunamiUtil.h"
namespace tsunamisquares {
typedef unsigned int UIndex;
static const UIndex INVALID_INDEX = std::numeric_limits<unsigned int>::max();
//// INVALID_INDEX = 4294967295;
class ModelIO {
private:
std::string _comment;
protected:
std::string comment(void) const {
return _comment;
};
void set_comment(std::string new_comment) {
_comment = new_comment;
};
std::string next_line(std::istream &in_stream);
void next_line(std::ostream &out_stream) const;
};
struct FieldDesc {
std::string name;
std::string details;
};
typedef struct FieldDesc FieldDesc;
typedef std::set<UIndex> SquareIDSet;
// Squares, the functional members of Tsunami Square
struct SquareData {
UIndex _id;
double _lat, _lon, _alt, _area;
Vec<2> _velocity;
Vec<2> _accel;
double _height;
double _friction;
double _density;
// updated data are used to keep track of volume/momentum redistribution from other squares
double _updated_height;
Vec<2> _updated_momentum;
};
class Square : public ModelIO {
private:
SquareData _data;
UIndex _top, _bottom, _right, _left, _top_right, _top_left, _bottom_left, _bottom_right;
std::map<UIndex, Vec<2> > _local_neighbor_coords;
std::vector<bool> _invalid_directions;
unsigned int _blocks_from_edge;
unsigned int _blocks_from_edgex;
unsigned int _blocks_from_edgey;
unsigned int _2Dindeces[2];
float _damping_factor;
std::map<UIndex, double> _diffusion_fractions;
Vec<3> _pos;
box_spheq _box;
public:
Square(void) {
_data._id = INVALID_INDEX;
_data._lat = _data._lon = _data._alt = _data._area = std::numeric_limits<double>::quiet_NaN();
_pos = Vec<3>();
_data._velocity = _data._accel = _data._updated_momentum = Vec<2>(0.0,0.0);
_data._height = _data._updated_height = 0.0;//std::numeric_limits<double>::quiet_NaN();
_data._density = 1025.0; // sea water by default
_data._friction = 0.00001;//0.02;
_invalid_directions = std::vector<bool>(4, false);
_blocks_from_edge = 0;
_2Dindeces[0] = std::numeric_limits<unsigned int>::quiet_NaN();
_2Dindeces[1] = std::numeric_limits<unsigned int>::quiet_NaN();
_damping_factor = 0;
_left = _right = _top = _bottom = INVALID_INDEX;
_top_right = _top_left = _bottom_left = _bottom_right = INVALID_INDEX;
};
void clear(void);
SquareData data(void) const {
return _data;
};
UIndex id(void) const {
return _data._id;
};
void set_id(const UIndex &id) {
_data._id = id;
};
double height(void) const {
return _data._height;
};
void set_height(const double &new_height) {
_data._height = new_height;
};
double updated_height(void) const {
return _data._updated_height;
};
void set_updated_height(const double &new_height) {
_data._updated_height = new_height;
};
double density(void) const {
return _data._density;
};
void set_density(const double &new_density) {
_data._density = new_density;
};
float damping_factor(void) const {
return _damping_factor;
};
void set_damping_factor(const double &new_damping_factor) {
_damping_factor = new_damping_factor;
};
Vec<2> velocity(void) const {
return _data._velocity;
};
void set_velocity(const Vec<2> &new_velocity) {
_data._velocity = new_velocity;
};
Vec<2> updated_momentum(void) const {
return _data._updated_momentum;
};
void set_updated_momentum(const Vec<2> &new_momentum) {
_data._updated_momentum = new_momentum;
};
Vec<2> accel(void) const {
return _data._accel;
};
void set_accel(const Vec<2> &new_accel) {
_data._accel = new_accel;
}
double friction(void) const {
if (_pos[2] <= 0 ){
return 0.00001;
} else {
return 0.0001;
}
//return _data._friction;
}
void set_friction(const double &new_friction) {
_data._friction = new_friction;
}
void set_box(const double &dlon, const double &dlat) {
_box = box_spheq(point_spheq(_pos[0]-dlon/2, _pos[1]-dlat/2), point_spheq(_pos[0]+dlon/2, _pos[1]+dlat/2));
// Set area when we set box
//_data._area = bg::area(ring())*EARTH_MEAN_RADIUS*EARTH_MEAN_RADIUS;
Geodesic geod(EARTH_MEAN_RADIUS, 0);
PolygonArea geo_poly(geod);
geo_poly.AddPoint(_pos[1]-dlat/2, _pos[0]-dlon/2);
geo_poly.AddPoint(_pos[1]-dlat/2, _pos[0]+dlon/2);
geo_poly.AddPoint(_pos[1]+dlat/2, _pos[0]+dlon/2);
geo_poly.AddPoint(_pos[1]+dlat/2, _pos[0]-dlon/2);
//CONSTANT AREA
/*
geo_poly.AddPoint(0-dlat/2, 0-dlon/2);
geo_poly.AddPoint(0-dlat/2, 0+dlon/2);
geo_poly.AddPoint(0+dlat/2, 0+dlon/2);
geo_poly.AddPoint(0+dlat/2, 0-dlon/2);
*/
double perimeter, area;
unsigned n = geo_poly.Compute(false, true, perimeter, area);
_data._area = area;
}
box_spheq box(void) const {
return _box;
}
ring_spheq ring(void) const {
ring_spheq box_ring;
bg::assign(box_ring, box());
return box_ring;
}
poly_spheq polygon(void) const {
poly_spheq box_poly;
bg::assign(box_poly, box());
return box_poly;
}
double area(void) const {
return _data._area;
}
double volume(void) const {
return area()*_data._height;
};
double mass(void) const {
return _data._density*volume();
};
Vec<2> momentum(void) const {
return _data._velocity*mass();
};
std::vector<bool> invalid_directions(void) {
return _invalid_directions;
}
void set_invalid_directions(const std::vector<bool> &new_invalid_directions) {
for(int i=0;i<4;i++){
_invalid_directions[i] = new_invalid_directions[i];
}
}
unsigned int blocks_from_edge(void) const{
return _blocks_from_edge;
}
unsigned int blocks_from_edgex(void) const{
return _blocks_from_edgex;
}
unsigned int blocks_from_edgey(void) const{
return _blocks_from_edgey;
}
void set_blocks_from_edge(const unsigned int &new_blocks_from_edge) {
_blocks_from_edge = new_blocks_from_edge;
}
void set_blocks_from_edgex(const unsigned int &new_blocks_from_edge) {
_blocks_from_edgex = new_blocks_from_edge;
}
void set_blocks_from_edgey(const unsigned int &new_blocks_from_edge) {
_blocks_from_edgey = new_blocks_from_edge;
}
unsigned int xind(void){
return _2Dindeces[0];
}
void set_xind(const unsigned int &new_xind){
_2Dindeces[0] = new_xind;
}
unsigned int yind(void){
return _2Dindeces[1];
}
void set_yind(const unsigned int &new_yind){
_2Dindeces[1] = new_yind;
}
std::map<UIndex, Vec<2> > local_neighbor_coords(void) const {
return _local_neighbor_coords;
}
void set_local_neighbor_coords(const std::map<UIndex, Vec<2> > coord_map) {
_local_neighbor_coords = coord_map;
}
std::map<UIndex, double > diffusion_fractions(void) const {
return _diffusion_fractions;
}
void set_diffusion_fractions(const std::map<UIndex, double> fract_map) {
_diffusion_fractions = fract_map;
}
// All functions with top/bottom/left/right are setting the IDs of the corresponding
// neighboring squares. Left/Right/Top/Bottom are nearest neighbors, the others are
// next-nearest neighbors.
void set_top(const UIndex &id) {
_top = id;
};
UIndex top(void) const {
return _top;
};
void set_right(const UIndex &id) {
_right = id;
};
UIndex right(void) const {
return _right;
};
void set_left(const UIndex &id) {
_left = id;
};
UIndex left(void) const {
return _left;
};
void set_bottom(const UIndex &id) {
_bottom = id;
};
UIndex bottom(void) const {
return _bottom;
};
void set_top_left(const UIndex &id) {
_top_left = id;
};
UIndex top_left(void) const {
return _top_left;
};
void set_top_right(const UIndex &id) {
_top_right = id;
};
UIndex top_right(void) const {
return _top_right;
};
void set_bottom_left(const UIndex &id) {
_bottom_left = id;
};
UIndex bottom_left(void) const {
return _bottom_left;
};
void set_bottom_right(const UIndex &id) {
_bottom_right = id;
};
UIndex bottom_right(void) const {
return _bottom_right;
};
SquareIDSet get_valid_neighbors(void) const {
SquareIDSet valid_neighbors;
if (left() != INVALID_INDEX) valid_neighbors.insert(left());
if (right() != INVALID_INDEX) valid_neighbors.insert(right());
if (top() != INVALID_INDEX) valid_neighbors.insert(top());
if (bottom() != INVALID_INDEX) valid_neighbors.insert(bottom());
if (top_left() != INVALID_INDEX) valid_neighbors.insert(top_left());
if (bottom_left() != INVALID_INDEX) valid_neighbors.insert(bottom_left());
if (top_right() != INVALID_INDEX) valid_neighbors.insert(top_right());
if (bottom_right() != INVALID_INDEX) valid_neighbors.insert(bottom_right());
return valid_neighbors;
};
SquareIDSet get_valid_nearest_neighbors(void) const {
SquareIDSet valid_neighbors;
if (left() != INVALID_INDEX) valid_neighbors.insert(left());
if (right() != INVALID_INDEX) valid_neighbors.insert(right());
if (top() != INVALID_INDEX) valid_neighbors.insert(top());
if (bottom() != INVALID_INDEX) valid_neighbors.insert(bottom());
return valid_neighbors;
};
SquareIDSet get_valid_nextnearest_neighbors(void) const {
SquareIDSet valid_neighbors;
if (top_left() != INVALID_INDEX) valid_neighbors.insert(top_left());
if (bottom_left() != INVALID_INDEX) valid_neighbors.insert(bottom_left());
if (top_right() != INVALID_INDEX) valid_neighbors.insert(top_right());
if (bottom_right()!= INVALID_INDEX) valid_neighbors.insert(bottom_right());
return valid_neighbors;
};
SquareIDSet get_neighbors_and_self(void) const {
SquareIDSet valid_neighbors;
if (left() != INVALID_INDEX) valid_neighbors.insert(left());
if (right() != INVALID_INDEX) valid_neighbors.insert(right());
if (top() != INVALID_INDEX) valid_neighbors.insert(top());
if (bottom() != INVALID_INDEX) valid_neighbors.insert(bottom());
if (top_left() != INVALID_INDEX) valid_neighbors.insert(top_left());
if (bottom_left() != INVALID_INDEX) valid_neighbors.insert(bottom_left());
if (top_right() != INVALID_INDEX) valid_neighbors.insert(top_right());
if (bottom_right()!= INVALID_INDEX) valid_neighbors.insert(bottom_right());
valid_neighbors.insert(id());
return valid_neighbors;
};
void print_neighbors(void) {
std::cout << "--- #" << id() << " ------------" << std::endl;
std::cout << " left:\t\t" << left() << std::endl;
std::cout << " right:\t\t" << right() << std::endl;
std::cout << " top:\t\t" << top() << std::endl;
std::cout << " bottom:\t" << bottom() << std::endl;
std::cout << " t left:\t" << top_left() << std::endl;
std::cout << " t right:\t" << top_right() << std::endl;
std::cout << " b left:\t" << bottom_left() << std::endl;
std::cout << " b right:\t" << bottom_right() << std::endl;
}
LatLonDepth lld(void) const {
return LatLonDepth(_data._lat, _data._lon, _data._alt);
};
void set_lld(const LatLonDepth &lld) {
_data._lat = lld.lat();
_data._lon = lld.lon();
_data._alt = lld.altitude();
_pos = Vec<3>(_data._lon, _data._lat, _data._alt);
// TEMPORARY FIX TO LET (X,Y,Z) = (LON,LAT,ALT), we'll later get rid of lld entirely
//_pos = Vec<3>(lld.lon(), lld.lat(), lld.altitude());
};
Vec<3> xyz(void) const {
return _pos;
};
Vec<2> xy(void) const {
Vec<2> pos_xy;
pos_xy[0] = _pos[0];
pos_xy[1] = _pos[1];
return pos_xy;
};
void read_bathymetry(std::istream &in_stream);
};
// Class to contain all Squares and Bathymetry
class World : public ModelIO {
private:
std::map<UIndex, Square> _squares;
LatLonDepth _base;
double _min_lat, _max_lat, _min_lon, _max_lon, _dlat, _dlon;
double _max_depth, _min_spacing, _tot_volume, _max_overlap_error;
int _num_latitudes, _num_longitudes;
RTree_spheq _square_rtree, _wet_rtree;
double apply_diffusion(std::map<UIndex, Square>::iterator& sit);
public:
double prevenergy;
double beforemoveE;
double startenergy;
double newPE;
double newKE;
double dtt;
Square &new_square(void);
Square &square(const UIndex &ind);
const Square &const_square(const UIndex &ind) const;
UIndex next_square_index(void) const {
if (_squares.size()) return _squares.rbegin()->first+1;
else return 0;
};
size_t num_squares(void) const;
size_t num_vertices(void) const;
void insert(Square &new_square);
void clear(void);
LatLonDepth getBase(void) const {
return _base;
}
int num_lats(void) const {
return _num_latitudes;
}
int num_lons(void) const {
return _num_longitudes;
}
double min_lat(void) const {
return _min_lat;
}
double max_lat(void) const {
return _max_lat;
}
double min_lon(void) const {
return _min_lon;
}
double max_lon(void) const {
return _max_lon;
}
double dlon(void) const {
return _dlon;
}
double dlat(void) const {
return _dlat;
}
double max_depth(void) const {
return _max_depth;
}
double min_spacing(void) const {
return _min_spacing;
}
double total_volume(void) const {
return _tot_volume;
}
double max_overlap_error(void) const {
return _max_overlap_error;
}
void printSquare(const UIndex square_id);
void printVertex(const UIndex vertex_id);
void info(void) const;
void populate_wet_rtree(void);
void get_bounds(LatLonDepth &minimum, LatLonDepth &maximum) const;
void reset_base_coord(const LatLonDepth &new_base);
SquareIDSet getSquareIDs(void) const;
SquareIDSet getVertexIDs(void) const;
std::multimap<double, UIndex> getNearest_rtree(const Vec<2> &location, const int &numNear, const bool wet_bool) const;
SquareIDSet getRingIntersects_rtree(const ring_spheq &ring) const;
SquareIDSet getBoxIntersects_rtree(const box_spheq &box) const;
SquareIDSet getNeighborIDs(const UIndex &square_id) const;
/// Test ///
// ======= Main functions =========
void indexNeighbors();
void computeNeighbors(void);
void computeNeighborCoords(void);
void smoothBathymetry(void);
void assign2DIndeces(void);
void fillToSeaLevel(void);
void moveSquares(const double dt, const bool accel_bool, const bool doPlaneFit, const bool absorbing_boundaries, const double accel_multiplier, const double friction_multiplier);
double computeenergy(bool verbose);
void computeDiffussionFracts(const double dt, const double D);
void diffuseSquaresSpherical(void);
void diffuseSquaresSchultz(const double dt);
void diffuseSquaresWard(const int ndiffuses, const bool absorbing_boundaries, const bool conserve_energy);
void applyDiffusion(const bool conserve_energy);
Vec<2> getAverageSlopeWard(const UIndex &square_id, const SquareIDSet &square_ids) const;
Vec<2> fitPointsToPlane(const UIndex &this_id, const SquareIDSet &square_ids);
Vec<2> getGradient(const UIndex &square_id, const bool doPlaneFit);
void updateAcceleration(const UIndex &square_id, const bool doPlaneFit, const double accel_multiplier, const double friction_multiplier);
void deformBottom(const UIndex &square_id, const double &height_change);
UIndex whichSquare(const Vec<2> &location) const;
void flattenBottom(const double &depth);
void bumpCenter(const double bump_height);
void gaussianPile(const double hgauss, const double std);
void gaussianPosNeg(const double hgauss, const double std);
void gaussianStrip(const double hgauss, const double std);
void soliton(const double hgauss);
void calcMaxDepth(void);
Vec<2> centralLoc(void);
void calcMinSpacing(void);
void calcMaxOverlapError();
bool checkSimHealth(void);
// ======= Square functions =========
Vec<2> squareCenter(const UIndex &square_id) const;
Vec<2> squareLatLon(const UIndex &square_id) const;
double squareDepth(const UIndex &square_id) const;
double squareLevel(const UIndex &square_id) const;
SquareIDSet get_neighbors_for_accel(const UIndex &square_id) const;
// ======= Initial condition setup functions ======
void setSquareVelocity(const UIndex &square_id, const Vec<2> &new_velo);
void setSquareAccel(const UIndex &square_id, const Vec<2> &new_accel);
void setSquareHeight(const UIndex &square_id, const double &new_height);
// ======= File I/O ====================
int read_bathymetry_chooser(const std::string &file_name);
int read_bathymetry_txt(const std::string &file_name);
int read_bathymetry_netCDF(const std::string &file_name);
int deformFromFile_txt(const std::string &file_name);
void deformFromFile_netCDF(const std::string &file_name, const double &eq_height_multiplier);
int write_file_kml(const std::string &file_name);
void write_square_ascii(std::ostream &out_stream, const double &time, const UIndex &square_id) const;
void initilize_netCDF_file(const std::string &file_name);
void append_netCDF_file(const std::string &file_name, const int ¤t_step, const float &time);
void write_sim_state_netCDF(const std::string &file_name, const float &this_time);
void read_sim_state_netCDF(const std::string &file_name);
};
}
| 38.255738 | 190 | 0.553694 |
ac59f4eb9d5353c2d0a0b14be4c73c172966ed36 | 349 | h | C | ios/coachlib/coachlib/mHealth/Campaign/PclReminderScheduledEvent.h | VAHacker/familycoach-catalyze | c94e53d7d666d708963ded1f5454adbbc6127d2a | [
"MIT"
] | null | null | null | ios/coachlib/coachlib/mHealth/Campaign/PclReminderScheduledEvent.h | VAHacker/familycoach-catalyze | c94e53d7d666d708963ded1f5454adbbc6127d2a | [
"MIT"
] | null | null | null | ios/coachlib/coachlib/mHealth/Campaign/PclReminderScheduledEvent.h | VAHacker/familycoach-catalyze | c94e53d7d666d708963ded1f5454adbbc6127d2a | [
"MIT"
] | null | null | null | //
// Autogenerated... do not edit
//
#import "EventLog.h"
#import "EventRecord.h"
@interface PclReminderScheduledEvent : EventRecord {
long long pclReminderScheduledTimestamp;
}
+ (void)logWithPclReminderScheduledTimestamp:(long long)pclReminderScheduledTimestamp;
@property (nonatomic, assign) long long pclReminderScheduledTimestamp;
@end
| 20.529412 | 86 | 0.793696 |
3a08ec190d7812e7e2e0827a205171e5d0273bbb | 736 | h | C | iFootageFramework/iFootageFramework/Main/Controllers/iFMainViews/sliceCirleView.h | 414039949/iFootageFramework | 25dada05a2605811bff4ac9d9fb4e1e233462684 | [
"MIT"
] | null | null | null | iFootageFramework/iFootageFramework/Main/Controllers/iFMainViews/sliceCirleView.h | 414039949/iFootageFramework | 25dada05a2605811bff4ac9d9fb4e1e233462684 | [
"MIT"
] | null | null | null | iFootageFramework/iFootageFramework/Main/Controllers/iFMainViews/sliceCirleView.h | 414039949/iFootageFramework | 25dada05a2605811bff4ac9d9fb4e1e233462684 | [
"MIT"
] | null | null | null | //
// sliceCirleView.h
// FinalCirleView
//
// Created by 黄品源 on 2016/12/8.
// Copyright © 2016年 iFootage. All rights reserved.
//
#import <UIKit/UIKit.h>
@protocol changeProgressDelegate <NSObject>
- (void)getProgressAngle:(CGFloat)angle;
@end
@interface sliceCirleView : UIControl
@property (nonatomic, assign)CGFloat startAngle;
@property (nonatomic, assign)CGFloat progress;
@property (nonatomic, assign)CGFloat lineWidth;
@property (nonatomic, assign)CGFloat handleOutSideRadius;
@property (nonatomic, assign)NSUInteger currentNumber;
@property (nonatomic, assign)NSUInteger totalNumber;
@property (nonatomic, assign)NSUInteger lightSliceNumber;
@property (nonatomic, strong)id<changeProgressDelegate>delegate;
@end
| 22.30303 | 64 | 0.779891 |
5c73b7a81a4d0afaa00f266d07d5935c30b75d84 | 3,936 | c | C | src/s11/handlers/s11_common_msg_handler.c | badhrinathpa/openmme | 6975dc7ba007cd111fdce8e8f64d3d52bef0a625 | [
"Apache-2.0"
] | 46 | 2019-02-19T07:47:54.000Z | 2022-03-12T13:16:26.000Z | src/s11/handlers/s11_common_msg_handler.c | omec-project/openmme | 181ee0a2a16fe4eea1b84986477f37d6ebbe55c3 | [
"Apache-2.0"
] | 71 | 2019-03-03T02:22:33.000Z | 2020-10-07T22:34:25.000Z | src/s11/handlers/s11_common_msg_handler.c | badhrinathpa/openmme | 6975dc7ba007cd111fdce8e8f64d3d52bef0a625 | [
"Apache-2.0"
] | 38 | 2019-02-19T06:36:40.000Z | 2021-07-17T14:35:50.000Z | /*
* Copyright 2019-present Open Networking Foundation
* Copyright (c) 2003-2018, Great Software Laboratory Pvt. Ltd.
* Copyright (c) 2017 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stdio.h>
#include <stdlib.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <string.h>
#include <pthread.h>
#include "log.h"
#include "err_codes.h"
#include "message_queues.h"
#include "ipc_api.h"
#include "gtpv2c.h"
#include "gtpv2c_ie.h"
#include "common_proc_info.h"
/************************************************************************
Current file : Stage 1 handler.
ATTACH stages :
Stage 1 : Ctx release -> Release access bearer
**************************************************************************/
/****Globals and externs ***/
/*S11 CP communication parameters*/
extern int g_s11_fd;
extern struct sockaddr_in g_s11_cp_addr;
extern socklen_t g_s11_serv_size;
extern pthread_mutex_t s11_net_lock;
static int g_Q_S11_read_fd;
/*Making global just to avoid stack passing*/
static char buf[S11_COMM_REQ_STAGE_BUF_SIZE];
struct thread_pool *g_tpool;
static uint8_t g_udp_buf[4096];
static uint32_t g_udp_buf_size;
extern volatile uint32_t g_s11_sequence;
/****Global and externs end***/
/**
Initialize the stage settings, Q,
destination communication etc.
*/
static void
init_stage()
{
//test ipc
log_msg(LOG_INFO, "Mme to s11 msg Handler.\n");
if ((g_Q_S11_read_fd = open_ipc_channel(S11_SEND_REQ_STAGE_QUEUE,
IPC_READ)) == -1){
log_msg(LOG_ERROR, "Error in opening reader mme to S11 IPC.\n");
pthread_exit(NULL);
}
log_msg(LOG_INFO, "S11 reader : Opened\n");
return;
}
/**
* Read next message from stage Q for processing.
*/
static int
read_next_msg()
{
int bytes_read=0;
memset(buf, 0, S11_COMM_REQ_STAGE_BUF_SIZE);
while (bytes_read < S11_COMM_REQ_STAGE_BUF_SIZE) {//TODO : Recheck condition
if ((bytes_read = read_ipc_channel(
g_Q_S11_read_fd, buf,
S11_COMM_REQ_STAGE_BUF_SIZE )) == -1) {
log_msg(LOG_ERROR, "Error in reading \n");
/* TODO : Add proper error handling */
}
log_msg(LOG_INFO, " MME to S11 request received - Len: %d\n",
bytes_read);
}
return bytes_read;
}
/**
* Stage specific message processing.
*/
static int
rabr_processing()
{
struct s11_req_Q_msg *rabr_msg = (struct s11_req_Q_msg *) buf;
struct gtpv2c_header *gtpv2c_s11_tx =
(struct gtpv2c_header *)g_udp_buf;
set_gtpv2c_header(gtpv2c_s11_tx, GTP_RABR_REQ,
rabr_msg->s11_sgw_c_fteid.header.teid_gre,
g_s11_sequence);
g_udp_buf_size = ntohs(gtpv2c_s11_tx->gtp.len) + 4;
gtpv2c_s11_tx->gtp.len = htons(g_udp_buf_size - 4);
g_s11_sequence++;
return SUCCESS;
}
/**
* Post message to next handler of the stage
*/
static int
post_to_next()
{
sendto(g_s11_fd, g_udp_buf, g_udp_buf_size, 0,
(struct sockaddr*)&g_s11_cp_addr, g_s11_serv_size);
//TODO " error chk, eagain etc?
log_msg(LOG_INFO, "Send RAB request\n");
return SUCCESS;
}
/**
* Thread exit function for future reference.
*/
void
shutdown_rabr_session()
{
close_ipc_channel(g_Q_S11_read_fd);
log_msg(LOG_INFO, "Shutdown handler \n");
pthread_exit(NULL);
return;
}
/**
* Thread function for stage.
*/
void*
s11_out_msg_handler(void *data)
{
init_stage();
log_msg(LOG_INFO, "Mme to S11 msg handler initialized\n");
while(1){
read_next_msg();
struct s11_req_Q_msg *s11_common_req =
(struct s11_req_Q_msg *) buf;
switch(s11_common_req->IE_type)
{
case S11_RABR_REQ:
log_msg(LOG_DEBUG, "RABR handling Start");
if (rabr_processing() == SUCCESS)
{
post_to_next();
}
else
{
log_msg(LOG_ERROR, "RABR handling failed");
}
break;
default:
log_msg(LOG_ERROR, "Unknown msg %d\n", s11_common_req->IE_type);
}
}
return NULL;
}
| 21.745856 | 84 | 0.656504 |
b155ee5d02504270565e87a3090d5622a9d4002b | 11,610 | h | C | src/xenia/gpu/d3d12/shaders/dxbc/float24_round_ps.h | neuroradiology/xenia | db9aceaccdc0ab95088fd3eda8453fbc819cb316 | [
"BSD-3-Clause"
] | 1 | 2019-04-21T05:56:30.000Z | 2019-04-21T05:56:30.000Z | src/xenia/gpu/d3d12/shaders/dxbc/float24_round_ps.h | nightcarnage/xenia | a6954aced397ea1846379dbb48571a76637dadce | [
"BSD-3-Clause"
] | 1 | 2021-04-07T08:47:23.000Z | 2021-04-07T08:47:23.000Z | src/xenia/gpu/d3d12/shaders/dxbc/float24_round_ps.h | nightcarnage/xenia | a6954aced397ea1846379dbb48571a76637dadce | [
"BSD-3-Clause"
] | null | null | null | // generated from `xb buildhlsl`
// source: float24_round.ps.hlsl
const uint8_t float24_round_ps[] = {
0x44, 0x58, 0x42, 0x43, 0xDF, 0x71, 0xF3, 0x0A, 0x4A, 0xDB, 0xC3, 0x80,
0x1E, 0xE4, 0x39, 0x21, 0x59, 0x07, 0x78, 0x97, 0x01, 0x00, 0x00, 0x00,
0x18, 0x07, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00,
0xA0, 0x00, 0x00, 0x00, 0x90, 0x02, 0x00, 0x00, 0xC4, 0x02, 0x00, 0x00,
0x7C, 0x06, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0x64, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x3C, 0x00, 0x00, 0x00, 0x01, 0x05, 0xFF, 0xFF, 0x00, 0x05, 0x00, 0x00,
0x3C, 0x00, 0x00, 0x00, 0x13, 0x13, 0x44, 0x25, 0x3C, 0x00, 0x00, 0x00,
0x18, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00,
0x24, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x28, 0x52,
0x29, 0x20, 0x48, 0x4C, 0x53, 0x4C, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65,
0x72, 0x20, 0x43, 0x6F, 0x6D, 0x70, 0x69, 0x6C, 0x65, 0x72, 0x20, 0x31,
0x30, 0x2E, 0x31, 0x00, 0x49, 0x53, 0x47, 0x4E, 0xE8, 0x01, 0x00, 0x00,
0x13, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0xD0, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0xD0, 0x01, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0xD0, 0x01, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0xD0, 0x01, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0xD0, 0x01, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0xD0, 0x01, 0x00, 0x00,
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x05, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0xD0, 0x01, 0x00, 0x00,
0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x06, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0xD0, 0x01, 0x00, 0x00,
0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x07, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0xD0, 0x01, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0xD0, 0x01, 0x00, 0x00,
0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x09, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0xD0, 0x01, 0x00, 0x00,
0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x0A, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0xD0, 0x01, 0x00, 0x00,
0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x0B, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0xD0, 0x01, 0x00, 0x00,
0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x0C, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0xD0, 0x01, 0x00, 0x00,
0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x0D, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0xD0, 0x01, 0x00, 0x00,
0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x0E, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0xD0, 0x01, 0x00, 0x00,
0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x0F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0xD0, 0x01, 0x00, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xD0, 0x01, 0x00, 0x00,
0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x11, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xD9, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x12, 0x00, 0x00, 0x00, 0x0F, 0x04, 0x00, 0x00, 0x54, 0x45, 0x58, 0x43,
0x4F, 0x4F, 0x52, 0x44, 0x00, 0x53, 0x56, 0x5F, 0x50, 0x6F, 0x73, 0x69,
0x74, 0x69, 0x6F, 0x6E, 0x00, 0xAB, 0xAB, 0xAB, 0x4F, 0x53, 0x47, 0x4E,
0x2C, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x0E, 0x00, 0x00,
0x53, 0x56, 0x5F, 0x44, 0x65, 0x70, 0x74, 0x68, 0x00, 0xAB, 0xAB, 0xAB,
0x53, 0x48, 0x45, 0x58, 0xB0, 0x03, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00,
0xEC, 0x00, 0x00, 0x00, 0x6A, 0x08, 0x00, 0x01, 0x64, 0x38, 0x00, 0x04,
0x42, 0x10, 0x10, 0x00, 0x12, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x65, 0x00, 0x00, 0x02, 0x01, 0xC0, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02,
0x02, 0x00, 0x00, 0x00, 0x36, 0x20, 0x08, 0x05, 0x12, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x2A, 0x10, 0x10, 0x00, 0x12, 0x00, 0x00, 0x00,
0x50, 0x00, 0x10, 0x07, 0x22, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x40, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x7F, 0x0A, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x07, 0x12, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x1A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x08, 0x07,
0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0xF8, 0xFF, 0xFF, 0x3F,
0x8C, 0x00, 0x10, 0x0B, 0x22, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x40, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x55, 0x00, 0x20, 0x07,
0x42, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
0x1E, 0x00, 0x20, 0x08, 0x42, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x2A, 0x00, 0x10, 0x80, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x40, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x54, 0x00, 0x20, 0x07,
0x42, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00,
0x55, 0x00, 0x10, 0x07, 0x22, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x1A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x4F, 0x00, 0x20, 0x07, 0x42, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0x38, 0x1E, 0x00, 0x08, 0x07,
0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC8,
0x37, 0x00, 0x08, 0x09, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x2A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x1E, 0x00, 0x10, 0x07, 0x22, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x8A, 0x00, 0x08, 0x09, 0x12, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x01, 0x40, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x08, 0x07, 0x12, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x1A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8A, 0x00, 0x38, 0x0F,
0x72, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00,
0x18, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x06, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87, 0x00, 0x40, 0x05,
0x82, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x40, 0x07, 0x82, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x40, 0x00, 0x00, 0xF5, 0xFF, 0xFF, 0xFF, 0x37, 0x00, 0x40, 0x09,
0x82, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x40, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x08, 0x08,
0x12, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3A, 0x00, 0x10, 0x80,
0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x37, 0x00, 0x08, 0x09, 0x12, 0x00, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x2A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x2A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x29, 0x00, 0x40, 0x07, 0x82, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x3A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x40, 0x07,
0x82, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3A, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0xFF, 0xFF, 0x0F, 0x00,
0x37, 0x00, 0x10, 0x09, 0x22, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x2A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x29, 0x00, 0x20, 0x07, 0x42, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0A, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00,
0x17, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x20, 0x07, 0x42, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x2A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x29, 0x00, 0x10, 0x07,
0x22, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x1E, 0x00, 0x10, 0x07, 0x22, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x2A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x37, 0x00, 0x08, 0x08, 0x01, 0xC0, 0x00, 0x00,
0x0A, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x3E, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54, 0x94, 0x00, 0x00, 0x00,
0x1E, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 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, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
};
| 73.949045 | 75 | 0.6323 |
1d85a44dd4e0c545404dec3603a9c68ef56465d5 | 322 | h | C | Orange/src/Platform/OpenGL/OpenGLContext.h | christianwaldmann/OrangeFlappyBirds | 8ae653b4d57a92be3b12eb13f50855433d91862e | [
"Apache-2.0"
] | null | null | null | Orange/src/Platform/OpenGL/OpenGLContext.h | christianwaldmann/OrangeFlappyBirds | 8ae653b4d57a92be3b12eb13f50855433d91862e | [
"Apache-2.0"
] | null | null | null | Orange/src/Platform/OpenGL/OpenGLContext.h | christianwaldmann/OrangeFlappyBirds | 8ae653b4d57a92be3b12eb13f50855433d91862e | [
"Apache-2.0"
] | null | null | null | #pragma once
#include "Orange/Renderer/GraphicsContext.h"
struct GLFWwindow;
namespace Orange {
class OpenGLContext : public GraphicsContext {
public:
OpenGLContext(GLFWwindow* windowHandle);
virtual void Init() override;
virtual void SwapBuffers() override;
private:
GLFWwindow* m_WindowHandle;
};
}
| 14 | 47 | 0.751553 |
59042eb62bd4f0797457b5b44582200d8f91764c | 252 | h | C | include/crypto/init.h | BitStumbler/crypto | 32d6d68fed185f7c437d4f1764c72b50721ca466 | [
"MIT"
] | null | null | null | include/crypto/init.h | BitStumbler/crypto | 32d6d68fed185f7c437d4f1764c72b50721ca466 | [
"MIT"
] | null | null | null | include/crypto/init.h | BitStumbler/crypto | 32d6d68fed185f7c437d4f1764c72b50721ca466 | [
"MIT"
] | 1 | 2021-08-03T08:40:47.000Z | 2021-08-03T08:40:47.000Z | /*
* The MIT License (MIT)
*
* Copyright (c) 2019 Sylko Olzscher
*
*/
#ifndef CYNG_CRYPTO_SSL_INIT_H
#define CYNG_CRYPTO_SSL_INIT_H
namespace cyng
{
namespace crypto
{
class ssl
{
public:
ssl();
virtual ~ssl();
};
}
}
#endif
| 9.692308 | 36 | 0.630952 |
5933ba69a2186c3fccfb34944838938b9ba83be2 | 158 | h | C | include/Red/Graphics/Graphics.h | OutOfTheVoid/ProjectRed | 801327283f5a302be130c90d593b39957c84cce5 | [
"MIT"
] | 1 | 2020-06-14T06:14:50.000Z | 2020-06-14T06:14:50.000Z | include/Red/Graphics/Graphics.h | OutOfTheVoid/ProjectRed | 801327283f5a302be130c90d593b39957c84cce5 | [
"MIT"
] | null | null | null | include/Red/Graphics/Graphics.h | OutOfTheVoid/ProjectRed | 801327283f5a302be130c90d593b39957c84cce5 | [
"MIT"
] | null | null | null | #ifndef RED_GRAPHICS_GRAPHICS_H
#define RED_GRAPHICS_GRAPHICS_H
#include <Red/Graphics/Graphics.h>
namespace Red
{
namespace Graphics
{
}
}
#endif
| 9.875 | 34 | 0.753165 |
df44a2495eb7a98326ca2de7d81d73b7c23b4f17 | 1,566 | c | C | DataScience Flores/alg datascience.c | yp1plus/Projetos-C | a52cd3afd3a0731ea9f7342f6696a708f550aed9 | [
"MIT"
] | null | null | null | DataScience Flores/alg datascience.c | yp1plus/Projetos-C | a52cd3afd3a0731ea9f7342f6696a708f550aed9 | [
"MIT"
] | null | null | null | DataScience Flores/alg datascience.c | yp1plus/Projetos-C | a52cd3afd3a0731ea9f7342f6696a708f550aed9 | [
"MIT"
] | null | null | null | /* Programa para calcular a menor distância entre flores e determinados grupos e a quantidade por grupos
* By Yure Pablo em 12/06/2019
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
typedef struct representante{
float x1;
float y1;
float x2;
float y2;
} representante;
float distancia(float x0, float x){
return (x0 - x) * (x0 - x);
}
float distN(float x0, float x, float y0, float y, float x1, float x2, float y1, float y2){
return sqrt(distancia(x0, x) + distancia(y0, y) + distancia(x1, x2) + distancia(y1, y2));
}
int main(void){
FILE *dados;
representante rp[3] = {{5.4, 3.7, 1.5, 0.2}, { 6.0, 2.2, 4.0, 1.0}, {5.8, 2.7, 5.1, 1.9}};
float dist;
float menorD = 2000000;
int indice;
int soma[3] = {0};
dados = fopen("iris.data", "r");
if (dados == NULL)
{
printf("ERRO\n");
exit(1);
}
float x1, y1, x2, y2;
char aux;
char tipo[20];
while(!feof(dados))
{
fscanf(dados, "%f %c %f %c %f %c %f %c", &x1, &aux, &y1, &aux, &x2, &aux, &y2, &aux);
for (int i = 0; i < 3; i++)
{
dist = distN(x1, rp[i].x1, y1, rp[i].y1, x2, rp[i].x2, y2, rp[i].y2);
if (dist < menorD)
{
menorD = dist;
indice = i;
}
}
soma[indice]++;
menorD = 2000000;
fscanf(dados, "%s ", tipo);
}
for (int i = 0; i < 3; i++)
{
printf("Total do Grupo %d: %d\n", i, soma[i]);
}
return 0;
} | 21.162162 | 104 | 0.492337 |
8a850e26532fef6fb6d6eef48b02743ec6b5b3e0 | 1,595 | h | C | code/terrain-renderer/gamestates/terrainrenderergamestate.h | Pipirongu/terrain-renderer | b159a8ca78fbe90a0db95a4a157bf05fd48ead54 | [
"CC0-1.0"
] | 1 | 2016-06-13T10:54:25.000Z | 2016-06-13T10:54:25.000Z | code/terrain-renderer/gamestates/terrainrenderergamestate.h | Pipirongu/terrain-renderer | b159a8ca78fbe90a0db95a4a157bf05fd48ead54 | [
"CC0-1.0"
] | null | null | null | code/terrain-renderer/gamestates/terrainrenderergamestate.h | Pipirongu/terrain-renderer | b159a8ca78fbe90a0db95a4a157bf05fd48ead54 | [
"CC0-1.0"
] | null | null | null | #pragma once
//------------------------------------------------------------------------------
/**
@class Tools::TerrainRendererGameState
gamestate where a terrain is attached
(C) 2013-2014 Individual contributors, see AUTHORS file
*/
#include "statehandlers/gamestatehandler.h"
#include "graphics/spotlightentity.h"
#include "graphics/globallightentity.h"
#include "graphics/pointlightentity.h"
#include "game/entity.h"
#include "terrainentity.h"
//------------------------------------------------------------------------------
namespace Tools
{
class TerrainRendererGameState : public BaseGameFeature::GameStateHandler
{
__DeclareClass(TerrainRendererGameState);
public:
/// constructor
TerrainRendererGameState();
/// destructor
virtual ~TerrainRendererGameState();
/// called when the state represented by this state handler is entered
virtual void OnStateEnter(const Util::String& prevState);
/// called when the state represented by this state handler is left
virtual void OnStateLeave(const Util::String& nextState);
/// called each frame as long as state is current, return new state
virtual Util::String OnFrame();
/// called after Db is opened, and before entities are loaded
virtual void OnLoadBefore();
/// called after entities are loaded
virtual void OnLoadAfter();
// handle all user input; called @ LevelEditorState::OnFrame()
void HandleInput();
private:
Ptr<Graphics::TerrainEntity> terrain_entity;
Ptr<Graphics::Stage> stage;
};
} // namespace Tools
//------------------------------------------------------------------------------ | 32.55102 | 80 | 0.647649 |
ceac6758e5116883bb4f9f7ccf87491e69f952b8 | 251 | h | C | hamming/hamming.h | fernape/sqlite3_distances | 9b3fd389c808d8d0c56d02ea47c1587042c0d50f | [
"BSD-3-Clause"
] | 2 | 2019-09-11T17:46:36.000Z | 2022-02-10T10:20:52.000Z | hamming/hamming.h | fernape/sqlite3_distances | 9b3fd389c808d8d0c56d02ea47c1587042c0d50f | [
"BSD-3-Clause"
] | null | null | null | hamming/hamming.h | fernape/sqlite3_distances | 9b3fd389c808d8d0c56d02ea47c1587042c0d50f | [
"BSD-3-Clause"
] | null | null | null | /*
* Copyright 2019 - 2020, Fernando Apesteguia
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef __HAMMING_DISTANCE__
#define __HAMMING_DISTANCE__
int _hamming_distance(const char *str_a, const char *str_b);
#endif /* __HAMMING_DISTANCE__ */
| 20.916667 | 60 | 0.760956 |
37b268bb0cdea01b534ca62b11de990c9e9933fe | 8,821 | h | C | B2G/gecko/toolkit/components/places/Database.h | wilebeast/FireFox-OS | 43067f28711d78c429a1d6d58c77130f6899135f | [
"Apache-2.0"
] | 3 | 2015-08-31T15:24:31.000Z | 2020-04-24T20:31:29.000Z | B2G/gecko/toolkit/components/places/Database.h | wilebeast/FireFox-OS | 43067f28711d78c429a1d6d58c77130f6899135f | [
"Apache-2.0"
] | null | null | null | B2G/gecko/toolkit/components/places/Database.h | wilebeast/FireFox-OS | 43067f28711d78c429a1d6d58c77130f6899135f | [
"Apache-2.0"
] | 3 | 2015-07-29T07:17:15.000Z | 2020-11-04T06:55:37.000Z | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_places_Database_h_
#define mozilla_places_Database_h_
#include "nsThreadUtils.h"
#include "nsWeakReference.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIObserver.h"
#include "mozilla/storage.h"
#include "mozilla/storage/StatementCache.h"
#include "mozilla/Attributes.h"
// This is the schema version. Update it at any schema change and add a
// corresponding migrateVxx method below.
#define DATABASE_SCHEMA_VERSION 21
// Fired after Places inited.
#define TOPIC_PLACES_INIT_COMPLETE "places-init-complete"
// Fired when initialization fails due to a locked database.
#define TOPIC_DATABASE_LOCKED "places-database-locked"
// This topic is received when the profile is about to be lost. Places does
// initial shutdown work and notifies TOPIC_PLACES_SHUTDOWN to all listeners.
// Any shutdown work that requires the Places APIs should happen here.
#define TOPIC_PROFILE_CHANGE_TEARDOWN "profile-change-teardown"
// This topic is received just before the profile is lost. Places begins
// shutting down the connection and notifies TOPIC_PLACES_WILL_CLOSE_CONNECTION
// to all listeners. Only critical database cleanups should happen here,
// some APIs may bail out already.
#define TOPIC_PROFILE_BEFORE_CHANGE "profile-before-change"
// Fired when Places is shutting down. Any code should stop accessing Places
// APIs after this notification. If you need to listen for Places shutdown
// you should only use this notification, next ones are intended only for
// internal Places use.
#define TOPIC_PLACES_SHUTDOWN "places-shutdown"
// For Internal use only. Fired when connection is about to be closed, only
// cleanup tasks should run at this stage, nothing should be added to the
// database, nor APIs should be called.
#define TOPIC_PLACES_WILL_CLOSE_CONNECTION "places-will-close-connection"
// Fired when the connection has gone, nothing will work from now on.
#define TOPIC_PLACES_CONNECTION_CLOSED "places-connection-closed"
class nsIStringBundle;
namespace mozilla {
namespace places {
enum JournalMode {
// Default SQLite journal mode.
JOURNAL_DELETE = 0
// Can reduce fsyncs on Linux when journal is deleted (See bug 460315).
// We fallback to this mode when WAL is unavailable.
, JOURNAL_TRUNCATE
// Unsafe in case of crashes on database swap or low memory.
, JOURNAL_MEMORY
// Can reduce number of fsyncs. We try to use this mode by default.
, JOURNAL_WAL
};
class Database MOZ_FINAL : public nsIObserver
, public nsSupportsWeakReference
{
typedef mozilla::storage::StatementCache<mozIStorageStatement> StatementCache;
typedef mozilla::storage::StatementCache<mozIStorageAsyncStatement> AsyncStatementCache;
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIOBSERVER
Database();
/**
* Initializes the database connection and the schema.
* In case of corruption the database is copied to a backup file and replaced.
*/
nsresult Init();
/**
* Finalizes the cached statements and closes the database connection.
* A TOPIC_PLACES_CONNECTION_CLOSED notification is fired when done.
*/
void Shutdown();
/**
* Getter to use when instantiating the class.
*
* @return Singleton instance of this class.
*/
static already_AddRefed<Database> GetDatabase()
{
return GetSingleton();
}
/**
* Returns last known database status.
*
* @return one of the nsINavHistoryService::DATABASE_STATUS_* constants.
*/
uint16_t GetDatabaseStatus() const
{
return mDatabaseStatus;
}
/**
* Returns a pointer to the storage connection.
*
* @return The connection handle.
*/
mozIStorageConnection* MainConn() const
{
return mMainConn;
}
/**
* Dispatches a runnable to the connection async thread, to be serialized
* with async statements.
*
* @param aEvent
* The runnable to be dispatched.
*/
void DispatchToAsyncThread(nsIRunnable* aEvent) const
{
if (mShuttingDown) {
return;
}
nsCOMPtr<nsIEventTarget> target = do_GetInterface(mMainConn);
if (target) {
(void)target->Dispatch(aEvent, NS_DISPATCH_NORMAL);
}
}
//////////////////////////////////////////////////////////////////////////////
//// Statements Getters.
/**
* Gets a cached synchronous statement.
*
* @param aQuery
* SQL query literal.
* @return The cached statement.
* @note Always null check the result.
* @note Always use a scoper to reset the statement.
*/
template<int N>
already_AddRefed<mozIStorageStatement>
GetStatement(const char (&aQuery)[N]) const
{
nsDependentCString query(aQuery, N - 1);
return GetStatement(query);
}
/**
* Gets a cached synchronous statement.
*
* @param aQuery
* nsCString of SQL query.
* @return The cached statement.
* @note Always null check the result.
* @note Always use a scoper to reset the statement.
*/
already_AddRefed<mozIStorageStatement>
GetStatement(const nsACString& aQuery) const
{
if (mShuttingDown) {
return nullptr;
}
if (NS_IsMainThread()) {
return mMainThreadStatements.GetCachedStatement(aQuery);
}
return mAsyncThreadStatements.GetCachedStatement(aQuery);
}
/**
* Gets a cached asynchronous statement.
*
* @param aQuery
* SQL query literal.
* @return The cached statement.
* @note Always null check the result.
* @note AsyncStatements are automatically reset on execution.
*/
template<int N>
already_AddRefed<mozIStorageAsyncStatement>
GetAsyncStatement(const char (&aQuery)[N]) const
{
nsDependentCString query(aQuery, N - 1);
return GetAsyncStatement(query);
}
/**
* Gets a cached asynchronous statement.
*
* @param aQuery
* nsCString of SQL query.
* @return The cached statement.
* @note Always null check the result.
* @note AsyncStatements are automatically reset on execution.
*/
already_AddRefed<mozIStorageAsyncStatement>
GetAsyncStatement(const nsACString& aQuery) const
{
if (mShuttingDown) {
return nullptr;
}
MOZ_ASSERT(NS_IsMainThread());
return mMainThreadAsyncStatements.GetCachedStatement(aQuery);
}
protected:
/**
* Initializes the database file. If the database does not exist or is
* corrupt, a new one is created. In case of corruption it also creates a
* backup copy of the database.
*
* @param aStorage
* mozStorage service instance.
* @param aNewDatabaseCreated
* whether a new database file has been created.
*/
nsresult InitDatabaseFile(nsCOMPtr<mozIStorageService>& aStorage,
bool* aNewDatabaseCreated);
/**
* Creates a database backup and replaces the original file with a new
* one.
*
* @param aStorage
* mozStorage service instance.
*/
nsresult BackupAndReplaceDatabaseFile(nsCOMPtr<mozIStorageService>& aStorage);
/**
* Initializes the database. This performs any necessary migrations for the
* database. All migration is done inside a transaction that is rolled back
* if any error occurs.
* @param aDatabaseMigrated
* Whether a schema upgrade happened.
*/
nsresult InitSchema(bool* aDatabaseMigrated);
/**
* Creates bookmark roots in a new DB.
*/
nsresult CreateBookmarkRoots();
/**
* Initializes additionale SQLite functions, defined in SQLFunctions.h
*/
nsresult InitFunctions();
/**
* Initializes triggers defined in nsPlacesTriggers.h
*/
nsresult InitTempTriggers();
/**
* Helpers used by schema upgrades.
*/
nsresult MigrateV7Up();
nsresult MigrateV8Up();
nsresult MigrateV9Up();
nsresult MigrateV10Up();
nsresult MigrateV11Up();
nsresult MigrateV13Up();
nsresult MigrateV14Up();
nsresult MigrateV15Up();
nsresult MigrateV16Up();
nsresult MigrateV17Up();
nsresult MigrateV18Up();
nsresult MigrateV19Up();
nsresult MigrateV20Up();
nsresult MigrateV21Up();
nsresult UpdateBookmarkRootTitles();
nsresult CheckAndUpdateGUIDs();
private:
~Database();
/**
* Singleton getter, invoked by class instantiation.
*
* Note: does AddRef.
*/
static Database* GetSingleton();
static Database* gDatabase;
nsCOMPtr<mozIStorageConnection> mMainConn;
mutable StatementCache mMainThreadStatements;
mutable AsyncStatementCache mMainThreadAsyncStatements;
mutable StatementCache mAsyncThreadStatements;
int32_t mDBPageSize;
uint16_t mDatabaseStatus;
bool mShuttingDown;
};
} // namespace places
} // namespace mozilla
#endif // mozilla_places_Database_h_
| 28.826797 | 90 | 0.712051 |
180be8e553ac20cb6b2e16249dd92d2e63dec3ba | 581 | h | C | src/net/H264RtpSink.h | larrystd/streamingserver | b3467964dc6478d5b2de71f8595de2d60b68ed49 | [
"Apache-2.0"
] | null | null | null | src/net/H264RtpSink.h | larrystd/streamingserver | b3467964dc6478d5b2de71f8595de2d60b68ed49 | [
"Apache-2.0"
] | null | null | null | src/net/H264RtpSink.h | larrystd/streamingserver | b3467964dc6478d5b2de71f8595de2d60b68ed49 | [
"Apache-2.0"
] | null | null | null | #ifndef _H264_MEDIA_SINK_H_
#define _H264_MEDIA_SINK_H_
#include <stdint.h>
#include "net/RtpSink.h"
class H264RtpSink : public RtpSink
{
public:
static H264RtpSink* createNew(UsageEnvironment* env, MediaSource* mediaSource);
H264RtpSink(UsageEnvironment* env, MediaSource* mediaSource);
virtual ~H264RtpSink();
virtual std::string getMediaDescription(uint16_t port);
virtual std::string getAttribute();
virtual void handleFrame(AVFrame* frame);
private:
RtpPacket mRtpPacket;
int mClockRate;
int mFps;
};
#endif //_H264_MEDIA_SINK_H_ | 22.346154 | 83 | 0.745267 |
9bab8059a3e01efd237d34c41947ae160a2c7a85 | 11,645 | c | C | fio/fio_plugin.c | ZaidQureshi/gpudirect-nvme | cba22f844acd6c3885b936cbb128cca0895a62da | [
"BSD-2-Clause"
] | 11 | 2021-02-17T18:28:31.000Z | 2022-03-22T02:21:29.000Z | fio/fio_plugin.c | ZaidQureshi/gpudirect-nvme | cba22f844acd6c3885b936cbb128cca0895a62da | [
"BSD-2-Clause"
] | 1 | 2022-02-18T05:39:59.000Z | 2022-02-18T05:39:59.000Z | fio/fio_plugin.c | ZaidQureshi/gpudirect-nvme | cba22f844acd6c3885b936cbb128cca0895a62da | [
"BSD-2-Clause"
] | 3 | 2021-11-29T06:46:21.000Z | 2022-03-23T08:27:29.000Z | #define _GNU_SOURCE
#define __DIS_CLUSTER__
#ifndef _REENTRANT
#define _REENTRANT
#endif
#include "config-host.h"
#include "fio.h"
#include "optgroup.h"
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
#include <errno.h>
#include <nvm_types.h>
#include <nvm_dma.h>
#include <nvm_util.h>
#include <nvm_error.h>
#include <nvm_admin.h>
#include <nvm_aq.h>
#include <nvm_rpc.h>
#include <nvm_cmd.h>
#include <nvm_queue.h>
#include <nvm_ctrl.h>
#include <sisci_api.h>
static bool _initialized = false;
struct libnvmfio_options
{
void* pad;
uint32_t fdid;
unsigned int reset;
unsigned int remote_queue;
unsigned int queue_id;
unsigned int adapter;
unsigned int namespace;
};
struct libnvmfio_thread
{
nvm_ctrl_t* ctrl; /* Controller handle */
struct nvm_ctrl_info ctrl_info;
struct nvm_ns_info ns_info;
nvm_dma_t* aq_mem; /* Admin queue memory */
nvm_aq_ref aq_ref; /* Admin queue reference */
nvm_dma_t* cq_mem; /* Completion queue memory */
nvm_queue_t cq; /* Completion queue */
nvm_dma_t* sq_mem; /* Submission queue memory */
nvm_queue_t sq; /* Submission queue */
nvm_dma_t* io_mem; /* Data buffer memory */
nvm_prp_list_t* prp_lists;
};
static int identify(struct libnvmfio_thread* data)
{
int err;
nvm_dma_t* page;
err = nvm_dis_dma_create(&page, data->ctrl, data->ctrl->page_size, 0);
if (!nvm_ok(err))
{
return err;
}
err = nvm_admin_ctrl_info(data->aq_ref, &data->ctrl_info, page->vaddr, page->ioaddrs[0]);
if (!nvm_ok(err))
{
nvm_dma_unmap(page);
return EIO;
}
err = nvm_admin_ns_info(data->aq_ref, &data->ns_info, 1, page->vaddr, page->ioaddrs[0]);
if (!nvm_ok(err))
{
nvm_dma_unmap(page);
return EIO;
}
nvm_dma_unmap(page);
return 0;
}
static int create_queues(struct libnvmfio_thread* data, unsigned int queue_no, size_t iodepth, unsigned int memhints)
{
int err;
size_t i;
const nvm_ctrl_t* ctrl = data->ctrl;
++iodepth;
data->prp_lists = calloc(iodepth, sizeof(nvm_prp_list_t));
assert(data->prp_lists);
err = nvm_dis_dma_create(&data->cq_mem, ctrl,
NVM_CQ_PAGES(ctrl, iodepth) * ctrl->page_size, 0);
if (err != 0)
{
free(data->prp_lists);
return err;
}
err = nvm_dis_dma_create(&data->sq_mem, ctrl,
(NVM_SQ_PAGES(ctrl, iodepth) + iodepth) * ctrl->page_size, memhints);
if (err != 0)
{
nvm_dma_unmap(data->cq_mem);
free(data->prp_lists);
return err;
}
memset(data->cq_mem->vaddr, 0, data->cq_mem->page_size * data->cq_mem->n_ioaddrs);
err = nvm_admin_cq_create(data->aq_ref, &data->cq, queue_no, data->cq_mem, 0, iodepth);
if (err != 0)
{
goto unwind;
}
memset(data->sq_mem->vaddr, 0, data->sq_mem->page_size * data->sq_mem->n_ioaddrs);
err = nvm_admin_sq_create(data->aq_ref, &data->sq, &data->cq, queue_no, data->sq_mem, 0, iodepth);
if (err != 0)
{
goto unwind;
}
for (i = 0; i < iodepth; ++i)
{
data->prp_lists[i] = NVM_PRP_LIST(data->sq_mem, NVM_SQ_PAGES(ctrl, iodepth + i));
}
return 0;
unwind:
nvm_dma_unmap(data->sq_mem);
nvm_dma_unmap(data->cq_mem);
free(data->prp_lists);
return err;
}
static void destroy_queues(struct libnvmfio_thread* data)
{
nvm_admin_sq_delete(data->aq_ref, &data->sq, &data->cq);
nvm_dma_unmap(data->sq_mem);
nvm_admin_cq_delete(data->aq_ref, &data->cq);
nvm_dma_unmap(data->cq_mem);
free(data->prp_lists);
}
static int thread_setup(struct thread_data* td)
{
unsigned int i;
struct fio_file* f;
if (!td->o.use_thread)
{
/* SPDK checks for this, should we too? */
}
if (!_initialized)
{
fprintf(stderr, "Failed to initialize SISCI\n");
return -1;
}
for_each_file(td, f, i)
{
fprintf(stderr, "%s\n", f->file_name);
}
return 0;
}
static enum fio_q_status fio_queue(struct thread_data* td, struct io_u* io_u)
{
struct libnvmfio_thread* data = td->io_ops_data;
nvm_queue_t* sq = &data->sq;
nvm_queue_t* cq = &data->cq;
const size_t ps = data->ctrl->page_size;
const size_t bs = data->ns_info.lba_data_size;
unsigned int idx;
uint8_t op;
nvm_cmd_t cmd;
nvm_cmd_t* ptr;
nvm_cpl_t* cpl;
size_t offset;
offset = ((char*) io_u->buf) - ((char*) data->io_mem->vaddr);
switch (io_u->ddir)
{
case DDIR_READ:
op = NVM_IO_READ;
break;
case DDIR_WRITE:
op = NVM_IO_WRITE;
break;
default:
assert(false);
break;
}
idx = sq->tail;
nvm_cmd_header(&cmd, idx, op, data->ns_info.ns_id);
nvm_cmd_data(&cmd, 1, &data->prp_lists[idx], io_u->xfer_buflen / ps, &data->io_mem->ioaddrs[offset / ps]);
nvm_cmd_rw_blks(&cmd, io_u->offset / bs, io_u->xfer_buflen / bs);
ptr = nvm_sq_enqueue(sq);
if (ptr == NULL)
{
return FIO_Q_BUSY;
}
*ptr = cmd;
nvm_sq_submit(sq);
while ((cpl = nvm_cq_dequeue(cq)) == NULL);
nvm_sq_update(sq);
if (!NVM_ERR_OK(cpl))
{
fprintf(stderr, "error %s\n", nvm_strerror(NVM_ERR_STATUS(cpl)));
}
nvm_cq_update(cq);
return FIO_Q_COMPLETED;
}
static int iomem_alloc(struct thread_data* td, size_t size)
{
int err;
struct libnvmfio_thread* data = td->io_ops_data;
if (data->io_mem)
{
return EINVAL;
}
err = nvm_dis_dma_create(&data->io_mem, data->ctrl, size, 0);
if (!nvm_ok(err))
{
return err;
}
td->orig_buffer = data->io_mem->vaddr;
return 0;
}
static void iomem_free(struct thread_data* td)
{
struct libnvmfio_thread* data = td->io_ops_data;
nvm_dma_unmap(data->io_mem);
data->io_mem = NULL;
}
static int fio_open(struct thread_data* td, struct fio_file* f)
{
// struct libnvmfio_thread* data = td->io_ops_data;
//
// f->filetype = FIO_TYPE_BLOCK;
// f->real_file_size = data->ns_info.size * data->ns_info.lba_data_size;
// fio_file_set_size_known(f);
//
return 0;
}
static int fio_close(struct thread_data fio_unused *td, struct fio_file fio_unused *f)
{
return 0;
}
static int fio_invalidate(struct thread_data fio_unused *td, struct fio_file fio_unused *f)
{
return 0;
}
static int thread_init(struct thread_data* td)
{
int err;
struct libnvmfio_options* opts = td->eo;
struct libnvmfio_thread* data;
char diskname[41];
unsigned int flags = 0;
uint16_t n_cqs, n_sqs;
if (opts->fdid == 0)
{
return EBADF;
}
if (opts->queue_id == 0)
{
return EINVAL;
}
if (td->o.iodepth != 1)
{
fprintf(stderr, "Warning: IO depth > 1 is not supported\n");
}
data = calloc(1, sizeof(struct libnvmfio_thread));
if (data == NULL)
{
return errno;
}
err = nvm_dis_ctrl_init(&data->ctrl, opts->fdid);
if (!nvm_ok(err))
{
free(data);
return err;
}
if (opts->reset)
{
err = nvm_dis_dma_create(&data->aq_mem, data->ctrl, data->ctrl->page_size * 2, 0);
if (!nvm_ok(err))
{
nvm_ctrl_free(data->ctrl);
free(data);
return err;
}
err = nvm_aq_create(&data->aq_ref, data->ctrl, data->aq_mem);
if (!nvm_ok(err))
{
nvm_dma_unmap(data->aq_mem);
nvm_ctrl_free(data->ctrl);
free(data);
return err;
}
nvm_admin_set_num_queues(data->aq_ref, opts->queue_id, opts->queue_id);
}
else
{
err = nvm_dis_rpc_bind(&data->aq_ref, data->ctrl, opts->adapter);
if (!nvm_ok(err))
{
nvm_ctrl_free(data->ctrl);
free(data);
return err;
}
}
err = identify(data);
if (err != 0)
{
goto error;
}
err = nvm_admin_get_num_queues(data->aq_ref, &n_cqs, &n_sqs);
if (err != 0)
{
goto error;
}
if (opts->queue_id > n_sqs)
{
err = EINVAL;
goto error;
}
flags = opts->remote_queue ? (SCI_MEMACCESS_DEVICE_READ | SCI_MEMACCESS_HOST_WRITE) : 0;
err = create_queues(data, opts->queue_id, td->o.iodepth, flags);
if (err != 0)
{
goto error;
}
fprintf(stderr, "SQ on node: %u\n", nvm_dis_node_from_dma(data->sq_mem));
strncpy(diskname, data->ctrl_info.model_no, 40);
diskname[40] = '\0';
fprintf(stderr, "Using disk: 0x%x %s\n", opts->fdid, diskname);
td->io_ops_data = data;
return 0;
error:
nvm_aq_destroy(data->aq_ref);
nvm_dma_unmap(data->aq_mem);
nvm_ctrl_free(data->ctrl);
free(data);
return err;
}
static void thread_cleanup(struct thread_data* td)
{
if (td->io_ops_data)
{
struct libnvmfio_thread* data = td->io_ops_data;
td->io_ops_data = NULL;
destroy_queues(data);
nvm_aq_destroy(data->aq_ref);
nvm_dma_unmap(data->aq_mem);
nvm_ctrl_free(data->ctrl);
free(data);
}
}
static struct fio_option options[] =
{
{ .name = "fdid", .lname = "fdid", .alias = "ctrl", .def = "0", .type = FIO_OPT_ULL, .off1 = offsetof(struct libnvmfio_options, fdid), .help = "Fabric device identifier for NVMe controller", .category = FIO_OPT_C_ENGINE, .group = FIO_OPT_G_INVALID, },
{ .name = "reset", .lname = "reset_ctrl", .type = FIO_OPT_STR_SET, .off1 = offsetof(struct libnvmfio_options, reset), .help = "Reset controller and become manager", .category = FIO_OPT_C_ENGINE, .group = FIO_OPT_G_INVALID, },
{ .name = "remote_queue", .lname = "remote_queue", .type = FIO_OPT_STR_SET, .off1 = offsetof(struct libnvmfio_options, remote_queue), .help = "Allocate submission queue close to controller", .category = FIO_OPT_C_ENGINE, .group = FIO_OPT_G_INVALID, },
{ .name = "queue_no", .lname = "queue_no", .alias = "queue_id", .type = FIO_OPT_ULL, .off1 = offsetof(struct libnvmfio_options, queue_id), .help = "Submission queue identifier",.category = FIO_OPT_C_ENGINE, .group = FIO_OPT_G_INVALID, },
{ .name = "adapter", .lname = "adapter", .def = "0", .type = FIO_OPT_ULL, .off1 = offsetof(struct libnvmfio_options, adapter), .help = "DIS adapter number", .category = FIO_OPT_C_ENGINE, .group = FIO_OPT_G_INVALID, },
{ .name = "namespace", .lname = "nvm_namespace", .alias = "ns", .def = "1", .type = FIO_OPT_ULL, .off1 = offsetof(struct libnvmfio_options, namespace), .help = "NVM namespace", .category = FIO_OPT_C_ENGINE, .group = FIO_OPT_G_INVALID, },
{ .name = NULL, }
};
struct ioengine_ops engine =
{
.name = "libnvm",
.version = FIO_IOOPS_VERSION,
.flags = FIO_SYNCIO | FIO_RAWIO | FIO_NOEXTEND | FIO_NODISKUTIL | FIO_MEMALIGN,
.setup = thread_setup,
.init = thread_init,
.queue = fio_queue,
.cleanup = thread_cleanup,
.open_file = fio_open,
.close_file = fio_close,
.invalidate = fio_invalidate,
.iomem_alloc = iomem_alloc,
.iomem_free = iomem_free,
//.get_file_size
.option_struct_size = sizeof(struct libnvmfio_options),
.options = options,
};
static void fio_init libnvm_fio_register(void)
{
sci_error_t err;
SCIInitialize(0, &err);
if (err == SCI_ERR_OK)
{
_initialized = true;
register_ioengine(&engine);
}
}
static void fio_exit libnvm_fio_unregister(void)
{
if (_initialized)
{
unregister_ioengine(&engine);
SCITerminate();
_initialized = false;
}
}
| 24.059917 | 255 | 0.615801 |
49b76212fbd628dc6ba6dbca56d1e206942760d7 | 8,142 | c | C | mlib/src/private/mLVItemMan.c | hanya/aobook-haiku | ffe2a900528ade0bb9da300c2c32478d135472fd | [
"BSD-3-Clause"
] | 1 | 2017-10-28T11:00:52.000Z | 2017-10-28T11:00:52.000Z | mlib/src/private/mLVItemMan.c | hanya/aobook-haiku | ffe2a900528ade0bb9da300c2c32478d135472fd | [
"BSD-3-Clause"
] | null | null | null | mlib/src/private/mLVItemMan.c | hanya/aobook-haiku | ffe2a900528ade0bb9da300c2c32478d135472fd | [
"BSD-3-Clause"
] | null | null | null | /*$
Copyright (c) 2014-2017, Azel
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the <organization> 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 <COPYRIGHT HOLDER> 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.
$*/
/*****************************************
* mLVItemMan [リストビューアイテム管理]
*****************************************/
/*
* 複数選択を有効にする場合は bMultiSel を TRUE にする。
*/
#include <string.h>
#include "mDef.h"
#include "mLVItemMan.h"
#include "mList.h"
//-----------------
#define _NUM_MAX 100000
#define _ITEM_TOP(p) M_LISTVIEWITEM(p->list.top)
#define _ITEMFLAG_ON(p,f) (p)->flags |= MLISTVIEW_ITEM_F_ ## f
#define _ITEMFLAG_OFF(p,f) (p)->flags &= ~(MLISTVIEW_ITEM_F_ ## f)
//-----------------
/** mListViewItem 破棄ハンドラ */
void mListViewItemDestroy(mListItem *item)
{
mListViewItem *p = (mListViewItem *)item;
if(!(p->flags & MLISTVIEW_ITEM_F_STATIC_TEXT))
{
mFree((void *)p->text);
p->text = NULL;
}
}
//====================
/** 解放 */
void mLVItemMan_free(mLVItemMan *p)
{
if(p)
{
mListDeleteAll(&p->list);
mFree(p);
}
}
/** 確保 */
mLVItemMan *mLVItemMan_new()
{
return (mLVItemMan *)mMalloc(sizeof(mLVItemMan), TRUE);
}
//=====================
/** テキストセット */
static void _set_text(mListViewItem *pi,const char *text,uint32_t flags)
{
if(flags & MLISTVIEW_ITEM_F_STATIC_TEXT)
{
pi->text = text;
pi->textlen = strlen(text);
}
else
{
mFree((void *)pi->text);
pi->textlen = mStrdup2(text, (char **)&pi->text);
}
}
/** アイテム追加 */
mListViewItem *mLVItemMan_addItem(mLVItemMan *p,int size,
const char *text,int icon,uint32_t flags,intptr_t param)
{
mListViewItem *pi;
if(p->list.num > _NUM_MAX) return NULL;
if(size < sizeof(mListViewItem))
size = sizeof(mListViewItem);
pi = (mListViewItem *)mListAppendNew(&p->list, size, mListViewItemDestroy);
_set_text(pi, text, flags);
pi->icon = icon;
pi->flags = flags;
pi->param = param;
return pi;
}
/** アイテム挿入 */
mListViewItem *mLVItemMan_insertItem(mLVItemMan *p,mListViewItem *ins,
const char *text,int icon,uint32_t flags,intptr_t param)
{
mListViewItem *pi;
if(p->list.num > _NUM_MAX) return NULL;
pi = (mListViewItem *)mListInsertNew(&p->list, M_LISTITEM(ins),
sizeof(mListViewItem), mListViewItemDestroy);
_set_text(pi, text, flags);
pi->icon = icon;
pi->flags = flags;
pi->param = param;
return pi;
}
/** アイテムすべて削除 */
void mLVItemMan_deleteAllItem(mLVItemMan *p)
{
mListDeleteAll(&p->list);
p->itemFocus = NULL;
}
/** アイテム削除
*
* @return フォーカスアイテムが削除された */
mBool mLVItemMan_deleteItem(mLVItemMan *p,mListViewItem *item)
{
mBool ret = FALSE;
if(item)
{
if(item == p->itemFocus)
{
p->itemFocus = NULL;
ret = TRUE;
}
mListDelete(&p->list, M_LISTITEM(item));
}
return ret;
}
/** アイテム削除 (番号から)
*
* @param index 負の値で現在のフォーカスアイテム */
mBool mLVItemMan_deleteItemByIndex(mLVItemMan *p,int index)
{
return mLVItemMan_deleteItem(p,
mLVItemMan_getItemByIndex(p, index));
}
/** すべて選択 */
void mLVItemMan_selectAll(mLVItemMan *p)
{
mListViewItem *pi;
if(p->bMultiSel)
{
for(pi = _ITEM_TOP(p); pi; pi = M_LISTVIEWITEM(pi->i.next))
_ITEMFLAG_ON(pi, SELECTED);
}
}
/** すべて選択解除 */
void mLVItemMan_unselectAll(mLVItemMan *p)
{
mListViewItem *pi;
if(p->bMultiSel)
{
for(pi = _ITEM_TOP(p); pi; pi = M_LISTVIEWITEM(pi->i.next))
_ITEMFLAG_OFF(pi, SELECTED);
}
}
/** アイテムのテキストをセット */
void mLVItemMan_setText(mListViewItem *pi,const char *text)
{
_set_text(pi, text, pi->flags);
}
//======================
// 取得
//======================
/** 位置からアイテム取得
*
* @param index 負の値で現在のフォーカスアイテム */
mListViewItem *mLVItemMan_getItemByIndex(mLVItemMan *p,int index)
{
if(index < 0)
return p->itemFocus;
else
return (mListViewItem *)mListGetItemByIndex(&p->list, index);
}
/** アイテムのインデックス番号取得
*
* @param item NULL でフォーカスアイテム */
int mLVItemMan_getItemIndex(mLVItemMan *p,mListViewItem *item)
{
if(!item) item = p->itemFocus;
return mListGetItemIndex(&p->list, M_LISTITEM(item));
}
/** パラメータ値からアイテム検索 */
mListViewItem *mLVItemMan_findItemParam(mLVItemMan *p,intptr_t param)
{
mListViewItem *pi;
for(pi = _ITEM_TOP(p); pi; pi = M_LISTVIEWITEM(pi->i.next))
{
if(pi->param == param)
return pi;
}
return NULL;
}
/** アイテムの位置を上下に移動 */
mBool mLVItemMan_moveItem_updown(mLVItemMan *p,mListViewItem *item,mBool down)
{
if(!item) item = p->itemFocus;
return mListMoveUpDown(&p->list, M_LISTITEM(item), !down);
}
//=========================
// フォーカスアイテム
//=========================
/** フォーカスアイテムセット (単一選択)
*
* @return 変更されたか */
mBool mLVItemMan_setFocusItem(mLVItemMan *p,mListViewItem *item)
{
if(p->itemFocus == item)
return FALSE;
else
{
//選択解除
if(p->bMultiSel)
mLVItemMan_unselectAll(p);
else
{
if(p->itemFocus)
_ITEMFLAG_OFF(p->itemFocus, SELECTED);
}
//選択
if(item) _ITEMFLAG_ON(item, SELECTED);
p->itemFocus = item;
return TRUE;
}
}
/** 指定位置のアイテムをフォーカスにセット
*
* @param index 負の値で選択をなしに */
mBool mLVItemMan_setFocusItemByIndex(mLVItemMan *p,int index)
{
mListViewItem *pi;
if(index < 0)
pi = NULL;
else
pi = (mListViewItem *)mListGetItemByIndex(&p->list, index);
return mLVItemMan_setFocusItem(p, pi);
}
/** フォーカスアイテムを先頭または終端にセット */
mBool mLVItemMan_setFocusHomeEnd(mLVItemMan *p,mBool home)
{
return mLVItemMan_setFocusItem(p,
(home)? M_LISTVIEWITEM(p->list.top): M_LISTVIEWITEM(p->list.bottom));
}
//=========================
// 操作
//=========================
/** フォーカスアイテムを上下に選択移動 */
mBool mLVItemMan_updownFocus(mLVItemMan *p,mBool down)
{
mListViewItem *item;
item = p->itemFocus;
if(!item)
item = _ITEM_TOP(p);
else if(down)
{
//下
if(item->i.next) item = M_LISTVIEWITEM(item->i.next);
}
else
{
//上
if(item->i.prev) item = M_LISTVIEWITEM(item->i.prev);
}
return mLVItemMan_setFocusItem(p, item);
}
/** アイテム選択処理
*
* @return フォーカスが変更されたか */
mBool mLVItemMan_select(mLVItemMan *p,uint32_t state,mListViewItem *item)
{
mListViewItem *focus,*pi,*top,*end;
focus = p->itemFocus;
if(!p->bMultiSel)
{
//単一選択
if(focus) _ITEMFLAG_OFF(focus, SELECTED);
_ITEMFLAG_ON(item, SELECTED);
}
else
{
//----- 複数選択
//範囲選択時、カレントアイテムがなければ通常処理
if((state & M_MODS_SHIFT) && !focus)
state = 0;
//
if(state & M_MODS_CTRL)
{
//選択反転
item->flags ^= MLISTVIEW_ITEM_F_SELECTED;
}
else if(state & M_MODS_SHIFT)
{
//範囲 (カレント位置から指定位置まで)
mLVItemMan_unselectAll(p);
if(mListGetDir(&p->list, M_LISTITEM(focus), M_LISTITEM(item)) < 0)
top = focus, end = item;
else
top = item, end = focus;
for(pi = top; pi; pi = M_LISTVIEWITEM(pi->i.next))
{
_ITEMFLAG_ON(pi, SELECTED);
if(pi == end) break;
}
}
else
{
//通常 (単一選択)
mLVItemMan_unselectAll(p);
_ITEMFLAG_ON(item, SELECTED);
}
}
p->itemFocus = item;
return (focus != item);
}
| 18.462585 | 79 | 0.660526 |
6f8a4e3aca8cebb61ae9624b4cb2f8b66d311660 | 2,145 | h | C | iosapp-token-test/Pods/Headers/Google-API-Client/GTLBooksAnnotationdata.h | hash3r/ios-app-youtube-token-test | b0c08ee3d2b81cacd174bc9c3f1c39e484b85a88 | [
"MIT"
] | null | null | null | iosapp-token-test/Pods/Headers/Google-API-Client/GTLBooksAnnotationdata.h | hash3r/ios-app-youtube-token-test | b0c08ee3d2b81cacd174bc9c3f1c39e484b85a88 | [
"MIT"
] | null | null | null | iosapp-token-test/Pods/Headers/Google-API-Client/GTLBooksAnnotationdata.h | hash3r/ios-app-youtube-token-test | b0c08ee3d2b81cacd174bc9c3f1c39e484b85a88 | [
"MIT"
] | null | null | null | /* Copyright (c) 2012 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//
// GTLBooksAnnotationdata.h
//
// ----------------------------------------------------------------------------
// NOTE: This file is generated from Google APIs Discovery Service.
// Service:
// Books API (books/v1)
// Description:
// Lets you search for books and manage your Google Books library.
// Documentation:
// https://developers.google.com/books/docs/v1/getting_started
// Classes:
// GTLBooksAnnotationdata (0 custom class methods, 9 custom properties)
#if GTL_BUILT_AS_FRAMEWORK
#import "GTL/GTLObject.h"
#else
#import "GTLObject.h"
#endif
// ----------------------------------------------------------------------------
//
// GTLBooksAnnotationdata
//
@interface GTLBooksAnnotationdata : GTLObject
// The type of annotation this data is for.
@property (copy) NSString *annotationType;
@property (retain) id data;
// Base64 encoded data for this annotation data.
@property (copy) NSString *encodedData; // GTLBase64 can encode/decode (probably web-safe format)
// Unique id for this annotation data.
// identifier property maps to 'id' in JSON (to avoid Objective C's 'id').
@property (copy) NSString *identifier;
// Resource Type
@property (copy) NSString *kind;
// The Layer id for this data. *
@property (copy) NSString *layerId;
// URL for this resource. *
@property (copy) NSString *selfLink;
// Timestamp for the last time this data was updated. (RFC 3339 UTC date-time
// format).
@property (retain) GTLDateTime *updated;
// The volume id for this data. *
@property (copy) NSString *volumeId;
@end
| 29.383562 | 98 | 0.675524 |
8d8fc612437578562a7216c32ec1b59d39735607 | 1,145 | h | C | trunk/win/Source/BT_PbPersistenceManager.h | dyzmapl/BumpTop | 1329ea41411c7368516b942d19add694af3d602f | [
"Apache-2.0"
] | 460 | 2016-01-13T12:49:34.000Z | 2022-02-20T04:10:40.000Z | trunk/win/Source/BT_PbPersistenceManager.h | dyzmapl/BumpTop | 1329ea41411c7368516b942d19add694af3d602f | [
"Apache-2.0"
] | 24 | 2016-11-07T04:59:49.000Z | 2022-03-14T06:34:12.000Z | trunk/win/Source/BT_PbPersistenceManager.h | dyzmapl/BumpTop | 1329ea41411c7368516b942d19add694af3d602f | [
"Apache-2.0"
] | 148 | 2016-01-17T03:16:43.000Z | 2022-03-17T12:20:36.000Z | // Copyright 2012 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef BT_PBPERSISTENCEMANAGER_H
#define BT_PBPERSISTENCEMANAGER_H
#include "BT_Singleton.h"
class PbBumpObject;
class PbPersistenceManager
{
friend class Singleton<PbPersistenceManager>;
PbPersistenceManager();
public:
~PbPersistenceManager();
bool loadScene(const QString& filePath);
bool saveScene(const QString& filePath);
BumpObject * deserializeBumpObjectFromPb(const PbBumpObject * object);
static PbPersistenceManager * getInstance();
};
#endif // BT_PBPERSISTENCEMANAGER_H | 30.131579 | 76 | 0.749345 |
9d7d881879973a69983019337025cb6931731b25 | 483 | c | C | shared_memory.c | EPantelaios/OS---Semaphores-and-Shared-memory | 2d116ad15ba30a442489cb551c2e37eb47b14b31 | [
"MIT"
] | null | null | null | shared_memory.c | EPantelaios/OS---Semaphores-and-Shared-memory | 2d116ad15ba30a442489cb551c2e37eb47b14b31 | [
"MIT"
] | null | null | null | shared_memory.c | EPantelaios/OS---Semaphores-and-Shared-memory | 2d116ad15ba30a442489cb551c2e37eb47b14b31 | [
"MIT"
] | null | null | null | #include "shared_memory.h"
#define IPC_RESULT_ERROR (-1)
int shared_create(key_t key, size_t size){
if(key<0){
printf("Error in key!\n");
return IPC_RESULT_ERROR;
}
return shmget(key, size, IPC_CREAT | 0666);
}
message *shared_attach(int shared_id){
return shmat(shared_id, (const void *)0, 0);
}
int shared_detach(message *shm_ptr){
return shmdt(shm_ptr);
}
int shared_remove(int shared_id){
return shmctl(shared_id, IPC_RMID, 0);
} | 17.25 | 48 | 0.670807 |
cbfd229bb8f4dc3ed1079ee94051fc8cf8cb2fda | 617 | h | C | plugins/iphone/Node.h | dmzgroup/mbra | d6749472f7c5463863ca93a8faff37f2afc9d1df | [
"MIT"
] | 1 | 2015-11-05T03:03:43.000Z | 2015-11-05T03:03:43.000Z | plugins/iphone/Node.h | dmzgroup/mbra | d6749472f7c5463863ca93a8faff37f2afc9d1df | [
"MIT"
] | null | null | null | plugins/iphone/Node.h | dmzgroup/mbra | d6749472f7c5463863ca93a8faff37f2afc9d1df | [
"MIT"
] | null | null | null | #import <UIKit/UIKit.h>
@class Edge;
@interface Node : UIImageView {
UIImageView *_overlayView;
CGPoint _overlayOffset;
UILabel *_rankLabel;
NSMutableArray *_edgeList;
CGPoint _pos;
NSUInteger _rank;
}
@property (nonatomic, retain) UIImageView *overlayView;
@property (nonatomic, retain) UILabel *rankLabel;
@property (nonatomic, readwrite) CGPoint pos;
- (void)addEdge:(Edge *)edge;
- (void)removeEdge:(Edge *)edge;
- (void)removeAllEdges;
- (void)setRank:(NSUInteger)rank;
- (void)setSelected:(BOOL)value;
- (void)startNewNodeAnimation;
- (void)shrinkAndRemoveFromSuperview;
@end
| 18.69697 | 55 | 0.726094 |
ae62e4a4197fc13e8d61f389eee2e71fa487ab2b | 865 | h | C | include/Map/Dialogue.h | tizian/Cendric2 | 5b0438c73a751bcc0d63c3af839af04ab0fb21a3 | [
"MIT"
] | 279 | 2015-05-06T19:04:07.000Z | 2022-03-21T21:33:38.000Z | include/Map/Dialogue.h | tizian/Cendric2 | 5b0438c73a751bcc0d63c3af839af04ab0fb21a3 | [
"MIT"
] | 222 | 2016-10-26T15:56:25.000Z | 2021-10-03T15:30:18.000Z | include/Map/Dialogue.h | tizian/Cendric2 | 5b0438c73a751bcc0d63c3af839af04ab0fb21a3 | [
"MIT"
] | 49 | 2015-10-01T21:23:03.000Z | 2022-03-19T20:11:31.000Z | #pragma once
#include "global.h"
#include "ResourceManager.h"
#include "TextProvider.h"
#include "Structs/DialogueNode.h"
class WorldScreen;
class DialogueWindow;
// A dialogue with conditions, choices and text
class Dialogue final {
public:
void reload(const std::string& id, WorldScreen* screen, DialogueWindow* window);
const std::string& getID() const;
const std::string& getTextType() const;
void addNode(int tag, const DialogueNode& node);
void setNextNode(int tag);
void setRoot(int root);
bool updateWindow();
// returns whether the current dialogue is a choice node and one of them is an ending option
bool isEndable() const;
bool hasNode(int tag) const;
bool isTradeNode(int nodeTag) const;
private:
WorldScreen* m_screen;
DialogueWindow* m_window;
DialogueNode* m_currentNode;
std::string m_id;
std::map<int, DialogueNode> m_nodes;
}; | 27.03125 | 93 | 0.759538 |
c46581852df32bc8fb5f78efa349661de8d91625 | 5,551 | h | C | clientd3d/protocol.h | thuhuong2k/Meridian59 | 35db18ae00c7713da4d6bb4564454eab93c68bce | [
"FTL",
"OML"
] | 119 | 2015-08-19T17:57:01.000Z | 2022-03-30T01:41:51.000Z | clientd3d/protocol.h | thuhuong2k/Meridian59 | 35db18ae00c7713da4d6bb4564454eab93c68bce | [
"FTL",
"OML"
] | 120 | 2015-01-01T13:02:04.000Z | 2015-08-14T20:06:27.000Z | clientd3d/protocol.h | thuhuong2k/Meridian59 | 35db18ae00c7713da4d6bb4564454eab93c68bce | [
"FTL",
"OML"
] | 46 | 2015-08-16T23:21:34.000Z | 2022-02-05T01:08:22.000Z | // Meridian 59, Copyright 1994-2012 Andrew Kirmse and Chris Kirmse.
// All rights reserved.
//
// This software is distributed under a license that is described in
// the LICENSE file that accompanies it.
//
// Meridian is a registered trademark.
/*
* protocol.h: Header file for protocol.c.
*/
#ifndef _PROTOCOL_H
#define _PROTOCOL_H
#define MAX_PARAMS 15 /* Max # of parameters in message to server */
typedef BYTE param_type;
enum {
PARAM_ID = 1,
PARAM_COORD = 2,
PARAM_ATTACK_INFO = 3,
PARAM_OBJECT = 4,
PARAM_OBJECT_LIST = 5,
PARAM_STRING = 6,
PARAM_GROUP = 7,
PARAM_SAY_INFO = 8,
PARAM_ID_ARRAY = 9, /* Length of array, followed by array of IDs */
PARAM_BYTE = 10,
PARAM_ID_LIST = 11,
PARAM_INT_ARRAY = 12,
PARAM_NEWSID = 13,
PARAM_INDEX = 14, /* Generic 4 byte index number (news article #, etc.) */
PARAM_INT = 15, /* Generic 4 byte integer (not truncated to 28 bits) */
PARAM_WORD = 16, /* Generic 2 byte integer */
PARAM_END = 100,
};
typedef struct {
BYTE type;
param_type params[MAX_PARAMS + 1];
} client_message, *ClientMsgTable;
/* Encapsulate calls to ToServer */
/* Login mode messages */
#define RequestLogin(v1, v2, i1, i2, i3, i4, i5, w1, w2, i7, i8, i9, str1, str2) \
ToServer(AP_LOGIN, NULL, v1, v2, i1, i2, i3, i4, i5, w1, w2, i7, i8, i9, str1, str2)
#define RequestGame(time, catch, hostname) \
ToServer(AP_REQ_GAME, NULL, time, catch, hostname)
#define RequestAdmin() ToServer(AP_REQ_ADMIN, NULL)
#define RequestAdminNote(str) ToServer(AP_ADMINNOTE, NULL, str)
#define RequestResources() ToServer(AP_GETRESOURCE, NULL)
#define RequestAllFiles() ToServer(AP_GETALL, NULL)
#define RequestUpload() ToServer(AP_UPLOAD, NULL)
#define RequestRegister(str) ToServer(AP_REGISTER, NULL, str)
#define RequestMainMenu() ToServer(AP_REQ_MENU, NULL)
#define RequestLoginResync() ToServer(AP_RESYNC, NULL)
#define RequestLoginPing() ToServer(AP_PING, NULL)
/* Game mode messages */
#define SendLogoff() ToServer(BP_LOGOFF, NULL)
#define RequestPlayer() ToServer(BP_SEND_PLAYER, NULL)
#define RequestRoom() ToServer(BP_SEND_ROOM_CONTENTS, NULL)
// Convert from client 0-based coordinates to server 1-based coordinates
#define RequestMove(y, x, speed, room) \
ToServer(BP_REQ_MOVE, NULL, FinenessClientToKod(y) + KOD_FINENESS, \
FinenessClientToKod(x) + KOD_FINENESS, speed, room)
#define RequestObjectContents(id) ToServer(BP_SEND_OBJECT_CONTENTS, NULL, id)
#define RequestPickup(id) ToServer(BP_REQ_GET, NULL, id)
#define RequestInventory() ToServer(BP_REQ_INVENTORY, NULL)
#define RequestDrop(obj) ToServer(BP_REQ_DROP, NULL, obj)
#define RequestInventoryMove(id1, id2) ToServer(BP_REQ_INVENTORY_MOVE, NULL, id1, id2)
#define RequestPut(id1, id2) ToServer(BP_REQ_PUT, NULL, id1, id2)
#define SendSay(info, msg) ToServer(BP_SAY_TO, NULL, info, msg)
#define SendSayGroup(objs, msg) ToServer(BP_SAY_GROUP, NULL, objs, msg)
#define RequestLook(id) ToServer(BP_REQ_LOOK, NULL, id)
#define RequestUse(id) ToServer(BP_REQ_USE, NULL, id)
#define RequestUnuse(id) ToServer(BP_REQ_UNUSE, NULL, id)
#define RequestAttack(info, id) ToServer(BP_REQ_ATTACK, NULL, info, id)
#define RequestOffer(id, objs) ToServer(BP_REQ_OFFER, NULL, id, objs)
#define RequestDeposit(id, objs) ToServer(BP_REQ_DEPOSIT, NULL, id, objs)
#define SendCancelOffer() ToServer(BP_CANCEL_OFFER, NULL)
#define SendAcceptOffer() ToServer(BP_ACCEPT_OFFER, NULL)
#define RequestCounteroffer(objs) ToServer(BP_REQ_COUNTEROFFER, NULL, objs)
#define RequestGo() ToServer(BP_REQ_GO, NULL)
#define RequestPlayers() ToServer(BP_SEND_PLAYERS, NULL)
#define RequestBuy(obj) ToServer(BP_REQ_BUY, NULL, obj)
#define RequestWithdrawal(obj) ToServer(BP_REQ_WITHDRAWAL, NULL, obj)
#define RequestBuyItems(seller, objs) ToServer(BP_REQ_BUY_ITEMS, NULL, seller, objs)
#define RequestWithdrawalItems(banker, objs) ToServer(BP_REQ_WITHDRAWAL_ITEMS, NULL, banker, objs)
#define RequestQuit() ToServer(BP_REQ_QUIT, NULL)
#define RequestApply(obj1, obj2) ToServer(BP_REQ_APPLY, NULL, obj1, obj2)
#define RequestGameResync() ToServer(BP_RESYNC, NULL)
#define RequestCast(id, objs) ToServer(BP_REQ_CAST, NULL, id, objs)
#define RequestTurn(obj, angle) ToServer(BP_REQ_TURN, NULL, obj, angle)
#define RequestAction(action) ToServer(BP_ACTION, NULL, action)
#define SendSayBlocked(id) ToServer(BP_SAY_BLOCKED, NULL, id)
#define RequestChangeDescription(id, str) ToServer(BP_CHANGE_DESCRIPTION, NULL, id, str)
#define RequestActivate(id) ToServer(BP_REQ_ACTIVATE, NULL, id)
#define RequestGamePing() ToServer(BP_PING, NULL)
#define RequestChangeURL(obj, s) ToServer(BP_USERCOMMAND, user_msg_table, UC_CHANGE_URL, obj, s)
#define RequestChangePassword(str1, str2) ToServer(BP_CHANGE_PASSWORD, NULL, str1, str2)
#define RequestRescue() ToServer(BP_USERCOMMAND, user_msg_table, UC_REQ_RESCUE)
#define RequestRoundtrip(t) ToServer(BP_ROUNDTRIP2, NULL, t)
#define RequestTime() ToServer(BP_USERCOMMAND, user_msg_table, UC_REQ_TIME)
M59EXPORT void Logoff(void);
M59EXPORT void _cdecl ToServer(BYTE type, ClientMsgTable table, ...);
#endif /* #ifndef _PROTOCOL_H */
| 48.269565 | 100 | 0.701315 |
162b32d8b133d9de23dd842710dc3ec38ce7a305 | 274 | h | C | src/experiments/babybot/objectspotter/stlport/BC50/using/ostream.h | robotology-legacy/yarp1 | 21434f5b776edea201b39a9644552dca59339dbc | [
"Artistic-1.0-Perl"
] | null | null | null | src/experiments/babybot/objectspotter/stlport/BC50/using/ostream.h | robotology-legacy/yarp1 | 21434f5b776edea201b39a9644552dca59339dbc | [
"Artistic-1.0-Perl"
] | null | null | null | src/experiments/babybot/objectspotter/stlport/BC50/using/ostream.h | robotology-legacy/yarp1 | 21434f5b776edea201b39a9644552dca59339dbc | [
"Artistic-1.0-Perl"
] | 1 | 2020-04-06T02:02:28.000Z | 2020-04-06T02:02:28.000Z | using _STLP_NEW_IO_NAMESPACE::basic_ostream;
using _STLP_NEW_IO_NAMESPACE::ostream;
# ifndef _STLP_NO_WIDE_STREAMS
using _STLP_NEW_IO_NAMESPACE::wostream;
# endif
using _STLP_NEW_IO_NAMESPACE::endl;
using _STLP_NEW_IO_NAMESPACE::ends;
using _STLP_NEW_IO_NAMESPACE::flush;
| 24.909091 | 44 | 0.857664 |
4209ee97ca7eda1defe2ff41bf0971b9feab4dc9 | 3,273 | h | C | chrome/browser/autocomplete/extension_app_provider.h | SlimKatLegacy/android_external_chromium | bc611cda58cc18d0dbaa8a7aee05eb3c0742e573 | [
"BSD-3-Clause"
] | 2 | 2017-02-20T14:25:04.000Z | 2019-12-13T13:58:28.000Z | chrome/browser/autocomplete/extension_app_provider.h | SlimKatLegacy/android_external_chromium | bc611cda58cc18d0dbaa8a7aee05eb3c0742e573 | [
"BSD-3-Clause"
] | 2 | 2017-07-25T09:37:22.000Z | 2017-08-04T07:18:56.000Z | chrome/browser/autocomplete/extension_app_provider.h | SlimKatLegacy/android_external_chromium | bc611cda58cc18d0dbaa8a7aee05eb3c0742e573 | [
"BSD-3-Clause"
] | 2 | 2017-08-09T09:03:23.000Z | 2020-05-26T09:14:49.000Z | // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
//
// This file contains the Extension App autocomplete provider. The provider
// is responsible for keeping track of which Extension Apps are installed and
// their URLs. An instance of it gets created and managed by the autocomplete
// controller.
//
// For more information on the autocomplete system in general, including how
// the autocomplete controller and autocomplete providers work, see
// chrome/browser/autocomplete.h.
#ifndef CHROME_BROWSER_AUTOCOMPLETE_EXTENSION_APP_PROVIDER_H_
#define CHROME_BROWSER_AUTOCOMPLETE_EXTENSION_APP_PROVIDER_H_
#pragma once
#include <string>
#include <utility>
#include <vector>
#include "base/compiler_specific.h"
#include "chrome/browser/autocomplete/autocomplete.h"
#include "chrome/browser/autocomplete/autocomplete_match.h"
#include "content/common/notification_observer.h"
#include "content/common/notification_registrar.h"
class TemplateURLModel;
class ExtensionAppProvider : public AutocompleteProvider,
public NotificationObserver {
public:
ExtensionAppProvider(ACProviderListener* listener, Profile* profile);
// Only used for testing.
void AddExtensionAppForTesting(const std::string& app_name,
const std::string url);
// AutocompleteProvider implementation:
virtual void Start(const AutocompleteInput& input,
bool minimal_changes) OVERRIDE;
private:
// An ExtensionApp is a pair of Extension Name and the Launch URL.
typedef std::pair<std::string, std::string> ExtensionApp;
typedef std::vector<ExtensionApp> ExtensionApps;
virtual ~ExtensionAppProvider();
// Fetch the current app list and cache it locally.
void RefreshAppList();
// Register for install/uninstall notification so we can update our cache.
void RegisterForNotifications();
// Highlights a certain part of a match string within a certain match class.
// |input| is the input we got from the user, |match_class| is the
// AutoComplete match classification that keeps track of the highlighting
// values, and |iter| is the location of the user input found within
// |match_string|.
void HighlightMatch(const AutocompleteInput& input,
ACMatchClassifications* match_class,
std::string::const_iterator iter,
const std::string& match_string);
// Calculate the relevance of the match.
int CalculateRelevance(AutocompleteInput::Type type,
int input_length,
int target_length,
const GURL& url);
// NotificationObserver implementation:
virtual void Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) OVERRIDE;
NotificationRegistrar registrar_;
// Our cache of ExtensionApp objects (name + url) representing the extension
// apps we know about.
ExtensionApps extension_apps_;
DISALLOW_COPY_AND_ASSIGN(ExtensionAppProvider);
};
#endif // CHROME_BROWSER_AUTOCOMPLETE_EXTENSION_APP_PROVIDER_H_
| 37.193182 | 78 | 0.724717 |
8f9aacdae8842ee7d40d5620142923a4e5a58e0f | 1,609 | h | C | src/Util/JsonWriter.h | Jasonchan35/ax_project_gen | 0eec9e63cf21726db718e8d6215674c0bb899e67 | [
"MIT"
] | 7 | 2017-04-04T02:16:00.000Z | 2021-09-09T19:47:56.000Z | src/Util/JsonWriter.h | Jasonchan35/ax_project_gen | 0eec9e63cf21726db718e8d6215674c0bb899e67 | [
"MIT"
] | null | null | null | src/Util/JsonWriter.h | Jasonchan35/ax_project_gen | 0eec9e63cf21726db718e8d6215674c0bb899e67 | [
"MIT"
] | 4 | 2017-07-07T17:07:50.000Z | 2021-11-13T01:42:45.000Z | #pragma once
#include "../common.h"
#include "String.h"
namespace ax_gen {
class JsonWriter {
public:
~JsonWriter();
class ObjectScope : public NonCopyable {
public:
ObjectScope(JsonWriter* p);
ObjectScope(ObjectScope && rhs);
~ObjectScope();
private:
JsonWriter* _p;
};
class ArrayScope : public NonCopyable {
public:
ArrayScope(JsonWriter* p);
ArrayScope(ArrayScope && rhs);
~ArrayScope();
private:
JsonWriter* _p;
};
ObjectScope objectScope(const StrView& name) { beginObject(name); return ObjectScope(this); }
ObjectScope objectScope() { beginObject(); return ObjectScope(this); }
ArrayScope arrayScope(const StrView& name) { beginArray(name); return ArrayScope(this); }
ArrayScope arrayScope() { beginArray(); return ArrayScope(this); }
void beginObject(const StrView& name);
void beginObject();
void endObject();
void beginArray(const StrView& name);
void beginArray();
void endArray();
void memberName(const StrView& name);
void write(int value);
void write(double value);
void write(bool value);
void write(const StrView& value);
template<typename VALUE>
void member(const StrView& name, const VALUE& value) {
memberName(name);
write(value);
}
String& buffer() { return _buf; }
void writeComma();
void newline(int offset = 0);
private:
void quoteString(const StrView& v);
enum class LevelType {
Object,
Array,
};
String _buf;
Vector<LevelType> _level;
bool _commaNeeded {false};
bool _newlineNeeded {true};
};
} //namespace
| 21.171053 | 95 | 0.668117 |
e907e550f308bdf6ed6ef41b0ed6ab3ff5f436a0 | 2,797 | h | C | interface/src/scripting/SettingsScriptingInterface.h | parkerchard/hifi | ae348babe4624bbce4151c9d84fa9cbeedf2c0eb | [
"Apache-2.0"
] | null | null | null | interface/src/scripting/SettingsScriptingInterface.h | parkerchard/hifi | ae348babe4624bbce4151c9d84fa9cbeedf2c0eb | [
"Apache-2.0"
] | null | null | null | interface/src/scripting/SettingsScriptingInterface.h | parkerchard/hifi | ae348babe4624bbce4151c9d84fa9cbeedf2c0eb | [
"Apache-2.0"
] | 2 | 2019-06-13T22:25:13.000Z | 2022-01-31T15:17:55.000Z | //
// SettingsScriptingInterface.h
// interface/src/scripting
//
// Created by Brad Hefta-Gaub on 3/22/14.
// Copyright 2014 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#ifndef hifi_SettingsScriptingInterface_h
#define hifi_SettingsScriptingInterface_h
#include <QObject>
#include <QString>
/**jsdoc
* The Settings API provides a facility to store and retrieve values that persist between Interface runs.
* @namespace Settings
*
* @hifi-interface
* @hifi-client-entity
* @hifi-avatar
*/
class SettingsScriptingInterface : public QObject {
Q_OBJECT
SettingsScriptingInterface() { };
public:
static SettingsScriptingInterface* getInstance();
public slots:
/**jsdoc
* Retrieve the value from a named setting.
* @function Settings.getValue
* @param {string} key - The name of the setting.
* @param {string|number|boolean|object} [defaultValue=""] - The value to return if the setting doesn't exist.
* @returns {string|number|boolean|object} The value stored in the named setting if it exists, otherwise the
* <code>defaultValue</code>.
* @example <caption>Retrieve non-existent setting values.</caption>
* var value1 = Settings.getValue("Script Example/Nonexistent Key");
* print("Value: " + (typeof value1) + " " + JSON.stringify(value1)); // string ""
*
* var value2 = Settings.getValue("Script Example/Nonexistent Key", true);
* print("Value: " + (typeof value2) + " " + JSON.stringify(value2)); // boolean true
*/
QVariant getValue(const QString& setting);
QVariant getValue(const QString& setting, const QVariant& defaultValue);
/**jsdoc
* Store a value in a named setting. If the setting already exists its value is overwritten, otherwise a new setting is
* created. If the value is set to <code>null</code> or <code>undefined</code>, the setting is deleted.
* @function Settings.setValue
* @param {string} key - The name of the setting. Be sure to use a unique name if creating a new setting.
* @param {string|number|boolean|object|undefined} value - The value to store in the setting. If <code>null</code> or
* <code>undefined</code> is specified, the setting is deleted.
* @example <caption>Store and retrieve an object value.</caption>
* Settings.setValue("Script Example/My Key", { x: 0, y: 10, z: 0 });
*
* var value = Settings.getValue("Script Example/My Key");
* print("Value: " + (typeof value) + " " + JSON.stringify(value)); // object {"x":0,"y":10,"z":0}
*/
void setValue(const QString& setting, const QVariant& value);
};
#endif // hifi_SettingsScriptingInterface_h
| 40.536232 | 124 | 0.68645 |
e92fd3c8e9fc59292e493012f1aa749a82731067 | 3,094 | c | C | Embedded C/Grid Following/Unbugged/trial.c | gyani91/Robotics | 124b9df7ae82e8c9b9ad54c74292585e81c7a3bb | [
"MIT"
] | null | null | null | Embedded C/Grid Following/Unbugged/trial.c | gyani91/Robotics | 124b9df7ae82e8c9b9ad54c74292585e81c7a3bb | [
"MIT"
] | null | null | null | Embedded C/Grid Following/Unbugged/trial.c | gyani91/Robotics | 124b9df7ae82e8c9b9ad54c74292585e81c7a3bb | [
"MIT"
] | null | null | null | #include<avr/io.h>
#include<util/delay.h>
#include<compat/deprecated.h>
#include<ilcd.h>
#define s1_clr bit_is_clear(PIND,0)
#define s2_clr bit_is_clear(PIND,1)
#define s3_clr bit_is_clear(PIND,2)
#define s4_clr bit_is_clear(PIND,3)
#define s1_set bit_is_set(PIND,0)
#define s2_set bit_is_set(PIND,1)
#define s3_set bit_is_set(PIND,2)
#define s4_set bit_is_set(PIND,3)
#define fwd PORTC=5
#define right PORTC=6
#define left PORTC=9
#define stop PORTC=0
void stgt(int);
void rgtturn();
void leftturn();
void zigzag(int,int);
void lead(int,int);
int x,y,dir,x1,y1;
int main()
{
DDRD=0xF0;
DDRC=0b11111111;
DDRB=0x0F;
int b,l;
b=3;
l=3;
x1=1;
y1=1;
//zigzag(b-1,l-1);
lead(1,2);
lead(2,2);
lead(3,3);
//lead(2,1);
//lead(1,1);
stop;
}
void stgt(int a)
{
int i;
for(i=1;i<=a;)
{
if(s1_clr && s2_clr && s3_clr && s4_clr)
{
i++;
fwd;
while(PIND==0);
}
if(s2_clr && s3_clr && s1_set && s4_set)
{
fwd;
}
if(s1_set && s2_set && s3_clr && s4_set)
{
right;
}
if(s1_set && s2_clr && s3_set && s4_set)
{
left;
}
}
PORTC=0;
}
void rgtturn()
{
fwd;
_delay_ms(1800);
right;
while(PIND!=7);
right;
while(PIND!=9);
}
void leftturn()
{
fwd;
_delay_ms(1800);
left;
while(PIND!=14);
left;
while(PIND!=9);
}
void abtturn()
{
fwd;
_delay_ms(1800);
right;
while(PIND!=7);
right;
while(PIND!=9);
right;
while(PIND!=7);
right;
while(PIND!=9);
}
/*void lcd(int a,int b,int c)
{
lcd_init();
lcd_goto(1,1);
lcd_prints("X");
lcd_goto(9,1);
lcd_prints("Y");
lcd_goto(13,1);
lcd_prints("DIR");
lcd_goto(1,2);
lcd_printi(a);
lcd_goto(9,2);
lcd_printi(b);
lcd_goto(14,2);
lcd_printi(c);
}*/
void lead(int col,int row)
{
int a,b;
a=col-x1;
b=row-y1;
if(a>0 && b>0)
{
stgt(b);
rgtturn();
dir=2;
stgt(a);
leftturn();
dir=1;
}
else if(a<0 && b<0)
{
a=a*(-1);
b=b*(-1);
leftturn();
dir=4;
stgt(a);
leftturn();
dir=3;
stgt(b);
abtturn();
dir=1;
}
else if(a<0 && b==0)
{
a=a*(-1);
leftturn();
dir=4;
stgt(a);
rgtturn();
dir=1;
}
else if(a<0 && b>0)
{
a=a*(-1);
stgt(b);
leftturn();
dir=4;
stgt(a);
rgtturn();
dir=1;
}
else if(a==0 && b<0)
{
b=b*(-1);
abtturn();
dir=3;
stgt(b);
abtturn();
dir=1;
}
else if(a==0 && b>0)
{
stgt(b);
}
else if(a>0 && b<0)
{
b=b*(-1);
rgtturn();
dir=2;
stgt(a);
leftturn();
dir=3;
stgt(b);
abtturn();
dir=1;
}
else if(a>0 && b==0)
{
rgtturn();
dir=2;
stgt(a);
leftturn();
dir=1;
}
x1=col;
y1=row;
}
/*void zigzag(int r,int c)
{
int i;
stgt(r);
for(i=1;i<=c;i++)
{
if(i%2!=0)
{
rgtturn();
stgt(1);
rgtturn();
stgt(r);
}
if(i%2==0)
{
leftturn();
stgt(1);
leftturn();
stgt(r);
}
}
if(c%2==0)
{
abtturn();
stgt(r);
rgtturn();
stgt(c);
rgtturn();
}
if(c%2!=0)
{
rgtturn();
stgt(c);
rgtturn();
}
}*/
| 12.680328 | 43 | 0.511312 |
e947be3c486e148369af39dacbfad1eb58d54a69 | 441 | h | C | RASFloatingBall/AppDelegate.h | air1120/RASFloatingBall | d8e256b393d5f5e47a1202f0857d3fce0a663e35 | [
"MIT"
] | null | null | null | RASFloatingBall/AppDelegate.h | air1120/RASFloatingBall | d8e256b393d5f5e47a1202f0857d3fce0a663e35 | [
"MIT"
] | null | null | null | RASFloatingBall/AppDelegate.h | air1120/RASFloatingBall | d8e256b393d5f5e47a1202f0857d3fce0a663e35 | [
"MIT"
] | null | null | null | //
// AppDelegate.h
// RASFloatingBall
//
// Created by Rason on 2017/4/22.
// Copyright © 2017年 Rason. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "RASFloatingBall.h"
@interface AppDelegateManager : NSObject
+ (instancetype)shareManager;
@property (nonatomic, strong) RASFloatingBall *floatinBall;
@end
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
| 18.375 | 60 | 0.743764 |
55509e11d022d89ca5da5259074ca7e703e47681 | 2,983 | h | C | src/CommStrings.h | tehilinski/MTBMPI | 5d8fa590c6708c6ef412c6d2959f04e125f2d9e0 | [
"Apache-2.0"
] | null | null | null | src/CommStrings.h | tehilinski/MTBMPI | 5d8fa590c6708c6ef412c6d2959f04e125f2d9e0 | [
"Apache-2.0"
] | null | null | null | src/CommStrings.h | tehilinski/MTBMPI | 5d8fa590c6708c6ef412c6d2959f04e125f2d9e0 | [
"Apache-2.0"
] | null | null | null | /*! ----------------------------------------------------------------------------------------------------------
@file CommStrings.h
@class mtbmpi::CommStrings
@brief Sends an array of strings to specified tasks, using the specified MPI communicator.
@example ../tests/Test_CommStrings.cpp
@internal
project Master-Task-Blackboard MPI Framework
@author Thomas E. Hilinski <https://github.com/tehilinski>
@copyright Copyright 2020 Thomas E. Hilinski. All rights reserved.
This software library, including source code and documentation,
is licensed under the Apache License version 2.0.
See "LICENSE.md" for more information.
------------------------------------------------------------------------------------------------------------*/
#ifndef INC_mtbmpi_CommStrings_h
#define INC_mtbmpi_CommStrings_h
#include "mpi.h"
#include "Communicator.h"
#include "SendsMsgsToLog.h"
#include "MsgTags.h"
#include "UtilitiesMPI.h"
namespace mtbmpi {
class CommStrings
{
public:
typedef TaskID::IDNum IDNum;
/// Constructor
CommStrings (
int const parentID, ///< sends rank
LoggerMPI & logger, ///< receives log messages
Communicator & useComm ///< communicator to send messages
); // here for doxygen bug
~CommStrings ();
/// Call by sender only; sends the string array to the destination process
void Isend (
IDNum const destinationID, ///< destination task ID
MsgTags const msgTag, ///< tag ID for message
StrVec & strVec ); ///< strings to send
/// Call by receiver only; receives the string array
void Receive(
IDNum const sourceID, ///< source task ID
MsgTags const msgTag, ///< tag ID for message
StrVec & strVec ); ///< returns received strings
/// Call by sender only; call after all Sends are done
void WaitAll ();
/// number of sends == number of destination processes
int GetSendCount () const { return sendCount; }
static char const lineDelimiter; ///< packed data delimiter
private:
/// @cond SKIP_PRIVATE
typedef std::vector<char> TBufferData; // bytes
typedef std::pair< TBufferData, int> TBuffer; // data, size
typedef std::vector< TBuffer > TBufferArray; // array of buffers
int const idParent;
LoggerMPI & logger;
Communicator & comm;
std::vector<MPI::Request> requests;
TBufferArray asyncBuffers; // asynchronous send buffers; size = no. work processes
int sendCount; // number of sends == number of destination processes
int PackData ( // returns buffer, size
StrVec const & strVec,
int const numCmdLines,
TBuffer & buffer);
void PrepareData (
StrVec & strVec, ///< strings to send
int & numChars); ///< returns sum of strVec sizes
// unused functions
CommStrings (CommStrings const & rhs);
CommStrings & operator= (CommStrings const & rhs);
bool operator== (CommStrings const &rhs) const;
bool operator!= (CommStrings const & rhs) const;
/// @endcond
};
} // namespace mtbmpi
#endif // INC_mtbmpi_CommStrings_h
| 30.752577 | 110 | 0.658062 |
1d70ffbb1b62e7a88c2b3fee7e7432959b3f8f9a | 624 | h | C | Framework/include/containers/containers.h | roncato/realtime | b0faeca49c28be9b5b68f16572d67188db926235 | [
"MIT"
] | null | null | null | Framework/include/containers/containers.h | roncato/realtime | b0faeca49c28be9b5b68f16572d67188db926235 | [
"MIT"
] | 1 | 2020-06-06T01:29:59.000Z | 2020-06-09T03:14:52.000Z | Framework/include/containers/containers.h | roncato/realtime | b0faeca49c28be9b5b68f16572d67188db926235 | [
"MIT"
] | null | null | null | /*
* containers.h
*
* Created: 6/17/2017 4:31:03 PM
* Author: roncato
*/
#ifndef CONTAINERS_H_
#define CONTAINERS_H_
namespace containers {
template <class T>
struct SinglyLinkedNode {
T elem;
SinglyLinkedNode<T>* next;
};
template <class K, class V>
struct Entry {
K key;
V value;
};
template <class K, class V>
struct SinglyLinkedEntryNode {
K key;
V value;
SinglyLinkedEntryNode<K, V>* next;
};
template <class K, class V>
struct BinaryTreeNode {
K key;
V value;
BinaryTreeNode<K, V>* left{nullptr};
BinaryTreeNode<K, V>* right{nullptr};
};
} // namespace containers
#endif /* CONTAINERS_H_ */ | 14.181818 | 38 | 0.690705 |
0dc77003b8c01fa261327b74e51f32b8fa8f0a00 | 1,790 | c | C | clientserver/authserver/authserver.c | Pridexs/dit | 9135f09ef6449b48fc204f9540e8a2261ff16af4 | [
"MIT"
] | null | null | null | clientserver/authserver/authserver.c | Pridexs/dit | 9135f09ef6449b48fc204f9540e8a2261ff16af4 | [
"MIT"
] | null | null | null | clientserver/authserver/authserver.c | Pridexs/dit | 9135f09ef6449b48fc204f9540e8a2261ff16af4 | [
"MIT"
] | null | null | null | /* Alexandre Maros - D14128553
* Class C
*/
#include "unp.h"
int main(int argc, char **argv)
{
int listenfd, connfd, n;
struct sockaddr_in servaddr;
char in_buff[MAXLINE];
char out_buff[MAXLINE];
char user[64], pass[64];
char cliIp[MAXLINE];
struct sockaddr_in cliaddr;
socklen_t len;
if (argc != 2)
err_quit("Usage: ./x <PortNumber>");
listenfd = Socket(AF_INET, SOCK_STREAM, 0);
bzero(&servaddr, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
servaddr.sin_port = htons(atoi(argv[1]));
Bind(listenfd, (SA *) &servaddr, sizeof(servaddr));
Listen(listenfd, LISTENQ);
for(;;)
{
len = sizeof(cliaddr);
connfd = Accept(listenfd, (SA *) &cliaddr, &len);
inet_ntop(AF_INET, &cliaddr.sin_addr, cliIp, sizeof(cliIp));
while( (n = read(connfd, in_buff, MAXLINE)) > 0)
{
if (strstr(in_buff, "\r\n\r\n"))
{
break;
}
}
if (n < 0)
err_sys("read error");
sscanf(in_buff, "username: %s password: %s", user, pass);
if (strcmp(user, "admin") == 0 && strcmp(pass, "pass") == 0)
{
snprintf(out_buff, sizeof(out_buff),
"PROCEED, Your IP Address is: %s and your Port Number is: %d\r\n",
cliIp, ntohs(cliaddr.sin_port));
}
else
{
snprintf(out_buff, sizeof(out_buff), "DENIED\r\n");
}
Write(connfd, out_buff, strlen(out_buff));
Close(connfd);
}
return 0;
}
| 27.121212 | 79 | 0.496089 |
c0239e08bdce555b76b6903c1972a31b611c4ebc | 254 | c | C | Oppgaver_fra_Digitale_Systemer/Sett3/oppgave2.c | rambech/Digitale_Systemer | 562fccdcf05796f1fffb5c5753655a0894716ce3 | [
"MIT"
] | null | null | null | Oppgaver_fra_Digitale_Systemer/Sett3/oppgave2.c | rambech/Digitale_Systemer | 562fccdcf05796f1fffb5c5753655a0894716ce3 | [
"MIT"
] | null | null | null | Oppgaver_fra_Digitale_Systemer/Sett3/oppgave2.c | rambech/Digitale_Systemer | 562fccdcf05796f1fffb5c5753655a0894716ce3 | [
"MIT"
] | null | null | null | #include <stdio.h>
void xe();
double nok;
double eu;
int main(int argc, char const *argv[])
{
xe();
printf("Qvanta dinero?\n");
scanf("%lf", &nok);
xe();
printf("%2.2lf\n", eu);
return 0;
}
void xe(){
//1 euro er 9.69 kroner
eu = nok/9.69;
} | 12.095238 | 38 | 0.574803 |
6da3d2f92239c120093b8431659027b4e58dcc88 | 3,826 | h | C | src/pmp/types.h | choyfung/pmp-library | 4a72c918494dac92f5e77545b71c7a327dafe71e | [
"BSD-3-Clause"
] | 1 | 2020-05-21T04:15:44.000Z | 2020-05-21T04:15:44.000Z | src/pmp/types.h | choyfung/pmp-library | 4a72c918494dac92f5e77545b71c7a327dafe71e | [
"BSD-3-Clause"
] | null | null | null | src/pmp/types.h | choyfung/pmp-library | 4a72c918494dac92f5e77545b71c7a327dafe71e | [
"BSD-3-Clause"
] | 1 | 2020-05-21T04:15:52.000Z | 2020-05-21T04:15:52.000Z | //=============================================================================
// Copyright (C) 2011-2017 The pmp-library developers
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of the copyright holder nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//=============================================================================
#pragma once
//=============================================================================
#include <pmp/MatVec.h>
#include <cstdint> // for std::uint_least32_t
//=============================================================================
//! \def PMP_ASSERT(x)
//! Custom assert macro that allows to silence unused variable warnings with no
//! overhead. Generates no code in release mode since if the argument to
//! sizeof() is an expression it is not evaluated. In debug mode we just fall
//! back to the default assert().
#ifdef NDEBUG
#define PMP_ASSERT(x) \
do \
{ \
(void)sizeof(x); \
} while (0)
#else
#define PMP_ASSERT(x) assert(x)
#endif
//! \def PMP_SHOW(x)
//! A simple pretty-printing debug macro. Prints the expression and its value.
#define PMP_SHOW(x) std::cerr << #x " = '" << x << "'" << std::endl;
//=============================================================================
//! The pmp-library namespace
namespace pmp {
//=============================================================================
//! Scalar type
typedef float Scalar;
//! Point type
typedef Vector<Scalar, 3> Point;
//! Normal type
typedef Vector<Scalar, 3> Normal;
//! Color type
typedef Vector<Scalar, 3> Color;
//! Texture coordinate type
typedef Vector<Scalar, 2> TextureCoordinate, TexCoord;
// define index type to be used
#ifdef PMP_INDEX_TYPE_64
typedef std::uint_least64_t IndexType;
#define PMP_MAX_INDEX UINT_LEAST64_MAX
#else
typedef std::uint_least32_t IndexType;
#define PMP_MAX_INDEX UINT_LEAST32_MAX
#endif
//! \defgroup algorithms algorithms
//! \brief Geometry processing algorithms.
//! \defgroup geometry geometry
//! \brief Data structures for representing geometric data sets.
//! \defgroup gl gl
//! \brief Visualization tools using OpenGL.
//! \defgroup io io
//! \brief Classes for reading and writing geometry data structures.
//=============================================================================
} // namespace pmp
//=============================================================================
| 37.881188 | 80 | 0.613696 |
33bc71fb58c91262a52945c36a7c705139d34ba2 | 4,049 | c | C | src/rwops/rwops_segment.c | Aragami1408/taisei | cbe07e53df4c4a0c430823ab83d3e605b017a4c5 | [
"CC-BY-4.0"
] | 573 | 2017-10-12T17:48:57.000Z | 2022-03-28T05:44:43.000Z | src/rwops/rwops_segment.c | Aragami1408/taisei | cbe07e53df4c4a0c430823ab83d3e605b017a4c5 | [
"CC-BY-4.0"
] | 153 | 2017-10-18T19:51:33.000Z | 2022-03-31T11:06:40.000Z | src/rwops/rwops_segment.c | Aragami1408/taisei | cbe07e53df4c4a0c430823ab83d3e605b017a4c5 | [
"CC-BY-4.0"
] | 72 | 2017-11-17T17:32:46.000Z | 2022-03-23T11:36:33.000Z | /*
* This software is licensed under the terms of the MIT License.
* See COPYING for further information.
* ---
* Copyright (c) 2011-2019, Lukas Weber <laochailan@web.de>.
* Copyright (c) 2012-2019, Andrei Alexeyev <akari@taisei-project.org>.
*/
#include "taisei.h"
#include "rwops_segment.h"
#include "util.h"
typedef struct Segment {
SDL_RWops *wrapped;
size_t start;
size_t end;
int64_t pos; // fallback for non-seekable streams
bool autoclose;
} Segment;
#define SEGMENT(rw) ((Segment*)((rw)->hidden.unknown.data1))
static int64_t segment_seek(SDL_RWops *rw, int64_t offset, int whence) {
Segment *s = SEGMENT(rw);
switch(whence) {
case RW_SEEK_CUR: {
if(offset) {
int64_t pos = SDL_RWtell(s->wrapped);
if(pos < 0) {
return pos;
}
if(pos + offset > s->end) {
offset = s->end - pos;
} else if(pos + offset < s->start) {
offset = s->start - pos;
}
}
break;
}
case RW_SEEK_SET: {
offset += s->start;
if(offset > s->end) {
offset = s->end;
}
break;
}
case RW_SEEK_END: {
int64_t size = SDL_RWsize(s->wrapped);
if(size < 0) {
return size;
}
if(size > s->end) {
offset -= size - s->end;
}
if(size + offset < s->start) {
offset += s->start - (size + offset);
}
break;
}
default: {
SDL_SetError("Bad whence value %i", whence);
return -1;
}
}
int64_t result = SDL_RWseek(s->wrapped, offset, whence);
if(result > 0) {
if(s->start > result) {
result = 0;
} else {
result -= s->start;
}
}
return result;
}
static int64_t segment_size(SDL_RWops *rw) {
Segment *s = SEGMENT(rw);
int64_t size = SDL_RWsize(s->wrapped);
if(size < 0) {
return size;
}
if(size > s->end) {
size = s->end;
}
return size - s->start;
}
static size_t segment_readwrite(SDL_RWops *rw, void *ptr, size_t size, size_t maxnum, bool write) {
Segment *s = SEGMENT(rw);
int64_t pos = SDL_RWtell(s->wrapped);
size_t onum;
if(pos < 0) {
log_debug("SDL_RWtell failed (%i): %s", (int)pos, SDL_GetError());
SDL_SetError("segment_readwrite: SDL_RWtell failed (%i) %s", (int)pos, SDL_GetError());
// this could be a non-seekable stream, like /dev/stdin...
// let's assume nothing else uses the wrapped stream and try to guess the current position
// this only works if the actual positon in the stream at the time of segment creation matched s->start...
pos = s->pos;
} else {
s->pos = pos;
}
if(pos < s->start || pos > s->end) {
log_warn("Segment range violation");
SDL_SetError("segment_readwrite: segment range violation");
return 0;
}
int64_t maxsize = s->end - pos;
while(size * maxnum > maxsize) {
if(!--maxnum) {
return 0;
}
}
if(write) {
onum = SDL_RWwrite(s->wrapped, ptr, size, maxnum);
} else {
onum = SDL_RWread(s->wrapped, ptr, size, maxnum);
}
s->pos += onum / size;
assert(s->pos <= s->end);
return onum;
}
static size_t segment_read(SDL_RWops *rw, void *ptr, size_t size, size_t maxnum) {
return segment_readwrite(rw, ptr, size, maxnum, false);
}
static size_t segment_write(SDL_RWops *rw, const void *ptr, size_t size, size_t maxnum) {
return segment_readwrite(rw, (void*)ptr, size, maxnum, true);
}
static int segment_close(SDL_RWops *rw) {
if(rw) {
Segment *s = SEGMENT(rw);
if(s->autoclose) {
SDL_RWclose(s->wrapped);
}
free(s);
SDL_FreeRW(rw);
}
return 0;
}
SDL_RWops *SDL_RWWrapSegment(SDL_RWops *src, size_t start, size_t end, bool autoclose) {
if(UNLIKELY(!src)) {
return NULL;
}
assert(end > start);
SDL_RWops *rw = SDL_AllocRW();
if(UNLIKELY(!rw)) {
return NULL;
}
memset(rw, 0, sizeof(SDL_RWops));
rw->type = SDL_RWOPS_UNKNOWN;
rw->seek = segment_seek;
rw->size = segment_size;
rw->read = segment_read;
rw->write = segment_write;
rw->close = segment_close;
Segment *s = malloc(sizeof(Segment));
s->wrapped = src;
s->start = start;
s->end = end;
s->autoclose = autoclose;
// fallback for non-seekable streams
s->pos = start;
rw->hidden.unknown.data1 = s;
return rw;
}
| 19.373206 | 108 | 0.636206 |
81e4bb40bf5edc297efb02e0e4155ce817923f99 | 771 | h | C | time_util.h | apppur/mahjong | d2b5ce29017466d161223a7ef65cee1eb3bea9ba | [
"MIT"
] | null | null | null | time_util.h | apppur/mahjong | d2b5ce29017466d161223a7ef65cee1eb3bea9ba | [
"MIT"
] | null | null | null | time_util.h | apppur/mahjong | d2b5ce29017466d161223a7ef65cee1eb3bea9ba | [
"MIT"
] | null | null | null | #include <iostream>
#include <ctime>
#include <ratio>
#include <chrono>
class TimeUtil
{
public:
TimeUtil()
{
start = std::chrono::steady_clock::now();
}
~TimeUtil() {}
double Span()
{
std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now();
std::chrono::duration<double> time_span = std::chrono::duration_cast<std::chrono::duration<double>>(end-start);
std::cout << "Calc win cost :" << time_span.count() << " seconds" << std::endl;
return time_span.count();
}
void Reset()
{
start = std::chrono::steady_clock::now();
}
private:
std::chrono::steady_clock::time_point start;
};
| 24.870968 | 123 | 0.539559 |
375b69a5c736690868e7f9af14746b6719b0e21d | 618 | h | C | XmilsSDKDo/Classes/SceneAdSdk.framework/Headers/SceneAdSdkZKRewardView.h | Ben21hao/XmilsSDKDo | d72090fd8e5f9991388d23d87c18572bd7f3bbae | [
"MIT"
] | null | null | null | XmilsSDKDo/Classes/SceneAdSdk.framework/Headers/SceneAdSdkZKRewardView.h | Ben21hao/XmilsSDKDo | d72090fd8e5f9991388d23d87c18572bd7f3bbae | [
"MIT"
] | null | null | null | XmilsSDKDo/Classes/SceneAdSdk.framework/Headers/SceneAdSdkZKRewardView.h | Ben21hao/XmilsSDKDo | d72090fd8e5f9991388d23d87c18572bd7f3bbae | [
"MIT"
] | null | null | null | //
// SceneAdSdkZKRewardView.h
// SceneAdSdk
//
// Created by xmiles on 2019/10/14.
// Copyright © 2019 dengsir. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "SceneAdSdkZKDataModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface SceneAdSdkZKRewardView : UIViewController
/** SceneAdSdkZKDataModel */
@property (nonatomic, strong) SceneAdSdkZKDataModel * zkModel;
//关闭广告
@property (nonatomic, copy) void (^ _Nullable adDidCloseBlock)(void);
// 2019.09.03
/**
激励完成
@param rewardResult 激励结果
*/
@property (nonatomic, copy) void(^ _Nullable adRewardFinshBlock)(BOOL rewardResult);
@end
NS_ASSUME_NONNULL_END
| 19.935484 | 84 | 0.750809 |
b85f1f30fe2b3c063356875c47139c471c37bce6 | 153 | h | C | examples/gbs_sample_color/data/include/data/tilemap_9.h | um3k/gbvm | dce728c5fd0d40c3f75b773660f475b4911d8121 | [
"MIT"
] | 33 | 2020-12-27T11:53:23.000Z | 2022-02-19T23:05:12.000Z | examples/gbs_sample_color/data/include/data/tilemap_9.h | um3k/gbvm | dce728c5fd0d40c3f75b773660f475b4911d8121 | [
"MIT"
] | 2 | 2020-12-10T16:53:53.000Z | 2022-01-31T21:42:01.000Z | examples/gbs_sample_color/data/include/data/tilemap_9.h | um3k/gbvm | dce728c5fd0d40c3f75b773660f475b4911d8121 | [
"MIT"
] | 6 | 2021-04-18T08:09:16.000Z | 2022-01-31T21:52:24.000Z | #ifndef TILEMAP_9_H
#define TILEMAP_9_H
// Tilemap 9
#include "gbs_types.h"
BANKREF_EXTERN(tilemap_9)
extern const unsigned char tilemap_9[];
#endif
| 12.75 | 39 | 0.777778 |
52d186c71f540543ef7dcbb823716b3400e4b851 | 4,079 | h | C | HYCache/Classes/HYDiskCache/HYDiskCache.h | fangyuxi/HYDBCache | 49ef94ef04c6da550f5cd57c2375339d73dd3dba | [
"MIT"
] | 1 | 2017-03-23T03:11:48.000Z | 2017-03-23T03:11:48.000Z | HYCache/Classes/HYDiskCache/HYDiskCache.h | fangyuxi/HYDBCache | 49ef94ef04c6da550f5cd57c2375339d73dd3dba | [
"MIT"
] | null | null | null | HYCache/Classes/HYDiskCache/HYDiskCache.h | fangyuxi/HYDBCache | 49ef94ef04c6da550f5cd57c2375339d73dd3dba | [
"MIT"
] | null | null | null | //
// HYDiskCache.h
// <https://github.com/fangyuxi/HDBYCache>
//
// Created by fangyuxi on 16/4/5.
//
// This source code is licensed under the MIT-style license found in the
// LICENSE file in the root directory of this source tree.
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
/**
Notifications Type
*/
extern NSString *const KHYDiskCacheFileSystemStorageFullNotification;
/**
Notifications Keys
*/
extern NSString *const KHYDiskCacheErrorKeyFreeSpace;
/**
MaxAge forever young
*/
extern NSInteger const KHYCacheItemMaxAge;
@class HYDiskCache;
typedef void (^HYDiskCacheBlock) (HYDiskCache *cache);
typedef void (^HYDiskCacheObjectBlock) (HYDiskCache *cache, NSString *key, id _Nullable object);
/**
线程安全
*/
@interface HYDiskCache : NSObject
/**
禁用初始化方法
*/
- (instancetype)init UNAVAILABLE_ATTRIBUTE;
+ (instancetype)new UNAVAILABLE_ATTRIBUTE;
/**
创建缓存
@param name 缓存名字
@return 缓存对象
*/
- (nullable instancetype)initWithName:(NSString *)name;
/**
指定初始化方法
@param name 缓存名字
@param directoryPath 缓存路径
@return 缓存对象
*/
- (nullable instancetype)initWithName:(NSString *)name
directoryPath:(nullable NSString *)directoryPath NS_DESIGNATED_INITIALIZER;
@property (nonatomic, copy, readonly) NSString *name;
@property (nonatomic, copy, readonly) NSString *directoryPath;
/**
当前的cost,当超过byteCostLimit的时候,移除策略为LRU
*/
@property (nonatomic, assign, readonly) NSUInteger totalCostNow;
/**
设置最大cost 默认 ULONG_MAX
*/
@property (nonatomic, assign) NSUInteger costLimit;
/**
移除时间间隔 cache会定期移除已经超过maxAge的对象 默认40秒
*/
@property (nonatomic, assign) NSInteger trimToMaxAgeInterval;
/**
对于没有遵循NSCoding协议的一类对象,可以在这个block中定义自己的archive逻辑
*/
@property (nonatomic, nullable, copy) NSData *(^customArchiveBlock)(id object);
@property (nonatomic, nullable, copy) id (^customUnarchiveBlock)(NSData *data);
/**
异步存储
Notice: 对象的maxAge为最大
@param object 'object'
@param key 'key'
@param block 'result'
*/
- (void)setObject:(id _Nullable)object
forKey:(NSString *)key
withBlock:(HYDiskCacheObjectBlock)block;
/**
异步存储
@param object 'object'
@param key 'key'
@param maxAge 'maxAge'
@param block 'result'
*/
- (void)setObject:(id _Nullable)object
forKey:(NSString *)key
maxAge:(NSInteger)maxAge
withBlock:(HYDiskCacheObjectBlock)block;
/**
同步存储对象,有效期为最大
@param object 存储的对象,如果为空,则不会插入,如果存在,会删除原有对象
@param key 存储对象的键,如果为空,则不会插入
*/
- (void)setObject:(id _Nullable)object
forKey:(NSString *)key;
/**
同步存储对象
@param object 存储的对象,如果为空,则不会插入,如果存在,会删除原有对象
@param key 存储对象的键,如果为空,则不会插入
@param maxAge 存储的最大时间
*/
- (void)setObject:(id _Nullable)object
forKey:(NSString *)key
maxAge:(NSInteger)maxAge;
/**
异步获取对象,该方法会立即返回,获取完毕之后block会在内部的concurrent queue中回调
@param key 存储对象的键,不能为空
@param block 返回值 key object cache object
*/
- (void)objectForKey:(id)key
withBlock:(HYDiskCacheObjectBlock)block;
/**
同步获取对象,该方法会阻塞调用的线程,直到获取完成
@param key 存储对象的键,不能为空
@return 如果没找到相应object则返回空
*/
- (nullable id)objectForKey:(NSString *)key;
/**
异步移除对象,移除完毕之后block会在内部的concurrent queue中回调
@param key 存储对象的键,不能为空
@param block 返回值 cache object
*/
- (void)removeObjectForKey:(NSString *)key
withBlock:(HYDiskCacheBlock)block;
/**
同步移除对象
@param key 存储对象的键,不能为空
*/
- (void)removeObjectForKey:(NSString *)key;
/**
异步移除所有对象,移除完毕之后block会在内部的concurrent queue中回调
@param block 返回值 cache object
*/
- (void)removeAllObjectWithBlock:(HYDiskCacheBlock)block;
/**
同步移除所有对象
*/
- (void)removeAllObject;
/**
查询是否包含这个key value
@param key 存储对象的键,不能为空
@return 是否包含
*/
- (BOOL)containsObjectForKey:(id)key;
/**
移除对象,直到totalCostNow <= cost
@param cost cost
@param block 移除完毕之后block会在内部的concurrent queue中回调
*/
- (void)trimToCost:(NSUInteger)cost
block:(HYDiskCacheBlock)block;
/**
移除对象,直到totalCostNow <= costLimit
@param block 移除完毕之后block会在内部的concurrent queue中回调
*/
- (void)trimToCostLimitWithBlock:(HYDiskCacheBlock)block;
@end
NS_ASSUME_NONNULL_END
| 18.29148 | 96 | 0.718068 |
da9d88e34ed31d2d9d488c06be3d04250beaf782 | 2,309 | c | C | MD5/md5_print.c | cykjamie/42 | 856cce5bc8f5c35db73903e6ccd4732d66e68543 | [
"Apache-2.0"
] | null | null | null | MD5/md5_print.c | cykjamie/42 | 856cce5bc8f5c35db73903e6ccd4732d66e68543 | [
"Apache-2.0"
] | null | null | null | MD5/md5_print.c | cykjamie/42 | 856cce5bc8f5c35db73903e6ccd4732d66e68543 | [
"Apache-2.0"
] | null | null | null | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* md5_print.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: chapark <chapark@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/14 18:32:35 by chapark #+# #+# */
/* Updated: 2019/10/16 22:56:31 by chapark ### ########.fr */
/* */
/* ************************************************************************** */
#include "../include/ft_ssl.h"
void print_md5(unsigned int *old_d, t_flag *flag, char *buf, char *f_name)
{
int j;
j = 0;
if (flag->p)
{
ft_printf("%s", buf);
print_hashing_md5(old_d);
ft_printf("\n");
}
else if (flag->file == 1)
{
print_md5_file(old_d, flag, f_name);
}
else if (flag->s == 1 && !flag->p)
{
print_md5_str(old_d, flag, buf);
}
else
{
print_hashing_md5(old_d);
ft_printf("\n");
}
}
void print_md5_file(unsigned int *old_d, t_flag *flag, char *f_name)
{
if (!flag->r && !flag->q)
ft_printf("MD5 (%s) = ", f_name);
print_hashing_md5(old_d);
if (!flag->r)
ft_printf("\n");
if (flag->r && !flag->q)
{
ft_printf(" %s\n", f_name);
}
if (flag->r && flag->q)
{
ft_printf("\n");
}
}
void print_md5_str(unsigned int *old_d, t_flag *flag, char *buf)
{
if (flag->s == 1 && !flag->p && flag->not_s)
{
print_hashing_md5(old_d);
ft_printf("\n");
}
else if (flag->r)
{
print_hashing_md5(old_d);
if (!flag->q)
ft_printf(" \"%s\"", buf);
ft_printf("\n");
}
else if (!flag->q)
{
ft_printf("MD5 (\"%s\") = ", buf);
print_hashing_md5(old_d);
ft_printf("\n");
}
}
void print_hashing_md5(unsigned int *old_d)
{
int j;
j = 0;
little_en(&old_d[0]);
little_en(&old_d[1]);
little_en(&old_d[2]);
little_en(&old_d[3]);
while (j < 4)
{
ft_printf("%.8x", old_d[j]);
j++;
}
}
int print_error(void)
{
ft_printf("\nerror\n");
return (0);
}
| 22.861386 | 80 | 0.401039 |
fd68bc1e575456689bbd78a59286437021b09895 | 785 | h | C | src/thermodynamics/thermodynamics.h | MHBalsmeier/game_archived | 9f23a580e51fa0e96d43cf7cb254bf2ef686b005 | [
"MIT"
] | 1 | 2021-08-01T16:28:39.000Z | 2021-08-01T16:28:39.000Z | src/thermodynamics/thermodynamics.h | OpenNWP/game | 933238793fd7b9c700494dcc4e239403b066060d | [
"MIT"
] | null | null | null | src/thermodynamics/thermodynamics.h | OpenNWP/game | 933238793fd7b9c700494dcc4e239403b066060d | [
"MIT"
] | null | null | null | /*
This source file is part of the Geophysical Fluids Modeling Framework (GAME), which is released under the MIT license.
Github repository: https://github.com/OpenNWP/GAME
*/
double spec_heat_cap_diagnostics_p(State *, int, Config *);
double spec_heat_cap_diagnostics_v(State *, int, Config *);
double gas_constant_diagnostics(State *, int, Config *);
double mean_particle_masses_gas(int);
double spec_heat_capacities_v_gas(int);
double spec_heat_capacities_p_gas(int);
double specific_gas_constants(int);
double calc_micro_density(double, double);
double calc_condensates_density_sum(int, Mass_densities);
double density_total(State *, int);
double density_gas(State *, int);
double calc_diffusion_coeff(double, double);
int temperature_diagnostics(State *, Grid *, Diagnostics *);
| 41.315789 | 118 | 0.805096 |
0a120534d2f63c4b1ba249907f4efcfaf88308b3 | 1,002 | h | C | test/test2-a/resource.h | pombredanne/esr-comparator | f61becf4a9169d49f6eb29dfd961b22c0f4c7bf2 | [
"BSD-2-Clause"
] | null | null | null | test/test2-a/resource.h | pombredanne/esr-comparator | f61becf4a9169d49f6eb29dfd961b22c0f4c7bf2 | [
"BSD-2-Clause"
] | null | null | null | test/test2-a/resource.h | pombredanne/esr-comparator | f61becf4a9169d49f6eb29dfd961b22c0f4c7bf2 | [
"BSD-2-Clause"
] | null | null | null | /*
* Process priority specifications to get/setpriority.
*/
#define PRIO_MIN -20
#define PRIO_MAX 20
#define PRIO_PROCESS 0
#define PRIO_PGRP 1
#define PRIO_USER 2
/*
* Resource utilization information.
*/
#define RUSAGE_SELF 0
#define RUSAGE_CHILDREN -1
struct rusage {
struct timeval ru_utime; /* user time used */
struct timeval ru_stime; /* system time used */
long ru_maxrss;
#define ru_first ru_ixrss
long ru_ixrss; /* XXX: 0 */
long ru_idrss; /* XXX: sum of rm_asrss */
long ru_isrss; /* XXX: 0 */
long ru_minflt; /* any page faults not requiring I/O */
long ru_majflt; /* any page faults requiring I/O */
long ru_nswap; /* swaps */
long ru_inblock; /* block input operations */
long ru_oublock; /* block output operations */
long ru_msgsnd; /* messages sent */
long ru_msgrcv; /* messages received */
long ru_nsignals; /* signals received */
long ru_nvcsw; /* voluntary context switches */
long ru_nivcsw; /* involuntary " */
#define ru_last ru_nivcsw
};
| 25.692308 | 57 | 0.700599 |
dabe2a97186260be0d4d04e20fdd5e3137d52515 | 487 | h | C | DemoiOS/AbstractFactory/AbstractFactory/FactoryManager.h | Misstime0501/iOS | 81f9e32f0432adfc13d6a505880c5edd2d3a99ca | [
"MIT"
] | null | null | null | DemoiOS/AbstractFactory/AbstractFactory/FactoryManager.h | Misstime0501/iOS | 81f9e32f0432adfc13d6a505880c5edd2d3a99ca | [
"MIT"
] | null | null | null | DemoiOS/AbstractFactory/AbstractFactory/FactoryManager.h | Misstime0501/iOS | 81f9e32f0432adfc13d6a505880c5edd2d3a99ca | [
"MIT"
] | null | null | null | //
// FactoryManager.h
// AbstractFactory
//
// Created by LiChen on 16/7/11.
// Copyright © 2016年 LiChen. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "BaseFactory.h"
#import "AppleFactory.h"
#import "GoogleFactory.h"
typedef enum : NSUInteger {
kApple,
kGoogle,
} EFactoryType;
@interface FactoryManager : NSObject
/**
* 获取工厂
*
* @param factoryType 工厂类型
*
* @return 工厂
*/
+ (BaseFactory *)factoryWithBrand:(EFactoryType)factoryType;
@end
| 15.709677 | 60 | 0.687885 |
dd4e70a9790ea8c97082937ee175f7ad494392d1 | 2,014 | c | C | Lab11/carrera.c | electrototo/fundprogra1718 | 0804c3447e5b510607dad218e5c1a466774851ef | [
"MIT"
] | 1 | 2017-09-25T17:54:23.000Z | 2017-09-25T17:54:23.000Z | Lab11/carrera.c | electrototo/fundprogra1718 | 0804c3447e5b510607dad218e5c1a466774851ef | [
"MIT"
] | null | null | null | Lab11/carrera.c | electrototo/fundprogra1718 | 0804c3447e5b510607dad218e5c1a466774851ef | [
"MIT"
] | null | null | null | /*
* autor: cristobal liendo i
* fecha: 13/11/17
* descripcion: carrera de la tortuga y la liebre
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
void change_pos(int *t, int *l) {
int tr, lr;
tr = (rand() % 10) + 1;
lr = (rand() % 10) + 1;
if (tr >= 1 && tr <= 5)
*t += 3;
else if(tr == 6 || tr == 7)
*t -= 6;
else
*t += 1;
if (lr == 3 || lr == 4)
*l += 9;
else if (lr == 5) {
*l -= 12;
}
else if (lr >= 6 && lr <= 8)
*l += 1;
else if (lr == 9 || lr == 10) {
*l -= 2;
}
if (*l <= 0)
*l = 1;
if (*t <= 0)
*t = 1;
if (*l > 70)
*l = 70;
if (*t > 70)
*t = 70;
}
void print_tablero(int *t, int *l, int start) {
int stop = 70;
if (*t == *l && !start) {
if (*l - 1 >= 1)
*l--;
else
*l = 1;
printf("OUCH!!!");
}
else if (!start){
for (int i = 0; i < stop; i++) {
if (*t == i + 1)
printf("T");
else if (*l == i + 1)
printf("L");
else
printf(" ");
}
}
if (start)
printf("BANG!!!");
printf("\n");
for (int i = 0; i < 70; i++)
printf("-");
printf("\n");
}
int main() {
srand(time(0));
int tx = 0, lx = 0, i = 1, countdown = 3;
while (tx < 70 && lx < 70) {
system("clear");
if (countdown == 0){
print_tablero(&tx, &lx, i);
if (i == 1) {
i = 0;
}
change_pos(&tx, &lx);
}
else {
printf("%d\n", countdown);
for (int i = 0; i < 70; i++)
printf("-");
printf("\n");
countdown--;
}
sleep(1);
}
if (tx >= lx)
printf("\n\nLa tortuga ha ganado!\n");
else
printf("\n\nLa liebre ha ganado!\n");
return 0;
}
| 17.213675 | 49 | 0.35005 |
97d4e34d9a696073933cbe357072810c01c08541 | 14,902 | c | C | vmafd/common/memory.c | slachiewicz/lightwave | 3784a3b14363bcb01dc94848ec3355cc6cffbe4c | [
"BSL-1.0",
"Apache-2.0"
] | 1 | 2019-06-27T07:40:49.000Z | 2019-06-27T07:40:49.000Z | vmafd/common/memory.c | slachiewicz/lightwave | 3784a3b14363bcb01dc94848ec3355cc6cffbe4c | [
"BSL-1.0",
"Apache-2.0"
] | null | null | null | vmafd/common/memory.c | slachiewicz/lightwave | 3784a3b14363bcb01dc94848ec3355cc6cffbe4c | [
"BSL-1.0",
"Apache-2.0"
] | null | null | null | /*
* Copyright © 2012-2015 VMware, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the “License”); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an “AS IS” BASIS, without
* warranties or conditions of any kind, EITHER EXPRESS OR IMPLIED. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
#include "includes.h"
static
DWORD
vmafdVsnprintf(
PSTR* ppszOut,
PCSTR pszFormat,
va_list args
);
DWORD
VmAfdAllocateMemory(
size_t dwSize,
PVOID* ppMemory
)
{
DWORD dwError = 0;
void* pMemory = NULL;
if (!ppMemory || !dwSize)
{
dwError = ERROR_INVALID_PARAMETER;
BAIL_ON_VMAFD_ERROR(dwError);
}
pMemory = calloc(1, dwSize);
if (!pMemory)
{
dwError = ERROR_NO_MEMORY;
BAIL_ON_VMAFD_ERROR(dwError);
}
cleanup:
*ppMemory = pMemory;
return dwError;
error:
VMAFD_SAFE_FREE_MEMORY(pMemory);
pMemory = NULL;
goto cleanup;
}
DWORD
VmAfdReallocateMemory(
PVOID pMemory,
PVOID* ppNewMemory,
size_t dwSize
)
{
DWORD dwError = 0;
void* pNewMemory = NULL;
if (!ppNewMemory)
{
dwError = ERROR_INVALID_PARAMETER;
BAIL_ON_VMAFD_ERROR(dwError);
}
if (pMemory)
{
pNewMemory = realloc(pMemory, dwSize);
}
else
{
dwError = VmAfdAllocateMemory(dwSize, &pNewMemory);
BAIL_ON_VMAFD_ERROR(dwError);
}
if (!pNewMemory)
{
dwError = ERROR_NO_MEMORY;
BAIL_ON_VMAFD_ERROR(dwError);
}
*ppNewMemory = pNewMemory;
cleanup:
return dwError;
error:
goto cleanup;
}
DWORD
VmAfdCopyMemory(
PVOID pDestination,
size_t destinationSize,
PCVOID pSource,
size_t maxCount
)
{
DWORD dwError = ERROR_SUCCESS;
if (!pDestination || !pSource || maxCount > destinationSize)
{
dwError = ERROR_INVALID_PARAMETER;
BAIL_ON_VMAFD_ERROR(dwError);
}
#ifndef _WIN32
memcpy(pDestination, pSource, maxCount);
#else
if (memcpy_s( pDestination, destinationSize, pSource, maxCount ) != 0)
{
dwError = ERROR_INVALID_PARAMETER;
BAIL_ON_VMAFD_ERROR(dwError);
}
#endif
error:
return dwError;
}
DWORD
VmAfdReallocateMemoryWithInit(
PVOID pMemory,
PVOID* ppNewMemory,
size_t dwNewSize,
size_t dwOldSize
)
{
DWORD dwError = 0;
if (dwNewSize < dwOldSize)
{
dwError = ERROR_INVALID_PARAMETER;
BAIL_ON_VMAFD_ERROR(dwError);
}
dwError = VmAfdReallocateMemory(pMemory, ppNewMemory, dwNewSize);
if (dwError == 0)
{
memset(((char*)(*ppNewMemory)) + dwOldSize, 0, dwNewSize - dwOldSize);
}
error:
return dwError;
}
VOID
VmAfdFreeMemory(
PVOID pMemory
)
{
if (pMemory)
{
free(pMemory);
}
return;
}
DWORD
VmAfdAllocateStringAVsnprintf(
PSTR* ppszOut,
PCSTR pszFormat,
...
)
{
DWORD dwError = 0;
BOOLEAN bVAEnd = FALSE;
va_list args;
//PSTR str1, str2;
if (!ppszOut || !pszFormat)
{
dwError = ERROR_INVALID_PARAMETER;
BAIL_ON_VMAFD_ERROR(dwError);
}
va_start(args, pszFormat);
bVAEnd = TRUE;
//TODO: Clean this up later
//str1 = va_arg( args, char*);
//str2 = va_arg( args, char*);
dwError = vmafdVsnprintf(
ppszOut,
pszFormat,
args);
BAIL_ON_VMAFD_ERROR(dwError);
cleanup:
if (bVAEnd)
{
va_end(args);
}
return dwError;
error:
goto cleanup;
}
DWORD
VmAfdAllocateStringA(
PCSTR pszString,
PSTR* ppszString
)
{
DWORD dwError = 0;
PSTR pszNewString = NULL;
size_t dwLen = 0;
if (!pszString || !ppszString)
{
if (ppszString) { *ppszString = NULL; }
return 0;
}
dwLen = VmAfdStringLenA(pszString);
// + 1 for \'0'
dwError = VmAfdAllocateMemory(dwLen + 1, (PVOID*)&pszNewString);
BAIL_ON_VMAFD_ERROR(dwError);
#ifndef _WIN32
memcpy(pszNewString, pszString, dwLen);
#else
memcpy_s(pszNewString, (dwLen + 1), pszString, dwLen);
#endif
*ppszString = pszNewString;
cleanup:
return dwError;
error:
VMAFD_SAFE_FREE_MEMORY(pszNewString);
goto cleanup;
}
VOID
VmAfdFreeStringA(
PSTR pszString
)
{
VMAFD_SAFE_FREE_MEMORY(pszString);
return;
}
VOID
VmAfdFreeStringW(
PWSTR pwszString
)
{
VMAFD_SAFE_FREE_MEMORY(pwszString);
return;
}
/*
* free array of PSTR
* assume array stop at PSTR == NULL
*/
VOID
VmAfdFreeStringArrayA(
PSTR* ppszStrings
)
{
if (ppszStrings)
{
DWORD dwCnt = 0;
for (dwCnt = 0; ppszStrings[dwCnt]; dwCnt++)
{
VmAfdFreeStringA(ppszStrings[dwCnt]);
}
VmAfdFreeMemory(ppszStrings);
}
}
VOID
VmAfdFreeStringArrayCountA(
PSTR* ppszStrings,
DWORD dwCount
)
{
if (ppszStrings)
{
DWORD idx = 0;
for (; idx < dwCount; idx++)
{
VmAfdFreeStringA(ppszStrings[idx]);
}
VmAfdFreeMemory(ppszStrings);
}
}
VOID
VmAfdFreeStringArrayW(
PWSTR* ppwszStrings,
DWORD dwCount
)
{
if (ppwszStrings)
{
DWORD idx = 0;
for (; idx < dwCount; idx++)
{
VMAFD_SAFE_FREE_MEMORY(ppwszStrings[idx]);
}
VmAfdFreeMemory(ppwszStrings);
}
}
static
DWORD
vmafdVsnprintf(
PSTR* ppszOut,
PCSTR pszFormat,
va_list args
)
{
#ifndef _WIN32
DWORD dwError = 0;
int iInitSize = 10;
int iFinalSize = 1;
PSTR pszBuf = NULL;
va_list argsNext;
va_copy(argsNext, args);
dwError = VmAfdAllocateMemory(
iInitSize,
(PVOID*)&pszBuf);
BAIL_ON_VMAFD_ERROR(dwError);
iFinalSize = vsnprintf(
pszBuf,
iInitSize,
pszFormat,
args);
if (iFinalSize < 0)
{
dwError = ERROR_NO_MEMORY;
BAIL_ON_VMAFD_ERROR(dwError);
}
if (iInitSize - iFinalSize <= 0)
{
int iRealSize = 0;
dwError = VmAfdReallocateMemory(
pszBuf,
(PVOID*)&pszBuf,
iFinalSize + 1);
BAIL_ON_VMAFD_ERROR(dwError);
iRealSize = vsnprintf(
pszBuf,
iFinalSize + 1,
pszFormat,
argsNext);
if (iRealSize < 0 || iRealSize != iFinalSize)
{
dwError = ERROR_NO_MEMORY;
BAIL_ON_VMAFD_ERROR(dwError);
}
}
*ppszOut = pszBuf;
cleanup:
va_end(argsNext);
return dwError;
error:
VMAFD_SAFE_FREE_MEMORY(pszBuf);
goto cleanup;
#else // _WIN32
DWORD dwError = 0;
int iSize = 0;
LPSTR pszAnsiString = NULL;
if (!ppszOut || !pszFormat)
{
dwError = ERROR_INVALID_PARAMETER;
BAIL_ON_VMAFD_ERROR(dwError);
}
*ppszOut = NULL;
/*
MSDN:
If execution is allowed to continue, the functions return -1 and
set errno to EINVAL.
*/
iSize = _vscprintf(pszFormat, args);
if ( iSize <= -1)
{
dwError = ERROR_INVALID_PARAMETER;
BAIL_ON_VMAFD_ERROR(dwError);
}
/*
MSDN:
_vscprintf returns the number of characters that would be generated
if the string pointed to by the list of arguments was printed or
sent to a file or buffer using the specified formatting codes.
The value returned does not include the terminating null character.
*/
iSize += 1;
dwError =
VmAfdAllocateMemory( (iSize*sizeof(CHAR)), (PVOID *)&pszAnsiString );
BAIL_ON_VMAFD_ERROR(dwError);
/*
MSDN:
return the number of characters written, not including
the terminating null, or a negative value if an output error occurs.
*/
// we should never truncate since we measured the buffer ....
if( vsnprintf_s( pszAnsiString, iSize, _TRUNCATE, pszFormat, args) < 0 )
{
dwError = ERROR_INVALID_PARAMETER;
BAIL_ON_VMAFD_ERROR(dwError);
}
*ppszOut = pszAnsiString;
pszAnsiString = NULL;
error:
VMAFD_SAFE_FREE_MEMORY(pszAnsiString);
return dwError;
#endif
}
ULONG
VmAfdLengthRequiredSid(
IN UCHAR SubAuthorityCount
)
{
#ifndef _WIN32
return RtlLengthRequiredSid(SubAuthorityCount);
#else
return GetSidLengthRequired(SubAuthorityCount);
#endif
}
ULONG
VmAfdInitializeSid(
PSID Sid,
PSID_IDENTIFIER_AUTHORITY IdentifierAuthority,
UCHAR SubAuthorityCount
)
{
#ifndef _WIN32
return LwNtStatusToWin32Error(RtlInitializeSid(Sid,
IdentifierAuthority,
SubAuthorityCount));
#else
DWORD dwError = ERROR_SUCCESS;
if ( InitializeSid(Sid, IdentifierAuthority, SubAuthorityCount ) == 0 )
{
dwError = GetLastError();
}
return dwError;
#endif
}
ULONG
VmAfdSetSidSubAuthority(
PSID pSid,
DWORD nSubAuthority,
DWORD subAuthorityValue
)
{
DWORD dwError = ERROR_SUCCESS;
#ifdef _WIN32
PDWORD pSubAuthority = NULL;
PUCHAR pSubAuth = NULL;
#endif
if(pSid == NULL)
{
dwError = ERROR_INVALID_PARAMETER;
BAIL_ON_VMAFD_ERROR(dwError);
}
#ifndef _WIN32
if(pSid->SubAuthorityCount <= nSubAuthority)
{
dwError = ERROR_INVALID_PARAMETER;
BAIL_ON_VMAFD_ERROR(dwError);
}
pSid->SubAuthority[nSubAuthority] = subAuthorityValue;
#else
if( IsValidSid(pSid) == 0 )
{
dwError = ERROR_INVALID_PARAMETER;
BAIL_ON_VMAFD_ERROR(dwError);
}
pSubAuth = GetSidSubAuthorityCount( pSid );
if( *pSubAuth <= nSubAuthority )
{
dwError = ERROR_INVALID_PARAMETER;
BAIL_ON_VMAFD_ERROR(dwError);
}
pSubAuthority = GetSidSubAuthority( pSid, nSubAuthority );
*pSubAuthority = subAuthorityValue;
#endif
error:
return dwError;
}
ULONG
VmAfdAllocateSidFromCString(
PCSTR pszSidString,
PSID* ppSid
)
{
#ifndef _WIN32
return LwNtStatusToWin32Error(
RtlAllocateSidFromCString(ppSid,
(PCSTR)pszSidString));
#else
DWORD dwError = ERROR_SUCCESS;
PSID originalSid = NULL;
PSID cloneSid = NULL;
DWORD sidLength = 0;
if (!pszSidString || !ppSid)
{
dwError = ERROR_INVALID_PARAMETER;
BAIL_ON_VMAFD_ERROR(dwError);
}
*ppSid = NULL;
/*
MSDN:
Sid [out]
A pointer to a variable that receives a pointer to
the converted SID.
To free the returned buffer, call the LocalFree function.
*/
if( ConvertStringSidToSidA( pszSidString, &originalSid ) == 0 )
{
dwError = GetLastError();
BAIL_ON_VMAFD_ERROR(dwError);
}
// callers of this function are prepared to free the
// sid, with regular VMAfdFreeMemory, but on windows
// original Sid needs to be freed with LocalFree...
// therefore we will clone the Sid being returned ...
if( IsValidSid(originalSid) == 0 )
{
dwError = ERROR_INVALID_PARAMETER;
BAIL_ON_VMAFD_ERROR(dwError);
}
sidLength = GetLengthSid( originalSid);
dwError = VmAfdAllocateMemory( sidLength, ((PVOID*)(&cloneSid)));
BAIL_ON_VMAFD_ERROR(dwError);
if( CopySid( sidLength, cloneSid, originalSid ) == 0 )
{
dwError = GetLastError();
BAIL_ON_VMAFD_ERROR(dwError);
}
*ppSid = cloneSid;
cloneSid = NULL;
error:
VMAFD_SAFE_FREE_MEMORY(cloneSid);
if( originalSid != NULL )
{
LocalFree(originalSid);
originalSid = NULL;
}
return dwError;
#endif
}
ULONG
VmAfdAllocateCStringFromSid(
PSTR* ppszStringSid,
PSID pSid
)
{
#ifndef _WIN32
return LwNtStatusToWin32Error(
RtlAllocateCStringFromSid(ppszStringSid,pSid));
#else
DWORD dwError = ERROR_SUCCESS;
PSTR origSid = NULL;
PSTR cloneSid = NULL;
if (!ppszStringSid || !pSid)
{
dwError = ERROR_INVALID_PARAMETER;
BAIL_ON_VMAFD_ERROR(dwError);
}
*ppszStringSid = NULL;
/*
MSDN:
StringSid [out]
A pointer to a variable that receives a pointer to a
null-terminated SID string.
To free the returned buffer, call the LocalFree function.
*/
if ( ConvertSidToStringSidA( pSid, &origSid ) == 0 )
{
dwError = GetLastError();
BAIL_ON_VMAFD_ERROR(dwError);
}
// callers of this function are prepared to free the
// string sid, with regular VMAfdFreeString, but on windows
// original Sid needs to be freed with LocalFree...
// therefore we will clone the string being returned ...
dwError = VmAfdAllocateStringA(origSid, &cloneSid);
BAIL_ON_VMAFD_ERROR(dwError);
*ppszStringSid = cloneSid;
cloneSid = NULL;
error :
VMAFD_SAFE_FREE_STRINGA(cloneSid);
if( origSid != NULL )
{
LocalFree(origSid);
origSid = NULL;
}
return dwError;
#endif
}
VOID
VmAfdFreeTypeSpecContent(
PVMW_TYPE_SPEC specInput,
DWORD sizeOfArray
)
{
DWORD dCounter = 0;
for (dCounter = 0; dCounter < sizeOfArray; dCounter++){
switch(specInput[dCounter].type){
case VMW_IPC_TYPE_UINT32:
VMAFD_SAFE_FREE_MEMORY (specInput[dCounter].data.pUint32);
break;
case VMW_IPC_TYPE_STRING:
VMAFD_SAFE_FREE_MEMORY (specInput[dCounter].data.pString);
break;
case VMW_IPC_TYPE_WSTRING:
VMAFD_SAFE_FREE_MEMORY (specInput[dCounter].data.pWString);
break;
default:
VMAFD_SAFE_FREE_MEMORY (specInput[dCounter].data.pByte);
break;
}
}
}
VOID
VmAfdFreeStorePermissionArray(
PVECS_STORE_PERMISSION_W pStorePermissions,
DWORD dwCount
)
{
DWORD dwIndex = 0;
if (pStorePermissions && dwCount)
{
for (; dwIndex < dwCount; dwIndex++)
{
PVECS_STORE_PERMISSION_W pCursor = &pStorePermissions[dwIndex];
VMAFD_SAFE_FREE_MEMORY (pCursor->pszUserName);
}
}
VMAFD_SAFE_FREE_MEMORY (pStorePermissions);
}
VOID
VmAfdFreeMutexesArray(
pthread_mutex_t *pMutexes,
DWORD dwCount
)
{
DWORD dwIndex = 0;
if (pMutexes)
{
for (; dwIndex < dwCount; ++dwIndex)
{
pthread_mutex_destroy(&(pMutexes[dwIndex]));
}
VMAFD_SAFE_FREE_MEMORY(pMutexes);
}
}
| 19.685601 | 78 | 0.611596 |
20094dc7d7b5ceabe1c032168b643ecaecae451d | 283 | h | C | nRF5_SDK_12/components/libraries/usbd/class/hid/app_usbd_hid_dox_config.h | Yugontech/SenStick | 9ebd86a342a2c66c2759ba030dbd84c82bab5f2e | [
"MIT"
] | 77 | 2015-09-20T01:50:16.000Z | 2022-03-30T18:13:31.000Z | linebeacon/src/nRF5_SDK_12/components/libraries/usbd/class/hid/app_usbd_hid_dox_config.h | FaBoPlatform/OpenBeacon | abf55dc53b8d3bae9c05c23a2e313c6f3d230160 | [
"Apache-2.0"
] | 41 | 2015-09-24T02:56:55.000Z | 2021-05-13T13:52:12.000Z | linebeacon/src/nRF5_SDK_12/components/libraries/usbd/class/hid/app_usbd_hid_dox_config.h | FaBoPlatform/OpenBeacon | abf55dc53b8d3bae9c05c23a2e313c6f3d230160 | [
"Apache-2.0"
] | 34 | 2015-11-06T22:50:28.000Z | 2022-01-18T07:01:51.000Z | /**
*
* @defgroup app_usbd_hid_config USB HID class configuration
* @{
* @ingroup app_usbd_hid
*/
/** @brief Enabling USBD HID Class library
*
* Set to 1 to activate.
*
* @note This is an NRF_CONFIG macro.
*/
#define APP_USBD_CLASS_HID_ENABLED
/** @} */
| 16.647059 | 61 | 0.625442 |
5a82bbb9f4846ed660386d1709d6fe46048b29ce | 359 | h | C | CJModule/UINavigationBar+CJCategory.h | dreamCC/CJModule | f06bc9d6c5f3b721c4f700de1802b7f8fafc837c | [
"MIT"
] | null | null | null | CJModule/UINavigationBar+CJCategory.h | dreamCC/CJModule | f06bc9d6c5f3b721c4f700de1802b7f8fafc837c | [
"MIT"
] | null | null | null | CJModule/UINavigationBar+CJCategory.h | dreamCC/CJModule | f06bc9d6c5f3b721c4f700de1802b7f8fafc837c | [
"MIT"
] | null | null | null | //
// UINavigationBar+CJCategory.h
// CommonProject
//
// Created by 仁和Mac on 2018/1/25.
// Copyright © 2018年 zhucj. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UINavigationBar (CJCategory)
/// 设置背景颜色
-(void)cj_barBackgroudColor:(UIColor *)color;
/// item的透明度
-(void)cj_navigationItemAlpha:(CGFloat)alpha;
/// 恢复
-(void)cj_reset;
@end
| 16.318182 | 49 | 0.707521 |
87074dd6a9d91195ad1191c131374f2de6fd17fe | 6,628 | h | C | aslam_cv_cameras/include/aslam/cameras/distortion-radtan.h | shuhannod/aslam_cv2 | 4dd48916b9e5b9d5aa56e28894a04d4a25a87348 | [
"Apache-2.0"
] | 173 | 2017-09-19T18:14:06.000Z | 2022-02-20T09:11:15.000Z | aslam_cv_cameras/include/aslam/cameras/distortion-radtan.h | shuhannod/aslam_cv2 | 4dd48916b9e5b9d5aa56e28894a04d4a25a87348 | [
"Apache-2.0"
] | 30 | 2017-11-16T12:46:13.000Z | 2022-01-20T04:38:41.000Z | aslam_cv_cameras/include/aslam/cameras/distortion-radtan.h | shuhannod/aslam_cv2 | 4dd48916b9e5b9d5aa56e28894a04d4a25a87348 | [
"Apache-2.0"
] | 58 | 2017-10-24T17:31:37.000Z | 2022-03-19T03:23:24.000Z | #ifndef ASLAM_RADTAN_DISTORTION_H_
#define ASLAM_RADTAN_DISTORTION_H_
#include <Eigen/Core>
#include <glog/logging.h>
#include <aslam/common/crtp-clone.h>
#include <aslam/cameras/distortion.h>
#include <aslam/common/macros.h>
namespace aslam {
/// \class RadTanDistortion
/// \brief An implementation of the standard radial tangential distortion model for pinhole cameras.
/// Two radial (k1, k2) and tangential (p1, p2) parameters are used in this implementation.
/// The ordering of the parameter vector is: k1 k2 p1 p2
/// NOTE: The inverse transformation (undistort) in this case is not available in
/// closed form and so it is computed iteratively!
class RadTanDistortion : public aslam::Cloneable<Distortion, RadTanDistortion> {
public:
/** \brief Number of parameters used for this distortion model. */
enum { kNumOfParams = 4 };
enum { CLASS_SERIALIZATION_VERSION = 1 };
ASLAM_POINTER_TYPEDEFS(RadTanDistortion);
//////////////////////////////////////////////////////////////
/// \name Constructors/destructors and operators
/// @{
/// \brief RadTanDistortion Ctor.
/// @param[in] distortionParams Vector containing the distortion parameter. (dim=4: k1, k2, p1, p2)
explicit RadTanDistortion(const Eigen::VectorXd& distortionParams);
/// \brief Convenience function to print the state using streams.
friend std::ostream& operator<<(std::ostream& out, const RadTanDistortion& distortion);
public:
/// Copy constructor for clone operation.
RadTanDistortion(const RadTanDistortion&) = default;
void operator=(const RadTanDistortion&) = delete;
/// @}
//////////////////////////////////////////////////////////////
/// \name Distort methods: applies the distortion model to a point.
/// @{
public:
/// \brief Apply distortion to a point in the normalized image plane using provided distortion
/// coefficients. External distortion coefficients can be specified using this function.
/// (Ignores the internally stored parameters.
/// @param[in] dist_coeffs Vector containing the coefficients for the distortion model.
/// NOTE: If nullptr, use internal distortion parameters.
/// @param[in,out] point The point in the normalized image plane. After the function,
/// this point is distorted.
/// @param[out] out_jacobian The Jacobian of the distortion function with respect to small
/// changes in the input point. If NULL is passed, the Jacobian
/// calculation is skipped.
virtual void distortUsingExternalCoefficients(const Eigen::VectorXd* dist_coeffs,
Eigen::Vector2d* point,
Eigen::Matrix2d* out_jacobian) const;
/// \brief Apply distortion to the point and provide the Jacobian of the distortion with respect
/// to small changes in the distortion parameters.
/// @param[in] dist_coeffs Vector containing the coefficients for the distortion model.
/// NOTE: If nullptr, use internal distortion parameters.
/// @param[in] point The point in the normalized image plane.
/// @param[out] out_jacobian The Jacobian of the distortion with respect to small changes in
/// the distortion parameters.
virtual void distortParameterJacobian(const Eigen::VectorXd* dist_coeffs,
const Eigen::Vector2d& point,
Eigen::Matrix<double, 2, Eigen::Dynamic>* out_jacobian) const;
/// @}
//////////////////////////////////////////////////////////////
/// \name Undistort methods: Removes the modeled distortion effects from a point.
/// @{
/// \brief Apply undistortion to recover a point in the normalized image plane using provided
/// distortion coefficients. External distortion coefficients can be specified using this
/// function. Ignores the internally stored parameters.
/// @param[in] dist_coeffs Vector containing the coefficients for the distortion model.
/// @param[in,out] point The distorted point. After the function, this point is in the
/// normalized image plane.
virtual void undistortUsingExternalCoefficients(const Eigen::VectorXd& dist_coeffs,
Eigen::Vector2d* point) const;
/// @}
//////////////////////////////////////////////////////////////
/// \name Methods to support unit testing.
/// @{
/// \brief Create a test distortion object for unit testing.
static RadTanDistortion::UniquePtr createTestDistortion() {
Eigen::VectorXd params(4); params << -0.28, 0.08, -0.00026, -0.00024;
return RadTanDistortion::UniquePtr(new RadTanDistortion(params));
}
/// \brief Create a test distortion object for unit testing with null distortion.
static RadTanDistortion::UniquePtr createZeroTestDistortion() {
Eigen::VectorXd params(4); params << 0.0, 0.0, 0.0, 0.0;
return RadTanDistortion::UniquePtr(new RadTanDistortion(params));
}
/// @}
///////////////////////////////////////////////////////////////////////////////
/// \name Methods to set/get distortion parameters
/// @{
/// Static function that checks whether the given intrinsic parameters are valid for this model.
static bool areParametersValid(const Eigen::VectorXd& parameters);
/// \brief Check the validity of distortion parameters.
/// @param[in] dist_coeffs Vector containing the coefficients.
/// Parameters will NOT be stored.
/// @return If the distortion parameters are valid.
virtual bool distortionParametersValid(const Eigen::VectorXd& dist_coeffs) const;
/// \brief Returns the number of parameters used in this distortion model.
inline static constexpr size_t parameterCount() {
return kNumOfParams;
}
/// \brief Returns the number of parameters used in the distortion model.
/// NOTE: Use the constexpr function parameterCount if you know the exact distortion type.
virtual int getParameterSize() const {
return kNumOfParams;
}
/// \brief Print the internal parameters of the distortion in a human-readable form
/// Print to the ostream that is passed in. The text is extra
/// text used by the calling function to distinguish cameras.
virtual void printParameters(std::ostream& out, const std::string& text) const;
/// @}
};
} // namespace aslam
#endif /* ASLAM_RADTAN_DISTORTION_H_ */
| 46.027778 | 102 | 0.64303 |
0c9ad34ed549072618372e3dbcbd0e7effba3f04 | 1,204 | h | C | libnczarr/zodom.h | mandrakos/netcdf-c | b9bb44f58508c293d437aaa698fbc419bede47fe | [
"BSD-3-Clause"
] | null | null | null | libnczarr/zodom.h | mandrakos/netcdf-c | b9bb44f58508c293d437aaa698fbc419bede47fe | [
"BSD-3-Clause"
] | null | null | null | libnczarr/zodom.h | mandrakos/netcdf-c | b9bb44f58508c293d437aaa698fbc419bede47fe | [
"BSD-3-Clause"
] | null | null | null | /*********************************************************************
* Copyright 2018, UCAR/Unidata
* See netcdf/COPYRIGHT file for copying and redistribution conditions.
*********************************************************************/
#ifndef ZODOM_H
#define ZODOM_H
struct NCZSlice;
typedef struct NCZOdometer {
int rank; /*rank */
size64_t* start;
size64_t* stop; /* start + (count*stride) */
size64_t* stride;
size64_t* max; /* full dimension length */
size64_t* index; /* current value of the odometer*/
} NCZOdometer;
/**************************************************/
/* From zodom.c */
extern NCZOdometer* nczodom_new(int rank, const size64_t*, const size64_t*, const size64_t*, const size64_t*);
extern NCZOdometer* nczodom_fromslices(int rank, const struct NCZSlice* slices);
extern int nczodom_more(NCZOdometer*);
extern void nczodom_next(NCZOdometer*);
extern size64_t* nczodom_indices(NCZOdometer*);
extern size64_t nczodom_offset(NCZOdometer*);
extern void nczodom_reset(NCZOdometer* odom);
extern void nczodom_free(NCZOdometer*);
extern size64_t nczodom_avail(NCZOdometer*);
extern void nczodom_incr(NCZOdometer*,size64_t);
#endif /*ZODOM_H*/
| 35.411765 | 110 | 0.63289 |
9192a30905e521d985cf431dade732c55f2a616b | 269 | h | C | monet/monet/ApplicationClasses/Login&Register/Controller/FFUserLoginViewController.h | MonetChain-Project/MonetBlockchain_IOS | 9e361b75cd3f928fda5fb236756a2dbb7c59cc53 | [
"MIT"
] | 2 | 2018-05-21T01:40:09.000Z | 2019-03-22T05:47:51.000Z | monet/monet/ApplicationClasses/Login&Register/Controller/FFUserLoginViewController.h | MonetChain-Project/MonetBlockchain_IOS | 9e361b75cd3f928fda5fb236756a2dbb7c59cc53 | [
"MIT"
] | null | null | null | monet/monet/ApplicationClasses/Login&Register/Controller/FFUserLoginViewController.h | MonetChain-Project/MonetBlockchain_IOS | 9e361b75cd3f928fda5fb236756a2dbb7c59cc53 | [
"MIT"
] | null | null | null | //
// FFUserLoginViewController.h
// MonetBlockchain
//
// Created by Megan on 2017/9/22.
// Copyright © 2017年 MonetBlockchain Foundation All rights reserved.
//
#import "DDYBaseViewController.h"
@interface FFUserLoginViewController : DDYBaseViewController
@end
| 19.214286 | 69 | 0.765799 |
7cdab08e6100f9165ee297465d5fc4b55075cc62 | 7,743 | h | C | benchmarks/source/superh/ALPBench/Sphinx3/src/bio.h | rhudson2802/sunflower-simulator | 9f55e03c9d80c024a75029d0e842cc5c92f31c82 | [
"BSD-3-Clause"
] | 7 | 2016-05-07T13:38:33.000Z | 2019-07-08T03:42:24.000Z | benchmarks/source/superh/ALPBench/Sphinx3/src/bio.h | rhudson2802/sunflower-simulator | 9f55e03c9d80c024a75029d0e842cc5c92f31c82 | [
"BSD-3-Clause"
] | 80 | 2019-08-27T14:43:46.000Z | 2020-12-16T11:56:19.000Z | benchmarks/source/superh/ALPBench/Sphinx3/src/bio.h | rhudson2802/sunflower-simulator | 9f55e03c9d80c024a75029d0e842cc5c92f31c82 | [
"BSD-3-Clause"
] | 98 | 2019-08-30T14:29:16.000Z | 2020-11-21T18:22:13.000Z | /*
*
* This file is part of the ALPBench Benchmark Suite Version 1.0
*
* Copyright (c) 2005 The Board of Trustees of the University of Illinois
*
* All rights reserved.
*
* ALPBench is a derivative of several codes, and restricted by licenses
* for those codes, as indicated in the source files and the ALPBench
* license at http://www.cs.uiuc.edu/alp/alpbench/alpbench-license.html
*
* The multithreading and SSE2 modifications for SpeechRec, FaceRec,
* MPEGenc, and MPEGdec were done by Man-Lap (Alex) Li and Ruchira
* Sasanka as part of the ALP research project at the University of
* Illinois at Urbana-Champaign (http://www.cs.uiuc.edu/alp/), directed
* by Prof. Sarita V. Adve, Dr. Yen-Kuang Chen, and Dr. Eric Debes.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal with 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:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimers.
*
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimers in the documentation and/or other materials provided
* with the distribution.
*
* * Neither the names of Professor Sarita Adve's research group, the
* University of Illinois at Urbana-Champaign, nor the names of its
* contributors may be used to endorse or promote products derived
* from this Software without specific prior written permission.
*
* 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 CONTRIBUTORS 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 WITH THE
* SOFTWARE.
*
*/
/* ====================================================================
* Copyright (c) 1999-2001 Carnegie Mellon University. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* This work was supported in part by funding from the Defense Advanced
* Research Projects Agency and the National Science Foundation of the
* United States of America, and the CMU Sphinx Speech Consortium.
*
* THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND
* ANY EXPRESSED 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 CARNEGIE MELLON UNIVERSITY
* NOR ITS EMPLOYEES 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.
*
* ====================================================================
*
*/
/*
* bio.h -- Sphinx-3 binary file I/O functions.
*
* **********************************************
* CMU ARPA Speech Project
*
* Copyright (c) 1996 Carnegie Mellon University.
* ALL RIGHTS RESERVED.
* **********************************************
*
* HISTORY
*
* 28-Apr-1999 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University
* Created.
*/
#ifndef _S3_BIO_H_
#define _S3_BIO_H_
#include "libutil.h"
#define BYTE_ORDER_MAGIC (0x11223344)
/* Macro to byteswap an int16 variable. x = ptr to variable */
#define SWAP_INT16(x) *(x) = ((0x00ff & (*(x))>>8) | (0xff00 & (*(x))<<8))
/* Macro to byteswap an int32 variable. x = ptr to variable */
#define SWAP_INT32(x) *(x) = ((0x000000ff & (*(x))>>24) | \
(0x0000ff00 & (*(x))>>8) | \
(0x00ff0000 & (*(x))<<8) | \
(0xff000000 & (*(x))<<24))
/* Macro to byteswap a float32 variable. x = ptr to variable */
#define SWAP_FLOAT32(x) SWAP_INT32((int32 *) x)
/*
* Read binary file format header: has the following format
* s3
* <argument-name> <argument-value>
* <argument-name> <argument-value>
* ...
* endhdr
* 4-byte byte-order word used to find file byte ordering relative to host machine.
* Lines beginning with # are ignored.
* Memory for name and val allocated by this function; use bio_hdrarg_free to free them.
* Return value: 0 if successful, -1 otherwise.
*/
int32 bio_readhdr (FILE *fp, /* In: File to read */
char ***name, /* Out: array of argument name strings read */
char ***val, /* Out: corresponding value strings read */
int32 *swap); /* Out: file needs byteswapping iff (*swap) */
/*
* Write a simple binary file header, containing only the version string. Also write
* the byte order magic word.
* Return value: 0 if successful, -1 otherwise.
*/
int32 bio_writehdr_version (FILE *fp, char *version);
/*
* Free name and value strings previously allocated and returned by bio_readhdr.
*/
void bio_hdrarg_free (char **name, /* In: Array previously returned by bio_readhdr */
char **val); /* In: Array previously returned by bio_readhdr */
/*
* Like fread but perform byteswapping and accumulate checksum (the 2 extra arguments).
* But unlike fread, returns -1 if required number of elements (n_el) not read; also,
* no byteswapping or checksum accumulation is performed in that case.
*/
int32 bio_fread (void *buf,
int32 el_sz,
int32 n_el,
FILE *fp,
int32 swap, /* In: Byteswap iff (swap != 0) */
uint32 *chksum); /* In/Out: Accumulated checksum */
/*
* Read a 1-d array (fashioned after fread):
* 4-byte array size (returned in n_el)
* memory allocated for the array and read (returned in buf)
* Byteswapping and checksum accumulation performed as necessary.
* Fails fatally if expected data not read.
* Return value: #array elements allocated and read; -1 if error.
*/
int32 bio_fread_1d (void **buf, /* Out: contains array data; allocated by this
function; can be freed using ckd_free */
int32 el_sz, /* In: Array element size */
int32 *n_el, /* Out: #array elements allocated/read */
FILE *fp, /* In: File to read */
int32 sw, /* In: Byteswap iff (swap != 0) */
uint32 *ck); /* In/Out: Accumulated checksum */
/*
* Read and verify checksum at the end of binary file. Fails fatally if there is
* a mismatch.
*/
void bio_verify_chksum (FILE *fp, /* In: File to read */
int32 byteswap, /* In: Byteswap iff (swap != 0) */
uint32 chksum); /* In: Value to compare with checksum in file */
#endif
| 39.707692 | 88 | 0.683456 |
e58bca56db442d8c10b6a492a645080df750db9f | 972 | h | C | src/d3d9/d9vr_openvr_controller.h | Joshua-Ashton/d9vr | 0b9aba307ac1f7a6cceb1ac105b2c82074a4ba83 | [
"MIT"
] | 3 | 2021-07-15T23:38:49.000Z | 2021-08-22T20:37:57.000Z | src/d3d9/d9vr_openvr_controller.h | Joshua-Ashton/d9vr | 0b9aba307ac1f7a6cceb1ac105b2c82074a4ba83 | [
"MIT"
] | null | null | null | src/d3d9/d9vr_openvr_controller.h | Joshua-Ashton/d9vr | 0b9aba307ac1f7a6cceb1ac105b2c82074a4ba83 | [
"MIT"
] | 1 | 2022-02-25T09:29:22.000Z | 2022-02-25T09:29:22.000Z | #pragma once
#include "d9vr.h"
#include "d9vr_interfaces.h"
#include "openvr.h"
namespace d9vr
{
class OpenVRController : public IController
{
public:
OpenVRController(vr::IVRSystem* pVRSystem, DeviceId Id);
bool GetAxis(uint32_t AxisIndex, ControllerAxis* pOutAxis) override;
bool GetButton(Button ButtonIndex) override;
Hand GetHand() override;
DeviceClass GetClass() override;
Pose* GetPose() override;
DeviceId GetDeviceId() override;
void UpdateHand();
void PollEvents();
private:
friend class D9VRInterface_OpenVR;
DeviceId m_Id;
Pose m_Pose;
static const uint8_t ControllerAxisCount = 5;
ControllerAxis m_Axes[ControllerAxisCount];
vr::VRControllerState_t m_State;
Hand m_Hand;
vr::IVRSystem* m_pVRSystem;
};
inline OpenVRController* AsController(IGenericDevice* pDevice)
{
if (pDevice && pDevice->GetClass() == DeviceClasses::Controller)
return static_cast<OpenVRController*>(pDevice);
return nullptr;
}
} | 21.6 | 70 | 0.751029 |
99b94c338200db726bab55ba1f0d7e3a11d47471 | 463 | h | C | ADClusterMapView/ADMapPointAnnotation.h | applidium/ADClusterMapView | 47d5210553e491f2f8a4295b4adeec581c1c2720 | [
"BSD-3-Clause"
] | 365 | 2015-01-06T10:41:28.000Z | 2020-04-29T14:40:09.000Z | ADClusterMapView/ADMapPointAnnotation.h | applidium/ADClusterMapView | 47d5210553e491f2f8a4295b4adeec581c1c2720 | [
"BSD-3-Clause"
] | 17 | 2015-02-12T02:53:21.000Z | 2021-08-22T18:32:41.000Z | ADClusterMapView/ADMapPointAnnotation.h | applidium/ADClusterMapView | 47d5210553e491f2f8a4295b4adeec581c1c2720 | [
"BSD-3-Clause"
] | 45 | 2015-01-11T19:33:02.000Z | 2021-06-02T17:10:15.000Z | //
// ADMapPointAnnotation.h
// ClusterDemo
//
// Created by Patrick Nollet on 11/10/12.
// Copyright (c) 2012 Applidium. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>
@interface ADMapPointAnnotation : NSObject
@property (nonatomic, readonly) MKMapPoint mapPoint;
@property (nonatomic, readonly, nonnull) id<MKAnnotation> annotation;
- (nonnull instancetype)initWithAnnotation:(nonnull id<MKAnnotation>)annotation;
@end
| 28.9375 | 80 | 0.766739 |
99f16abebcbc388df0c0b8d9d391c9c0f6f9dabc | 2,597 | h | C | GeometryServiceTaskSample/Classes/GeometryServiceSampleViewController.h | MapEnglish/arcgis-runtime-samples-ios | 8ca16311186182517f70628ba0567981471af95e | [
"Apache-2.0"
] | 1 | 2017-11-11T02:59:56.000Z | 2017-11-11T02:59:56.000Z | GeometryServiceTaskSample/Classes/GeometryServiceSampleViewController.h | hengcj/arcgis-runtime-samples-ios | 8ca16311186182517f70628ba0567981471af95e | [
"Apache-2.0"
] | null | null | null | GeometryServiceTaskSample/Classes/GeometryServiceSampleViewController.h | hengcj/arcgis-runtime-samples-ios | 8ca16311186182517f70628ba0567981471af95e | [
"Apache-2.0"
] | 1 | 2016-03-15T02:50:34.000Z | 2016-03-15T02:50:34.000Z | // Copyright 2012 ESRI
//
// All rights reserved under the copyright laws of the United States
// and applicable international laws, treaties, and conventions.
//
// You may freely redistribute and use this sample code, with or
// without modification, provided you include the original copyright
// notice and use restrictions.
//
// See the use restrictions at http://help.arcgis.com/en/sdk/10.0/usageRestrictions.htm
//
#import <UIKit/UIKit.h>
#import <ArcGIS/ArcGIS.h>
#define kBaseMapService @"http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"
#define kGeometryBufferService @"http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer/buffer"
#define kesriSRUnit_SurveyMile 9035
#define kesriSRUnit_Meter 9001
#define kWebMercator 102100
@interface GeometryServiceSampleViewController : UIViewController < AGSGeometryServiceTaskDelegate, AGSMapViewLayerDelegate, AGSMapViewTouchDelegate > {
UINavigationBar *_navBar;
UIButton *_goBtn;
UIButton *_clearGraphicsBtn;
UIView *_statusView;
UILabel *_statusLabel; /* label that informs user to click points/number of pts clicked */
AGSMapView *_mapView;
AGSGraphicsLayer *_graphicsLayer;
NSMutableArray *_geometryArray; /* holds on to the buffered geometries until "clear" clicked */
NSInteger _numPoints; /* keeps track of the number of points the user has clicked */
NSMutableArray *_pushpins; /* holds on to the pushpins that mark where the user clicks */
AGSGeometryServiceTask *_gst; /* The Geometry Service Task we will use to execute operations */
}
@property (nonatomic, strong) IBOutlet UIButton *goBtn;
@property (nonatomic, strong) IBOutlet UIButton *clearGraphicsBtn;
@property (nonatomic, strong) IBOutlet UINavigationBar *navBar;
@property (nonatomic, strong) IBOutlet UIView *statusView;
@property (nonatomic, strong) IBOutlet UILabel *statusLabel;
@property (nonatomic, strong) IBOutlet AGSMapView *mapView;
@property (nonatomic, strong) AGSGraphicsLayer *graphicsLayer;
@property (nonatomic, strong) NSMutableArray *geometryArray;
@property (nonatomic, strong) NSMutableArray *pushpins;
@property (nonatomic, strong) AGSGeometryServiceTask *gst;
/* Called when the user clicks the "Go" button on the UINavigation Bar
* Kicks off the Geometry Service Task given the user has selected >= 1 point
*/
- (IBAction)goBtnClicked:(id)sender;
/* Clears all of the graphics from the view
*/
- (IBAction)clearGraphicsBtnClicked:(id)sender;
@end
| 38.761194 | 153 | 0.754717 |
6602419cb1c2bafc606aef9d631e6721e6bb7811 | 2,378 | h | C | Gems/Atom/RHI/DX12/Code/Source/RHI/StagingMemoryAllocator.h | cypherdotXd/o3de | bb90c4ddfe2d495e9c00ebf1e2650c6d603a5676 | [
"Apache-2.0",
"MIT"
] | 11 | 2021-07-08T09:58:26.000Z | 2022-03-17T17:59:26.000Z | Gems/Atom/RHI/DX12/Code/Source/RHI/StagingMemoryAllocator.h | RoddieKieley/o3de | e804fd2a4241b039a42d9fa54eaae17dc94a7a92 | [
"Apache-2.0",
"MIT"
] | 29 | 2021-07-06T19:33:52.000Z | 2022-03-22T10:27:49.000Z | Gems/Atom/RHI/DX12/Code/Source/RHI/StagingMemoryAllocator.h | RoddieKieley/o3de | e804fd2a4241b039a42d9fa54eaae17dc94a7a92 | [
"Apache-2.0",
"MIT"
] | 4 | 2021-07-06T19:24:43.000Z | 2022-03-31T12:42:27.000Z | /*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#include <RHI/MemoryPageAllocator.h>
#include <RHI/MemorySubAllocator.h>
#include <Atom/RHI/ThreadLocalContext.h>
#include <AzCore/std/functional.h>
namespace AZ
{
namespace RHI
{
class MemoryStatisticsBuilder;
}
namespace DX12
{
class Device;
class StagingMemoryAllocator
{
public:
StagingMemoryAllocator();
StagingMemoryAllocator(const StagingMemoryAllocator&) = delete;
struct Descriptor
{
Device* m_device = nullptr;
uint32_t m_mediumPageSizeInBytes = 0;
uint32_t m_largePageSizeInBytes = 0;
uint32_t m_collectLatency = 0;
};
void Init(const Descriptor& descriptor);
void Shutdown();
void GarbageCollect();
MemoryView Allocate(size_t sizeInBytes, size_t alignmentInBytes);
void ReportMemoryUsage(RHI::MemoryStatisticsBuilder& builder) const;
MemoryPageAllocator& GetMediumPageAllocator();
private:
MemoryView AllocateUnique(size_t sizeInBytes);
Device* m_device = nullptr;
// Memory usage is shared betweeen large and medium page allocators.
RHI::HeapMemoryUsage m_memoryUsage;
/**
* Small allocations are done from a thread-local linear allocator that pulls
* pages from a central page allocator. This allows small allocations to be very
* low contention.
*/
MemoryPageAllocator m_mediumPageAllocator;
RHI::ThreadLocalContext<MemoryLinearSubAllocator> m_mediumBlockAllocators;
/**
* Large allocations are done through a separate page pool (with large pages) and
* uses a lock. We should have few large allocations per frame for things like streaming
* image or geometry uploads.
*/
MemoryPageAllocator m_largePageAllocator;
MemoryLinearSubAllocator m_largeBlockAllocator;
AZStd::mutex m_largeBlockMutex;
};
}
}
| 30.101266 | 100 | 0.626577 |
61c9eb554692eb0e00903296a77bee0d2cfa20b2 | 31,021 | h | C | src/libSBML/src/sbml/packages/distrib/sbml/Uncertainty.h | copasi/copasi-dependencies | c01dd455c843522375c32c2989aa8675f59bb810 | [
"Unlicense"
] | 5 | 2015-04-16T14:27:38.000Z | 2021-11-30T14:54:39.000Z | src/libSBML/src/sbml/packages/distrib/sbml/Uncertainty.h | copasi/copasi-dependencies | c01dd455c843522375c32c2989aa8675f59bb810 | [
"Unlicense"
] | 8 | 2017-05-30T16:58:39.000Z | 2022-02-22T16:51:34.000Z | src/libSBML/src/sbml/packages/distrib/sbml/Uncertainty.h | copasi/copasi-dependencies | c01dd455c843522375c32c2989aa8675f59bb810 | [
"Unlicense"
] | 7 | 2016-05-29T08:12:59.000Z | 2019-05-02T13:39:25.000Z | /**
* @file Uncertainty.h
* @brief Definition of the Uncertainty class.
* @author SBMLTeam
*
* <!--------------------------------------------------------------------------
* This file is part of libSBML. Please visit http://sbml.org for more
* information about SBML, and the latest version of libSBML.
*
* Copyright (C) 2020 jointly by the following organizations:
* 1. California Institute of Technology, Pasadena, CA, USA
* 2. University of Heidelberg, Heidelberg, Germany
* 3. University College London, London, UK
*
* Copyright (C) 2019 jointly by the following organizations:
* 1. California Institute of Technology, Pasadena, CA, USA
* 2. University of Heidelberg, Heidelberg, Germany
*
* Copyright (C) 2013-2018 jointly by the following organizations:
* 1. California Institute of Technology, Pasadena, CA, USA
* 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK
* 3. University of Heidelberg, Heidelberg, Germany
*
* Copyright (C) 2009-2013 jointly by the following organizations:
* 1. California Institute of Technology, Pasadena, CA, USA
* 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK
*
* Copyright (C) 2006-2008 by the California Institute of Technology,
* Pasadena, CA, USA
*
* Copyright (C) 2002-2005 jointly by the following organizations:
* 1. California Institute of Technology, Pasadena, CA, USA
* 2. Japan Science and Technology Agency, Japan
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation. A copy of the license agreement is provided in the
* file named "LICENSE.txt" included with this software distribution and also
* available online as http://sbml.org/software/libsbml/license.html
* ------------------------------------------------------------------------ -->
*
* @class Uncertainty
* @sbmlbrief{distrib} TODO:Definition of the Uncertainty class.
*/
#ifndef Uncertainty_H__
#define Uncertainty_H__
#include <sbml/common/extern.h>
#include <sbml/common/sbmlfwd.h>
#include <sbml/packages/distrib/common/distribfwd.h>
#ifdef __cplusplus
#include <string>
#include <sbml/packages/distrib/sbml/DistribBase.h>
#include <sbml/packages/distrib/extension/DistribExtension.h>
#include <sbml/packages/distrib/sbml/ListOfUncertParameters.h>
LIBSBML_CPP_NAMESPACE_BEGIN
class LIBSBML_EXTERN Uncertainty : public DistribBase
{
protected:
/** @cond doxygenLibsbmlInternal */
ListOfUncertParameters mUncertParameters;
/** @endcond */
public:
/**
* Creates a new Uncertainty using the given SBML Level, Version and
* “distrib” package version.
*
* @param level an unsigned int, the SBML Level to assign to this
* Uncertainty.
*
* @param version an unsigned int, the SBML Version to assign to this
* Uncertainty.
*
* @param pkgVersion an unsigned int, the SBML Distrib Version to assign to
* this Uncertainty.
*
* @copydetails doc_note_setting_lv_pkg
*/
Uncertainty(unsigned int level = DistribExtension::getDefaultLevel(),
unsigned int version = DistribExtension::getDefaultVersion(),
unsigned int pkgVersion =
DistribExtension::getDefaultPackageVersion());
/**
* Creates a new Uncertainty using the given DistribPkgNamespaces object.
*
* @copydetails doc_what_are_sbml_package_namespaces
*
* @param distribns the DistribPkgNamespaces object.
*
* @copydetails doc_note_setting_lv_pkg
*/
Uncertainty(DistribPkgNamespaces *distribns);
/**
* Copy constructor for Uncertainty.
*
* @param orig the Uncertainty instance to copy.
*/
Uncertainty(const Uncertainty& orig);
/**
* Assignment operator for Uncertainty.
*
* @param rhs the Uncertainty object whose values are to be used as the basis
* of the assignment.
*/
Uncertainty& operator=(const Uncertainty& rhs);
/**
* Creates and returns a deep copy of this Uncertainty object.
*
* @return a (deep) copy of this Uncertainty object.
*/
virtual Uncertainty* clone() const;
/**
* Destructor for Uncertainty.
*/
virtual ~Uncertainty();
/**
* Returns the ListOfUncertParameters from this Uncertainty.
*
* @return the ListOfUncertParameters from this Uncertainty.
*
* @copydetails doc_returned_unowned_pointer
*
* @see addUncertParameter(const UncertParameter* object)
* @see createUncertParameter()
* @see getUncertParameter(const std::string& sid)
* @see getUncertParameter(unsigned int n)
* @see getNumUncertParameters()
* @see removeUncertParameter(const std::string& sid)
* @see removeUncertParameter(unsigned int n)
*/
const ListOfUncertParameters* getListOfUncertParameters() const;
/**
* Returns the ListOfUncertParameters from this Uncertainty.
*
* @return the ListOfUncertParameters from this Uncertainty.
*
* @copydetails doc_returned_unowned_pointer
*
* @see addUncertParameter(const UncertParameter* object)
* @see createUncertParameter()
* @see getUncertParameter(const std::string& sid)
* @see getUncertParameter(unsigned int n)
* @see getNumUncertParameters()
* @see removeUncertParameter(const std::string& sid)
* @see removeUncertParameter(unsigned int n)
*/
ListOfUncertParameters* getListOfUncertParameters();
/**
* Get an UncertParameter from the Uncertainty.
*
* @param n an unsigned int representing the index of the UncertParameter to
* retrieve.
*
* @return the nth UncertParameter in the ListOfUncertParameters within this
* Uncertainty or @c NULL if no such object exists.
*
* @copydetails doc_returned_unowned_pointer
*
* @see addUncertParameter(const UncertParameter* object)
* @see createUncertParameter()
* @see getUncertParameter(const std::string& sid)
* @see getNumUncertParameters()
* @see removeUncertParameter(const std::string& sid)
* @see removeUncertParameter(unsigned int n)
*/
UncertParameter* getUncertParameter(unsigned int n);
/**
* Get an UncertParameter from the Uncertainty.
*
* @param n an unsigned int representing the index of the UncertParameter to
* retrieve.
*
* @return the nth UncertParameter in the ListOfUncertParameters within this
* Uncertainty or @c NULL if no such object exists.
*
* @copydetails doc_returned_unowned_pointer
*
* @see addUncertParameter(const UncertParameter* object)
* @see createUncertParameter()
* @see getUncertParameter(const std::string& sid)
* @see getNumUncertParameters()
* @see removeUncertParameter(const std::string& sid)
* @see removeUncertParameter(unsigned int n)
*/
const UncertParameter* getUncertParameter(unsigned int n) const;
/**
* Get an UncertParameter from the Uncertainty based on the element to which
* it refers.
*
* @param sid a string representing the "var" attribute of the
* UncertParameter object to retrieve.
*
* @return the first UncertParameter in this Uncertainty based on the given
* var attribute or NULL if no such UncertParameter exists.
*
* @copydetails doc_returned_unowned_pointer
*/
const UncertParameter* getUncertParameterByVar(const std::string& sid) const;
/**
* Get an UncertParameter from the Uncertainty based on
* its type.
*
* @param utype the UncertType representing the "type" attribute of the
* UncertParameter object to retrieve.
*
* @return the first UncertParameter in this ListOfUncertParameters based on
* the given var attribute or NULL if no such UncertParameter exists.
*
* Note that while most types must be unique in any ListOfUncertParameters,
* the exception is external parameters
* (@sbmlconstant{DISTRIB_UNCERTTYPE_EXTERNALPARAMETER, UncerType_t}),
* which there many be several of.
*
* @copydetails doc_returned_unowned_pointer
*/
const UncertParameter * getUncertParameterByType(UncertType_t utype) const;
/**
* Get an UncertParameter from the Uncertainty based on the element to which
* it refers.
*
* @param sid a string representing the "var" attribute of the
* UncertParameter object to retrieve.
*
* @return the first UncertParameter in this Uncertainty based on the given
* var attribute or NULL if no such UncertParameter exists.
*
* @copydetails doc_returned_unowned_pointer
*/
UncertParameter* getUncertParameterByVar(const std::string& sid);
/**
* Get an UncertParameter from the Uncertainty based on
* its type.
*
* @param utype the UncertType representing the "type" attribute of the
* UncertParameter object to retrieve.
*
* @return the first UncertParameter in this ListOfUncertParameters based on
* the given var attribute or NULL if no such UncertParameter exists.
*
* Note that while most types must be unique in any ListOfUncertParameters,
* the exception is external parameters
* (@sbmlconstant{DISTRIB_UNCERTTYPE_EXTERNALPARAMETER, UncerType_t}),
* which there many be several of.
*
* @copydetails doc_returned_unowned_pointer
*/
UncertParameter * getUncertParameterByType(UncertType_t utype);
/**
* Adds a copy of the given UncertParameter to this Uncertainty.
*
* @param up the UncertParameter object to add.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t}
*
* @copydetails doc_note_object_is_copied
*
* @see createUncertParameter()
* @see getUncertParameter(const std::string& sid)
* @see getUncertParameter(unsigned int n)
* @see getNumUncertParameters()
* @see removeUncertParameter(const std::string& sid)
* @see removeUncertParameter(unsigned int n)
*/
int addUncertParameter(const UncertParameter* up);
int addUncertSpan(const UncertSpan* us);
/**
* Get the number of UncertParameter objects in this Uncertainty.
*
* @return the number of UncertParameter objects in this Uncertainty.
*
* @see addUncertParameter(const UncertParameter* object)
* @see createUncertParameter()
* @see getUncertParameter(const std::string& sid)
* @see getUncertParameter(unsigned int n)
* @see removeUncertParameter(const std::string& sid)
* @see removeUncertParameter(unsigned int n)
*/
unsigned int getNumUncertParameters() const;
UncertParameter* createUncertParameter();
UncertSpan* createUncertSpan();
/**
* Removes the nth UncertParameter from this Uncertainty and returns a
* pointer to it.
*
* @param n an unsigned int representing the index of the UncertParameter to
* remove.
*
* @return a pointer to the nth UncertParameter in this Uncertainty.
*
* @copydetails doc_warning_returns_owned_pointer
*
* @see addUncertParameter(const UncertParameter* object)
* @see createUncertParameter()
* @see getUncertParameter(const std::string& sid)
* @see getUncertParameter(unsigned int n)
* @see getNumUncertParameters()
* @see removeUncertParameter(const std::string& sid)
*/
UncertParameter* removeUncertParameter(unsigned int n);
/**
* Returns the XML element name of this Uncertainty object.
*
* For Uncertainty, the XML element name is always @c "uncertainty".
*
* @return the name of this element, i.e. @c "uncertainty".
*/
virtual const std::string& getElementName() const;
/**
* Returns the libSBML type code for this Uncertainty object.
*
* @copydetails doc_what_are_typecodes
*
* @return the SBML type code for this object:
* @sbmlconstant{SBML_DISTRIB_UNCERTAINTY, SBMLDistribTypeCode_t}.
*
* @copydetails doc_warning_typecodes_not_unique
*
* @see getElementName()
* @see getPackageName()
*/
virtual int getTypeCode() const;
/**
* Predicate returning @c true if all the required attributes for this
* Uncertainty object have been set.
*
* @return @c true to indicate that all the required attributes of this
* Uncertainty have been set, otherwise @c false is returned.
*/
virtual bool hasRequiredAttributes() const;
/**
* Predicate returning @c true if all the required elements for this
* Uncertainty object have been set.
*
* @return @c true to indicate that all the required elements of this
* Uncertainty have been set, otherwise @c false is returned.
*
*
* @note The required elements for the Uncertainty object are:
*/
virtual bool hasRequiredElements() const;
/** @cond doxygenLibsbmlInternal */
/**
* Write any contained elements
*/
virtual void writeElements(XMLOutputStream& stream) const;
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/**
* Accepts the given SBMLVisitor
*/
virtual bool accept(SBMLVisitor& v) const;
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/**
* Sets the parent SBMLDocument
*/
virtual void setSBMLDocument(SBMLDocument* d);
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/**
* Connects to child elements
*/
virtual void connectToChild();
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/**
* Enables/disables the given package with this element
*/
virtual void enablePackageInternal(const std::string& pkgURI,
const std::string& pkgPrefix,
bool flag);
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/**
* Updates the namespaces when setLevelVersion is used
*/
virtual void updateSBMLNamespace(const std::string& package,
unsigned int level,
unsigned int version);
/** @endcond */
#ifndef SWIG
/** @cond doxygenLibsbmlInternal */
/**
* Gets the value of the "attributeName" attribute of this Uncertainty.
*
* @param attributeName, the name of the attribute to retrieve.
*
* @param value, the address of the value to record.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
*/
virtual int getAttribute(const std::string& attributeName, bool& value)
const;
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/**
* Gets the value of the "attributeName" attribute of this Uncertainty.
*
* @param attributeName, the name of the attribute to retrieve.
*
* @param value, the address of the value to record.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
*/
virtual int getAttribute(const std::string& attributeName, int& value) const;
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/**
* Gets the value of the "attributeName" attribute of this Uncertainty.
*
* @param attributeName, the name of the attribute to retrieve.
*
* @param value, the address of the value to record.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
*/
virtual int getAttribute(const std::string& attributeName,
double& value) const;
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/**
* Gets the value of the "attributeName" attribute of this Uncertainty.
*
* @param attributeName, the name of the attribute to retrieve.
*
* @param value, the address of the value to record.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
*/
virtual int getAttribute(const std::string& attributeName,
unsigned int& value) const;
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/**
* Gets the value of the "attributeName" attribute of this Uncertainty.
*
* @param attributeName, the name of the attribute to retrieve.
*
* @param value, the address of the value to record.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
*/
virtual int getAttribute(const std::string& attributeName,
std::string& value) const;
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/**
* Predicate returning @c true if this Uncertainty's attribute
* "attributeName" is set.
*
* @param attributeName, the name of the attribute to query.
*
* @return @c true if this Uncertainty's attribute "attributeName" has been
* set, otherwise @c false is returned.
*/
virtual bool isSetAttribute(const std::string& attributeName) const;
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/**
* Sets the value of the "attributeName" attribute of this Uncertainty.
*
* @param attributeName, the name of the attribute to set.
*
* @param value, the value of the attribute to set.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
*/
virtual int setAttribute(const std::string& attributeName, bool value);
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/**
* Sets the value of the "attributeName" attribute of this Uncertainty.
*
* @param attributeName, the name of the attribute to set.
*
* @param value, the value of the attribute to set.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
*/
virtual int setAttribute(const std::string& attributeName, int value);
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/**
* Sets the value of the "attributeName" attribute of this Uncertainty.
*
* @param attributeName, the name of the attribute to set.
*
* @param value, the value of the attribute to set.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
*/
virtual int setAttribute(const std::string& attributeName, double value);
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/**
* Sets the value of the "attributeName" attribute of this Uncertainty.
*
* @param attributeName, the name of the attribute to set.
*
* @param value, the value of the attribute to set.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
*/
virtual int setAttribute(const std::string& attributeName,
unsigned int value);
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/**
* Sets the value of the "attributeName" attribute of this Uncertainty.
*
* @param attributeName, the name of the attribute to set.
*
* @param value, the value of the attribute to set.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
*/
virtual int setAttribute(const std::string& attributeName,
const std::string& value);
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/**
* Unsets the value of the "attributeName" attribute of this Uncertainty.
*
* @param attributeName, the name of the attribute to query.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
*/
virtual int unsetAttribute(const std::string& attributeName);
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/**
* Creates and returns an new "elementName" object in this Uncertainty.
*
* @param elementName, the name of the element to create.
*
* @return pointer to the element created.
*/
virtual SBase* createChildObject(const std::string& elementName);
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/**
* Adds a new "elementName" object to this Uncertainty.
*
* @param elementName, the name of the element to create.
*
* @param element, pointer to the element to be added.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
*/
virtual int addChildObject(const std::string& elementName,
const SBase* element);
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/**
* Removes and returns the new "elementName" object with the given id in this
* Uncertainty.
*
* @param elementName, the name of the element to remove.
*
* @param id, the id of the element to remove.
*
* @return pointer to the element removed.
*/
virtual SBase* removeChildObject(const std::string& elementName,
const std::string& id);
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/**
* Returns the number of "elementName" in this Uncertainty.
*
* @param elementName, the name of the element to get number of.
*
* @return unsigned int number of elements.
*/
virtual unsigned int getNumObjects(const std::string& elementName);
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/**
* Returns the nth object of "objectName" in this Uncertainty.
*
* @param elementName, the name of the element to get number of.
*
* @param index, unsigned int the index of the object to retrieve.
*
* @return pointer to the object.
*/
virtual SBase* getObject(const std::string& elementName, unsigned int index);
/** @endcond */
#endif /* !SWIG */
/**
* Returns the first child element that has the given @p id in the model-wide
* SId namespace, or @c NULL if no such object is found.
*
* @param id a string representing the id attribute of the object to
* retrieve.
*
* @return a pointer to the SBase element with the given @p id. If no such
* object is found, this method returns @c NULL.
*/
virtual SBase* getElementBySId(const std::string& id);
/**
* Returns the first child element that has the given @p metaid, or @c NULL
* if no such object is found.
*
* @param metaid a string representing the metaid attribute of the object to
* retrieve.
*
* @return a pointer to the SBase element with the given @p metaid. If no
* such object is found this method returns @c NULL.
*/
virtual SBase* getElementByMetaId(const std::string& metaid);
/**
* Returns a List of all child SBase objects, including those nested to an
* arbitrary depth.
*
* @param filter an ElementFilter that may impose restrictions on the objects
* to be retrieved.
*
* @return a List pointer of pointers to all SBase child objects with any
* restriction imposed.
*/
virtual List* getAllElements(ElementFilter * filter = NULL);
protected:
/** @cond doxygenLibsbmlInternal */
/**
* Creates a new object from the next XMLToken on the XMLInputStream
*/
virtual SBase* createObject(XMLInputStream& stream);
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/**
* Adds the expected attributes for this element
*/
virtual void addExpectedAttributes(ExpectedAttributes& attributes);
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/**
* Reads the expected attributes into the member data variables
*/
virtual void readAttributes(const XMLAttributes& attributes,
const ExpectedAttributes& expectedAttributes);
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/**
* Writes the attributes to the stream
*/
virtual void writeAttributes(XMLOutputStream& stream) const;
/** @endcond */
};
LIBSBML_CPP_NAMESPACE_END
#endif /* __cplusplus */
#ifndef SWIG
LIBSBML_CPP_NAMESPACE_BEGIN
BEGIN_C_DECLS
/**
* Creates a new Uncertainty_t using the given SBML Level, Version and
* “distrib” package version.
*
* @param level an unsigned int, the SBML Level to assign to this
* Uncertainty_t.
*
* @param version an unsigned int, the SBML Version to assign to this
* Uncertainty_t.
*
* @param pkgVersion an unsigned int, the SBML Distrib Version to assign to
* this Uncertainty_t.
*
* @copydetails doc_note_setting_lv_pkg
*
* @copydetails doc_returned_owned_pointer
*
* @memberof Uncertainty_t
*/
LIBSBML_EXTERN
Uncertainty_t *
Uncertainty_create(unsigned int level,
unsigned int version,
unsigned int pkgVersion);
/**
* Creates and returns a deep copy of this Uncertainty_t object.
*
* @param u the Uncertainty_t structure.
*
* @return a (deep) copy of this Uncertainty_t object.
*
* @copydetails doc_returned_owned_pointer
*
* @memberof Uncertainty_t
*/
LIBSBML_EXTERN
Uncertainty_t*
Uncertainty_clone(const Uncertainty_t* u);
/**
* Frees this Uncertainty_t object.
*
* @param u the Uncertainty_t structure.
*
* @memberof Uncertainty_t
*/
LIBSBML_EXTERN
void
Uncertainty_free(Uncertainty_t* u);
/**
* Returns a ListOf_t * containing UncertParameter_t objects from this
* Uncertainty_t.
*
* @param u the Uncertainty_t structure whose ListOfUncertParameters is sought.
*
* @return the ListOfUncertParameters from this Uncertainty_t as a ListOf_t *.
*
* @copydetails doc_returned_unowned_pointer
*
* @see Uncertainty_addUncertParameter()
* @see Uncertainty_createUncertParameter()
* @see Uncertainty_getUncertParameterById()
* @see Uncertainty_getUncertParameter()
* @see Uncertainty_getNumUncertParameters()
* @see Uncertainty_removeUncertParameterById()
* @see Uncertainty_removeUncertParameter()
*
* @memberof Uncertainty_t
*/
LIBSBML_EXTERN
ListOf_t*
Uncertainty_getListOfUncertParameters(Uncertainty_t* u);
/**
* Get an UncertParameter_t from the Uncertainty_t.
*
* @param u the Uncertainty_t structure to search.
*
* @param n an unsigned int representing the index of the UncertParameter_t to
* retrieve.
*
* @return the nth UncertParameter_t in the ListOfUncertParameters within this
* Uncertainty or @c NULL if no such object exists.
*
* @copydetails doc_returned_unowned_pointer
*
* @memberof Uncertainty_t
*/
LIBSBML_EXTERN
UncertParameter_t*
Uncertainty_getUncertParameter(Uncertainty_t* u, unsigned int n);
/**
* Get an UncertParameter_t from the Uncertainty_t based on the element to
* which it refers.
*
* @param u the Uncertainty_t structure to search.
*
* @param sid a string representing the "var" attribute of the
* UncertParameter_t object to retrieve.
*
* @return the first UncertParameter_t in this Uncertainty_t based on the given
* var attribute or NULL if no such UncertParameter_t exists.
*
* @copydetails doc_returned_unowned_pointer
*
* @memberof Uncertainty_t
*/
LIBSBML_EXTERN
UncertParameter_t*
Uncertainty_getUncertParameterByVar(Uncertainty_t* u, const char *sid);
/**
* Adds a copy of the given UncertParameter_t to this Uncertainty_t.
*
* @param u the Uncertainty_t structure to which the UncertParameter_t should
* be added.
*
* @param up the UncertParameter_t object to add.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t}
*
* @memberof Uncertainty_t
*/
LIBSBML_EXTERN
int
Uncertainty_addUncertParameter(Uncertainty_t* u, const UncertParameter_t* up);
/**
* Get the number of UncertParameter_t objects in this Uncertainty_t.
*
* @param u the Uncertainty_t structure to query.
*
* @return the number of UncertParameter_t objects in this Uncertainty_t.
*
* @memberof Uncertainty_t
*/
LIBSBML_EXTERN
unsigned int
Uncertainty_getNumUncertParameters(Uncertainty_t* u);
/**
* Removes the nth UncertParameter_t from this Uncertainty_t and returns a
* pointer to it.
*
* @param u the Uncertainty_t structure to search.
*
* @param n an unsigned int representing the index of the UncertParameter_t to
* remove.
*
* @return a pointer to the nth UncertParameter_t in this Uncertainty_t.
*
* @copydetails doc_warning_returns_owned_pointer
*
* @memberof Uncertainty_t
*/
LIBSBML_EXTERN
UncertParameter_t*
Uncertainty_removeUncertParameter(Uncertainty_t* u, unsigned int n);
/**
* Predicate returning @c 1 (true) if all the required attributes for this
* Uncertainty_t object have been set.
*
* @param u the Uncertainty_t structure.
*
* @return @c 1 (true) to indicate that all the required attributes of this
* Uncertainty_t have been set, otherwise @c 0 (false) is returned.
*
* @memberof Uncertainty_t
*/
LIBSBML_EXTERN
int
Uncertainty_hasRequiredAttributes(const Uncertainty_t * u);
/**
* Predicate returning @c 1 (true) if all the required elements for this
* Uncertainty_t object have been set.
*
* @param u the Uncertainty_t structure.
*
* @return @c 1 (true) to indicate that all the required elements of this
* Uncertainty_t have been set, otherwise @c 0 (false) is returned.
*
*
* @note The required elements for the Uncertainty_t object are:
*
* @memberof Uncertainty_t
*/
LIBSBML_EXTERN
int
Uncertainty_hasRequiredElements(const Uncertainty_t * u);
END_C_DECLS
LIBSBML_CPP_NAMESPACE_END
#endif /* !SWIG */
#endif /* !Uncertainty_H__ */
| 26.951347 | 79 | 0.707231 |
2529e206d0f3a613a622913afd5c9ce86ad3b902 | 732 | h | C | src/platform.h | 19wintersp/CFacts | 5baa543d984e9e2d05857ca842a0844bd4de0259 | [
"MIT"
] | null | null | null | src/platform.h | 19wintersp/CFacts | 5baa543d984e9e2d05857ca842a0844bd4de0259 | [
"MIT"
] | null | null | null | src/platform.h | 19wintersp/CFacts | 5baa543d984e9e2d05857ca842a0844bd4de0259 | [
"MIT"
] | null | null | null | #ifndef PLATFORM_H
#define PLATFORM_H
#ifdef __linux__
#define PLATFORM_LINUX
#define PLATFORM_POSIX
#define PLATFORM_NAME "Linux"
#endif // ifdef __unix__
#if defined(__DragonFly__) || defined(__FreeBSD__) || \
defined(__NetBSD__) || defined(__OpenBSD__)
#define PLATFORM_BSD
#define PLATFORM_POSIX
#define PLATFORM_NAME "BSD"
#endif // ifdef __DragonFly__ || __FreeBSD__ || __NetBSD__ || __OpenBSD__
#ifdef __APPLE__
#define PLATFORM_APPLE
#define PLATFORM_POSIX
#define PLATFORM_NAME "Apple"
#endif // ifdef __APPLE__
#ifdef _WIN32
#define PLATFORM_WINDOWS
#define PLATFORM_NAME "Windows"
#endif // ifdef _WIN32
#ifndef PLATFORM_NAME
#error unsupported platform!
#endif // ifndef PLATFORM_NAME
#endif // ifndef PLATFORM_H
| 22.181818 | 73 | 0.789617 |
bfcaddecee6df0907dac7265ef50d848b513b9cb | 716 | h | C | NBMediaPlayer/src/decoder/NBMediaDecoder.h | sunyymq/NewBlashPlayer | bcd44784d1ad2584f5f04b10f339abe6ac57c97c | [
"MIT"
] | 1 | 2020-06-08T13:47:05.000Z | 2020-06-08T13:47:05.000Z | NBMediaPlayer/src/decoder/NBMediaDecoder.h | sunyymq/NewBlashPlayer | bcd44784d1ad2584f5f04b10f339abe6ac57c97c | [
"MIT"
] | null | null | null | NBMediaPlayer/src/decoder/NBMediaDecoder.h | sunyymq/NewBlashPlayer | bcd44784d1ad2584f5f04b10f339abe6ac57c97c | [
"MIT"
] | 1 | 2020-06-08T13:49:32.000Z | 2020-06-08T13:49:32.000Z | //
// Created by parallels on 9/10/18.
//
#ifndef NBMEDIADECODER_H
#define NBMEDIADECODER_H
#include "NBMediaSource.h"
#include "foundation/NBMetaData.h"
class NBMediaDecoder {
public:
/** the audio decoder only support software
* the video decoder select hardware in auto mode
*/
enum {
NB_DECODER_FLAG_AUTO_SELECT = 0x01,
NB_DECODER_FLAG_FORCE_SOFTWARE = 0x02
};
public:
static NBMediaSource* Create(NBMetaData* metaData, NBMediaSource* mediaTrack, void* window, uint32_t flags = NB_DECODER_FLAG_AUTO_SELECT);
static void Destroy(NBMediaSource* mediaSource);
private:
NBMediaDecoder() {
}
~NBMediaDecoder() {
}
};
#endif //NBMEDIADECODER_H
| 21.69697 | 142 | 0.703911 |
b5d9dc1d0c8162c4cdca09283676cc66402404fb | 948 | h | C | src/Util/GL/DeferredRenderer.h | petegodkin/OculusGL | a35350cc08030fe7b260e8868b9d4892f92cc48c | [
"MIT"
] | 1 | 2018-04-13T21:35:36.000Z | 2018-04-13T21:35:36.000Z | src/Util/GL/DeferredRenderer.h | petegodkin/OculusGL | a35350cc08030fe7b260e8868b9d4892f92cc48c | [
"MIT"
] | null | null | null | src/Util/GL/DeferredRenderer.h | petegodkin/OculusGL | a35350cc08030fe7b260e8868b9d4892f92cc48c | [
"MIT"
] | null | null | null | #pragma once
#include "StencilShader.h"
#include "Shader.h"
#include "Camera.h"
class DeferredRenderer : public Shader
{
public:
DeferredRenderer();
DeferredRenderer(std::string vertShader, std::string fragShader);
~DeferredRenderer();
void setGBuffer(GBuffer* gbuffer);
virtual void draw(Camera* camera, std::vector<Light*> lights) const;
private:
void pointLightPass(Camera* camera, Light* light) const;
void allLightsPass(Camera* camera, std::vector<Light*> lights) const;
glm::vec3 lightDir;
const GBuffer* gbuffer;
StencilShader stencilShader;
GLuint model_handle;
GLuint view_handle;
GLuint proj_handle;
GLuint pos_map_handle;
GLuint color_map_handle;
GLuint normal_map_handle;
GLuint eye_handle;
GLuint size_handle;
GLuint position_handle;
GLuint light_pos_handle;
GLuint light_color_handle;
GLuint shiny_handle;
GLuint intensity_handle;
GLuint exp_handle;
GLuint linear_handle;
std::string toast;
}; | 18.96 | 70 | 0.776371 |
a7d302e1c9bab4797d383ddef0b11c4f4db86585 | 289 | c | C | valgrind/exp-omega/tests/scope3.c | sjcappella/avalanche | a30936ae9374bbac1fa09c28e27f75b0f57c69c5 | [
"Apache-2.0"
] | 3 | 2016-01-20T13:01:59.000Z | 2018-03-30T15:27:51.000Z | valgrind/exp-omega/tests/scope3.c | vancaho/avalanche | a30936ae9374bbac1fa09c28e27f75b0f57c69c5 | [
"Apache-2.0"
] | null | null | null | valgrind/exp-omega/tests/scope3.c | vancaho/avalanche | a30936ae9374bbac1fa09c28e27f75b0f57c69c5 | [
"Apache-2.0"
] | 1 | 2017-05-27T07:13:53.000Z | 2017-05-27T07:13:53.000Z | #include <stdlib.h>
static void func1(char *pointer)
{
__attribute__((unused)) int dummy = 0;
return;
} /* Line 7 x86-64*/
int main(int argc, char *argv[])
{
func1((char *)malloc(64)); /* Line 11 */
return 0;
} /* Line 14 x86 due to timing of stack invalidation */
| 19.266667 | 55 | 0.605536 |
71ec051870e0c8cb3cc7c14608ab487ce574d058 | 714 | h | C | Telecomm/Telecomm/Lib/Componet/StockMarket/include/JFLineStyleCell.h | telecommai/ios | 0dce4eeba342466ffe0db72fc0b77ba7d708d8cf | [
"BSD-3-Clause"
] | 1 | 2019-04-19T08:05:34.000Z | 2019-04-19T08:05:34.000Z | Telecomm/Telecomm/Lib/Componet/StockMarket/include/JFLineStyleCell.h | telecommai/ios | 0dce4eeba342466ffe0db72fc0b77ba7d708d8cf | [
"BSD-3-Clause"
] | null | null | null | Telecomm/Telecomm/Lib/Componet/StockMarket/include/JFLineStyleCell.h | telecommai/ios | 0dce4eeba342466ffe0db72fc0b77ba7d708d8cf | [
"BSD-3-Clause"
] | 1 | 2019-09-05T01:54:54.000Z | 2019-09-05T01:54:54.000Z | //
// JFLineStyleCell.h
// StockMarket
//
// Created by YRH on 2018/11/14.
// Copyright © 2018 SpiderMan. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "JFStockSegmentBarItem.h"
@class JFLineStyleCell;
@protocol JFLineStyleCelldelegate <NSObject>
- (void)didTouchButton:(UIButton *)sender cell:(JFLineStyleCell *)cell index:(NSInteger)index model:(JFSegmentBarItemChildModel *)model title:(NSString *)title;
@end
NS_ASSUME_NONNULL_BEGIN
@interface JFLineStyleCell : UITableViewCell
@property (nonatomic, strong) JFSegmentBarItemChildModel *model;
@property (nonatomic, weak) id<JFLineStyleCelldelegate> delegate;
- (void)hiddenBottomLive;
- (void)showBottomLive;
@end
NS_ASSUME_NONNULL_END
| 22.3125 | 160 | 0.777311 |
70b51efe4eb5a85574c83ff0443527253870f800 | 24,115 | c | C | src/lib/ewl_attach.c | OpenInkpot/attic-ewl | a843dcee8933452e0aff7baa0a9210aaac25553f | [
"MIT-advertising"
] | null | null | null | src/lib/ewl_attach.c | OpenInkpot/attic-ewl | a843dcee8933452e0aff7baa0a9210aaac25553f | [
"MIT-advertising"
] | null | null | null | src/lib/ewl_attach.c | OpenInkpot/attic-ewl | a843dcee8933452e0aff7baa0a9210aaac25553f | [
"MIT-advertising"
] | null | null | null | /* vim: set sw=8 ts=8 sts=8 expandtab: */
#include "ewl_base.h"
#include "ewl_box.h"
#include "ewl_popup.h"
#include "ewl_label.h"
#include "ewl_macros.h"
#include "ewl_private.h"
#include "ewl_debug.h"
/**
* Ewl_Attach_Tooltip
*/
typedef struct Ewl_Attach_Tooltip Ewl_Attach_Tooltip;
/**
* @brief Inherits from Ewl_Widget and extends to provide information on a
* tooltip
*/
struct Ewl_Attach_Tooltip
{
Ewl_Widget *embed;
Ewl_Widget *win;
Ewl_Widget *box;
Ewl_Attach *attach;
int x;
int y;
Ecore_Timer *timer;
Ewl_Widget *to;
};
static Ewl_Attach_List *ewl_attach_list_new(void);
static void ewl_attach_list_free(Ewl_Attach_List *list);
static void ewl_attach_list_add(Ewl_Attach_List *list, Ewl_Widget *parent,
Ewl_Attach *attach);
static void *ewl_attach_list_get(Ewl_Attach_List *list, Ewl_Attach_Type type);
static Ewl_Attach *ewl_attach_new(Ewl_Attach_Type t,
Ewl_Attach_Data_Type dt, void *data);
static int ewl_attach_init(Ewl_Attach *attach, Ewl_Attach_Type t,
Ewl_Attach_Data_Type dt, void *data);
static void ewl_attach_free(Ewl_Attach *attach);
static void ewl_attach_parent_setup(Ewl_Widget *w);
static void ewl_attach_cb_parent_destroy(Ewl_Widget *w, void *ev, void *data);
static void ewl_attach_attach_type_setup(Ewl_Widget *w, Ewl_Attach *attach);
static void ewl_attach_tooltip_attach(Ewl_Widget *w, Ewl_Attach *attach);
static void ewl_attach_tooltip_detach(Ewl_Attach *attach);
static void ewl_attach_cb_tooltip_win_destroy(Ewl_Widget *w, void *ev, void *data);
static void ewl_attach_cb_tooltip_mouse_move(Ewl_Widget *w, void *ev, void *data);
static void ewl_attach_cb_tooltip_mouse_down(Ewl_Widget *w, void *ev, void *data);
static void ewl_attach_cb_tooltip_mouse_out(Ewl_Widget *w, void *ev, void *data);
static int ewl_attach_cb_tooltip_timer(void *data);
static Ewl_Attach_Tooltip *ewl_attach_tooltip = NULL;
/**
* @param w: The widget to attach the text too
* @param t: The type of the attachment
* @param data: The text to set as the attachment
* @return Returns no value
* @brief Attaches the text @p data to the widget @p w
*/
void
ewl_attach_text_set(Ewl_Widget *w, Ewl_Attach_Type t, const char *data)
{
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR(w);
DCHECK_TYPE(w, EWL_WIDGET_TYPE);
if (!w->attach)
ewl_attach_parent_setup(w);
if (data)
{
Ewl_Attach *attach;
attach = ewl_attach_new(t, EWL_ATTACH_DATA_TYPE_TEXT,
(void *)data);
if (attach)
ewl_attach_list_add(w->attach, w, attach);
}
else
ewl_attach_list_del(w->attach, t);
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
* @param w: The widget to attach the widget too
* @param t: The type of data being attached
* @param data: The wiget to attach
* @return Returns no value
* @brief Attaches a widget @p data to the widget @p w
*/
void
ewl_attach_widget_set(Ewl_Widget *w, Ewl_Attach_Type t, Ewl_Widget *data)
{
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR(w);
DCHECK_TYPE(w, EWL_WIDGET_TYPE);
DCHECK_TYPE(data, EWL_WIDGET_TYPE);
if (!w->attach)
ewl_attach_parent_setup(w);
if (data)
{
Ewl_Attach *attach;
attach = ewl_attach_new(t, EWL_ATTACH_DATA_TYPE_WIDGET,
(void *)data);
if (attach)
ewl_attach_list_add(w->attach, w, attach);
}
else
ewl_attach_list_del(w->attach, t);
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
* @param w: The widget to attach the data too
* @param t: The type of attachment
* @param data: The data to attach
* @return Returns no value
* @brief Attaches the data @p data to the widget @p w with the attache type
* of @p t
*/
void
ewl_attach_other_set(Ewl_Widget *w, Ewl_Attach_Type t, void *data)
{
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR(w);
DCHECK_TYPE(w, EWL_WIDGET_TYPE);
if (!w->attach)
ewl_attach_parent_setup(w);
if (data)
{
Ewl_Attach *attach;
attach = ewl_attach_new(t, EWL_ATTACH_DATA_TYPE_OTHER, data);
if (attach)
ewl_attach_list_add(w->attach, w, attach);
}
else
ewl_attach_list_del(w->attach, t);
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
* @param w: The widget to attach the dnd data too
* @param c: The cursor to display during drag.
* @param data: The data to transfer on drop.
* @param size: The amount of data send
* @return Returns no value
* @brief Attaches the DND data @p data to the widget @p w with the displayed
* cursor @p c.
*/
void
ewl_attach_dnd_drag_set(Ewl_Widget *w, Ewl_Widget *c, void *data, int size)
{
Ewl_Attach_Dnd *dnd_data;
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR(w);
DCHECK_TYPE(w, EWL_WIDGET_TYPE);
dnd_data = ewl_attach_get(w, EWL_ATTACH_TYPE_DND_DATA);
if (!c && !data) {
if (dnd_data)
FREE(dnd_data);
}
else {
if (!dnd_data)
dnd_data = NEW(Ewl_Attach_Dnd, 1);
dnd_data->cursor = c;
dnd_data->data = data;
dnd_data->size = size;
}
ewl_attach_other_set(w, EWL_ATTACH_TYPE_DND_DATA, dnd_data);
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
* @param w: The widget to get the attachment from
* @param t: The type of attachment to get
* @return Returns the data for the given attachment type
* @brief Get the attachment of type @p t from the widget @p w
*/
void *
ewl_attach_get(Ewl_Widget *w, Ewl_Attach_Type t)
{
Ewl_Attach *attach;
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR_RET(w, NULL);
DCHECK_TYPE_RET(w, EWL_WIDGET_TYPE, NULL);
if (!w->attach)
{
DRETURN_PTR(NULL, DLEVEL_STABLE);
}
attach = ewl_attach_list_get(w->attach, t);
if (attach)
{
DRETURN_PTR(attach->data, DLEVEL_STABLE);
}
DRETURN_PTR(NULL, DLEVEL_STABLE);
}
static Ewl_Attach_List *
ewl_attach_list_new(void)
{
Ewl_Attach_List *list;
DENTER_FUNCTION(DLEVEL_STABLE);
list = NEW(Ewl_Attach_List, 1);
DRETURN_PTR(list, DLEVEL_STABLE);
}
static void
ewl_attach_list_free(Ewl_Attach_List *list)
{
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR(list);
if (list->direct)
ewl_attach_list_del(list, EWL_ATTACH(list->list)->type);
else
{
while (list->len)
{
if (!list->direct)
ewl_attach_list_del(list,
EWL_ATTACH(list->list[0])->type);
else
ewl_attach_list_del(list,
EWL_ATTACH(list->list)->type);
}
}
FREE(list);
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_attach_list_add(Ewl_Attach_List *list, Ewl_Widget *parent, Ewl_Attach *attach)
{
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR(list);
DCHECK_PARAM_PTR(attach);
if (!list->len)
{
list->len = 1;
list->direct = 1;
list->list = (void *)attach;
ewl_attach_attach_type_setup(parent, attach);
DRETURN(DLEVEL_STABLE);
}
else if (list->direct)
{
Ewl_Attach *tmp;
tmp = EWL_ATTACH(list->list);
/* replace if the same type */
if (tmp->type == attach->type)
{
ewl_attach_free(tmp);
list->list = (void *)attach;
ewl_attach_attach_type_setup(parent, attach);
DRETURN(DLEVEL_STABLE);
}
list->list = malloc(sizeof(void *));
list->list[0] = tmp;
list->direct = 0;
}
else
{
unsigned int i;
Ewl_Attach *tmp;
/* replace if in list already */
for (i = 0; i < list->len; i++)
{
tmp = EWL_ATTACH(list->list[i]);
if (tmp->type == attach->type)
{
ewl_attach_free(tmp);
list->list[i] = attach;
ewl_attach_attach_type_setup(parent, attach);
DRETURN(DLEVEL_STABLE);
}
}
}
list->len ++;
REALLOC(list->list, void *, list->len);
list->list[list->len - 1] = attach;
ewl_attach_attach_type_setup(parent, attach);
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_attach_attach_type_setup(Ewl_Widget *w, Ewl_Attach *attach)
{
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR(w);
DCHECK_PARAM_PTR(attach);
DCHECK_TYPE(w, EWL_WIDGET_TYPE);
switch (attach->type)
{
case EWL_ATTACH_TYPE_TOOLTIP:
ewl_attach_tooltip_attach(w, attach);
break;
case EWL_ATTACH_TYPE_COLOR:
case EWL_ATTACH_TYPE_NAME:
default:
break;
}
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
/**
* @param list: The Ewl_Attach_List to delete
* @param type: The Ewl_Attach_Type to delete
* @return Returns no value
* @brief Deletes the given type @p type from the list @p list
*/
void
ewl_attach_list_del(Ewl_Attach_List *list, Ewl_Attach_Type type)
{
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR(list);
if (!list->len)
{
DRETURN(DLEVEL_STABLE);
}
else if (list->direct)
{
Ewl_Attach *tmp;
tmp = EWL_ATTACH(list->list);
if (tmp->type == type)
{
ewl_attach_free(tmp);
list->len --;
list->direct = 0;
list->list = NULL;
}
DRETURN(DLEVEL_STABLE);
}
else
{
unsigned int i;
Ewl_Attach *tmp;
for (i = 0; i < list->len; i++)
{
tmp = EWL_ATTACH(list->list[i]);
if (tmp->type == type)
{
ewl_attach_free(tmp);
list->len --;
/* if not the last entry */
if (i != list->len)
memmove(list->list + i,
list->list + i + 1,
list->len * sizeof(void *));
REALLOC(list->list, void *, list->len);
}
}
}
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void *
ewl_attach_list_get(Ewl_Attach_List *list, Ewl_Attach_Type type)
{
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR_RET(list, NULL);
if (!list->len)
{
DRETURN_PTR(NULL, DLEVEL_STABLE);
}
else if (list->direct)
{
Ewl_Attach *tmp;
tmp = EWL_ATTACH(list->list);
if (tmp->type == type)
{
DRETURN_PTR(tmp, DLEVEL_STABLE);
}
DRETURN_PTR(NULL, DLEVEL_STABLE);
}
else
{
unsigned int i;
Ewl_Attach *tmp;
for (i = 0; i < list->len; i++)
{
tmp = EWL_ATTACH(list->list[i]);
if (tmp->type == type)
{
DRETURN_PTR(tmp, DLEVEL_STABLE);
}
}
}
DRETURN_PTR(NULL, DLEVEL_STABLE);
}
static Ewl_Attach *
ewl_attach_new(Ewl_Attach_Type t, Ewl_Attach_Data_Type dt, void *data)
{
Ewl_Attach *attach;
DENTER_FUNCTION(DLEVEL_STABLE);
attach = NEW(Ewl_Attach, 1);
if (!attach)
{
DRETURN_PTR(NULL, DLEVEL_STABLE);
}
if (!ewl_attach_init(attach, t, dt, data))
{
FREE(attach);
}
DRETURN_PTR(attach, DLEVEL_STABLE);
}
static int
ewl_attach_init(Ewl_Attach *attach, Ewl_Attach_Type t,
Ewl_Attach_Data_Type dt, void *data)
{
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR_RET(attach, FALSE);
attach->type = t;
if (dt == EWL_ATTACH_DATA_TYPE_TEXT)
attach->data = strdup(data);
else
attach->data = data;
attach->data_type = dt;
DRETURN_INT(TRUE, DLEVEL_STABLE);
}
static void
ewl_attach_free(Ewl_Attach *attach)
{
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR(attach);
/* XXX should we clean up _WIDGET in here? */
if ((attach->data_type == EWL_ATTACH_DATA_TYPE_TEXT))
{
IF_FREE(attach->data);
}
IF_FREE(attach);
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_attach_parent_setup(Ewl_Widget *w)
{
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR(w);
DCHECK_TYPE(w, EWL_WIDGET_TYPE);
w->attach = ewl_attach_list_new();
ewl_callback_prepend(w, EWL_CALLBACK_DESTROY,
ewl_attach_cb_parent_destroy, NULL);
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_attach_cb_parent_destroy(Ewl_Widget *w, void *ev __UNUSED__,
void *data __UNUSED__)
{
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR(w);
DCHECK_TYPE(w, EWL_WIDGET_TYPE);
/* make sure the timer gets cleaned up if the widget goes away */
if ((ewl_attach_tooltip) && (w == ewl_attach_tooltip->to)
&& (ewl_attach_tooltip->timer))
{
ecore_timer_del(ewl_attach_tooltip->timer);
ewl_attach_tooltip->timer = NULL;
}
if (w->attach)
ewl_attach_list_free(w->attach);
w->attach = NULL;
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_attach_tooltip_attach(Ewl_Widget *w, Ewl_Attach *attach)
{
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR(w);
DCHECK_PARAM_PTR(attach);
DCHECK_TYPE(w, EWL_WIDGET_TYPE);
ewl_callback_append(w, EWL_CALLBACK_MOUSE_MOVE,
ewl_attach_cb_tooltip_mouse_move, NULL);
ewl_callback_append(w, EWL_CALLBACK_MOUSE_DOWN,
ewl_attach_cb_tooltip_mouse_down, NULL);
ewl_callback_append(w, EWL_CALLBACK_MOUSE_OUT,
ewl_attach_cb_tooltip_mouse_out, NULL);
ewl_callback_append(w, EWL_CALLBACK_OBSCURE,
ewl_attach_cb_tooltip_mouse_out, NULL);
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_attach_tooltip_detach(Ewl_Attach *attach)
{
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR(attach);
/* make sure the display attach is our attach */
if (!ewl_attach_tooltip || (ewl_attach_tooltip->attach != attach))
DRETURN(DLEVEL_STABLE);
if (ewl_attach_tooltip->timer)
ecore_timer_del(ewl_attach_tooltip->timer);
ewl_attach_tooltip->timer = NULL;
ewl_attach_tooltip->to = NULL;
ewl_attach_tooltip->x = 0;
ewl_attach_tooltip->y = 0;
/* cleanup the display window */
if (ewl_attach_tooltip->box)
{
if (attach->data_type != EWL_ATTACH_DATA_TYPE_TEXT)
ewl_container_child_remove(
EWL_CONTAINER(ewl_attach_tooltip->box),
EWL_WIDGET(attach->data));
ewl_widget_destroy(ewl_attach_tooltip->box);
ewl_attach_tooltip->box = NULL;
}
/* destroy window if needed */
if (ewl_attach_tooltip->win && VISIBLE(ewl_attach_tooltip->win))
ewl_widget_hide(ewl_attach_tooltip->win);
ewl_attach_tooltip->attach = NULL;
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_attach_cb_tooltip_mouse_move(Ewl_Widget *w, void *ev, void *data __UNUSED__)
{
Ewl_Attach *attach;
Ewl_Event_Mouse *e;
const char *delay_str;
double delay = 1.0;
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR(w);
DCHECK_PARAM_PTR(ev);
DCHECK_TYPE(w, EWL_WIDGET_TYPE);
e = ev;
attach = ewl_attach_list_get(w->attach, EWL_ATTACH_TYPE_TOOLTIP);
if (!attach)
DRETURN(DLEVEL_STABLE);
if (!ewl_attach_tooltip)
ewl_attach_tooltip = NEW(Ewl_Attach_Tooltip, 1);
if (!ewl_attach_tooltip)
DRETURN(DLEVEL_STABLE);
/* we only want to kill this tooltip if the move is outside
* the move tolerance */
if (ewl_attach_tooltip->attach == attach)
{
int amt = 0;
amt = ewl_theme_data_int_get(w, "/tooltip/tolerance");
if ((e->x >= (ewl_attach_tooltip->x - amt))
&& (e->x <= (ewl_attach_tooltip->x + amt))
&& (e->y >= (ewl_attach_tooltip->y - amt))
&& (e->y <= (ewl_attach_tooltip->y + amt)))
DRETURN(DLEVEL_STABLE);
}
ewl_attach_tooltip_detach(attach);
ewl_attach_tooltip->attach = attach;
ewl_attach_tooltip->to = w;
ewl_attach_tooltip->x = e->x;
ewl_attach_tooltip->y = e->y;
delay_str = (const char *)ewl_theme_data_str_get(w, "/tooltip/delay");
if (delay_str) delay = atof(delay_str);
ewl_attach_tooltip->timer = ecore_timer_add(delay,
ewl_attach_cb_tooltip_timer, w);
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_attach_cb_tooltip_mouse_down(Ewl_Widget *w __UNUSED__,
void *ev __UNUSED__, void *data __UNUSED__)
{
Ewl_Attach *attach;
DENTER_FUNCTION(DLEVEL_STABLE);
attach = ewl_attach_list_get(w->attach, EWL_ATTACH_TYPE_TOOLTIP);
if (!attach) DRETURN(DLEVEL_STABLE);
ewl_attach_tooltip_detach(attach);
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static void
ewl_attach_cb_tooltip_mouse_out(Ewl_Widget *w __UNUSED__,
void *ev __UNUSED__, void *data __UNUSED__)
{
Ewl_Attach *attach;
DENTER_FUNCTION(DLEVEL_STABLE);
attach = ewl_attach_list_get(w->attach, EWL_ATTACH_TYPE_TOOLTIP);
if (!attach) DRETURN(DLEVEL_STABLE);
ewl_attach_tooltip_detach(attach);
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
static int
ewl_attach_cb_tooltip_timer(void *data)
{
Ewl_Widget *w;
Ewl_Embed *emb;
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR_RET(data, ECORE_CALLBACK_CANCEL);
/* we are returning false so that will shutdown the timer, just need
* to make sure we don't try to del it a second time so set it NULL */
ewl_attach_tooltip->timer = NULL;
w = data;
emb = ewl_embed_widget_find(w);
if (!emb)
DRETURN_INT(ECORE_CALLBACK_CANCEL, DLEVEL_STABLE);
if (!(ewl_attach_tooltip->win))
{
int oh, ov;
ewl_attach_tooltip->win = ewl_popup_new();
ewl_popup_type_set(EWL_POPUP(ewl_attach_tooltip->win),
EWL_POPUP_TYPE_MOUSE);
ewl_popup_follow_set(EWL_POPUP(ewl_attach_tooltip->win),
EWL_WIDGET(emb));
ewl_attach_tooltip->embed = EWL_WIDGET(emb);
ewl_callback_prepend(ewl_attach_tooltip->win,
EWL_CALLBACK_DESTROY,
ewl_attach_cb_tooltip_win_destroy,
NULL);
ov = ewl_theme_data_int_get(EWL_WIDGET(w),
"/tooltip/voffset");
oh = ewl_theme_data_int_get(EWL_WIDGET(w),
"/tooltip/hoffset");
ewl_popup_offset_set(EWL_POPUP(ewl_attach_tooltip->win),
oh, ov);
ewl_widget_appearance_set(ewl_attach_tooltip->win,
EWL_ATTACH_TOOLTIP_TYPE);
ewl_widget_inherit(ewl_attach_tooltip->win,
EWL_ATTACH_TOOLTIP_TYPE);
}
else
{
/* see if we need to add to the embed */
if ((!ewl_attach_tooltip->embed)
|| (ewl_attach_tooltip->embed
!= EWL_WIDGET(emb)))
{
ewl_attach_tooltip->embed = EWL_WIDGET(emb);
ewl_popup_follow_set(EWL_POPUP(ewl_attach_tooltip->win),
ewl_attach_tooltip->embed);
}
}
ewl_widget_show(ewl_attach_tooltip->win);
if (!(ewl_attach_tooltip->box))
{
ewl_attach_tooltip->box = ewl_hbox_new();
ewl_container_child_append(
EWL_CONTAINER(ewl_attach_tooltip->win),
ewl_attach_tooltip->box);
}
ewl_widget_show(ewl_attach_tooltip->box);
if (ewl_attach_tooltip->attach->data_type ==
EWL_ATTACH_DATA_TYPE_WIDGET)
{
ewl_container_child_append(
EWL_CONTAINER(ewl_attach_tooltip->box),
EWL_WIDGET(ewl_attach_tooltip->attach->data));
ewl_widget_show(EWL_WIDGET(ewl_attach_tooltip->attach->data));
}
else
{
Ewl_Widget *o;
o = ewl_label_new();
ewl_label_text_set(EWL_LABEL(o),
ewl_attach_tooltip->attach->data);
ewl_container_child_append(
EWL_CONTAINER(ewl_attach_tooltip->box), o);
ewl_widget_show(o);
}
ewl_popup_mouse_position_set(EWL_POPUP(ewl_attach_tooltip->win),
ewl_attach_tooltip->x,
ewl_attach_tooltip->y);
DRETURN_INT(ECORE_CALLBACK_CANCEL, DLEVEL_STABLE);
}
static void
ewl_attach_cb_tooltip_win_destroy(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__,
void *data __UNUSED__)
{
DENTER_FUNCTION(DLEVEL_STABLE);
ewl_attach_tooltip->embed = NULL;
ewl_attach_tooltip->win = NULL;
ewl_attach_tooltip->box = NULL;
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
| 30.371537 | 83 | 0.539208 |
f35434dc6111f71edd66b485da2ee9ff24bf4500 | 603 | h | C | ProgressButton/ProgressButton/ProgressPlay.h | UCliwenbin/BasicDemo-IOS | b51850addf723f26dfcdc42393907b9b68e7a8c0 | [
"MIT"
] | null | null | null | ProgressButton/ProgressButton/ProgressPlay.h | UCliwenbin/BasicDemo-IOS | b51850addf723f26dfcdc42393907b9b68e7a8c0 | [
"MIT"
] | null | null | null | ProgressButton/ProgressButton/ProgressPlay.h | UCliwenbin/BasicDemo-IOS | b51850addf723f26dfcdc42393907b9b68e7a8c0 | [
"MIT"
] | null | null | null | //
// ProgressPlay.h
// ProgressButton
//
// Created by mac on 2020/1/10.
// Copyright © 2020 lwb. All rights reserved.
//
#import <Foundation/Foundation.h>
#define DURATION 20.0
#define PERIOD 0.5
@class ProgressPlay;
@protocol ProgressPlayDelegate <NSObject>
- (void)player:(ProgressPlay *)player didReachPosition:(float)position;
- (void)playerDidStop:(ProgressPlay *)player;
@end
@interface ProgressPlay : NSObject
{
NSTimer *timer;
}
- (void)play;
- (void)pause;
@property (nonatomic, assign) float position;
@property (nonatomic, weak) id<ProgressPlayDelegate> delegate;
@end
| 15.868421 | 71 | 0.721393 |
279e9733b1b1f81e3aa8edd48a2c6acb14bece30 | 2,155 | h | C | 3Engine/src/Shader/ShaderProgram.h | RicardoEPRodrigues/CGJ-Labs | 127e24d67fe221dbbc4089095ac0f8bd4f9e897a | [
"MIT"
] | 5 | 2017-11-03T11:34:47.000Z | 2019-07-30T18:18:05.000Z | 3Engine/src/Shader/ShaderProgram.h | RicardoEPRodrigues/CGJ-Labs | 127e24d67fe221dbbc4089095ac0f8bd4f9e897a | [
"MIT"
] | 7 | 2018-07-03T06:16:26.000Z | 2020-05-16T02:17:41.000Z | 3Engine/src/Shader/ShaderProgram.h | RicardoEPRodrigues/CGJ-Labs | 127e24d67fe221dbbc4089095ac0f8bd4f9e897a | [
"MIT"
] | 2 | 2018-01-05T12:55:04.000Z | 2020-10-14T18:56:05.000Z | /*
* File ShaderProgram.h in project ThreeEngine
*
* Copyright (C) Ricardo Rodrigues 2017 - All Rights Reserved
*/
#ifndef THREEENGINE_SHADERPROGRAM_H
#define THREEENGINE_SHADERPROGRAM_H
#include <vector>
#include "Shader.h"
#include "../Utilities/json.hpp"
namespace ThreeEngine {
class ShaderProgram {
private:
GLuint id;
std::vector<Shader*> shaders;
nlohmann::json info;
void Add(Shader* shader);
void BindAttributeLocation(GLuint index, const GLchar* name);
void Link();
const std::string GetTypeString(GLenum type);
std::string GetResourceName(int program, int type, int id, unsigned long nameLength);
void ExtractUniform(int id, std::vector<std::pair<int, std::string>>& uniforms);
GLint GetUniformLocation(const GLchar* name);
GLint GetUniformBlockIndex(const GLchar* name);
void UniformBlockBinding(GLuint ubi, GLuint blockBinding);
public:
ShaderProgram();
explicit ShaderProgram(nlohmann::json j);
explicit ShaderProgram(const GLchar* filepath);
virtual ~ShaderProgram();
void LoadJson(nlohmann::json j);
void LoadJsonFile(const GLchar* filepath);
void Init();
GLint GetUniformLocationId(const GLchar* name);
GLint GetUniformBlockId(const GLchar* name);
GLint GetUniformBlockBidingId(const GLchar* name);
void SetTextureUnits(std::string name, GLint number);
void Bind();
void Unbind();
friend std::ostream& operator<<(std::ostream& os, const ShaderProgram& shaderProgram) {
os << "Shader Program " << shaderProgram.id << std::endl
<< shaderProgram.info.dump(2) << std::endl;
return os;
};
operator std::string() const {
return "Shader Program " + std::to_string(id) + "\n" + info.dump(2) + "\n";
}
};
} /* namespace Divisaction */
#endif //THREEENGINE_SHADERPROGRAM_H
| 26.280488 | 99 | 0.59536 |
4609e5302854da8ba3592ecbf28212c03ab8017a | 63,168 | c | C | Lab3_2/ripple_led/isim/rippler_top_isim_beh.exe.sim/work/m_15934688313890345061_0296076146.c | Riyuzakii/CS220 | 122e6876792316604788e0b79b2f7c641ff56b41 | [
"MIT"
] | null | null | null | Lab3_2/ripple_led/isim/rippler_top_isim_beh.exe.sim/work/m_15934688313890345061_0296076146.c | Riyuzakii/CS220 | 122e6876792316604788e0b79b2f7c641ff56b41 | [
"MIT"
] | null | null | null | Lab3_2/ripple_led/isim/rippler_top_isim_beh.exe.sim/work/m_15934688313890345061_0296076146.c | Riyuzakii/CS220 | 122e6876792316604788e0b79b2f7c641ff56b41 | [
"MIT"
] | null | null | null | /**********************************************************************/
/* ____ ____ */
/* / /\/ / */
/* /___/ \ / */
/* \ \ \/ */
/* \ \ Copyright (c) 2003-2009 Xilinx, Inc. */
/* / / All Right Reserved. */
/* /---/ /\ */
/* \ \ / \ */
/* \___\/\___\ */
/***********************************************************************/
/* This file is designed for use with ISim build 0xfbc00daa */
#define XSI_HIDE_SYMBOL_SPEC true
#include "xsi.h"
#include <memory.h>
#ifdef __GNUC__
#include <stdlib.h>
#else
#include <malloc.h>
#define alloca _alloca
#endif
static const char *ng0 = "/media/raditya/822A-B6CA/CS220Labs/Lab3_2/ripple_led/rippler_top.v";
static const char *ng1 = "time=%d: clk=%b, led0=%b, led1=%b, led2=%b, led3=%b, led4=%b, led5=%b, led6=%b, led7=%b";
static int ng2[] = {0, 0};
static int ng3[] = {1, 0};
static void Always_53_0(char *t0)
{
char t4[16];
char *t1;
char *t2;
char *t3;
char *t5;
char *t6;
char *t7;
char *t8;
char *t9;
char *t10;
char *t11;
char *t12;
char *t13;
char *t14;
char *t15;
char *t16;
char *t17;
LAB0: t1 = (t0 + 3480U);
t2 = *((char **)t1);
if (t2 == 0)
goto LAB2;
LAB3: goto *t2;
LAB2: xsi_set_current_line(53, ng0);
t2 = (t0 + 4048);
*((int *)t2) = 1;
t3 = (t0 + 3512);
*((char **)t3) = t2;
*((char **)t1) = &&LAB4;
LAB1: return;
LAB4: xsi_set_current_line(53, ng0);
LAB5: xsi_set_current_line(54, ng0);
t5 = xsi_vlog_time(t4, 1000.0000000000000, 1000.0000000000000);
t6 = (t0 + 2568);
t7 = (t6 + 56U);
t8 = *((char **)t7);
t9 = (t0 + 1048U);
t10 = *((char **)t9);
t9 = (t0 + 1208U);
t11 = *((char **)t9);
t9 = (t0 + 1368U);
t12 = *((char **)t9);
t9 = (t0 + 1528U);
t13 = *((char **)t9);
t9 = (t0 + 1688U);
t14 = *((char **)t9);
t9 = (t0 + 1848U);
t15 = *((char **)t9);
t9 = (t0 + 2008U);
t16 = *((char **)t9);
t9 = (t0 + 2168U);
t17 = *((char **)t9);
xsi_vlogfile_write(1, 0, 0, ng1, 11, t0, (char)118, t4, 64, (char)118, t8, 1, (char)118, t10, 1, (char)118, t11, 1, (char)118, t12, 1, (char)118, t13, 1, (char)118, t14, 1, (char)118, t15, 1, (char)118, t16, 1, (char)118, t17, 1);
goto LAB2;
}
static void Initial_57_1(char *t0)
{
char *t1;
char *t2;
char *t3;
char *t4;
LAB0: t1 = (t0 + 3728U);
t2 = *((char **)t1);
if (t2 == 0)
goto LAB2;
LAB3: goto *t2;
LAB2: xsi_set_current_line(57, ng0);
LAB4: xsi_set_current_line(58, ng0);
t2 = ((char*)((ng2)));
t3 = (t0 + 2568);
xsi_vlogvar_assign_value(t3, t2, 0, 0, 1);
xsi_set_current_line(59, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB5;
LAB1: return;
LAB5: xsi_set_current_line(60, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(61, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB6;
goto LAB1;
LAB6: xsi_set_current_line(62, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(63, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB7;
goto LAB1;
LAB7: xsi_set_current_line(64, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(65, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB8;
goto LAB1;
LAB8: xsi_set_current_line(66, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(67, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB9;
goto LAB1;
LAB9: xsi_set_current_line(68, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(69, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB10;
goto LAB1;
LAB10: xsi_set_current_line(70, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(71, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB11;
goto LAB1;
LAB11: xsi_set_current_line(72, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(73, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB12;
goto LAB1;
LAB12: xsi_set_current_line(74, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(75, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB13;
goto LAB1;
LAB13: xsi_set_current_line(76, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(77, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB14;
goto LAB1;
LAB14: xsi_set_current_line(78, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(79, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB15;
goto LAB1;
LAB15: xsi_set_current_line(80, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(81, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB16;
goto LAB1;
LAB16: xsi_set_current_line(82, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(83, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB17;
goto LAB1;
LAB17: xsi_set_current_line(84, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(85, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB18;
goto LAB1;
LAB18: xsi_set_current_line(86, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(87, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB19;
goto LAB1;
LAB19: xsi_set_current_line(88, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(89, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB20;
goto LAB1;
LAB20: xsi_set_current_line(90, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(91, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB21;
goto LAB1;
LAB21: xsi_set_current_line(92, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(93, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB22;
goto LAB1;
LAB22: xsi_set_current_line(94, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(95, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB23;
goto LAB1;
LAB23: xsi_set_current_line(96, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(97, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB24;
goto LAB1;
LAB24: xsi_set_current_line(98, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(99, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB25;
goto LAB1;
LAB25: xsi_set_current_line(100, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(101, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB26;
goto LAB1;
LAB26: xsi_set_current_line(102, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(103, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB27;
goto LAB1;
LAB27: xsi_set_current_line(104, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(105, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB28;
goto LAB1;
LAB28: xsi_set_current_line(106, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(107, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB29;
goto LAB1;
LAB29: xsi_set_current_line(108, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(109, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB30;
goto LAB1;
LAB30: xsi_set_current_line(110, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(111, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB31;
goto LAB1;
LAB31: xsi_set_current_line(112, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(113, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB32;
goto LAB1;
LAB32: xsi_set_current_line(114, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(115, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB33;
goto LAB1;
LAB33: xsi_set_current_line(116, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(117, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB34;
goto LAB1;
LAB34: xsi_set_current_line(118, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(119, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB35;
goto LAB1;
LAB35: xsi_set_current_line(120, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(121, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB36;
goto LAB1;
LAB36: xsi_set_current_line(122, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(123, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB37;
goto LAB1;
LAB37: xsi_set_current_line(124, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(125, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB38;
goto LAB1;
LAB38: xsi_set_current_line(126, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(127, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB39;
goto LAB1;
LAB39: xsi_set_current_line(128, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(129, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB40;
goto LAB1;
LAB40: xsi_set_current_line(130, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(131, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB41;
goto LAB1;
LAB41: xsi_set_current_line(132, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(133, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB42;
goto LAB1;
LAB42: xsi_set_current_line(134, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(135, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB43;
goto LAB1;
LAB43: xsi_set_current_line(136, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(137, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB44;
goto LAB1;
LAB44: xsi_set_current_line(138, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(139, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB45;
goto LAB1;
LAB45: xsi_set_current_line(140, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(141, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB46;
goto LAB1;
LAB46: xsi_set_current_line(142, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(143, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB47;
goto LAB1;
LAB47: xsi_set_current_line(144, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(145, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB48;
goto LAB1;
LAB48: xsi_set_current_line(146, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(147, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB49;
goto LAB1;
LAB49: xsi_set_current_line(148, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(149, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB50;
goto LAB1;
LAB50: xsi_set_current_line(150, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(151, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB51;
goto LAB1;
LAB51: xsi_set_current_line(152, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(153, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB52;
goto LAB1;
LAB52: xsi_set_current_line(154, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(155, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB53;
goto LAB1;
LAB53: xsi_set_current_line(156, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(157, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB54;
goto LAB1;
LAB54: xsi_set_current_line(158, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(159, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB55;
goto LAB1;
LAB55: xsi_set_current_line(160, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(161, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB56;
goto LAB1;
LAB56: xsi_set_current_line(162, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(163, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB57;
goto LAB1;
LAB57: xsi_set_current_line(164, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(165, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB58;
goto LAB1;
LAB58: xsi_set_current_line(166, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(167, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB59;
goto LAB1;
LAB59: xsi_set_current_line(168, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(169, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB60;
goto LAB1;
LAB60: xsi_set_current_line(170, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(171, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB61;
goto LAB1;
LAB61: xsi_set_current_line(172, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(173, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB62;
goto LAB1;
LAB62: xsi_set_current_line(174, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(175, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB63;
goto LAB1;
LAB63: xsi_set_current_line(176, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(177, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB64;
goto LAB1;
LAB64: xsi_set_current_line(178, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(179, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB65;
goto LAB1;
LAB65: xsi_set_current_line(180, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(181, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB66;
goto LAB1;
LAB66: xsi_set_current_line(182, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(183, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB67;
goto LAB1;
LAB67: xsi_set_current_line(184, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(185, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB68;
goto LAB1;
LAB68: xsi_set_current_line(186, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(187, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB69;
goto LAB1;
LAB69: xsi_set_current_line(188, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(189, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB70;
goto LAB1;
LAB70: xsi_set_current_line(190, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(191, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB71;
goto LAB1;
LAB71: xsi_set_current_line(192, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(193, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB72;
goto LAB1;
LAB72: xsi_set_current_line(194, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(195, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB73;
goto LAB1;
LAB73: xsi_set_current_line(196, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(197, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB74;
goto LAB1;
LAB74: xsi_set_current_line(198, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(199, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB75;
goto LAB1;
LAB75: xsi_set_current_line(200, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(201, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB76;
goto LAB1;
LAB76: xsi_set_current_line(202, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(203, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB77;
goto LAB1;
LAB77: xsi_set_current_line(204, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(205, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB78;
goto LAB1;
LAB78: xsi_set_current_line(206, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(207, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB79;
goto LAB1;
LAB79: xsi_set_current_line(208, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(209, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB80;
goto LAB1;
LAB80: xsi_set_current_line(210, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(211, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB81;
goto LAB1;
LAB81: xsi_set_current_line(212, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(213, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB82;
goto LAB1;
LAB82: xsi_set_current_line(214, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(215, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB83;
goto LAB1;
LAB83: xsi_set_current_line(216, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(217, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB84;
goto LAB1;
LAB84: xsi_set_current_line(218, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(219, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB85;
goto LAB1;
LAB85: xsi_set_current_line(220, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(221, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB86;
goto LAB1;
LAB86: xsi_set_current_line(222, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(223, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB87;
goto LAB1;
LAB87: xsi_set_current_line(224, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(225, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB88;
goto LAB1;
LAB88: xsi_set_current_line(226, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(227, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB89;
goto LAB1;
LAB89: xsi_set_current_line(228, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(229, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB90;
goto LAB1;
LAB90: xsi_set_current_line(230, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(231, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB91;
goto LAB1;
LAB91: xsi_set_current_line(232, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(233, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB92;
goto LAB1;
LAB92: xsi_set_current_line(234, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(235, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB93;
goto LAB1;
LAB93: xsi_set_current_line(236, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(237, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB94;
goto LAB1;
LAB94: xsi_set_current_line(238, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(239, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB95;
goto LAB1;
LAB95: xsi_set_current_line(240, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(241, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB96;
goto LAB1;
LAB96: xsi_set_current_line(242, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(243, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB97;
goto LAB1;
LAB97: xsi_set_current_line(244, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(245, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB98;
goto LAB1;
LAB98: xsi_set_current_line(246, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(247, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB99;
goto LAB1;
LAB99: xsi_set_current_line(248, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(249, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB100;
goto LAB1;
LAB100: xsi_set_current_line(250, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(251, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB101;
goto LAB1;
LAB101: xsi_set_current_line(252, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(253, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB102;
goto LAB1;
LAB102: xsi_set_current_line(254, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(255, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB103;
goto LAB1;
LAB103: xsi_set_current_line(256, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(257, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB104;
goto LAB1;
LAB104: xsi_set_current_line(258, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(259, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB105;
goto LAB1;
LAB105: xsi_set_current_line(260, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(261, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB106;
goto LAB1;
LAB106: xsi_set_current_line(262, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(263, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB107;
goto LAB1;
LAB107: xsi_set_current_line(264, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(265, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB108;
goto LAB1;
LAB108: xsi_set_current_line(266, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(267, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB109;
goto LAB1;
LAB109: xsi_set_current_line(268, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(269, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB110;
goto LAB1;
LAB110: xsi_set_current_line(270, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(271, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB111;
goto LAB1;
LAB111: xsi_set_current_line(272, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(273, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB112;
goto LAB1;
LAB112: xsi_set_current_line(274, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(275, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB113;
goto LAB1;
LAB113: xsi_set_current_line(276, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(277, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB114;
goto LAB1;
LAB114: xsi_set_current_line(278, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(279, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB115;
goto LAB1;
LAB115: xsi_set_current_line(280, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(281, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB116;
goto LAB1;
LAB116: xsi_set_current_line(282, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(283, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB117;
goto LAB1;
LAB117: xsi_set_current_line(284, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(285, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB118;
goto LAB1;
LAB118: xsi_set_current_line(286, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(287, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB119;
goto LAB1;
LAB119: xsi_set_current_line(288, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(289, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB120;
goto LAB1;
LAB120: xsi_set_current_line(290, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(291, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB121;
goto LAB1;
LAB121: xsi_set_current_line(292, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(293, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB122;
goto LAB1;
LAB122: xsi_set_current_line(294, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(295, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB123;
goto LAB1;
LAB123: xsi_set_current_line(296, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(297, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB124;
goto LAB1;
LAB124: xsi_set_current_line(298, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(299, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB125;
goto LAB1;
LAB125: xsi_set_current_line(300, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(301, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB126;
goto LAB1;
LAB126: xsi_set_current_line(302, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(303, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB127;
goto LAB1;
LAB127: xsi_set_current_line(304, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(305, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB128;
goto LAB1;
LAB128: xsi_set_current_line(306, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(307, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB129;
goto LAB1;
LAB129: xsi_set_current_line(308, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(309, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB130;
goto LAB1;
LAB130: xsi_set_current_line(310, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(311, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB131;
goto LAB1;
LAB131: xsi_set_current_line(312, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(313, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB132;
goto LAB1;
LAB132: xsi_set_current_line(314, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(315, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB133;
goto LAB1;
LAB133: xsi_set_current_line(316, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(317, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB134;
goto LAB1;
LAB134: xsi_set_current_line(318, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(319, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB135;
goto LAB1;
LAB135: xsi_set_current_line(320, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(321, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB136;
goto LAB1;
LAB136: xsi_set_current_line(322, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(323, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB137;
goto LAB1;
LAB137: xsi_set_current_line(324, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(325, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB138;
goto LAB1;
LAB138: xsi_set_current_line(326, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(327, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB139;
goto LAB1;
LAB139: xsi_set_current_line(328, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(329, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB140;
goto LAB1;
LAB140: xsi_set_current_line(330, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(331, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB141;
goto LAB1;
LAB141: xsi_set_current_line(332, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(333, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB142;
goto LAB1;
LAB142: xsi_set_current_line(334, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(335, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB143;
goto LAB1;
LAB143: xsi_set_current_line(336, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(337, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB144;
goto LAB1;
LAB144: xsi_set_current_line(338, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(339, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB145;
goto LAB1;
LAB145: xsi_set_current_line(340, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(341, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB146;
goto LAB1;
LAB146: xsi_set_current_line(342, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(343, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB147;
goto LAB1;
LAB147: xsi_set_current_line(344, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(345, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB148;
goto LAB1;
LAB148: xsi_set_current_line(346, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(347, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB149;
goto LAB1;
LAB149: xsi_set_current_line(348, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(349, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB150;
goto LAB1;
LAB150: xsi_set_current_line(350, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(351, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB151;
goto LAB1;
LAB151: xsi_set_current_line(352, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(353, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB152;
goto LAB1;
LAB152: xsi_set_current_line(354, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(355, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB153;
goto LAB1;
LAB153: xsi_set_current_line(356, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(357, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB154;
goto LAB1;
LAB154: xsi_set_current_line(358, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(359, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB155;
goto LAB1;
LAB155: xsi_set_current_line(360, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(361, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB156;
goto LAB1;
LAB156: xsi_set_current_line(362, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(363, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB157;
goto LAB1;
LAB157: xsi_set_current_line(364, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(365, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB158;
goto LAB1;
LAB158: xsi_set_current_line(366, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(367, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB159;
goto LAB1;
LAB159: xsi_set_current_line(368, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(369, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB160;
goto LAB1;
LAB160: xsi_set_current_line(370, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(371, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB161;
goto LAB1;
LAB161: xsi_set_current_line(372, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(373, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB162;
goto LAB1;
LAB162: xsi_set_current_line(374, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(375, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB163;
goto LAB1;
LAB163: xsi_set_current_line(376, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(377, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB164;
goto LAB1;
LAB164: xsi_set_current_line(378, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(379, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB165;
goto LAB1;
LAB165: xsi_set_current_line(380, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(381, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB166;
goto LAB1;
LAB166: xsi_set_current_line(382, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(383, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB167;
goto LAB1;
LAB167: xsi_set_current_line(384, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(385, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB168;
goto LAB1;
LAB168: xsi_set_current_line(386, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(387, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB169;
goto LAB1;
LAB169: xsi_set_current_line(388, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(389, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB170;
goto LAB1;
LAB170: xsi_set_current_line(390, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(391, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB171;
goto LAB1;
LAB171: xsi_set_current_line(392, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(393, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB172;
goto LAB1;
LAB172: xsi_set_current_line(394, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(395, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB173;
goto LAB1;
LAB173: xsi_set_current_line(396, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(397, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB174;
goto LAB1;
LAB174: xsi_set_current_line(398, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(399, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB175;
goto LAB1;
LAB175: xsi_set_current_line(400, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(401, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB176;
goto LAB1;
LAB176: xsi_set_current_line(402, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(403, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB177;
goto LAB1;
LAB177: xsi_set_current_line(404, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(405, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB178;
goto LAB1;
LAB178: xsi_set_current_line(406, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(407, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB179;
goto LAB1;
LAB179: xsi_set_current_line(408, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(409, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB180;
goto LAB1;
LAB180: xsi_set_current_line(410, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(411, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB181;
goto LAB1;
LAB181: xsi_set_current_line(412, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(413, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB182;
goto LAB1;
LAB182: xsi_set_current_line(414, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(415, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB183;
goto LAB1;
LAB183: xsi_set_current_line(416, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(417, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB184;
goto LAB1;
LAB184: xsi_set_current_line(418, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(419, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB185;
goto LAB1;
LAB185: xsi_set_current_line(420, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(421, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB186;
goto LAB1;
LAB186: xsi_set_current_line(422, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(423, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB187;
goto LAB1;
LAB187: xsi_set_current_line(424, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(425, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB188;
goto LAB1;
LAB188: xsi_set_current_line(426, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(427, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB189;
goto LAB1;
LAB189: xsi_set_current_line(428, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(429, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB190;
goto LAB1;
LAB190: xsi_set_current_line(430, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(431, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB191;
goto LAB1;
LAB191: xsi_set_current_line(432, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(433, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB192;
goto LAB1;
LAB192: xsi_set_current_line(434, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(435, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB193;
goto LAB1;
LAB193: xsi_set_current_line(436, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(437, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB194;
goto LAB1;
LAB194: xsi_set_current_line(438, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(439, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB195;
goto LAB1;
LAB195: xsi_set_current_line(440, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(441, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB196;
goto LAB1;
LAB196: xsi_set_current_line(442, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(443, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB197;
goto LAB1;
LAB197: xsi_set_current_line(444, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(445, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB198;
goto LAB1;
LAB198: xsi_set_current_line(446, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(447, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB199;
goto LAB1;
LAB199: xsi_set_current_line(448, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(449, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB200;
goto LAB1;
LAB200: xsi_set_current_line(450, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(451, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB201;
goto LAB1;
LAB201: xsi_set_current_line(452, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(453, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB202;
goto LAB1;
LAB202: xsi_set_current_line(454, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(455, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB203;
goto LAB1;
LAB203: xsi_set_current_line(456, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(457, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB204;
goto LAB1;
LAB204: xsi_set_current_line(458, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(459, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB205;
goto LAB1;
LAB205: xsi_set_current_line(460, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(461, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB206;
goto LAB1;
LAB206: xsi_set_current_line(462, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(463, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB207;
goto LAB1;
LAB207: xsi_set_current_line(464, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(465, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB208;
goto LAB1;
LAB208: xsi_set_current_line(466, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(467, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB209;
goto LAB1;
LAB209: xsi_set_current_line(468, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(469, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB210;
goto LAB1;
LAB210: xsi_set_current_line(470, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(471, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB211;
goto LAB1;
LAB211: xsi_set_current_line(472, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(473, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB212;
goto LAB1;
LAB212: xsi_set_current_line(474, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(475, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB213;
goto LAB1;
LAB213: xsi_set_current_line(476, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(477, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB214;
goto LAB1;
LAB214: xsi_set_current_line(478, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(479, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB215;
goto LAB1;
LAB215: xsi_set_current_line(480, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(481, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB216;
goto LAB1;
LAB216: xsi_set_current_line(482, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(483, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB217;
goto LAB1;
LAB217: xsi_set_current_line(484, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(485, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB218;
goto LAB1;
LAB218: xsi_set_current_line(486, ng0);
t3 = ((char*)((ng2)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(487, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB219;
goto LAB1;
LAB219: xsi_set_current_line(488, ng0);
t3 = ((char*)((ng3)));
t4 = (t0 + 2568);
xsi_vlogvar_assign_value(t4, t3, 0, 0, 1);
xsi_set_current_line(489, ng0);
t2 = (t0 + 3536);
xsi_process_wait(t2, 5000LL);
*((char **)t1) = &&LAB220;
goto LAB1;
LAB220: xsi_set_current_line(490, ng0);
xsi_vlog_finish(1);
goto LAB1;
}
extern void work_m_15934688313890345061_0296076146_init()
{
static char *pe[] = {(void *)Always_53_0,(void *)Initial_57_1};
xsi_register_didat("work_m_15934688313890345061_0296076146", "isim/rippler_top_isim_beh.exe.sim/work/m_15934688313890345061_0296076146.didat");
xsi_register_executes(pe);
}
| 27.668857 | 234 | 0.560379 |
46a5ee2e37c56089b5fbbfbd89fc6e1832c93245 | 1,285 | h | C | System/Library/PrivateFrameworks/CameraUI.framework/CAMPendingLocalPersistenceWrapper.h | lechium/iOS1351Headers | 6bed3dada5ffc20366b27f7f2300a24a48a6284e | [
"MIT"
] | 2 | 2021-11-02T09:23:27.000Z | 2022-03-28T08:21:57.000Z | System/Library/PrivateFrameworks/CameraUI.framework/CAMPendingLocalPersistenceWrapper.h | lechium/iOS1351Headers | 6bed3dada5ffc20366b27f7f2300a24a48a6284e | [
"MIT"
] | null | null | null | System/Library/PrivateFrameworks/CameraUI.framework/CAMPendingLocalPersistenceWrapper.h | lechium/iOS1351Headers | 6bed3dada5ffc20366b27f7f2300a24a48a6284e | [
"MIT"
] | 1 | 2022-03-28T08:21:59.000Z | 2022-03-28T08:21:59.000Z | /*
* This header is generated by classdump-dyld 1.5
* on Wednesday, October 27, 2021 at 3:17:29 PM Mountain Standard Time
* Operating System: Version 13.5.1 (Build 17F80)
* Image Source: /System/Library/PrivateFrameworks/CameraUI.framework/CameraUI
* classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos. Updated by Kevin Bradley.
*/
@class CAMCaptureRequest;
@interface CAMPendingLocalPersistenceWrapper : NSObject {
CAMCaptureRequest* _request;
id _result;
/*^block*/id _completionHandler;
}
@property (nonatomic,readonly) CAMCaptureRequest * request; //@synthesize request=_request - In the implementation block
@property (nonatomic,readonly) id result; //@synthesize result=_result - In the implementation block
@property (nonatomic,copy) id completionHandler; //@synthesize completionHandler=_completionHandler - In the implementation block
-(id)result;
-(CAMCaptureRequest *)request;
-(id)completionHandler;
-(void)setCompletionHandler:(id)arg1 ;
-(id)initWithRequest:(id)arg1 result:(id)arg2 completionHandler:(/*^block*/id)arg3 ;
@end
| 42.833333 | 153 | 0.656031 |
7d6265179190772d649519f611c3c9c400398f1a | 2,264 | h | C | System/Library/Frameworks/ARKit.framework/ARProximityData.h | lechium/iOS1351Headers | 6bed3dada5ffc20366b27f7f2300a24a48a6284e | [
"MIT"
] | 2 | 2021-11-02T09:23:27.000Z | 2022-03-28T08:21:57.000Z | System/Library/Frameworks/ARKit.framework/ARProximityData.h | lechium/iOS1351Headers | 6bed3dada5ffc20366b27f7f2300a24a48a6284e | [
"MIT"
] | null | null | null | System/Library/Frameworks/ARKit.framework/ARProximityData.h | lechium/iOS1351Headers | 6bed3dada5ffc20366b27f7f2300a24a48a6284e | [
"MIT"
] | 1 | 2022-03-28T08:21:59.000Z | 2022-03-28T08:21:59.000Z | /*
* This header is generated by classdump-dyld 1.5
* on Wednesday, October 27, 2021 at 3:16:35 PM Mountain Standard Time
* Operating System: Version 13.5.1 (Build 17F80)
* Image Source: /System/Library/Frameworks/ARKit.framework/ARKit
* classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos. Updated by Kevin Bradley.
*/
#import <ARKit/ARSensorData.h>
@class PRRelativePosition, PRPeer, NSString;
@interface ARProximityData : NSObject <ARSensorData> {
double _timestamp;
double _timestampLocalSync;
double _timestampGlobalSync;
PRRelativePosition* _measurement;
PRPeer* _peer;
unsigned long long _vioSessionID;
}
@property (assign,nonatomic) double timestamp; //@synthesize timestamp=_timestamp - In the implementation block
@property (assign,nonatomic) double timestampLocalSync; //@synthesize timestampLocalSync=_timestampLocalSync - In the implementation block
@property (assign,nonatomic) double timestampGlobalSync; //@synthesize timestampGlobalSync=_timestampGlobalSync - In the implementation block
@property (nonatomic,readonly) PRRelativePosition * measurement; //@synthesize measurement=_measurement - In the implementation block
@property (nonatomic,readonly) PRPeer * peer; //@synthesize peer=_peer - In the implementation block
@property (nonatomic,readonly) unsigned long long vioSessionID; //@synthesize vioSessionID=_vioSessionID - In the implementation block
@property (readonly) unsigned long long hash;
@property (readonly) Class superclass;
@property (copy,readonly) NSString * description;
@property (copy,readonly) NSString * debugDescription;
-(double)timestamp;
-(PRRelativePosition *)measurement;
-(void)setTimestamp:(double)arg1 ;
-(PRPeer *)peer;
-(unsigned long long)vioSessionID;
-(double)timestampLocalSync;
-(double)timestampGlobalSync;
-(id)initWithMeasurement:(id)arg1 peer:(id)arg2 vioSessionID:(unsigned long long)arg3 ;
-(void)setTimestampLocalSync:(double)arg1 ;
-(void)setTimestampGlobalSync:(double)arg1 ;
@end
| 49.217391 | 162 | 0.701413 |
a87415325eb0814ad11b72b948de97b0c88b8269 | 654 | h | C | Engine/GameEngine/Sprite.h | kaushal135/NetworkingAstroids | 903aa4cbff58f2626f93e7054c27797aa6e591dc | [
"MIT"
] | null | null | null | Engine/GameEngine/Sprite.h | kaushal135/NetworkingAstroids | 903aa4cbff58f2626f93e7054c27797aa6e591dc | [
"MIT"
] | null | null | null | Engine/GameEngine/Sprite.h | kaushal135/NetworkingAstroids | 903aa4cbff58f2626f93e7054c27797aa6e591dc | [
"MIT"
] | null | null | null | #ifndef _SPRITE_H_
#define _SPRITE_H_
#pragma once
#include "Renderable.h"
class Asset;
namespace sf { class Sprite; }
class Sprite : public Renderable
{
DECLARE_DYNAMIC_DERIVED_CLASS(Sprite, Renderable)
public :
~Sprite();
virtual void initialize();
void writeCreate(RakNet::BitStream & bs) const override;
void readCreate(RakNet::BitStream & bs) override;
void load(XMLElement* node);
void save(XMLElement* node);
virtual void render(sf::RenderWindow* window, Transform* t) override;
bool isWithinBounds(float x, float y);
protected:
sf::Sprite* renderableSprite;
Asset* textureAsset;
std::string textureUID;
};
#endif
| 17.675676 | 70 | 0.740061 |
a39e70705cba139e22eb85013926d9b59549e2f4 | 2,234 | h | C | hphp/runtime/ext/asio/session_scoped_wait_handle.h | tstarling/hhvm | 6bc40a3d0c7e5f3162b7ce606be52ed7408db3c1 | [
"PHP-3.01",
"Zend-2.0"
] | 3 | 2015-04-21T12:15:53.000Z | 2016-12-25T09:15:44.000Z | hphp/runtime/ext/asio/session_scoped_wait_handle.h | tstarling/hhvm | 6bc40a3d0c7e5f3162b7ce606be52ed7408db3c1 | [
"PHP-3.01",
"Zend-2.0"
] | null | null | null | hphp/runtime/ext/asio/session_scoped_wait_handle.h | tstarling/hhvm | 6bc40a3d0c7e5f3162b7ce606be52ed7408db3c1 | [
"PHP-3.01",
"Zend-2.0"
] | 1 | 2021-03-24T20:14:38.000Z | 2021-03-24T20:14:38.000Z | /*
+----------------------------------------------------------------------+
| HipHop for PHP |
+----------------------------------------------------------------------+
| Copyright (c) 2010-2014 Facebook, Inc. (http://www.facebook.com) |
| Copyright (c) 1997-2010 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
*/
#ifndef incl_HPHP_EXT_ASIO_SESSION_SCOPED_WAIT_HANDLE_H_
#define incl_HPHP_EXT_ASIO_SESSION_SCOPED_WAIT_HANDLE_H_
#include "hphp/runtime/base/base-includes.h"
#include "hphp/runtime/ext/asio/waitable_wait_handle.h"
namespace HPHP {
///////////////////////////////////////////////////////////////////////////////
// class SessionScopedWaitHandle
/**
* A wait handle whose execution transcends context-scope.
*/
FORWARD_DECLARE_CLASS(SessionScopedWaitHandle);
class c_SessionScopedWaitHandle : public c_WaitableWaitHandle {
public:
DECLARE_CLASS_NO_SWEEP(SessionScopedWaitHandle)
explicit c_SessionScopedWaitHandle(Class* cls =
c_SessionScopedWaitHandle::classof())
: c_WaitableWaitHandle(cls)
{}
~c_SessionScopedWaitHandle() {}
void t___construct();
public:
void exitContext(context_idx_t ctx_idx);
protected:
void enterContextImpl(context_idx_t ctx_idx);
virtual void registerToContext() = 0;
virtual void unregisterFromContext() = 0;
static const int8_t STATE_WAITING = 3;
};
///////////////////////////////////////////////////////////////////////////////
}
#endif // incl_HPHP_EXT_ASIO_SESSION_SCOPED_WAIT_HANDLE_H_
| 37.864407 | 79 | 0.539839 |
9ebd40ce0e35755e3f8247f0d6cc60e2df8a039e | 780 | h | C | shared/Irrlicht/include/EGUIAlignment.h | iProgramMC/proton | 1c383134b44a22cebab8e8db1afb17afd59dd543 | [
"XFree86-1.1"
] | 47 | 2018-07-30T12:05:15.000Z | 2022-03-31T04:12:03.000Z | shared/Irrlicht/include/EGUIAlignment.h | iProgramMC/proton | 1c383134b44a22cebab8e8db1afb17afd59dd543 | [
"XFree86-1.1"
] | 11 | 2019-03-31T13:05:10.000Z | 2021-11-03T11:37:18.000Z | shared/Irrlicht/include/EGUIAlignment.h | iProgramMC/proton | 1c383134b44a22cebab8e8db1afb17afd59dd543 | [
"XFree86-1.1"
] | 16 | 2019-07-09T07:59:00.000Z | 2022-02-25T15:49:06.000Z | // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __E_GUI_ALIGNMENT_H_INCLUDED__
#define __E_GUI_ALIGNMENT_H_INCLUDED__
namespace irr
{
namespace gui
{
enum EGUI_ALIGNMENT
{
//! Aligned to parent's top or left side (default)
EGUIA_UPPERLEFT=0,
//! Aligned to parent's bottom or right side
EGUIA_LOWERRIGHT,
//! Aligned to the center of parent
EGUIA_CENTER,
//! Stretched to fit parent
EGUIA_SCALE
};
//! Names for alignments
const c8* const GUIAlignmentNames[] =
{
"upperLeft",
"lowerRight",
"center",
"scale",
0
};
} // namespace gui
} // namespace irr
#endif // __E_GUI_ALIGNMENT_H_INCLUDED__
| 20 | 78 | 0.705128 |
b147cf5b35183b650fef7efce8fed5a491119750 | 1,685 | h | C | kernel/linux-4.13/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.h | ShawnZhong/SplitFS | 7e21a6fc505ff70802e5666d097326ecb97a4ae3 | [
"Apache-2.0"
] | 31 | 2018-01-16T17:11:44.000Z | 2022-03-16T13:51:24.000Z | kernel/linux-4.13/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.h | braymill/SplitFS | 00a42bb1b51718048e4c15dde31e9d358932575e | [
"Apache-2.0"
] | 5 | 2020-04-04T09:24:09.000Z | 2020-04-19T12:33:55.000Z | kernel/linux-4.13/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.h | braymill/SplitFS | 00a42bb1b51718048e4c15dde31e9d358932575e | [
"Apache-2.0"
] | 30 | 2018-05-02T08:43:27.000Z | 2022-01-23T03:25:54.000Z | #ifndef __NV50_DISP_ROOT_H__
#define __NV50_DISP_ROOT_H__
#define nv50_disp_root(p) container_of((p), struct nv50_disp_root, object)
#include "nv50.h"
#include "channv50.h"
#include "dmacnv50.h"
struct nv50_disp_root {
const struct nv50_disp_root_func *func;
struct nv50_disp *disp;
struct nvkm_object object;
struct nvkm_gpuobj *instmem;
struct nvkm_ramht *ramht;
};
struct nv50_disp_root_func {
int (*init)(struct nv50_disp_root *);
void (*fini)(struct nv50_disp_root *);
const struct nv50_disp_dmac_oclass *dmac[3];
const struct nv50_disp_pioc_oclass *pioc[2];
};
int nv50_disp_root_new_(const struct nv50_disp_root_func *, struct nvkm_disp *,
const struct nvkm_oclass *, void *data, u32 size,
struct nvkm_object **);
int nv50_disp_root_init(struct nv50_disp_root *);
void nv50_disp_root_fini(struct nv50_disp_root *);
int gf119_disp_root_init(struct nv50_disp_root *);
void gf119_disp_root_fini(struct nv50_disp_root *);
extern const struct nvkm_disp_oclass nv50_disp_root_oclass;
extern const struct nvkm_disp_oclass g84_disp_root_oclass;
extern const struct nvkm_disp_oclass g94_disp_root_oclass;
extern const struct nvkm_disp_oclass gt200_disp_root_oclass;
extern const struct nvkm_disp_oclass gt215_disp_root_oclass;
extern const struct nvkm_disp_oclass gf119_disp_root_oclass;
extern const struct nvkm_disp_oclass gk104_disp_root_oclass;
extern const struct nvkm_disp_oclass gk110_disp_root_oclass;
extern const struct nvkm_disp_oclass gm107_disp_root_oclass;
extern const struct nvkm_disp_oclass gm200_disp_root_oclass;
extern const struct nvkm_disp_oclass gp100_disp_root_oclass;
extern const struct nvkm_disp_oclass gp102_disp_root_oclass;
#endif
| 36.630435 | 80 | 0.833234 |
322f1f3c7d3e80cc3184d6553d62439f15288e8e | 15,031 | h | C | include/ceres/gradient_problem_solver.h | jmackay2/ceres-solver | 044c168b4d15c956f6451322c038b91c1d5498f9 | [
"Apache-2.0"
] | null | null | null | include/ceres/gradient_problem_solver.h | jmackay2/ceres-solver | 044c168b4d15c956f6451322c038b91c1d5498f9 | [
"Apache-2.0"
] | null | null | null | include/ceres/gradient_problem_solver.h | jmackay2/ceres-solver | 044c168b4d15c956f6451322c038b91c1d5498f9 | [
"Apache-2.0"
] | null | null | null | // Ceres Solver - A fast non-linear least squares minimizer
// Copyright 2019 Google Inc. All rights reserved.
// http://ceres-solver.org/
//
// 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.
//
// Author: sameeragarwal@google.com (Sameer Agarwal)
#ifndef CERES_PUBLIC_GRADIENT_PROBLEM_SOLVER_H_
#define CERES_PUBLIC_GRADIENT_PROBLEM_SOLVER_H_
#include <cmath>
#include <string>
#include <vector>
#include "ceres/internal/disable_warnings.h"
#include "ceres/internal/port.h"
#include "ceres/iteration_callback.h"
#include "ceres/types.h"
namespace ceres {
class GradientProblem;
class CERES_EXPORT GradientProblemSolver {
public:
virtual ~GradientProblemSolver();
// The options structure contains, not surprisingly, options that control how
// the solver operates. The defaults should be suitable for a wide range of
// problems; however, better performance is often obtainable with tweaking.
//
// The constants are defined inside types.h
struct CERES_EXPORT Options {
// Returns true if the options struct has a valid
// configuration. Returns false otherwise, and fills in *error
// with a message describing the problem.
bool IsValid(std::string* error) const;
// Minimizer options ----------------------------------------
LineSearchDirectionType line_search_direction_type = LBFGS;
LineSearchType line_search_type = WOLFE;
NonlinearConjugateGradientType nonlinear_conjugate_gradient_type =
FLETCHER_REEVES;
// The LBFGS hessian approximation is a low rank approximation to
// the inverse of the Hessian matrix. The rank of the
// approximation determines (linearly) the space and time
// complexity of using the approximation. Higher the rank, the
// better is the quality of the approximation. The increase in
// quality is however is bounded for a number of reasons.
//
// 1. The method only uses secant information and not actual
// derivatives.
//
// 2. The Hessian approximation is constrained to be positive
// definite.
//
// So increasing this rank to a large number will cost time and
// space complexity without the corresponding increase in solution
// quality. There are no hard and fast rules for choosing the
// maximum rank. The best choice usually requires some problem
// specific experimentation.
//
// For more theoretical and implementation details of the LBFGS
// method, please see:
//
// Nocedal, J. (1980). "Updating Quasi-Newton Matrices with
// Limited Storage". Mathematics of Computation 35 (151): 773-782.
int max_lbfgs_rank = 20;
// As part of the (L)BFGS update step (BFGS) / right-multiply step (L-BFGS),
// the initial inverse Hessian approximation is taken to be the Identity.
// However, Oren showed that using instead I * \gamma, where \gamma is
// chosen to approximate an eigenvalue of the true inverse Hessian can
// result in improved convergence in a wide variety of cases. Setting
// use_approximate_eigenvalue_bfgs_scaling to true enables this scaling.
//
// It is important to note that approximate eigenvalue scaling does not
// always improve convergence, and that it can in fact significantly degrade
// performance for certain classes of problem, which is why it is disabled
// by default. In particular it can degrade performance when the
// sensitivity of the problem to different parameters varies significantly,
// as in this case a single scalar factor fails to capture this variation
// and detrimentally downscales parts of the jacobian approximation which
// correspond to low-sensitivity parameters. It can also reduce the
// robustness of the solution to errors in the jacobians.
//
// Oren S.S., Self-scaling variable metric (SSVM) algorithms
// Part II: Implementation and experiments, Management Science,
// 20(5), 863-874, 1974.
bool use_approximate_eigenvalue_bfgs_scaling = false;
// Degree of the polynomial used to approximate the objective
// function. Valid values are BISECTION, QUADRATIC and CUBIC.
//
// BISECTION corresponds to pure backtracking search with no
// interpolation.
LineSearchInterpolationType line_search_interpolation_type = CUBIC;
// If during the line search, the step_size falls below this
// value, it is truncated to zero.
double min_line_search_step_size = 1e-9;
// Line search parameters.
// Solving the line search problem exactly is computationally
// prohibitive. Fortunately, line search based optimization
// algorithms can still guarantee convergence if instead of an
// exact solution, the line search algorithm returns a solution
// which decreases the value of the objective function
// sufficiently. More precisely, we are looking for a step_size
// s.t.
//
// f(step_size) <= f(0) + sufficient_decrease * f'(0) * step_size
//
double line_search_sufficient_function_decrease = 1e-4;
// In each iteration of the line search,
//
// new_step_size >= max_line_search_step_contraction * step_size
//
// Note that by definition, for contraction:
//
// 0 < max_step_contraction < min_step_contraction < 1
//
double max_line_search_step_contraction = 1e-3;
// In each iteration of the line search,
//
// new_step_size <= min_line_search_step_contraction * step_size
//
// Note that by definition, for contraction:
//
// 0 < max_step_contraction < min_step_contraction < 1
//
double min_line_search_step_contraction = 0.6;
// Maximum number of trial step size iterations during each line search,
// if a step size satisfying the search conditions cannot be found within
// this number of trials, the line search will terminate.
int max_num_line_search_step_size_iterations = 20;
// Maximum number of restarts of the line search direction algorithm before
// terminating the optimization. Restarts of the line search direction
// algorithm occur when the current algorithm fails to produce a new descent
// direction. This typically indicates a numerical failure, or a breakdown
// in the validity of the approximations used.
int max_num_line_search_direction_restarts = 5;
// The strong Wolfe conditions consist of the Armijo sufficient
// decrease condition, and an additional requirement that the
// step-size be chosen s.t. the _magnitude_ ('strong' Wolfe
// conditions) of the gradient along the search direction
// decreases sufficiently. Precisely, this second condition
// is that we seek a step_size s.t.
//
// |f'(step_size)| <= sufficient_curvature_decrease * |f'(0)|
//
// Where f() is the line search objective and f'() is the derivative
// of f w.r.t step_size (d f / d step_size).
double line_search_sufficient_curvature_decrease = 0.9;
// During the bracketing phase of the Wolfe search, the step size is
// increased until either a point satisfying the Wolfe conditions is
// found, or an upper bound for a bracket containing a point satisfying
// the conditions is found. Precisely, at each iteration of the
// expansion:
//
// new_step_size <= max_step_expansion * step_size.
//
// By definition for expansion, max_step_expansion > 1.0.
double max_line_search_step_expansion = 10.0;
// Maximum number of iterations for the minimizer to run for.
int max_num_iterations = 50;
// Maximum time for which the minimizer should run for.
double max_solver_time_in_seconds = 1e9;
// Minimizer terminates when
//
// (new_cost - old_cost) < function_tolerance * old_cost;
//
double function_tolerance = 1e-6;
// Minimizer terminates when
//
// max_i |x - Project(Plus(x, -g(x))| < gradient_tolerance
//
// This value should typically be 1e-4 * function_tolerance.
double gradient_tolerance = 1e-10;
// Minimizer terminates when
//
// |step|_2 <= parameter_tolerance * ( |x|_2 + parameter_tolerance)
//
double parameter_tolerance = 1e-8;
// Logging options ---------------------------------------------------------
LoggingType logging_type = PER_MINIMIZER_ITERATION;
// By default the Minimizer progress is logged to VLOG(1), which
// is sent to STDERR depending on the vlog level. If this flag is
// set to true, and logging_type is not SILENT, the logging output
// is sent to STDOUT.
bool minimizer_progress_to_stdout = false;
// If true, the user's parameter blocks are updated at the end of
// every Minimizer iteration, otherwise they are updated when the
// Minimizer terminates. This is useful if, for example, the user
// wishes to visualize the state of the optimization every
// iteration.
bool update_state_every_iteration = false;
// Callbacks that are executed at the end of each iteration of the
// Minimizer. An iteration may terminate midway, either due to
// numerical failures or because one of the convergence tests has
// been satisfied. In this case none of the callbacks are
// executed.
// Callbacks are executed in the order that they are specified in
// this vector. By default, parameter blocks are updated only at
// the end of the optimization, i.e when the Minimizer
// terminates. This behaviour is controlled by
// update_state_every_variable. If the user wishes to have access
// to the update parameter blocks when his/her callbacks are
// executed, then set update_state_every_iteration to true.
//
// The solver does NOT take ownership of these pointers.
std::vector<IterationCallback*> callbacks;
};
struct CERES_EXPORT Summary {
// A brief one line description of the state of the solver after
// termination.
std::string BriefReport() const;
// A full multiline description of the state of the solver after
// termination.
std::string FullReport() const;
bool IsSolutionUsable() const;
// Minimizer summary -------------------------------------------------
TerminationType termination_type = FAILURE;
// Reason why the solver terminated.
std::string message = "ceres::GradientProblemSolve was not called.";
// Cost of the problem (value of the objective function) before
// the optimization.
double initial_cost = -1.0;
// Cost of the problem (value of the objective function) after the
// optimization.
double final_cost = -1.0;
// IterationSummary for each minimizer iteration in order.
std::vector<IterationSummary> iterations;
// Number of times the cost (and not the gradient) was evaluated.
int num_cost_evaluations = -1;
// Number of times the gradient (and the cost) were evaluated.
int num_gradient_evaluations = -1;
// Sum total of all time spent inside Ceres when Solve is called.
double total_time_in_seconds = -1.0;
// Time (in seconds) spent evaluating the cost.
double cost_evaluation_time_in_seconds = -1.0;
// Time (in seconds) spent evaluating the gradient.
double gradient_evaluation_time_in_seconds = -1.0;
// Time (in seconds) spent minimizing the interpolating polynomial
// to compute the next candidate step size as part of a line search.
double line_search_polynomial_minimization_time_in_seconds = -1.0;
// Number of parameters in the problem.
int num_parameters = -1;
// Dimension of the tangent space of the problem.
CERES_DEPRECATED_WITH_MSG("Use num_tangent_parameters.")
int num_local_parameters = -1;
// Dimension of the tangent space of the problem.
int num_tangent_parameters = -1;
// Type of line search direction used.
LineSearchDirectionType line_search_direction_type = LBFGS;
// Type of the line search algorithm used.
LineSearchType line_search_type = WOLFE;
// When performing line search, the degree of the polynomial used
// to approximate the objective function.
LineSearchInterpolationType line_search_interpolation_type = CUBIC;
// If the line search direction is NONLINEAR_CONJUGATE_GRADIENT,
// then this indicates the particular variant of non-linear
// conjugate gradient used.
NonlinearConjugateGradientType nonlinear_conjugate_gradient_type =
FLETCHER_REEVES;
// If the type of the line search direction is LBFGS, then this
// indicates the rank of the Hessian approximation.
int max_lbfgs_rank = -1;
};
// Once a least squares problem has been built, this function takes
// the problem and optimizes it based on the values of the options
// parameters. Upon return, a detailed summary of the work performed
// by the preprocessor, the non-linear minimizer and the linear
// solver are reported in the summary object.
virtual void Solve(const GradientProblemSolver::Options& options,
const GradientProblem& problem,
double* parameters,
GradientProblemSolver::Summary* summary);
};
// Helper function which avoids going through the interface.
CERES_EXPORT void Solve(const GradientProblemSolver::Options& options,
const GradientProblem& problem,
double* parameters,
GradientProblemSolver::Summary* summary);
} // namespace ceres
#include "ceres/internal/reenable_warnings.h"
#endif // CERES_PUBLIC_GRADIENT_PROBLEM_SOLVER_H_
| 42.103641 | 80 | 0.712195 |
9ad83779a22d9c53438546f9d2bbc9f116699320 | 6,812 | c | C | src/lib/libc/mktime.c | dgaur/dx | 701232e4ba67036de7594f33c3f5445d0c49942f | [
"MIT"
] | null | null | null | src/lib/libc/mktime.c | dgaur/dx | 701232e4ba67036de7594f33c3f5445d0c49942f | [
"MIT"
] | null | null | null | src/lib/libc/mktime.c | dgaur/dx | 701232e4ba67036de7594f33c3f5445d0c49942f | [
"MIT"
] | null | null | null | //
// mktime.c
//
#include "assert.h"
#include "string.h" // memcpy()
#include "time.h"
//
// VARIOUS TIME + CALENDAR CONSTANTS ////////////////////////////////////
//
#define SECONDS_PER_MINUTE 60
#define MINUTES_PER_HOUR 60
#define HOURS_PER_DAY 24
#define SECONDS_PER_HOUR SECONDS_PER_MINUTE * MINUTES_PER_HOUR
#define SECONDS_PER_DAY SECONDS_PER_HOUR * HOURS_PER_DAY
/// Days per month, Jan - Dec, in non-leap-year
static
const
unsigned
DAYS_PER_MONTH[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
/// Offset of first day of each month, relative to Jan 1, for computing
/// the day-of-week
static
const
unsigned
FIRST_DAY_OFFSET[] = { 0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4 };
//
// LOCAL ROUTINES, NOT PART OF LIBC API /////////////////////////////////
//
///
/// Is this a leap year? No side effects
///
static
int
is_leap_year(int year)
{
int leap_year = 0;
//
// A leap year is: any year that is divisible by 4; unless the year is
// also divisible by 100 (in which case, *not* a leap year); unless also
// divisible by 400 (in which case, still a leap year)
//
do
{
if (year % 4)
{ break; }
if (year % 100)
{ leap_year = 1; break; }
if (year % 400)
{ break; }
leap_year = 1;
} while(0);
return(leap_year);
}
///
/// Compute the number of days in this month, year. No side effects.
///
/// @param month -- zero-based month (0 = Jan, 1 = Feb, 2 = Mar, etc)
/// @param year -- full year (1970, 1971, 1972, etc)
///
/// @return the number of days in this month
///
static
unsigned
days_per_month(unsigned month, int year)
{
assert(month < 12);
unsigned days = DAYS_PER_MONTH[month];
// Account for leap-day
if (month == 1 && is_leap_year(year))
days++;
return(days);
}
///
/// Compute the number of days in this year. No side effects.
///
static
unsigned
days_per_year(int year)
{ return(is_leap_year(year) ? 366 : 365); }
//
// LIBC ROUTINES ////////////////////////////////////////////////////////
//
struct tm*
gmtime(const time_t *timer)
{
// Per C99, the buffer returned from gmtime() may be a static object
static struct tm datetime;
localtime_r(timer, &datetime);
return(&datetime);
}
struct tm*
localtime(const time_t *timer)
{
// Per C99, the buffer returned from localtime() may be a static object
static struct tm datetime;
localtime_r(timer, &datetime);
return(&datetime);
}
///
/// Convert calendar seconds into normalized, broken-down time.
///
/// Does not handle leap-seconds; DST; or timezones
///
/// @param seconds_since_epoch -- calendar time to be converted
/// @param result -- the broken-down time, on return
///
/// @return pointer to result, or NULL on error
///
struct tm*
localtime_r(const time_t *seconds_since_epoch, struct tm *result)
{
int delta;
int forward;
time_t t = *seconds_since_epoch;
memset(result, 0, sizeof(*result));
//
// Determine the direction of counting
//
if (t >= 0)
{
// Counting forward from epoch, forward from Jan 1st, forward from the
// start of the day, etc
delta = 1;
forward = 1;
}
else
{
// Counting backwards from epoch, backwards from Dec 31st, backwards
// from the end of the day, etc
delta = -1;
forward = 0;
t = -t;
}
//
// Partial day
//
int seconds = t % SECONDS_PER_MINUTE;
if (seconds)
{
if (forward)
result->tm_sec = seconds;
else
{
result->tm_sec = SECONDS_PER_MINUTE - seconds;
t += SECONDS_PER_MINUTE;
}
}
t /= SECONDS_PER_MINUTE;
int minutes = t % MINUTES_PER_HOUR;
if (minutes)
{
if (forward)
result->tm_min = minutes;
else
{
result->tm_min = MINUTES_PER_HOUR - minutes;
t += MINUTES_PER_HOUR;
}
}
t /= MINUTES_PER_HOUR;
int hours = t % HOURS_PER_DAY;
if (hours)
{
if (forward)
result->tm_hour = hours;
else
{
result->tm_hour = HOURS_PER_DAY - hours;
t += HOURS_PER_DAY;
}
}
//
// Remaining time is now some integral number of days, possibly spanning
// multiple years
//
unsigned days = (unsigned)(t / HOURS_PER_DAY);
//
// Account for full years
//
int year = (forward ? 1970 : 1969);
for (;;)
{
unsigned days_this_year = days_per_year(year);
if (days_this_year >= days)
{ break; }
else
{ days -= days_this_year; year = year + delta; }
}
result->tm_year = year - 1900;
//
// Account for the remaining partial year, if any
//
assert(days <= 365);
result->tm_yday = (forward ? days : days_per_year(year)-days);
int month = (forward ? 0 : 11);
for(;;)
{
unsigned days_this_month = days_per_month(month, year);
if (days_this_month >= days)
{ break; }
else
{ days -= days_this_month; month = month + delta; }
}
assert(month >= 0);
assert(month <= 11);
result->tm_mon = month;
//
// Account for partial month, if any
//
assert(days <= 31);
result->tm_mday = (forward ? days+1 : days_per_month(month,year)-days+1);
//
// Lastly, compute the day-of-the-week. This is the Sakamoto algorithm.
//
if (month < 2)
year--;
result->tm_wday = (year + year/4 - year/100 + year/400 +
FIRST_DAY_OFFSET[month] + days+1) % 7;
return(result);
}
///
/// Convert a broken-down time into seconds-from-epoch representation. In
/// addition, normalize the input value, if any values are out-of-range.
///
/// Does not handle leap-seconds; DST; or timezones
///
time_t
mktime(struct tm *datetime)
{
long full_days;
int i;
time_t partial_day;
time_t seconds_since_epoch;
int year = datetime->tm_year + 1900;
//
// First, compute the elapsed seconds from the epoch. The input fields
// are not necessarily normalized (e.g., 61 seconds; 62 minutes; etc).
//
// Total seconds in the partial day
partial_day = (datetime->tm_sec) +
(datetime->tm_min * SECONDS_PER_MINUTE) +
(datetime->tm_hour * SECONDS_PER_HOUR);
// Account for partial month
full_days = (datetime->tm_mday - 1); // One-based
// Add the partial year, accounting for leap day, if applicable
for (i = 0; i < datetime->tm_mon; i++)
{ full_days += days_per_month(i, year); }
// Add full years up the epoch
if (year > 1970)
{
for (i = 1970; i < year; i++)
{ full_days += days_per_year(i); }
}
else
{
for (i = year; i < 1970; i++)
{ full_days -= days_per_year(i); }
}
// Finally compute the total elapsed seconds
seconds_since_epoch = (full_days * SECONDS_PER_DAY) + partial_day;
//
// Per C99, mktime() also normalizes its input, populates the
// day-of-the-week and -year fields, etc. Take the count of elapsed
// seconds, and convert it back into (normalized) broken-down time
//
struct tm normalized_time;
if (localtime_r(&seconds_since_epoch, &normalized_time))
{ memcpy(datetime, &normalized_time, sizeof(*datetime)); }
else
{ seconds_since_epoch = -1; }
return(seconds_since_epoch);
}
| 19.29745 | 74 | 0.639166 |
d6497e26aea42e0b339acf7f82654768a0ccc42f | 1,233 | h | C | src/nf.h | Farahdeeba/nftsim | 3701634d965c372b5f8ee57bbe5cd52ad3237926 | [
"Apache-2.0"
] | null | null | null | src/nf.h | Farahdeeba/nftsim | 3701634d965c372b5f8ee57bbe5cd52ad3237926 | [
"Apache-2.0"
] | null | null | null | src/nf.h | Farahdeeba/nftsim | 3701634d965c372b5f8ee57bbe5cd52ad3237926 | [
"Apache-2.0"
] | null | null | null | /** @file nf.h
@brief A brief, one sentence description.
A more detailed multiline description...
@author Peter Drysdale, Felix Fung,
*/
#ifndef NFTSIM_SRC_NF_H
#define NFTSIM_SRC_NF_H
// Other nftsim headers
#include "configf.h" // Configf;
//#include "dumpf.h" // Dumpf;
#include "output.h" // Output;
// C++ standard library headers
#include <vector> // std::vector;
class NF {
protected:
using size_type = std::vector<double>::size_type;
virtual void init( Configf& configf ) = 0;
//virtual void restart( Restartf& restartf ) = 0;
//virtual void dump( Dumpf& dumpf ) const = 0;
NF( size_type nodes, double deltat, size_type index );
size_type nodes; ///< number of nodes in simulation
double deltat; ///< time increment per timestep
size_type index; ///< object index within the population/connection model
public:
NF() = delete; // No default constructor allowed.
friend Configf& operator>> ( Configf& configf, NF& nf );
//friend Restartf& operator>> ( Restartf& restartf, NF& nf );
//friend Dumpf& operator<< ( Dumpf& dumpf, const NF& nf );
virtual void step() = 0;
virtual void output( Output& /*unused*/) const;
virtual ~NF();
};
#endif //NFTSIM_SRC_NF_H
| 28.674419 | 76 | 0.673966 |
cf0d51b462f4352dc9671f2fc5fbf59a67f2b293 | 411 | c | C | pset2/initials.c | anatoliy86/CS50 | 0f31f3184ffdd78a5ffb1e80ed5cc839f0adfa49 | [
"CC-BY-3.0"
] | null | null | null | pset2/initials.c | anatoliy86/CS50 | 0f31f3184ffdd78a5ffb1e80ed5cc839f0adfa49 | [
"CC-BY-3.0"
] | null | null | null | pset2/initials.c | anatoliy86/CS50 | 0f31f3184ffdd78a5ffb1e80ed5cc839f0adfa49 | [
"CC-BY-3.0"
] | null | null | null | #include <cs50.h>
#include <ctype.h>
#include <stdio.h>
#include <string.h>
int main(void)
{
string name = GetString();
for (int i = 0, n = strlen(name); i < n; i++)
{
if (i == 0)
{
printf("%c", toupper(name[i]));
}
if (name[i] == 32)
{
printf("%c", toupper(name[i+1]));
}
}
printf("\n");
} | 17.869565 | 49 | 0.396594 |
65a62ac21499b30f10115bf69a34b980fcf6a387 | 8,454 | c | C | src/alloc-override.c | HowJMay/mimalloc | 1125271c2756ee1db1303918816fea35e08b3405 | [
"MIT"
] | 1 | 2019-07-11T06:32:23.000Z | 2019-07-11T06:32:23.000Z | src/alloc-override.c | HowJMay/mimalloc | 1125271c2756ee1db1303918816fea35e08b3405 | [
"MIT"
] | null | null | null | src/alloc-override.c | HowJMay/mimalloc | 1125271c2756ee1db1303918816fea35e08b3405 | [
"MIT"
] | 1 | 2021-02-22T08:23:18.000Z | 2021-02-22T08:23:18.000Z | /* ----------------------------------------------------------------------------
Copyright (c) 2018, Microsoft Research, Daan Leijen
This is free software; you can redistribute it and/or modify it under the
terms of the MIT license. A copy of the license can be found in the file
"LICENSE" at the root of this distribution.
-----------------------------------------------------------------------------*/
#if !defined(MI_IN_ALLOC_C)
#error "this file should be included from 'alloc.c' (so aliases can work)"
#endif
#if defined(MI_MALLOC_OVERRIDE) && defined(_WIN32) && !(defined(MI_SHARED_LIB) && defined(_DLL))
#error "It is only possible to override malloc on Windows when building as a DLL (and linking the C runtime as a DLL)"
#endif
#if defined(MI_MALLOC_OVERRIDE) && !defined(_WIN32)
// ------------------------------------------------------
// Override system malloc
// ------------------------------------------------------
#if defined(_MSC_VER)
#pragma warning(disable:4273) // inconsistent dll linking
#endif
#if (defined(__GNUC__) || defined(__clang__)) && !defined(__MACH__)
// use aliasing to alias the exported function to one of our `mi_` functions
#if (defined(__GNUC__) && __GNUC__ >= 9)
#define MI_FORWARD(fun) __attribute__((alias(#fun), used, visibility("default"), copy(fun)))
#else
#define MI_FORWARD(fun) __attribute__((alias(#fun), used, visibility("default")))
#endif
#define MI_FORWARD1(fun,x) MI_FORWARD(fun)
#define MI_FORWARD2(fun,x,y) MI_FORWARD(fun)
#define MI_FORWARD0(fun,x) MI_FORWARD(fun)
#else
// use forwarding by calling our `mi_` function
#define MI_FORWARD1(fun,x) { return fun(x); }
#define MI_FORWARD2(fun,x,y) { return fun(x,y); }
#define MI_FORWARD0(fun,x) { fun(x); }
#endif
#if defined(__APPLE__) && defined(MI_SHARED_LIB_EXPORT) && defined(MI_INTERPOSE)
// use interposing so `DYLD_INSERT_LIBRARIES` works without `DYLD_FORCE_FLAT_NAMESPACE=1`
// See: <https://books.google.com/books?id=K8vUkpOXhN4C&pg=PA73>
struct mi_interpose_s {
const void* replacement;
const void* target;
};
#define MI_INTERPOSEX(oldfun,newfun) { (const void*)&newfun, (const void*)&oldfun }
#define MI_INTERPOSE_MI(fun) MI_INTERPOSEX(fun,mi_##fun)
__attribute__((used)) static struct mi_interpose_s _mi_interposes[] __attribute__((section("__DATA, __interpose"))) =
{
MI_INTERPOSE_MI(malloc),
MI_INTERPOSE_MI(calloc),
MI_INTERPOSE_MI(realloc),
MI_INTERPOSE_MI(free)
};
#else
// On all other systems forward to our API
void* malloc(size_t size) mi_attr_noexcept MI_FORWARD1(mi_malloc, size);
void* calloc(size_t size, size_t n) mi_attr_noexcept MI_FORWARD2(mi_calloc, size, n);
void* realloc(void* p, size_t newsize) mi_attr_noexcept MI_FORWARD2(mi_realloc, p, newsize);
void free(void* p) mi_attr_noexcept MI_FORWARD0(mi_free, p);
#endif
#if (defined(__GNUC__) || defined(__clang__)) && !defined(__MACH__)
#pragma GCC visibility push(default)
#endif
// ------------------------------------------------------
// Override new/delete
// This is not really necessary as they usually call
// malloc/free anyway, but it improves performance.
// ------------------------------------------------------
#ifdef __cplusplus
// ------------------------------------------------------
// With a C++ compiler we override the new/delete operators.
// see <https://en.cppreference.com/w/cpp/memory/new/operator_new>
// ------------------------------------------------------
#include <new>
void operator delete(void* p) noexcept MI_FORWARD0(mi_free,p);
void operator delete[](void* p) noexcept MI_FORWARD0(mi_free,p);
void* operator new(std::size_t n) noexcept(false) MI_FORWARD1(mi_malloc,n);
void* operator new[](std::size_t n) noexcept(false) MI_FORWARD1(mi_malloc,n);
#if (__cplusplus >= 201703L)
void* operator new( std::size_t n, std::align_val_t align) noexcept(false) MI_FORWARD2(mi_malloc_aligned,n,align);
void* operator new[]( std::size_t n, std::align_val_t align) noexcept(false) MI_FORWARD2(mi_malloc_aligned,n,align);
#endif
#else
// ------------------------------------------------------
// With a C compiler we override the new/delete operators
// by defining the mangled C++ names of the operators (as
// used by GCC and CLang).
// See <https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling>
// ------------------------------------------------------
void _ZdlPv(void* p) MI_FORWARD0(mi_free,p); // delete
void _ZdaPv(void* p) MI_FORWARD0(mi_free,p); // delete[]
#if (MI_INTPTR_SIZE==8)
void* _Znwm(uint64_t n) MI_FORWARD1(mi_malloc,n); // new 64-bit
void* _Znam(uint64_t n) MI_FORWARD1(mi_malloc,n); // new[] 64-bit
void* _Znwmm(uint64_t n, uint64_t align) { return mi_malloc_aligned(n,align); } // aligned new 64-bit
void* _Znamm(uint64_t n, uint64_t align) { return mi_malloc_aligned(n,align); } // aligned new[] 64-bit
#elif (MI_INTPTR_SIZE==4)
void* _Znwj(uint32_t n) MI_FORWARD1(mi_malloc,n); // new 32-bit
void* _Znaj(uint32_t n) MI_FORWARD1(mi_malloc,n); // new[] 32-bit
void* _Znwjj(uint32_t n, uint32_t align) { return mi_malloc_aligned(n,align); } // aligned new 32-bit
void* _Znajj(uint32_t n, uint32_t align) { return mi_malloc_aligned(n,align); } // aligned new[] 32-bit
#else
#error "define overloads for new/delete for this platform (just for performance, can be skipped)"
#endif
#endif // __cplusplus
#ifdef __cplusplus
extern "C" {
#endif
// ------------------------------------------------------
// Posix & Unix functions definitions
// ------------------------------------------------------
#include <errno.h>
#ifndef EINVAL
#define EINVAL 22
#endif
#ifndef ENOMEM
#define ENOMEM 12
#endif
void* reallocf(void* p, size_t newsize) MI_FORWARD2(mi_reallocf,p,newsize);
size_t malloc_size(void* p) MI_FORWARD1(mi_usable_size,p);
size_t malloc_usable_size(void *p) MI_FORWARD1(mi_usable_size,p);
void cfree(void* p) MI_FORWARD0(mi_free, p);
int posix_memalign(void** p, size_t alignment, size_t size) {
// TODO: the spec says we should return EINVAL also if alignment is not a power of 2.
// The spec also dictates we should not modify `*p` on an error. (issue#27)
// <http://man7.org/linux/man-pages/man3/posix_memalign.3.html>
if (alignment % sizeof(void*) != 0) return EINVAL; // no `p==NULL` check as it is declared as non-null
void* q = mi_malloc_aligned(size, alignment);
if (q==NULL && size != 0) return ENOMEM;
*p = q;
return 0;
}
void* memalign(size_t alignment, size_t size) {
return mi_malloc_aligned(size, alignment);
}
void* valloc(size_t size) {
return mi_malloc_aligned(size, _mi_os_page_size());
}
void* pvalloc(size_t size) {
size_t psize = _mi_os_page_size();
if (size >= SIZE_MAX - psize) return NULL; // overflow
size_t asize = ((size + psize - 1) / psize) * psize;
return mi_malloc_aligned(asize, psize);
}
void* aligned_alloc(size_t alignment, size_t size) {
return mi_malloc_aligned(size, alignment);
}
void* reallocarray( void* p, size_t count, size_t size ) { // BSD
void* newp = mi_reallocn(p,count,size);
if (newp==NULL) errno = ENOMEM;
return newp;
}
#if defined(__GLIBC__) && defined(__linux__)
// forward __libc interface (needed for glibc-based Linux distributions)
void* __libc_malloc(size_t size) MI_FORWARD1(mi_malloc,size);
void* __libc_calloc(size_t count, size_t size) MI_FORWARD2(mi_calloc,count,size);
void* __libc_realloc(void* p, size_t size) MI_FORWARD2(mi_realloc,p,size);
void __libc_free(void* p) MI_FORWARD0(mi_free,p);
void __libc_cfree(void* p) MI_FORWARD0(mi_free,p);
void* __libc_memalign(size_t alignment, size_t size) {
return memalign(alignment,size);
}
void* __libc_valloc(size_t size) {
return valloc(size);
}
void* __libc_pvalloc(size_t size) {
return pvalloc(size);
}
int __posix_memalign(void** p, size_t alignment, size_t size) {
return posix_memalign(p,alignment,size);
}
#endif
#ifdef __cplusplus
}
#endif
#if (defined(__GNUC__) || defined(__clang__)) && !defined(__MACH__)
#pragma GCC visibility pop
#endif
#endif // MI_MALLOC_OVERRIDE & !_WIN32
| 41.239024 | 120 | 0.632955 |
e78ccdb060e78ba4aa8d22afd254b6cb9b6bbc8b | 710 | h | C | include/Area.h | rdelfin/proceduralcities | b5e3b01ab9b21cc4476526a1902374ed159c1da6 | [
"Apache-2.0"
] | 1 | 2021-12-30T07:39:51.000Z | 2021-12-30T07:39:51.000Z | include/Area.h | rdelfin/proceduralcities | b5e3b01ab9b21cc4476526a1902374ed159c1da6 | [
"Apache-2.0"
] | null | null | null | include/Area.h | rdelfin/proceduralcities | b5e3b01ab9b21cc4476526a1902374ed159c1da6 | [
"Apache-2.0"
] | null | null | null | #ifndef PROCEDURALCITIES_AREA_H
#define PROCEDURALCITIES_AREA_H
#include <string>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <fstream>
#include <GL/glew.h>
#include <glm/glm.hpp>
using namespace std;
class Area {
public:
Area();
vector<glm::vec4> waterVertices;
vector<glm::vec4> waterNormals;
vector<glm::uvec3> waterFaces;
vector<glm::vec4> parksVertices;
vector<glm::vec4> parksNormals;
vector<glm::uvec3> parksFaces;
vector<glm::vec2> populationCenters;
map<float, set<float>> waterPoints;
map<float, set<float>> parksPoints;
};
#endif // PROCEDURALCITIES_AREA_H | 21.515152 | 44 | 0.652113 |
a103b6b8197c66a5447946d11c27c45400302c5b | 2,077 | h | C | src/util.h | Bhaskers-Blu-Org2/distributed_word_embedding | 3fc473d05ab8dd35556685b53319e7e0ed78679b | [
"MIT"
] | 148 | 2015-11-10T04:57:02.000Z | 2019-04-21T12:10:07.000Z | src/util.h | Bhaskers-Blu-Org2/distributed_word_embedding | 3fc473d05ab8dd35556685b53319e7e0ed78679b | [
"MIT"
] | 4 | 2016-05-26T05:05:30.000Z | 2016-10-26T05:03:33.000Z | src/util.h | Microsoft/distributed_word_embedding | 3fc473d05ab8dd35556685b53319e7e0ed78679b | [
"MIT"
] | 56 | 2015-11-10T07:25:42.000Z | 2018-08-04T18:55:09.000Z | #pragma once
/*!
* file util.h
* \brief Struct Option stores many general arguments in model
*/
#include <cstring>
#include <cstdlib>
#include <random>
#include <cassert>
#include <exception>
#include "constant.h"
#include "dictionary.h"
namespace multiverso
{
namespace wordembedding
{
struct Option
{
const char* train_file;
const char* read_vocab_file;
const char* output_file;
const char* sw_file;
const char* endpoints_file;
bool hs, output_binary, cbow, stopwords;
bool use_adagrad;
bool is_pipeline;
real sample;
int64 data_block_size;
int embeding_size, thread_cnt, window_size, negative_num, min_count, epoch;
int64 total_words;
int64 max_preload_data_size;
real init_learning_rate;
int num_servers, num_aggregator, lock_option, num_lock, max_delay;
Option();
/*!
* \brief Get the model-set arguments from file
*/
void ParseArgs(int argc, char* argv[]);
void PrintArgs();
void PrintUsage();
};
class Sampler
{
public:
Sampler();
/*!
* \brief Set the negative-sampling distribution for every vocabulary
* \param dictionary the train_file dictionary
*/
void SetNegativeSamplingDistribution(Dictionary *dictionary);
bool WordSampling(int64 word_cnt, int64 train_words, real sample);
/*!
* \brief Get the next random according to the existing random seed
*/
uint64 GetNextRandom(uint64 next_random);
int NegativeSampling(uint64 next_random);
private:
int* table_;
//No copying allowed
Sampler(const Sampler&);
void operator=(const Sampler&);
};
std::string GetSystemTime();
extern std::string g_log_suffix;
}
} | 26.974026 | 88 | 0.568127 |
bdfecfb72990a819e28380740ce2042ede254d1f | 685 | h | C | moreCUDA/LatticeBoltzmannmethod/LatticeBoltzmann2D_gfx/commonlib/checkerror.h | ernestyalumni/CompPhys | 1f5d7559146a14a21182653b77fd35e6d6829855 | [
"Apache-2.0"
] | 70 | 2017-07-24T04:09:27.000Z | 2021-12-24T16:00:41.000Z | moreCUDA/LatticeBoltzmannmethod/LatticeBoltzmann2D/commonlib/checkerror.h | ernestyalumni/CompPhys | 1f5d7559146a14a21182653b77fd35e6d6829855 | [
"Apache-2.0"
] | 3 | 2018-01-16T22:34:47.000Z | 2019-01-29T22:37:10.000Z | moreCUDA/LatticeBoltzmannmethod/LatticeBoltzmann2D/commonlib/checkerror.h | ernestyalumni/CompPhys | 1f5d7559146a14a21182653b77fd35e6d6829855 | [
"Apache-2.0"
] | 40 | 2017-01-24T19:18:42.000Z | 2021-03-01T07:13:35.000Z | /*
* checkerror.h
*
* EXAMPLE of USAGE:
* checkCudaErrors( CUDA commandyouwanttocheckerrorsfor ) ;
*
* */
#ifndef __ERRORS_H__
#define __ERRORS_H__
#include <iostream> // std::cerr, std::endl;
#include <cuda.h>
#include <cuda_runtime.h> // cudaSuccess
#include <cuda_runtime_api.h>
#define checkCudaErrors(val) checkerror( (val), #val, __FILE__, __LINE__ )
template<typename T>
void checkerror(T err, const char* const func, const char* const file, const int line) {
if (err != cudaSuccess) {
std::cerr << "CUDA error at: " << file << " : " << line << std::endl;
std::cerr << cudaGetErrorString(err) << " " << func << std::endl;
exit(1);
}
}
#endif // __ERRORS_H__
| 24.464286 | 88 | 0.664234 |
0c10c2496443d3bb2dead6755c31df67b140e99d | 4,215 | c | C | tests/lib/libc/gen/t_ttyname.c | calmsacibis995/minix | dfba95598f553b6560131d35a76658f1f8c9cf38 | [
"Unlicense"
] | 4 | 2016-08-22T22:02:55.000Z | 2017-03-04T22:56:44.000Z | tests/lib/libc/gen/t_ttyname.c | calmsacibis995/minix | dfba95598f553b6560131d35a76658f1f8c9cf38 | [
"Unlicense"
] | 21 | 2016-08-11T09:43:43.000Z | 2017-01-29T12:52:56.000Z | tests/lib/libc/gen/t_ttyname.c | calmsacibis995/minix | dfba95598f553b6560131d35a76658f1f8c9cf38 | [
"Unlicense"
] | null | null | null | /* $NetBSD: t_ttyname.c,v 1.3 2011/05/01 18:14:01 jruoho Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jukka Ruohonen.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: t_ttyname.c,v 1.3 2011/05/01 18:14:01 jruoho Exp $");
#include <atf-c.h>
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
static long ttymax = 0;
ATF_TC(ttyname_err);
ATF_TC_HEAD(ttyname_err, tc)
{
atf_tc_set_md_var(tc, "descr", "Test errors in ttyname(3)");
}
ATF_TC_BODY(ttyname_err, tc)
{
int fd;
fd = open("XXX", O_RDONLY);
if (fd < 0) {
errno = 0;
ATF_REQUIRE(isatty(fd) != -1);
ATF_REQUIRE(errno == EBADF);
errno = 0;
ATF_REQUIRE(ttyname(fd) == NULL);
ATF_REQUIRE(errno == EBADF);
}
fd = open("/etc/passwd", O_RDONLY);
if (fd >= 0) {
errno = 0;
ATF_REQUIRE(isatty(fd) != -1);
ATF_REQUIRE(errno == ENOTTY);
errno = 0;
ATF_REQUIRE(ttyname(fd) == NULL);
ATF_REQUIRE(errno == ENOTTY);
}
}
ATF_TC(ttyname_r_err);
ATF_TC_HEAD(ttyname_r_err, tc)
{
atf_tc_set_md_var(tc, "descr", "Test errors in ttyname_r(3)");
}
ATF_TC_BODY(ttyname_r_err, tc)
{
char sbuf[0];
char *buf;
int fd;
int rv;
buf = malloc(ttymax + 1);
if (buf == NULL)
return;
(void)memset(buf, '\0', ttymax + 1);
if (isatty(STDIN_FILENO) != 0) {
rv = ttyname_r(STDIN_FILENO, sbuf, sizeof(sbuf));
ATF_REQUIRE(rv == ERANGE);
}
rv = ttyname_r(-1, buf, ttymax);
ATF_REQUIRE(rv == EBADF);
fd = open("/etc/passwd", O_RDONLY);
if (fd >= 0) {
rv = ttyname_r(fd, buf, ttymax);
ATF_REQUIRE(rv == ENOTTY);
ATF_REQUIRE(close(fd) == 0);
}
free(buf);
}
ATF_TC(ttyname_r_stdin);
ATF_TC_HEAD(ttyname_r_stdin, tc)
{
atf_tc_set_md_var(tc, "descr", "Test ttyname_r(3) with stdin(3)");
}
ATF_TC_BODY(ttyname_r_stdin, tc)
{
const char *str;
char *buf;
int rv;
if (isatty(STDIN_FILENO) == 0)
return;
buf = malloc(ttymax + 1);
if (buf == NULL)
return;
(void)memset(buf, '\0', ttymax + 1);
str = ttyname(STDIN_FILENO);
rv = ttyname_r(STDIN_FILENO, buf, ttymax);
ATF_REQUIRE(rv == 0);
ATF_REQUIRE(str != NULL);
if (strcmp(str, buf) != 0)
atf_tc_fail("ttyname(3) and ttyname_r(3) conflict");
free(buf);
}
ATF_TC(ttyname_stdin);
ATF_TC_HEAD(ttyname_stdin, tc)
{
atf_tc_set_md_var(tc, "descr", "Test ttyname(3) with stdin(3)");
}
ATF_TC_BODY(ttyname_stdin, tc)
{
if (isatty(STDIN_FILENO) != 0)
ATF_REQUIRE(ttyname(STDIN_FILENO) != NULL);
(void)close(STDIN_FILENO);
ATF_REQUIRE(isatty(STDIN_FILENO) != 1);
ATF_REQUIRE(ttyname(STDIN_FILENO) == NULL);
}
ATF_TP_ADD_TCS(tp)
{
ttymax = sysconf(_SC_TTY_NAME_MAX);
ATF_REQUIRE(ttymax >= 0);
ATF_TP_ADD_TC(tp, ttyname_err);
ATF_TP_ADD_TC(tp, ttyname_r_err);
ATF_TP_ADD_TC(tp, ttyname_r_stdin);
ATF_TP_ADD_TC(tp, ttyname_stdin);
return atf_no_error();
}
| 22.301587 | 78 | 0.696797 |
b7f37cd6fdbefc37aff8c0772474397de0c328fa | 1,546 | h | C | FaceIdentification/include/viplnet.h | Sayesailor/SeetaFaceEngine-pro | 14d583ab0c12f5f7c3e27d01db5ae973b87d76b6 | [
"BSD-2-Clause"
] | null | null | null | FaceIdentification/include/viplnet.h | Sayesailor/SeetaFaceEngine-pro | 14d583ab0c12f5f7c3e27d01db5ae973b87d76b6 | [
"BSD-2-Clause"
] | null | null | null | FaceIdentification/include/viplnet.h | Sayesailor/SeetaFaceEngine-pro | 14d583ab0c12f5f7c3e27d01db5ae973b87d76b6 | [
"BSD-2-Clause"
] | null | null | null | /*
*
* This file is part of the open-source SeetaFace engine, which includes three
*modules:
* SeetaFace Detection, SeetaFace Alignment, and SeetaFace Identification.
*
* This file is part of the SeetaFace Identification module, containing codes
*implementing the
* face identification method described in the following paper:
*
*
* VIPLFaceNet: An Open Source Deep Face Recognition SDK,
* Xin Liu, Meina Kan, Wanglong Wu, Shiguang Shan, Xilin Chen.
* In Frontiers of Computer Science.
*
*
* Copyright (C) 2016, Visual Information Processing and Learning (VIPL) group,
* Institute of Computing Technology, Chinese Academy of Sciences, Beijing,
*China.
*
* The codes are mainly developed by Shiying Luo(a M.S. supervised by Prof.
*Shiguang Shan)
*
* As an open-source face recognition engine: you can redistribute SeetaFace
*source codes
* and/or modify it under the terms of the BSD 2-Clause License.
*
* You should have received a copy of the BSD 2-Clause License along with the
*software.
* If not, see < https://opensource.org/licenses/BSD-2-Clause>.
*
* Contact Info: you can send an email to SeetaFace@vipl.ict.ac.cn for any
*problems.
*
* Note: the above information must be kept whenever or wherever the codes are
*used.
*
*/
#ifndef VIPLNET_H_
#define VIPLNET_H_
#if defined(__unix__) || defined(__APPLE__)
#ifndef fopen_s
#define fopen_s(pFile, filename, mode) \
((*(pFile)) = fopen((filename), (mode))) == NULL
#endif // fopen_s
#endif //__unix__, __APPLE__
#endif // VIPLNET_H_
| 28.109091 | 79 | 0.725097 |
2314c45d314c20ae63d730bf8bac4de24bf36746 | 282 | h | C | FlowerFire/商城/Page/Mine/Second/VC/SettingViewController.h | CoderWeiLee/FlowerFire | 7109cc2f2b41f4c92617e7d6b8af2b6c57bc8a62 | [
"MIT"
] | 1 | 2021-01-16T15:15:18.000Z | 2021-01-16T15:15:18.000Z | FlowerFire/商城/Page/Mine/Second/VC/SettingViewController.h | CoderWeiLee/FlowerFire | 7109cc2f2b41f4c92617e7d6b8af2b6c57bc8a62 | [
"MIT"
] | null | null | null | FlowerFire/商城/Page/Mine/Second/VC/SettingViewController.h | CoderWeiLee/FlowerFire | 7109cc2f2b41f4c92617e7d6b8af2b6c57bc8a62 | [
"MIT"
] | null | null | null | //
// SettingViewController.h
// 531Mall
//
// Created by 王涛 on 2020/5/22.
// Copyright © 2020 Celery. All rights reserved.
//
#import "BaseTableViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface SettingViewController : BaseTableViewController
@end
NS_ASSUME_NONNULL_END
| 15.666667 | 58 | 0.762411 |
269c98381d64a4884f4a5b5a4c0a12e3ea5bb9ce | 708 | h | C | YKMediaPlayerKit/YKMainVideo.h | evandcoleman/YKMediaPlayerKit | 93266ed23c04c6a103a4f91db877d15695f088cd | [
"MIT"
] | null | null | null | YKMediaPlayerKit/YKMainVideo.h | evandcoleman/YKMediaPlayerKit | 93266ed23c04c6a103a4f91db877d15695f088cd | [
"MIT"
] | null | null | null | YKMediaPlayerKit/YKMainVideo.h | evandcoleman/YKMediaPlayerKit | 93266ed23c04c6a103a4f91db877d15695f088cd | [
"MIT"
] | 2 | 2017-04-24T20:07:03.000Z | 2019-03-04T16:58:15.000Z | //
// YKMainVideo.h
// Pods
//
// Created by Damien Legrand on 05/01/2016.
//
//
#import <Foundation/Foundation.h>
#import "YKVideo.h"
#import "YKAVPlayerViewController.h"
@interface YKMainVideo : NSObject <YKVideo>
@property (nonatomic, strong) NSURL *contentURL;
@property (nonatomic, strong) YKAVPlayerViewController *videoPlayer;
@property (nonatomic) YKQualityOptions currentQuality;
- (void)buildPlayerWithQuality:(YKQualityOptions)quality;
- (void)presentController:(UIViewController *)controller completion:(void (^)(void))completion;
- (void)presentController:(UIViewController *)controller sourceController:(UIViewController *)sourceController completion:(void (^)(void))completion;
@end
| 27.230769 | 149 | 0.774011 |
5309e647806060ca1921fb5fbd9f57212e149598 | 493 | h | C | Shelf/ROKOMobi.framework/Headers/ROKOInviteHeadlineScheme.h | vikingdr/ShelfCosmetics | 54dde67360d4fc461b12eafe72b7a1719b67749e | [
"Apache-2.0"
] | null | null | null | Shelf/ROKOMobi.framework/Headers/ROKOInviteHeadlineScheme.h | vikingdr/ShelfCosmetics | 54dde67360d4fc461b12eafe72b7a1719b67749e | [
"Apache-2.0"
] | null | null | null | Shelf/ROKOMobi.framework/Headers/ROKOInviteHeadlineScheme.h | vikingdr/ShelfCosmetics | 54dde67360d4fc461b12eafe72b7a1719b67749e | [
"Apache-2.0"
] | 1 | 2019-09-19T21:01:43.000Z | 2019-09-19T21:01:43.000Z | //
// ROKOInviteHeadlineScheme.h
// ROKOMobi
//
// Created by Alexey Golovenkov on 12.02.16.
// Copyright © 2016 ROKO Labs. All rights reserved.
//
#import "ROKOComponentScheme.h"
#import "ROKOFontDataObject.h"
/**
* UI scheme for headline of Invite Friends view
*/
@interface ROKOInviteHeadlineScheme : ROKOComponentScheme
/**
* Headline text
*/
@property (nonatomic, copy) NSString *text;
/**
* Headline font
*/
@property (nonatomic, strong) ROKOFontDataObject *font;
@end
| 17.607143 | 57 | 0.709939 |
9b9bb82c062c20d372a72153272079d63ed63dca | 1,308 | h | C | dev/Code/Sandbox/Plugins/TelemetryPlugin/resource.h | jeikabu/lumberyard | 07228c605ce16cbf5aaa209a94a3cb9d6c1a4115 | [
"AML"
] | 1,738 | 2017-09-21T10:59:12.000Z | 2022-03-31T21:05:46.000Z | dev/Code/Sandbox/Plugins/TelemetryPlugin/resource.h | jeikabu/lumberyard | 07228c605ce16cbf5aaa209a94a3cb9d6c1a4115 | [
"AML"
] | 427 | 2017-09-29T22:54:36.000Z | 2022-02-15T19:26:50.000Z | dev/Code/Sandbox/Plugins/TelemetryPlugin/resource.h | jeikabu/lumberyard | 07228c605ce16cbf5aaa209a94a3cb9d6c1a4115 | [
"AML"
] | 671 | 2017-09-21T08:04:01.000Z | 2022-03-29T14:30:07.000Z | /*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
#define IDD_TELEMETRY_DIALOG 2000
#define IDC_EDIT_PIPE_NAME 2000
#define IDD_PANEL_CONNECTION 2000
#define IDC_CONNECT 2001
#define IDC_BUTTON2 2002
#define IDC_OPEN 2002
#define IDC_MARKERS_RB 2003
#define IDC_DENSITY_RB 2004
#define IDC_DISPLAY_MODE 2007
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 2002
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 2009
#define _APS_NEXT_SYMED_VALUE 2000
#endif
#endif
| 38.470588 | 85 | 0.692661 |
af742500d0b71e0e8cf5af7783c1eb35a8ec6736 | 651 | c | C | p3_zomb.c | gleason9113/xv6 | c28dc3b039b354ea2b862cf4016565a006558a12 | [
"MIT-0"
] | null | null | null | p3_zomb.c | gleason9113/xv6 | c28dc3b039b354ea2b862cf4016565a006558a12 | [
"MIT-0"
] | null | null | null | p3_zomb.c | gleason9113/xv6 | c28dc3b039b354ea2b862cf4016565a006558a12 | [
"MIT-0"
] | null | null | null | #ifdef CS333_P3
#include "types.h"
#include "user.h"
//Test ZOMBIE list
//Process will fork.
//Parent will wait 30secs
//Child will exit immediately.
//Use ctrl-z to examine ZOMBIE list.
int
main(void)
{
printf(1, "This process will pause briefly. Press ctrl-p and ctrl-z now.\n");
sleep(6 * TPS);
printf(1, "This process will now fork. Child will exit. Parent will sleep. Press ctrl-z now.\n");
int pid;
pid = fork();
if(pid < 0){
printf(2, "Error when forking!\n");
exit();
}
if(pid == 0){
exit();
}
if(pid > 0){
sleep(30 * TPS);
}
printf(1, "All processes exiting! \n");
exit();
}
#endif //CS333_P3
| 18.083333 | 99 | 0.617512 |
15f256723d6bb8311fdf315762c472728b6ce7e3 | 6,596 | h | C | src/databases/SimV2/vtkArrayComponent.h | visit-dav/vis | c08bc6e538ecd7d30ddc6399ec3022b9e062127e | [
"BSD-3-Clause"
] | 226 | 2018-12-29T01:13:49.000Z | 2022-03-30T19:16:31.000Z | src/databases/SimV2/vtkArrayComponent.h | visit-dav/vis | c08bc6e538ecd7d30ddc6399ec3022b9e062127e | [
"BSD-3-Clause"
] | 5,100 | 2019-01-14T18:19:25.000Z | 2022-03-31T23:08:36.000Z | src/databases/SimV2/vtkArrayComponent.h | visit-dav/vis | c08bc6e538ecd7d30ddc6399ec3022b9e062127e | [
"BSD-3-Clause"
] | 84 | 2019-01-24T17:41:50.000Z | 2022-03-10T10:01:46.000Z | // Copyright (c) Lawrence Livermore National Security, LLC and other VisIt
// Project developers. See the top-level LICENSE file for dates and other
// details. No copyright assignment is required to contribute to VisIt.
#ifndef VTK_ARRAY_COMPONENT_H
#define VTK_ARRAY_COMPONENT_H
// ****************************************************************************
// Class: vtkArrayComponentStride
//
// Purpose:
// This array component object lets us iterate over blocks of memory using
// a stride and then we apply an offset to access parts within the block.
// This lets us access AOS data as though it was contiguous.
//
// Notes: For zero-copy access of SOA data. It can be used for AOS data too.
//
// Programmer: Brad Whitlock
// Creation: Fri Jun 19 11:52:42 PDT 2015
//
// Modifications:
//
// ****************************************************************************
class vtkArrayComponentStride
{
public:
vtkArrayComponentStride()
{
this->start = NULL;
this->offset = 0;
this->stride = 0;
this->type = 0;
this->owns = false;
}
vtkArrayComponentStride(void *start, size_t offset, size_t stride, int type, bool owns)
{
this->start = (unsigned char *)start;
this->offset = offset;
this->stride = stride;
this->type = type;
this->owns = owns;
}
~vtkArrayComponentStride()
{
}
void Delete()
{
if(this->owns && this->start != NULL)
{
free(start);
start = NULL;
}
}
template <typename DestinationType>
void GetValue(vtkIdType id, DestinationType &out) const
{
if(this->start != NULL)
{
unsigned char *addr = this->start + this->offset + id * this->stride;
switch(this->type)
{
vtkTemplateMacro(
VTK_TT *ptr = reinterpret_cast<VTK_TT *>(addr);
out = static_cast<DestinationType>(*ptr);
);
}
}
else
{
out = DestinationType();
}
}
protected:
// Memory traversal attributes.
unsigned char *start;
size_t offset;
size_t stride;
int type;
bool owns;
};
////////////////////////////////////////////////////////////////////////////////
// ****************************************************************************
// Class: vtkArrayComponentIJKSlice
//
// Purpose:
// This array component object lets us select an IJK volume of interest in a
// larger IJK block of memory. We can access the subvolume using normal
// vtkDataArray indexing and we handle the id translation here so we index
// into the original volume appropriately.
//
// Notes: For zero-copy access of subvolumes of structured data.
//
// Programmer: Brad Whitlock
// Creation: Fri Jun 19 11:52:42 PDT 2015
//
// Modifications:
//
// ****************************************************************************
class vtkArrayComponentIJKSlice
{
public:
vtkArrayComponentIJKSlice()
{
this->start = NULL;
this->offset = 0;
this->stride = 0;
this->type = 0;
for(int i = 0; i < 3; ++i)
{
this->whole_start_index[i] = 0;
this->whole_end_index[i] = 0;
this->slice_start_index[i] = 0;
this->slice_end_index[i] = 0;
this->slice_size[i] = 0;
this->whole_size[i] = 0;
}
this->sliceNXNY = 0;
this->wholeNXNY = 0;
}
vtkArrayComponentIJKSlice(void *start, size_t offset, size_t stride, int type,
const int whole_start_index[3], const int whole_end_index[3],
const int slice_start_index[3], const int slice_end_index[3])
{
this->start = (unsigned char *)start;
this->offset = offset;
this->stride = stride;
this->type = type;
for(int i = 0; i < 3; ++i)
{
this->whole_start_index[i] = whole_start_index[i];
this->whole_end_index[i] = whole_end_index[i];
this->slice_start_index[i] = slice_start_index[i];
this->slice_end_index[i] = slice_end_index[i];
this->slice_size[i] = slice_end_index[i] - slice_start_index[i] + 1;
this->whole_size[i] = whole_end_index[i] - whole_start_index[i] + 1;
}
this->sliceNXNY = slice_size[0] * slice_size[1];
this->wholeNXNY = whole_size[0] * whole_size[1];
}
void Delete()
{
}
template <typename DestinationType>
void GetValue(vtkIdType id, DestinationType &out) const
{
// id is the index in the smaller sliced volume. Figure out where that
// exists in the larger volume.
vtkIdType slice_K = id / this->sliceNXNY;
vtkIdType idInIJPlane = id % this->sliceNXNY;
vtkIdType slice_J = idInIJPlane / this->slice_size[0];
vtkIdType slice_I = idInIJPlane % this->slice_size[0];
vtkIdType whole_I = slice_I + this->slice_start_index[0] - this->whole_start_index[0];
vtkIdType whole_J = slice_J + this->slice_start_index[1] - this->whole_start_index[1];
vtkIdType whole_K = slice_K + this->slice_start_index[2] - this->whole_start_index[2];
vtkIdType wholeId = whole_K * this->wholeNXNY +
whole_J * whole_size[0] +
whole_I;
#if 0
cout << "GetValue: id=" << id
<< ", sliceIJK={" << slice_I << ", " << slice_J << ", " << slice_K
<< "}, wholeIJK={" << whole_I << ", " << whole_J << ", " << whole_K
<< "}, wholeId=" << wholeId << endl;
#endif
unsigned char *addr = this->start + this->offset + wholeId * this->stride;
switch(this->type)
{
vtkTemplateMacro(
VTK_TT *ptr = reinterpret_cast<VTK_TT *>(addr);
out = static_cast<DestinationType>(*ptr);
);
}
}
bool GetPrint() const { return false; }
private:
// Memory traversal attributes.
unsigned char *start;
size_t offset;
size_t stride;
int type;
// The IJK extents of the whole data array.
int whole_start_index[3];
int whole_end_index[3];
// The IJK extents of the volume of interest.
int slice_start_index[3];
int slice_end_index[3];
// Derived data
vtkIdType slice_size[3];
vtkIdType whole_size[3];
vtkIdType sliceNXNY;
vtkIdType wholeNXNY;
};
#endif
| 30.967136 | 94 | 0.545331 |
7681a2aa0a1bbaf10283ab7e4fbf316146606786 | 190 | h | C | motor_completed/include/serial.h | HuangCongQing/curriculum-design | 74d9b8c62494a81236794d00e36c580963cc8da6 | [
"MIT"
] | 3 | 2019-04-06T08:47:45.000Z | 2022-01-28T15:03:43.000Z | motor_completed/include/serial.h | HuangCongQing/curriculum-design | 74d9b8c62494a81236794d00e36c580963cc8da6 | [
"MIT"
] | null | null | null | motor_completed/include/serial.h | HuangCongQing/curriculum-design | 74d9b8c62494a81236794d00e36c580963cc8da6 | [
"MIT"
] | 2 | 2020-06-07T02:08:40.000Z | 2020-08-08T02:51:27.000Z |
#ifndef _SERIAL_H_
#define _SERIAL_H_
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <termios.h>
#include <unistd.h>
int send(char *m);
#endif | 14.615385 | 22 | 0.710526 |
761005828ba661058314234f4cbb03b281f76a61 | 585 | h | C | include/mpe/pose_estimation/marker_pose.h | thhuang/MarkerPoseEstimation | b7d362abd2b44c2e5917ec08b0b94cc5dbf43e6d | [
"MIT"
] | 3 | 2019-11-08T01:40:10.000Z | 2022-01-12T08:27:51.000Z | include/mpe/pose_estimation/marker_pose.h | thhuang/marker-pose-estimation | b7d362abd2b44c2e5917ec08b0b94cc5dbf43e6d | [
"MIT"
] | null | null | null | include/mpe/pose_estimation/marker_pose.h | thhuang/marker-pose-estimation | b7d362abd2b44c2e5917ec08b0b94cc5dbf43e6d | [
"MIT"
] | 1 | 2019-12-20T08:30:31.000Z | 2019-12-20T08:30:31.000Z | #ifndef MPE_POSE_ESTIMATION_MARKER_POSE_H
#define MPE_POSE_ESTIMATION_MARKER_POSE_H
#include <string>
#include <opencv2/core/types.hpp>
#include <Eigen/Geometry>
namespace mpe {
struct MarkerPose {
double x;
double y;
double z;
double qw;
double qx;
double qy;
double qz;
std::string text;
MarkerPose() = default;
MarkerPose(cv::Vec3d t, Eigen::Quaterniond q, std::string text)
: x{t[0]}, y{t[1]}, z{t[2]},
qw{q.w()}, qx{q.vec()[0]}, qy{q.vec()[1]}, qz{q.vec()[2]},
text{text} {}
};
} // namespace mpe
#endif // MPE_POSE_ESTIMATION_MARKER_POSE_H | 20.892857 | 65 | 0.663248 |
6f27e5803e17f28217f1c304fb06ef9d70d54ba9 | 77 | h | C | config.h | oelrich/crkbd-atnrb | ce44b1f7c402a6567c287e1fcf5422d983a44934 | [
"Unlicense"
] | null | null | null | config.h | oelrich/crkbd-atnrb | ce44b1f7c402a6567c287e1fcf5422d983a44934 | [
"Unlicense"
] | null | null | null | config.h | oelrich/crkbd-atnrb | ce44b1f7c402a6567c287e1fcf5422d983a44934 | [
"Unlicense"
] | null | null | null | #pragma once
#include "config_common.h"
#define USE_SERIAL
#define EE_HANDS
| 12.833333 | 26 | 0.792208 |
a06759d2a78adacd07465b4259625900f8f27873 | 4,344 | h | C | Library/Source/Nano/Graphics/NVector.h | refnum/Nano | dceb0907061f7845d8a3c662f309ca164e932e6f | [
"BSD-3-Clause"
] | 23 | 2019-11-12T09:31:11.000Z | 2021-09-13T08:59:37.000Z | Library/Source/Nano/Graphics/NVector.h | refnum/nano | dceb0907061f7845d8a3c662f309ca164e932e6f | [
"BSD-3-Clause"
] | 1 | 2020-10-30T09:54:12.000Z | 2020-10-30T09:54:12.000Z | Library/Source/Nano/Graphics/NVector.h | refnum/Nano | dceb0907061f7845d8a3c662f309ca164e932e6f | [
"BSD-3-Clause"
] | 3 | 2015-09-08T11:00:02.000Z | 2017-09-11T05:42:30.000Z | /* NAME:
NVector.h
DESCRIPTION:
Vector object.
COPYRIGHT:
Copyright (c) 2006-2021, refNum Software
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
___________________________________________________________________________
*/
#ifndef NVECTOR_H
#define NVECTOR_H
//=============================================================================
// Includes
//-----------------------------------------------------------------------------
#include "NMixinComparable.h"
#include "NanoMacros.h"
#include "NanoTypes.h"
//=============================================================================
// Class Declaration
//-----------------------------------------------------------------------------
class NN_EMPTY_BASE NVector final : public NMixinComparable<NVector>
{
public:
constexpr NVector(float64_t x, float64_t y);
constexpr NVector();
// Clear the vector
constexpr void Clear();
// Is the vector zero?
constexpr bool IsZero() const;
// Is the vector normalized?
bool IsNormalized() const;
// Get the length
float64_t GetLength() const;
constexpr float64_t GetLength2() const;
// Get the dot product
constexpr float64_t GetDot(const NVector& theVector) const;
// Get the cross product
constexpr float64_t GetCross(const NVector& theVector) const;
// Get the angle to another vector
NDegrees GetAngle(const NVector& theVector) const;
// Get a normalized vector
NVector GetNormalized() const;
void Normalize();
// Get a negated vector
constexpr NVector GetNegated() const;
constexpr void Negate();
// Get a scaled vector
constexpr NVector GetScaled(float64_t scaleBy) const;
constexpr void Scale( float64_t scaleBy);
// Operators
constexpr NVector operator+(const NVector& theVector) const;
constexpr NVector operator-(const NVector& theVector) const;
constexpr const NVector& operator+=(const NVector& theVector);
constexpr const NVector& operator-=(const NVector& theVector);
public:
// NMixinComparable
constexpr bool CompareEqual(const NVector& theVector) const;
constexpr NComparison CompareOrder(const NVector& theVector) const;
public:
float64_t x;
float64_t y;
};
//=============================================================================
// Includes
//-----------------------------------------------------------------------------
#include "NVector.inl"
#endif // NVECTOR_H
| 31.708029 | 82 | 0.593692 |
ae3707b5c0330b96234dcff1ab4949f8e821dd15 | 1,501 | c | C | source/WormholeDrivers/PHYMEM/PhyMem/driver/AccessBus.c | IMULMUL/Misc | e15669d8397597cf37c5ddc3fa3ce86a9b990432 | [
"MIT"
] | 31 | 2018-12-03T12:32:37.000Z | 2022-03-28T13:31:26.000Z | source/WormholeDrivers/PHYMEM/PhyMem/driver/AccessBus.c | IMULMUL/Misc | e15669d8397597cf37c5ddc3fa3ce86a9b990432 | [
"MIT"
] | null | null | null | source/WormholeDrivers/PHYMEM/PhyMem/driver/AccessBus.c | IMULMUL/Misc | e15669d8397597cf37c5ddc3fa3ce86a9b990432 | [
"MIT"
] | 15 | 2018-12-03T12:32:42.000Z | 2021-05-30T07:34:40.000Z | /*++
access pci bus configuration
--*/
#include <ntddk.h>
#include <wdmguid.h>
#include "DebugPrint.h"
//gets the bus interface standard information from the PDO.
NTSTATUS GetBusInterface(IN PDEVICE_OBJECT pcifido,
OUT PPCI_BUS_INTERFACE_STANDARD busInterface)
{
KEVENT event;
NTSTATUS ntStatus;
PIRP irp;
IO_STATUS_BLOCK ioStatus;
PIO_STACK_LOCATION irpStack;
if (pcifido==NULL)
return STATUS_UNSUCCESSFUL;
KeInitializeEvent(&event, NotificationEvent, FALSE);
irp=IoBuildSynchronousFsdRequest(IRP_MJ_PNP,
pcifido,
NULL,
0,
NULL,
&event,
&ioStatus);
if (irp==NULL)
{
return STATUS_INSUFFICIENT_RESOURCES;
}
irpStack=IoGetNextIrpStackLocation(irp);
irpStack->MinorFunction=IRP_MN_QUERY_INTERFACE;
irpStack->Parameters.QueryInterface.InterfaceType=(LPGUID)&GUID_PCI_BUS_INTERFACE_STANDARD;
irpStack->Parameters.QueryInterface.Size=sizeof(PCI_BUS_INTERFACE_STANDARD);
irpStack->Parameters.QueryInterface.Version=PCI_BUS_INTERFACE_STANDARD_VERSION;
irpStack->Parameters.QueryInterface.Interface=(PINTERFACE)busInterface;
irpStack->Parameters.QueryInterface.InterfaceSpecificData=NULL;
//initialize the status to error in case the bus driver does not
//set it correctly.
irp->IoStatus.Status=STATUS_NOT_SUPPORTED ;
ntStatus=IoCallDriver(pcifido, irp);
if (ntStatus==STATUS_PENDING)
{
KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL);
ntStatus=ioStatus.Status;
}
return ntStatus;
}
| 25.016667 | 92 | 0.768821 |
5b3594415d94dd09ce882f0a827aa2372e4278b0 | 10,314 | c | C | thirdparty/win/miracl/miracl_osmt/source/ecdhp16.c | namasikanam/MultipartyPSI | 57fed04b6cb86b88eeede6f7fb50e9ccd3f84528 | [
"Unlicense"
] | 419 | 2016-03-15T18:07:22.000Z | 2022-03-31T07:25:20.000Z | aby/src/abycore/util/Miracl/source/ecdhp16.c | huxh10/SGDX | ed93ab5636e9ccc2a15f87572562641604a3cc2b | [
"Apache-2.0"
] | 89 | 2016-05-12T17:29:14.000Z | 2022-03-22T15:02:11.000Z | aby/src/abycore/util/Miracl/source/ecdhp16.c | huxh10/SGDX | ed93ab5636e9ccc2a15f87572562641604a3cc2b | [
"Apache-2.0"
] | 180 | 2016-03-15T23:49:25.000Z | 2022-03-10T17:41:02.000Z | /*
Example Elliptic Curve Diffie-Hellman program for 16-bit constrained environments. Uses point compression.
Stack-only memory allocation
Use with this mirdef.h header (for a PC using MS C)
(Use this header also with Blackfin processor, and
mex 10 blackfin mrcomba)
#define MR_LITTLE_ENDIAN
#define MIRACL 16
#define mr_utype short
#define MR_IBITS 32
#define MR_LBITS 32
#define mr_unsign32 unsigned int
#define mr_dltype int
#define MR_DLTYPE_IS_INT
#define MR_STATIC 10
#define MR_ALWAYS_BINARY
#define MR_NOASM
#define MR_STRIPPED_DOWN
#define MR_GENERIC_MT
#define MAXBASE ((mr_small)1<<(MIRACL-1))
#define MR_COMBA 10
#define MR_GENERALIZED_MERSENNE
#define MR_SPECIAL
#define MR_BITSINCHAR 8
#define MR_SIMPLE_BASE
#define MR_SIMPLE_IO
Build the library from these modules (Example using MS C compiler)
mex 10 c mrcomba
rem In a real 16-bit setting, a suitable assembly language .mcs file would be used. Here we use C.
cl /c /O2 /W3 mrcore.c
cl /c /O2 /W3 mrarth0.c
cl /c /O2 /W3 mrarth1.c
cl /c /O2 /W3 mrio1.c
cl /c /O2 /W3 mrbits.c
cl /c /O2 /W3 mrcurve.c
cl /c /O2 /W3 mrsroot.c
cl /c /O2 /W3 mrjack.c
cl /c /O2 /W3 mrlucas.c
cl /c /O2 /W3 mrarth2.c
cl /c /O2 /W3 mrmonty.c
cl /c /O2 /W3 mrcomba.c
cl /c /O2 /W3 mrxgcd.c
cl /c /O2 /W3 mrebrick.c
rem
rem Create library 'miracl.lib'
del miracl.lib
lib /OUT:miracl.lib mrio1.obj mrmonty.obj mrcomba.obj mrxgcd.obj
lib /OUT:miracl.lib miracl.lib mrbits.obj mrarth2.obj mrlucas.obj mrjack.obj
lib /OUT:miracl.lib miracl.lib mrarth0.obj mrarth1.obj mrcore.obj mrebrick.obj
lib /OUT:miracl.lib miracl.lib mrcurve.obj mrsroot.obj
del mr*.obj
rem Create the program
cl /O2 ecdhp16.c miracl.lib
********************************************************************************************
Using the Turbo C 16-bit compiler use this header
#define MR_LITTLE_ENDIAN
#define MIRACL 16
#define mr_utype short
#define MR_IBITS 16
#define MR_LBITS 32
#define mr_unsign32 unsigned long
#define mr_dltype long
#define MR_STATIC 10
#define MR_ALWAYS_BINARY
#define MR_STRIPPED_DOWN
#define MR_GENERIC_MT
#define MAXBASE ((mr_small)1<<(MIRACL-1))
#define MR_COMBA 10
#define MR_GENERALIZED_MERSENNE
#define MR_SPECIAL
#define MR_BITSINCHAR 8
#define MR_NOKOBLITZ
Extract the Turbo C small model version of mrmuldv.c from mrmuldv.any
and execute
mex 10 tc86 mrcomba
tcc -c -ms mrcore.c
tcc -c -ms mrarth0.c
tcc -c -ms mrarth1.c
tcc -c -ms mrarth2.c
tcc -c -ms mrio1.c
tcc -c -ms mrjack.c
tcc -c -ms mrxgcd.c
tcc -c -ms mrbits.c
tcc -c -ms mrmonty.c
tcc -c -ms mrsroot.c
tcc -c -ms mrcurve.c
tcc -c -ms mrlucas.c
tcc -c -ms mrsmall.c
tcc -c -ms mrebrick.c
tcc -c -ms mrcomba.c
tcc -c -ms mrmuldv.c
rem
rem Create library 'miracl.lib'
del miracl.lib
tlib miracl
tlib miracl +mrio1
tlib miracl +mrjack+mrxgcd+mrarth2+mrsroot+mrbits
tlib miracl +mrmonty+mrarth1+mrarth0+mrsmall+mrcore
tlib miracl +mrcurve+mrlucas+mrebrick+mrcomba+mrmuldv
del mr*.obj
tcc -ms ecdhp16.c miracl.lib
This assumes that the tasm assembler is available
********************************************************
For the msp430 processor use this header
#define MIRACL 16
#define MR_LITTLE_ENDIAN
#define mr_utype int
#define mr_unsign32 unsigned long
#define mr_dltype long
#define mr_unsign64 unsigned long long
#define MR_IBITS 16
#define MR_LBITS 32
#define MR_NO_FILE_IO
#define MR_STATIC 10
#define MR_COMBA 10
#define MR_ALWAYS_BINARY
#define MAXBASE ((mr_small)1<<(MIRACL-1))
#define MR_BITSINCHAR 8
#define MR_GENERIC_MT
#define MR_STRIPPED_DOWN
#define MR_SIMPLE_IO
#define MR_SIMPLE_BASE
#define MR_SPECIAL
#define MR_GENERALIZED_MERSENNE
#define MR_SMALL_EWINDOW
#define MR_NO_STANDARD_IO
#define MR_NOASM
mex 10 msp430 mrcomba
But read the comments at the start of msp430.mcs
Then add these files to the project, along with this file
mrcore.c
mrarth0.c
mrarth1.c
mrarth2.c
mrio1.c
mrjack.c
mrxgcd.c
mrbits.c
mrmonty.c
mrsroot.c
mrcurve.c
mrlucas.c
mrsmall.c
mrebrick.c
mrcomba.c
*/
#include <stdio.h>
#include <string.h>
#include "miracl.h"
/* !!!!!! THIS CODE AND THESE ROMS ARE NOW CREATED AUTOMATICALLY USING THE ROMAKER.C APPLICATION !!!!!!!! */
/* !!!!!! READ COMMENTS IN ROMAKER.C !!!!!! */
#define HEXDIGS (MIRACL/4)
#define CURVE_BITS 160
/* SCOTT p160 bit elliptic curve Y^2=X^3-3X+157 modulo 2^160-2^112+2^64+1
Here is stored P, B, the group order q, and the generator G(x,y) */
static const mr_small rom[]=
{0x0001, 0x0000, 0x0000, 0x0000, 0x0001, 0x0000, 0x0000, 0xFFFF, 0xFFFF, 0xFFFF,
0x9D,0,0,0,0,0,0,0,0,0,
0x35C3, 0xC739, 0xA36F, 0x36C9, 0x593A, 0xFFFE, 0xFFFF, 0xFFFE, 0xFFFF, 0xFFFF,
0xA11E, 0x4E35, 0x6AAD, 0x373E, 0x87AD, 0xAC67, 0xE14C, 0xEF68, 0x0583, 0xE116,
0x8460, 0xF29E, 0xCE44, 0x63F0, 0x5E8B, 0x761E, 0xE48A, 0x6D02, 0x7574, 0x5707};
#define WINDOW 4
/* 32 precomputed points based on fixed generator G(x,y) */
/* (created using romaker.c program with window size of 4) */
/* These values are only correct if MR_SPECIAL is defined! */
static const mr_small prom[]=
{0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0xa11e,0x4e35,0x6aad,0x373e,0x87ad,0xac67,0xe14c,0xef68,0x583,0xe116,
0x8460,0xf29e,0xce44,0x63f0,0x5e8b,0x761e,0xe48a,0x6d02,0x7574,0x5707,
0x6772,0x397f,0x9767,0xf0ed,0xf5ea,0xf954,0x38f4,0x2928,0x7b45,0x2f0a,
0x6448,0xaeb8,0x22d7,0x7e28,0x1d6a,0x3509,0x7ea7,0xa3cd,0x9c3a,0xf99b,
0x544,0xd389,0x55a6,0xa7d5,0xb755,0xe532,0x77a2,0x6c83,0xc3b6,0xae04,
0x5eca,0xfa9,0x8852,0xf64f,0x40d6,0x5b02,0x8960,0xd05c,0xa31f,0x1675,
0x9873,0x5ab3,0xcfa1,0xcd39,0xf19a,0x5a4c,0xea04,0x23b5,0xc579,0xcb53,
0x8bf1,0x3d76,0x85c8,0x123d,0x445b,0x30,0x2cef,0xb240,0x69c9,0x4367,
0x43ee,0xa57f,0xb704,0xdf9e,0x6410,0x359c,0x8e20,0xf1f5,0x1711,0x52d4,
0x5cf1,0x3481,0xa1ea,0x432c,0xd516,0xb073,0x9ba8,0xc4a3,0x9cc7,0x6c19,
0x601b,0xb7f7,0x9a94,0x8011,0x50d,0xe1b5,0x34db,0x98a5,0xb4cb,0xf354,
0xd8f3,0x8b08,0x1176,0xa270,0xeda6,0x6d69,0xd305,0x6c9a,0xab0a,0x561d,
0xa57a,0xe3ad,0x6d98,0x45a2,0xfa02,0x9930,0x744a,0x7fb,0x263b,0xeca9,
0x230c,0x39f9,0xac8a,0x113e,0x2fd1,0x17cb,0x18bf,0xed10,0xd225,0xda56,
0x7ad3,0x6d66,0x9fed,0x13cf,0xed86,0xe288,0x55eb,0x61a1,0xc92d,0xa067,
0x8ef8,0x6b8d,0x67a,0xa091,0xef31,0x948a,0x553e,0x7280,0xe632,0x45a8,
0x4fc8,0x62c2,0xd82f,0x36b2,0x5143,0x836d,0xb073,0xc6fc,0xf900,0x5505,
0xeff8,0x2835,0xfbb,0x9523,0x8f5,0xfe1c,0xb10e,0x94e5,0x35ea,0xe75b,
0x43c7,0x1dfd,0xe2c8,0x5ed1,0x2cd1,0xcb7e,0x210,0x32ea,0x16d7,0x764b,
0xaf27,0x1721,0x37ac,0xe1f4,0xab94,0xb2f5,0xb1dc,0x7a94,0x611,0x42e,
0xc781,0x54c5,0x5784,0xa020,0xd723,0xdf6d,0x76b9,0xfbc9,0xb44e,0x9ffb,
0x9cd4,0x1bea,0x818b,0x7045,0xad2d,0xbeaa,0x505b,0xc778,0x5361,0x15c2,
0x6b66,0x81a5,0xdf67,0xadfe,0xe2fa,0xbdc5,0xef77,0x5eeb,0x60a5,0x9037,
0xa1cc,0x997,0xb8df,0xfc09,0x49e0,0x918a,0x2993,0x4f18,0xf876,0x9680,
0x694b,0x37d,0xbbce,0x3d9f,0x5494,0x9b16,0x25fb,0x760b,0xc6c3,0x9b41,
0x1bda,0x2fa5,0x45ce,0x3da9,0x4810,0x23b8,0xa722,0xceb9,0xc045,0x3366,
0xe65e,0x62ba,0x675a,0xfdf5,0xc814,0x23fd,0x33c9,0x4c06,0xe787,0xa06d,
0x7358,0x6132,0xf731,0xf884,0xe4d3,0x9f3b,0x9fcc,0x458c,0xfb96,0x58c5,
0x6fb1,0xe7f,0x240,0x8adb,0x9095,0xe4dc,0xe662,0x54b8,0x1716,0x8ae4,
0x9c38,0x8a61,0xfcad,0x78ef,0x2029,0x3c0c,0xed18,0x19af,0xd4fb,0xfbf5};
#define WORDS 10 /* Number of words per big variable 10*16 = 160 */
/* Note that in a real application a source of real random numbers would be required, to
replace those generated by MIRACL's internal pseudo-random generator "bigbits"
Alternatively from a truly random and unguessable seed, use MIRACL's strong random
number generator */
/* Elliptic Curve Diffie-Hellman, using point compression to minimize bandwidth,
and precomputation to speed up off-line calculation */
int main()
{
int promptr;
epoint *PB;
big A,B,p,a,b,q,pa,pb,key,x,y;
ebrick binst;
miracl instance; /* create miracl workspace on the stack */
/* Specify base 16 here so that HEX can be read in directly without a base-change */
miracl *mip=mirsys(&instance,WORDS*HEXDIGS,16); /* size of bigs is fixed */
char mem_big[MR_BIG_RESERVE(10)]; /* we need 10 bigs... */
char mem_ecp[MR_ECP_RESERVE(1)]; /* ..and two elliptic curve points */
memset(mem_big, 0, MR_BIG_RESERVE(10)); /* clear the memory */
memset(mem_ecp, 0, MR_ECP_RESERVE(1));
A=mirvar_mem(mip, mem_big, 0); /* Initialise big numbers */
B=mirvar_mem(mip, mem_big, 1);
pa=mirvar_mem(mip, mem_big, 2);
pb=mirvar_mem(mip, mem_big, 3);
key=mirvar_mem(mip, mem_big, 4);
x=mirvar_mem(mip, mem_big, 5);
y=mirvar_mem(mip, mem_big, 6);
a=mirvar_mem(mip, mem_big, 7);
b=mirvar_mem(mip, mem_big, 8);
p=mirvar_mem(mip, mem_big, 9);
PB=epoint_init_mem(mip, mem_ecp, 0); /* initialise Elliptic Curve points */
irand(mip, 3L); /* change parameter for different random numbers */
promptr=0;
init_big_from_rom(p,WORDS,rom,WORDS*5,&promptr); /* Read in prime modulus p from ROM */
init_big_from_rom(B,WORDS,rom,WORDS*5,&promptr); /* Read in curve parameter B from ROM */
/* don't need q or G(x,y) (we have precomputed table from it) */
convert(mip,-3,A); /* set A=-3 */
/* Create precomputation instance from precomputed table in ROM */
ebrick_init(&binst,prom,A,B,p,WINDOW,CURVE_BITS);
/* offline calculations */
bigbits(mip,CURVE_BITS,a); /* A's random number */
mul_brick(mip,&binst,a,pa,pa); /* a*G =(pa,ya) */
bigbits(mip,CURVE_BITS,b); /* B's random number */
mul_brick(mip,&binst,b,pb,pb); /* b*G =(pb,yb) */
/* swap X values of point */
/* online calculations */
ecurve_init(mip,A,B,p,MR_PROJECTIVE);
epoint_set(mip,pb,pb,0,PB); /* decompress PB */
ecurve_mult(mip,a,PB,PB);
epoint_get(mip,PB,key,key);
/* since internal base is HEX, can use otnum instead of cotnum - avoiding a base change */
#ifndef MR_NO_STANDARD_IO
printf("Alice's Key= ");
otnum(mip,key,stdout);
#endif
epoint_set(mip,pa,pa,0,PB); /* decompress PA */
ecurve_mult(mip,b,PB,PB);
epoint_get(mip,PB,key,key);
#ifndef MR_NO_STANDARD_IO
printf("Bob's Key= ");
otnum(mip,key,stdout);
#endif
/* clear the memory */
memset(mem_big, 0, MR_BIG_RESERVE(10));
memset(mem_ecp, 0, MR_ECP_RESERVE(1));
return 0;
}
| 31.160121 | 113 | 0.729494 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.