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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5671dcfbb1a425a43c8e806b2d12bdcbac7e1c3e | 1,493 | h | C | ExpandCategory/UIExpand/UITextField+Expand.h | 1039289948/ExpandCategory | 6e11b05c0d8ffcf4d6f19533ae24017b4580cb41 | [
"MIT"
] | 1 | 2017-09-28T08:45:03.000Z | 2017-09-28T08:45:03.000Z | ExpandCategory/UIExpand/UITextField+Expand.h | 1039289948/ExpandCategory | 6e11b05c0d8ffcf4d6f19533ae24017b4580cb41 | [
"MIT"
] | null | null | null | ExpandCategory/UIExpand/UITextField+Expand.h | 1039289948/ExpandCategory | 6e11b05c0d8ffcf4d6f19533ae24017b4580cb41 | [
"MIT"
] | null | null | null | //
// UITextField+Expand.h
//
#import <UIKit/UIKit.h>
@interface UITextField (Expand)
+ (instancetype)ex_textFieldWithFrame:(CGRect)frame KeyboardType:(UIKeyboardType)keyboardType Placeholder:(NSString *)placeholder TextAlignment:(NSTextAlignment)textAlignment Delegate:(id<UITextFieldDelegate>)delegate;
- (void)ex_setLeftViewWithImg:(UIImage *)img;
- (void)ex_setLeftViewWithText:(NSString *)text;
- (void)ex_setLeftTextColor:(UIColor *)color;
- (void)ex_setLayerCornerRadius:(CGFloat)radius AndBorderColor:(UIColor *)borderColor;
- (void)ex_setBorderWidth:(CGFloat)width IsLeft:(BOOL)isLeft;
- (void)ex_setRightViewWithImg:(UIImage *)img;
- (void)ex_setRightViewWithImg:(UIImage *)img AndWidth:(CGFloat)width;
- (void)ex_setRightViewWithText:(NSString *)text;
- (void)ex_setPlaceholderColor:(UIColor *)color;
- (void)ex_setPlaceholderFont:(UIFont *)font;
/**
* 仅能输入 整数
*/
- (BOOL)ex_canOnlyEnterAnIntegerWithReplacementString:(NSString *)string InRange:(NSRange)range;
/**
* 仅能输入 Float
*/
- (BOOL)ex_canOnlyEnterAnFloatWithReplacementString:(NSString *)string InRange:(NSRange)range;
/***************************** 常用输入栏样式 *****************************/
+ (instancetype)ex_defaultSearchTextFieldWithFrame:(CGRect)frame
Placeholder:(NSString *)placeholder
Delegate:(id<UITextFieldDelegate>)delegate
Target:(id)target Action:(SEL)action;
@end
| 31.104167 | 218 | 0.685867 |
bc5330a51fa9a53e84a2c3023334c9fe2c3cd0d6 | 1,839 | c | C | CXSparse_newfiles/MATLAB/CSparse/cs_qrsol_mex.c | gabrielfougeron/SuiteSparse | f196042715861c28846f3e01a394931c00860de2 | [
"Apache-2.0"
] | 370 | 2015-01-30T01:04:37.000Z | 2022-03-26T18:48:39.000Z | CXSparse_newfiles/MATLAB/CSparse/cs_qrsol_mex.c | gabrielfougeron/SuiteSparse | f196042715861c28846f3e01a394931c00860de2 | [
"Apache-2.0"
] | 85 | 2015-02-03T22:57:35.000Z | 2021-12-17T12:39:55.000Z | CXSparse_newfiles/MATLAB/CSparse/cs_qrsol_mex.c | gabrielfougeron/SuiteSparse | f196042715861c28846f3e01a394931c00860de2 | [
"Apache-2.0"
] | 234 | 2015-01-14T15:09:09.000Z | 2022-03-26T18:48:41.000Z | #include "cs_mex.h"
/* cs_qrsol: solve least squares or underdetermined problem */
void mexFunction
(
int nargout,
mxArray *pargout [ ],
int nargin,
const mxArray *pargin [ ]
)
{
CS_INT k, order ;
if (nargout > 1 || nargin < 2 || nargin > 3)
{
mexErrMsgTxt ("Usage: x = cs_qrsol(A,b,order)") ;
}
order = (nargin < 3) ? 3 : mxGetScalar (pargin [2]) ;
order = CS_MAX (order, 0) ;
order = CS_MIN (order, 3) ;
if (mxIsComplex (pargin [0]) || mxIsComplex (pargin [1]))
{
#ifndef NCOMPLEX
cs_cl *A, Amatrix ;
cs_complex_t *x, *b ;
A = cs_cl_mex_get_sparse (&Amatrix, 0, pargin [0]) ; /* get A */
b = cs_cl_mex_get_double (A->m, pargin [1]) ; /* get b */
x = cs_dl_calloc (CS_MAX (A->m, A->n), sizeof (cs_complex_t)) ;
for (k = 0 ; k < A->m ; k++) x [k] = b [k] ; /* x = b */
cs_free (b) ;
if (!cs_cl_qrsol (order, A, x)) /* x = A\x */
{
mexErrMsgTxt ("QR solve failed") ;
}
pargout [0] = cs_cl_mex_put_double (A->n, x) ; /* return x */
#else
mexErrMsgTxt ("complex matrices not supported") ;
#endif
}
else
{
cs_dl *A, Amatrix ;
double *x, *b ;
A = cs_dl_mex_get_sparse (&Amatrix, 0, 1, pargin [0]) ; /* get A */
b = cs_dl_mex_get_double (A->m, pargin [1]) ; /* get b */
x = cs_dl_calloc (CS_MAX (A->m, A->n), sizeof (double)) ; /* x = b */
for (k = 0 ; k < A->m ; k++) x [k] = b [k] ;
if (!cs_dl_qrsol (order, A, x)) /* x = A\x */
{
mexErrMsgTxt ("QR solve failed") ;
}
cs_dl_mex_put_double (A->n, x, &(pargout [0])) ; /* return x */
cs_free (x) ;
}
}
| 33.436364 | 79 | 0.466558 |
5d8cfa9c63990b56258fd76281da74c25b4563a7 | 698 | h | C | Example/FGShortVideoKitFramework/FGShortVideoKitFramework.h | FoneG/FGShortVideoKit | d8726ee44ba8fa824c85bd96d8e8020dfeb81fa8 | [
"MIT"
] | null | null | null | Example/FGShortVideoKitFramework/FGShortVideoKitFramework.h | FoneG/FGShortVideoKit | d8726ee44ba8fa824c85bd96d8e8020dfeb81fa8 | [
"MIT"
] | null | null | null | Example/FGShortVideoKitFramework/FGShortVideoKitFramework.h | FoneG/FGShortVideoKit | d8726ee44ba8fa824c85bd96d8e8020dfeb81fa8 | [
"MIT"
] | null | null | null | //
// FGShortVideoKitFramework.h
// FGShortVideoKitFramework
//
// Created by FoneG on 2021/10/28.
// Copyright © 2021 15757127193@163.com. All rights reserved.
//
#import <Foundation/Foundation.h>
//! Project version number for FGShortVideoKitFramework.
FOUNDATION_EXPORT double FGShortVideoKitFrameworkVersionNumber;
//! Project version string for FGShortVideoKitFramework.
FOUNDATION_EXPORT const unsigned char FGShortVideoKitFrameworkVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <FGShortVideoKitFramework/PublicHeader.h>
#import <FGShortVideoKitFramework/Test.h>
#import <FGShortVideoKitFramework/TestB.h>
| 34.9 | 149 | 0.810888 |
a412126b4693e71af47d859f10dc265bf25d1714 | 339 | h | C | badge/ui/menu.h | rohieb/hackover-2013-badge-firmware | da312aba6f92013e49639fcc3755ca98ead831fa | [
"BSD-3-Clause"
] | null | null | null | badge/ui/menu.h | rohieb/hackover-2013-badge-firmware | da312aba6f92013e49639fcc3755ca98ead831fa | [
"BSD-3-Clause"
] | null | null | null | badge/ui/menu.h | rohieb/hackover-2013-badge-firmware | da312aba6f92013e49639fcc3755ca98ead831fa | [
"BSD-3-Clause"
] | null | null | null | #ifndef INCLUDED_BADGE_UI_MENU_H
#define INCLUDED_BADGE_UI_MENU_H
#include <stddef.h>
#include <stdint.h>
uint8_t badge_menu(char const *const * menu,
uint8_t n,
uint8_t *first_visible,
uint8_t preselected);
void badge_scroll_text(char const *const *lines, uint8_t n);
#endif
| 22.6 | 60 | 0.654867 |
5d75369d489430f55548aea250e8fcbd903e2a13 | 2,317 | h | C | Refureku/Library/Include/Public/Refureku/TypeInfo/Archetypes/Template/NonTypeTemplateArgument.h | Angelysse/Refureku | 1f01107c94cd81998068ce3fde02bb21c180166b | [
"MIT"
] | null | null | null | Refureku/Library/Include/Public/Refureku/TypeInfo/Archetypes/Template/NonTypeTemplateArgument.h | Angelysse/Refureku | 1f01107c94cd81998068ce3fde02bb21c180166b | [
"MIT"
] | null | null | null | Refureku/Library/Include/Public/Refureku/TypeInfo/Archetypes/Template/NonTypeTemplateArgument.h | Angelysse/Refureku | 1f01107c94cd81998068ce3fde02bb21c180166b | [
"MIT"
] | null | null | null | /**
* Copyright (c) 2021 Julien SOYSOUVANH - All Rights Reserved
*
* This file is part of the Refureku library project which is released under the MIT License.
* See the LICENSE.md file for full license details.
*/
#pragma once
#include "Refureku/TypeInfo/Archetypes/Template/TemplateArgument.h"
#include "Refureku/TypeInfo/Archetypes/GetArchetype.h"
namespace rfk
{
//Forward declaration
class Archetype;
class NonTypeTemplateArgument : public TemplateArgument
{
public:
template <typename T>
NonTypeTemplateArgument(T const& value) noexcept;
REFUREKU_API NonTypeTemplateArgument(Archetype const* valueArchetype,
void const* valuePtr) noexcept;
REFUREKU_API ~NonTypeTemplateArgument() noexcept;
/**
* @brief Get the archetype of the argument.
*
* @return The archetype of the argument.
*/
RFK_NODISCARD REFUREKU_API
Archetype const* getArchetype() const noexcept;
/**
* @brief Get the value of the non-type template argument.
* If the provided type is not the original type of the non-type template argument,
* the behaviour is undefined.
*
* @tparam Type of the non-type argument value.
*
* @return The argument value.
*/
template <typename T>
RFK_NODISCARD T const& getValue() const noexcept;
/**
* @brief Get a pointer to the argument value.
*
* @return A pointer to the argument value.
*/
RFK_NODISCARD REFUREKU_API
void const* getValuePtr() const noexcept;
/**
* @brief Check whether 2 NonTypeTemplateArgument instances are equal or not.
*
* @param other The NonTypeTemplateArgument to compare to.
*
* @return true if the 2 type template arguments have the same archetype, and values.
* Returns false if the bound parameter archetype is nullptr, since the equality can't be guaranteed.
*/
RFK_NODISCARD REFUREKU_API bool operator==(NonTypeTemplateArgument const& other) const noexcept;
RFK_NODISCARD REFUREKU_API bool operator!=(NonTypeTemplateArgument const& other) const noexcept;
protected:
//Forward declaration
class NonTypeTemplateArgumentImpl;
RFK_GEN_GET_PIMPL(NonTypeTemplateArgumentImpl, TemplateArgument::getPimpl())
};
#include "Refureku/TypeInfo/Archetypes/Template/NonTypeTemplateArgument.inl"
} | 30.893333 | 105 | 0.725076 |
51383c458ac8a9c746df62d66aa44d87eeb4d7dd | 3,120 | c | C | storm/ia32/string.c | chaos4ever/chaos-old | 97d96d78d0b5f7961b9b062ccfcdbad2f977b0fa | [
"BSD-3-Clause"
] | null | null | null | storm/ia32/string.c | chaos4ever/chaos-old | 97d96d78d0b5f7961b9b062ccfcdbad2f977b0fa | [
"BSD-3-Clause"
] | null | null | null | storm/ia32/string.c | chaos4ever/chaos-old | 97d96d78d0b5f7961b9b062ccfcdbad2f977b0fa | [
"BSD-3-Clause"
] | null | null | null | /* $Id$ */
/* Abstract: String routines. */
/* Author: Per Lundberg <plundis@chaosdev.org> */
/* Copyright 1999 chaos development. */
/* This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA. */
#include <storm/generic/debug.h>
#include <storm/generic/defines.h>
#include <storm/generic/return_values.h>
#include <storm/generic/string.h>
#include <storm/generic/types.h>
/* Converts a string to a number. */
return_type string_to_number (char *string, int *number)
{
unsigned int index = 0;
unsigned int base = 10;
bool negative = FALSE;
/* Make sure we are not null. */
if (string == NULL)
{
return RETURN_INVALID_ARGUMENT;
}
/* Is this a negative number? */
if (string[index] == '-')
{
negative = TRUE;
index++;
}
/* Check which base this is. Hexadecimal, perhaps? */
switch (string[index])
{
case '0':
{
index++;
switch (string[index])
{
/* Hexadecimal. */
case 'x':
{
base = 16;
index++;
break;
}
case 'b':
{
base = 2;
index++;
break;
}
}
break;
}
}
/* Null the number. */
*number = 0;
switch (base)
{
/* Binary. */
case 2:
{
while (string[index] != '\0')
{
*number *= 2;
*number += string[index] - '0';
index++;
}
break;
}
/* Decimal. */
case 10:
{
while (string[index] != '\0')
{
*number *= 10;
if ('0' <= string[index] && string[index] <= '9')
{
*number += string[index] - '0';
}
else
{
return RETURN_INVALID_ARGUMENT;
}
index++;
}
break;
}
/* Hexadecimal. */
case 16:
{
while (string[index] != '\0')
{
*number *= 16;
if ('0' <= string[index] && string[index] <= '9')
{
*number += string[index] - '0';
}
else if (string[index] >= 'a' && string[index] <= 'f')
{
*number += string[index] - 'a' + 10;
}
else if (string[index] >= 'A' && string[index] <= 'F')
{
*number += string[index] - 'A' + 10;
}
else
{
return RETURN_INVALID_ARGUMENT;
}
index++;
}
break;
}
}
if (negative)
{
*number = 0 - *number;
}
return RETURN_SUCCESS;
}
| 19.746835 | 70 | 0.520513 |
4ea713d3dfa4100967912e5b7183c3e09d6cbca1 | 48 | h | C | include/libtech/libtypes.h | tristanred/libtech | 88f49e893dc3674821cc3d5f57e354846c8dbccd | [
"MIT"
] | null | null | null | include/libtech/libtypes.h | tristanred/libtech | 88f49e893dc3674821cc3d5f57e354846c8dbccd | [
"MIT"
] | 1 | 2019-06-01T14:37:41.000Z | 2019-06-01T14:37:41.000Z | include/libtech/libtypes.h | tristanred/libtech | 88f49e893dc3674821cc3d5f57e354846c8dbccd | [
"MIT"
] | null | null | null | #pragma once
#ifndef NULL
#define NULL 0
#endif | 9.6 | 14 | 0.75 |
e50f542a0ffd27df557899e38eb06a2291cbade4 | 2,683 | c | C | src/build/rust/std/remap_alloc.c | uszhen/naiveproxy | 0aa27e8bd37428f2124a891be1e5e793928cd726 | [
"BSD-3-Clause"
] | 3 | 2020-05-31T16:20:21.000Z | 2021-09-05T20:39:50.000Z | src/build/rust/std/remap_alloc.c | uszhen/naiveproxy | 0aa27e8bd37428f2124a891be1e5e793928cd726 | [
"BSD-3-Clause"
] | null | null | null | src/build/rust/std/remap_alloc.c | uszhen/naiveproxy | 0aa27e8bd37428f2124a891be1e5e793928cd726 | [
"BSD-3-Clause"
] | null | null | null | // Copyright 2021 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.
#include <stddef.h>
#include <stdlib.h>
// When linking a final binary, rustc has to pick between either:
// * The default Rust allocator
// * Any #[global_allocator] defined in *any rlib in its dependency tree*
// (https://doc.rust-lang.org/edition-guide/rust-2018/platform-and-target-support/global-allocators.html)
//
// In this latter case, this fact will be recorded in some of the metadata
// within the .rlib file. (An .rlib file is just a .a file, but does have
// additional metadata for use by rustc. This is, as far as I know, the only
// such metadata we would ideally care about.)
//
// In all the linked rlibs,
// * If 0 crates define a #[global_allocator], rustc uses its default allocator
// * If 1 crate defines a #[global_allocator], rustc uses that
// * If >1 crates define a #[global_allocator], rustc bombs out.
//
// Because rustc does these checks, it doesn't just have the __rust_alloc
// symbols defined anywhere (neither in the stdlib nor in any of these
// crates which have a #[global_allocator] defined.)
//
// Instead:
// Rust's final linking stage invokes dynamic LLVM codegen to create symbols
// for the basic heap allocation operations. It literally creates a
// __rust_alloc symbol at link time. Unless any crate has specified a
// #[global_allocator], it simply calls from __rust_alloc into
// __rdl_alloc, which is the default Rust allocator. The same applies to a
// few other symbols.
//
// We're not (always) using rustc for final linking. For cases where we're not
// Rustc as the final linker, we'll define those symbols here instead.
//
// In future, we may wish to do something different from using the Rust
// default allocator (e.g. explicitly redirect to PartitionAlloc). We could
// do that here, or we could build a crate with a #[global_allocator] and
// redirect these symbols to that crate instead. The advantage of the latter
// is that it would work equally well for those cases where rustc is doing
// the final linking.
void* __rdl_alloc(size_t, size_t);
void __rdl_dealloc(void*);
void* __rdl_realloc(void*, size_t, size_t, size_t);
void* __rdl_alloc_zeroed(size_t, size_t);
void* __rust_alloc(size_t a, size_t b) {
return __rdl_alloc(a, b);
}
void __rust_dealloc(void* a) {
__rdl_dealloc(a);
}
void* __rust_realloc(void* a, size_t b, size_t c, size_t d) {
return __rdl_realloc(a, b, c, d);
}
void* __rust_alloc_zeroed(size_t a, size_t b) {
return __rdl_alloc_zeroed(a, b);
}
void __rust_alloc_error_handler(size_t a, size_t b) {
abort();
}
| 38.884058 | 107 | 0.738725 |
66648c02b99d91d123aceb100903e7d7acb46f04 | 1,099 | h | C | Examples/include/Aspose.Pdf.Cpp/PsLoadOptions.h | kashifiqb/Aspose.PDF-for-C | 13d49bba591c5704685820185741e64a462a5bdc | [
"MIT"
] | null | null | null | Examples/include/Aspose.Pdf.Cpp/PsLoadOptions.h | kashifiqb/Aspose.PDF-for-C | 13d49bba591c5704685820185741e64a462a5bdc | [
"MIT"
] | null | null | null | Examples/include/Aspose.Pdf.Cpp/PsLoadOptions.h | kashifiqb/Aspose.PDF-for-C | 13d49bba591c5704685820185741e64a462a5bdc | [
"MIT"
] | null | null | null | #pragma once
// Copyright (c) 2001-2019 Aspose Pty Ltd. All Rights Reserved.
#include <system/string.h>
#include <system/array.h>
#include "LoadOptions.h"
#include "aspose_pdf_api_defs.h"
namespace Aspose {
namespace Pdf {
/// <summary>
/// Represents options for loading/importing of .mht-file into pdf document.
/// </summary>
class ASPOSE_PDF_SHARED_API PsLoadOptions FINAL : public Aspose::Pdf::LoadOptions
{
typedef PsLoadOptions ThisType;
typedef Aspose::Pdf::LoadOptions BaseType;
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
RTTI_INFO_DECL();
public:
System::ArrayPtr<System::String> get_FontsFolders();
void set_FontsFolders(System::ArrayPtr<System::String> value);
/// <summary>
/// Creates load options for converting PostScript into pdf document with empty base path.
/// </summary>
PsLoadOptions();
protected:
System::Object::shared_members_type GetSharedMembers() override;
private:
System::ArrayPtr<System::String> _fontsFolders;
};
} // namespace Pdf
} // namespace Aspose
| 22.428571 | 94 | 0.710646 |
e2e479f8b3727c668a59c41e117adb3b7ffeb0d7 | 1,271 | h | C | src/api/pywrapper_api_type.h | sterin/pywrapper | 5ddff66cedbd12f7c8a898b95efe0dd8079796b2 | [
"MIT-0"
] | 1 | 2018-10-02T15:29:17.000Z | 2018-10-02T15:29:17.000Z | src/api/pywrapper_api_type.h | sterin/pywrapper | 5ddff66cedbd12f7c8a898b95efe0dd8079796b2 | [
"MIT-0"
] | null | null | null | src/api/pywrapper_api_type.h | sterin/pywrapper | 5ddff66cedbd12f7c8a898b95efe0dd8079796b2 | [
"MIT-0"
] | 2 | 2018-10-02T15:39:46.000Z | 2020-10-11T23:15:23.000Z |
#ifndef PYTHONWRAPPER_API_TYPE__H
#define PYTHONWRAPPER_API_TYPE__H
namespace py
{
static inline int Type_Check(PyObject *o)
{
return safe_noref( PyType_Check(o) );
}
static inline int Type_CheckExact(PyObject *o)
{
return safe_noref( PyType_CheckExact(o) );
}
static inline unsigned int Type_ClearCache()
{
return safe_noref( PyType_ClearCache() );
}
static inline void Type_Modified(PyTypeObject *type)
{
PyType_Modified(type);
exception::check();
}
static inline int Type_HasFeature(PyTypeObject *o, int feature)
{
return safe_noref( PyType_HasFeature(o, feature) );
}
static inline int Type_IS_GC(PyTypeObject *o)
{
return safe_noref( PyType_IS_GC(o) );
}
static inline int Type_IsSubtype(PyTypeObject *a, PyTypeObject *b)
{
return safe_noref( PyType_IsSubtype(a, b) );
}
static inline ref<PyObject> Type_GenericAlloc(PyTypeObject *type, Py_ssize_t nitems)
{
return safe_ref( PyType_GenericAlloc(type, nitems) );
}
static inline ref<PyObject> Type_GenericNew(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
return safe_ref( PyType_GenericNew(type, args, kwds) );
}
static inline int Type_Ready(PyTypeObject *type)
{
return safe_noref( PyType_Ready(type) );
}
}
#endif // PYTHONWRAPPER_API_API_TYPE__H
| 19.859375 | 95 | 0.74823 |
822cf151a3ebe487d9504f119f6414bda9fdc474 | 1,374 | h | C | game.h | fjacob21/Pocman | 745266075b08634e73bd00ae5b6f9f0c8350437f | [
"MIT"
] | null | null | null | game.h | fjacob21/Pocman | 745266075b08634e73bd00ae5b6f9f0c8350437f | [
"MIT"
] | null | null | null | game.h | fjacob21/Pocman | 745266075b08634e73bd00ae5b6f9f0c8350437f | [
"MIT"
] | null | null | null | #include <Windowsx.h>
#include <time.h>
//RANDOM
class CFJ_Random
{
public:
CFJ_Random(){ordinal = 1;srand((int)time(NULL));};
CFJ_Random(int ord){ordinal = ord;srand((int)time(NULL));};
~CFJ_Random(){};
int operator () (){return rand()%ordinal+1;};
int operator () (int ord){return rand()%ord+1;};
private:
int ordinal;
};
CFJ_Random d4(4);
CFJ_Random d6(6);
CFJ_Random d8(8);
CFJ_Random d10(10);
CFJ_Random d12(12);
CFJ_Random d20(20);
CFJ_Random d100(100);
CFJ_Random dd;
//TIMER
void Wait(int t)
{
_int64 start, end, freq;
QueryPerformanceFrequency((LARGE_INTEGER*)&freq);
QueryPerformanceCounter((LARGE_INTEGER*)&start); // the main message loop begins here
QueryPerformanceCounter((LARGE_INTEGER*)&end);
while((end-start)/freq < t)
QueryPerformanceCounter((LARGE_INTEGER*)&end);
}
class CFJ_Timer
{
public:
CFJ_Timer(){QueryPerformanceFrequency((LARGE_INTEGER*)&freq);set=false;};
~CFJ_Timer(){};
void Start();
void Stop();
float operator()();
private:
_int64 start, freq;
bool set;
};
void CFJ_Timer::Start()
{
QueryPerformanceCounter((LARGE_INTEGER*)&start);
set = true;
}
void CFJ_Timer::Stop()
{
set = false;
}
float CFJ_Timer::operator() ()
{
_int64 now;
QueryPerformanceCounter((LARGE_INTEGER*)&now);
return (float)(now-start)/freq;
} | 19.628571 | 90 | 0.657933 |
058aaf3bc55a91dcb1064b6d1de692ff0ed6524a | 1,091 | h | C | tutorial/MyGNode/MyTemplateNode.h | LiuLingLing1217/CGraph | 09dba261d5e998e26f9c5ae9a8b30c7d50e979e8 | [
"MIT"
] | 2 | 2022-03-02T14:46:06.000Z | 2022-03-03T10:05:49.000Z | tutorial/MyGNode/MyTemplateNode.h | weijiav/CGraph | 848a58b51d6dd80f6f9e5d65d50059b7d0095e69 | [
"MIT"
] | null | null | null | tutorial/MyGNode/MyTemplateNode.h | weijiav/CGraph | 848a58b51d6dd80f6f9e5d65d50059b7d0095e69 | [
"MIT"
] | null | null | null | /***************************
@Author: Chunel
@Contact: chunel@foxmail.com
@File: MyTemplateNode.h
@Time: 2021/9/18 9:52 下午
@Desc:
***************************/
#ifndef CGRAPH_MYTEMPLATENODE_H
#define CGRAPH_MYTEMPLATENODE_H
#include "../../src/CGraph.h"
template <typename T>
class MyTemplateNode : public CGraph::GNode {
public:
CStatus run () override {
CStatus status;
if (std::string("c") == typeid(val_).name()) {
CGraph::CGRAPH_ECHO("This node template type is [char]."); // 对应模板类型是 char 类型
} else if (std::string("f") == typeid(val_).name()) {
CGraph::CGRAPH_ECHO("This node template type is [float]."); // 对应模板类型是 float 类型
} else if (std::string("i") == typeid(val_).name()) {
CGraph::CGRAPH_ECHO("This node template type is [int]."); // 对应模板类型是 int 类型
} else {
CGraph::CGRAPH_ECHO("This node template type is others.");
}
/* 模板类型节点,还可以和GParam逻辑联动,实现更多功能 */
return status;
}
private:
T val_; // 模板类型成员变量
};
#endif //CGRAPH_MYTEMPLATENODE_H
| 27.275 | 94 | 0.575619 |
66b4dd4e2990b0e43827edeec07e6be52acc910d | 2,410 | h | C | c++/VIPS.h | ykwon0407/VIPS | 91d940304b34d702c1a8b12363b5fff38455ef88 | [
"MIT"
] | 1 | 2021-11-23T05:58:56.000Z | 2021-11-23T05:58:56.000Z | c++/VIPS.h | ykwon0407/VIPS | 91d940304b34d702c1a8b12363b5fff38455ef88 | [
"MIT"
] | null | null | null | c++/VIPS.h | ykwon0407/VIPS | 91d940304b34d702c1a8b12363b5fff38455ef88 | [
"MIT"
] | null | null | null | #ifndef VIPS_VIPS_H
#define VIPS_VIPS_H
#define ARMA_DONT_PRINT_ERRORS
#include <armadillo>
#include <random>
#include "VIPS_Model.h"
#include "SampleDatabase.h"
class VIPS {
protected:
int num_threads;
int num_dimensions;
// active samples (subset of total samples)
int num_samples;
arma::mat samples;
arma::vec target_densities;
// log-densities of active samples on various distributions
arma::mat log_densities_on_model_comps;
arma::mat log_joint_densities;
arma::vec log_densities_on_model;
arma::mat log_responsibilities;
arma::mat log_densities_on_background_dist;
arma::rowvec offsets_for_model_joint_densities;
arma::rowvec sum_of_joint_densities_with_offsets;
// importance weights of active samples
arma::mat importance_weights;
arma::mat importance_weights_normalized;
public:
VIPS(int num_dimensions, int num_threads);
~VIPS(void);
VIPS_Model model;
GMM backgroundDistribution;
SampleDatabase sampleDatabase;
void delete_low_weight_components(double min_weight);
void add_samples_to_database(arma::mat new_samples, arma::vec new_target_densities, arma::uvec used_components);
void recompute_densities(bool update_log_densities_on_model_comps=true, bool update_log_densities_on_background_dist=true);
void activate_newest_samples(int N);
void update_targets_for_KL_bounds(bool update_weight_targets, bool update_comp_targets);
void promote_samples_to_components(int N, double max_exploration_bonus, double tau, bool only_check_active_samples, int max_samples);
std::tuple<double,vec,vec> update_weights(double epsilon, double tau, double entropy_bound);
arma::vec adapt_KL_bound_for_comp_update(double max_kl_bound, double factor);
arma::vec update_components(double max_kl_bound, double factor, double tau, double ridge_coefficient,
vec entropy_bounds, double max_active_samples, bool dont_learn_correlations);
void add_components(arma::vec new_weights_total, arma::mat new_means, arma::cube new_covs);
double get_entropy_estimate_on_active_samples();
double get_entropy_estimate_on_gmm_samples(int num_samples=10000);
std::tuple<arma::mat, arma::vec, arma::mat, arma::mat, arma::vec, arma::mat, arma::mat, arma::mat, arma::mat>
get_debug_info();
// Getters
int getNumSamples();
};
#endif | 31.710526 | 137 | 0.762241 |
250b07f0667b32fec9be98c616091f83224d144f | 3,467 | h | C | framework/system/foundation/Bee_Log.h | lancy/BeeFramework | 9f2baef60ea76ed1ffccc21bf3e936a08165279b | [
"MIT"
] | 1 | 2016-05-09T08:54:49.000Z | 2016-05-09T08:54:49.000Z | framework/system/foundation/Bee_Log.h | lancy/BeeFramework | 9f2baef60ea76ed1ffccc21bf3e936a08165279b | [
"MIT"
] | null | null | null | framework/system/foundation/Bee_Log.h | lancy/BeeFramework | 9f2baef60ea76ed1ffccc21bf3e936a08165279b | [
"MIT"
] | null | null | null | //
// ______ ______ ______
// /\ __ \ /\ ___\ /\ ___\
// \ \ __< \ \ __\_ \ \ __\_
// \ \_____\ \ \_____\ \ \_____\
// \/_____/ \/_____/ \/_____/
//
//
// Copyright (c) 2013-2014, {Bee} open source community
// http://www.bee-framework.com
//
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//
#import "Bee_Precompile.h"
#import "Bee_Singleton.h"
#pragma mark -
typedef enum
{
BeeLogLevelNone = 0,
BeeLogLevelInfo = 100,
BeeLogLevelPerf = 100 + 1,
BeeLogLevelProgress = 100 + 2,
BeeLogLevelWarn = 200,
BeeLogLevelError = 300
} BeeLogLevel;
#pragma mark -
#undef CC
#define CC( ... ) [[BeeLogger sharedInstance] level:BeeLogLevelNone format:__VA_ARGS__];
#undef INFO
#define INFO( ... ) [[BeeLogger sharedInstance] level:BeeLogLevelInfo format:__VA_ARGS__];
#undef PERF
#define PERF( ... ) [[BeeLogger sharedInstance] level:BeeLogLevelPerf format:__VA_ARGS__];
#undef WARN
#define WARN( ... ) [[BeeLogger sharedInstance] level:BeeLogLevelWarn format:__VA_ARGS__];
#undef ERROR
#define ERROR( ... ) [[BeeLogger sharedInstance] level:BeeLogLevelError format:__VA_ARGS__];
#undef PROGRESS
#define PROGRESS( ... ) [[BeeLogger sharedInstance] level:BeeLogLevelProgress format:__VA_ARGS__];
#undef VAR_DUMP
#define VAR_DUMP( __obj ) [[BeeLogger sharedInstance] level:BeeLogLevelNone format:[__obj description]];
#undef OBJ_DUMP
#define OBJ_DUMP( __obj ) [[BeeLogger sharedInstance] level:BeeLogLevelNone format:[__obj objectToDictionary]];
#undef TODO
#define TODO( desc, ... )
#pragma mark -
@interface BeeBacklog : NSObject
@property (nonatomic, assign) BeeLogLevel level;
@property (nonatomic, retain) NSDate * time;
@property (nonatomic, retain) NSString * text;
@end
#pragma mark -
@interface BeeLogger : NSObject
AS_SINGLETON( BeeLogger );
@property (nonatomic, assign) BOOL enabled;
@property (nonatomic, assign) BOOL backlog;
@property (nonatomic, retain) NSMutableArray * backlogs;
@property (nonatomic, assign) NSUInteger indentTabs;
- (void)toggle;
- (void)enable;
- (void)disable;
- (void)indent;
- (void)indent:(NSUInteger)tabs;
- (void)unindent;
- (void)unindent:(NSUInteger)tabs;
- (void)level:(BeeLogLevel)level format:(NSString *)format, ...;
- (void)level:(BeeLogLevel)level format:(NSString *)format args:(va_list)args;
@end
#pragma mark -
#if __cplusplus
extern "C" {
#endif
void BeeLog( NSString * format, ... );
#if __cplusplus
};
#endif
| 28.891667 | 111 | 0.722527 |
c98f696f11f56bd31b4139ed37826927b914def3 | 5,876 | h | C | application.h | widelec-BB/KwaKwa | 8dcb9e5e7bd769ce7d3f0893bb825fa5b4741bad | [
"MIT"
] | 2 | 2018-02-10T15:42:33.000Z | 2018-04-11T10:39:25.000Z | application.h | widelec-BB/KwaKwa | 8dcb9e5e7bd769ce7d3f0893bb825fa5b4741bad | [
"MIT"
] | 1 | 2018-02-21T06:35:55.000Z | 2018-08-15T21:16:57.000Z | application.h | widelec-BB/KwaKwa | 8dcb9e5e7bd769ce7d3f0893bb825fa5b4741bad | [
"MIT"
] | null | null | null | /*
* Copyright (c) 2012-2022 Filip "widelec-BB" Maryjanski, BlaBla group.
* All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef __APPLICATION_H__
#define __APPLICATION_H__
#include <proto/intuition.h>
#include <proto/utility.h>
#include <proto/muimaster.h>
#include <clib/alib_protos.h>
#include <exec/lists.h>
extern struct MUI_CustomClass *ApplicationClass;
struct MUI_CustomClass *CreateApplicationClass(void);
void DeleteApplicationClass(void);
struct InsertLinkParms
{
ULONG pluginid;
STRPTR contactid;
STRPTR link;
};
/* methods */
#define APPM_MainLoop 0x6EDA0000
#define APPM_DisconnectAck 0x6EDA0001
#define APPM_Connect 0x6EDA0002
#define APPM_Disconnect 0x6EDA0003
#define APPM_ChangeStatus 0x6EDA0004
#define APPM_ErrorNotSupported 0x6EDA0005
#define APPM_NotifyContactList 0x6EDA0006
#define APPM_ListChangeAck 0x6EDA0007
#define APPM_NewMessageAck 0x6EDA0009
#define APPM_StatusChangeAck 0x6EDA0008
#define APPM_SendMessage 0x6EDA000A
#define APPM_ScreenbarChange 0x6EDA000B
#define APPM_AddNotify 0x6EDA000C
#define APPM_RemoveNotify 0x6EDA000D
#define APPM_ScreenbarMenu 0x6EDA000E
#define APPM_SendTypingNotify 0x6EDA000F
#define APPM_TypingNotifyAck 0x6EDA0010
#define APPM_Screenbarize 0x6EDA0011
#define APPM_ModuleMessageAck 0x6EDA0012
#define APPM_ErrorNoMem 0x6EDA0013
#define APPM_ErrorConnFail 0x6EDA0014
#define APPM_ErrorLoginFail 0x6EDA0015
#define APPM_ScreenbarUnread 0x6EDA0016
#define APPM_OpenModules 0x6EDA0017
#define APPM_CloseModules 0x6EDA0018
#define APPM_NewEvent 0x6EDA0019
#define APPM_ReplyMsg 0x6EDA001A
#define APPM_ParseEvent 0x6EDA001B
#define APPM_ConnectAck 0x6EDA001C
#define APPM_FtpPut 0x6EDA001D
#define APPM_NotifyBeacon 0x6EDA001E
#define APPM_SendHttpGet 0x6EDA001F
#define APPM_SendHttpPost 0x6EDA0020
#define APPM_NewAvatarAck 0x6EDA0021
#define APPM_ClipboardStart 0x6EDA0022
#define APPM_ClipboardWrite 0x6EDA0023
#define APPM_ClipboardEnd 0x6EDA0024
#define APPM_Setup 0x6EDA0025
#define APPM_Cleanup 0x6EDA0026
#define APPM_InstallBroker 0x6EDA0027
#define APPM_RemoveBroker 0x6EDA0028
#define APPM_AutoAway 0x6EDA0029
#define APPM_AutoBack 0x6EDA002A
#define APPM_ImportList 0x6EDA002B
#define APPM_ExportList 0x6EDA002C
#define APPM_ImportListAck 0x6EDA002D
#define APPM_ExportListAck 0x6EDA002E
#define APPM_AddModulesGui 0x6EDA002F
#define APPM_SendPicture 0x6EDA0030
#define APPM_NewPictureAck 0x6EDA0031
#define APPM_FtpPutCallback 0x6EDA0032
#define APPM_FtpPutActiveTab 0x6EDA0033
#define APPM_AnswerInvite 0x6EDA0034
#define APPM_NewInviteAck 0x6EDA0035
#define APPM_PubDirRequest 0x6EDA0036
#define APPM_GetModuleName 0x6EDA0037
#define APPM_ConvertContactEntry 0x6EDA0038
#define APPM_OpenHistoryDatabase 0x6EDA0039
#define APPM_CloseHistoryDatabase 0x6EDA003A
#define APPM_DoSqlOnHistoryDatabase 0x6EDA003B
#define APPM_InsertMessageIntoHistory 0x6EDA003C
#define APPM_InsertConversationIntoHistory 0x6EDA003D
#define APPM_GetModuleUserId 0x6EDA003E
#define APPM_GetLastMessagesFromHistory 0x6EDA004F
#define APPM_GetLastConvMsgsFromHistory 0x6EDA0050
#define APPM_GetLastMessagesByTime 0x6EDA0051
#define APPM_GetLastConversation 0x6EDA0052
#define APPM_GetContactsFromHistory 0x6EDA0053
#define APPM_GetConversationsFromHistory 0x6EDA0054
#define APPM_GetMessagesFromHistory 0x6EDA0055
#define APPM_DeleteContactFromHistory 0x6EDA0056
#define APPM_DeleteConversationFromHistory 0x6EDA0057
#define APPM_SetLastStatus 0x6EDA0058
#define APPM_ConfirmQuit 0x6EDA0059
#define APPM_ScreenbarInstall 0x6EDA005A
#define APPM_ScreenbarRemove 0x6EDA005B
#define APPM_UpdateHistoryDatabase 0x6EDA005C
#define APPM_SecTrigger 0x6EDA111D
/* attrs */
#define APPA_ScreenbarUnread 0x6EDA1000
#define APPA_Status 0x6EDA1001
#define APPA_Description 0x6EDA1002
/* magic beacon notifications names */
#define BEACON_MESSAGE "MESSAGE"
#define BEACON_STATUS "STATUS"
#define BEACON_PICTURE "PICTURE"
#define BEACON_INVITE "INVITE"
/* history database flags - conversations table */
#define HISTORY_CONVERSATIONS_NORMAL (0)
#define HISTORY_CONVERSATIONS_CONFERENCE (1)
/* history database flags - messages table */
#define HISTORY_MESSAGES_MY (0)
#define HISTORY_MESSAGES_FRIEND (1 << 0)
#define HISTORY_MESSAGES_NORMAL (1 << 1)
#define HISTORY_MESSAGES_SYSTEM (1 << 2)
#define HISTORY_MESSAGES_PICTURE (1 << 3) /* TODO: not yet implemented */
#define HISTORY_MESSAGES_INVITE (1 << 4) /* TODO: not yet implemented */
#endif /* __APPLICATION_H__ */
| 43.850746 | 80 | 0.650102 |
2a1e2076303bc309484dd37505f2210f2e72ca9c | 9,736 | c | C | src/core/signals/test_signal_update_basic.c | parmance/HSA-Runtime-Conformance | 37d2652d8c3deba7996df331817622dfef01f4ca | [
"NCSA"
] | 1 | 2017-05-22T17:21:37.000Z | 2017-05-22T17:21:37.000Z | src/core/signals/test_signal_update_basic.c | parmance/HSA-Runtime-Conformance | 37d2652d8c3deba7996df331817622dfef01f4ca | [
"NCSA"
] | 13 | 2016-11-12T09:25:46.000Z | 2016-11-27T19:11:34.000Z | src/core/signals/test_signal_update_basic.c | parmance/HSA-Runtime-Conformance | 37d2652d8c3deba7996df331817622dfef01f4ca | [
"NCSA"
] | 3 | 2016-11-23T13:22:03.000Z | 2021-02-21T17:52:45.000Z | /*
* =============================================================================
* HSA Runtime Conformance Release License
* =============================================================================
* The University of Illinois/NCSA
* Open Source License (NCSA)
*
* Copyright (c) 2014, Advanced Micro Devices, Inc.
* All rights reserved.
*
* Developed by:
*
* AMD Research and AMD HSA Software Development
*
* Advanced Micro Devices, Inc.
*
* www.amd.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal 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 <Name of Development Group, Name of Institution>,
* 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.
*
*/
/*
* Test Name: signal_update_basic
* Scope: Conformance
*
* Purpose: Verifies that all of the signal modification APIs are functional
* in a single thread.
*
* Test Description:
* 1) Create a signal.
* 2) For each of the signal modification APIs
* a) Change the signal value to a new value.
* b) Read back the signal value with hsa_signal_load
* 3) The modification APIs under test are:
* - hsa_signal_store_(acquire|relaxed)
* - hsa_signal_exchange_(acq_rel|acquire|relaxed|release)
* - hsa_signal_cas_(acq_rel|acquire|relaxed|release)
* - hsa_signal_add_(acq_rel|acquire|relaxed|release)
* - hsa_signal_subtract_(acq_rel|acquire|relaxed|release)
* - hsa_signal_and_(acq_rel|acquire|relaxed|release)
* - hsa_signal_or_(acq_rel|acquire|relaxed|release)
* - hsa_signal_xor_(acq_rel|acquire|relaxed|release)
*
* Expected Results: The hsa_signal_load should return the expected value
* after each modification.
*
*/
#include<hsa.h>
#include<framework.h>
void hsa_signal_store_update_basic() {
hsa_signal_t signal;
hsa_status_t status = hsa_signal_create(0, 0, NULL, &signal);
ASSERT(HSA_STATUS_SUCCESS == status);
hsa_signal_value_t value;
hsa_signal_store_release(signal, 1);
value = hsa_signal_load_relaxed(signal);
ASSERT(1 == value);
hsa_signal_store_relaxed(signal, 0);
value = hsa_signal_load_relaxed(signal);
ASSERT(0 == value);
status = hsa_signal_destroy(signal);
ASSERT(HSA_STATUS_SUCCESS == status);
return;
}
void hsa_signal_exchange_update_basic() {
hsa_signal_t signal;
hsa_status_t status = hsa_signal_create(0, 0, NULL, &signal);
ASSERT(HSA_STATUS_SUCCESS == status);
hsa_signal_value_t value;
value = hsa_signal_exchange_acquire(signal, 1);
ASSERT(0 == value);
value = hsa_signal_load_relaxed(signal);
ASSERT(1 == value);
value = hsa_signal_exchange_acq_rel(signal, 0);
ASSERT(1 == value);
value = hsa_signal_load_relaxed(signal);
ASSERT(0 == value);
value = hsa_signal_exchange_release(signal, 1);
ASSERT(0 == value);
value = hsa_signal_load_relaxed(signal);
ASSERT(1 == value);
value = hsa_signal_exchange_relaxed(signal, 0);
ASSERT(1 == value);
value = hsa_signal_load_relaxed(signal);
ASSERT(0 == value);
status = hsa_signal_destroy(signal);
ASSERT(HSA_STATUS_SUCCESS == status);
return;
}
void hsa_signal_cas_update_basic() {
hsa_signal_t signal;
hsa_status_t status = hsa_signal_create(0, 0, NULL, &signal);
ASSERT(HSA_STATUS_SUCCESS == status);
hsa_signal_value_t value;
value = hsa_signal_cas_acquire(signal, 0, 1);
ASSERT(0 == value);
value = hsa_signal_load_relaxed(signal);
ASSERT(1 == value);
value = hsa_signal_cas_acq_rel(signal, 1, 0);
ASSERT(1 == value);
value = hsa_signal_load_relaxed(signal);
ASSERT(0 == value);
value = hsa_signal_cas_release(signal, 0, 1);
ASSERT(0 == value);
value = hsa_signal_load_relaxed(signal);
ASSERT(1 == value);
value = hsa_signal_cas_relaxed(signal, 1, 0);
ASSERT(1 == value);
value = hsa_signal_load_relaxed(signal);
ASSERT(0 == value);
status = hsa_signal_destroy(signal);
ASSERT(HSA_STATUS_SUCCESS == status);
return;
}
void hsa_signal_add_update_basic() {
hsa_signal_t signal;
hsa_status_t status = hsa_signal_create(0, 0, NULL, &signal);
ASSERT(HSA_STATUS_SUCCESS == status);
hsa_signal_value_t value;
hsa_signal_add_acquire(signal, 1);
value = hsa_signal_load_relaxed(signal);
ASSERT(1 == value);
hsa_signal_add_acq_rel(signal, 1);
value = hsa_signal_load_relaxed(signal);
ASSERT(2 == value);
hsa_signal_add_release(signal, 1);
value = hsa_signal_load_relaxed(signal);
ASSERT(3 == value);
hsa_signal_add_relaxed(signal, 1);
value = hsa_signal_load_relaxed(signal);
ASSERT(4 == value);
status = hsa_signal_destroy(signal);
ASSERT(HSA_STATUS_SUCCESS == status);
return;
}
void hsa_signal_subtract_update_basic() {
hsa_signal_t signal;
hsa_status_t status = hsa_signal_create(4, 0, NULL, &signal);
ASSERT(HSA_STATUS_SUCCESS == status);
hsa_signal_value_t value;
hsa_signal_subtract_acquire(signal, 1);
value = hsa_signal_load_relaxed(signal);
ASSERT(3 == value);
hsa_signal_subtract_acq_rel(signal, 1);
value = hsa_signal_load_relaxed(signal);
ASSERT(2 == value);
hsa_signal_subtract_release(signal, 1);
value = hsa_signal_load_relaxed(signal);
ASSERT(1 == value);
hsa_signal_subtract_relaxed(signal, 1);
value = hsa_signal_load_relaxed(signal);
ASSERT(0 == value);
status = hsa_signal_destroy(signal);
ASSERT(HSA_STATUS_SUCCESS == status);
return;
}
void hsa_signal_and_update_basic() {
hsa_signal_t signal;
hsa_status_t status = hsa_signal_create(0x1111, 0, NULL, &signal);
ASSERT(HSA_STATUS_SUCCESS == status);
hsa_signal_value_t value;
hsa_signal_and_acquire(signal, 0x0111);
value = hsa_signal_load_relaxed(signal);
ASSERT(0x0111 == value);
hsa_signal_and_acq_rel(signal, 0x0011);
value = hsa_signal_load_relaxed(signal);
ASSERT(0x0011 == value);
hsa_signal_and_release(signal, 0x0001);
value = hsa_signal_load_relaxed(signal);
ASSERT(0x0001 == value);
hsa_signal_and_relaxed(signal, 0x0000);
value = hsa_signal_load_relaxed(signal);
ASSERT(0x0000 == value);
status = hsa_signal_destroy(signal);
ASSERT(HSA_STATUS_SUCCESS == status);
return;
}
void hsa_signal_or_update_basic() {
hsa_signal_t signal;
hsa_status_t status = hsa_signal_create(0x0000, 0, NULL, &signal);
ASSERT(HSA_STATUS_SUCCESS == status);
hsa_signal_value_t value;
hsa_signal_or_acquire(signal, 0x0001);
value = hsa_signal_load_relaxed(signal);
ASSERT(0x0001 == value);
hsa_signal_or_acq_rel(signal, 0x0010);
value = hsa_signal_load_relaxed(signal);
ASSERT(0x0011 == value);
hsa_signal_or_release(signal, 0x0100);
value = hsa_signal_load_relaxed(signal);
ASSERT(0x0111 == value);
hsa_signal_or_relaxed(signal, 0x1000);
value = hsa_signal_load_relaxed(signal);
ASSERT(0x1111 == value);
status = hsa_signal_destroy(signal);
ASSERT(HSA_STATUS_SUCCESS == status);
return;
}
void hsa_signal_xor_update_basic() {
hsa_signal_t signal;
hsa_status_t status = hsa_signal_create(0x0000, 0, NULL, &signal);
ASSERT(HSA_STATUS_SUCCESS == status);
hsa_signal_value_t value;
hsa_signal_xor_acquire(signal, 0x0001);
value = hsa_signal_load_relaxed(signal);
ASSERT(0x0001 == value);
hsa_signal_xor_acq_rel(signal, 0x0010);
value = hsa_signal_load_relaxed(signal);
ASSERT(0x0011 == value);
hsa_signal_xor_release(signal, 0x0100);
value = hsa_signal_load_relaxed(signal);
ASSERT(0x0111 == value);
hsa_signal_xor_relaxed(signal, 0x1000);
value = hsa_signal_load_relaxed(signal);
ASSERT(0x1111 == value);
status = hsa_signal_destroy(signal);
ASSERT(HSA_STATUS_SUCCESS == status);
return;
}
int test_signal_update_basic() {
hsa_status_t status;
status = hsa_init();
ASSERT(HSA_STATUS_SUCCESS == status);
hsa_signal_store_update_basic();
hsa_signal_exchange_update_basic();
hsa_signal_cas_update_basic();
hsa_signal_add_update_basic();
hsa_signal_subtract_update_basic();
hsa_signal_and_update_basic();
hsa_signal_or_update_basic();
hsa_signal_xor_update_basic();
status = hsa_shut_down();
ASSERT(HSA_STATUS_SUCCESS == status);
return 0;
}
| 29.7737 | 80 | 0.699979 |
2421177ff39c61781fc66fcf3f1c4fe2ca664224 | 376 | h | C | Util.h | ryancarr/CppND-System-Monitor | 4193d9b0c9850ea3a3d55a326e4153061f0c798f | [
"MIT"
] | null | null | null | Util.h | ryancarr/CppND-System-Monitor | 4193d9b0c9850ea3a3d55a326e4153061f0c798f | [
"MIT"
] | null | null | null | Util.h | ryancarr/CppND-System-Monitor | 4193d9b0c9850ea3a3d55a326e4153061f0c798f | [
"MIT"
] | null | null | null | #ifndef UTIL_H
#define UTIL_H
#include <fstream>
#include <string>
using std::ifstream;
using std::string;
using std::to_string;
using std::runtime_error;
// Classic helper function
class Util
{
public:
static string convertToTime ( long int);
static string getProgressBar(string);
static void getStream(string, ifstream&);
};
#endif // UTIL_H | 17.904762 | 49 | 0.699468 |
511497a073b67418c2b1f46ec375ad95012389a5 | 4,630 | h | C | aws-cpp-sdk-transcribe/include/aws/transcribe/model/GetCallAnalyticsJobResult.h | Nexuscompute/aws-sdk-cpp | e7ef485e46e6962c9e084b8c9b104c1bfcceaf26 | [
"Apache-2.0"
] | 1 | 2022-01-05T18:20:03.000Z | 2022-01-05T18:20:03.000Z | aws-cpp-sdk-transcribe/include/aws/transcribe/model/GetCallAnalyticsJobResult.h | Nexuscompute/aws-sdk-cpp | e7ef485e46e6962c9e084b8c9b104c1bfcceaf26 | [
"Apache-2.0"
] | null | null | null | aws-cpp-sdk-transcribe/include/aws/transcribe/model/GetCallAnalyticsJobResult.h | Nexuscompute/aws-sdk-cpp | e7ef485e46e6962c9e084b8c9b104c1bfcceaf26 | [
"Apache-2.0"
] | 1 | 2021-11-09T11:58:03.000Z | 2021-11-09T11:58:03.000Z | /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/transcribe/TranscribeService_EXPORTS.h>
#include <aws/transcribe/model/CallAnalyticsJob.h>
#include <utility>
namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;
namespace Utils
{
namespace Json
{
class JsonValue;
} // namespace Json
} // namespace Utils
namespace TranscribeService
{
namespace Model
{
class AWS_TRANSCRIBESERVICE_API GetCallAnalyticsJobResult
{
public:
GetCallAnalyticsJobResult();
GetCallAnalyticsJobResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
GetCallAnalyticsJobResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
/**
* <p>An object that contains detailed information about your call analytics job.
* Returned fields include: <code>CallAnalyticsJobName</code>,
* <code>CallAnalyticsJobStatus</code>, <code>ChannelDefinitions</code>,
* <code>CompletionTime</code>, <code>CreationTime</code>,
* <code>DataAccessRoleArn</code>, <code>FailureReason</code>,
* <code>IdentifiedLanguageScore</code>, <code>LanguageCode</code>,
* <code>Media</code>, <code>MediaFormat</code>, <code>MediaSampleRateHertz</code>,
* <code>Settings</code>, <code>StartTime</code>, and <code>Transcript</code>.</p>
*/
inline const CallAnalyticsJob& GetCallAnalyticsJob() const{ return m_callAnalyticsJob; }
/**
* <p>An object that contains detailed information about your call analytics job.
* Returned fields include: <code>CallAnalyticsJobName</code>,
* <code>CallAnalyticsJobStatus</code>, <code>ChannelDefinitions</code>,
* <code>CompletionTime</code>, <code>CreationTime</code>,
* <code>DataAccessRoleArn</code>, <code>FailureReason</code>,
* <code>IdentifiedLanguageScore</code>, <code>LanguageCode</code>,
* <code>Media</code>, <code>MediaFormat</code>, <code>MediaSampleRateHertz</code>,
* <code>Settings</code>, <code>StartTime</code>, and <code>Transcript</code>.</p>
*/
inline void SetCallAnalyticsJob(const CallAnalyticsJob& value) { m_callAnalyticsJob = value; }
/**
* <p>An object that contains detailed information about your call analytics job.
* Returned fields include: <code>CallAnalyticsJobName</code>,
* <code>CallAnalyticsJobStatus</code>, <code>ChannelDefinitions</code>,
* <code>CompletionTime</code>, <code>CreationTime</code>,
* <code>DataAccessRoleArn</code>, <code>FailureReason</code>,
* <code>IdentifiedLanguageScore</code>, <code>LanguageCode</code>,
* <code>Media</code>, <code>MediaFormat</code>, <code>MediaSampleRateHertz</code>,
* <code>Settings</code>, <code>StartTime</code>, and <code>Transcript</code>.</p>
*/
inline void SetCallAnalyticsJob(CallAnalyticsJob&& value) { m_callAnalyticsJob = std::move(value); }
/**
* <p>An object that contains detailed information about your call analytics job.
* Returned fields include: <code>CallAnalyticsJobName</code>,
* <code>CallAnalyticsJobStatus</code>, <code>ChannelDefinitions</code>,
* <code>CompletionTime</code>, <code>CreationTime</code>,
* <code>DataAccessRoleArn</code>, <code>FailureReason</code>,
* <code>IdentifiedLanguageScore</code>, <code>LanguageCode</code>,
* <code>Media</code>, <code>MediaFormat</code>, <code>MediaSampleRateHertz</code>,
* <code>Settings</code>, <code>StartTime</code>, and <code>Transcript</code>.</p>
*/
inline GetCallAnalyticsJobResult& WithCallAnalyticsJob(const CallAnalyticsJob& value) { SetCallAnalyticsJob(value); return *this;}
/**
* <p>An object that contains detailed information about your call analytics job.
* Returned fields include: <code>CallAnalyticsJobName</code>,
* <code>CallAnalyticsJobStatus</code>, <code>ChannelDefinitions</code>,
* <code>CompletionTime</code>, <code>CreationTime</code>,
* <code>DataAccessRoleArn</code>, <code>FailureReason</code>,
* <code>IdentifiedLanguageScore</code>, <code>LanguageCode</code>,
* <code>Media</code>, <code>MediaFormat</code>, <code>MediaSampleRateHertz</code>,
* <code>Settings</code>, <code>StartTime</code>, and <code>Transcript</code>.</p>
*/
inline GetCallAnalyticsJobResult& WithCallAnalyticsJob(CallAnalyticsJob&& value) { SetCallAnalyticsJob(std::move(value)); return *this;}
private:
CallAnalyticsJob m_callAnalyticsJob;
};
} // namespace Model
} // namespace TranscribeService
} // namespace Aws
| 44.951456 | 140 | 0.711879 |
dff392aa4dcf67e06a021d49b1028476fc24edc4 | 4,246 | h | C | Game_of_Life/Board.h | BG43/Game-of-Life | d057845b68cf00a1761e2135ce3dcb87a99ea43e | [
"MIT"
] | 2 | 2020-06-25T01:15:34.000Z | 2020-07-07T05:31:32.000Z | Game_of_Life/Board.h | BG43/Game-of-Life | d057845b68cf00a1761e2135ce3dcb87a99ea43e | [
"MIT"
] | null | null | null | Game_of_Life/Board.h | BG43/Game-of-Life | d057845b68cf00a1761e2135ce3dcb87a99ea43e | [
"MIT"
] | 1 | 2020-06-26T12:20:15.000Z | 2020-06-26T12:20:15.000Z | #pragma once
#include <iostream>
#include <algorithm>
using namespace std;
class Board {
bool board[21][21]{ 0 };
int neighbourCount{ 0 };
public:
// setCell will change the state (false|true) of a certain cell
// it will return the previous state of the cell just modified
bool setCell(int x, int y, bool state)
{
x %= 21;
y %= 21;
auto previous = board[x][y];
board[x][y] = state;
return previous;
}
bool getCell(int x, int y)
{
return board[y % 21][x % 21];
}
// 00000 00000
// 01000 00000
// 00000 => 00100
// 00000 00000
// 00000 00000
// go through the board and calculate the next generation
// for our first iteration: just move each cell diagonally
Board next()
{
Board result;
// ... take the state of the current board,
//auto t = board[i][j]; how to read the initial board
//result.setCell(1, 1, true); how to write into the resulting board
// int neighboursBasic =
// board[i-1][j] ? 1 : 0 +
// board[i-1][j+1] ? 1 : 0 +
// board[i][j+1] ? 1 : 0 +
// board[i+1][j+1] ? 1 : 0 +
// board[i-1][j] ? 1 : 0 +
// board[i-1][j] ? 1 : 0 +
// board[i-1][j] ? 1 : 0 +
// board[i-1][j] ? 1 : 0;
static const int neighbourOffsets[8][2] {
{-1,0}, // N
{-1,1}, // NE
{0,1}, // E
{1,1}, // SE
{1,0}, // S
{1,-1}, // SW
{0,-1}, // W
{-1,-1} // NW
};
// three rules
// => for each of the cells
for (int i = 1; i < 21; i++) {
for (int j = 1; j < 21; j++) {
// => count its neighbourgs
// given i,j apply neighbourOffsets to them
// ? how do we count the neighbours?
// 8 neighbours: (i,j)
// north: (i-1,j)
// north-east: (i-1,j+1)
for (int k = 0; k < 8; k++) {
auto temp_i{ 0 };
auto temp_j{ 0 };
for (int l = 0; l < 2; l++) {
if (l == 0) temp_i = result.board[i][j] + neighbourOffsets[k][l];
if (l == 1) temp_j = result.board[i][j] + neighbourOffsets[k][l];
if (0 < l) {
if (result.board[i + temp_i][j + temp_j]) {
neighbourCount++;
result.board[i - temp_i][j - temp_j];
}
}
}
}
// I do not understand this?????
/*auto neighbours = std::count_if(neighbourOffsets,
neighbourOffsets + 8,
[&](const int offset[2]){ return board[i+offset[0]][j+offset[1]]; });*/
// => decide, depending on the count:
// 2 or 3 => Any live cell with two or three live neighbours survives.
// 3 => Any dead cell with three live neighbours becomes a live cell.
if ((neighbourCount == 2 || neighbourCount == 3) || ((result.board[i][j] == false && neighbourCount == 3))) {
result.board[i][j] = true;
}
// any other => All other live cells die in the next generation.
// Similarly, all other dead cells stay dead.
else {
result.board[i][j] = false;
}
// result started with all cells dead (all false)
// for each cell that needs to be alive on the next generation,
//
}
}
return result;
// cout<<
}
void print() {
for (int i = 1; i < 21; i++) {
for (int j = 1; j < 21; j++) {
cout << board[i][j];
}
cout << endl;
}
}
};
| 30.546763 | 125 | 0.400141 |
24777ef2465968061261a171a91c0cb1e5d2114d | 7,866 | c | C | lites/emulator/e_uname.c | eyadhamdan4/xMach | 38272d98114715a10e77c2c014e16c9782f7807c | [
"BSD-3-Clause"
] | 7 | 2021-06-08T06:08:12.000Z | 2021-11-06T02:02:24.000Z | lites/emulator/e_uname.c | eyadhamdan4/xMach | 38272d98114715a10e77c2c014e16c9782f7807c | [
"BSD-3-Clause"
] | 2 | 2021-08-30T12:05:35.000Z | 2022-01-24T07:34:52.000Z | lites/emulator/e_uname.c | eyadhamdan4/xMach | 38272d98114715a10e77c2c014e16c9782f7807c | [
"BSD-3-Clause"
] | 3 | 2021-06-24T20:42:42.000Z | 2021-10-03T21:34:11.000Z | /*
* Mach Operating System
* Copyright (c) 1994 Johannes Helander
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* JOHANNES HELANDER ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. JOHANNES HELANDER DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*/
/*
* HISTORY
* $Log: e_uname.c,v $
* Revision 1.3 2000/11/07 00:41:25 welchd
*
* Added support for executing dynamically linked Linux ELF binaries
*
* Revision 1.2 2000/10/27 01:55:27 welchd
*
* Updated to latest source
*
* Revision 1.1.1.1 1995/03/02 21:49:28 mike
* Initial Lites release from hut.fi
*
*/
/*
* File: emulator/e_uname.c
* Author: Johannes Helander, Helsinki University of Technology, 1994.
*
* Uname in a few different flavors.
*/
/*-
* Copyright (c) 1994
* The Regents of the University of California. 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. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University 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 REGENTS 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 REGENTS 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.
*/
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)uname.c 8.1 (Berkeley) 1/4/94";
#endif /* LIBC_SCCS and not lint */
#include <e_defs.h>
#include <sys/param.h>
#include <sys/sysctl.h>
#include <sys/utsname.h>
struct lite_utsname {
char sysname[256]; /* Name of this OS. */
char nodename[256]; /* Name of this network node. */
char release[256]; /* Release level. */
char version[256]; /* Version level. */
char machine[256]; /* Hardware type. */
};
struct bnr_utsname {
char sysname[32]; /* Name of this OS. */
char nodename[32]; /* Name of this network node. */
char release[32]; /* Release level. */
char version[32]; /* Version level. */
char machine[32]; /* Hardware type. */
};
struct linux_utsname {
char sysname[65];
char nodename[65];
char release[65];
char version[65];
char machine[65];
char domainname[65];
};
errno_t e_lite_uname(struct lite_utsname *name)
{
int mib[2];
size_t len;
char *p;
errno_t err, rval;
rval = 0;
mib[0] = CTL_KERN;
mib[1] = KERN_OSTYPE;
len = sizeof(name->sysname);
if (err = e_sysctl(mib, 2, &name->sysname, &len, NULL, 0))
rval = err;
mib[0] = CTL_KERN;
mib[1] = KERN_HOSTNAME;
len = sizeof(name->nodename);
if (err = e_sysctl(mib, 2, &name->nodename, &len, NULL, 0))
rval = err;
mib[0] = CTL_KERN;
mib[1] = KERN_OSRELEASE;
len = sizeof(name->release);
if (err = e_sysctl(mib, 2, &name->release, &len, NULL, 0))
rval = err;
/* The version may have newlines in it, turn them into spaces. */
mib[0] = CTL_KERN;
mib[1] = KERN_VERSION;
len = sizeof(name->version);
if (err = e_sysctl(mib, 2, &name->version, &len, NULL, 0))
rval = err;
else
for (p = name->version; len--; ++p)
if (*p == '\n' || *p == '\t')
if (len > 1)
*p = ' ';
else
*p = '\0';
mib[0] = CTL_HW;
mib[1] = HW_MACHINE;
len = sizeof(name->machine);
if (err = e_sysctl(mib, 2, &name->machine, &len, NULL, 0))
rval = err;
return rval;
}
errno_t e_bnr_uname(struct bnr_utsname *name)
{
int mib[2];
size_t len;
char *p;
errno_t err, rval;
char version[256];
rval = 0;
mib[0] = CTL_KERN;
mib[1] = KERN_OSTYPE;
len = sizeof(name->sysname);
if (err = e_sysctl(mib, 2, &name->sysname, &len, NULL, 0))
rval = err;
mib[0] = CTL_KERN;
mib[1] = KERN_HOSTNAME;
len = sizeof(name->nodename);
if (err = e_sysctl(mib, 2, &name->nodename, &len, NULL, 0))
rval = err;
mib[0] = CTL_KERN;
mib[1] = KERN_OSRELEASE;
len = sizeof(name->release);
if (err = e_sysctl(mib, 2, &name->release, &len, NULL, 0))
rval = err;
/* The version may have newlines in it, turn them into spaces. */
/*
* sysctl doesn't copy anything if the space is too short.
* Here get as much as we can instead.
*/
mib[0] = CTL_KERN;
mib[1] = KERN_VERSION;
len = sizeof(version);
if (err = e_sysctl(mib, 2, version, &len, NULL, 0)) {
rval = err;
} else {
for (p = version; len--; ++p)
if (*p == '\n' || *p == '\t')
if (len > 1)
*p = ' ';
else
*p = '\0';
version[31] = '\0';
bcopy(version, name->version, 32);
}
mib[0] = CTL_HW;
mib[1] = HW_MACHINE;
len = sizeof(name->machine);
if (err = e_sysctl(mib, 2, &name->machine, &len, NULL, 0))
rval = err;
return ESUCCESS; /* XXX */
}
errno_t e_linux_uname(struct linux_utsname *name)
{
int mib[2];
size_t len;
char *p;
errno_t err, rval;
rval = 0;
#if 0
mib[0] = CTL_KERN;
mib[1] = KERN_OSTYPE;
len = sizeof(name->sysname);
if (err = e_sysctl(mib, 2, &name->sysname, &len, NULL, 0)) {
rval = err;
strcpy((void *) &name->sysname, "sysname");
}
#endif
strcpy((void *) &name->sysname, "Linux");
mib[0] = CTL_KERN;
mib[1] = KERN_HOSTNAME;
len = sizeof(name->nodename);
if (err = e_sysctl(mib, 2, &name->nodename, &len, NULL, 0)) {
rval = err;
strcpy((void *) &name->nodename, "nodename");
}
#if 0
mib[0] = CTL_KERN;
mib[1] = KERN_OSRELEASE;
len = sizeof(name->release);
if (err = e_sysctl(mib, 2, &name->release, &len, NULL, 0)) {
rval = err;
strcpy((void *) &name->release, "sysname");
}
#endif
strcpy(&name->release, "2.4.0-test8");
#if 0
/* The version may have newlines in it, turn them into spaces. */
mib[0] = CTL_KERN;
mib[1] = KERN_VERSION;
len = sizeof(name->version);
if (err = e_sysctl(mib, 2, &name->version, &len, NULL, 0)) {
rval = err;
strcpy((void *) &name->version, "version");
} else
for (p = name->version; len--; ++p)
if (*p == '\n' || *p == '\t')
if (len > 1)
*p = ' ';
else
*p = '\0';
#endif
strcpy((void *) &name->version, "#9");
#if 0
mib[0] = CTL_HW;
mib[1] = HW_MACHINE;
len = sizeof(name->machine);
if (err = e_sysctl(mib, 2, &name->machine, &len, NULL, 0)) {
rval = err;
strcpy((void *) &name->sysname, "machine");
}
#endif
strcpy((void *) &name->sysname, "i386");
name->domainname[0] = '\0';
return ESUCCESS; /* XXX */
}
| 27.893617 | 77 | 0.648996 |
2afc37d2ef3b02875539810c552b9fc0fb954aec | 18,391 | h | C | include/common/variant.h | timxx/wpsrpc-sdk | 6a7008ea0f94005b1745877fb4b071cdbab8890f | [
"FSFAP"
] | 98 | 2020-01-19T01:27:43.000Z | 2022-03-31T14:55:00.000Z | include/common/variant.h | timxx/wpsrpc-sdk | 6a7008ea0f94005b1745877fb4b071cdbab8890f | [
"FSFAP"
] | 45 | 2020-03-08T14:25:24.000Z | 2022-03-29T07:02:43.000Z | include/common/variant.h | timxx/wpsrpc-sdk | 6a7008ea0f94005b1745877fb4b071cdbab8890f | [
"FSFAP"
] | 30 | 2020-01-19T01:27:45.000Z | 2022-03-29T06:19:21.000Z | /*
** Copyright @ 2012-2019, Kingsoft office,All rights reserved.
**
** Redistribution and use in source and binary forms ,without modification and
** selling solely, 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.
**
** SPECIAL NOTE:THIS SOFTWARE IS NOT PERMITTED TO BE MODIFIED OR SOLD SOLELY AT
** ANY TIME AND UNDER ANY CIRCUMSTANCES, EXCEPT WITH THE WRITTEN PERMISSION OF
** KINGSOFT OFFICE
**
** 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 __KFC_VARIANT_H__
#define __KFC_VARIANT_H__
#ifndef ASSERT
#define ASSERT(f)
#endif
interface IUnknown;
interface IDispatch;
_KFC_BEGIN
// -------------------------------------------------------------------------
class KComVariant : public tagVARIANT
{
public:
enum { npos = -1 };
public:
KComVariant()
{
V_VT(this) = VT_EMPTY;
}
KComVariant(const VARIANT& varSrc)
{
V_VT(this) = VT_EMPTY;
Copy(&varSrc);
}
KComVariant(const KComVariant& varSrc)
{
V_VT(this) = VT_EMPTY;
Copy(&varSrc);
}
KComVariant(int32 nSrc, VARTYPE vtSrc = VT_I4)
{
V_VT(this) = vtSrc;
V_I4(this) = nSrc;
}
KComVariant(uint32 nSrc, VARTYPE vtSrc = VT_I4)
{
V_VT(this) = vtSrc;
V_I4(this) = nSrc;
}
#ifndef X_BIT_64
#ifdef X_OS_WINDOWS
KComVariant(DWORD nSrc, VARTYPE vtSrc = VT_I4)
#else
KComVariant(long nSrc, VARTYPE vtSrc = VT_I4)
#endif
{
V_VT(this) = vtSrc;
V_I4(this) = nSrc;
}
#endif
KComVariant(int64 nSrc, VARTYPE vtSrc = VT_I8)
{
V_VT(this) = vtSrc;
V_I8(this) = nSrc;
}
KComVariant(uint64 nSrc, VARTYPE vtSrc = VT_I8)
{
V_VT(this) = vtSrc;
V_I8(this) = nSrc;
}
KComVariant(double nSrc, VARTYPE vtSrc = VT_R8)
{
V_VT(this) = vtSrc;
V_R8(this) = nSrc;
}
KComVariant(CURRENCY cySrc)
{
V_VT(this) = VT_CY;
V_CY(this) = cySrc;
}
KComVariant(IDispatch* pSrc)
{
V_VT(this) = VT_DISPATCH;
V_DISPATCH(this) = pSrc;
if (V_DISPATCH(this) != NULL)
((IUnknown*)V_DISPATCH(this))->AddRef();
}
KComVariant(IUnknown* pSrc)
{
V_VT(this) = VT_UNKNOWN;
V_UNKNOWN(this) = pSrc;
if (V_UNKNOWN(this) != NULL)
V_UNKNOWN(this)->AddRef();
}
KComVariant(void* ptr)
{
V_VT(this) = VT_PTR;
V_BYREF(this) = ptr;
}
KComVariant(LPCOLESTR lpszSrc, int cch = npos)
{
V_VT(this) = VT_EMPTY;
if (cch < 0 && lpszSrc)
{
LPCOLESTR lpszSrcMax = lpszSrc;
while (*lpszSrcMax)
++lpszSrcMax;
cch = lpszSrcMax - lpszSrc;
}
Assign(lpszSrc, cch);
}
~KComVariant()
{
Clear();
}
public:
HRESULT Clear()
{
return VariantClear(this);
}
HRESULT Copy(const VARIANT* pSrc)
{
return VariantCopy(this, (VARIANT*)(pSrc));
}
HRESULT ChangeType(VARTYPE vtNew, const VARIANT* pSrc = NULL)
{
VARIANT* pVar = (VARIANT*)(pSrc);
if (pVar == NULL)
pVar = this;
if (pVar != this)
Clear();
return VariantChangeType(this, pVar, 0, vtNew);
}
public:
HRESULT Attach(BSTR bstrSrc)
{
V_VT(this) = VT_BSTR;
V_BSTR(this) = bstrSrc;
return S_OK;
}
HRESULT Attach(VARIANT* pSrc)
{
HRESULT hr = Clear();
if (!FAILED(hr))
{
memcpy(this, pSrc, sizeof(VARIANT));
V_VT(pSrc) = VT_EMPTY;
hr = S_OK;
}
return hr;
}
HRESULT Detach(VARIANT* pDest)
{
HRESULT hr = VariantClear(pDest);
if (!FAILED(hr))
{
memcpy(pDest, this, sizeof(VARIANT));
V_VT(this) = VT_EMPTY;
hr = S_OK;
}
return hr;
}
public:
KComVariant& Assign(const VARIANT& varSrc)
{
Copy(&varSrc);
return *this;
}
KComVariant& Assign(int32 nSrc, VARTYPE vtSrc = VT_I4)
{
Clear();
V_VT(this) = vtSrc;
V_I4(this) = nSrc;
return *this;
}
KComVariant& Assign(uint32 nSrc, VARTYPE vtSrc = VT_I4)
{
Clear();
V_VT(this) = vtSrc;
V_I4(this) = nSrc;
return *this;
}
#ifndef X_BIT_64
#ifdef X_OS_WINDOWS
KComVariant& Assign(DWORD nSrc, VARTYPE vtSrc = VT_I4)
#else
KComVariant& Assign(long nSrc, VARTYPE vtSrc = VT_I4)
#endif
{
Clear();
V_VT(this) = vtSrc;
V_I4(this) = nSrc;
return *this;
}
#endif
KComVariant& Assign(int64 nSrc, VARTYPE vtSrc = VT_I8)
{
Clear();
V_VT(this) = vtSrc;
V_I8(this) = nSrc;
return *this;
}
KComVariant& Assign(uint64 nSrc, VARTYPE vtSrc = VT_I8)
{
Clear();
V_VT(this) = vtSrc;
V_I8(this) = nSrc;
return *this;
}
KComVariant& Assign(double dblSrc, VARTYPE vtSrc = VT_R8)
{
return AssignDouble(dblSrc);
}
KComVariant& Assign(LPCOLESTR lpszSrc, int cch)
{
Clear();
V_VT(this) = VT_BSTR;
if (lpszSrc == NULL)
{
V_BSTR(this) = NULL;
}
else
{
V_BSTR(this) = SysAllocStringLen(lpszSrc, cch);
if (V_BSTR(this) == NULL && cch)
{
V_VT(this) = VT_ERROR;
V_ERROR(this) = E_OUTOFMEMORY;
}
}
return *this;
}
KComVariant& AssignString(LPCOLESTR lpszSrc)
{
LPCOLESTR lpszSrcMax = lpszSrc;
if (lpszSrcMax)
{
while (*lpszSrcMax)
++lpszSrcMax;
}
return Assign(lpszSrc, lpszSrcMax - lpszSrc);
}
KComVariant& AssignBSTR(BSTR bstrSrc)
{
return Assign(bstrSrc, SysStringLen(bstrSrc));
}
KComVariant& AssignDate(DATE dtSrc)
{
Clear();
V_VT(this)= VT_DATE;
V_DATE(this) = dtSrc;
return *this;
}
KComVariant& AssignDouble(double dblSrc)
{
Clear();
V_VT(this)= VT_R8;
V_R8(this) = dblSrc;
return *this;
}
KComVariant& AssignBOOL(BOOL bSrc)
{
Clear();
V_VT(this) = VT_BOOL;
V_BOOL(this) = bSrc != 0 ? VARIANT_TRUE : VARIANT_FALSE;
return *this;
}
public:
KComVariant& operator=(const KComVariant& varSrc)
{
Copy(&varSrc);
return *this;
}
KComVariant& operator=(const VARIANT& varSrc)
{
Copy(&varSrc);
return *this;
}
KComVariant& operator=(int nSrc)
{
if (V_VT(this) != VT_I4)
{
Clear();
V_VT(this) = VT_I4;
}
V_I4(this) = nSrc;
return *this;
}
KComVariant& operator=(CURRENCY cySrc)
{
if (V_VT(this) != VT_CY)
{
Clear();
V_VT(this) = VT_CY;
}
V_CY(this) = cySrc;
return *this;
}
KComVariant& operator=(IDispatch* pSrc)
{
Clear();
V_VT(this) = VT_DISPATCH;
V_DISPATCH(this) = pSrc;
if (V_DISPATCH(this)!= NULL)
((IUnknown*)V_DISPATCH(this))->AddRef();
return *this;
}
KComVariant& operator=(IUnknown* pSrc)
{
Clear();
V_VT(this) = VT_UNKNOWN;
V_UNKNOWN(this) = pSrc;
if (V_UNKNOWN(this)!= NULL)
V_UNKNOWN(this)->AddRef();
return *this;
}
KComVariant& operator=(void* ptr)
{
Clear();
V_VT(this) = VT_PTR;
V_BYREF(this) = ptr;
return *this;
}
KComVariant& operator=(LPCOLESTR lpszSrc)
{
return AssignString(lpszSrc);
}
public:
bool operator==(const VARIANT& varSrc) const
{
if (this == &varSrc)
return true;
if (V_VT(this) != V_VT(&varSrc))
return false;
switch (V_VT(this))
{
case VT_EMPTY:
case VT_NULL:
return true;
case VT_I4:
return V_I4(this) == V_I4(&varSrc);
case VT_I8:
return V_I8(this) == V_I8(&varSrc);
case VT_R8:
return V_R8(this) == V_R8(&varSrc);
case VT_ERROR:
return V_ERROR(this) == V_ERROR(&varSrc);
case VT_BSTR:
return (SysStringLen(V_BSTR(this)) == SysStringLen(V_BSTR(&varSrc))) &&
(memcmp(V_BSTR(this), V_BSTR(&varSrc), SysStringLen(V_BSTR(this))*sizeof(OLECHAR)) == 0);
case VT_BOOL:
return V_BOOL(this) == V_BOOL(&varSrc);
case VT_UI1:
return V_UI1(this) == V_UI1(&varSrc);
case VT_I2:
return V_I2(this) == V_I2(&varSrc);
case VT_R4:
return V_R4(this) == V_R4(&varSrc);
case VT_DISPATCH:
return V_DISPATCH(this) == V_DISPATCH(&varSrc);
case VT_UNKNOWN:
return V_UNKNOWN(this) == V_UNKNOWN(&varSrc);
case VT_PTR:
return V_BYREF(this) == V_BYREF(&varSrc);
case VT_DATE:
{
DATE lhs = V_DATE(this);
DATE rhs = V_DATE(&varSrc);
if (fuzzyIsNull(lhs) && fuzzyIsNull(rhs))
return true;
if (fuzzyIsNull(lhs) || fuzzyIsNull(rhs))
return false;
return fuzzyCompare(lhs, rhs);
}
default:
ASSERT(false);
}
return false;
}
bool operator!=(const VARIANT& varSrc) const
{
return !operator==(varSrc);
}
private:
double abs(const double &t) const
{
return t >= 0 ? t : -t;
}
double min(const double &a, const double &b) const
{
return (a < b) ? a : b;
}
bool fuzzyCompare(double p1, double p2) const
{
return (abs(p1 - p2) <= 0.000000000001 * min(abs(p1), abs(p2)));
}
bool fuzzyIsNull(double d) const
{
return abs(d) <= 0.000000000001;
}
};
// -------------------------------------------------------------------------
class KFakeCopyVaraint : public VARIANT
{
public:
KFakeCopyVaraint()
{
ZeroMemory(this, sizeof(*this));
V_VT(this) = VT_EMPTY;
}
KFakeCopyVaraint(VARIANT* pSrcVar)
{
ZeroMemory(this, sizeof(*this));
if (!pSrcVar)
V_VT(this) = VT_EMPTY;
else
_ProcessVaraint(*pSrcVar);
}
KFakeCopyVaraint(const VARIANT& srcVar)
{
ZeroMemory(this, sizeof(*this));
_ProcessVaraint(srcVar);
}
~KFakeCopyVaraint()
{
if (_NeedClear())
_Clear();
}
KFakeCopyVaraint& operator=(const VARIANT& srcVar)
{
if (_NeedClear())
_Clear();
_ProcessVaraint(srcVar);
return *this;
}
KFakeCopyVaraint& operator=(const VARIANT* pSrcVar)
{
if (pSrcVar)
{
if (_NeedClear())
_Clear();
_ProcessVaraint(*pSrcVar);
}
return *this;
}
/*不要随便去改变KFakeCopyVaraint的内容,因为改变了它可能会引起内存问题,这两个操作符const一下*/
const VARIANT& operator*() const
{
return *this;
}
const VARIANT* operator&() const
{
return this;
}
private:
void _ProcessVaraint(const VARIANT& srcVar)
{
if (V_ISBYREF(&srcVar))
_ProcessRefVaraint(srcVar);
else
_ProcessNormalVaraint(srcVar);
}
void _Clear()
{
if (_NeedClear())
VariantClear(this);
}
void _ProcessNormalVaraint(const VARIANT& srcVar)
{
if(V_ISBYREF(&srcVar))
return;
VARTYPE srcVt = V_VT(&srcVar);
VARTYPE vtType = srcVt & VT_TYPEMASK;
if (VT_ARRAY & srcVt)
{
V_ARRAY(this) = V_ARRAY(&srcVar);
V_VT(this) = srcVt;
return;
}
switch (vtType)
{
case VT_EMPTY:
V_VT(this) = srcVt;
break;
case VT_NULL:
V_VT(this) = srcVt;
break;
case VT_I2:
V_I2(this) = V_I2(&srcVar);
V_VT(this) = srcVt;
break;
case VT_I4:
V_I4(this) = V_I4(&srcVar);
V_VT(this) = srcVt;
break;
case VT_R4:
V_R4(this) = V_R4(&srcVar);
V_VT(this) = srcVt;
break;
case VT_R8:
V_R8(this) = V_R8(&srcVar);
V_VT(this) = srcVt;
break;
case VT_CY:
V_CY(this) = V_CY(&srcVar);
V_VT(this) = srcVt;
break;
case VT_DATE:
V_DATE(this) = V_DATE(&srcVar);
V_VT(this) = srcVt;
break;
case VT_BSTR:
V_BSTR(this) = V_BSTR(&srcVar);
V_VT(this) = srcVt;
break;
case VT_DISPATCH:
V_DISPATCH(this) = V_DISPATCH(&srcVar);
V_VT(this) = srcVt;
break;
case VT_ERROR:
V_ERROR(this) = V_ERROR(&srcVar);
V_VT(this) = srcVt;
break;
case VT_BOOL:
V_BOOL(this) = V_BOOL(&srcVar);
V_VT(this) = srcVt;
break;
case VT_VARIANT:
ASSERT(FALSE);
break;
case VT_UNKNOWN:
V_UNKNOWN(this) = V_UNKNOWN(&srcVar);
V_VT(this) = srcVt;
break;
case VT_DECIMAL:
V_DECIMAL(this) = V_DECIMAL(&srcVar);
V_VT(this) = srcVt;
break;
case VT_I1:
V_I1(this) = V_I1(&srcVar);
V_VT(this) = srcVt;
break;
case VT_UI1:
V_UI1(this) = V_UI1(&srcVar);
V_VT(this) = srcVt;
break;
case VT_UI2:
V_UI2(this) = V_UI2(&srcVar);
V_VT(this) = srcVt;
break;
case VT_UI4:
V_UI4(this) = V_UI4(&srcVar);
V_VT(this) = srcVt;
break;
case VT_I8:
V_I8(this) = V_I8(&srcVar);
V_VT(this) = srcVt;
break;
case VT_UI8:
V_UI8(this) = V_UI8(&srcVar);
V_VT(this) = srcVt;
break;
case VT_INT:
V_INT(this) = V_INT(&srcVar);
V_VT(this) = srcVt;
break;
case VT_UINT:
V_UINT(this) = V_UINT(&srcVar);
V_VT(this) = srcVt;
break;
case VT_HRESULT:
V_I4(this) = V_I4(&srcVar);
V_VT(this) = srcVt;
break;
case VT_SAFEARRAY:
V_ARRAY(this) = V_ARRAY(&srcVar);
V_VT(this) = srcVt;
break;
case VT_CARRAY:
V_ARRAY(this) = V_ARRAY(&srcVar);
V_VT(this) = srcVt;
break;
case VT_INT_PTR:
V_INT_PTR(this) = V_INT_PTR(&srcVar);
V_VT(this) = srcVt;
break;
case VT_UINT_PTR:
V_UINT_PTR(this) = V_UINT_PTR(&srcVar);
V_VT(this) = srcVt;
break;
case VT_VOID:
case VT_PTR:
case VT_USERDEFINED:
case VT_LPSTR:
case VT_LPWSTR:
case VT_RECORD:
case VT_FILETIME:
case VT_BLOB:
case VT_STREAM:
case VT_STORAGE:
case VT_STREAMED_OBJECT:
case VT_STORED_OBJECT:
case VT_BLOB_OBJECT:
case VT_CF:
case VT_CLSID:
case VT_VERSIONED_STREAM:
case VT_BSTR_BLOB:
VariantCopy(this, &srcVar);
break;
default:
ASSERT(FALSE);
VariantCopy(this, &srcVar);
break;
}
return;
}
void _ProcessRefVaraint(const VARIANT& srcVar)
{
if (!V_ISBYREF(&srcVar))
return;
VARTYPE srcVt = V_VT(&srcVar);
VARTYPE vtFlag = (srcVt & ~VT_TYPEMASK) & ~VT_BYREF;
VARTYPE vtType = srcVt & VT_TYPEMASK;
if (VT_ARRAY & vtFlag)
{
V_ARRAYREF(this) = V_ARRAYREF(&srcVar);
V_VT(this) = srcVt;
return;
}
switch (vtType)
{
case VT_EMPTY:
V_VT(this) = srcVt;
break;
case VT_NULL:
V_VT(this) = srcVt;
break;
case VT_I2:
V_I2REF(this) = V_I2REF(&srcVar);
V_VT(this) = srcVt;
break;
case VT_I4:
V_I4REF(this) = V_I4REF(&srcVar);
V_VT(this) = srcVt;
break;
case VT_R4:
V_R4REF(this) = V_R4REF(&srcVar);
V_VT(this) = srcVt;
break;
case VT_R8:
V_R8REF(this) = V_R8REF(&srcVar);
V_VT(this) = srcVt;
break;
case VT_CY:
V_CYREF(this) = V_CYREF(&srcVar);
V_VT(this) = srcVt;
break;
case VT_DATE:
V_DATEREF(this) = V_DATEREF(&srcVar);
V_VT(this) = srcVt;
break;
case VT_BSTR:
V_BSTRREF(this) = V_BSTRREF(&srcVar);
V_VT(this) = srcVt;
break;
case VT_DISPATCH:
V_DISPATCHREF(this) = V_DISPATCHREF(&srcVar);
V_VT(this) = srcVt;
break;
case VT_ERROR:
V_ERRORREF(this) = V_ERRORREF(&srcVar);
V_VT(this) = srcVt;
break;
case VT_BOOL:
V_BOOLREF(this) = V_BOOLREF(&srcVar);
V_VT(this) = srcVt;
break;
case VT_VARIANT:
V_VARIANTREF(this) = V_VARIANTREF(&srcVar);
V_VT(this) = srcVt;
break;
case VT_UNKNOWN:
V_UNKNOWNREF(this) = V_UNKNOWNREF(&srcVar);
V_VT(this) = srcVt;
break;
case VT_DECIMAL:
V_DECIMALREF(this) = V_DECIMALREF(&srcVar);
V_VT(this) = srcVt;
break;
case VT_I1:
V_I1REF(this) = V_I1REF(&srcVar);
V_VT(this) = srcVt;
break;
case VT_UI1:
V_UI1REF(this) = V_UI1REF(&srcVar);
V_VT(this) = srcVt;
break;
case VT_UI2:
V_UI2REF(this) = V_UI2REF(&srcVar);
V_VT(this) = srcVt;
break;
case VT_UI4:
V_UI4REF(this) = V_UI4REF(&srcVar);
V_VT(this) = srcVt;
break;
case VT_I8:
V_I8REF(this) = V_I8REF(&srcVar);
V_VT(this) = srcVt;
break;
case VT_UI8:
V_UI8REF(this) = V_UI8REF(&srcVar);
V_VT(this) = srcVt;
break;
case VT_INT:
V_INTREF(this) = V_INTREF(&srcVar);
V_VT(this) = srcVt;
break;
case VT_UINT:
V_UINTREF(this) = V_UINTREF(&srcVar);
V_VT(this) = srcVt;
break;
case VT_HRESULT:
V_I4REF(this) = V_I4REF(&srcVar);
V_VT(this) = srcVt;
break;
case VT_SAFEARRAY:
V_ARRAYREF(this) = V_ARRAYREF(&srcVar);
V_VT(this) = srcVt;
break;
case VT_CARRAY:
V_ARRAYREF(this) = V_ARRAYREF(&srcVar);
V_VT(this) = srcVt;
break;
case VT_INT_PTR:
V_INT_PTRREF(this) = V_INT_PTRREF(&srcVar);
V_VT(this) = srcVt;
break;
case VT_UINT_PTR:
V_UINT_PTRREF(this) = V_UINT_PTRREF(&srcVar);
V_VT(this) = srcVt;
break;
case VT_VOID:
case VT_PTR:
case VT_USERDEFINED:
case VT_LPSTR:
case VT_LPWSTR:
case VT_RECORD:
case VT_FILETIME:
case VT_BLOB:
case VT_STREAM:
case VT_STORAGE:
case VT_STREAMED_OBJECT:
case VT_STORED_OBJECT:
case VT_BLOB_OBJECT:
case VT_CF:
case VT_CLSID:
case VT_VERSIONED_STREAM:
case VT_BSTR_BLOB:
VariantCopy(this, &srcVar);
break;
default:
ASSERT(FALSE);
VariantCopy(this, &srcVar);
break;
}
return;
}
BOOL _NeedClear()
{
VARTYPE srcVt = V_VT(this) & VT_TYPEMASK;
switch (srcVt)
{
case VT_VOID:
case VT_PTR:
case VT_USERDEFINED:
case VT_LPSTR:
case VT_LPWSTR:
case VT_RECORD:
case VT_FILETIME:
case VT_BLOB:
case VT_STREAM:
case VT_STORAGE:
case VT_STREAMED_OBJECT:
case VT_STORED_OBJECT:
case VT_BLOB_OBJECT:
case VT_CF:
case VT_CLSID:
case VT_VERSIONED_STREAM:
case VT_BSTR_BLOB:
return TRUE;
break;
default:
break;
}
return FALSE;
}
};
_KFC_END
#endif /* __KFC_VARIANT_H__ */
| 21.114811 | 94 | 0.620086 |
f277f2a98af947a58195eeb6b35201b1f2acb06d | 368 | h | C | usr/libexec/gamed/NSData-GKBase64.h | lechium/tvOS124Headers | 11d1b56dd4c0ffd88b9eac43f87a5fd6f7228475 | [
"MIT"
] | 4 | 2019-08-27T18:03:47.000Z | 2021-09-18T06:29:00.000Z | usr/libexec/gamed/NSData-GKBase64.h | lechium/tvOS124Headers | 11d1b56dd4c0ffd88b9eac43f87a5fd6f7228475 | [
"MIT"
] | null | null | null | usr/libexec/gamed/NSData-GKBase64.h | lechium/tvOS124Headers | 11d1b56dd4c0ffd88b9eac43f87a5fd6f7228475 | [
"MIT"
] | null | null | null | //
// Generated by classdumpios 1.0.1 (64 bit) (iOS port by DreamDevLost)(Debug version compiled Jun 10 2020 10:03:13).
//
// Copyright (C) 1997-2019 Steve Nygard.
//
#import <Foundation/NSData.h>
@interface NSData (GKBase64)
- (id)_gkBase64EncodedString; // IMP=0x000000010005aad8
- (id)initWithBase64EncodedString_gk:(id)arg1; // IMP=0x000000010005aac8
@end
| 26.285714 | 120 | 0.730978 |
f2a8b4a7a11efad1a799a120bd34d7075bf95a3c | 2,596 | c | C | apps/breakfast/pde_fw/bacon/CC430x513x Code Examples/cc430x513x_compB_04.c | tp-freeforall/breakfast | 0399619cdb7a81b3c3cc4c5a1b7d69f5c32b8c65 | [
"BSD-3-Clause"
] | 1 | 2020-05-15T18:08:48.000Z | 2020-05-15T18:08:48.000Z | apps/breakfast/pde_fw/bacon/CC430x513x Code Examples/cc430x513x_compB_04.c | tp-freeforall/breakfast | 0399619cdb7a81b3c3cc4c5a1b7d69f5c32b8c65 | [
"BSD-3-Clause"
] | null | null | null | apps/breakfast/pde_fw/bacon/CC430x513x Code Examples/cc430x513x_compB_04.c | tp-freeforall/breakfast | 0399619cdb7a81b3c3cc4c5a1b7d69f5c32b8c65 | [
"BSD-3-Clause"
] | null | null | null | //******************************************************************************
// CC430x513x Demo - CBOUT from LPM4; CompB in ultra low power mode; Vref = Vcc*1/2
//
// Description: Use CompB and shared reference to determine if input 'Vcompare'
// is high of low. When Vcompare exceeds Vcc*1/2 CBOUT goes high and when
// Vcompare is less than Vcc*1/2 then CBOUT goes low.
// Connect P1.6/CBOUT to P1.0 externally to see the LED toggle accordingly.
//
// CC430x513x
// ------------------
// /|\| |
// | | |
// --|RST P2.0/CB0 |<--Vcompare
// | |
// | P1.6/CBOUT|----> 'high'(Vcompare>Vcc*1/2); 'low'(Vcompare<Vcc*1/2)
// | | |
// | P1.0 |__| LED 'ON'(Vcompare>Vcc*1/2); 'OFF'(Vcompare<Vcc*1/2)
// | |
//
// M Morales
// Texas Instruments Inc.
// April 2009
// Built with CCE Version: 3.2.2 and IAR Embedded Workbench Version: 4.11B
//******************************************************************************
#include "cc430x513x.h"
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
P1DIR |= BIT6; // P1.6 output direction
P1SEL |= BIT6; // Select CBOUT function on P1.6/CBOUT
PMAPPWD = 0x02D52; // Get write-access to port mapping regs
P1MAP6 = PM_CBOUT0; // Map CBOUT output to P1.6
PMAPPWD = 0; // Lock port mapping registers
P2SEL |= BIT0; // Select CB0 input for P2.0
/* Setup ComparatorB */
CBCTL0 |= CBIPEN+CBIPSEL_0; // Enable V+, input channel CB0
CBCTL1 |= CBMRVS; // CMRVL selects the refV - VREF0
CBCTL1 |= CBPWRMD_2; // Ultra-Low Power mode
CBCTL2 |= CBRSEL; // VREF is applied to -terminal
CBCTL2 |= CBRS_1+CBREF04; // VCC applied to R-ladder; VREF0 is Vcc*1/2
CBCTL3 |= BIT0; // Input Buffer Disable @P2.0/CB0
CBCTL1 |= CBON; // Turn On ComparatorB
__delay_cycles(75);
__bis_SR_register(LPM4_bits); // Enter LPM4
__no_operation(); // For debug
}
| 48.074074 | 90 | 0.416025 |
7d250ed42132a46b781d253e7328361a1cac253c | 2,119 | c | C | core/array_dynamic/test.c | DaveDaDev/ImagineEngine | 828b93136b1e47d1361ecb3b793174fc6a82e649 | [
"MIT"
] | null | null | null | core/array_dynamic/test.c | DaveDaDev/ImagineEngine | 828b93136b1e47d1361ecb3b793174fc6a82e649 | [
"MIT"
] | null | null | null | core/array_dynamic/test.c | DaveDaDev/ImagineEngine | 828b93136b1e47d1361ecb3b793174fc6a82e649 | [
"MIT"
] | null | null | null | #include "iearraydynamic.h"
#include <stdio.h>
#include <stdlib.h>
unsigned int is_equal_int(void* p1, void* p2)
{
int* i1 = (int*) p1;
int* i2 = (int*) p2;
if ( (*i1) == (*i2) )
return 1;
return 0;
}
int main()
{
iec_array_dynamic* my_new_array = iec_array_dynamic_create(sizeof(int));
int i;
for (i = 1; i < 21; ++i) {
iec_array_dynamic_push_back(my_new_array, &i);
}
int insert = 55;
iec_array_dynamic_erase(my_new_array, 15);
iec_array_dynamic_insert(my_new_array, &insert, 15);
int assign = 69;
iec_array_dynamic_assign(my_new_array, &assign, 20);
int* pdata = NULL;
for(i = 0; i < iec_array_dynamic_size(my_new_array); ++i) {
pdata = iec_array_dynamic_value_pointer(my_new_array, i);
if ( pdata != NULL )
printf("%i\n", *pdata);
}
int pop = 0;
iec_array_dynamic_pop_back(my_new_array, &pop);
printf("Popped: %i\n", pop);
iec_array_dynamic_pop_back(my_new_array, &pop);
printf("Popped: %i\n", pop);
printf("Capacity: %u\n", iec_array_dynamic_capacity(my_new_array));
iec_array_dynamic_refit(my_new_array);
printf("Refit\n");
printf("Capacity: %u\n", iec_array_dynamic_capacity(my_new_array));
for(i = 0; i < iec_array_dynamic_size(my_new_array); ++i) {
pdata = iec_array_dynamic_value_pointer(my_new_array, i);
if ( pdata != NULL )
printf("%i\n", *pdata);
}
int j = 10;
unsigned int result = iec_array_dynamic_has(my_new_array, &j, is_equal_int);
printf("Has 10? (%u)\n", result);
for (i = 0; i < 15; ++i) {
iec_array_dynamic_pop_back(my_new_array, NULL);
}
printf("Size: %u\n", iec_array_dynamic_size(my_new_array));
printf("Capacity: %u\n", iec_array_dynamic_capacity(my_new_array));
iec_array_dynamic_shrink_toggle(my_new_array, 1);
printf("Dynamic Shrink On\n");
iec_array_dynamic_pop_back(my_new_array, NULL);
printf("Capacity: %u\n", iec_array_dynamic_capacity(my_new_array));
iec_array_dynamic_destroy(my_new_array);
printf("Completed\n");
}
| 27.519481 | 80 | 0.644172 |
eaaa11cbf264517200332105c9e45170ac7ea8ef | 873 | h | C | src/aadcUser/GoalControl/Tasks/Task_PullOutRight.h | kimsoohwan/Cariosity2018 | 49f935623c41d627b45c47a219358f9d7d207fdf | [
"BSD-4-Clause"
] | null | null | null | src/aadcUser/GoalControl/Tasks/Task_PullOutRight.h | kimsoohwan/Cariosity2018 | 49f935623c41d627b45c47a219358f9d7d207fdf | [
"BSD-4-Clause"
] | null | null | null | src/aadcUser/GoalControl/Tasks/Task_PullOutRight.h | kimsoohwan/Cariosity2018 | 49f935623c41d627b45c47a219358f9d7d207fdf | [
"BSD-4-Clause"
] | 1 | 2019-10-03T12:23:26.000Z | 2019-10-03T12:23:26.000Z | #pragma once
#include "stdafx.h"
#include "Task.h"
using namespace fhw;
class cTask_PullOutRight : public cTask
{
private:
enum eState {
INIT,
STRAIGHT,
STEERING,
DONE
};
tFloat32 targetDistance;
tFloat64 targetHeading;
eState state;
tTimeStamp waitEndTime;
public:
/*! Default constructor. Sets parent Task. */
cTask_PullOutRight(tBool isFirstTaskOfManeuver = tFalse);
/*! Destructor. */
virtual ~cTask_PullOutRight() = default;
/*! Calculates actuator steering info from egoState and map
* --> needs to be overridden by specific Task implementations! */
tResult execute(tTaskResult &taskResult) override;
tFloat64 normalizeAngle(tFloat64 value);
tFloat64 getRelativeAngle(tFloat64 ofAngle, tFloat64 toAngle);
std::pair<tFloat32, int> nextParkingSpot();
};
| 19.4 | 69 | 0.680412 |
d98ab41e3cd9a5ff75eab9c4008e35a8a1e8dd81 | 283 | h | C | HDJFKJ/HDJFKJ/LDFindPassViewController.h | huangjinping/test111 | 58a5a15c551d598557952ff9a2246f52ffa7cf7c | [
"MIT"
] | null | null | null | HDJFKJ/HDJFKJ/LDFindPassViewController.h | huangjinping/test111 | 58a5a15c551d598557952ff9a2246f52ffa7cf7c | [
"MIT"
] | null | null | null | HDJFKJ/HDJFKJ/LDFindPassViewController.h | huangjinping/test111 | 58a5a15c551d598557952ff9a2246f52ffa7cf7c | [
"MIT"
] | null | null | null | //
// LDFindPassViewController.h
// HDJFKJ
//
// Created by apple on 16/4/5.
// Copyright © 2016年 LDSmallCat. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface LDFindPassViewController : LDBaseUIViewController
@property (nonatomic, strong) NSString * fromWhere;
@end
| 18.866667 | 60 | 0.731449 |
26daaef50228412784180dd8e546d06804d308e4 | 6,588 | h | C | src/atlas/array/MakeView.h | egparedes/atlas | fff4b692334b1dcb5abd14a36a09df9c9204b08b | [
"Apache-2.0"
] | 1 | 2019-12-02T20:41:33.000Z | 2019-12-02T20:41:33.000Z | src/atlas/array/MakeView.h | egparedes/atlas | fff4b692334b1dcb5abd14a36a09df9c9204b08b | [
"Apache-2.0"
] | null | null | null | src/atlas/array/MakeView.h | egparedes/atlas | fff4b692334b1dcb5abd14a36a09df9c9204b08b | [
"Apache-2.0"
] | null | null | null | /*
* (C) Copyright 2013 ECMWF.
*
* This software is licensed under the terms of the Apache Licence Version 2.0
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
* In applying this licence, ECMWF does not waive the privileges and immunities
* granted to it by virtue of its status as an intergovernmental organisation
* nor does it submit to any jurisdiction.
*/
#pragma once
#include "atlas/array/ArrayView.h"
#include "atlas/array/IndexView.h"
#include "atlas/array/LocalView.h"
#include "atlas/array_fwd.h"
namespace atlas {
namespace array {
extern template IndexView<idx_t, 1> make_indexview<idx_t, 1>( const Array& );
#define EXPLICIT_TEMPLATE_INSTANTIATION( Rank ) \
extern template ArrayView<int, Rank, Intent::ReadOnly> make_view<int, Rank, Intent::ReadOnly>( const Array& ); \
extern template ArrayView<int, Rank, Intent::ReadWrite> make_view<int, Rank, Intent::ReadWrite>( const Array& ); \
extern template ArrayView<long, Rank, Intent::ReadOnly> make_view<long, Rank, Intent::ReadOnly>( const Array& ); \
extern template ArrayView<long, Rank, Intent::ReadWrite> make_view<long, Rank, Intent::ReadWrite>( const Array& ); \
extern template ArrayView<float, Rank, Intent::ReadOnly> make_view<float, Rank, Intent::ReadOnly>( const Array& ); \
extern template ArrayView<float, Rank, Intent::ReadWrite> make_view<float, Rank, Intent::ReadWrite>( \
const Array& ); \
extern template ArrayView<double, Rank, Intent::ReadOnly> make_view<double, Rank, Intent::ReadOnly>( \
const Array& ); \
extern template ArrayView<double, Rank, Intent::ReadWrite> make_view<double, Rank, Intent::ReadWrite>( \
const Array& ); \
\
extern template LocalView<int, Rank, Intent::ReadOnly> make_view<int, Rank, Intent::ReadOnly>( \
const int data[], const ArrayShape& ); \
extern template LocalView<int, Rank, Intent::ReadWrite> make_view<int, Rank, Intent::ReadWrite>( \
const int data[], const ArrayShape& ); \
extern template LocalView<long, Rank, Intent::ReadOnly> make_view<long, Rank, Intent::ReadOnly>( \
const long data[], const ArrayShape& ); \
extern template LocalView<long, Rank, Intent::ReadWrite> make_view<long, Rank, Intent::ReadWrite>( \
const long data[], const ArrayShape& ); \
extern template LocalView<float, Rank, Intent::ReadOnly> make_view<float, Rank, Intent::ReadOnly>( \
const float data[], const ArrayShape& ); \
extern template LocalView<float, Rank, Intent::ReadWrite> make_view<float, Rank, Intent::ReadWrite>( \
const float data[], const ArrayShape& ); \
extern template LocalView<double, Rank, Intent::ReadOnly> make_view<double, Rank, Intent::ReadOnly>( \
const double data[], const ArrayShape& ); \
extern template LocalView<double, Rank, Intent::ReadWrite> make_view<double, Rank, Intent::ReadWrite>( \
const double data[], const ArrayShape& ); \
\
extern template LocalView<int, Rank, Intent::ReadOnly> make_view<int, Rank, Intent::ReadOnly>( const int data[], \
size_t ); \
extern template LocalView<int, Rank, Intent::ReadWrite> make_view<int, Rank, Intent::ReadWrite>( const int data[], \
size_t ); \
extern template LocalView<long, Rank, Intent::ReadOnly> make_view<long, Rank, Intent::ReadOnly>( \
const long data[], size_t ); \
extern template LocalView<long, Rank, Intent::ReadWrite> make_view<long, Rank, Intent::ReadWrite>( \
const long data[], size_t ); \
extern template LocalView<float, Rank, Intent::ReadOnly> make_view<float, Rank, Intent::ReadOnly>( \
const float data[], size_t ); \
extern template LocalView<float, Rank, Intent::ReadWrite> make_view<float, Rank, Intent::ReadWrite>( \
const float data[], size_t ); \
extern template LocalView<double, Rank, Intent::ReadOnly> make_view<double, Rank, Intent::ReadOnly>( \
const double data[], size_t ); \
extern template LocalView<double, Rank, Intent::ReadWrite> make_view<double, Rank, Intent::ReadWrite>( \
const double data[], size_t );
// For each NDims in [1..9]
EXPLICIT_TEMPLATE_INSTANTIATION( 1 )
EXPLICIT_TEMPLATE_INSTANTIATION( 2 )
EXPLICIT_TEMPLATE_INSTANTIATION( 3 )
EXPLICIT_TEMPLATE_INSTANTIATION( 4 )
EXPLICIT_TEMPLATE_INSTANTIATION( 5 )
EXPLICIT_TEMPLATE_INSTANTIATION( 6 )
EXPLICIT_TEMPLATE_INSTANTIATION( 7 )
EXPLICIT_TEMPLATE_INSTANTIATION( 8 )
EXPLICIT_TEMPLATE_INSTANTIATION( 9 )
#undef EXPLICIT_TEMPLATE_INSTANTIATION
} // namespace array
} // namespace atlas
| 77.505882 | 120 | 0.4915 |
1e49c4e0cd1ff2f971df9ea9aa0c62ef8561e5f7 | 302 | c | C | pwn/01-netcat/src/main.c | wani-hackase/wanictf2020-writeup | bd6910cbdfa6330f29cd613d3dbeea160c4a6690 | [
"MIT"
] | 9 | 2020-11-23T12:56:36.000Z | 2021-09-11T16:35:51.000Z | pwn/01-netcat/file/pwn01.c | wani-hackase/wanictf2020-writeup | bd6910cbdfa6330f29cd613d3dbeea160c4a6690 | [
"MIT"
] | null | null | null | pwn/01-netcat/file/pwn01.c | wani-hackase/wanictf2020-writeup | bd6910cbdfa6330f29cd613d3dbeea160c4a6690 | [
"MIT"
] | 1 | 2021-05-01T05:49:40.000Z | 2021-05-01T05:49:40.000Z | #include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
void init();
void win()
{
puts("congratulation!");
system("/bin/sh");
exit(0);
}
int main()
{
init();
win();
}
void init()
{
alarm(30);
setbuf(stdin, NULL);
setbuf(stdout, NULL);
setbuf(stderr, NULL);
}
| 11.185185 | 28 | 0.549669 |
8c1de5c70024e2f0ab6043fd53dee2a8b82c41ac | 4,955 | h | C | quic/server/third-party/siphash.h | Shikugawa/mvfst-quicbench | 5c6bb05cb5b9810bf1afddc5fe168d6b220bcd1d | [
"MIT"
] | null | null | null | quic/server/third-party/siphash.h | Shikugawa/mvfst-quicbench | 5c6bb05cb5b9810bf1afddc5fe168d6b220bcd1d | [
"MIT"
] | null | null | null | quic/server/third-party/siphash.h | Shikugawa/mvfst-quicbench | 5c6bb05cb5b9810bf1afddc5fe168d6b220bcd1d | [
"MIT"
] | null | null | null | /* <MIT License>
Copyright (c) 2013 Marek Majkowski <marek@popcount.org>
Copyright (c) 2014 Marco Elver
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.
</MIT License>
Original location:
https://github.com/melver/cppsiphash/
Solution inspired by code from:
Marek Majkowski (https://github.com/majek/csiphash/)
Samuel Neves (supercop/crypto_auth/siphash24/little)
djb (supercop/crypto_auth/siphash24/little2)
Jean-Philippe Aumasson (https://131002.net/siphash/siphash24.c)
*/
#ifndef SIPHASH_HPP_
#define SIPHASH_HPP_
#include <cstdint>
#include <cstddef>
#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && \
__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
# define _le64toh(x) ((std::uint64_t)(x))
#elif defined(_WIN32)
/* Windows is always little endian, unless you're on xbox360
http://msdn.microsoft.com/en-us/library/b0084kay(v=vs.80).aspx */
# define _le64toh(x) ((std::uint64_t)(x))
#elif defined(__APPLE__)
# include <libkern/OSByteOrder.h>
# define _le64toh(x) OSSwapLittleToHostInt64(x)
#else
/* See: http://sourceforge.net/p/predef/wiki/Endianness/ */
# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
# include <sys/endian.h>
# else
# include <endian.h>
# endif
# if defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && \
__BYTE_ORDER == __LITTLE_ENDIAN
# define _le64toh(x) ((std::uint64_t)(x))
# else
# define _le64toh(x) le64toh(x)
# endif
#endif
namespace siphash {
template <std::uint64_t b>
inline std::uint64_t sip_rotate(const std::uint64_t x)
{
return ((x) << (b)) | ( (x) >> (64 - (b)));
}
template <std::uint64_t s, std::uint64_t t>
inline void sip_half_round(
std::uint64_t& a,
std::uint64_t& b,
std::uint64_t& c,
std::uint64_t& d)
{
a += b; c += d;
b = sip_rotate<s >(b) ^ a;
d = sip_rotate<t >(d) ^ c;
a = sip_rotate<32>(a);
}
inline void sip_double_round(
std::uint64_t& v0,
std::uint64_t& v1,
std::uint64_t& v2,
std::uint64_t& v3)
{
sip_half_round<13,16>(v0,v1,v2,v3);
sip_half_round<17,21>(v2,v1,v0,v3);
sip_half_round<13,16>(v0,v1,v2,v3);
sip_half_round<17,21>(v2,v1,v0,v3);
}
struct Key {
union {
char k_char[16];
std::uint64_t k_uint64[2];
};
Key(char k0, char k1, char k2, char k3, char k4, char k5, char k6, char k7,
char k8, char k9, char ka, char kb, char kc, char kd, char ke, char kf)
: k_char{k0, k1, k2, k3, k4, k5, k6, k7, k8, k9, ka, kb, kc, kd, ke, kf}
{}
Key(std::uint64_t k0, std::uint64_t k1)
: k_uint64{k0, k1}
{}
};
inline std::uint64_t siphash24(const void *src, std::size_t len, const Key *key)
{
const std::uint64_t k0 = _le64toh(key->k_uint64[0]);
const std::uint64_t k1 = _le64toh(key->k_uint64[1]);
const std::uint64_t *in = static_cast<const std::uint64_t*>(src);
std::uint64_t b = static_cast<std::uint64_t>(len) << 56;
std::uint64_t v0 = k0 ^ 0x736f6d6570736575ULL;
std::uint64_t v1 = k1 ^ 0x646f72616e646f6dULL;
std::uint64_t v2 = k0 ^ 0x6c7967656e657261ULL;
std::uint64_t v3 = k1 ^ 0x7465646279746573ULL;
while (len >= 8) {
const std::uint64_t mi = _le64toh(*in);
in += 1; len -= 8;
v3 ^= mi;
sip_double_round(v0,v1,v2,v3);
v0 ^= mi;
}
std::uint64_t t = 0;
std::uint8_t *pt = reinterpret_cast<std::uint8_t *>(&t);
const std::uint8_t *m = reinterpret_cast<const std::uint8_t *>(in);
switch (len) {
case 7: pt[6] = m[6];
case 6: pt[5] = m[5];
case 5: pt[4] = m[4];
case 4:
*(reinterpret_cast<std::uint32_t*>(pt)) =
*(reinterpret_cast<const std::uint32_t*>(m));
break;
case 3: pt[2] = m[2];
case 2: pt[1] = m[1];
case 1: pt[0] = m[0];
}
b |= _le64toh(t);
v3 ^= b;
sip_double_round(v0,v1,v2,v3);
v0 ^= b; v2 ^= 0xff;
sip_double_round(v0,v1,v2,v3);
sip_double_round(v0,v1,v2,v3);
return (v0 ^ v1) ^ (v2 ^ v3);
}
template <class T>
inline std::uint64_t siphash24(const T& src, const Key& key)
{
return siphash24(&src, sizeof(src), &key);
}
} /* namespace siphash */
#endif /* SIPHASH_HPP_ */
| 28.80814 | 80 | 0.687386 |
968cd7198a5c8114d17390fe089b9f642b27c23e | 361 | h | C | Pay/Classes/Pay.h | Tank/Swift-Pay | cb7300999aa6261a2235aeb0e12938d4655e9643 | [
"MIT"
] | 7 | 2019-05-14T03:30:57.000Z | 2022-02-14T03:39:11.000Z | Pay/Classes/Pay.h | Tank/Swift-Pay | cb7300999aa6261a2235aeb0e12938d4655e9643 | [
"MIT"
] | null | null | null | Pay/Classes/Pay.h | Tank/Swift-Pay | cb7300999aa6261a2235aeb0e12938d4655e9643 | [
"MIT"
] | 2 | 2020-07-22T13:48:23.000Z | 2021-02-07T13:12:35.000Z | //
// PaySDK.h
// Pay
//
// Created by Tank on 2018/9/14.
// Copyright © 2018年 CocoaPods. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "AlipaySDK.h"
#import "APayAuthInfo.h"
#import "WechatAuthSDK.h"
#import "WXApi.h"
#import "WXApiObject.h"
FOUNDATION_EXPORT double PayVersionNumber;
FOUNDATION_EXPORT const unsigned char PayVersionString[];
| 19 | 57 | 0.728532 |
14846d00005101eba7142e7c545ce2e1c9008da0 | 207 | h | C | Includes/init.h | dracc/nPongX | b2ce6e0f6f7068c278c34d1091176f20e391853c | [
"MIT"
] | 2 | 2019-08-03T15:39:02.000Z | 2019-12-12T12:35:04.000Z | Includes/init.h | dracc/nPongX | b2ce6e0f6f7068c278c34d1091176f20e391853c | [
"MIT"
] | null | null | null | Includes/init.h | dracc/nPongX | b2ce6e0f6f7068c278c34d1091176f20e391853c | [
"MIT"
] | null | null | null | #ifndef __INIT_H
#define __INIT_H
#include <SDL.h>
#include <SDL_ttf.h>
#include <pbkit/pbkit.h>
#include <hal/input.h>
#include <hal/video.h>
#include <hal/xbox.h>
void doInit();
void killAll();
#endif
| 12.9375 | 24 | 0.700483 |
f02545021e5cacceb35f91dd3d0e073751c64f79 | 4,289 | h | C | src/etp/HttpClientSession.h | cgodkin/fesapi | d25c5e30ccec537c471adc3bb036c48f2c51f2c9 | [
"Apache-2.0"
] | null | null | null | src/etp/HttpClientSession.h | cgodkin/fesapi | d25c5e30ccec537c471adc3bb036c48f2c51f2c9 | [
"Apache-2.0"
] | null | null | null | src/etp/HttpClientSession.h | cgodkin/fesapi | d25c5e30ccec537c471adc3bb036c48f2c51f2c9 | [
"Apache-2.0"
] | null | null | null | /*-----------------------------------------------------------------------
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"; you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-----------------------------------------------------------------------*/
#pragma once
#include <boost/beast/core.hpp>
#include <boost/beast/http.hpp>
#include <boost/beast/version.hpp>
#include <boost/asio/connect.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <iostream>
using tcp = boost::asio::ip::tcp; // from <boost/asio/ip/tcp.hpp>
namespace http = boost::beast::http; // from <boost/beast/http.hpp>
namespace ETP_NS
{
// Performs an HTTP GET and stores the response
class HttpClientSession : public std::enable_shared_from_this<HttpClientSession>
{
tcp::resolver resolver_;
tcp::socket socket_;
boost::beast::flat_buffer buffer_; // (Must persist between reads)
http::request<http::empty_body> req_;
http::response<http::string_body> res_;
public:
// Resolver and socket require an io_context
explicit
HttpClientSession(boost::asio::io_context& ioc)
: resolver_(ioc)
, socket_(ioc)
{
}
// Start the asynchronous operation
void
run(
char const* host,
char const* port,
char const* target,
int version)
{
// Set up an HTTP GET request message
req_.version(version);
req_.method(http::verb::get);
req_.target(target);
req_.set(http::field::host, host);
req_.set(http::field::user_agent, BOOST_BEAST_VERSION_STRING);
// Look up the domain name
resolver_.async_resolve(
host,
port,
std::bind(
&HttpClientSession::on_resolve,
shared_from_this(),
std::placeholders::_1,
std::placeholders::_2));
}
void
on_resolve(
boost::system::error_code ec,
tcp::resolver::results_type results)
{
if (ec) {
std::cerr << "resolve : " << ec.message() << std::endl;
return;
}
// Make the connection on the IP address we get from a lookup
boost::asio::async_connect(
socket_,
results.begin(),
results.end(),
std::bind(
&HttpClientSession::on_connect,
shared_from_this(),
std::placeholders::_1));
}
void
on_connect(boost::system::error_code ec)
{
if (ec) {
std::cerr << "connect : " << ec.message() << std::endl;
return;
}
// Send the HTTP request to the remote host
http::async_write(socket_, req_,
std::bind(
&HttpClientSession::on_write,
shared_from_this(),
std::placeholders::_1,
std::placeholders::_2));
}
void
on_write(
boost::system::error_code ec,
std::size_t bytes_transferred)
{
boost::ignore_unused(bytes_transferred);
if (ec) {
std::cerr << "write : " << ec.message() << std::endl;
return;
}
// Receive the HTTP response
http::async_read(socket_, buffer_, res_,
std::bind(
&HttpClientSession::on_read,
shared_from_this(),
std::placeholders::_1,
std::placeholders::_2));
}
void
on_read(
boost::system::error_code ec,
std::size_t bytes_transferred)
{
boost::ignore_unused(bytes_transferred);
if (ec) {
std::cerr << "read : " << ec.message() << std::endl;
return;
}
// Gracefully close the socket
socket_.shutdown(tcp::socket::shutdown_both, ec);
// not_connected happens sometimes so don't bother reporting it.
if (ec && ec != boost::system::errc::not_connected) {
std::cerr << "shutdown : " << ec.message() << std::endl;
return;
}
// If we get here then the connection is closed gracefully
}
const http::response<http::string_body>& getResponse() const {
return res_;
}
};
}
| 25.993939 | 81 | 0.650268 |
9b5182f0da1df8972e51e623a279a2aed624452c | 860 | h | C | My Game Plan/EditAppointmentViewController.h | damienleri/mygameplan-ios | 0e59d83e4e750cc3f34f4c01694a7a0538544b87 | [
"MIT"
] | 1 | 2015-03-17T00:45:14.000Z | 2015-03-17T00:45:14.000Z | My Game Plan/EditAppointmentViewController.h | damienleri/mygameplan-ios | 0e59d83e4e750cc3f34f4c01694a7a0538544b87 | [
"MIT"
] | null | null | null | My Game Plan/EditAppointmentViewController.h | damienleri/mygameplan-ios | 0e59d83e4e750cc3f34f4c01694a7a0538544b87 | [
"MIT"
] | null | null | null | //
// AppointmentViewController.h
// My Game Plan
//
// Created by Damien Leri on 6/29/13.
// Copyright (c) 2013 Damien Leri. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "Appointment.h"
#import "Parse/Parse.h"
@interface EditAppointmentViewController : UITableViewController <UIActionSheetDelegate>
- (IBAction)CancelButton:(id)sender;
@property (weak, nonatomic) IBOutlet UITextField *nameInput;
@property (weak, nonatomic) IBOutlet UIButton *dateButton;
@property(nonatomic) BOOL isEditing;
@property(nonatomic,strong) Appointment *appointment;
@property (strong, nonatomic) IBOutlet UITableView *tableView;
@property (weak, nonatomic) IBOutlet UITableViewCell *deleteCell;
@property (weak, nonatomic) IBOutlet UITextField *noteInput;
@property (weak, nonatomic) IBOutlet UIButton *deleteButton;
@property(nonatomic) BOOL changedDate;
@end
| 34.4 | 88 | 0.781395 |
1581a2267ef48b96e8c96c407fddee09a9160a82 | 3,193 | h | C | sys/deprecated/netdecnet/nsp_var.h | weiss/original-bsd | b44636d7febc9dcf553118bd320571864188351d | [
"Unlicense"
] | 114 | 2015-01-18T22:55:52.000Z | 2022-02-17T10:45:02.000Z | sys/deprecated/netdecnet/nsp_var.h | JamesLinus/original-bsd | b44636d7febc9dcf553118bd320571864188351d | [
"Unlicense"
] | null | null | null | sys/deprecated/netdecnet/nsp_var.h | JamesLinus/original-bsd | b44636d7febc9dcf553118bd320571864188351d | [
"Unlicense"
] | 29 | 2015-11-03T22:05:22.000Z | 2022-02-08T15:36:37.000Z | /* nsp_var.h 1.3 82/10/09 */
/*
* Kernel variables for NSP
*/
typedef short nsp_seq;
/*
* NSP control block, ala Session Control Port,
* p. 41-44, NSP spec.
*/
struct nspcb {
struct nspcb *n_next, *n_prev; /* list of all NSP cb's */
struct nspcb *n_head; /* pointer to head of list */
struct nspq *nq_next, *nq_prev; /* retransmit queue */
/* NEED STUFF FOR INPUT REASSEMBLY */
struct socket *n_socket; /* back pointer to socket */
char n_state; /* state of the port */
char n_flags; /* flags, see below */
short n_retrans; /* count of message retransmissions */
short n_segsize; /* transmit segment size */
u_short n_node; /* remote node address */
u_short n_loc; /* local link address */
u_short n_rem; /* remote link address */
/* timer variables */
u_short nt_dat; /* timeout for data segments */
u_short nt_oth; /* timeout for other data */
u_short nt_con; /* timeout for connect, disconnect */
/* sequence variables */
nsp_seq nn_dat; /* number of next data segment to transmit */
nsp_seq nn_oth; /* number of next other data segment */
nsp_seq nn_high; /* highest numbered data segment queued */
/* error control variables */
nsp_seq na_xmtdat; /* number of last data segment we acked */
nsp_seq na_xmtoth; /* number of last other data we acked */
nsp_seq na_rcvdat; /* number of highest data segment ack rcv'ed */
/* flow control variables */
char nf_locdat; /* data request count */
char nf_locint; /* flow control state for receiving intr data */
char nf_remdat; /* data request count from remote */
char nf_remint; /* interrupt request count from remote */
/* buffers for optional data */
u_short nb_src; /* source node addr for rcv CI */
struct mbuf *nb_con; /* data for rcv or xmt CI */
struct mbuf *nb_xmt; /* data for xmt CC, DI, Intr */
struct mbuf *nb_rcv; /* data for rcv CC, DI, Intr */
};
#define sotonspcb(so) ((struct nspcb *)(so)->so_pcb)
/* port states, p. 34-36 */
#define NS_O 0 /* open */
#define NS_CR 1 /* connect received */
#define NS_DR 2 /* disconnect reject */
#define NS_DRC 3 /* disconnect reject complete */
#define NS_CC 4 /* connect confirm */
#define NS_CI 5 /* connect initiate */
#define NS_NR 6 /* no resources */
#define NS_NC 7 /* no communication */
#define NS_CD 8 /* connect delivered */
#define NS_RJ 9 /* rejected */
#define NS_RUN 10 /* running */
#define NS_DI 11 /* disconnect initiate */
#define NS_DIC 12 /* disconnect complete */
#define NS_DN 13 /* disconnect notification */
#define NS_CL 14 /* closed */
#define NS_CN 15 /* closed notification */
#define NS_LI 16 /* listen for connection */
/* flags */
#define NF_DATACK 0001 /* data acknowledgement required */
#define NF_OTHACK 0002 /* other data acknowledgement required */
#define NF_CON 0004 /* connect data available */
#define NF_INTAVAIL 0010 /* transmit interrupt data available */
#define NF_OTHSENT 0020 /* other data message has been sent */
#define NF_OTHINTR 0040 /* other data message was an interrupt msg */
#define NF_DATOFF 0100 /* on/off switch for data flow control */
/* locint states */
/* I STILL DON'T UNDERSTAND THIS WELL ENOUGH */
#define NFL_EMPTY 0
#define NFL_INTR 1
#define NFL_SEND 2
| 37.564706 | 69 | 0.694018 |
9dc43f4295b59fe198aaf5cf8232eb603b52c762 | 18,530 | h | C | src/FunctorOps.h | binrats/souffle | 30cfe00941aeb60536982eba24ba63be86a65fdd | [
"UPL-1.0"
] | null | null | null | src/FunctorOps.h | binrats/souffle | 30cfe00941aeb60536982eba24ba63be86a65fdd | [
"UPL-1.0"
] | null | null | null | src/FunctorOps.h | binrats/souffle | 30cfe00941aeb60536982eba24ba63be86a65fdd | [
"UPL-1.0"
] | null | null | null | /*
* Souffle - A Datalog Compiler
* Copyright (c) 2019, The Souffle Developers. All rights reserved.
* Licensed under the Universal Permissive License v 1.0 as shown at:
* - https://opensource.org/licenses/UPL
* - <souffle root>/licenses/SOUFFLE-UPL.txt
*/
/************************************************************************
*
* @file FunctorOps.h
*
* Defines intrinsic functor operators for AST and RAM
*
***********************************************************************/
#pragma once
#include "RamTypes.h"
#include "Util.h"
#include <cassert>
#include <cstdlib>
#include <iostream>
namespace souffle {
enum class FunctorOp {
/** Unary Functor Operators */
ORD, // ordinal number of a string
STRLEN, // length of a string
NEG, // Signed numeric negation
FNEG, // Float numeric negation
BNOT, // Signed bitwise negation
UBNOT, // Unsigned bitwise negation
LNOT, // Signed logical negation
ULNOT, // Unsigned logical negation
TONUMBER, // convert string to number
TOSTRING, // convert number to string
ITOU, // convert signed number to unsigned
UTOI, // convert unsigned number to signed
ITOF, // convert signed number to float
FTOI, // convert float number to signed number.
UTOF, // convert unsigned number to a float.
FTOU, // convert float to unsigned number.
/** Binary Functor Operators */
ADD, // addition
SUB, // subtraction
MUL, // multiplication
DIV, // division
EXP, // exponent
MAX, // max of two numbers
MIN, // min of two numbers
MOD, // modulus
BAND, // bitwise and
BOR, // bitwise or
BXOR, // bitwise exclusive or
BSHIFT_L, // bitwise shift left
BSHIFT_R, // bitwise shift right
BSHIFT_R_UNSIGNED, // bitwise shift right (unsigned)
LAND, // logical and
LOR, // logical or
UADD, // addition
USUB, // subtraction
UMUL, // multiplication
UDIV, // division
UEXP, // exponent
UMAX, // max of two numbers
UMIN, // min of two numbers
UMOD, // modulus
UBAND, // bitwise and
UBOR, // bitwise or
UBXOR, // bitwise exclusive or
UBSHIFT_L, // bitwise shift right
UBSHIFT_R, // bitwise shift right
UBSHIFT_R_UNSIGNED, // bitwise shift right (unsigned)
ULAND, // logical and
ULOR, // logical or
FADD, // addition
FSUB, // subtraction
FMUL, // multiplication
FDIV, // division
FEXP, // exponent
FMAX, // max of two floats
FMIN, // min of two floats
SMAX, // max of two symbols
SMIN, // min of two symbols
CAT, // string concatenation
/** Ternary Functor Operators */
SUBSTR, // substring
};
/**
* Checks whether a functor operation can have a given argument count.
*/
inline bool isValidFunctorOpArity(const FunctorOp op, const size_t arity) {
switch (op) {
/** Unary Functor Operators */
case FunctorOp::ORD:
case FunctorOp::STRLEN:
case FunctorOp::NEG:
case FunctorOp::FNEG:
case FunctorOp::BNOT:
case FunctorOp::UBNOT:
case FunctorOp::LNOT:
case FunctorOp::ULNOT:
case FunctorOp::TONUMBER:
case FunctorOp::TOSTRING:
case FunctorOp::ITOU:
case FunctorOp::UTOI:
case FunctorOp::ITOF:
case FunctorOp::FTOI:
case FunctorOp::UTOF:
case FunctorOp::FTOU:
return arity == 1;
/** Binary Functor Operators */
case FunctorOp::ADD:
case FunctorOp::SUB:
case FunctorOp::MUL:
case FunctorOp::DIV:
case FunctorOp::EXP:
case FunctorOp::MOD:
case FunctorOp::BAND:
case FunctorOp::BOR:
case FunctorOp::BXOR:
case FunctorOp::BSHIFT_L:
case FunctorOp::BSHIFT_R:
case FunctorOp::BSHIFT_R_UNSIGNED:
case FunctorOp::LAND:
case FunctorOp::LOR:
case FunctorOp::UADD:
case FunctorOp::USUB:
case FunctorOp::UMUL:
case FunctorOp::UDIV:
case FunctorOp::UEXP:
case FunctorOp::UMOD:
case FunctorOp::UBAND:
case FunctorOp::UBOR:
case FunctorOp::UBXOR:
case FunctorOp::UBSHIFT_L:
case FunctorOp::UBSHIFT_R:
case FunctorOp::UBSHIFT_R_UNSIGNED:
case FunctorOp::ULAND:
case FunctorOp::ULOR:
case FunctorOp::FADD:
case FunctorOp::FSUB:
case FunctorOp::FMUL:
case FunctorOp::FDIV:
case FunctorOp::FEXP:
return arity == 2;
/** Ternary Functor Operators */
case FunctorOp::SUBSTR:
return arity == 3;
/** Non-fixed */
case FunctorOp::MAX:
case FunctorOp::MIN:
case FunctorOp::UMAX:
case FunctorOp::UMIN:
case FunctorOp::FMAX:
case FunctorOp::FMIN:
case FunctorOp::SMAX:
case FunctorOp::SMIN:
case FunctorOp::CAT:
return arity >= 2;
}
UNREACHABLE_BAD_CASE_ANALYSIS
}
/**
* Return a string representation of a functor.
*/
inline std::string getSymbolForFunctorOp(const FunctorOp op) {
switch (op) {
/** Unary Functor Operators */
case FunctorOp::ITOF:
return "itof";
case FunctorOp::ITOU:
return "itou";
case FunctorOp::UTOF:
return "utof";
case FunctorOp::UTOI:
return "utoi";
case FunctorOp::FTOI:
return "ftoi";
case FunctorOp::FTOU:
return "ftou";
case FunctorOp::ORD:
return "ord";
case FunctorOp::STRLEN:
return "strlen";
case FunctorOp::NEG:
case FunctorOp::FNEG:
return "-";
case FunctorOp::BNOT:
case FunctorOp::UBNOT:
return "bnot";
case FunctorOp::LNOT:
case FunctorOp::ULNOT:
return "lnot";
case FunctorOp::TONUMBER:
return "to_number";
case FunctorOp::TOSTRING:
return "to_string";
/** Binary Functor Operators */
case FunctorOp::ADD:
case FunctorOp::FADD:
case FunctorOp::UADD:
return "+";
case FunctorOp::SUB:
case FunctorOp::USUB:
case FunctorOp::FSUB:
return "-";
case FunctorOp::MUL:
case FunctorOp::UMUL:
case FunctorOp::FMUL:
return "*";
case FunctorOp::DIV:
case FunctorOp::UDIV:
case FunctorOp::FDIV:
return "/";
case FunctorOp::EXP:
case FunctorOp::FEXP:
case FunctorOp::UEXP:
return "^";
case FunctorOp::MOD:
case FunctorOp::UMOD:
return "%";
case FunctorOp::BAND:
case FunctorOp::UBAND:
return "band";
case FunctorOp::BOR:
case FunctorOp::UBOR:
return "bor";
case FunctorOp::BXOR:
case FunctorOp::UBXOR:
return "bxor";
case FunctorOp::BSHIFT_L:
case FunctorOp::UBSHIFT_L:
return "bshl";
case FunctorOp::BSHIFT_R:
case FunctorOp::UBSHIFT_R:
return "bshr";
case FunctorOp::BSHIFT_R_UNSIGNED:
case FunctorOp::UBSHIFT_R_UNSIGNED:
return "bshru";
case FunctorOp::LAND:
case FunctorOp::ULAND:
return "land";
case FunctorOp::LOR:
case FunctorOp::ULOR:
return "lor";
/* N-ary Functor Operators */
case FunctorOp::MAX:
case FunctorOp::UMAX:
case FunctorOp::FMAX:
case FunctorOp::SMAX:
return "max";
case FunctorOp::MIN:
case FunctorOp::UMIN:
case FunctorOp::FMIN:
case FunctorOp::SMIN:
return "min";
case FunctorOp::CAT:
return "cat";
/** Ternary Functor Operators */
case FunctorOp::SUBSTR:
return "substr";
}
UNREACHABLE_BAD_CASE_ANALYSIS
}
/**
* Check a functor's return type (codomain).
*/
inline TypeAttribute functorReturnType(const FunctorOp op) {
switch (op) {
case FunctorOp::ORD:
case FunctorOp::STRLEN:
case FunctorOp::NEG:
case FunctorOp::BNOT:
case FunctorOp::LNOT:
case FunctorOp::TONUMBER:
case FunctorOp::ADD:
case FunctorOp::SUB:
case FunctorOp::MUL:
case FunctorOp::DIV:
case FunctorOp::EXP:
case FunctorOp::BAND:
case FunctorOp::BOR:
case FunctorOp::BXOR:
case FunctorOp::BSHIFT_L:
case FunctorOp::BSHIFT_R:
case FunctorOp::BSHIFT_R_UNSIGNED:
case FunctorOp::LAND:
case FunctorOp::LOR:
case FunctorOp::MOD:
case FunctorOp::MAX:
case FunctorOp::MIN:
case FunctorOp::FTOI:
case FunctorOp::UTOI:
return TypeAttribute::Signed;
case FunctorOp::UBNOT:
case FunctorOp::ITOU:
case FunctorOp::FTOU:
case FunctorOp::ULNOT:
case FunctorOp::UADD:
case FunctorOp::USUB:
case FunctorOp::UMUL:
case FunctorOp::UDIV:
case FunctorOp::UEXP:
case FunctorOp::UMAX:
case FunctorOp::UMIN:
case FunctorOp::UMOD:
case FunctorOp::UBAND:
case FunctorOp::UBOR:
case FunctorOp::UBXOR:
case FunctorOp::UBSHIFT_L:
case FunctorOp::UBSHIFT_R:
case FunctorOp::UBSHIFT_R_UNSIGNED:
case FunctorOp::ULAND:
case FunctorOp::ULOR:
return TypeAttribute::Unsigned;
case FunctorOp::FMAX:
case FunctorOp::FMIN:
case FunctorOp::FNEG:
case FunctorOp::FADD:
case FunctorOp::FSUB:
case FunctorOp::ITOF:
case FunctorOp::UTOF:
case FunctorOp::FMUL:
case FunctorOp::FDIV:
case FunctorOp::FEXP:
return TypeAttribute::Float;
case FunctorOp::SMAX:
case FunctorOp::SMIN:
case FunctorOp::TOSTRING:
case FunctorOp::CAT:
case FunctorOp::SUBSTR:
return TypeAttribute::Symbol;
}
UNREACHABLE_BAD_CASE_ANALYSIS
}
/**
* Check the type of argument indicated by arg (0-indexed) of a functor op.
*/
inline TypeAttribute functorOpArgType(const size_t arg, const FunctorOp op) {
switch (op) {
// Special case
case FunctorOp::ORD:
fatal("ord is a special function that returns a Ram Representation of the element");
case FunctorOp::ITOF:
case FunctorOp::ITOU:
case FunctorOp::NEG:
case FunctorOp::BNOT:
case FunctorOp::LNOT:
case FunctorOp::TOSTRING:
assert(arg == 0 && "unary functor out of bound");
return TypeAttribute::Signed;
case FunctorOp::FNEG:
case FunctorOp::FTOI:
case FunctorOp::FTOU:
assert(arg == 0 && "unary functor out of bound");
return TypeAttribute::Float;
case FunctorOp::STRLEN:
case FunctorOp::TONUMBER:
assert(arg == 0 && "unary functor out of bound");
return TypeAttribute::Symbol;
case FunctorOp::UBNOT:
case FunctorOp::ULNOT:
case FunctorOp::UTOI:
case FunctorOp::UTOF:
assert(arg == 0 && "unary functor out of bound");
return TypeAttribute::Unsigned;
case FunctorOp::ADD:
case FunctorOp::SUB:
case FunctorOp::MUL:
case FunctorOp::DIV:
case FunctorOp::EXP:
case FunctorOp::MOD:
case FunctorOp::BAND:
case FunctorOp::BOR:
case FunctorOp::BXOR:
case FunctorOp::BSHIFT_L:
case FunctorOp::BSHIFT_R:
case FunctorOp::BSHIFT_R_UNSIGNED:
case FunctorOp::LAND:
case FunctorOp::LOR:
assert(arg < 2 && "binary functor out of bound");
return TypeAttribute::Signed;
case FunctorOp::UADD:
case FunctorOp::USUB:
case FunctorOp::UMUL:
case FunctorOp::UDIV:
case FunctorOp::UEXP:
case FunctorOp::UMOD:
case FunctorOp::UBAND:
case FunctorOp::UBOR:
case FunctorOp::UBXOR:
case FunctorOp::UBSHIFT_L:
case FunctorOp::UBSHIFT_R:
case FunctorOp::UBSHIFT_R_UNSIGNED:
case FunctorOp::ULAND:
case FunctorOp::ULOR:
assert(arg < 2 && "binary functor out of bound");
return TypeAttribute::Unsigned;
case FunctorOp::FADD:
case FunctorOp::FSUB:
case FunctorOp::FMUL:
case FunctorOp::FDIV:
case FunctorOp::FEXP:
assert(arg < 2 && "binary functor out of bound");
return TypeAttribute::Float;
case FunctorOp::SUBSTR:
assert(arg < 3 && "ternary functor out of bound");
if (arg == 0) {
return TypeAttribute::Symbol;
} else {
return TypeAttribute::Signed; // In the future: Change to unsigned
}
case FunctorOp::MAX:
case FunctorOp::MIN:
return TypeAttribute::Signed;
case FunctorOp::UMAX:
case FunctorOp::UMIN:
return TypeAttribute::Unsigned;
case FunctorOp::FMAX:
case FunctorOp::FMIN:
return TypeAttribute::Float;
case FunctorOp::SMAX:
case FunctorOp::SMIN:
case FunctorOp::CAT:
return TypeAttribute::Symbol;
}
UNREACHABLE_BAD_CASE_ANALYSIS
}
/**
* Indicate whether a functor is overloaded.
* At the moment, the signed versions are treated as representatives (because parser always returns a signed
* version).
*/
inline bool isOverloadedFunctor(const FunctorOp functor) {
switch (functor) {
/* Unary */
case FunctorOp::NEG:
case FunctorOp::BNOT:
case FunctorOp::LNOT:
/* Binary */
case FunctorOp::ADD:
case FunctorOp::SUB:
case FunctorOp::MUL:
case FunctorOp::DIV:
case FunctorOp::EXP:
case FunctorOp::BAND:
case FunctorOp::BOR:
case FunctorOp::BXOR:
case FunctorOp::LAND:
case FunctorOp::LOR:
case FunctorOp::MOD:
case FunctorOp::MAX:
case FunctorOp::MIN:
return true;
break;
default:
break;
}
return false;
}
/**
* Convert an overloaded functor, so that it works with the requested type.
* Example: toType = Float, functor = PLUS -> FPLUS (version of plus working on floats)
*/
inline FunctorOp convertOverloadedFunctor(const FunctorOp functor, const TypeAttribute toType) {
// clang-format off
#define OVERLOAD_SIGNED(op) if (toType == TypeAttribute::Signed ) return FunctorOp::op
#define OVERLOAD_UNSIGNED(op) if (toType == TypeAttribute::Unsigned ) return FunctorOp::U##op
#define OVERLOAD_FLOAT(op) if (toType == TypeAttribute::Float ) return FunctorOp::F##op
#define OVERLOAD_SYMBOL(op) if (toType == TypeAttribute::Symbol ) return FunctorOp::S##op
// clang-format on
#define CASE_INTEGRAL(op) \
case FunctorOp::op: { \
OVERLOAD_SIGNED(op); \
OVERLOAD_UNSIGNED(op); \
} break;
#define CASE_NUMERIC(op) \
case FunctorOp::op: { \
OVERLOAD_SIGNED(op); \
OVERLOAD_UNSIGNED(op); \
OVERLOAD_FLOAT(op); \
} break;
#define CASE_ORDERED(op) \
case FunctorOp::op: { \
OVERLOAD_SIGNED(op); \
OVERLOAD_UNSIGNED(op); \
OVERLOAD_FLOAT(op); \
OVERLOAD_SYMBOL(op); \
} break;
switch (functor) {
default:
fatal("functor is not overloaded");
case FunctorOp::NEG: {
OVERLOAD_SIGNED(NEG);
OVERLOAD_FLOAT(NEG);
} break;
// clang-format off
CASE_INTEGRAL(LAND)
CASE_INTEGRAL(LNOT)
CASE_INTEGRAL(LOR)
CASE_INTEGRAL(BAND)
CASE_INTEGRAL(BNOT)
CASE_INTEGRAL(BOR)
CASE_INTEGRAL(BSHIFT_L)
CASE_INTEGRAL(BSHIFT_R)
CASE_INTEGRAL(BSHIFT_R_UNSIGNED)
CASE_INTEGRAL(BXOR)
CASE_NUMERIC(ADD)
CASE_NUMERIC(SUB)
CASE_NUMERIC(MUL)
CASE_NUMERIC(DIV)
CASE_INTEGRAL(MOD)
CASE_NUMERIC(EXP)
CASE_ORDERED(MAX)
CASE_ORDERED(MIN)
// clang-format on
}
#undef OVERLOAD_SIGNED
#undef OVERLOAD_UNSIGNED
#undef OVERLOAD_FLOAT
#undef OVERLOAD_SYMBOL
#undef CASE_INTERGRAL
#undef CASE_NUMERIC
#undef CASE_ORDERED
fatal("invalid functor conversion");
}
/**
* Determines whether a functor should be written using infix notation (e.g. `a + b + c`)
* or prefix notation (e.g. `+(a,b,c)`)
*/
inline bool isInfixFunctorOp(const FunctorOp op) {
switch (op) {
case FunctorOp::ADD:
case FunctorOp::FADD:
case FunctorOp::UADD:
case FunctorOp::SUB:
case FunctorOp::USUB:
case FunctorOp::FSUB:
case FunctorOp::MUL:
case FunctorOp::FMUL:
case FunctorOp::UMUL:
case FunctorOp::DIV:
case FunctorOp::FDIV:
case FunctorOp::UDIV:
case FunctorOp::EXP:
case FunctorOp::FEXP:
case FunctorOp::UEXP:
case FunctorOp::BAND:
case FunctorOp::UBAND:
case FunctorOp::BOR:
case FunctorOp::UBOR:
case FunctorOp::BXOR:
case FunctorOp::BSHIFT_L:
case FunctorOp::UBSHIFT_L:
case FunctorOp::BSHIFT_R:
case FunctorOp::UBSHIFT_R:
case FunctorOp::BSHIFT_R_UNSIGNED:
case FunctorOp::UBSHIFT_R_UNSIGNED:
case FunctorOp::UBXOR:
case FunctorOp::LAND:
case FunctorOp::ULAND:
case FunctorOp::LOR:
case FunctorOp::ULOR:
case FunctorOp::MOD:
case FunctorOp::UMOD:
return true;
default:
return false;
}
}
} // end of namespace souffle
| 30.527183 | 108 | 0.560011 |
6fbda66d701d7c7082f526b9efa6874057e8abf8 | 1,713 | h | C | DeliriOS_64bits/include/idt.h | Izikiel/intel_multicore | 10ab11fa901f555608a75f9256ea7d14f8aab84d | [
"MIT"
] | 3 | 2015-12-16T06:17:14.000Z | 2019-09-01T08:21:21.000Z | DeliriOS_64bits/include/idt.h | Izikiel/intel_multicore | 10ab11fa901f555608a75f9256ea7d14f8aab84d | [
"MIT"
] | null | null | null | DeliriOS_64bits/include/idt.h | Izikiel/intel_multicore | 10ab11fa901f555608a75f9256ea7d14f8aab84d | [
"MIT"
] | null | null | null | #ifndef __IDT_H__
#define __IDT_H__
#include <types.h>
// Campo de atts de la IDT:
// | | Descriptor | | | |
// |Present | Privilege | 0 D 1 1 0 | 0 0 0 | 0 0 0 0 0 |
// | | Level | | | |
// Trap
//attrs:
//P=1 present segment
//DPL=00 kernel level
//D=1 32 bits
//1000 1111 0000 0000 => 0x8F00
// | 1 | 0 0 | 0 1 1 1 1 | 0 0 0 | 0 0 0 0 0 | = 0x8F00
//Kernel
// Interrupt
//attrs:
//P=1 present segment
//DPL=00 user level
//D=1 32 bits
//1000 1110 0000 0000 => 0x8E00
// | 1 | 0 0 | 0 1 1 1 0 | 0 0 0 | 0 0 0 0 0 | = 0x8E00
//User
// Interrupt
//attrs:
//P=1 present segment
//DPL=11 user level
//D=1 32 bits
//1110 1110 0000 0000 => 0xEE00
// | 1 | 1 1 | 0 1 1 1 0 | 0 0 0 | 0 0 0 0 0 | = 0xEE00
#define IDT_ENTRIES_COUNT 255
#define KERNEL_TRAP_GATE_TYPE 0x8F00
#define KERNEL_INT_GATE_TYPE 0x8E00
#define SERVICE_INT_GATE_TYPE 0xEE00
/* Struct de descriptor de IDT */
typedef struct str_idt_descriptor {
uint16_t idt_length;
uint64_t idt_addr;
} __attribute__((__packed__)) idt_descriptor;
/* Struct de una entrada de la IDT */
typedef struct str_idt_entry_fld {
uint16_t offset_0_15;
uint16_t segsel;
uint16_t attr;
uint16_t offset_16_31;
uint32_t offset_32_63;
uint32_t zeroPadd;
} __attribute__((__packed__, aligned (8))) idt_entry;
extern idt_entry idt[];
extern idt_descriptor IDT_DESC;
void idt_inicializar();
//Handler de ignorar interrupciones espurias
// De acuerdo a la APIC spec, los 4 bits de abajo deben estar en 1.
// Lo demas lo seteamos nosotros.
#define SPURIOUS_VEC_NUM ((1 << 3) & 0xF)
#define SPURIOUS_INTR_NUM ((SPURIOUS_VEC_NUM << 4) | 0xF)
#endif /* !__IDT_H__ */
| 24.126761 | 67 | 0.645067 |
6fd072a086bb3695c431a0c2e2df467cac3e1832 | 4,127 | h | C | tesseract_srdf/include/tesseract_srdf/srdf_model.h | daoran/tesseract | 2c593d12a0a470bd2672fdf6ff86843dd69b6e4a | [
"BSD-3-Clause",
"BSD-2-Clause",
"Apache-2.0"
] | 25 | 2021-11-08T05:41:28.000Z | 2022-03-29T12:17:30.000Z | tesseract_srdf/include/tesseract_srdf/srdf_model.h | daoran/tesseract | 2c593d12a0a470bd2672fdf6ff86843dd69b6e4a | [
"BSD-3-Clause",
"BSD-2-Clause",
"Apache-2.0"
] | 79 | 2021-10-30T19:53:38.000Z | 2022-03-31T21:37:43.000Z | tesseract_srdf/include/tesseract_srdf/srdf_model.h | daoran/tesseract | 2c593d12a0a470bd2672fdf6ff86843dd69b6e4a | [
"BSD-3-Clause",
"BSD-2-Clause",
"Apache-2.0"
] | 10 | 2021-11-09T03:02:08.000Z | 2022-03-23T02:24:33.000Z | /**
* @file srdf_model.h
* @brief Parse srdf xml
*
* @author Levi Armstrong, Ioan Sucan
* @date May 12, 2020
* @version TODO
* @bug No known bugs
*
* @copyright Copyright (c) 2020, Southwest Research Institute
*
* @par License
* Software License Agreement (Apache License)
* @par
* 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
* @par
* 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 TESSERACT_SRDF_SRDF_MODEL_H
#define TESSERACT_SRDF_SRDF_MODEL_H
#include <tesseract_common/macros.h>
TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
#include <boost/serialization/access.hpp>
#include <string>
#include <memory>
#include <array>
#include <Eigen/Core>
TESSERACT_COMMON_IGNORE_WARNINGS_POP
#include <tesseract_srdf/kinematics_information.h>
#include <tesseract_scene_graph/graph.h>
#include <tesseract_common/allowed_collision_matrix.h>
#include <tesseract_common/resource_locator.h>
#include <tesseract_common/collision_margin_data.h>
#ifdef SWIG
%shared_ptr(tesseract_srdf::SRDFModel)
#endif // SWIG
/// Main namespace
namespace tesseract_srdf
{
using CollisionMarginData = tesseract_common::CollisionMarginData;
using PairsCollisionMarginData = tesseract_common::PairsCollisionMarginData;
/** @brief Representation of semantic information about the robot */
class SRDFModel
{
public:
// LCOV_EXCL_START
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
// LCOV_EXCL_STOP
using Ptr = std::shared_ptr<SRDFModel>;
using ConstPtr = std::shared_ptr<const SRDFModel>;
SRDFModel() = default;
virtual ~SRDFModel() = default;
SRDFModel(const SRDFModel&) = default;
SRDFModel& operator=(const SRDFModel&) = default;
SRDFModel(SRDFModel&&) = default;
SRDFModel& operator=(SRDFModel&&) = default;
/**
* @brief Load Model given a filename
* @throws std::nested_exception if an error occurs during parsing srdf
*/
void initFile(const tesseract_scene_graph::SceneGraph& scene_graph,
const std::string& filename,
const tesseract_common::ResourceLocator& locator);
/**
* @brief Load Model from a XML-string
* @throws std::nested_exception if an error occurs during parsing srdf
*/
void initString(const tesseract_scene_graph::SceneGraph& scene_graph,
const std::string& xmlstring,
const tesseract_common::ResourceLocator& locator);
/** @brief Save the model to a file */
bool saveToFile(const std::string& file_path) const;
/** @brief Clear the model */
void clear();
/** @brief The name of the srdf model */
std::string name{ "undefined" };
/** @brief The version number major.minor[.patch] */
std::array<int, 3> version{ { 1, 0, 0 } };
/** @brief Contact information related to kinematics */
KinematicsInformation kinematics_information;
/** @brief The contact managers plugin information */
tesseract_common::ContactManagersPluginInfo contact_managers_plugin_info;
/** @brief The allowed collision matrix */
tesseract_common::AllowedCollisionMatrix acm;
/** @brief Collision margin data */
tesseract_common::CollisionMarginData::Ptr collision_margin_data;
/** @brief The calibration information */
tesseract_common::CalibrationInfo calibration_info;
bool operator==(const SRDFModel& rhs) const;
bool operator!=(const SRDFModel& rhs) const;
private:
friend class boost::serialization::access;
template <class Archive>
void serialize(Archive& ar, const unsigned int version); // NOLINT
};
} // namespace tesseract_srdf
#include <boost/serialization/export.hpp>
#include <boost/serialization/tracking.hpp>
BOOST_CLASS_EXPORT_KEY2(tesseract_srdf::SRDFModel, "SRDFModel")
#endif // TESSERACT_SRDF_SRDF_MODEL_H
| 31.265152 | 76 | 0.744609 |
8d1fd6bb25d89cae7efc7396c6ed5f0e3f790737 | 1,981 | c | C | minix-2.0/fs/usr/src/lib/libp/dis.c | jorenvo/minix2 | a2a4c092b95f806035d28a1169df68205c599904 | [
"BSD-3-Clause"
] | 71 | 2017-04-03T22:37:27.000Z | 2022-02-20T04:27:19.000Z | minix-2.0/fs/usr/src/lib/libp/dis.c | jorenvo/minix2 | a2a4c092b95f806035d28a1169df68205c599904 | [
"BSD-3-Clause"
] | 3 | 2017-10-04T12:45:32.000Z | 2021-07-16T12:13:49.000Z | minix-2.0/fs/usr/src/lib/libp/dis.c | jorenvo/minix2 | a2a4c092b95f806035d28a1169df68205c599904 | [
"BSD-3-Clause"
] | 30 | 2017-09-26T23:10:58.000Z | 2021-10-01T04:46:12.000Z | /* $Header: dis.c,v 2.1 84/07/20 11:03:16 sater Stab $ */
/*
* (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
*
* This product is part of the Amsterdam Compiler Kit.
*
* Permission to use, sell, duplicate or disclose this software must be
* obtained in writing. Requests for such permissions may be sent to
*
* Dr. Andrew S. Tanenbaum
* Wiskundig Seminarium
* Vrije Universiteit
* Postbox 7161
* 1007 MC Amsterdam
* The Netherlands
*
*/
/* Author: J.W. Stevenson */
#include <pc_err.h>
#define assert() /* nothing */
/*
* use circular list of free blocks from low to high addresses
* _highp points to free block with highest address
*/
struct adm {
struct adm *next;
int size;
};
extern struct adm *_lastp;
extern struct adm *_highp;
extern _trp();
static int merge(p1,p2) struct adm *p1,*p2; {
struct adm *p;
p = (struct adm *)((char *)p1 + p1->size);
if (p > p2)
_trp(EFREE);
if (p != p2)
return(0);
p1->size += p2->size;
p1->next = p2->next;
return(1);
}
_dis(n,pp) int n; struct adm **pp; {
struct adm *p1,*p2;
/*
* NOTE: dispose only objects whose size is a multiple of sizeof(*pp).
* this is always true for objects allocated by _new()
*/
n = ((n+sizeof(*p1)-1) / sizeof(*p1)) * sizeof(*p1);
if (n == 0)
return;
if ((p1= *pp) == (struct adm *) 0)
_trp(EFREE);
p1->size = n;
if ((p2 = _highp) == 0) /*p1 is the only free block*/
p1->next = p1;
else {
if (p2 > p1) {
/*search for the preceding free block*/
if (_lastp < p1) /*reduce search*/
p2 = _lastp;
while (p2->next < p1)
p2 = p2->next;
}
/* if p2 preceeds p1 in the circular list,
* try to merge them */
p1->next = p2->next; p2->next = p1;
if (p2 <= p1 && merge(p2,p1))
p1 = p2;
p2 = p1->next;
/* p1 preceeds p2 in the circular list */
if (p2 > p1) merge(p1,p2);
}
if (p1 >= p1->next)
_highp = p1;
_lastp = p1;
*pp = (struct adm *) 0;
}
| 22.511364 | 76 | 0.596164 |
a58e2731167095eb1ffc6007c538ce84d937afdb | 1,345 | h | C | code/src/Dispatcher/DispatcherManager.h | salmanahmedshaikh/streamOLAPOptimization | 0a352bbd6e364865013452d30d2654e33b627e69 | [
"Apache-2.0"
] | 1 | 2021-04-15T11:42:52.000Z | 2021-04-15T11:42:52.000Z | code/src/Dispatcher/DispatcherManager.h | salmanahmedshaikh/streamOLAPOptimization | 0a352bbd6e364865013452d30d2654e33b627e69 | [
"Apache-2.0"
] | null | null | null | code/src/Dispatcher/DispatcherManager.h | salmanahmedshaikh/streamOLAPOptimization | 0a352bbd6e364865013452d30d2654e33b627e69 | [
"Apache-2.0"
] | 1 | 2019-08-25T05:46:20.000Z | 2019-08-25T05:46:20.000Z | //////////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2017 KDE Laboratory, University of Tsukuba, Tsukuba, Japan. //
// //
// The JsSpinnerSPE/StreamingCube and the accompanying materials are made available //
// under the terms of Eclipse Public License v1.0 which accompanies this distribution //
// and is available at <https://eclipse.org/org/documents/epl-v10.php> //
//////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "../Common/stdafx.h"
#include "../Common/Types.h"
#include <cstdlib>
#include <boost/noncopyable.hpp>
#include <event2/event.h>
#include <event2/buffer.h>
#include <event2/bufferevent.h>
#include <boost/shared_ptr.hpp>
#include <boost/unordered_map.hpp>
//#include "../IO/IOManager.h"
class DispatcherManager:private boost::noncopyable
{
private:
static DispatcherManager* dispatcherManager;
DispatcherManager(void);
void initialize(void);
public:
static DispatcherManager* getInstance(void);
~DispatcherManager(void);
void execute(std::map<std::string, int> workerIPIDMap, std::vector<std::string> dispatcherQueryVec);
};
| 36.351351 | 108 | 0.557621 |
a5a2bf2383517e8c66c02f71e45c6baa7f629103 | 553 | h | C | Engine/translator.h | vadkasevas/BAS | 657f62794451c564c77d6f92b2afa9f5daf2f517 | [
"MIT"
] | 302 | 2016-05-20T12:55:23.000Z | 2022-03-29T02:26:14.000Z | Engine/translator.h | chulakshana/BAS | 955f5a41bd004bcdd7d19725df6ab229b911c09f | [
"MIT"
] | 9 | 2016-07-21T09:04:50.000Z | 2021-05-16T07:34:42.000Z | Engine/translator.h | chulakshana/BAS | 955f5a41bd004bcdd7d19725df6ab229b911c09f | [
"MIT"
] | 113 | 2016-05-18T07:48:37.000Z | 2022-02-26T12:59:39.000Z | #ifndef TRANSLATOR_H
#define TRANSLATOR_H
#include "engine_global.h"
#include "itranslator.h"
#include <QTranslator>
namespace BrowserAutomationStudioFramework
{
class ENGINESHARED_EXPORT Translator : public ITranslator
{
Q_OBJECT
QTranslator *LastLanguage;
QString Directory;
public:
explicit Translator(QObject *parent = 0);
virtual void Translate(const QString &lang);
virtual void SetDirectory(const QString &Directory);
signals:
public slots:
};
}
#endif // TRANSLATOR_H
| 20.481481 | 61 | 0.698011 |
77ba8137981b70910db8cd0f1b5e4732dc54c968 | 217 | h | C | SKNewsProject/SKNewsProject/Class/Functions/HomePage/SKHomePageVC.h | shaveKevin/iOS-Learning-Demo | e9b6972a112eed12afbee18ea3a994bfd305d8df | [
"MIT"
] | 1 | 2019-12-13T08:38:10.000Z | 2019-12-13T08:38:10.000Z | SKNewsProject/SKNewsProject/Class/Functions/HomePage/SKHomePageVC.h | shaveKevin/iOS-Learning-Demo | e9b6972a112eed12afbee18ea3a994bfd305d8df | [
"MIT"
] | null | null | null | SKNewsProject/SKNewsProject/Class/Functions/HomePage/SKHomePageVC.h | shaveKevin/iOS-Learning-Demo | e9b6972a112eed12afbee18ea3a994bfd305d8df | [
"MIT"
] | null | null | null | //
// SKHomePageVC.h
// SKNewsProject
//
// Created by shavekevin on 2016/11/22.
// Copyright © 2016年 shavekevin. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface SKHomePageVC : UIViewController
@end
| 15.5 | 54 | 0.705069 |
a043b0952edb7a2b74708eeb6ef096d9c0958990 | 1,171 | c | C | sel4-camkes-proj/projects/camkes/vm/templates/seL4ExcludeGuestPAddr.template.c | mssabr01/Dissertation-Work | 355366ed658c6d18f83d6751bf66a7f83786e22d | [
"Apache-2.0"
] | null | null | null | sel4-camkes-proj/projects/camkes/vm/templates/seL4ExcludeGuestPAddr.template.c | mssabr01/Dissertation-Work | 355366ed658c6d18f83d6751bf66a7f83786e22d | [
"Apache-2.0"
] | null | null | null | sel4-camkes-proj/projects/camkes/vm/templates/seL4ExcludeGuestPAddr.template.c | mssabr01/Dissertation-Work | 355366ed658c6d18f83d6751bf66a7f83786e22d | [
"Apache-2.0"
] | null | null | null | /*
* Copyright 2017, Data61
* Commonwealth Scientific and Industrial Research Organisation (CSIRO)
* ABN 41 687 119 230.
*
* This software may be distributed and modified according to the terms of
* the BSD 2-Clause license. Note that NO WARRANTY is provided.
* See "LICENSE_BSD2.txt" for details.
*
* @TAG(DATA61_BSD)
*/
#include <assert.h>
#include <camkes/error.h>
#include <stdio.h>
#include <stdint.h>
#include <sel4/sel4.h>
/*? macros.show_includes(me.instance.type.includes) ?*/
/*- set regions = configuration[me.parent.to_instance.name].get(me.parent.to_interface.name) -*/
static uintptr_t exclude_regions[] = {
/*- if regions is not none -*/
/*- for paddr, bytes in regions -*/
/*? paddr ?*/, /*? bytes ?*/,
/*- endfor -*/
/*- endif -*/
};
int /*? me.interface.name ?*/_num_regions() {
return ARRAY_SIZE(exclude_regions) / 2;
}
void /*? me.interface.name ?*/_get_region(int region_num, uintptr_t *paddr, size_t *bytes) {
assert(paddr);
assert(bytes);
assert(region_num < /*? me.interface.name ?*/_num_regions());
*paddr = exclude_regions[region_num * 2];
*bytes = exclude_regions[(region_num * 2) + 1];
}
| 28.560976 | 96 | 0.666951 |
99545910a608c949ea2f9b336bdcf667a2264cb0 | 418 | h | C | Classes/Circuit.h | QuentinGruber/F1sim | c0800bb7621af16ad21fb43c2f2f6e2f42d9ad76 | [
"MIT"
] | null | null | null | Classes/Circuit.h | QuentinGruber/F1sim | c0800bb7621af16ad21fb43c2f2f6e2f42d9ad76 | [
"MIT"
] | null | null | null | Classes/Circuit.h | QuentinGruber/F1sim | c0800bb7621af16ad21fb43c2f2f6e2f42d9ad76 | [
"MIT"
] | null | null | null | //
// Created by Quentin on 06/02/2020.
//
#ifndef PROJ_C_CIRCUIT_H
#define PROJ_C_CIRCUIT_H
class Circuit {
public:
/// Number of laps in the race
int lap = 50;
/// Circuit length in meter
float Circuit_length = 5371.0;
/// Number of right bends in the circuit
float right_bends = 4.0;
/// Number of left bends in the circuit
float left_bends = 5.0;
};
#endif //PROJ_C_CIRCUIT_H
| 17.416667 | 44 | 0.660287 |
85c56739b4433937b012da1563759307afd64bab | 264 | h | C | ios/versioned-react-native/ABI25_0_0/Expo/Core/Api/Components/Maps/ABI25_0_0AIRMapUrlTileManager.h | mauriciord/expo | c0a4dc89a3a74836cdc88440645313eadfc40e4a | [
"Apache-2.0",
"MIT"
] | 1 | 2019-07-20T03:35:10.000Z | 2019-07-20T03:35:10.000Z | ios/versioned-react-native/ABI25_0_0/Expo/Core/Api/Components/Maps/ABI25_0_0AIRMapUrlTileManager.h | mauriciord/expo | c0a4dc89a3a74836cdc88440645313eadfc40e4a | [
"Apache-2.0",
"MIT"
] | null | null | null | ios/versioned-react-native/ABI25_0_0/Expo/Core/Api/Components/Maps/ABI25_0_0AIRMapUrlTileManager.h | mauriciord/expo | c0a4dc89a3a74836cdc88440645313eadfc40e4a | [
"Apache-2.0",
"MIT"
] | null | null | null | //
// ABI25_0_0AIRMapUrlTileManager.h
// AirMaps
//
// Created by cascadian on 3/19/16.
// Copyright © 2016. All rights reserved.
//
#import <ReactABI25_0_0/ABI25_0_0RCTViewManager.h>
@interface ABI25_0_0AIRMapUrlTileManager : ABI25_0_0RCTViewManager
@end
| 17.6 | 66 | 0.757576 |
c4688fb05a80e1d14d0d67e2656f4bd100121899 | 3,508 | h | C | dali/internal/event/events/gesture-impl.h | dalihub/dali-core | f9b1a5a637bbc91de4aaf9e0be9f79cba0bbb195 | [
"Apache-2.0",
"BSD-3-Clause"
] | 21 | 2016-11-18T10:26:40.000Z | 2021-11-02T09:46:15.000Z | dali/internal/event/events/gesture-impl.h | dalihub/dali-core | f9b1a5a637bbc91de4aaf9e0be9f79cba0bbb195 | [
"Apache-2.0",
"BSD-3-Clause"
] | 7 | 2016-10-18T17:39:12.000Z | 2020-12-01T11:45:36.000Z | dali/internal/event/events/gesture-impl.h | dalihub/dali-core | f9b1a5a637bbc91de4aaf9e0be9f79cba0bbb195 | [
"Apache-2.0",
"BSD-3-Clause"
] | 16 | 2017-03-08T15:50:32.000Z | 2021-05-24T06:58:10.000Z | #ifndef DALI_INTERNAL_GESTURE_H
#define DALI_INTERNAL_GESTURE_H
/*
* Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* 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.
*
*/
// INTERNAL INCLUDES
#include <dali/integration-api/events/event.h>
#include <dali/public-api/events/gesture.h>
#include <dali/public-api/object/base-object.h>
namespace Dali
{
namespace Internal
{
class Gesture;
using GesturePtr = IntrusivePtr<Gesture>;
/**
* This is the abstract base structure for any gestures that the adaptor detects and wishes to send
* to the Core.
*/
class Gesture : public BaseObject
{
public:
/**
* @brief Get the gesture type.
*
* @return The gesture type.
*/
inline GestureType::Value GetType() const
{
return mGestureType;
}
/**
* @brief Set the state of the gesture.
* @param[in] state The state of the gesture to set
*/
inline void SetState(GestureState state)
{
mState = state;
}
/**
* @brief Get the state of the gesture.
*
* @return The state of the gesture.
*/
inline GestureState GetState() const
{
return mState;
}
/**
* @brief Set The time the gesture took place.
* @param[in] time The time the gesture took place. to set
*/
inline void SetTime(uint32_t time)
{
mTime = time;
}
/**
* @brief Get the time the gesture took place.
*
* @return The time the gesture took place.
*/
inline uint32_t GetTime() const
{
return mTime;
}
Gesture(const Gesture&) = delete; ///< Deleted copy constructor
Gesture(Gesture&&) = delete; ///< Deleted move constructor
Gesture& operator=(const Gesture&) = delete; ///< Deleted copy assignment operator
Gesture& operator=(Gesture&&) = delete; ///< Deleted move assignment operator
protected:
/**
* This constructor is only used by derived classes.
* @param[in] gestureType The type of gesture event.
* @param[in] gestureState The state of the gesture event.
*/
Gesture(GestureType::Value gestureType, GestureState gestureState)
: mGestureType(gestureType),
mState(gestureState)
{
}
/**
* @brief Virtual destructor.
*
* A reference counted object may only be deleted by calling Unreference()
*/
~Gesture() override = default;
private:
GestureType::Value mGestureType;
GestureState mState;
uint32_t mTime{0u};
};
} // namespace Internal
/**
* Helper methods for public API.
*/
inline Internal::Gesture& GetImplementation(Dali::Gesture& gesture)
{
DALI_ASSERT_ALWAYS(gesture && "gesture handle is empty");
BaseObject& handle = gesture.GetBaseObject();
return static_cast<Internal::Gesture&>(handle);
}
inline const Internal::Gesture& GetImplementation(const Dali::Gesture& gesture)
{
DALI_ASSERT_ALWAYS(gesture && "gesture handle is empty");
const BaseObject& handle = gesture.GetBaseObject();
return static_cast<const Internal::Gesture&>(handle);
}
} // namespace Dali
#endif // DALI_INTERNAL_GESTURE_H
| 24.361111 | 99 | 0.688997 |
e233924e3d00cb20ae6cc69b38d1ff81d091e207 | 891 | h | C | cases/comparison_navigators/param/post/objects/surfer__us_15o58__surftimeconst_4o0__reorientationtime_0o5/px/group/choice.h | C0PEP0D/sheld0n | 497d4ee8b6b1815cd5fa1b378d1b947ee259f4bc | [
"MIT"
] | null | null | null | cases/comparison_navigators/param/post/objects/surfer__us_15o58__surftimeconst_4o0__reorientationtime_0o5/px/group/choice.h | C0PEP0D/sheld0n | 497d4ee8b6b1815cd5fa1b378d1b947ee259f4bc | [
"MIT"
] | null | null | null | cases/comparison_navigators/param/post/objects/surfer__us_15o58__surftimeconst_4o0__reorientationtime_0o5/px/group/choice.h | C0PEP0D/sheld0n | 497d4ee8b6b1815cd5fa1b378d1b947ee259f4bc | [
"MIT"
] | null | null | null | #ifndef C0P_PARAM_POST_OBJECTS_SURFER__US_15O58__SURFTIMECONST_4O0__REORIENTATIONTIME_0O5_PX_GROUP_CHOICE_H
#define C0P_PARAM_POST_OBJECTS_SURFER__US_15O58__SURFTIMECONST_4O0__REORIENTATIONTIME_0O5_PX_GROUP_CHOICE_H
#pragma once
// THIS FILE SHOULD NOT BE EDITED DIRECTLY BY THE USERS.
// THIS FILE WILL BE AUTOMATICALLY EDITED WHEN THE
// CHOOSE COMMAND IS USED
// choose your post
#include "core/post/objects/object/post/group/all/core.h"
#include "param/post/objects/surfer__us_15o58__surftimeconst_4o0__reorientationtime_0o5/px/group/all/parameters.h"
namespace c0p {
template<typename TypeSurferUs15O58Surftimeconst4O0Reorientationtime0O5Step>
using PostSurferUs15O58Surftimeconst4O0Reorientationtime0O5PxGroup = PostPostGroupAll<PostSurferUs15O58Surftimeconst4O0Reorientationtime0O5PxGroupAllParameters, TypeSurferUs15O58Surftimeconst4O0Reorientationtime0O5Step>;
}
#endif
| 46.894737 | 224 | 0.87991 |
e95ef63d7dd8482e86d612d0ef040b79e6b2dc15 | 3,534 | h | C | src/vm/arm64/gmscpu.h | danmosemsft/coreclr | 04a3d11e4eecec2a4b7dcc81ab1575a57e30e3e2 | [
"MIT"
] | 1 | 2019-04-14T16:52:47.000Z | 2019-04-14T16:52:47.000Z | src/vm/arm64/gmscpu.h | danmosemsft/coreclr | 04a3d11e4eecec2a4b7dcc81ab1575a57e30e3e2 | [
"MIT"
] | null | null | null | src/vm/arm64/gmscpu.h | danmosemsft/coreclr | 04a3d11e4eecec2a4b7dcc81ab1575a57e30e3e2 | [
"MIT"
] | 1 | 2019-11-12T01:26:39.000Z | 2019-11-12T01:26:39.000Z | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
/**************************************************************/
/* gmscpu.h */
/**************************************************************/
/* HelperFrame is defines 'GET_STATE(machState)' macro, which
figures out what the state of the machine will be when the
current method returns. It then stores the state in the
JIT_machState structure. */
/**************************************************************/
#ifndef __gmscpu_h__
#define __gmscpu_h__
#define __gmscpu_h__
// X19 - X29
#define NUM_NONVOLATILE_CONTEXT_POINTERS 11
struct MachState {
ULONG64 captureX19_X29[NUM_NONVOLATILE_CONTEXT_POINTERS]; // preserved registers
PTR_ULONG64 ptrX19_X29[NUM_NONVOLATILE_CONTEXT_POINTERS]; // pointers to preserved registers
TADDR _pc; // program counter after the function returns
TADDR _sp; // stack pointer after the function returns
BOOL _isValid;
BOOL isValid() { LIMITED_METHOD_DAC_CONTRACT; return _isValid; }
TADDR GetRetAddr() { LIMITED_METHOD_DAC_CONTRACT; return _pc; }
};
struct LazyMachState : public MachState{
TADDR captureSp; // Stack pointer at the time of capture
TADDR captureIp; // Instruction pointer at the time of capture
void setLazyStateFromUnwind(MachState* copy);
static void unwindLazyState(LazyMachState* baseState,
MachState* lazyState,
DWORD threadId,
int funCallDepth = 1,
HostCallPreference hostCallPreference = AllowHostCalls);
};
inline void LazyMachState::setLazyStateFromUnwind(MachState* copy)
{
#if defined(DACCESS_COMPILE)
// This function cannot be called in DAC because DAC cannot update target memory.
DacError(E_FAIL);
return;
#else // !DACCESS_COMPILE
_sp = copy->_sp;
_pc = copy->_pc;
// Now copy the preserved register pointers. Note that some of the pointers could be
// pointing to copy->captureX19_X29[]. If that is case then while copying to destination
// ensure that they point to corresponding element in captureX19_X29[] of destination.
ULONG64* srcLowerBound = ©->captureX19_X29[0];
ULONG64* srcUpperBound = (ULONG64*)((BYTE*)copy + offsetof(MachState, ptrX19_X29));
for (int i = 0; i<NUM_NONVOLATILE_CONTEXT_POINTERS; i++)
{
if (copy->ptrX19_X29[i] >= srcLowerBound && copy->ptrX19_X29[i] < srcUpperBound)
{
ptrX19_X29[i] = (PTR_ULONG64)((BYTE*)copy->ptrX19_X29[i] - (BYTE*)srcLowerBound + (BYTE*)captureX19_X29);
}
else
{
ptrX19_X29[i] = copy->ptrX19_X29[i];
}
}
// this has to be last because we depend on write ordering to
// synchronize the race implicit in updating this struct
VolatileStore(&_isValid, TRUE);
#endif // DACCESS_COMPILE
}
// Do the initial capture of the machine state. This is meant to be
// as light weight as possible, as we may never need the state that
// we capture.
EXTERN_C void LazyMachStateCaptureState(struct LazyMachState *pState);
#define CAPTURE_STATE(machState, ret) \
LazyMachStateCaptureState(machState)
#endif
| 37.595745 | 117 | 0.624222 |
6a1c9b33c7e2fd880e31d0af40a6f7fc6174647c | 957 | h | C | PrivateFrameworks/ContactsUICore/CNTUCallProviderManager.h | phatblat/macOSPrivateFrameworks | 9047371eb80f925642c8a7c4f1e00095aec66044 | [
"MIT"
] | 17 | 2018-11-13T04:02:58.000Z | 2022-01-20T09:27:13.000Z | PrivateFrameworks/ContactsUICore/CNTUCallProviderManager.h | phatblat/macOSPrivateFrameworks | 9047371eb80f925642c8a7c4f1e00095aec66044 | [
"MIT"
] | 3 | 2018-04-06T02:02:27.000Z | 2018-10-02T01:12:10.000Z | PrivateFrameworks/ContactsUICore/CNTUCallProviderManager.h | phatblat/macOSPrivateFrameworks | 9047371eb80f925642c8a7c4f1e00095aec66044 | [
"MIT"
] | 1 | 2018-09-28T13:54:23.000Z | 2018-09-28T13:54:23.000Z | //
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//
#import "NSObject.h"
#import "CNTUCallProviderManager.h"
@class NSString, TUCallProviderManager;
@interface CNTUCallProviderManager : NSObject <CNTUCallProviderManager>
{
TUCallProviderManager *_callProviderManager;
}
@property(copy, nonatomic) TUCallProviderManager *callProviderManager; // @synthesize callProviderManager=_callProviderManager;
- (void).cxx_destruct;
- (id)thirdPartyCallProviderWithBundleIdentifier:(id)arg1;
- (id)thirdPartyCallProvidersForActionType:(id)arg1;
- (id)observableForCallProvidersChangedWithSchedulerProvider:(id)arg1;
- (id)providerManagerQueue;
- (id)init;
// Remaining properties
@property(readonly, copy) NSString *debugDescription;
@property(readonly, copy) NSString *description;
@property(readonly) unsigned long long hash;
@property(readonly) Class superclass;
@end
| 28.147059 | 127 | 0.783699 |
7583aeb3c38ff3758eaca23e4d72971dd9f2e5de | 1,370 | c | C | qemu/tests/qtest/pcnet-test.c | hyunjoy/scripts | 01114d3627730d695b5ebe61093c719744432ffa | [
"Apache-2.0"
] | 44 | 2022-03-16T08:32:31.000Z | 2022-03-31T16:02:35.000Z | qemu/tests/qtest/pcnet-test.c | hyunjoy/scripts | 01114d3627730d695b5ebe61093c719744432ffa | [
"Apache-2.0"
] | 1 | 2022-03-29T02:30:28.000Z | 2022-03-30T03:40:46.000Z | qemu/tests/qtest/pcnet-test.c | hyunjoy/scripts | 01114d3627730d695b5ebe61093c719744432ffa | [
"Apache-2.0"
] | 18 | 2022-03-19T04:41:04.000Z | 2022-03-31T03:32:12.000Z | /*
* QTest testcase for PC-Net NIC
*
* Copyright (c) 2013-2014 SUSE LINUX Products GmbH
*
* This work is licensed under the terms of the GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
*/
#include "qemu/osdep.h"
#include "libqos/libqtest.h"
#include "qemu/module.h"
#include "libqos/qgraph.h"
#include "libqos/pci.h"
typedef struct QPCNet QPCNet;
struct QPCNet {
QOSGraphObject obj;
QPCIDevice dev;
};
static void *pcnet_get_driver(void *obj, const char *interface)
{
QPCNet *pcnet = obj;
if (!g_strcmp0(interface, "pci-device")) {
return &pcnet->dev;
}
fprintf(stderr, "%s not present in pcnet\n", interface);
g_assert_not_reached();
}
static void *pcnet_create(void *pci_bus, QGuestAllocator *alloc, void *addr)
{
QPCNet *pcnet = g_new0(QPCNet, 1);
QPCIBus *bus = pci_bus;
qpci_device_init(&pcnet->dev, bus, addr);
pcnet->obj.get_driver = pcnet_get_driver;
return &pcnet->obj;
}
static void pcnet_register_nodes(void)
{
QOSGraphEdgeOptions opts = {
.extra_device_opts = "addr=04.0",
};
add_qpci_address(&opts, &(QPCIAddress) { .devfn = QPCI_DEVFN(4, 0) });
qos_node_create_driver("pcnet", pcnet_create);
qos_node_consumes("pcnet", "pci-bus", &opts);
qos_node_produces("pcnet", "pci-device");
}
libqos_init(pcnet_register_nodes);
| 23.220339 | 76 | 0.680292 |
1d03dd076ece89b30a2fac54ba7ecc62f844e220 | 2,824 | h | C | lib/nocan.h | omzlo/canzero-core-firmware | 9ba8d74f067598f3ce055d40d47c49c283acfba6 | [
"MIT"
] | 2 | 2020-02-20T23:29:20.000Z | 2021-08-17T19:29:17.000Z | lib/nocan.h | omzlo/canzero-core-firmware | 9ba8d74f067598f3ce055d40d47c49c283acfba6 | [
"MIT"
] | null | null | null | lib/nocan.h | omzlo/canzero-core-firmware | 9ba8d74f067598f3ce055d40d47c49c283acfba6 | [
"MIT"
] | 4 | 2018-09-29T13:44:22.000Z | 2020-09-01T14:28:46.000Z | #ifndef _NOCAN_H_
#define _NOCAN_H_
#include <stdint.h>
#include <nocan_ll.h>
/*
EID format used:
pos size description
------------------------
0 1 first_packet_flag (0=>not the fist packet in a block, 1=> is the first packet)
1 7 node_id
8 1 last_packet_flag (0=>not the last packet in a block, 1=> is not the last packet)
9 1 reserved
10 1 sys_flag
-- if sys_flag == 0 then
11 2 reserved
13 16 channel_id
-- if sys_flag == 1 then
11 2 reserved
13 8 function
21 8 parameter
------------------------
29 - total length
*/
typedef int16_t NocanChannelId;
typedef int8_t NocanNodeId;
typedef struct {
NocanNodeId node_id;
NocanChannelId channel_id;
uint8_t data_len;
uint8_t data[64];
} NocanMessage;
class NocanClass {
public:
enum {
OK = 0,
ERROR = -1,
TIMEOUT = -2,
NO_DATA = -3,
NO_BUFFER_AVAILABLE = -4,
SYSTEM_MESSAGE = -32,
WORKING = -33
};
NocanNodeId open(void);
int8_t close(void) {
led(false);
/* TODO: send close sys message */
return NocanClass::OK;
}
int8_t lookupChannel(const char *channel, NocanChannelId *channel_id) const;
int8_t registerChannel(const char *channel, NocanChannelId *channel_id) const;
int8_t unregisterChannel(NocanChannelId channel_id) const;
int8_t subscribeChannel(NocanChannelId channel_id) const;
int8_t lookupAndSubscribeChannel(const char *channel, NocanChannelId *channel_id) const {
uint8_t status;
status = lookupChannel(channel,channel_id);
if (status<0)
return NocanClass::ERROR;
return subscribeChannel(*channel_id);
}
int8_t unsubscribeChannel(NocanChannelId channel_id) const;
int8_t publishMessage(const NocanMessage &msg) const;
int8_t publishMessage(NocanChannelId cid, const char *str) const;
int8_t receiveMessage(NocanMessage *msg) const;
int8_t getUniqueDeviceIdentifier(uint8_t *dest) const {
return nocan_ll_get_udid(dest);
}
uint8_t status(void) const {
return nocan_ll_get_status();
}
bool receivePending(void) const {
return (bool)nocan_ll_rx_pending();
}
bool transmitPending(void) const {
return (bool)nocan_ll_tx_pending();
}
void led(bool on) {
nocan_ll_set_led((int)on);
}
private:
NocanNodeId _node_id;
};
extern NocanClass Nocan;
#endif
| 25.908257 | 99 | 0.567635 |
0eabc341fb641c9b7808bcc63d4d8ce191c16873 | 1,421 | h | C | ios/Frameworks/AnXinSDK.framework/Headers/UpDataCert.h | AHECA/sts_flutter | 5694ff3a47175e471b041872433c4fb8ae2d62c8 | [
"MIT"
] | null | null | null | ios/Frameworks/AnXinSDK.framework/Headers/UpDataCert.h | AHECA/sts_flutter | 5694ff3a47175e471b041872433c4fb8ae2d62c8 | [
"MIT"
] | null | null | null | ios/Frameworks/AnXinSDK.framework/Headers/UpDataCert.h | AHECA/sts_flutter | 5694ff3a47175e471b041872433c4fb8ae2d62c8 | [
"MIT"
] | null | null | null | //
// UpDataCert.h
// AnXinSDK
//
// Created by 安徽省电子认证管理中心 on 2018/7/3.
// Copyright © 2018年 mac. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface UpDataCert : NSObject
/**签名证书*/
@property (nonatomic, copy) NSString *signCert;
/**签名证书序列号*/
@property (nonatomic, copy) NSString *signCertSerial;
/**加密证书序列号*/
@property (nonatomic, copy) NSString *encCertSerial;
/**证书生效日期*/
@property (nonatomic, copy) NSString *startDate;
/**证书失效日期*/
@property (nonatomic, copy) NSString *endDate;
/**证书状态*/
@property (nonatomic, copy) NSString *certStatus;
/**证书算法标识*/
@property (nonatomic, copy) NSString *algorithm;
/**主题*/
@property (nonatomic, copy) NSString *subjectDN;
/**扩展项*/
@property (nonatomic, copy) NSString *extensions;
/**颁发者信息*/
@property (nonatomic, copy) NSString *issuerDN;
/**版本号*/
@property (nonatomic, copy) NSString *version;
/**公钥*/
@property (nonatomic, copy) NSString *pubKey;
/**证书唯一标识*/
@property(nonatomic, strong)NSString *uniqueId;
/**加密证书*/
@property(nonatomic, strong)NSString *encCert;
/**加密证书私钥*/
@property(nonatomic, strong)NSString *encPrivateKey;
/**签名证书私钥*/
@property(nonatomic, strong)NSString *signPrivateKey;
/**证书安装码*/
@property(nonatomic, strong)NSString *lraInfo;
/**PIN*/
@property(nonatomic, strong)NSString *PINValue;
/**签名图片*/
@property(nonatomic, strong)NSString *signatureImage;
+(NSDictionary *)dictionary:(id)responseObject userID:(NSString *)userID;
@end
| 26.811321 | 73 | 0.725545 |
3deca4e98e8839df23c93c9352e348705a75a0bd | 1,777 | h | C | extensions/third_party/perfetto/protos/perfetto/trace/track_event/chrome_message_pump.pbzero.h | blockspacer/chromium_base_conan | b4749433cf34f54d2edff52e2f0465fec8cb9bad | [
"Apache-2.0",
"BSD-3-Clause"
] | 6 | 2020-12-22T05:48:31.000Z | 2022-02-08T19:49:49.000Z | extensions/third_party/perfetto/protos/perfetto/trace/track_event/chrome_message_pump.pbzero.h | blockspacer/chromium_base_conan | b4749433cf34f54d2edff52e2f0465fec8cb9bad | [
"Apache-2.0",
"BSD-3-Clause"
] | 4 | 2020-05-22T18:36:43.000Z | 2021-05-19T10:20:23.000Z | extensions/third_party/perfetto/protos/perfetto/trace/track_event/chrome_message_pump.pbzero.h | blockspacer/chromium_base_conan | b4749433cf34f54d2edff52e2f0465fec8cb9bad | [
"Apache-2.0",
"BSD-3-Clause"
] | 2 | 2019-12-06T11:48:16.000Z | 2021-09-16T04:44:47.000Z | // Autogenerated by the ProtoZero compiler plugin. DO NOT EDIT.
#ifndef PERFETTO_PROTOS_PROTOS_PERFETTO_TRACE_TRACK_EVENT_CHROME_MESSAGE_PUMP_PROTO_H_
#define PERFETTO_PROTOS_PROTOS_PERFETTO_TRACE_TRACK_EVENT_CHROME_MESSAGE_PUMP_PROTO_H_
#include <stddef.h>
#include <stdint.h>
#include "perfetto/protozero/message.h"
#include "perfetto/protozero/packed_repeated_fields.h"
#include "perfetto/protozero/proto_decoder.h"
#include "perfetto/protozero/proto_utils.h"
namespace perfetto {
namespace protos {
namespace pbzero {
class ChromeMessagePump_Decoder : public ::protozero::TypedProtoDecoder</*MAX_FIELD_ID=*/2, /*HAS_NONPACKED_REPEATED_FIELDS=*/false> {
public:
ChromeMessagePump_Decoder(const uint8_t* data, size_t len) : TypedProtoDecoder(data, len) {}
explicit ChromeMessagePump_Decoder(const std::string& raw) : TypedProtoDecoder(reinterpret_cast<const uint8_t*>(raw.data()), raw.size()) {}
explicit ChromeMessagePump_Decoder(const ::protozero::ConstBytes& raw) : TypedProtoDecoder(raw.data, raw.size) {}
bool has_sent_messages_in_queue() const { return at<1>().valid(); }
bool sent_messages_in_queue() const { return at<1>().as_bool(); }
bool has_io_handler_location_iid() const { return at<2>().valid(); }
uint64_t io_handler_location_iid() const { return at<2>().as_uint64(); }
};
class ChromeMessagePump : public ::protozero::Message {
public:
using Decoder = ChromeMessagePump_Decoder;
enum : int32_t {
kSentMessagesInQueueFieldNumber = 1,
kIoHandlerLocationIidFieldNumber = 2,
};
void set_sent_messages_in_queue(bool value) {
AppendTinyVarInt(1, value);
}
void set_io_handler_location_iid(uint64_t value) {
AppendVarInt(2, value);
}
};
} // Namespace.
} // Namespace.
} // Namespace.
#endif // Include guard.
| 36.265306 | 141 | 0.768149 |
380ad48158ee37b9175e43ba3c8047557d6b819a | 3,246 | h | C | DataCollector/mozilla/xulrunner-sdk/include/nsIDOMDOMException.h | andrasigneczi/TravelOptimiser | b08805f97f0823fd28975a36db67193386aceb22 | [
"Apache-2.0"
] | 1 | 2016-04-20T08:35:44.000Z | 2016-04-20T08:35:44.000Z | DataCollector/mozilla/xulrunner-sdk/include/nsIDOMDOMException.h | andrasigneczi/TravelOptimiser | b08805f97f0823fd28975a36db67193386aceb22 | [
"Apache-2.0"
] | null | null | null | DataCollector/mozilla/xulrunner-sdk/include/nsIDOMDOMException.h | andrasigneczi/TravelOptimiser | b08805f97f0823fd28975a36db67193386aceb22 | [
"Apache-2.0"
] | null | null | null | /*
* DO NOT EDIT. THIS FILE IS GENERATED FROM ../../../dist/idl\nsIDOMDOMException.idl
*/
#ifndef __gen_nsIDOMDOMException_h__
#define __gen_nsIDOMDOMException_h__
#ifndef __gen_domstubs_h__
#include "domstubs.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: nsIDOMDOMException */
#define NS_IDOMDOMEXCEPTION_IID_STR "5bd766d3-57a9-4833-995d-dbe21da29595"
#define NS_IDOMDOMEXCEPTION_IID \
{0x5bd766d3, 0x57a9, 0x4833, \
{ 0x99, 0x5d, 0xdb, 0xe2, 0x1d, 0xa2, 0x95, 0x95 }}
class NS_NO_VTABLE nsIDOMDOMException : public nsISupports {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOMDOMEXCEPTION_IID)
enum {
INDEX_SIZE_ERR = 1U,
DOMSTRING_SIZE_ERR = 2U,
HIERARCHY_REQUEST_ERR = 3U,
WRONG_DOCUMENT_ERR = 4U,
INVALID_CHARACTER_ERR = 5U,
NO_DATA_ALLOWED_ERR = 6U,
NO_MODIFICATION_ALLOWED_ERR = 7U,
NOT_FOUND_ERR = 8U,
NOT_SUPPORTED_ERR = 9U,
INUSE_ATTRIBUTE_ERR = 10U,
INVALID_STATE_ERR = 11U,
SYNTAX_ERR = 12U,
INVALID_MODIFICATION_ERR = 13U,
NAMESPACE_ERR = 14U,
INVALID_ACCESS_ERR = 15U,
VALIDATION_ERR = 16U,
TYPE_MISMATCH_ERR = 17U,
SECURITY_ERR = 18U,
NETWORK_ERR = 19U,
ABORT_ERR = 20U,
URL_MISMATCH_ERR = 21U,
QUOTA_EXCEEDED_ERR = 22U,
TIMEOUT_ERR = 23U,
INVALID_NODE_TYPE_ERR = 24U,
DATA_CLONE_ERR = 25U,
INVALID_POINTER_ERR = 26U
};
/* readonly attribute unsigned short code; */
NS_IMETHOD GetCode(uint16_t *aCode) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMDOMException, NS_IDOMDOMEXCEPTION_IID)
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIDOMDOMEXCEPTION \
NS_IMETHOD GetCode(uint16_t *aCode) override;
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIDOMDOMEXCEPTION(_to) \
NS_IMETHOD GetCode(uint16_t *aCode) override { return _to GetCode(aCode); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIDOMDOMEXCEPTION(_to) \
NS_IMETHOD GetCode(uint16_t *aCode) override { return !_to ? NS_ERROR_NULL_POINTER : _to->GetCode(aCode); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsDOMDOMException : public nsIDOMDOMException
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMDOMEXCEPTION
nsDOMDOMException();
private:
~nsDOMDOMException();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS(nsDOMDOMException, nsIDOMDOMException)
nsDOMDOMException::nsDOMDOMException()
{
/* member initializers and constructor code */
}
nsDOMDOMException::~nsDOMDOMException()
{
/* destructor code */
}
/* readonly attribute unsigned short code; */
NS_IMETHODIMP nsDOMDOMException::GetCode(uint16_t *aCode)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsIDOMDOMException_h__ */
| 26.826446 | 119 | 0.717807 |
e1fbaeba8bfa8b3eac673e60dba26ef7c1467776 | 20,724 | c | C | src/config.c | MountCloud/cnc-ddraw | 5e79340fef6aae70f367c762572fef34e77ebb9a | [
"MIT"
] | 1 | 2022-01-02T10:32:34.000Z | 2022-01-02T10:32:34.000Z | src/config.c | MountCloud/cnc-ddraw | 5e79340fef6aae70f367c762572fef34e77ebb9a | [
"MIT"
] | null | null | null | src/config.c | MountCloud/cnc-ddraw | 5e79340fef6aae70f367c762572fef34e77ebb9a | [
"MIT"
] | null | null | null | #define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdio.h>
#include <d3d9.h>
#include "config.h"
#include "dd.h"
#include "render_d3d9.h"
#include "render_gdi.h"
#include "render_ogl.h"
#include "hook.h"
#include "debug.h"
static BOOL cfg_get_bool(LPCSTR key, BOOL default_value);
static int cfg_get_int(LPCSTR key, int default_value);
static DWORD cfg_get_string(LPCSTR key, LPCSTR default_value, LPSTR out_string, DWORD out_size);
static void cfg_create_ini();
cnc_ddraw_config g_config =
{ .window_rect = { .left = -32000, .top = -32000, .right = 0, .bottom = 0 }, .window_state = -1 };
void cfg_load()
{
//set up settings ini
char cwd[MAX_PATH];
char tmp[256];
GetCurrentDirectoryA(sizeof(cwd), cwd);
_snprintf(g_config.ini_path, sizeof(g_config.ini_path), "%s\\ddraw.ini", cwd);
if (GetFileAttributes(g_config.ini_path) == INVALID_FILE_ATTRIBUTES)
cfg_create_ini();
//get process filename
char process_file_path[MAX_PATH] = { 0 };
GetModuleFileNameA(NULL, process_file_path, MAX_PATH);
_splitpath(process_file_path, NULL, NULL, g_config.process_file_name, NULL);
//load settings from ini
g_ddraw->windowed = cfg_get_bool("windowed", FALSE);
g_ddraw->border = cfg_get_bool("border", TRUE);
g_ddraw->boxing = cfg_get_bool("boxing", FALSE);
g_ddraw->maintas = cfg_get_bool("maintas", FALSE);
g_ddraw->adjmouse = cfg_get_bool("adjmouse", FALSE);
g_ddraw->devmode = cfg_get_bool("devmode", FALSE);
g_ddraw->vsync = cfg_get_bool("vsync", FALSE);
g_ddraw->noactivateapp = cfg_get_bool("noactivateapp", FALSE);
g_ddraw->vhack = cfg_get_bool("vhack", FALSE);
g_ddraw->accurate_timers = cfg_get_bool("accuratetimers", FALSE);
g_ddraw->resizable = cfg_get_bool("resizable", TRUE);
g_ddraw->nonexclusive = cfg_get_bool("nonexclusive", FALSE);
g_ddraw->fixchildwindows = cfg_get_bool("fixchildwindows", TRUE);
g_ddraw->d3d9linear = cfg_get_bool("d3d9linear", TRUE);
g_ddraw->sierrahack = cfg_get_bool("sierrahack", FALSE); // Sierra Caesar III, Pharaoh, and Zeus hack
g_ddraw->dk2hack = cfg_get_bool("dk2hack", FALSE); // Dungeon Keeper 2 hack
g_config.window_rect.right = cfg_get_int("width", 0);
g_config.window_rect.bottom = cfg_get_int("height", 0);
g_config.window_rect.left = cfg_get_int("posX", -32000);
g_config.window_rect.top = cfg_get_int("posY", -32000);
g_config.save_settings = cfg_get_int("savesettings", 1);
#ifdef _MSC_VER
g_hook_method = cfg_get_int("hook", 4);
#endif
g_ddraw->render.maxfps = cfg_get_int("maxfps", 60);
g_ddraw->render.minfps = cfg_get_int("minfps", 0);
if (g_ddraw->render.minfps > 1000)
{
g_ddraw->render.minfps = 1000;
}
if (g_ddraw->render.minfps > 0)
{
g_ddraw->render.minfps_tick_len = 1000.0f / g_ddraw->render.minfps;
}
if (g_ddraw->accurate_timers || g_ddraw->vsync)
g_ddraw->fps_limiter.htimer = CreateWaitableTimer(NULL, TRUE, NULL);
//can't fully set it up here due to missing g_ddraw->mode.dmDisplayFrequency
int max_ticks = cfg_get_int("maxgameticks", 0);
if (max_ticks > 0 && max_ticks <= 1000)
{
if (g_ddraw->accurate_timers)
g_ddraw->ticks_limiter.htimer = CreateWaitableTimer(NULL, TRUE, NULL);
float len = 1000.0f / max_ticks;
g_ddraw->ticks_limiter.tick_length_ns = len * 10000;
g_ddraw->ticks_limiter.tick_length = len + 0.5f;
}
if (max_ticks >= 0)
{
//always using 60 fps for flip...
if (g_ddraw->accurate_timers)
g_ddraw->flip_limiter.htimer = CreateWaitableTimer(NULL, TRUE, NULL);
float flip_len = 1000.0f / 60;
g_ddraw->flip_limiter.tick_length_ns = flip_len * 10000;
g_ddraw->flip_limiter.tick_length = flip_len + 0.5f;
}
if ((g_ddraw->fullscreen = cfg_get_bool("fullscreen", FALSE)))
{
g_config.window_rect.left = g_config.window_rect.top = -32000;
}
if (!(g_ddraw->handlemouse = cfg_get_bool("handlemouse", TRUE)))
{
g_ddraw->adjmouse = TRUE;
}
if (cfg_get_bool("singlecpu", TRUE))
{
SetProcessAffinityMask(GetCurrentProcess(), 1);
}
else
{
DWORD system_affinity;
DWORD proc_affinity;
HANDLE proc = GetCurrentProcess();
if (GetProcessAffinityMask(proc, &proc_affinity, &system_affinity))
SetProcessAffinityMask(proc, system_affinity);
}
g_ddraw->render.bpp = cfg_get_int("bpp", 0);
if (g_ddraw->render.bpp != 16 && g_ddraw->render.bpp != 24 && g_ddraw->render.bpp != 32)
{
g_ddraw->render.bpp = 0;
}
// to do: read .glslp config file instead of the shader and apply the correct settings
cfg_get_string("shader", "", g_ddraw->shader, sizeof(g_ddraw->shader));
cfg_get_string("renderer", "auto", tmp, sizeof(tmp));
dprintf(" Using %s renderer\n", tmp);
if (tolower(tmp[0]) == 's' || tolower(tmp[0]) == 'g') //gdi
{
g_ddraw->renderer = gdi_render_main;
}
else if (tolower(tmp[0]) == 'd') //direct3d9
{
g_ddraw->renderer = d3d9_render_main;
}
else if (tolower(tmp[0]) == 'o') //opengl
{
if (oglu_load_dll())
{
g_ddraw->renderer = ogl_render_main;
}
else
{
g_ddraw->show_driver_warning = TRUE;
g_ddraw->renderer = gdi_render_main;
}
}
else //auto
{
if (!g_ddraw->wine && d3d9_is_available())
{
g_ddraw->renderer = d3d9_render_main;
}
else if (oglu_load_dll())
{
g_ddraw->renderer = ogl_render_main;
}
else
{
g_ddraw->show_driver_warning = TRUE;
g_ddraw->renderer = gdi_render_main;
}
}
}
void cfg_save()
{
if (!g_config.save_settings)
return;
char buf[16];
char *section = g_config.save_settings == 1 ? "ddraw" : g_config.process_file_name;
if (g_config.window_rect.right)
{
sprintf(buf, "%ld", g_config.window_rect.right);
WritePrivateProfileString(section, "width", buf, g_config.ini_path);
}
if (g_config.window_rect.bottom)
{
sprintf(buf, "%ld", g_config.window_rect.bottom);
WritePrivateProfileString(section, "height", buf, g_config.ini_path);
}
if (g_config.window_rect.left != -32000)
{
sprintf(buf, "%ld", g_config.window_rect.left);
WritePrivateProfileString(section, "posX", buf, g_config.ini_path);
}
if (g_config.window_rect.top != -32000)
{
sprintf(buf, "%ld", g_config.window_rect.top);
WritePrivateProfileString(section, "posY", buf, g_config.ini_path);
}
if (g_config.window_state != -1)
{
WritePrivateProfileString(section, "windowed", g_config.window_state ? "true" : "false", g_config.ini_path);
}
}
static void cfg_create_ini()
{
FILE *fh = fopen(g_config.ini_path, "w");
if (fh)
{
fputs(
"; cnc-ddraw - https://github.com/CnCNet/cnc-ddraw - https://cncnet.org\n"
"\n"
"[ddraw]\n"
"; ### Optional settings ###\n"
"; Use the following settings to adjust the look and feel to your liking\n"
"\n"
"\n"
"; Stretch to custom resolution, 0 = defaults to the size game requests\n"
"width=0\n"
"height=0\n"
"\n"
"; Override the width/height settings shown above and always stretch to fullscreen\n"
"; Note: Can be combined with 'windowed=true' to get windowed-fullscreen aka borderless mode\n"
"fullscreen=false\n"
"\n"
"; Run in windowed mode rather than going fullscreen\n"
"windowed=false\n"
"\n"
"; Maintain aspect ratio - (Requires 'handlemouse=true')\n"
"maintas=false\n"
"\n"
"; Windowboxing / Integer Scaling - (Requires 'handlemouse=true')\n"
"boxing=false\n"
"\n"
"; Real rendering rate, -1 = screen rate, 0 = unlimited, n = cap\n"
"; Note: Does not have an impact on the game speed, to limit your game speed use 'maxgameticks='\n"
"maxfps=60\n"
"\n"
"; Vertical synchronization, enable if you get tearing - (Requires 'renderer=auto/opengl/direct3d9')\n"
"; Note: vsync=true can fix tearing but it will cause input lag\n"
"vsync=false\n"
"\n"
"; Automatic mouse sensitivity scaling - (Requires 'handlemouse=true')\n"
"; Note: Only works if stretching is enabled. Sensitivity will be adjusted according to the size of the window\n"
"adjmouse=false\n"
"\n"
"; Preliminary libretro shader support - (Requires 'renderer=opengl') https://github.com/libretro/glsl-shaders\n"
"; 2x scaling example: https://imgur.com/a/kxsM1oY - 4x scaling example: https://imgur.com/a/wjrhpFV\n"
"shader=Shaders\\interpolation\\bilinear.glsl\n"
"\n"
"; Window position, -32000 = center to screen\n"
"posX=-32000\n"
"posY=-32000\n"
"\n"
"; Renderer, possible values: auto, opengl, gdi, direct3d9 (auto = try direct3d9/opengl, fallback = gdi)\n"
"renderer=auto\n"
"\n"
"; Developer mode (don't lock the cursor)\n"
"devmode=false\n"
"\n"
"; Show window borders in windowed mode\n"
"border=true\n"
"\n"
"; Save window position/size/state on game exit and restore it automatically on next game start\n"
"; Possible values: 0 = disabled, 1 = save to global 'ddraw' section, 2 = save to game specific section\n"
"savesettings=1\n"
"\n"
"; Should the window be resizeable by the user in windowed mode?\n"
"resizeable=true\n"
"\n"
"; Enable C&C video resize hack - Stretches C&C cutscenes to fullscreen\n"
"vhack=false\n"
"\n"
"; Enable linear (D3DTEXF_LINEAR) upscaling filter for the direct3d9 renderer (16 bit color depth games only)\n"
"d3d9linear=true\n"
"\n"
"\n"
"\n"
"; ### Compatibility settings ###\n"
"; Use the following settings in case there are any issues with the game\n"
"\n"
"\n"
"; Hide WM_ACTIVATEAPP and WM_NCACTIVATE messages to prevent problems on alt+tab\n"
"noactivateapp=false\n"
"\n"
"; Max game ticks per second, possible values: -1 = disabled, 0 = emulate 60hz vblank, 1-1000 = custom game speed\n"
"; Note: Can be used to slow down a too fast running game, fix flickering or too fast animations\n"
"; Note: Usually one of the following values will work: 60 / 30 / 25 / 20 / 15 (lower value = slower game speed)\n"
"maxgameticks=0\n"
"\n"
"; Gives cnc-ddraw full control over the mouse cursor (required for adjmouse/boxing/maintas)\n"
"; Note: Set this to 'false' if your cursor becomes invisible at some places in the game\n"
"handlemouse=true\n"
"\n"
"; Windows API Hooking, Possible values: 0 = disabled, 1 = IAT Hooking, 2 = Microsoft Detours, 3 = IAT+Detours Hooking (All Modules), 4 = IAT Hooking (All Modules)\n"
"; Note: Change this value if windowed mode or upscaling isn't working properly\n"
"; Note: 'hook=2' will usually work for problematic games, but 'hook=2' must be combined with renderer=gdi\n"
"hook=4\n"
"\n"
"; Force minimum FPS, possible values: 0 = disabled, -1 = use 'maxfps=' value, 1-1000 = custom FPS\n"
"; Note: Set this to a low value such as 5 or 10 if some parts of the game are not being displayed (e.g. menus or loading screens)\n"
"minfps=0\n"
"\n"
"; Disable fullscreen-exclusive mode for the direct3d9/opengl renderers\n"
"; Note: Can be used in case some GUI elements like buttons/textboxes/videos/etc.. are invisible\n"
"nonexclusive=false\n"
"\n"
"; Force CPU0 affinity, avoids crashes/freezing, *might* have a performance impact\n"
"singlecpu=true\n"
"\n"
"\n"
"\n"
"; ### Game specific settings ###\n"
"; The following settings override all settings shown above, section name = executable name\n"
"\n"
"\n"
"; Command & Conquer: Red Alert - CnCNet\n"
"[ra95-spawn]\n"
"maxfps=125\n"
"\n"
"; Command & Conquer Gold - CnCNet\n"
"[cnc95]\n"
"maxfps=125\n"
"\n"
"; Carmageddon\n"
"[CARMA95]\n"
"renderer=opengl\n"
"noactivateapp=true\n"
"maxgameticks=60\n"
"\n"
"; Carmageddon\n"
"[CARM95]\n"
"renderer=opengl\n"
"noactivateapp=true\n"
"maxgameticks=60\n"
"\n"
"; Command & Conquer Gold\n"
"[C&C95]\n"
"maxgameticks=120\n"
"maxfps=60\n"
"minfps=-1\n"
"\n"
"; Command & Conquer: Red Alert\n"
"[ra95]\n"
"maxgameticks=120\n"
"maxfps=60\n"
"minfps=-1\n"
"\n"
"; Command & Conquer: Red Alert\n"
"[ra95p]\n"
"maxfps=60\n"
"minfps=-1\n"
"\n"
"; Age of Empires\n"
"[empires]\n"
"handlemouse=false\n"
"\n"
"; Age of Empires: The Rise of Rome\n"
"[empiresx]\n"
"handlemouse=false\n"
"\n"
"; Age of Empires II\n"
"[EMPIRES2]\n"
"handlemouse=false\n"
"\n"
"; Age of Empires II: The Conquerors\n"
"[age2_x1]\n"
"handlemouse=false\n"
"\n"
"; Outlaws\n"
"[olwin]\n"
"noactivateapp=true\n"
"maxgameticks=60\n"
"handlemouse=false\n"
"renderer=gdi\n"
"\n"
"; Dark Reign: The Future of War\n"
"[DKReign]\n"
"maxgameticks=60\n"
"\n"
"; Star Wars: Galactic Battlegrounds\n"
"[battlegrounds]\n"
"handlemouse=false\n"
"\n"
"; Star Wars: Galactic Battlegrounds: Clone Campaigns\n"
"[battlegrounds_x1]\n"
"handlemouse=false\n"
"\n"
"; Carmageddon 2\n"
"[Carma2_SW]\n"
"renderer=opengl\n"
"noactivateapp=true\n"
"maxgameticks=60\n"
"\n"
"; Atomic Bomberman\n"
"[BM]\n"
"maxgameticks=60\n"
"\n"
"; Dune 2000\n"
"[dune2000]\n"
"maxfps=59\n"
"accuratetimers=true\n"
"\n"
"; Dune 2000 - CnCNet\n"
"[dune2000-spawn]\n"
"maxfps=59\n"
"accuratetimers=true\n"
"\n"
"; Command & Conquer: Tiberian Sun / Command & Conquer: Red Alert 2\n"
"[game]\n"
"checkfile=.\\blowfish.dll\n"
"noactivateapp=true\n"
"handlemouse=false\n"
"maxfps=60\n"
"minfps=-1\n"
"\n"
"; Command & Conquer: Tiberian Sun Demo\n"
"[SUN]\n"
"noactivateapp=true\n"
"handlemouse=false\n"
"maxfps=60\n"
"minfps=-1\n"
"\n"
"; Command & Conquer: Tiberian Sun - CnCNet\n"
"[ts-spawn]\n"
"noactivateapp=true\n"
"handlemouse=false\n"
"maxfps=60\n"
"minfps=-1\n"
"\n"
"; Command & Conquer: Red Alert 2 - XWIS\n"
"[ra2]\n"
"noactivateapp=true\n"
"handlemouse=false\n"
"maxfps=60\n"
"minfps=-1\n"
"\n"
"; Command & Conquer: Red Alert 2 - XWIS\n"
"[Red Alert 2]\n"
"noactivateapp=true\n"
"handlemouse=false\n"
"maxfps=60\n"
"minfps=-1\n"
"\n"
"; Command & Conquer: Red Alert 2: Yuri's Revenge\n"
"[gamemd]\n"
"noactivateapp=true\n"
"handlemouse=false\n"
"maxfps=60\n"
"minfps=-1\n"
"\n"
"; Command & Conquer: Red Alert 2: Yuri's Revenge - ?ModExe?\n"
"[ra2md]\n"
"noactivateapp=true\n"
"handlemouse=false\n"
"maxfps=60\n"
"minfps=-1\n"
"\n"
"; Command & Conquer: Red Alert 2: Yuri's Revenge - CnCNet\n"
"[gamemd-spawn]\n"
"noactivateapp=true\n"
"handlemouse=false\n"
"maxfps=60\n"
"minfps=-1\n"
"\n"
"; Command & Conquer: Red Alert 2: Yuri's Revenge - XWIS\n"
"[Yuri's Revenge]\n"
"noactivateapp=true\n"
"handlemouse=false\n"
"maxfps=60\n"
"minfps=-1\n"
"\n"
"; Twisted Metal\n"
"[TWISTED]\n"
"renderer=opengl\n"
"nonexclusive=true\n"
"maxgameticks=25\n"
"minfps=5\n"
"\n"
"; Twisted Metal 2\n"
"[Tm2]\n"
"renderer=opengl\n"
"nonexclusive=true\n"
"maxgameticks=60\n"
"handlemouse=false\n"
"fixchildwindows=false\n"
"\n"
"; Caesar III\n"
"[c3]\n"
"handlemouse=false\n"
"sierrahack=true\n"
"\n"
"; Pharaoh\n"
"[Pharaoh]\n"
"handlemouse=false\n"
"sierrahack=true\n"
"\n"
"; Master of Olympus - Zeus\n"
"[Zeus]\n"
"handlemouse=false\n"
"sierrahack=true\n"
"renderer=gdi\n"
"hook=2\n"
"\n"
"; Dungeon Keeper 2\n"
"[DKII]\n"
"maxgameticks=60\n"
"noactivateapp=true\n"
"dk2hack=true\n"
"\n"
"; Chris Sawyer's Locomotion\n"
"[LOCO]\n"
"handlemouse=false\n"
"\n"
"; Age of Wonders\n"
"[AoWSM]\n"
"windowed=true\n"
"fullscreen=false\n"
"renderer=gdi\n"
"hook=2\n"
"\n"
"; Age of Wonders 2\n"
"[AoW2]\n"
"windowed=true\n"
"fullscreen=false\n"
"renderer=gdi\n"
"hook=2\n"
"\n"
"; Stronghold Crusader HD\n"
"[Stronghold Crusader]\n"
"handlemouse=false\n"
"\n"
"; Stronghold Crusader Extreme HD\n"
"[Stronghold_Crusader_Extreme]\n"
"handlemouse=false\n"
"\n"
, fh);
fclose(fh);
}
}
static DWORD cfg_get_string(LPCSTR key, LPCSTR default_value, LPSTR out_string, DWORD out_size)
{
DWORD s = GetPrivateProfileStringA(
g_config.process_file_name, key, "", out_string, out_size, g_config.ini_path);
if (s > 0)
{
char buf[MAX_PATH] = { 0 };
if (GetPrivateProfileStringA(
g_config.process_file_name, "checkfile", "", buf, sizeof(buf), g_config.ini_path) > 0)
{
if (GetFileAttributes(buf) != INVALID_FILE_ATTRIBUTES)
return s;
}
else
return s;
}
return GetPrivateProfileStringA("ddraw", key, default_value, out_string, out_size, g_config.ini_path);
}
static BOOL cfg_get_bool(LPCSTR key, BOOL default_value)
{
char value[8];
cfg_get_string(key, default_value ? "Yes" : "No", value, sizeof(value));
return (_stricmp(value, "yes") == 0 || _stricmp(value, "true") == 0 || _stricmp(value, "1") == 0);
}
static int cfg_get_int(LPCSTR key, int default_value)
{
char def_value[16];
_snprintf(def_value, sizeof(def_value), "%d", default_value);
char value[16];
cfg_get_string(key, def_value, value, sizeof(value));
return atoi(value);
}
| 34.655518 | 178 | 0.538217 |
0e07a0ce0ba88ce40cf7b7e6ceb31e23b5680ff5 | 585 | h | C | PrivateFrameworks/UIKitHostAppServices/UHAToolbarItemInterface-Protocol.h | phatblat/macOSPrivateFrameworks | 9047371eb80f925642c8a7c4f1e00095aec66044 | [
"MIT"
] | 17 | 2018-11-13T04:02:58.000Z | 2022-01-20T09:27:13.000Z | PrivateFrameworks/UIKitHostAppProtocols/UHAToolbarItemInterface-Protocol.h | phatblat/macOSPrivateFrameworks | 9047371eb80f925642c8a7c4f1e00095aec66044 | [
"MIT"
] | 3 | 2018-04-06T02:02:27.000Z | 2018-10-02T01:12:10.000Z | PrivateFrameworks/UIKitHostAppServices/UHAToolbarItemInterface-Protocol.h | phatblat/macOSPrivateFrameworks | 9047371eb80f925642c8a7c4f1e00095aec66044 | [
"MIT"
] | 1 | 2018-09-28T13:54:23.000Z | 2018-09-28T13:54:23.000Z | //
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//
#import "ROCKForwardingInterposableWithRunLoop.h"
#import "ROCKImpersonateable.h"
@class NSString;
@protocol UHAToolbarItemInterface <ROCKImpersonateable, ROCKForwardingInterposableWithRunLoop>
@property(copy, nonatomic) CDUnknownBlockType changeHandler;
@property(copy, nonatomic) id <UHAAccesibilityInfoInterface> accessibilityInfo;
@property(copy, nonatomic) NSString *label;
@property(readonly, copy, nonatomic) NSString *identifier;
@end
| 30.789474 | 94 | 0.784615 |
dbd09190137bd65077e82171facd6774a11df35d | 4,298 | c | C | clients/client4/client4.c | tomtix/penguins | 0b5daa6fc3ee6b72c7793b0d3098ae63c3d8cf0b | [
"Apache-2.0"
] | null | null | null | clients/client4/client4.c | tomtix/penguins | 0b5daa6fc3ee6b72c7793b0d3098ae63c3d8cf0b | [
"Apache-2.0"
] | null | null | null | clients/client4/client4.c | tomtix/penguins | 0b5daa6fc3ee6b72c7793b0d3098ae63c3d8cf0b | [
"Apache-2.0"
] | null | null | null | /**
* @file
*/
#include <stdio.h>
#include <client.h>
#include <server.h>
#include <move.h>
#include <tile.h>
#include <utils/graph.h>
#include <utils/list.h>
#include <display/mouseclick.h>
static struct {
int id;
struct graph *graph;
struct list *my_penguins;
struct list *tile_fish1;
} client;
struct penguin {
int tile;
};
union iv {
int i;
void *v;
};
static struct penguin *penguin_create(int tile)
{
struct penguin *p = malloc(sizeof(*p));
p->tile = tile;
return p;
}
static void parse_tile(int tile)
{
int nc = tile__get_neighbour_count(tile);
int *neighbour = tile__get_neighbour(tile);
int fish = tile__get_fishes(tile);
if (fish == 1){
union iv f = {.i=tile};
list_add_element(client.tile_fish1, f.v);
}
graph_set_fish(client.graph, tile, fish);
for (int i = 0; i < nc; i++)
graph_add_edge(client.graph, tile, neighbour[i]);
}
void client_init(int nb_tile)
{
client.id = get_current_player_id();
client.graph = graph_create(nb_tile, 0, GRAPH_LIST);
client.my_penguins = list_create(LIST_FREE_MALLOCD_ELEMENT__);
client.tile_fish1 = list_create(LIST_DEFAULT__);
for (int i = 0; i < nb_tile; i++)
parse_tile(i);
display_mc_init(NULL, 0., 0., 0.);
}
int client_place_penguin(void)
{
puts("CLIENT PLACE: user mode start!");
int tile = 0;
int ok = 0;
while (!ok) {
struct mouseclick mc;
int ret = display_mc_get(&mc);
if (ret == DISPLAY_THREAD_STOP ||
ret == SURRENDER) {
tile = -1;
goto end;
}
tile = mc.tile_id;
if (graph_get_fish(client.graph, tile) != 1) {
//display_blink(BLINK_WRONG, tile);
puts("WRONG TILE: must have exactly 1 fish on it");
} else {
//display_blink(BLINK_GOOD, tile);
ok = 1;
}
}
struct penguin *penguin = penguin_create(tile);
list_add_element(client.my_penguins, penguin);
end:
puts("CLIENT PLACE: user mode end!");
return tile;
}
static void update_tile(int tile)
{
int fish = graph_get_fish(client.graph, tile);
if (fish == 1) {
int l = list_size(client.tile_fish1);
for (int i = 1; i <= l; i++) {
union iv ti;
ti.v = list_get_element(client.tile_fish1, i);
if (ti.i == tile) {
list_remove_element(client.tile_fish1, i);
break;
}
}
}
// an updated tile is necessary for the worst:
graph_set_fish(client.graph, tile, -1);
// set the owner of the tile, it may interest us
graph_set_player(client.graph, tile, tile__get_player(tile));
}
static int target_is_reachable(int src, int trg, int *dir, int *jmp)
{
int max_dir = nb_direction(src), ok = 0;
for (int i = 0; !ok && i < max_dir; i++) {
int dst = 1;
int j = 1;
while (dst > 0) {
dst = move_is_valid(src, i, j);
if (dst == trg) {
*dir = i;
*jmp = j;
ok = 1;
break;
}
j++;
}
}
return ok;
}
void client_play(struct move *retmov)
{
puts("CLIENT PLAY: user mode start!");
int src = -1;
int target = -1;
int ok = 0, dir, jmp;
while (!ok) {
struct mouseclick mc;
int ret = display_mc_get(&mc);
if (ret == DISPLAY_THREAD_STOP ||
ret == SURRENDER) {
move_set(retmov, -1, -1, -1);
return;
}
if (!mc.validclick)
continue;
int p = graph_get_player(client.graph, mc.tile_id);
if (p == client.id) {
src = mc.tile_id;
printf("Source set on tile %d\n", mc.tile_id);
}
else if (p >= 0)
//display_blink(BLINK_WRONG, mc.tile_id);
puts("WRONG TILE: This is the enemy!! Just Look !!!");
else if (mc.t == MC_TILE) {
target = mc.tile_id;
printf("Target set on tile %d\n", mc.tile_id);
}
if (src >= 0 && target >= 0) {
ok = target_is_reachable(src, target, &dir, &jmp);
if (!ok)
// display_blink(BLINK_WRONG, target);
puts("Oh! we can't reach this "
"delicious-looking fishes from here!");
}
}
move_set(retmov, src, dir, jmp);
puts("CLIENT PLAY: user mode end!");
}
void send_diff(enum diff_type dt, int orig, int dest)
{
if (dt == MOVE)
update_tile(dest);
update_tile(orig);
}
__attribute__ ((destructor))
static void memory_free(void)
{
if (client.graph != NULL)
graph_destroy(client.graph);
if (client.my_penguins != NULL)
list_destroy(client.my_penguins);
}
| 22.154639 | 68 | 0.613774 |
a350e46f08d4dfbd3be7e65db87ce811f11c0d38 | 1,236 | h | C | src/nmodl/symbol.h | tommorse/nrn | 73236b12977118ae0a98d7dbbed60973994cdaee | [
"BSD-3-Clause"
] | 203 | 2018-05-03T11:02:11.000Z | 2022-03-31T14:18:31.000Z | src/nmodl/symbol.h | tommorse/nrn | 73236b12977118ae0a98d7dbbed60973994cdaee | [
"BSD-3-Clause"
] | 1,228 | 2018-04-25T09:00:48.000Z | 2022-03-31T21:42:21.000Z | src/nmodl/symbol.h | tommorse/nrn | 73236b12977118ae0a98d7dbbed60973994cdaee | [
"BSD-3-Clause"
] | 134 | 2018-04-23T09:14:13.000Z | 2022-03-16T08:57:11.000Z | /* /local/src/master/nrn/src/nmodl/symbol.h,v 4.1 1997/08/30 20:45:37 hines Exp */
/*
symbol.h,v
* Revision 4.1 1997/08/30 20:45:37 hines
* cvs problem with branches. Latest nmodl stuff should now be a top level
*
* Revision 4.0.1.1 1997/08/08 17:24:05 hines
* nocmodl version 4.0.1
*
* Revision 4.0 1997/08/08 17:06:32 hines
* proper nocmodl version number
*
* Revision 1.1.1.1 1994/10/12 17:21:33 hines
* NEURON 3.0 distribution
*
* Revision 8.0 89/09/22 17:27:04 nfh
* Freezing
*
* Revision 7.0 89/08/30 13:32:42 nfh
* Rev 7 is now Experimental; Rev 6 is Testing
*
* Revision 6.0 89/08/14 16:27:21 nfh
* Rev 6.0 is latest of 4.x; now the Experimental version
*
* Revision 4.0 89/07/24 17:03:52 nfh
* Freezing rev 3. Rev 4 is now Experimental
*
* Revision 3.1 89/07/07 16:55:21 mlh
* FIRST LAST START in independent SWEEP higher order derivatives
*
* Revision 1.1 89/07/06 14:52:48 mlh
* Initial revision
*
*/
extern List *symlist[];
#define SYMITER(arg1) for (i = 'A'; i <= 'z'; i++)\
ITERATE(qs, symlist[i])\
if ((s = SYM(qs))->type == arg1)
#define SYMITER_STAT for (i='A'; i <= 'z'; i++)\
ITERATE(qs, symlist[i])\
if ((s = SYM(qs))->subtype & STAT)
| 26.869565 | 82 | 0.630259 |
890bde1d021326c81f2637820270b64aaf19dac1 | 584 | h | C | cppFX/src/stage.h | urosisakovic/cppFX | 180710e3a2a38668bc7c2a824532a6bae1be7189 | [
"MIT"
] | null | null | null | cppFX/src/stage.h | urosisakovic/cppFX | 180710e3a2a38668bc7c2a824532a6bae1be7189 | [
"MIT"
] | null | null | null | cppFX/src/stage.h | urosisakovic/cppFX | 180710e3a2a38668bc7c2a824532a6bae1be7189 | [
"MIT"
] | null | null | null | #pragma once
#include <string>
#include <memory>
#include "group.h"
namespace cppfx
{
class Stage
{
public:
Stage();
~Stage();
void setWidth(unsigned);
void setHeight(unsigned);
void setSize(unsigned, unsigned);
int getWidth() const;
int getHeight() const;
void setTitle(const std::string&);
const char* getTitle() const;
void setRoot(Group*);
Group* getRoot();
private:
int width, height;
std::string title;
Group* root;
};
} // namespace cppfx | 17.69697 | 42 | 0.554795 |
89661166bf03aab5d227535cd6a3948b8428a6a8 | 284 | h | C | FreelyHeath/Net/OrderDetailApi.h | XYGDeveloper/FreelyHealth_User | af0d8dbcf29bd39301292b299f331201c417a08c | [
"MIT"
] | 1 | 2019-04-24T07:42:27.000Z | 2019-04-24T07:42:27.000Z | FreelyHeath/Net/OrderDetailApi.h | XYGDeveloper/FreelyHealth_User | af0d8dbcf29bd39301292b299f331201c417a08c | [
"MIT"
] | null | null | null | FreelyHeath/Net/OrderDetailApi.h | XYGDeveloper/FreelyHealth_User | af0d8dbcf29bd39301292b299f331201c417a08c | [
"MIT"
] | null | null | null | //
// OrderDetailApi.h
// FreelyHeath
//
// Created by L on 2017/8/1.
// Copyright © 2017年 深圳乐易住智能科技股份有限公司. All rights reserved.
//
#import "BaseApi.h"
@class OrderDetailModel;
@interface OrderDetailApi : BaseApi
- (void)getOrderdetail:(NSMutableDictionary *)detail;
@end
| 13.52381 | 59 | 0.707746 |
8eb55633c858b7e981badc5800dace8d2b535737 | 522 | c | C | acsl/libraries/libc/test/posix/net_if/test_if_indextoname.c | davidcok/annotationsforall | 16024a9ffecdb72b638e1f942c567f8815183e89 | [
"Apache-2.0"
] | 4 | 2016-06-16T21:03:57.000Z | 2021-02-06T10:20:14.000Z | acsl/libraries/libc/test/posix/net_if/test_if_indextoname.c | davidcok/annotationsforall | 16024a9ffecdb72b638e1f942c567f8815183e89 | [
"Apache-2.0"
] | null | null | null | acsl/libraries/libc/test/posix/net_if/test_if_indextoname.c | davidcok/annotationsforall | 16024a9ffecdb72b638e1f942c567f8815183e89 | [
"Apache-2.0"
] | 1 | 2021-06-09T07:00:34.000Z | 2021-06-09T07:00:34.000Z | #include "../../../test_common.h"
#include <net/if.h>
void runSuccess() {
char buf[IF_NAMESIZE];
if_indextoname(anyuint(), buf);
}
void runFailure() {
if_indextoname(anyuint(), NULL);
}
void runFailure1() {
char buf[1];
if_indextoname(anyuint(), buf);
}
int f;
void testValues() {
f = 2;
char* result;
char buf[IF_NAMESIZE];
result = if_indextoname(anyuint(), buf);
//@ assert result == \null || result == buf;
//@ assert f == 2;
//@ assert vacuous: \false;
}
| 17.4 | 48 | 0.58046 |
88383887c71fea20c0c564bcc4bdaf9b033c848c | 2,268 | c | C | lib/logmsg/timestamp-serialize.c | balabit-deps/balabit-os-6-syslog-ng | c8d0fafc8eaca8ed690b2ad17ab1d93820bd07f6 | [
"BSD-4-Clause-UC"
] | null | null | null | lib/logmsg/timestamp-serialize.c | balabit-deps/balabit-os-6-syslog-ng | c8d0fafc8eaca8ed690b2ad17ab1d93820bd07f6 | [
"BSD-4-Clause-UC"
] | null | null | null | lib/logmsg/timestamp-serialize.c | balabit-deps/balabit-os-6-syslog-ng | c8d0fafc8eaca8ed690b2ad17ab1d93820bd07f6 | [
"BSD-4-Clause-UC"
] | null | null | null | /*
* Copyright (c) 2002-2015 Balabit
* Copyright (c) 2015 Viktor Juhasz <viktor.juhasz@balabit.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* As an additional exemption you are allowed to compile & link against the
* OpenSSL libraries as published by the OpenSSL project. See the file
* COPYING for details.
*
*/
#include "timestamp-serialize.h"
static gboolean
_write_log_stamp(SerializeArchive *sa, LogStamp *stamp)
{
return serialize_write_uint64(sa, stamp->tv_sec) &&
serialize_write_uint32(sa, stamp->tv_usec) &&
serialize_write_uint32(sa, stamp->zone_offset);
}
static gboolean
_read_log_stamp(SerializeArchive *sa, LogStamp *stamp)
{
guint64 val64;
guint32 val;
if (!serialize_read_uint64(sa, &val64))
return FALSE;
stamp->tv_sec = (gint64) val64;
if (!serialize_read_uint32(sa, &val))
return FALSE;
stamp->tv_usec = val;
if (!serialize_read_uint32(sa, &val))
return FALSE;
stamp->zone_offset = (gint) val;
return TRUE;
}
gboolean
timestamp_serialize(SerializeArchive *sa, LogStamp *timestamps)
{
LogStamp additional_timestamp;
return _write_log_stamp(sa, ×tamps[LM_TS_STAMP]) &&
_write_log_stamp(sa, ×tamps[LM_TS_RECVD]) &&
_write_log_stamp(sa, &additional_timestamp);
}
gboolean
timestamp_deserialize(SerializeArchive *sa, LogStamp *timestamps)
{
LogStamp additional_timestamp = {0};
return _read_log_stamp(sa, ×tamps[LM_TS_STAMP]) &&
_read_log_stamp(sa, ×tamps[LM_TS_RECVD]) &&
_read_log_stamp(sa, &additional_timestamp);
}
| 30.648649 | 77 | 0.733686 |
88479d9b74cc2a892b866400534efbf0b337ac37 | 204 | h | C | NSNull+HExtensions.h | trinhduchung/HExtensions | b9cda1957fcb01a0c66cee2e2eea58965315a65d | [
"MIT"
] | 3 | 2015-12-01T12:24:54.000Z | 2018-07-23T13:03:55.000Z | NSNull+HExtensions.h | trinhduchung/HExtensions | b9cda1957fcb01a0c66cee2e2eea58965315a65d | [
"MIT"
] | null | null | null | NSNull+HExtensions.h | trinhduchung/HExtensions | b9cda1957fcb01a0c66cee2e2eea58965315a65d | [
"MIT"
] | null | null | null | //
// NSNull+HExtensions.h
// Libs
//
// Created by HungTD7 on 11/24/15.
// Copyright © 2015 HungTD7. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSNull (HExtensions)
@end
| 14.571429 | 50 | 0.681373 |
b03c294657c05a0c9025da0495313da1952dd10f | 38,378 | h | C | kernel/drivers/hisi/ipp/v250/v250/include/sub_ctrl_drv_priv.h | wonderful666/marx-10.1.0 | a8be8880fe31bff4f94d6e3fad17c455666ff60f | [
"MIT"
] | null | null | null | kernel/drivers/hisi/ipp/v250/v250/include/sub_ctrl_drv_priv.h | wonderful666/marx-10.1.0 | a8be8880fe31bff4f94d6e3fad17c455666ff60f | [
"MIT"
] | null | null | null | kernel/drivers/hisi/ipp/v250/v250/include/sub_ctrl_drv_priv.h | wonderful666/marx-10.1.0 | a8be8880fe31bff4f94d6e3fad17c455666ff60f | [
"MIT"
] | null | null | null | // ******************************************************************************
// Copyright : Copyright (C) 2018, Hisilicon Technologies Co., Ltd.
// File name : sub_ctrl_drv_priv.h
// Version : 1.0
// Date : 2018-07-02
// Description : Define all registers/tables for HiStarISP
// Others : Generated automatically by nManager V4.0
// ******************************************************************************
#ifndef __SUB_CTRL_DRV_PRIV_CS_H__
#define __SUB_CTRL_DRV_PRIV_CS_H__
/* Define the union U_DMA_CRG_CFG0 */
typedef union {
/* Define the struct bits */
struct {
unsigned int jpg_dw_axi_gatedclock_en : 1 ; /* [0] */
unsigned int jpg_top_apb_force_clk_on : 1 ; /* [1] */
unsigned int reserved_0 : 14 ; /* [15..2] */
unsigned int control_disable_axi_data_packing : 1 ; /* [16] */
unsigned int mst_priority_fd : 1 ; /* [17] */
unsigned int mst_priority_cvdr : 1 ; /* [18] */
unsigned int apb_overf_prot : 2 ; /* [20..19] */
unsigned int reserved_1 : 11 ; /* [31..21] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_DMA_CRG_CFG0;
/* Define the union U_DMA_CRG_CFG1 */
typedef union {
/* Define the struct bits */
struct {
unsigned int cvdr_soft_rst : 1 ; /* [0] */
unsigned int smmu_soft_rst : 1 ; /* [1] */
unsigned int smmu_master_soft_rst : 1 ; /* [2] */
unsigned int cmdlst_soft_rst : 1 ; /* [3] */
unsigned int reserved_0 : 28 ; /* [31..4] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_DMA_CRG_CFG1;
/* Define the union U_CVDR_MEM_CFG0 */
typedef union {
/* Define the struct bits */
struct {
unsigned int cvdr_mem_ctrl_sp : 3 ; /* [2..0] */
unsigned int mem_ctrl_sp : 29 ; /* [31..3] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CVDR_MEM_CFG0;
/* Define the union U_CVDR_MEM_CFG1 */
typedef union {
/* Define the struct bits */
struct {
unsigned int reserved_0 : 3 ; /* [2..0] */
unsigned int mem_ctrl_tp : 29 ; /* [31..3] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CVDR_MEM_CFG1;
/* Define the union U_CVDR_IRQ_REG0 */
typedef union {
/* Define the struct bits */
struct {
unsigned int cvdr_irq_clr : 8 ; /* [7..0] */
unsigned int reserved_0 : 24 ; /* [31..8] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CVDR_IRQ_REG0;
/* Define the union U_CVDR_IRQ_REG1 */
typedef union {
/* Define the struct bits */
struct {
unsigned int cvdr_irq_mask : 8 ; /* [7..0] */
unsigned int reserved_0 : 24 ; /* [31..8] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CVDR_IRQ_REG1;
/* Define the union U_CVDR_IRQ_REG2 */
typedef union {
/* Define the struct bits */
struct {
unsigned int cvdr_irq_state_mask : 8 ; /* [7..0] */
unsigned int reserved_0 : 8 ; /* [15..8] */
unsigned int cvdr_irq_state_raw : 8 ; /* [23..16] */
unsigned int reserved_1 : 8 ; /* [31..24] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CVDR_IRQ_REG2;
/* Define the union U_CMDLST_CTRL */
typedef union {
/* Define the struct bits */
struct {
unsigned int cmdlst_ctrl_chn0 : 3 ; /* [2..0] */
unsigned int cmdlst_ctrl_chn1 : 3 ; /* [5..3] */
unsigned int cmdlst_ctrl_chn2 : 3 ; /* [8..6] */
unsigned int cmdlst_ctrl_chn3 : 3 ; /* [11..9] */
unsigned int cmdlst_ctrl_chn4 : 3 ; /* [14..12] */
unsigned int cmdlst_ctrl_chn5 : 3 ; /* [17..15] */
unsigned int cmdlst_ctrl_chn6 : 3 ; /* [20..18] */
unsigned int cmdlst_ctrl_chn7 : 3 ; /* [23..21] */
unsigned int reserved_0 : 8 ; /* [31..24] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CMDLST_CTRL;
/* Define the union U_CMDLST_CHN0 */
typedef union {
/* Define the struct bits */
struct {
unsigned int cmdlst_eof_mask_chn0 : 2 ; /* [1..0] */
unsigned int reserved_0 : 30 ; /* [31..2] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CMDLST_CHN0;
/* Define the union U_CMDLST_CHN1 */
typedef union {
/* Define the struct bits */
struct {
unsigned int cmdlst_eof_mask_chn1 : 2 ; /* [1..0] */
unsigned int reserved_0 : 30 ; /* [31..2] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CMDLST_CHN1;
/* Define the union U_CMDLST_CHN2 */
typedef union {
/* Define the struct bits */
struct {
unsigned int cmdlst_eof_mask_chn2 : 2 ; /* [1..0] */
unsigned int reserved_0 : 30 ; /* [31..2] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CMDLST_CHN2;
/* Define the union U_CMDLST_CHN3 */
typedef union {
/* Define the struct bits */
struct {
unsigned int cmdlst_eof_mask_chn3 : 2 ; /* [1..0] */
unsigned int reserved_0 : 30 ; /* [31..2] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CMDLST_CHN3;
/* Define the union U_CMDLST_CHN4 */
typedef union {
/* Define the struct bits */
struct {
unsigned int cmdlst_eof_mask_chn4 : 2 ; /* [1..0] */
unsigned int reserved_0 : 30 ; /* [31..2] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CMDLST_CHN4;
/* Define the union U_CMDLST_CHN5 */
typedef union {
/* Define the struct bits */
struct {
unsigned int cmdlst_eof_mask_chn5 : 2 ; /* [1..0] */
unsigned int reserved_0 : 30 ; /* [31..2] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CMDLST_CHN5;
/* Define the union U_CMDLST_CHN6 */
typedef union {
/* Define the struct bits */
struct {
unsigned int cmdlst_eof_mask_chn6 : 2 ; /* [1..0] */
unsigned int reserved_0 : 30 ; /* [31..2] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CMDLST_CHN6;
/* Define the union U_CMDLST_CHN7 */
typedef union {
/* Define the struct bits */
struct {
unsigned int cmdlst_eof_mask_chn7 : 2 ; /* [1..0] */
unsigned int reserved_0 : 30 ; /* [31..2] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CMDLST_CHN7;
/* Define the union U_CMDLST_R8_IRQ_REG0 */
typedef union {
/* Define the struct bits */
struct {
unsigned int cmdlst_r8_irq_clr : 8 ; /* [7..0] */
unsigned int reserved_0 : 24 ; /* [31..8] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CMDLST_R8_IRQ_REG0;
/* Define the union U_CMDLST_R8_IRQ_REG1 */
typedef union {
/* Define the struct bits */
struct {
unsigned int cmdlst_r8_irq_mask : 8 ; /* [7..0] */
unsigned int reserved_0 : 24 ; /* [31..8] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CMDLST_R8_IRQ_REG1;
/* Define the union U_CMDLST_R8_IRQ_REG2 */
typedef union {
/* Define the struct bits */
struct {
unsigned int cmdlst_r8_irq_state_mask : 8 ; /* [7..0] */
unsigned int reserved_0 : 8 ; /* [15..8] */
unsigned int cmdlst_r8_irq_state_raw : 8 ; /* [23..16] */
unsigned int reserved_1 : 8 ; /* [31..24] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CMDLST_R8_IRQ_REG2;
/* Define the union U_CMDLST_ACPU_IRQ_REG0 */
typedef union {
/* Define the struct bits */
struct {
unsigned int cmdlst_acpu_irq_clr : 8 ; /* [7..0] */
unsigned int reserved_0 : 24 ; /* [31..8] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CMDLST_ACPU_IRQ_REG0;
/* Define the union U_CMDLST_ACPU_IRQ_REG1 */
typedef union {
/* Define the struct bits */
struct {
unsigned int cmdlst_acpu_irq_mask : 8 ; /* [7..0] */
unsigned int reserved_0 : 24 ; /* [31..8] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CMDLST_ACPU_IRQ_REG1;
/* Define the union U_CMDLST_ACPU_IRQ_REG2 */
typedef union {
/* Define the struct bits */
struct {
unsigned int cmdlst_acpu_irq_state_mask : 8 ; /* [7..0] */
unsigned int reserved_0 : 8 ; /* [15..8] */
unsigned int cmdlst_acpu_irq_state_raw : 8 ; /* [23..16] */
unsigned int reserved_1 : 8 ; /* [31..24] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CMDLST_ACPU_IRQ_REG2;
/* Define the union U_CMDLST_IVP_IRQ_REG0 */
typedef union {
/* Define the struct bits */
struct {
unsigned int cmdlst_ivp_irq_clr : 8 ; /* [7..0] */
unsigned int reserved_0 : 24 ; /* [31..8] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CMDLST_IVP_IRQ_REG0;
/* Define the union U_CMDLST_IVP_IRQ_REG1 */
typedef union {
/* Define the struct bits */
struct {
unsigned int cmdlst_ivp_irq_mask : 8 ; /* [7..0] */
unsigned int reserved_0 : 24 ; /* [31..8] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CMDLST_IVP_IRQ_REG1;
/* Define the union U_CMDLST_IVP_IRQ_REG2 */
typedef union {
/* Define the struct bits */
struct {
unsigned int cmdlst_ivp_irq_state_mask : 8 ; /* [7..0] */
unsigned int reserved_0 : 8 ; /* [15..8] */
unsigned int cmdlst_ivp_irq_state_raw : 8 ; /* [23..16] */
unsigned int reserved_1 : 8 ; /* [31..24] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CMDLST_IVP_IRQ_REG2;
/* Define the union U_JPG_FLUX_CTRL0_0 */
typedef union {
/* Define the struct bits */
struct {
unsigned int flux_ctrl0_cvdr_r : 32 ; /* [31..0] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_JPG_FLUX_CTRL0_0;
/* Define the union U_JPG_FLUX_CTRL0_1 */
typedef union {
/* Define the struct bits */
struct {
unsigned int flux_ctrl1_cvdr_r : 32 ; /* [31..0] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_JPG_FLUX_CTRL0_1;
/* Define the union U_JPG_FLUX_CTRL1_0 */
typedef union {
/* Define the struct bits */
struct {
unsigned int flux_ctrl0_cvdr_w : 32 ; /* [31..0] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_JPG_FLUX_CTRL1_0;
/* Define the union U_JPG_FLUX_CTRL1_1 */
typedef union {
/* Define the struct bits */
struct {
unsigned int flux_ctrl1_cvdr_w : 32 ; /* [31..0] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_JPG_FLUX_CTRL1_1;
/* Define the union U_JPG_FLUX_CTRL2_0 */
typedef union {
/* Define the struct bits */
struct {
unsigned int flux_ctrl0_fd_r : 32 ; /* [31..0] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_JPG_FLUX_CTRL2_0;
/* Define the union U_JPG_FLUX_CTRL2_1 */
typedef union {
/* Define the struct bits */
struct {
unsigned int flux_ctrl1_fd_r : 32 ; /* [31..0] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_JPG_FLUX_CTRL2_1;
/* Define the union U_JPG_FLUX_CTRL3_0 */
typedef union {
/* Define the struct bits */
struct {
unsigned int flux_ctrl0_fd_w : 32 ; /* [31..0] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_JPG_FLUX_CTRL3_0;
/* Define the union U_JPG_FLUX_CTRL3_1 */
typedef union {
/* Define the struct bits */
struct {
unsigned int flux_ctrl1_fd_w : 32 ; /* [31..0] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_JPG_FLUX_CTRL3_1;
/* Define the union U_JPG_RO_STATE */
typedef union {
/* Define the struct bits */
struct {
unsigned int reserved_0 : 16 ; /* [15..0] */
unsigned int jpg_axi_dlock_irq : 1 ; /* [16] */
unsigned int jpg_axi_dlock_wr : 1 ; /* [17] */
unsigned int jpg_axi_dlock_slv : 1 ; /* [18] */
unsigned int jpg_axi_dlock_mst : 1 ; /* [19] */
unsigned int jpg_axi_dlock_id : 8 ; /* [27..20] */
unsigned int reserved_1 : 4 ; /* [31..28] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_JPG_RO_STATE;
/* Define the union U_JPGENC_CRG_CFG0 */
typedef union {
/* Define the struct bits */
struct {
unsigned int jpgenc_clken : 1 ; /* [0] */
unsigned int reserved_0 : 15 ; /* [15..1] */
unsigned int jpgenc_force_clk_on : 1 ; /* [16] */
unsigned int reserved_1 : 15 ; /* [31..17] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_JPGENC_CRG_CFG0;
/* Define the union U_JPGENC_CRG_CFG1 */
typedef union {
/* Define the struct bits */
struct {
unsigned int jpgenc_soft_rst : 1 ; /* [0] */
unsigned int reserved_0 : 31 ; /* [31..1] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_JPGENC_CRG_CFG1;
/* Define the union U_JPGENC_MEM_CFG */
typedef union {
/* Define the struct bits */
struct {
unsigned int jpgenc_mem_ctrl_sp : 3 ; /* [2..0] */
unsigned int reserved_0 : 29 ; /* [31..3] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_JPGENC_MEM_CFG;
/* Define the union U_JPGENC_PREF_STOP */
typedef union {
/* Define the struct bits */
struct {
unsigned int jpgenc_prefetch_stop : 1 ; /* [0] */
unsigned int reserved_0 : 15 ; /* [15..1] */
unsigned int jpgenc_prefetch_stop_ok : 1 ; /* [16] */
unsigned int reserved_1 : 15 ; /* [31..17] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_JPGENC_PREF_STOP;
/* Define the union U_JPGENC_IRQ_REG0 */
typedef union {
/* Define the struct bits */
struct {
unsigned int jpgenc_irq_clr : 5 ; /* [4..0] */
unsigned int reserved_0 : 11 ; /* [15..5] */
unsigned int jpgenc_irq_force : 5 ; /* [20..16] */
unsigned int reserved_1 : 11 ; /* [31..21] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_JPGENC_IRQ_REG0;
/* Define the union U_JPGENC_IRQ_REG1 */
typedef union {
/* Define the struct bits */
struct {
unsigned int jpgenc_irq_mask : 5 ; /* [4..0] */
unsigned int reserved_0 : 27 ; /* [31..5] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_JPGENC_IRQ_REG1;
/* Define the union U_JPGENC_IRQ_REG2 */
typedef union {
/* Define the struct bits */
struct {
unsigned int jpgenc_irq_state_mask : 5 ; /* [4..0] */
unsigned int reserved_0 : 11 ; /* [15..5] */
unsigned int jpgenc_irq_state_raw : 5 ; /* [20..16] */
unsigned int reserved_1 : 11 ; /* [31..21] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_JPGENC_IRQ_REG2;
/* Define the union U_JPGDEC_CRG_CFG0 */
typedef union {
/* Define the struct bits */
struct {
unsigned int jpgdec_clken : 1 ; /* [0] */
unsigned int reserved_0 : 15 ; /* [15..1] */
unsigned int jpgdec_force_clk_on : 1 ; /* [16] */
unsigned int reserved_1 : 15 ; /* [31..17] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_JPGDEC_CRG_CFG0;
/* Define the union U_JPGDEC_CRG_CFG1 */
typedef union {
/* Define the struct bits */
struct {
unsigned int jpgdec_soft_rst : 1 ; /* [0] */
unsigned int reserved_0 : 31 ; /* [31..1] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_JPGDEC_CRG_CFG1;
/* Define the union U_JPGDEC_MEM_CFG */
typedef union {
/* Define the struct bits */
struct {
unsigned int jpgdec_mem_ctrl_sp : 3 ; /* [2..0] */
unsigned int reserved_0 : 1 ; /* [3] */
unsigned int jpgdec_mem_ctrl_tp : 3 ; /* [6..4] */
unsigned int reserved_1 : 25 ; /* [31..7] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_JPGDEC_MEM_CFG;
/* Define the union U_JPGDEC_PREF_STOP */
typedef union {
/* Define the struct bits */
struct {
unsigned int jpgdec_prefetch_stop : 1 ; /* [0] */
unsigned int reserved_0 : 15 ; /* [15..1] */
unsigned int jpgdec_prefetch_stop_ok : 1 ; /* [16] */
unsigned int reserved_1 : 15 ; /* [31..17] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_JPGDEC_PREF_STOP;
/* Define the union U_JPGDEC_IRQ_REG0 */
typedef union {
/* Define the struct bits */
struct {
unsigned int jpgdec_irq_clr : 4 ; /* [3..0] */
unsigned int reserved_0 : 12 ; /* [15..4] */
unsigned int jpgdec_irq_force : 4 ; /* [19..16] */
unsigned int reserved_1 : 12 ; /* [31..20] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_JPGDEC_IRQ_REG0;
/* Define the union U_JPGDEC_IRQ_REG1 */
typedef union {
/* Define the struct bits */
struct {
unsigned int jpgdec_irq_mask : 4 ; /* [3..0] */
unsigned int reserved_0 : 28 ; /* [31..4] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_JPGDEC_IRQ_REG1;
/* Define the union U_JPGDEC_IRQ_REG2 */
typedef union {
/* Define the struct bits */
struct {
unsigned int jpgdec_irq_state_mask : 4 ; /* [3..0] */
unsigned int reserved_0 : 12 ; /* [15..4] */
unsigned int jpgdec_irq_state_raw : 4 ; /* [19..16] */
unsigned int reserved_1 : 12 ; /* [31..20] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_JPGDEC_IRQ_REG2;
/* Define the union U_CPE_CRG_CFG0 */
typedef union {
/* Define the struct bits */
struct {
unsigned int mcf_clken : 1 ; /* [0] */
unsigned int mfnr_clken : 1 ; /* [1] */
unsigned int vbk_clken : 1 ; /* [2] */
unsigned int reserved_0 : 13 ; /* [15..3] */
unsigned int mcf_force_clk_on : 1 ; /* [16] */
unsigned int mfnr_force_clk_on : 1 ; /* [17] */
unsigned int vbk_force_clk_on : 1 ; /* [18] */
unsigned int reserved_1 : 13 ; /* [31..19] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CPE_CRG_CFG0;
/* Define the union U_CPE_CRG_CFG1 */
typedef union {
/* Define the struct bits */
struct {
unsigned int mcf_soft_rst : 1 ; /* [0] */
unsigned int mfnr_soft_rst : 1 ; /* [1] */
unsigned int vbk_soft_rst : 1 ; /* [2] */
unsigned int reserved_0 : 29 ; /* [31..3] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CPE_CRG_CFG1;
/* Define the union U_CPE_MEM_CFG */
typedef union {
/* Define the struct bits */
struct {
unsigned int mcf_mem_ctrl_sp : 3 ; /* [2..0] */
unsigned int reserved_0 : 1 ; /* [3] */
unsigned int mfnr_mem_ctrl_sp : 3 ; /* [6..4] */
unsigned int reserved_1 : 1 ; /* [7] */
unsigned int vbk_mem_ctrl_sp : 3 ; /* [10..8] */
unsigned int reserved_2 : 21 ; /* [31..11] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CPE_MEM_CFG;
/* Define the union U_CPE_IRQ_REG0 */
typedef union {
/* Define the struct bits */
struct {
unsigned int cpe_irq_clr : 23 ; /* [22..0] */
unsigned int reserved_0 : 9 ; /* [31..23] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CPE_IRQ_REG0;
/* Define the union U_CPE_IRQ_REG1 */
typedef union {
/* Define the struct bits */
struct {
unsigned int cpe_irq_mask : 23 ; /* [22..0] */
unsigned int reserved_0 : 9 ; /* [31..23] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CPE_IRQ_REG1;
/* Define the union U_CPE_IRQ_REG2 */
typedef union {
/* Define the struct bits */
struct {
unsigned int mcf_irq_outen : 2 ; /* [1..0] */
unsigned int mfnr_irq_outen : 2 ; /* [3..2] */
unsigned int vbk_irq_outen : 2 ; /* [5..4] */
unsigned int reserved_0 : 26 ; /* [31..6] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CPE_IRQ_REG2;
/* Define the union U_CPE_IRQ_REG3 */
typedef union {
/* Define the struct bits */
struct {
unsigned int cpe_irq_state_mask : 23 ; /* [22..0] */
unsigned int reserved_0 : 9 ; /* [31..23] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CPE_IRQ_REG3;
/* Define the union U_CPE_IRQ_REG4 */
typedef union {
/* Define the struct bits */
struct {
unsigned int cpe_irq_state_raw : 23 ; /* [22..0] */
unsigned int reserved_0 : 9 ; /* [31..23] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CPE_IRQ_REG4;
/* Define the union U_CROP_VPWR_0 */
typedef union {
/* Define the struct bits */
struct {
unsigned int cpe_vpwr0_ihleft : 11 ; /* [10..0] */
unsigned int reserved_0 : 5 ; /* [15..11] */
unsigned int cpe_vpwr0_ihright : 11 ; /* [26..16] */
unsigned int reserved_1 : 5 ; /* [31..27] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CROP_VPWR_0;
/* Define the union U_CROP_VPWR_1 */
typedef union {
/* Define the struct bits */
struct {
unsigned int cpe_vpwr1_ihleft : 11 ; /* [10..0] */
unsigned int reserved_0 : 5 ; /* [15..11] */
unsigned int cpe_vpwr1_ihright : 11 ; /* [26..16] */
unsigned int reserved_1 : 5 ; /* [31..27] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CROP_VPWR_1;
/* Define the union U_CROP_VPWR_2 */
typedef union {
/* Define the struct bits */
struct {
unsigned int cpe_vpwr2_ihleft : 11 ; /* [10..0] */
unsigned int reserved_0 : 5 ; /* [15..11] */
unsigned int cpe_vpwr2_ihright : 11 ; /* [26..16] */
unsigned int reserved_1 : 5 ; /* [31..27] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CROP_VPWR_2;
/* Define the union U_CPE_mode_CFG */
typedef union {
/* Define the struct bits */
struct {
unsigned int cpe_op_mode : 2 ; /* [1..0] */
unsigned int reserved_0 : 30 ; /* [31..2] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CPE_mode_CFG;
/* Define the union U_SLAM_CRG_CFG0 */
typedef union {
/* Define the struct bits */
struct {
unsigned int slam_clken : 1 ; /* [0] */
unsigned int reserved_0 : 15 ; /* [15..1] */
unsigned int slam_force_clk_on : 1 ; /* [16] */
unsigned int reserved_1 : 15 ; /* [31..17] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_SLAM_CRG_CFG0;
/* Define the union U_SLAM_CRG_CFG1 */
typedef union {
/* Define the struct bits */
struct {
unsigned int slam_soft_rst : 1 ; /* [0] */
unsigned int reserved_0 : 31 ; /* [31..1] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_SLAM_CRG_CFG1;
/* Define the union U_SLAM_MEM_CFG */
typedef union {
/* Define the struct bits */
struct {
unsigned int slam_mem_ctrl_sp : 3 ; /* [2..0] */
unsigned int reserved_0 : 29 ; /* [31..3] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_SLAM_MEM_CFG;
/* Define the union U_SLAM_IRQ_REG0 */
typedef union {
/* Define the struct bits */
struct {
unsigned int slam_irq_clr : 14 ; /* [13..0] */
unsigned int reserved_0 : 2 ; /* [15..14] */
unsigned int slam_irq_force : 14 ; /* [29..16] */
unsigned int reserved_1 : 2 ; /* [31..30] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_SLAM_IRQ_REG0;
/* Define the union U_SLAM_IRQ_REG1 */
typedef union {
/* Define the struct bits */
struct {
unsigned int slam_irq_mask : 14 ; /* [13..0] */
unsigned int reserved_0 : 2 ; /* [15..14] */
unsigned int slam_irq_outen : 2 ; /* [17..16] */
unsigned int reserved_1 : 14 ; /* [31..18] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_SLAM_IRQ_REG1;
/* Define the union U_SLAM_IRQ_REG2 */
typedef union {
/* Define the struct bits */
struct {
unsigned int slam_irq_state_mask : 14 ; /* [13..0] */
unsigned int reserved_0 : 2 ; /* [15..14] */
unsigned int slam_irq_state_raw : 14 ; /* [29..16] */
unsigned int reserved_1 : 2 ; /* [31..30] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_SLAM_IRQ_REG2;
/* Define the union U_RDR_CRG_CFG0 */
typedef union {
/* Define the struct bits */
struct {
unsigned int rdr_clken : 1 ; /* [0] */
unsigned int reserved_0 : 15 ; /* [15..1] */
unsigned int rdr_force_clk_on : 1 ; /* [16] */
unsigned int reserved_1 : 15 ; /* [31..17] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_RDR_CRG_CFG0;
/* Define the union U_RDR_CRG_CFG1 */
typedef union {
/* Define the struct bits */
struct {
unsigned int rdr_soft_rst : 1 ; /* [0] */
unsigned int reserved_0 : 31 ; /* [31..1] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_RDR_CRG_CFG1;
/* Define the union U_RDR_MEM_CFG */
typedef union {
/* Define the struct bits */
struct {
unsigned int rdr_mem_ctrl_sp : 3 ; /* [2..0] */
unsigned int reserved_0 : 29 ; /* [31..3] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_RDR_MEM_CFG;
/* Define the union U_RDR_PREF_STOP */
typedef union {
/* Define the struct bits */
struct {
unsigned int rdr_prefetch_stop : 1 ; /* [0] */
unsigned int reserved_0 : 15 ; /* [15..1] */
unsigned int rdr_prefetch_stop_ok : 1 ; /* [16] */
unsigned int reserved_1 : 15 ; /* [31..17] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_RDR_PREF_STOP;
/* Define the union U_RDR_IRQ_REG0 */
typedef union {
/* Define the struct bits */
struct {
unsigned int rdr_irq_clr : 5 ; /* [4..0] */
unsigned int reserved_0 : 11 ; /* [15..5] */
unsigned int rdr_irq_force : 5 ; /* [20..16] */
unsigned int reserved_1 : 11 ; /* [31..21] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_RDR_IRQ_REG0;
/* Define the union U_RDR_IRQ_REG1 */
typedef union {
/* Define the struct bits */
struct {
unsigned int rdr_irq_mask : 5 ; /* [4..0] */
unsigned int reserved_0 : 11 ; /* [15..5] */
unsigned int rdr_irq_outen : 2 ; /* [17..16] */
unsigned int reserved_1 : 14 ; /* [31..18] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_RDR_IRQ_REG1;
/* Define the union U_RDR_IRQ_REG2 */
typedef union {
/* Define the struct bits */
struct {
unsigned int rdr_irq_state_mask : 5 ; /* [4..0] */
unsigned int reserved_0 : 11 ; /* [15..5] */
unsigned int rdr_irq_state_raw : 5 ; /* [20..16] */
unsigned int reserved_1 : 11 ; /* [31..21] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_RDR_IRQ_REG2;
/* Define the union U_CMP_CRG_CFG0 */
typedef union {
/* Define the struct bits */
struct {
unsigned int cmp_clken : 1 ; /* [0] */
unsigned int reserved_0 : 15 ; /* [15..1] */
unsigned int cmp_force_clk_on : 1 ; /* [16] */
unsigned int reserved_1 : 15 ; /* [31..17] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CMP_CRG_CFG0;
/* Define the union U_CMP_CRG_CFG1 */
typedef union {
/* Define the struct bits */
struct {
unsigned int cmp_soft_rst : 1 ; /* [0] */
unsigned int reserved_0 : 31 ; /* [31..1] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CMP_CRG_CFG1;
/* Define the union U_CMP_MEM_CFG */
typedef union {
/* Define the struct bits */
struct {
unsigned int cmp_mem_ctrl_sp : 3 ; /* [2..0] */
unsigned int reserved_0 : 29 ; /* [31..3] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CMP_MEM_CFG;
/* Define the union U_CMP_PREF_STOP */
typedef union {
/* Define the struct bits */
struct {
unsigned int cmp_prefetch_stop : 1 ; /* [0] */
unsigned int reserved_0 : 15 ; /* [15..1] */
unsigned int cmp_prefetch_stop_ok : 1 ; /* [16] */
unsigned int reserved_1 : 15 ; /* [31..17] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CMP_PREF_STOP;
/* Define the union U_CMP_IRQ_REG0 */
typedef union {
/* Define the struct bits */
struct {
unsigned int cmp_irq_clr : 5 ; /* [4..0] */
unsigned int reserved_0 : 11 ; /* [15..5] */
unsigned int cmp_irq_force : 5 ; /* [20..16] */
unsigned int reserved_1 : 11 ; /* [31..21] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CMP_IRQ_REG0;
/* Define the union U_CMP_IRQ_REG1 */
typedef union {
/* Define the struct bits */
struct {
unsigned int cmp_irq_mask : 5 ; /* [4..0] */
unsigned int reserved_0 : 11 ; /* [15..5] */
unsigned int cmp_irq_outen : 2 ; /* [17..16] */
unsigned int reserved_1 : 14 ; /* [31..18] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CMP_IRQ_REG1;
/* Define the union U_CMP_IRQ_REG2 */
typedef union {
/* Define the struct bits */
struct {
unsigned int cmp_irq_state_mask : 5 ; /* [4..0] */
unsigned int reserved_0 : 11 ; /* [15..5] */
unsigned int cmp_irq_state_raw : 5 ; /* [20..16] */
unsigned int reserved_1 : 11 ; /* [31..21] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_CMP_IRQ_REG2;
/* Define the union U_HIFD_CRG_CFG0 */
typedef union {
/* Define the struct bits */
struct {
unsigned int hifd_clken : 1 ; /* [0] */
unsigned int reserved_0 : 31 ; /* [31..1] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_HIFD_CRG_CFG0;
/* Define the union U_HIFD_CRG_CFG1 */
typedef union {
/* Define the struct bits */
struct {
unsigned int hifd_soft_rst : 1 ; /* [0] */
unsigned int reserved_0 : 31 ; /* [31..1] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_HIFD_CRG_CFG1;
/* Define the union U_HIFD_MEM_CFG */
typedef union {
/* Define the struct bits */
struct {
unsigned int hifd_mem_ctrl_sp : 3 ; /* [2..0] */
unsigned int reserved_0 : 1 ; /* [3] */
unsigned int hifd_mem_ctrl_sp2 : 3 ; /* [6..4] */
unsigned int reserved_1 : 1 ; /* [7] */
unsigned int hifd_mem_ctrl_tp : 3 ; /* [10..8] */
unsigned int reserved_2 : 5 ; /* [15..11] */
unsigned int hifd_rom_ctrl : 8 ; /* [23..16] */
unsigned int reserved_3 : 8 ; /* [31..24] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_HIFD_MEM_CFG;
/* Define the union U_FD_SMMU_MASTER_REG0 */
typedef union {
/* Define the struct bits */
struct {
unsigned int fd_prefetch_initial : 11 ; /* [10..0] */
unsigned int reserved_0 : 21 ; /* [31..11] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_FD_SMMU_MASTER_REG0;
/* Define the union U_FD_SMMU_MASTER_REG1 */
typedef union {
/* Define the struct bits */
struct {
unsigned int fd_stream_end : 11 ; /* [10..0] */
unsigned int reserved_0 : 21 ; /* [31..11] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_FD_SMMU_MASTER_REG1;
/* Define the union U_FD_SMMU_MASTER_REG2 */
typedef union {
/* Define the struct bits */
struct {
unsigned int fd_stream_ack : 11 ; /* [10..0] */
unsigned int reserved_0 : 21 ; /* [31..11] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_FD_SMMU_MASTER_REG2;
/* Define the union U_JPG_DEBUG_0 */
typedef union {
/* Define the struct bits */
struct {
unsigned int debug_info_0 : 32 ; /* [31..0] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_JPG_DEBUG_0;
/* Define the union U_JPG_DEBUG_1 */
typedef union {
/* Define the struct bits */
struct {
unsigned int debug_info_1 : 32 ; /* [31..0] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_JPG_DEBUG_1;
/* Define the union U_JPG_DEBUG_2 */
typedef union {
/* Define the struct bits */
struct {
unsigned int debug_info_2 : 32 ; /* [31..0] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_JPG_DEBUG_2;
/* Define the union U_JPG_DEBUG_3 */
typedef union {
/* Define the struct bits */
struct {
unsigned int debug_info_3 : 32 ; /* [31..0] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_JPG_DEBUG_3;
/* Define the union U_JPG_SEC_CTRL_S */
typedef union {
/* Define the struct bits */
struct {
unsigned int top_tz_secure_n : 1 ; /* [0] */
unsigned int jpgenc_tz_secure_n : 1 ; /* [1] */
unsigned int jpgdec_tz_secure_n : 1 ; /* [2] */
unsigned int fd_tz_secure_n : 1 ; /* [3] */
unsigned int cpe_tz_secure_n : 1 ; /* [4] */
unsigned int slam_tz_secure_n : 1 ; /* [5] */
unsigned int orb_tz_secure_n : 1 ; /* [6] */
unsigned int cmdlst_tz_secure_n : 1 ; /* [7] */
unsigned int reserved_0 : 24 ; /* [31..8] */
} bits;
/* Define an unsigned member */
unsigned int u32;
} U_JPG_SEC_CTRL_S;
//==============================================================================
/* Define the global struct */
typedef struct {
U_DMA_CRG_CFG0 DMA_CRG_CFG0;
U_DMA_CRG_CFG1 DMA_CRG_CFG1;
U_CVDR_MEM_CFG0 CVDR_MEM_CFG0;
U_CVDR_MEM_CFG1 CVDR_MEM_CFG1;
U_CVDR_IRQ_REG0 CVDR_IRQ_REG0;
U_CVDR_IRQ_REG1 CVDR_IRQ_REG1;
U_CVDR_IRQ_REG2 CVDR_IRQ_REG2;
U_CMDLST_CTRL CMDLST_CTRL;
U_CMDLST_CHN0 CMDLST_CHN0;
U_CMDLST_CHN1 CMDLST_CHN1;
U_CMDLST_CHN2 CMDLST_CHN2;
U_CMDLST_CHN3 CMDLST_CHN3;
U_CMDLST_CHN4 CMDLST_CHN4;
U_CMDLST_CHN5 CMDLST_CHN5;
U_CMDLST_CHN6 CMDLST_CHN6;
U_CMDLST_CHN7 CMDLST_CHN7;
U_CMDLST_R8_IRQ_REG0 CMDLST_R8_IRQ_REG0;
U_CMDLST_R8_IRQ_REG1 CMDLST_R8_IRQ_REG1;
U_CMDLST_R8_IRQ_REG2 CMDLST_R8_IRQ_REG2;
U_CMDLST_ACPU_IRQ_REG0 CMDLST_ACPU_IRQ_REG0;
U_CMDLST_ACPU_IRQ_REG1 CMDLST_ACPU_IRQ_REG1;
U_CMDLST_ACPU_IRQ_REG2 CMDLST_ACPU_IRQ_REG2;
U_CMDLST_IVP_IRQ_REG0 CMDLST_IVP_IRQ_REG0;
U_CMDLST_IVP_IRQ_REG1 CMDLST_IVP_IRQ_REG1;
U_CMDLST_IVP_IRQ_REG2 CMDLST_IVP_IRQ_REG2;
U_JPG_FLUX_CTRL0_0 JPG_FLUX_CTRL0_0;
U_JPG_FLUX_CTRL0_1 JPG_FLUX_CTRL0_1;
U_JPG_FLUX_CTRL1_0 JPG_FLUX_CTRL1_0;
U_JPG_FLUX_CTRL1_1 JPG_FLUX_CTRL1_1;
U_JPG_FLUX_CTRL2_0 JPG_FLUX_CTRL2_0;
U_JPG_FLUX_CTRL2_1 JPG_FLUX_CTRL2_1;
U_JPG_FLUX_CTRL3_0 JPG_FLUX_CTRL3_0;
U_JPG_FLUX_CTRL3_1 JPG_FLUX_CTRL3_1;
U_JPG_RO_STATE JPG_RO_STATE;
U_JPGENC_CRG_CFG0 JPGENC_CRG_CFG0;
U_JPGENC_CRG_CFG1 JPGENC_CRG_CFG1;
U_JPGENC_MEM_CFG JPGENC_MEM_CFG;
U_JPGENC_PREF_STOP JPGENC_PREF_STOP;
U_JPGENC_IRQ_REG0 JPGENC_IRQ_REG0;
U_JPGENC_IRQ_REG1 JPGENC_IRQ_REG1;
U_JPGENC_IRQ_REG2 JPGENC_IRQ_REG2;
U_JPGDEC_CRG_CFG0 JPGDEC_CRG_CFG0;
U_JPGDEC_CRG_CFG1 JPGDEC_CRG_CFG1;
U_JPGDEC_MEM_CFG JPGDEC_MEM_CFG;
U_JPGDEC_PREF_STOP JPGDEC_PREF_STOP;
U_JPGDEC_IRQ_REG0 JPGDEC_IRQ_REG0;
U_JPGDEC_IRQ_REG1 JPGDEC_IRQ_REG1;
U_JPGDEC_IRQ_REG2 JPGDEC_IRQ_REG2;
U_CPE_CRG_CFG0 CPE_CRG_CFG0;
U_CPE_CRG_CFG1 CPE_CRG_CFG1;
U_CPE_MEM_CFG CPE_MEM_CFG;
U_CPE_IRQ_REG0 CPE_IRQ_REG0;
U_CPE_IRQ_REG1 CPE_IRQ_REG1;
U_CPE_IRQ_REG2 CPE_IRQ_REG2;
U_CPE_IRQ_REG3 CPE_IRQ_REG3;
U_CPE_IRQ_REG4 CPE_IRQ_REG4;
U_CROP_VPWR_0 CROP_VPWR_0;
U_CROP_VPWR_1 CROP_VPWR_1;
U_CROP_VPWR_2 CROP_VPWR_2;
U_CPE_mode_CFG CPE_mode_CFG;
U_SLAM_CRG_CFG0 SLAM_CRG_CFG0;
U_SLAM_CRG_CFG1 SLAM_CRG_CFG1;
U_SLAM_MEM_CFG SLAM_MEM_CFG;
U_SLAM_IRQ_REG0 SLAM_IRQ_REG0;
U_SLAM_IRQ_REG1 SLAM_IRQ_REG1;
U_SLAM_IRQ_REG2 SLAM_IRQ_REG2;
U_RDR_CRG_CFG0 RDR_CRG_CFG0;
U_RDR_CRG_CFG1 RDR_CRG_CFG1;
U_RDR_MEM_CFG RDR_MEM_CFG;
U_RDR_PREF_STOP RDR_PREF_STOP;
U_RDR_IRQ_REG0 RDR_IRQ_REG0;
U_RDR_IRQ_REG1 RDR_IRQ_REG1;
U_RDR_IRQ_REG2 RDR_IRQ_REG2;
U_CMP_CRG_CFG0 CMP_CRG_CFG0;
U_CMP_CRG_CFG1 CMP_CRG_CFG1;
U_CMP_MEM_CFG CMP_MEM_CFG;
U_CMP_PREF_STOP CMP_PREF_STOP;
U_CMP_IRQ_REG0 CMP_IRQ_REG0;
U_CMP_IRQ_REG1 CMP_IRQ_REG1;
U_CMP_IRQ_REG2 CMP_IRQ_REG2;
U_HIFD_CRG_CFG0 HIFD_CRG_CFG0;
U_HIFD_CRG_CFG1 HIFD_CRG_CFG1;
U_HIFD_MEM_CFG HIFD_MEM_CFG;
U_FD_SMMU_MASTER_REG0 FD_SMMU_MASTER_REG0;
U_FD_SMMU_MASTER_REG1 FD_SMMU_MASTER_REG1;
U_FD_SMMU_MASTER_REG2 FD_SMMU_MASTER_REG2;
U_JPG_DEBUG_0 JPG_DEBUG_0;
U_JPG_DEBUG_1 JPG_DEBUG_1;
U_JPG_DEBUG_2 JPG_DEBUG_2;
U_JPG_DEBUG_3 JPG_DEBUG_3;
U_JPG_SEC_CTRL_S JPG_SEC_CTRL_S;
} S_SUB_CTRL_REGS_TYPE;
/* Declare the struct pointor of the module SUB_CTRL */
extern S_SUB_CTRL_REGS_TYPE *gopSUB_CTRLAllReg;
#endif /* __SUB_CTRL_DRV_PRIV_CS_H__ */
| 27.729769 | 81 | 0.578899 |
b81da6b81e7c837f5fdd335eb07adc0fd251baa8 | 3,541 | c | C | libserialize/libserialize.c | raging-loon/NORAA | b86efc0bfdf68398a46b2eabdc904b8d621c7b92 | [
"Apache-2.0"
] | 3 | 2021-12-31T20:14:45.000Z | 2022-02-10T15:09:43.000Z | libserialize/libserialize.c | raging-loon/NORAA | b86efc0bfdf68398a46b2eabdc904b8d621c7b92 | [
"Apache-2.0"
] | null | null | null | libserialize/libserialize.c | raging-loon/NORAA | b86efc0bfdf68398a46b2eabdc904b8d621c7b92 | [
"Apache-2.0"
] | null | null | null | #include "libserialize.h"
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#ifndef LIBTEST
# include "../src/engine/spi.h"
#endif
unsigned char * sm_to_bytes(struct spi_members * sm){
unsigned char * buff;
for(int i = 0; i < sizeof(sm); i++){
buff[i] = ((unsigned char*)sm)[i];
}
return buff;
}
void sm_to_php(struct spi_members * sm, unsigned char * php_ser_buff){
// php object serialization set up like this:
/*
<type>:<strlen of obj name>:<objname>:<num members>:{data}
*/
sprintf(php_ser_buff,"O:11:\"spi_members\":14:{"
"s:9:\"serv_addr\";s:%lu:\"%s\";"\
\
"s:8:\"cli_addr\";s:%lu:\"%s\";"\
"s:9:\"serv_port\";i:%i;"\
"s:8:\"cli_port\";i:%i;"\
"s:16:\"serv_packet_sent\";i:%i;"\
"s:15:\"cli_packet_sent\";i:%i;"\
"s:16:\"serv_packet_recv\";i:%i;"\
"s:15:\"cli_packet_recv\";i:%i;"\
"s:8:\"protocol\";i:%i;"\
"s:3:\"pps\";i:%i;"\
"s:10:\"start_time\";i:%lu;"\
"s:8:\"end_time\";i:%lu;"\
"s:11:\"control_pkt\";i:%i;"\
"s:8:\"data_pkt\";i:%i;}", strlen(sm->serv_addr),sm->serv_addr,strlen(sm->cli_addr),sm->cli_addr,
sm->serv_port,sm->cli_port,sm->serv_packet_sent,*sm->cli_packet_sent,sm->serv_packet_recv,*sm->cli_packet_recv,
sm->protocol,sm->pps,sm->start_time,sm->end_time,sm->control_pkt,sm->data_pkt);
// printf("%s\n",php_ser_buff);
}
void sm_to_pypickle(struct spi_members * sm, unsigned char * py_pickle_buf){
/*
"""
(b'\x80\x04\x95#\x01\x00\x00\x00\x00\x00\x00\x8c\x11vigil.classes.spi\x94\x8c'
b'\x0bspi_members\x94\x93\x94)\x81\x94}\x94(\x8c\tserv_addr\x94\x8c\x0b192.1'
b'68.0.1\x94\x8c\x08cli_addr\x94\x8c\x0b192.168.0.2\x94\x8c\tserv_port\x94'
b'M\xbb\x01\x8c\x08cli_port\x94M\x99\xdc\x8c\x10serv_packet_sent\x94'
b'K\x0c\x8c\x0fcli_packet_sent\x94K\x14\x8c\x0fcli_packet_recv\x94'
b'K\x0c\x8c\x10serv_packet_recv\x94K\x14\x8c\x08protocol\x94K~\x8c\x03pp'
b's\x94K\x00\x8c\nstart_time\x94J\xa2\\Lb\x8c\x08end_time\x94J\xcd\\Lb\x8c\x0b'
b'control_pkt\x94K\x0f\x8c\x08data_pkt\x94K\x10ub.')
"""
*/
sprintf(py_pickle_buf,
"%s|%s|%d|%d|%d|%d|%d|%d|%d|%d|%lu|%lu|%d|%d"
, sm->serv_addr, sm->cli_addr,sm->serv_port,sm->cli_port,
sm->serv_packet_sent, *sm->cli_packet_sent, *sm->cli_packet_recv, sm->serv_packet_recv,
sm->protocol, sm->pps,sm->start_time,sm->end_time,sm->data_pkt,sm->control_pkt
);
// memcpy(py_pickle_buf,(void*)sm->serv_port,strlen(py_pickle_buf));
}
#ifdef lIBTEST
// 140.82.112.3|10.108.32.227|443|50800|12|20|20|12|126|0|1649171618|1649171661|16|15
#include <signal.h>
int main(int argc, char ** argv){
struct spi_members sm;
strcpy(sm.serv_addr, "140.82.112.3");
strcpy(sm.cli_addr,"10.108.32.227");
sm.serv_port = 443;
sm.cli_port = 50800;
sm.serv_packet_sent = 12;
sm.cli_packet_sent = &sm.serv_packet_recv;
sm.serv_packet_recv = 20;
sm.cli_packet_recv = &sm.serv_packet_sent;
sm.protocol = 126; // R_TCP
sm.pps = 0;
sm.start_time = 1649171618;
sm.end_time = 1649171661;
sm.control_pkt = 15;
sm.data_pkt = 16;
unsigned char php_data[512];
sm_to_pypickle(&sm,(unsigned char*)&php_data);
printf("%s\n",php_data);
}
#endif | 35.767677 | 134 | 0.586557 |
6980499ec59b1723b93424be841a36ef724c988f | 637 | c | C | week_8/point.c | nickmyb/c_zju | 0a4f9a81384b68dc8507c8ba55c97fb6ac696f68 | [
"MIT"
] | null | null | null | week_8/point.c | nickmyb/c_zju | 0a4f9a81384b68dc8507c8ba55c97fb6ac696f68 | [
"MIT"
] | null | null | null | week_8/point.c | nickmyb/c_zju | 0a4f9a81384b68dc8507c8ba55c97fb6ac696f68 | [
"MIT"
] | null | null | null | /**
* 数组变量本身表达地址
* int a[10]; int *p = a;
* 数组的单元是变量,需要用&取地址
* a == &a[0]
*
* []可以用于指针, p[0] == a[0]
* *可以对数组做, *a = 25;
*
* 数组变量是const的指针,所以不能被赋值
* int a[] -> int * const a
*
*
* 字符串:
* 以0(整数0)/ '\0'结尾的一串字符, 0 == '\0' != '0'
* str 即 字符数组
*
* char *s = "Hello World!" // "Hello World!"在代码段,只读
* char s[] = "Hello World!"
*
* char *string;
* scanf("%s", string);
* 可能报错,例如未初始化的string指向代码段的地址,只读
*/
#include <stdio.h>
/**
* IN:
* 12345678 12345678
*
* OUT:
* ##12345678##
*
* ???
*/
int main()
{
char a1[8];
char a2[8];
scanf("%s", a1);
scanf("%s", a2);
printf("%s##%s##\n", a1, a2);
} | 14.477273 | 53 | 0.477237 |
11203329070e5ec37723bd9349e1f7e33a15c60a | 584 | h | C | Purchases/RCPromotionalOffer.h | OgrePet/purchases-ios | 0ce5b4f47ad541a5139e8d0d819bd0171f661b30 | [
"MIT"
] | 4 | 2021-01-31T08:20:49.000Z | 2021-03-08T13:15:03.000Z | Purchases/Purchasing/RCPromotionalOffer.h | Timac/purchases-ios | f2b25180ce5b65ec272a5144ed9f61dd135d5cee | [
"MIT"
] | null | null | null | Purchases/Purchasing/RCPromotionalOffer.h | Timac/purchases-ios | f2b25180ce5b65ec272a5144ed9f61dd135d5cee | [
"MIT"
] | 1 | 2021-02-23T12:03:55.000Z | 2021-02-23T12:03:55.000Z | //
// RCPromotionalOffer.h
// Purchases
//
// Created by RevenueCat.
// Copyright © 2019 RevenueCat. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "RCBackend.h"
NS_ASSUME_NONNULL_BEGIN
@interface RCPromotionalOffer : NSObject
@property (nonatomic, readonly) NSString *offerIdentifier;
@property (nonatomic, readonly) NSDecimalNumber *price;
@property (nonatomic, readonly) enum RCPaymentMode paymentMode;
- (instancetype)initWithProductDiscount:(SKProductDiscount *)productDiscount API_AVAILABLE(ios(12.2), macos(10.14.4));
@end
NS_ASSUME_NONNULL_END
| 21.62963 | 118 | 0.777397 |
522b006e4fa0db1d5629c0a338559936e9056e72 | 6,307 | h | C | src/search/TreeWorker.h | AlexKent3141/OnePunchGo | a86caaf421c8122222f72316171702617c519d28 | [
"MIT"
] | 3 | 2018-05-14T12:32:19.000Z | 2021-04-20T23:11:56.000Z | src/search/TreeWorker.h | AlexKent3141/OnePunchGo | a86caaf421c8122222f72316171702617c519d28 | [
"MIT"
] | 1 | 2018-03-30T18:44:49.000Z | 2018-03-31T15:57:49.000Z | src/search/TreeWorker.h | AlexKent3141/OnePunchGo | a86caaf421c8122222f72316171702617c519d28 | [
"MIT"
] | null | null | null | #ifndef __TREE_WORKER_H__
#define __TREE_WORKER_H__
#include "core/Board.h"
#include "Node.h"
#include "Playout/PlayoutPolicy.h"
#include "Selection/SelectionPolicy.h"
#include "core/RandomGenerator.h"
#include <mutex>
#include <thread>
#include "lurien.h"
// This class performs the MCTS algorithm to find the best move.
// It contains the code that is executed by each worker thread.
template<class SP, class PP>
class TreeWorker
{
public:
TreeWorker(const Board& pos, Node* root, uint64_t seed) : _pos(&pos)
{
_root = root;
_gen = std::make_unique<RandomGenerator>(seed);
_sp = std::make_unique<SP>();
_pp = std::make_unique<PP>();
}
// Start a searching thread.
void Start()
{
_stop = false;
std::thread worker([&] { DoSearch(); });
worker.detach();
}
// Stop the currently executing search.
void Stop()
{
_stop = true;
// Block until the mutex is available.
std::unique_lock<std::mutex> lock(_mtx);
}
private:
bool _stop = false;
Node* _root;
std::unique_ptr<SP> _sp;
std::unique_ptr<PP> _pp;
std::unique_ptr<RandomGenerator> _gen;
Board const* _pos;
std::mutex _mtx;
// This method keeps searching until a call to Stop is made.
void DoSearch()
{
LURIEN_SCOPE(search)
std::unique_lock<std::mutex> lock(_mtx);
int boardSize = _pos->Size();
int boardArea = boardSize*boardSize;
Board temp(_pos->Size());
Colour* playerOwned = new Colour[boardArea];
while (!_stop)
{
// Clone the board state.
temp.CloneFrom(*_pos);
// Reset the player ownership map.
memset(playerOwned, None, boardArea*sizeof(Colour));
Node* leaf = SelectNode(temp, playerOwned);
// Perform a playout and record the result.
int res = Simulate(temp, leaf->Stats.LastMove, playerOwned);
// Backpropagate the scores.
UpdateScores(leaf, playerOwned, res);
}
delete[] playerOwned;
}
Node* SelectNode(Board& temp, Colour* playerOwned) const
{
LURIEN_SCOPE(select)
// Find the leaf node which must be expanded.
Node* leaf = Select(temp, _root, playerOwned);
// Expand the leaf node.
leaf = Expand(temp, leaf, playerOwned);
return leaf;
}
// Select a node to expand.
Node* Select(Board& temp, Node* root, Colour* playerOwned) const
{
Node* current = root;
while (current->Stats.Visits >= (int)current->Children.size() && current->HasChildren())
{
std::lock_guard<std::mutex> lk(current->Obj);
current = _sp->Select(current->Children);
current->Stats.VirtualLoss();
const Move& move = current->Stats.LastMove;
temp.MakeMove(move);
// Update the ownership map.
UpdateOwnership(move, playerOwned);
}
return current;
}
// Expand the chosen leaf node.
Node* Expand(Board& temp, Node* leaf, Colour* playerOwned) const
{
LURIEN_SCOPE(expand)
Node* expanded = leaf;
std::lock_guard<std::mutex> lk(expanded->Obj);
if (!expanded->HasChildren())
{
expanded->Moves = temp.GetMoves();
expanded->AddChildren();
if (expanded->HasChildren())
{
// Select the best according to the priors.
expanded = _sp->Select(expanded->Children);
expanded->Stats.VirtualLoss();
const Move& move = expanded->Stats.LastMove;
temp.MakeMove(move);
// Update the ownership map.
UpdateOwnership(move, playerOwned);
}
}
return expanded;
}
// Perform a simulation from the specified game state.
int Simulate(Board& temp, const Move& lastMove, Colour* playerOwned) const
{
LURIEN_SCOPE(simulate)
// Make moves according to the playout policy until a terminal state is reached.
Move move = lastMove;
while ((move = _pp->Select(temp, move)) != BadMove)
{
UpdateOwnership(move, playerOwned);
temp.MakeMove(move);
}
return temp.Score();
}
// Update the ownership map used in RAVE calculations.
void UpdateOwnership(const Move& move, Colour* playerOwned) const
{
int coord = move.Coord;
if (coord != PassCoord && playerOwned[coord] == None)
{
playerOwned[coord] = move.Col;
}
}
// Backpropagate the score from the simulation up the tree.
void UpdateScores(Node* leaf, Colour* playerOwned, int score) const
{
LURIEN_SCOPE(update)
// Backtrack the scores up the tree.
while (leaf != nullptr)
{
std::lock_guard<std::mutex> lk(leaf->Obj);
// RAVE update all children of leaf.
RaveUpdate(leaf, playerOwned, score);
MoveStats& stats = leaf->Stats;
// Reverse the effects of virtual losses.
stats.VirtualWin();
stats.UpdateScore(score);
leaf = leaf->Parent;
}
// Give the root node a visit (some selection policies need this).
_root->Stats.Visits++;
}
// The RAVE update effects all children of this node.
// The ultimate effect is that all siblings of nodes that were traversed during selection phase
// will potentially be updated.
void RaveUpdate(Node* node, Colour* playerOwned, int score) const
{
// Update the node if possible.
if (node != nullptr)
{
for (Node* child : node->Children)
{
// Update this child's stats.
MoveStats& stats = child->Stats;
int coord = stats.LastMove.Coord;
Colour col = stats.LastMove.Col;
if (coord != PassCoord && playerOwned[coord] == col)
{
// This is valid evidence for the node.
stats.UpdateRaveScore(score);
}
}
}
}
};
#endif // __TREE_WORKER_H__
| 28.40991 | 100 | 0.570794 |
fbcba33e70a5bc5260b3326e3a6b8793cc72df79 | 263 | h | C | node_modules/lzz-gyp/lzz-source/gram_FileStatPtr.h | SuperDizor/dizornator | 9f57dbb3f6af80283b4d977612c95190a3d47900 | [
"ISC"
] | 3 | 2019-09-18T16:44:33.000Z | 2021-03-29T13:45:27.000Z | node_modules/lzz-gyp/lzz-source/gram_FileStatPtr.h | SuperDizor/dizornator | 9f57dbb3f6af80283b4d977612c95190a3d47900 | [
"ISC"
] | null | null | null | node_modules/lzz-gyp/lzz-source/gram_FileStatPtr.h | SuperDizor/dizornator | 9f57dbb3f6af80283b4d977612c95190a3d47900 | [
"ISC"
] | 2 | 2019-03-29T01:06:38.000Z | 2019-09-18T16:44:34.000Z | // gram_FileStatPtr.h
//
#ifndef LZZ_gram_FileStatPtr_h
#define LZZ_gram_FileStatPtr_h
#include "util_BPtr.h"
#define LZZ_INLINE inline
namespace gram
{
class FileStat;
}
namespace gram
{
typedef util::BPtr <FileStat> FileStatPtr;
}
#undef LZZ_INLINE
#endif
| 14.611111 | 44 | 0.779468 |
f71e40be667e21577f4fd1889746447c005a3298 | 8,722 | c | C | src/qip/farg.c | dasfaha/sky | 4f2696e9abe54f4818f94337ed3bceae798e5a6d | [
"MIT"
] | 2 | 2018-01-16T07:26:53.000Z | 2021-12-08T03:12:40.000Z | src/qip/farg.c | dasfaha/sky | 4f2696e9abe54f4818f94337ed3bceae798e5a6d | [
"MIT"
] | null | null | null | src/qip/farg.c | dasfaha/sky | 4f2696e9abe54f4818f94337ed3bceae798e5a6d | [
"MIT"
] | null | null | null | #include <stdlib.h>
#include "dbg.h"
#include "node.h"
//==============================================================================
//
// Functions
//
//==============================================================================
//--------------------------------------
// Lifecycle
//--------------------------------------
// Creates an AST node for a function argument declaration.
//
// var_decl - The variable declaration.
//
// Returns a function argument node.
qip_ast_node *qip_ast_farg_create(struct qip_ast_node *var_decl)
{
qip_ast_node *node = malloc(sizeof(qip_ast_node)); check_mem(node);
node->type = QIP_AST_TYPE_FARG;
node->parent = NULL;
node->line_no = node->char_no = 0;
node->generated = false;
node->farg.var_decl = var_decl;
if(var_decl != NULL) var_decl->parent = node;
return node;
error:
qip_ast_node_free(node);
return NULL;
}
// Frees a variable declaration AST node from memory.
//
// node - The AST node to free.
void qip_ast_farg_free(struct qip_ast_node *node)
{
if(node->farg.var_decl) {
qip_ast_node_free(node->farg.var_decl);
}
node->farg.var_decl = NULL;
}
// Copies a node and its children.
//
// node - The node to copy.
// ret - A pointer to where the new copy should be returned to.
//
// Returns 0 if successful, otherwise returns -1.
int qip_ast_farg_copy(qip_ast_node *node, qip_ast_node **ret)
{
int rc;
check(node != NULL, "Node required");
check(ret != NULL, "Return pointer required");
qip_ast_node *clone = qip_ast_farg_create(NULL);
check_mem(clone);
rc = qip_ast_node_copy(node->farg.var_decl, &clone->farg.var_decl);
check(rc == 0, "Unable to copy var decl");
if(clone->farg.var_decl) clone->farg.var_decl->parent = clone;
*ret = clone;
return 0;
error:
qip_ast_node_free(clone);
*ret = NULL;
return -1;
}
//--------------------------------------
// Codegen
//--------------------------------------
// Recursively generates LLVM code for the function argument AST node.
//
// node - The node to generate an LLVM value for.
// module - The compilation unit this node is a part of.
// value - A pointer to where the LLVM value should be returned.
//
// Returns 0 if successful, otherwise returns -1.
int qip_ast_farg_codegen(qip_ast_node *node, qip_module *module,
LLVMValueRef *value)
{
int rc;
check(node != NULL, "Node required");
check(node->type == QIP_AST_TYPE_FARG, "Node type must be 'function argument'");
check(node->farg.var_decl != NULL, "Function argument declaration required");
check(module != NULL, "Module required");
// Delegate LLVM generation to the variable declaration.
rc = qip_ast_node_codegen(node->farg.var_decl, module, value);
check(rc == 0, "Unable to codegen function argument");
return 0;
error:
return -1;
}
//--------------------------------------
// Preprocessor
//--------------------------------------
// Preprocesses the node.
//
// node - The node.
// module - The module that the node is a part of.
// stage - The processing stage.
//
// Returns 0 if successful, otherwise returns -1.
int qip_ast_farg_preprocess(qip_ast_node *node, qip_module *module,
qip_ast_processing_stage_e stage)
{
int rc;
check(node != NULL, "Node required");
check(module != NULL, "Module required");
// Preprocess variable declaration.
rc = qip_ast_node_preprocess(node->farg.var_decl, module, stage);
check(rc == 0, "Unable to preprocess function argument variable declaration");
return 0;
error:
return -1;
}
//--------------------------------------
// Type refs
//--------------------------------------
// Computes a list of type references used by the node.
//
// node - The node.
// type_refs - A pointer to an array of type refs.
// count - A pointer to where the number of type refs is stored.
//
// Returns 0 if successful, otherwise returns -1.
int qip_ast_farg_get_type_refs(qip_ast_node *node,
qip_ast_node ***type_refs,
uint32_t *count)
{
int rc;
check(node != NULL, "Node required");
check(type_refs != NULL, "Type refs return pointer required");
check(count != NULL, "Type ref count return pointer required");
if(node->farg.var_decl != NULL) {
rc = qip_ast_node_get_type_refs(node->farg.var_decl, type_refs, count);
check(rc == 0, "Unable to add function argument type refs");
}
return 0;
error:
qip_ast_node_type_refs_free(type_refs, count);
return -1;
}
// Retrieves all variable reference of a given name within this node.
//
// node - The node.
// name - The variable name.
// array - The array to add the references to.
//
// Returns 0 if successful, otherwise returns -1.
int qip_ast_farg_get_var_refs(qip_ast_node *node, bstring name,
qip_array *array)
{
int rc;
check(node != NULL, "Node required");
check(name != NULL, "Variable name required");
check(array != NULL, "Array required");
if(node->farg.var_decl != NULL) {
rc = qip_ast_node_get_var_refs(node->farg.var_decl, name, array);
check(rc == 0, "Unable to add function argument var refs");
}
return 0;
error:
return -1;
}
// Retrieves all variable reference of a given type name within this node.
//
// node - The node.
// module - The module.
// type_name - The type name.
// array - The array to add the references to.
//
// Returns 0 if successful, otherwise returns -1.
int qip_ast_farg_get_var_refs_by_type(qip_ast_node *node, qip_module *module,
bstring type_name, qip_array *array)
{
int rc;
check(node != NULL, "Node required");
check(module != NULL, "Module required");
check(type_name != NULL, "Type name required");
check(array != NULL, "Array required");
rc = qip_ast_node_get_var_refs_by_type(node->farg.var_decl, module, type_name, array);
check(rc == 0, "Unable to add function argument var refs");
return 0;
error:
return -1;
}
//--------------------------------------
// Dependencies
//--------------------------------------
// Computes a list of class names that this AST node depends on.
//
// node - The node to compute dependencies for.
// dependencies - A pointer to an array of dependencies.
// count - A pointer to where the number of dependencies is stored.
//
// Returns 0 if successful, otherwise returns -1.
int qip_ast_farg_get_dependencies(qip_ast_node *node,
bstring **dependencies,
uint32_t *count)
{
int rc;
check(node != NULL, "Node required");
check(dependencies != NULL, "Dependencies return pointer required");
check(count != NULL, "Dependency count return pointer required");
if(node->farg.var_decl != NULL) {
rc = qip_ast_node_get_dependencies(node->farg.var_decl, dependencies, count);
check(rc == 0, "Unable to add function argument dependencies");
}
return 0;
error:
qip_ast_node_dependencies_free(dependencies, count);
return -1;
}
//--------------------------------------
// Validation
//--------------------------------------
// Validates the AST node.
//
// node - The node to validate.
// module - The module that the node is a part of.
//
// Returns 0 if successful, otherwise returns -1.
int qip_ast_farg_validate(qip_ast_node *node, qip_module *module)
{
int rc;
check(node != NULL, "Node required");
check(module != NULL, "Module required");
// Validate variable declaration.
rc = qip_ast_node_validate(node->farg.var_decl, module);
check(rc == 0, "Unable to validate function argument variable declaration");
return 0;
error:
return -1;
}
//--------------------------------------
// Debugging
//--------------------------------------
// Append the contents of the AST node to the string.
//
// node - The node to dump.
// ret - A pointer to the bstring to concatenate to.
//
// Return 0 if successful, otherwise returns -1.s
int qip_ast_farg_dump(qip_ast_node *node, bstring ret)
{
int rc;
check(node != NULL, "Node required");
check(ret != NULL, "String required");
// Append dump.
check(bcatcstr(ret, "<farg>\n") == BSTR_OK, "Unable to append dump");
// Recursively dump children.
if(node->farg.var_decl != NULL) {
rc = qip_ast_node_dump(node->farg.var_decl, ret);
check(rc == 0, "Unable to dump variable declaration");
}
return 0;
error:
return -1;
}
| 27.77707 | 90 | 0.594588 |
a1ce4e8eeee9c3c4c9d6785aaf60fa553e9fff22 | 3,046 | h | C | robot/install/include/intera_core_msgs/SolvePositionIK.h | satvu/TeachBot | 5888aea544fea952afa36c097a597c5d575c8d6d | [
"BSD-3-Clause"
] | null | null | null | robot/install/include/intera_core_msgs/SolvePositionIK.h | satvu/TeachBot | 5888aea544fea952afa36c097a597c5d575c8d6d | [
"BSD-3-Clause"
] | null | null | null | robot/install/include/intera_core_msgs/SolvePositionIK.h | satvu/TeachBot | 5888aea544fea952afa36c097a597c5d575c8d6d | [
"BSD-3-Clause"
] | null | null | null | // Generated by gencpp from file intera_core_msgs/SolvePositionIK.msg
// DO NOT EDIT!
#ifndef INTERA_CORE_MSGS_MESSAGE_SOLVEPOSITIONIK_H
#define INTERA_CORE_MSGS_MESSAGE_SOLVEPOSITIONIK_H
#include <ros/service_traits.h>
#include <intera_core_msgs/SolvePositionIKRequest.h>
#include <intera_core_msgs/SolvePositionIKResponse.h>
namespace intera_core_msgs
{
struct SolvePositionIK
{
typedef SolvePositionIKRequest Request;
typedef SolvePositionIKResponse Response;
Request request;
Response response;
typedef Request RequestType;
typedef Response ResponseType;
}; // struct SolvePositionIK
} // namespace intera_core_msgs
namespace ros
{
namespace service_traits
{
template<>
struct MD5Sum< ::intera_core_msgs::SolvePositionIK > {
static const char* value()
{
return "7ae4607244c30c6c631f3693cd280e45";
}
static const char* value(const ::intera_core_msgs::SolvePositionIK&) { return value(); }
};
template<>
struct DataType< ::intera_core_msgs::SolvePositionIK > {
static const char* value()
{
return "intera_core_msgs/SolvePositionIK";
}
static const char* value(const ::intera_core_msgs::SolvePositionIK&) { return value(); }
};
// service_traits::MD5Sum< ::intera_core_msgs::SolvePositionIKRequest> should match
// service_traits::MD5Sum< ::intera_core_msgs::SolvePositionIK >
template<>
struct MD5Sum< ::intera_core_msgs::SolvePositionIKRequest>
{
static const char* value()
{
return MD5Sum< ::intera_core_msgs::SolvePositionIK >::value();
}
static const char* value(const ::intera_core_msgs::SolvePositionIKRequest&)
{
return value();
}
};
// service_traits::DataType< ::intera_core_msgs::SolvePositionIKRequest> should match
// service_traits::DataType< ::intera_core_msgs::SolvePositionIK >
template<>
struct DataType< ::intera_core_msgs::SolvePositionIKRequest>
{
static const char* value()
{
return DataType< ::intera_core_msgs::SolvePositionIK >::value();
}
static const char* value(const ::intera_core_msgs::SolvePositionIKRequest&)
{
return value();
}
};
// service_traits::MD5Sum< ::intera_core_msgs::SolvePositionIKResponse> should match
// service_traits::MD5Sum< ::intera_core_msgs::SolvePositionIK >
template<>
struct MD5Sum< ::intera_core_msgs::SolvePositionIKResponse>
{
static const char* value()
{
return MD5Sum< ::intera_core_msgs::SolvePositionIK >::value();
}
static const char* value(const ::intera_core_msgs::SolvePositionIKResponse&)
{
return value();
}
};
// service_traits::DataType< ::intera_core_msgs::SolvePositionIKResponse> should match
// service_traits::DataType< ::intera_core_msgs::SolvePositionIK >
template<>
struct DataType< ::intera_core_msgs::SolvePositionIKResponse>
{
static const char* value()
{
return DataType< ::intera_core_msgs::SolvePositionIK >::value();
}
static const char* value(const ::intera_core_msgs::SolvePositionIKResponse&)
{
return value();
}
};
} // namespace service_traits
} // namespace ros
#endif // INTERA_CORE_MSGS_MESSAGE_SOLVEPOSITIONIK_H
| 24.564516 | 90 | 0.755745 |
74b08e030769c112c6b503b8f812e074104ed83c | 248 | h | C | XDKAirMenu/SecondViewController.h | XavierDK/XDKAirMenu | 436da2eb726ad15621a64fbe1896bc3d828fa8f6 | [
"MIT"
] | 30 | 2015-01-02T20:50:50.000Z | 2016-10-04T18:08:55.000Z | XDKAirMenu/SecondViewController.h | XavierDK/XDKAirMenu | 436da2eb726ad15621a64fbe1896bc3d828fa8f6 | [
"MIT"
] | 2 | 2015-02-25T21:11:48.000Z | 2015-04-01T06:41:01.000Z | XDKAirMenu/SecondViewController.h | XavierDK/XDKAirMenu | 436da2eb726ad15621a64fbe1896bc3d828fa8f6 | [
"MIT"
] | 9 | 2015-01-13T09:30:58.000Z | 2021-04-24T11:49:29.000Z | //
// SecondViewController.h
// XDKAirMenu
//
// Created by Xavier De Koninck on 04/01/2014.
// Copyright (c) 2014 XavierDeKoninck. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface SecondViewController : UITableViewController
@end
| 17.714286 | 60 | 0.729839 |
ddbb88573ef5041a10f623ea9904b72eb3943f32 | 705 | h | C | lib/majmcp4725/majMCP4725.h | mar-rej/BPM19 | 83e67d0c4903e7ad5973c60d5fa255751a8f81e5 | [
"MIT"
] | null | null | null | lib/majmcp4725/majMCP4725.h | mar-rej/BPM19 | 83e67d0c4903e7ad5973c60d5fa255751a8f81e5 | [
"MIT"
] | null | null | null | lib/majmcp4725/majMCP4725.h | mar-rej/BPM19 | 83e67d0c4903e7ad5973c60d5fa255751a8f81e5 | [
"MIT"
] | null | null | null | /*
rej version 0.0.1 -> creation
*/
#ifndef MAJMCP4725_H
#define MAJMCP4725_H
#include "Arduino.h"
#include <Wire.h>
// Définition des commandes et registres
// Commandes
#define FAST_MODE 0x00
#define DAC_MODE 0x40
#define EEPROM_DAC_MODE 0x60
// Power Mode
#define NORM_PWR 0x00
#define ONEK_PWR 0x01
#define HUNK_PWR 0x02
#define FHUK_PWR 0x03
class majMCP4725{
public:
majMCP4725();
void begin(uint8_t a);
void setVoltage(uint16_t output, uint8_t *ret);
void setMode(uint8_t mode);
void setPower(uint8_t power);
uint16_t getVoltage(void);
uint8_t getMode(void);
uint8_t getPower(void);
private:
uint8_t _i2caddr;
uint8_t _mode;
uint8_t _power;
uint16_t _output;
};
#endif
| 17.195122 | 48 | 0.747518 |
1f99f76458a3863ff85dd80573c432fd9aaf511d | 205 | h | C | YLT_Hotfix/Classes/YLT_HotfixManager+NSArray.h | YLTTeam/YLT_Hotfix | b50f76cc926c1f01729ddc13ea034c42aa53e71d | [
"MIT"
] | null | null | null | YLT_Hotfix/Classes/YLT_HotfixManager+NSArray.h | YLTTeam/YLT_Hotfix | b50f76cc926c1f01729ddc13ea034c42aa53e71d | [
"MIT"
] | null | null | null | YLT_Hotfix/Classes/YLT_HotfixManager+NSArray.h | YLTTeam/YLT_Hotfix | b50f76cc926c1f01729ddc13ea034c42aa53e71d | [
"MIT"
] | null | null | null | //
// YLT_HotfixManager+NSArray.h
// Aspects
//
// Created by 项普华 on 2018/7/11.
//
#import "YLT_HotfixManager.h"
@interface YLT_HotfixManager (NSArray)
- (void)setupArray:(JSContext *)context;
@end
| 13.666667 | 40 | 0.697561 |
1c62f3d34787b480aa8a1e7e973b0ba0776bee92 | 12,991 | c | C | win/tty/topl.c | Bam4d/BrowserHack | 1a7de3a7db8ff88aaeb4a8277739586251db04e5 | [
"CC-BY-3.0"
] | 318 | 2015-04-08T17:21:29.000Z | 2022-03-24T21:16:43.000Z | win/tty/topl.c | schwabse/BrowserHack | 1a7de3a7db8ff88aaeb4a8277739586251db04e5 | [
"CC-BY-3.0"
] | 21 | 2015-04-12T18:27:16.000Z | 2021-11-15T07:02:27.000Z | win/tty/topl.c | schwabse/BrowserHack | 1a7de3a7db8ff88aaeb4a8277739586251db04e5 | [
"CC-BY-3.0"
] | 51 | 2015-04-08T17:59:07.000Z | 2022-02-24T10:10:30.000Z | /* SCCS Id: @(#)topl.c 3.4 1996/10/24 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
#include "hack.h"
#ifdef TTY_GRAPHICS
#include "tcap.h"
#include "wintty.h"
#include <ctype.h>
#ifndef C /* this matches src/cmd.c */
#define C(c) (0x1f & (c))
#endif
STATIC_DCL void FDECL(redotoplin, (const char*));
STATIC_DCL void FDECL(topl_putsym, (CHAR_P));
STATIC_DCL void NDECL(remember_topl);
STATIC_DCL void FDECL(removetopl, (int));
#ifdef OVLB
int
tty_doprev_message()
{
register struct WinDesc *cw = wins[WIN_MESSAGE];
winid prevmsg_win;
int i;
if ((iflags.prevmsg_window != 's') && !ttyDisplay->inread) { /* not single */
if(iflags.prevmsg_window == 'f') { /* full */
prevmsg_win = create_nhwindow(NHW_MENU);
putstr(prevmsg_win, 0, "Message History");
putstr(prevmsg_win, 0, "");
cw->maxcol = cw->maxrow;
i = cw->maxcol;
do {
if(cw->data[i] && strcmp(cw->data[i], "") )
putstr(prevmsg_win, 0, cw->data[i]);
i = (i + 1) % cw->rows;
} while (i != cw->maxcol);
putstr(prevmsg_win, 0, toplines);
display_nhwindow(prevmsg_win, TRUE);
destroy_nhwindow(prevmsg_win);
} else if (iflags.prevmsg_window == 'c') { /* combination */
do {
morc = 0;
if (cw->maxcol == cw->maxrow) {
ttyDisplay->dismiss_more = C('p'); /* <ctrl/P> allowed at --More-- */
redotoplin(toplines);
cw->maxcol--;
if (cw->maxcol < 0) cw->maxcol = cw->rows-1;
if (!cw->data[cw->maxcol])
cw->maxcol = cw->maxrow;
} else if (cw->maxcol == (cw->maxrow - 1)){
ttyDisplay->dismiss_more = C('p'); /* <ctrl/P> allowed at --More-- */
redotoplin(cw->data[cw->maxcol]);
cw->maxcol--;
if (cw->maxcol < 0) cw->maxcol = cw->rows-1;
if (!cw->data[cw->maxcol])
cw->maxcol = cw->maxrow;
} else {
prevmsg_win = create_nhwindow(NHW_MENU);
putstr(prevmsg_win, 0, "Message History");
putstr(prevmsg_win, 0, "");
cw->maxcol = cw->maxrow;
i = cw->maxcol;
do {
if(cw->data[i] && strcmp(cw->data[i], "") )
putstr(prevmsg_win, 0, cw->data[i]);
i = (i + 1) % cw->rows;
} while (i != cw->maxcol);
putstr(prevmsg_win, 0, toplines);
display_nhwindow(prevmsg_win, TRUE);
destroy_nhwindow(prevmsg_win);
}
} while (morc == C('p'));
ttyDisplay->dismiss_more = 0;
} else { /* reversed */
morc = 0;
prevmsg_win = create_nhwindow(NHW_MENU);
putstr(prevmsg_win, 0, "Message History");
putstr(prevmsg_win, 0, "");
putstr(prevmsg_win, 0, toplines);
cw->maxcol=cw->maxrow-1;
if(cw->maxcol < 0) cw->maxcol = cw->rows-1;
do {
putstr(prevmsg_win, 0, cw->data[cw->maxcol]);
cw->maxcol--;
if (cw->maxcol < 0) cw->maxcol = cw->rows-1;
if (!cw->data[cw->maxcol])
cw->maxcol = cw->maxrow;
} while (cw->maxcol != cw->maxrow);
display_nhwindow(prevmsg_win, TRUE);
destroy_nhwindow(prevmsg_win);
cw->maxcol = cw->maxrow;
ttyDisplay->dismiss_more = 0;
}
} else if(iflags.prevmsg_window == 's') { /* single */
ttyDisplay->dismiss_more = C('p'); /* <ctrl/P> allowed at --More-- */
do {
morc = 0;
if (cw->maxcol == cw->maxrow)
redotoplin(toplines);
else if (cw->data[cw->maxcol])
redotoplin(cw->data[cw->maxcol]);
cw->maxcol--;
if (cw->maxcol < 0) cw->maxcol = cw->rows-1;
if (!cw->data[cw->maxcol])
cw->maxcol = cw->maxrow;
} while (morc == C('p'));
ttyDisplay->dismiss_more = 0;
}
return 0;
}
#endif /* OVLB */
#ifdef OVL1
STATIC_OVL void
redotoplin(str)
const char *str;
{
int otoplin = ttyDisplay->toplin;
home();
if(*str & 0x80) {
/* kludge for the / command, the only time we ever want a */
/* graphics character on the top line */
g_putch((int)*str++);
ttyDisplay->curx++;
}
end_glyphout(); /* in case message printed during graphics output */
putsyms(str);
cl_end();
ttyDisplay->toplin = 1;
if(ttyDisplay->cury && otoplin != 3)
more();
}
STATIC_OVL void
remember_topl()
{
register struct WinDesc *cw = wins[WIN_MESSAGE];
int idx = cw->maxrow;
unsigned len = strlen(toplines) + 1;
if (len > (unsigned)cw->datlen[idx]) {
if (cw->data[idx]) free(cw->data[idx]);
len += (8 - (len & 7)); /* pad up to next multiple of 8 */
cw->data[idx] = (char *)alloc(len);
cw->datlen[idx] = (short)len;
}
Strcpy(cw->data[idx], toplines);
cw->maxcol = cw->maxrow = (idx + 1) % cw->rows;
}
void
addtopl(s)
const char *s;
{
register struct WinDesc *cw = wins[WIN_MESSAGE];
tty_curs(BASE_WINDOW,cw->curx+1,cw->cury);
putsyms(s);
cl_end();
ttyDisplay->toplin = 1;
}
#endif /* OVL1 */
#ifdef OVL2
void
more()
{
struct WinDesc *cw = wins[WIN_MESSAGE];
/* avoid recursion -- only happens from interrupts */
if(ttyDisplay->inmore++)
return;
if(ttyDisplay->toplin) {
tty_curs(BASE_WINDOW, cw->curx+1, cw->cury);
if(cw->curx >= CO - 8) topl_putsym('\n');
}
if(flags.standout)
standoutbeg();
putsyms(defmorestr);
if(flags.standout)
standoutend();
xwaitforspace("\033 ");
if(morc == '\033')
cw->flags |= WIN_STOP;
if(ttyDisplay->toplin && cw->cury) {
docorner(1, cw->cury+1);
cw->curx = cw->cury = 0;
home();
} else if(morc == '\033') {
cw->curx = cw->cury = 0;
home();
cl_end();
}
ttyDisplay->toplin = 0;
ttyDisplay->inmore = 0;
}
void
update_topl(bp)
register const char *bp;
{
register char *tl, *otl;
register int n0;
int notdied = 1;
struct WinDesc *cw = wins[WIN_MESSAGE];
/* If there is room on the line, print message on same line */
/* But messages like "You die..." deserve their own line */
n0 = strlen(bp);
if ((ttyDisplay->toplin == 1 || (cw->flags & WIN_STOP)) &&
cw->cury == 0 &&
n0 + (int)strlen(toplines) + 3 < CO-8 && /* room for --More-- */
(notdied = strncmp(bp, "You die", 7))) {
Strcat(toplines, " ");
Strcat(toplines, bp);
cw->curx += 2;
if(!(cw->flags & WIN_STOP))
addtopl(bp);
return;
} else if (!(cw->flags & WIN_STOP)) {
if(ttyDisplay->toplin == 1) more();
else if(cw->cury) { /* for when flags.toplin == 2 && cury > 1 */
docorner(1, cw->cury+1); /* reset cury = 0 if redraw screen */
cw->curx = cw->cury = 0;/* from home--cls() & docorner(1,n) */
}
}
remember_topl();
(void) strncpy(toplines, bp, TBUFSZ);
toplines[TBUFSZ - 1] = 0;
for(tl = toplines; n0 >= CO; ){
otl = tl;
for(tl+=CO-1; tl != otl && !isspace(*tl); --tl) ;
if(tl == otl) {
/* Eek! A huge token. Try splitting after it. */
tl = index(otl, ' ');
if (!tl) break; /* No choice but to spit it out whole. */
}
*tl++ = '\n';
n0 = strlen(tl);
}
if(!notdied) cw->flags &= ~WIN_STOP;
if(!(cw->flags & WIN_STOP)) redotoplin(toplines);
}
STATIC_OVL
void
topl_putsym(c)
char c;
{
register struct WinDesc *cw = wins[WIN_MESSAGE];
if(cw == (struct WinDesc *) 0) panic("Putsym window MESSAGE nonexistant");
switch(c) {
case '\b':
if(ttyDisplay->curx == 0 && ttyDisplay->cury > 0)
tty_curs(BASE_WINDOW, CO, (int)ttyDisplay->cury-1);
backsp();
ttyDisplay->curx--;
cw->curx = ttyDisplay->curx;
return;
case '\n':
cl_end();
ttyDisplay->curx = 0;
ttyDisplay->cury++;
cw->cury = ttyDisplay->cury;
#ifdef WIN32CON
(void) putchar(c);
#endif
break;
default:
if(ttyDisplay->curx == CO-1)
topl_putsym('\n'); /* 1 <= curx <= CO; avoid CO */
#ifdef WIN32CON
(void) putchar(c);
#endif
ttyDisplay->curx++;
}
cw->curx = ttyDisplay->curx;
if(cw->curx == 0) cl_end();
#ifndef WIN32CON
(void) putchar(c);
#endif
}
void
putsyms(str)
const char *str;
{
while(*str)
topl_putsym(*str++);
}
STATIC_OVL void
removetopl(n)
register int n;
{
/* assume addtopl() has been done, so ttyDisplay->toplin is already set */
while (n-- > 0) putsyms("\b \b");
}
extern char erase_char; /* from xxxtty.c; don't need kill_char */
char
tty_yn_function(query,resp, def)
const char *query,*resp;
char def;
/*
* Generic yes/no function. 'def' is the default (returned by space or
* return; 'esc' returns 'q', or 'n', or the default, depending on
* what's in the string. The 'query' string is printed before the user
* is asked about the string.
* If resp is NULL, any single character is accepted and returned.
* If not-NULL, only characters in it are allowed (exceptions: the
* quitchars are always allowed, and if it contains '#' then digits
* are allowed); if it includes an <esc>, anything beyond that won't
* be shown in the prompt to the user but will be acceptable as input.
*/
{
register char q;
char rtmp[40];
boolean digit_ok, allow_num;
struct WinDesc *cw = wins[WIN_MESSAGE];
boolean doprev = 0;
char prompt[QBUFSZ];
if(ttyDisplay->toplin == 1 && !(cw->flags & WIN_STOP)) more();
cw->flags &= ~WIN_STOP;
ttyDisplay->toplin = 3; /* special prompt state */
ttyDisplay->inread++;
if (resp) {
char *rb, respbuf[QBUFSZ];
allow_num = (index(resp, '#') != 0);
Strcpy(respbuf, resp);
/* any acceptable responses that follow <esc> aren't displayed */
if ((rb = index(respbuf, '\033')) != 0) *rb = '\0';
Sprintf(prompt, "%s [%s] ", query, respbuf);
if (def) Sprintf(eos(prompt), "(%c) ", def);
pline("%s", prompt);
} else {
pline("%s ", query);
q = readchar();
goto clean_up;
}
do { /* loop until we get valid input */
q = lowc(readchar());
if (q == '\020') { /* ctrl-P */
if (iflags.prevmsg_window != 's') {
int sav = ttyDisplay->inread;
ttyDisplay->inread = 0;
(void) tty_doprev_message();
ttyDisplay->inread = sav;
tty_clear_nhwindow(WIN_MESSAGE);
cw->maxcol = cw->maxrow;
addtopl(prompt);
} else {
if(!doprev)
(void) tty_doprev_message(); /* need two initially */
(void) tty_doprev_message();
doprev = 1;
}
q = '\0'; /* force another loop iteration */
continue;
} else if (doprev) {
/* BUG[?]: this probably ought to check whether the
character which has just been read is an acceptable
response; if so, skip the reprompt and use it. */
tty_clear_nhwindow(WIN_MESSAGE);
cw->maxcol = cw->maxrow;
doprev = 0;
addtopl(prompt);
q = '\0'; /* force another loop iteration */
continue;
}
digit_ok = allow_num && digit(q);
if (q == '\033') {
if (index(resp, 'q'))
q = 'q';
else if (index(resp, 'n'))
q = 'n';
else
q = def;
break;
} else if (index(quitchars, q)) {
q = def;
break;
}
if (!index(resp, q) && !digit_ok) {
tty_nhbell();
q = (char)0;
} else if (q == '#' || digit_ok) {
char z, digit_string[2];
int n_len = 0;
long value = 0;
addtopl("#"), n_len++;
digit_string[1] = '\0';
if (q != '#') {
digit_string[0] = q;
addtopl(digit_string), n_len++;
value = q - '0';
q = '#';
}
do { /* loop until we get a non-digit */
z = lowc(readchar());
if (digit(z)) {
value = (10 * value) + (z - '0');
if (value < 0) break; /* overflow: try again */
digit_string[0] = z;
addtopl(digit_string), n_len++;
} else if (z == 'y' || index(quitchars, z)) {
if (z == '\033') value = -1; /* abort */
z = '\n'; /* break */
} else if (z == erase_char || z == '\b') {
if (n_len <= 1) { value = -1; break; }
else { value /= 10; removetopl(1), n_len--; }
} else {
value = -1; /* abort */
tty_nhbell();
break;
}
} while (z != '\n');
if (value > 0) yn_number = value;
else if (value == 0) q = 'n'; /* 0 => "no" */
else { /* remove number from top line, then try again */
removetopl(n_len), n_len = 0;
q = '\0';
}
}
} while(!q);
if (q != '#') {
Sprintf(rtmp, "%c", q);
addtopl(rtmp);
}
clean_up:
ttyDisplay->inread--;
ttyDisplay->toplin = 2;
if (ttyDisplay->intr) ttyDisplay->intr--;
if(wins[WIN_MESSAGE]->cury)
tty_clear_nhwindow(WIN_MESSAGE);
return q;
}
#endif /* OVL2 */
#endif /* TTY_GRAPHICS */
/*topl.c*/
| 27.758547 | 89 | 0.541452 |
e3799dc350eeb674e2dd1f7e08eca005327945b0 | 2,990 | c | C | src/biopack/psglib/rna_HPcosyHCP.c | DanIverson/OpenVnmrJ | 0db324603dbd8f618a6a9526b9477a999c5a4cc3 | [
"Apache-2.0"
] | 32 | 2016-06-17T05:04:26.000Z | 2022-03-28T17:54:44.000Z | src/biopack/psglib/rna_HPcosyHCP.c | DanIverson/OpenVnmrJ | 0db324603dbd8f618a6a9526b9477a999c5a4cc3 | [
"Apache-2.0"
] | 128 | 2016-07-13T17:09:02.000Z | 2022-03-28T17:53:52.000Z | src/biopack/psglib/rna_HPcosyHCP.c | DanIverson/OpenVnmrJ | 0db324603dbd8f618a6a9526b9477a999c5a4cc3 | [
"Apache-2.0"
] | 102 | 2016-01-23T15:27:16.000Z | 2022-03-20T05:41:54.000Z | /*
* Copyright (C) 2015 University of Oregon
*
* You may distribute under the terms of either the GNU General Public
* License or the Apache License, as specified in the LICENSE file.
*
* For more information, see the LICENSE file.
*/
/* rna_HPcosyHCP - heteronuclear COSY with proton observe
H1 - BB - - 90 - Acq.
X d1 - 90 - t1 - 90
EBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEB
EB EB
EB For qualitative measurement of torsion angles beta and epsilon EB
EB Use with HCP for analysis. EB
EB EB
EBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEBEB
pwPlvl - X pulse power level
pwP - X 90 deg pulse
hdpwr - proton BB decoupling (during d1 using obs channel) power
hdres - tip-angle resolution for the hdshape
hd90 - 90 pulse width at hdpwr for BB decoupling
hdshape - decoupling modulation shape
hdflg - 'y' for decoupling
'n' no decoupling
phase - 1,2 (only hypercomplex with FAD is supported)
sspul - HS-pw90-HS before d1
Modified for RnaPack by Peter Lukavsky, June 2002, Stanford
Use with D2O-sample!!
*/
#include <standard.h>
void pulsesequence()
{
double pwPlvl,
pwP,
hdpwr,
hdres,
hd90,
phase;
char hdshape[MAXSTR],
sspul[MAXSTR],
hdflg[MAXSTR];
int iphase;
pwPlvl = getval("pwPlvl");
pwP = getval("pwP");
hdpwr = getval("hdpwr");
hd90 = getval("hd90");
hdres = getval("hdres");
phase = getval("phase");
getstr("hdshape",hdshape);
getstr("hdflg",hdflg);
getstr("sspul",sspul);
iphase = (int)(phase + 0.5);
hlv(ct,v1); /* v1 = 0 0 1 1 2 2 3 3 */
mod4(ct,v1);
mod2(ct,v2); /* v2 = 0 1 0 1 0 1 0 1 */
dbl(v2,v2); /* v2 = 0 2 0 2 0 2 0 2 */
add(v2,v1,v2); /* v2 = 0 2 1 3 2 0 3 1 */
assign(v2,oph);
initval(2.0*(double)(((int)(d2*getval("sw1")+0.5)%2)),v14);
if (iphase == 2)
incr(v2);
add(v2,v14,v2);
add(oph,v14,oph);
status(A);
dec2power(pwPlvl);
obspower(tpwr);
if (sspul[0] == 'y')
{ hsdelay(hst);
rgpulse(pw,v1,rof1,rof2);
hsdelay(hst+.001);
}
if (hdflg[0] == 'y')
{ obspower(hdpwr);
delay(0.5);
rcvroff();
obsprgon(hdshape,hd90,hdres);
xmtron();
delay(d1);
xmtroff();
obsprgoff();
obspower(tpwr);
delay(0.05);
rcvron();
}
else
delay(d1);
rcvroff();
dec2phase(v2);
status(B);
dec2rgpulse(pwP,v2,rof1,1e-6);
if (d2 > 0.0)
delay(d2 - 2e-6 - (4*pwP/3.1416));
else
delay(d2);
sim3pulse(pw,0.0,pwP,v1,zero,v1,1e-6,rof2);
status(C);
rcvron();
}
| 23.359375 | 75 | 0.533445 |
2d6a590f08a2e41b29013ba89fd599874c03c5cf | 927 | h | C | include/hoist/hoist.h | hostilefork/hoist | cbe31715beb93eeebf7d2e3587fc7fb51853b512 | [
"BSL-1.0"
] | 3 | 2015-10-31T10:18:32.000Z | 2019-08-30T08:47:19.000Z | include/hoist/hoist.h | hostilefork/hoist | cbe31715beb93eeebf7d2e3587fc7fb51853b512 | [
"BSL-1.0"
] | null | null | null | include/hoist/hoist.h | hostilefork/hoist | cbe31715beb93eeebf7d2e3587fc7fb51853b512 | [
"BSL-1.0"
] | null | null | null | //
// hoist.h - A single include which does a #include for all the hoist
// library classes, provided as a convenience. You may also
// include them individually, though some depend on others.
//
// Copyright (c) 2009-2014 HostileFork.com
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://hostilefork.com/hoist/ for documentation.
//
#ifndef HOIST_HOIST_H
#define HOIST_HOIST_H
#include "codeplace.h"
#include "hopefully.h"
#include "tracked.h"
#include "stacked.h"
#include "listed.h"
#include "mapped.h"
#include "cast_hopefully.h"
#include "chronicle.h"
// we moc this file, though whether there are any QObjects or not may vary
// this dummy object suppresses the warning "No relevant classes found" w/moc
class HOIST_no_moc_warning : public QObject { Q_OBJECT };
#endif
| 29.903226 | 77 | 0.727077 |
31d5991c23ba53df1cc48e2c2b3d8ff2478aebfb | 795 | h | C | labs/4/Flappy Bird - Part 2/Flappy Bird/Renderer.h | triffon/oop-2019-20 | db199631d59ddefdcc0c8eb3d689de0095618f92 | [
"MIT"
] | 19 | 2020-02-21T16:46:50.000Z | 2022-01-26T19:59:49.000Z | labs/4/Flappy Bird - Part 2/Flappy Bird/Renderer.h | triffon/oop-2019-20 | db199631d59ddefdcc0c8eb3d689de0095618f92 | [
"MIT"
] | 1 | 2020-03-14T08:09:45.000Z | 2020-03-14T08:09:45.000Z | labs/4/Flappy Bird - Part 2/Flappy Bird/Renderer.h | triffon/oop-2019-20 | db199631d59ddefdcc0c8eb3d689de0095618f92 | [
"MIT"
] | 11 | 2020-02-23T12:29:58.000Z | 2021-04-11T08:30:12.000Z | #pragma once
#include <string>
#include "Util.h"
struct SDL_Window;
struct SDL_Renderer;
struct SDL_Texture;
struct SDL_Rect;
class Model;
class Renderer
{
SDL_Window* window;
SDL_Renderer* renderer;
Vec2D offset;
Vec2D scale;
Vec2D resolution;
public:
Renderer() : offset({ 0,0 }), resolution({1280, 768}), scale({ 1,1 }) {}
SDL_Texture* createTexture(const std::string& path);
void init();
void createWindow();
void clear();
void present();
void renderTexture(SDL_Texture* tex, SDL_Rect& dst);
void renderModel(Model* model);
void drawRect(const SDL_Rect& rect);
void setOffset(const Vec2D& offset) { this->offset = offset; }
void setScale(const Vec2D& scale) { this->scale = scale; }
Vec2D getOffset() { return offset; }
Vec2D getResolution() { return resolution; }
};
| 22.083333 | 73 | 0.715723 |
ee0fd02fae79045ae89ab8717098ef577002d577 | 338 | h | C | CustomSpinner/LCHProgressBeadLayer.h | jeevangs/CustomHUDProgressView | 15f2ca702c1f147b63324137291b26388936298f | [
"MIT"
] | null | null | null | CustomSpinner/LCHProgressBeadLayer.h | jeevangs/CustomHUDProgressView | 15f2ca702c1f147b63324137291b26388936298f | [
"MIT"
] | null | null | null | CustomSpinner/LCHProgressBeadLayer.h | jeevangs/CustomHUDProgressView | 15f2ca702c1f147b63324137291b26388936298f | [
"MIT"
] | null | null | null | //
// LCHProgressBeadLayer.h
// CustomSpinner
//
// Created by Geddam Subramanyam, Jeevan Kumar on 1/19/16.
// Copyright © 2016 Honeywell. All rights reserved.
//
#import <QuartzCore/QuartzCore.h>
#import <UIKit/UIKit.h>
@interface LCHProgressBeadLayer : CALayer
- (id)initWithFrame:(CGRect)frame WithColor:(UIColor *)color;
@end
| 19.882353 | 61 | 0.730769 |
ee1aa59ac73d86e96a1c753a0272a3aa5f4a2c7c | 5,923 | h | C | cpp/gte/GteMatrix4x4.h | valentjn/thesis | 65a0eb7d5f7488aac93882959e81ac6b115a9ea8 | [
"CC0-1.0"
] | 4 | 2022-01-15T19:50:36.000Z | 2022-01-15T20:16:10.000Z | cpp/gte/GteMatrix4x4.h | valentjn/thesis | 65a0eb7d5f7488aac93882959e81ac6b115a9ea8 | [
"CC0-1.0"
] | null | null | null | cpp/gte/GteMatrix4x4.h | valentjn/thesis | 65a0eb7d5f7488aac93882959e81ac6b115a9ea8 | [
"CC0-1.0"
] | null | null | null | // Geometric Tools LLC, Redmond WA 98052
// Copyright (c) 1998-2015
// Distributed under the Boost Software License, Version 1.0.
// http://www.boost.org/LICENSE_1_0.txt
// http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
// File Version: 1.0.2 (2014/12/13)
#pragma once
#include <gte/GteMatrix.h>
#include <gte/GteVector4.h>
namespace gte
{
// Template alias for convenience.
template <typename Real>
using Matrix4x4 = Matrix<4, 4, Real>;
// Geometric operations.
template <typename Real>
Matrix4x4<Real> Inverse(Matrix4x4<Real> const& M,
bool* reportInvertibility = nullptr);
template <typename Real>
Matrix4x4<Real> Adjoint(Matrix4x4<Real> const& M);
template <typename Real>
Real Determinant(Matrix4x4<Real> const& M);
template <typename Real>
Real Trace(Matrix4x4<Real> const& M);
//----------------------------------------------------------------------------
template <typename Real>
Matrix4x4<Real> Inverse(Matrix4x4<Real> const& M, bool* reportInvertibility)
{
Matrix4x4<Real> inverse;
bool invertible;
Real a0 = M(0, 0)*M(1, 1) - M(0, 1)*M(1, 0);
Real a1 = M(0, 0)*M(1, 2) - M(0, 2)*M(1, 0);
Real a2 = M(0, 0)*M(1, 3) - M(0, 3)*M(1, 0);
Real a3 = M(0, 1)*M(1, 2) - M(0, 2)*M(1, 1);
Real a4 = M(0, 1)*M(1, 3) - M(0, 3)*M(1, 1);
Real a5 = M(0, 2)*M(1, 3) - M(0, 3)*M(1, 2);
Real b0 = M(2, 0)*M(3, 1) - M(2, 1)*M(3, 0);
Real b1 = M(2, 0)*M(3, 2) - M(2, 2)*M(3, 0);
Real b2 = M(2, 0)*M(3, 3) - M(2, 3)*M(3, 0);
Real b3 = M(2, 1)*M(3, 2) - M(2, 2)*M(3, 1);
Real b4 = M(2, 1)*M(3, 3) - M(2, 3)*M(3, 1);
Real b5 = M(2, 2)*M(3, 3) - M(2, 3)*M(3, 2);
Real det = a0*b5 - a1*b4 + a2*b3 + a3*b2 - a4*b1 + a5*b0;
if (det != (Real)0)
{
Real invDet = ((Real)1) / det;
inverse = Matrix4x4<Real>
{
(+M(1, 1)*b5 - M(1, 2)*b4 + M(1, 3)*b3)*invDet,
(-M(0, 1)*b5 + M(0, 2)*b4 - M(0, 3)*b3)*invDet,
(+M(3, 1)*a5 - M(3, 2)*a4 + M(3, 3)*a3)*invDet,
(-M(2, 1)*a5 + M(2, 2)*a4 - M(2, 3)*a3)*invDet,
(-M(1, 0)*b5 + M(1, 2)*b2 - M(1, 3)*b1)*invDet,
(+M(0, 0)*b5 - M(0, 2)*b2 + M(0, 3)*b1)*invDet,
(-M(3, 0)*a5 + M(3, 2)*a2 - M(3, 3)*a1)*invDet,
(+M(2, 0)*a5 - M(2, 2)*a2 + M(2, 3)*a1)*invDet,
(+M(1, 0)*b4 - M(1, 1)*b2 + M(1, 3)*b0)*invDet,
(-M(0, 0)*b4 + M(0, 1)*b2 - M(0, 3)*b0)*invDet,
(+M(3, 0)*a4 - M(3, 1)*a2 + M(3, 3)*a0)*invDet,
(-M(2, 0)*a4 + M(2, 1)*a2 - M(2, 3)*a0)*invDet,
(-M(1, 0)*b3 + M(1, 1)*b1 - M(1, 2)*b0)*invDet,
(+M(0, 0)*b3 - M(0, 1)*b1 + M(0, 2)*b0)*invDet,
(-M(3, 0)*a3 + M(3, 1)*a1 - M(3, 2)*a0)*invDet,
(+M(2, 0)*a3 - M(2, 1)*a1 + M(2, 2)*a0)*invDet
};
invertible = true;
}
else
{
inverse.MakeZero();
invertible = false;
}
if (reportInvertibility)
{
*reportInvertibility = invertible;
}
return inverse;
}
//----------------------------------------------------------------------------
template <typename Real>
Matrix4x4<Real> Adjoint(Matrix4x4<Real> const& M)
{
Real a0 = M(0, 0)*M(1, 1) - M(0, 1)*M(1, 0);
Real a1 = M(0, 0)*M(1, 2) - M(0, 2)*M(1, 0);
Real a2 = M(0, 0)*M(1, 3) - M(0, 3)*M(1, 0);
Real a3 = M(0, 1)*M(1, 2) - M(0, 2)*M(1, 1);
Real a4 = M(0, 1)*M(1, 3) - M(0, 3)*M(1, 1);
Real a5 = M(0, 2)*M(1, 3) - M(0, 3)*M(1, 2);
Real b0 = M(2, 0)*M(3, 1) - M(2, 1)*M(3, 0);
Real b1 = M(2, 0)*M(3, 2) - M(2, 2)*M(3, 0);
Real b2 = M(2, 0)*M(3, 3) - M(2, 3)*M(3, 0);
Real b3 = M(2, 1)*M(3, 2) - M(2, 2)*M(3, 1);
Real b4 = M(2, 1)*M(3, 3) - M(2, 3)*M(3, 1);
Real b5 = M(2, 2)*M(3, 3) - M(2, 3)*M(3, 2);
return Matrix4x4<Real>
{
+M(1, 1)*b5 - M(1, 2)*b4 + M(1, 3)*b3,
-M(0, 1)*b5 + M(0, 2)*b4 - M(0, 3)*b3,
+M(3, 1)*a5 - M(3, 2)*a4 + M(3, 3)*a3,
-M(2, 1)*a5 + M(2, 2)*a4 - M(2, 3)*a3,
-M(1, 0)*b5 + M(1, 2)*b2 - M(1, 3)*b1,
+M(0, 0)*b5 - M(0, 2)*b2 + M(0, 3)*b1,
-M(3, 0)*a5 + M(3, 2)*a2 - M(3, 3)*a1,
+M(2, 0)*a5 - M(2, 2)*a2 + M(2, 3)*a1,
+M(1, 0)*b4 - M(1, 1)*b2 + M(1, 3)*b0,
-M(0, 0)*b4 + M(0, 1)*b2 - M(0, 3)*b0,
+M(3, 0)*a4 - M(3, 1)*a2 + M(3, 3)*a0,
-M(2, 0)*a4 + M(2, 1)*a2 - M(2, 3)*a0,
-M(1, 0)*b3 + M(1, 1)*b1 - M(1, 2)*b0,
+M(0, 0)*b3 - M(0, 1)*b1 + M(0, 2)*b0,
-M(3, 0)*a3 + M(3, 1)*a1 - M(3, 2)*a0,
+M(2, 0)*a3 - M(2, 1)*a1 + M(2, 2)*a0
};
}
//----------------------------------------------------------------------------
template <typename Real>
Real Determinant(Matrix4x4<Real> const& M)
{
Real a0 = M(0, 0)*M(1, 1) - M(0, 1)*M(1, 0);
Real a1 = M(0, 0)*M(1, 2) - M(0, 2)*M(1, 0);
Real a2 = M(0, 0)*M(1, 3) - M(0, 3)*M(1, 0);
Real a3 = M(0, 1)*M(1, 2) - M(0, 2)*M(1, 1);
Real a4 = M(0, 1)*M(1, 3) - M(0, 3)*M(1, 1);
Real a5 = M(0, 2)*M(1, 3) - M(0, 3)*M(1, 2);
Real b0 = M(2, 0)*M(3, 1) - M(2, 1)*M(3, 0);
Real b1 = M(2, 0)*M(3, 2) - M(2, 2)*M(3, 0);
Real b2 = M(2, 0)*M(3, 3) - M(2, 3)*M(3, 0);
Real b3 = M(2, 1)*M(3, 2) - M(2, 2)*M(3, 1);
Real b4 = M(2, 1)*M(3, 3) - M(2, 3)*M(3, 1);
Real b5 = M(2, 2)*M(3, 3) - M(2, 3)*M(3, 2);
Real det = a0*b5 - a1*b4 + a2*b3 + a3*b2 - a4*b1 + a5*b0;
return det;
}
//----------------------------------------------------------------------------
template <typename Real>
Real Trace(Matrix4x4<Real> const& M)
{
Real trace = M(0, 0) + M(1, 1) + M(2, 2) + M(3, 3);
return trace;
}
//----------------------------------------------------------------------------
}
| 38.212903 | 79 | 0.402668 |
10600b9ad352287f6b8f40f108afa27ecef019ff | 5,402 | h | C | blades/xbmc/xbmc/cores/VideoRenderers/VideoShaders/YUV2RGBShader.h | krattai/AEBL | a7b12c97479e1236d5370166b15ca9f29d7d4265 | [
"BSD-2-Clause"
] | 4 | 2016-04-26T03:43:54.000Z | 2016-11-17T08:09:04.000Z | blades/xbmc/xbmc/cores/VideoRenderers/VideoShaders/YUV2RGBShader.h | krattai/AEBL | a7b12c97479e1236d5370166b15ca9f29d7d4265 | [
"BSD-2-Clause"
] | 17 | 2015-01-05T21:06:22.000Z | 2015-12-07T20:45:44.000Z | blades/xbmc/xbmc/cores/VideoRenderers/VideoShaders/YUV2RGBShader.h | krattai/AEBL | a7b12c97479e1236d5370166b15ca9f29d7d4265 | [
"BSD-2-Clause"
] | 3 | 2016-04-26T03:43:55.000Z | 2020-11-06T11:02:08.000Z | #ifndef __YUV2RGB_SHADERS_H__
#define __YUV2RGB_SHADERS_H__
/*
* Copyright (C) 2007-2013 Team XBMC
* http://xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
#include "guilib/TransformMatrix.h"
#include "cores/VideoRenderers/RenderFormats.h"
void CalculateYUVMatrix(TransformMatrix &matrix
, unsigned int flags
, ERenderFormat format
, float black
, float contrast);
#if defined(HAS_GL) || HAS_GLES == 2
#ifndef __GNUC__
#pragma warning( push )
#pragma warning( disable : 4250 )
#endif
#include "guilib/Shader.h"
namespace Shaders {
class BaseYUV2RGBShader
: virtual public CShaderProgram
{
public:
virtual ~BaseYUV2RGBShader() {};
virtual void SetField(int field) {};
virtual void SetWidth(int width) {};
virtual void SetHeight(int width) {};
virtual void SetBlack(float black) {};
virtual void SetContrast(float contrast) {};
virtual void SetNonLinStretch(float stretch){};
#if HAS_GLES == 2
virtual GLint GetVertexLoc() { return 0; };
virtual GLint GetYcoordLoc() { return 0; };
virtual GLint GetUcoordLoc() { return 0; };
virtual GLint GetVcoordLoc() { return 0; };
virtual void SetMatrices(GLfloat *p, GLfloat *m) {};
virtual void SetAlpha(GLfloat alpha) {};
#endif
};
class BaseYUV2RGBGLSLShader
: public BaseYUV2RGBShader
, public CGLSLShaderProgram
{
public:
BaseYUV2RGBGLSLShader(bool rect, unsigned flags, ERenderFormat format, bool stretch);
~BaseYUV2RGBGLSLShader() {}
virtual void SetField(int field) { m_field = field; }
virtual void SetWidth(int w) { m_width = w; }
virtual void SetHeight(int h) { m_height = h; }
virtual void SetBlack(float black) { m_black = black; }
virtual void SetContrast(float contrast) { m_contrast = contrast; }
virtual void SetNonLinStretch(float stretch) { m_stretch = stretch; }
#if HAS_GLES == 2
virtual GLint GetVertexLoc() { return m_hVertex; }
virtual GLint GetYcoordLoc() { return m_hYcoord; }
virtual GLint GetUcoordLoc() { return m_hUcoord; }
virtual GLint GetVcoordLoc() { return m_hVcoord; }
virtual void SetMatrices(GLfloat *p, GLfloat *m) { m_proj = p; m_model = m; }
virtual void SetAlpha(GLfloat alpha) { m_alpha = alpha; }
#endif
protected:
void OnCompiledAndLinked();
bool OnEnabled();
unsigned m_flags;
ERenderFormat m_format;
int m_width;
int m_height;
int m_field;
float m_black;
float m_contrast;
float m_stretch;
std::string m_defines;
// shader attribute handles
GLint m_hYTex;
GLint m_hUTex;
GLint m_hVTex;
GLint m_hMatrix;
GLint m_hStretch;
GLint m_hStep;
#if HAS_GLES == 2
GLint m_hVertex;
GLint m_hYcoord;
GLint m_hUcoord;
GLint m_hVcoord;
GLint m_hProj;
GLint m_hModel;
GLint m_hAlpha;
GLfloat *m_proj;
GLfloat *m_model;
GLfloat m_alpha;
#endif
};
#if HAS_GLES != 2 // No ARB Shader when using GLES2.0
class BaseYUV2RGBARBShader
: public BaseYUV2RGBShader
, public CARBShaderProgram
{
public:
BaseYUV2RGBARBShader(unsigned flags, ERenderFormat format);
~BaseYUV2RGBARBShader() {}
virtual void SetField(int field) { m_field = field; }
virtual void SetWidth(int w) { m_width = w; }
virtual void SetHeight(int h) { m_height = h; }
virtual void SetBlack(float black) { m_black = black; }
virtual void SetContrast(float contrast) { m_contrast = contrast; }
protected:
unsigned m_flags;
ERenderFormat m_format;
int m_width;
int m_height;
int m_field;
float m_black;
float m_contrast;
// shader attribute handles
GLint m_hYTex;
GLint m_hUTex;
GLint m_hVTex;
};
class YUV2RGBProgressiveShaderARB : public BaseYUV2RGBARBShader
{
public:
YUV2RGBProgressiveShaderARB(bool rect=false, unsigned flags=0, ERenderFormat format=RENDER_FMT_NONE);
void OnCompiledAndLinked();
bool OnEnabled();
};
#endif
class YUV2RGBProgressiveShader : public BaseYUV2RGBGLSLShader
{
public:
YUV2RGBProgressiveShader(bool rect=false, unsigned flags=0, ERenderFormat format=RENDER_FMT_NONE, bool stretch = false);
};
class YUV2RGBBobShader : public BaseYUV2RGBGLSLShader
{
public:
YUV2RGBBobShader(bool rect=false, unsigned flags=0, ERenderFormat format=RENDER_FMT_NONE);
void OnCompiledAndLinked();
bool OnEnabled();
GLint m_hStepX;
GLint m_hStepY;
GLint m_hField;
};
} // end namespace
#ifndef __GNUC__
#pragma warning( pop )
#endif
#endif
#endif //__YUV2RGB_SHADERS_H__
| 27.561224 | 124 | 0.672899 |
7ce440a1f4cbd1d1faaa66e4bd12d88dc5791cc6 | 31,363 | h | C | src/main/store/store.h | aaronwald/coypu | 9371736309d3d205a43bd7e8972ea4a5621c176f | [
"Apache-2.0"
] | null | null | null | src/main/store/store.h | aaronwald/coypu | 9371736309d3d205a43bd7e8972ea4a5621c176f | [
"Apache-2.0"
] | null | null | null | src/main/store/store.h | aaronwald/coypu | 9371736309d3d205a43bd7e8972ea4a5621c176f | [
"Apache-2.0"
] | null | null | null | #pragma once
#include <iostream>
#include <sys/uio.h>
#include <string.h>
#include <functional>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <memory>
#include <streambuf>
#include <type_traits>
namespace coypu {
namespace store {
// Simpler to make this a rolling buffer
template <typename MMapProvider>
class LogWriteBuf {
public:
LogWriteBuf (off64_t pageSize, off64_t offset, int fd, bool readOnly, bool anonymous) :
_pageSize(pageSize), _offset(offset), _fd(fd), _readOnly(readOnly), _dataPage(nullptr, 0), _anonymous(anonymous) {
}
virtual ~LogWriteBuf () {
if (!_anonymous && _dataPage.first) {
MMapProvider::MUnmap(_dataPage.first, _pageSize);
}
}
int Push (const char *data, off64_t len) {
if (_readOnly) return -1;
off64_t off = 0;
while (len) {
if (!_dataPage.first || _dataPage.second == _pageSize) {
int r = AllocatePage();
if (r != 0) return r;
}
off64_t x = std::min(len, _pageSize - _dataPage.second);
memcpy(&(_dataPage.first[_dataPage.second]), &data[off], x); // hacky copy for testing
_dataPage.second += x;
off += x;
len -= x;
}
return 0; // can overflow
}
int Readv (int fd, std::function <int(int, const struct iovec *, int)> &cb) {
if (_readOnly) return -1; // could have static coypu errno
struct iovec iov;
if (!_dataPage.first || _dataPage.second == _pageSize) {
int r = AllocatePage();
if (r != 0) return r;
}
iov.iov_base = &(_dataPage.first[_dataPage.second]);
iov.iov_len = _pageSize - _dataPage.second;
int r = cb(fd, &iov, 1);
if (r < 0) return r;
_dataPage.second += r;
return r; // can overflow
}
template <typename CacheType>
void CachePage(CacheType &cache) {
cache.AddPage(_dataPage.first, _dataPage.second);
}
void SetAllocateCB (std::function<void(char *, off64_t)> &allocate_cb) {
_allocate_cb = allocate_cb;
}
// For use with google buf
int ZeroCopyNext (void **data, int *len) {
if (_readOnly) return -1;
if (!_dataPage.first || _dataPage.second == _pageSize) {
int r = AllocatePage();
if (r != 0) return r;
}
*len = _pageSize - _dataPage.second;
*data = &(_dataPage.first[_dataPage.second]);
_dataPage.second = _pageSize; // assume all used
return 0;
}
bool Backup (int len) {
if (len > _dataPage.second) return false;
_dataPage.second -= len; // backup
return true;
}
bool SetPosition (off64_t offset) {
return PositionPage(offset) == 0;
}
private:
LogWriteBuf (const LogWriteBuf &other);
LogWriteBuf &operator= (const LogWriteBuf &other);
int PositionPage (off64_t offset) {
_offset = (offset / _pageSize) * _pageSize; // to nearets page
if (!_anonymous) {
off64_t size = 0;
if (MMapProvider::GetSize(_fd, size) == -1) {
return -4;
}
if (size == _offset) {
if (MMapProvider::Truncate(_fd, _offset+_pageSize)) {
return -1;
}
}
if (MMapProvider::LSeekSet(_fd, _offset) != _offset) {
return -2;
}
if (_dataPage.first) {
MMapProvider::MUnmap(_dataPage.first, _pageSize);
}
}
_dataPage.first = reinterpret_cast<char *>(MMapProvider::MMapWrite(_fd, _offset, _pageSize));
if (_allocate_cb) {
_allocate_cb(_dataPage.first, _offset);
}
if (!_dataPage.first) {
return -3;
}
_dataPage.second = offset % _pageSize;
return 0;
}
int AllocatePage () {
if (!_anonymous) {
if (MMapProvider::Truncate(_fd, _offset+_pageSize)) {
return -1;
}
if (MMapProvider::LSeekSet(_fd, _offset) != _offset) {
return -2;
}
if (_dataPage.first) {
MMapProvider::MUnmap(_dataPage.first, _pageSize);
}
}
_dataPage.first = reinterpret_cast<char *>(MMapProvider::MMapWrite(_fd, _offset, _pageSize));
if (_allocate_cb) {
_allocate_cb(_dataPage.first, _offset);
}
if (!_dataPage.first) {
return -3;
}
_dataPage.second = 0;
_offset += _pageSize;
return 0;
}
off64_t _pageSize;
off64_t _offset;
int _fd;
bool _readOnly;
std::pair<char *, off64_t> _dataPage;
bool _anonymous;
std::function<void(char *, off64_t)> _allocate_cb;
};
template <typename LogStreamTrait>
class logstreambuf : public std::streambuf {
public:
logstreambuf (const std::shared_ptr<LogStreamTrait> &stream) : _stream(stream) {
}
protected:
virtual std::streamsize xsputn(const char_type* s, std::streamsize n) override
{
return _stream->Push(s, n);
};
virtual int_type overflow (int_type c) override {
if (c != EOF) {
return _stream->Push(reinterpret_cast<char *>(&c), 1);
} else {
return 0;
}
}
private:
const std::shared_ptr<LogStreamTrait> _stream;
};
// class LogReadPageBuf
// map / remap
template <typename MMapProvider>
class LogReadPageBuf {
public:
LogReadPageBuf (off64_t pageSize) :
_pageSize(pageSize),
_dataPage(nullptr, UINT64_MAX) {
}
LogReadPageBuf (off64_t pageSize, char *page, uint64_t offset) :
_pageSize(pageSize),
_dataPage(page, offset) {
}
virtual ~LogReadPageBuf () {
MMapProvider::MUnmap(_dataPage.first, _pageSize);
}
int Map (int fd, uint64_t offset) {
if (_dataPage.second != offset) {
MMapProvider::MUnmap(_dataPage.first, _pageSize);
_dataPage.second = offset;
assert(fd >= 0);
_dataPage.first = reinterpret_cast<char *>(MMapProvider::MMapRead(fd, _dataPage.second, _pageSize));
if (!_dataPage.first) {
return -3;
}
}
return 0;
}
// Absolute offset
bool Peak (uint64_t offset, char &d) const {
if (!_dataPage.first) return false;
if ((offset >= _dataPage.second) &&
(offset <= (_dataPage.second + _pageSize))) {
d = _dataPage.first[offset-_dataPage.second];
return true;
}
return false;
}
bool ZeroCopyNextPeak (uint64_t offset, const void **data, int *len) {
if (!_dataPage.first) return false;
if ((offset >= _dataPage.second) &&
(offset <= (_dataPage.second + _pageSize))) {
*data = &_dataPage.first[offset-_dataPage.second];
*len = _pageSize - (offset-_dataPage.second);
return true;
}
return false;
}
// Absolute offset
bool Find (uint64_t start, char d, uint64_t &offset) const {
for (uint64_t i = start; i < (_dataPage.second+_pageSize); ++ i) {
if (_dataPage.first[i-_dataPage.second] == d) {
offset = i;
return true;
}
}
return false;
}
// Absolute offset - copy (memcpy)
bool Pop (uint64_t start, char *dest, uint64_t size, uint64_t &outSize) {
if (!_dataPage.first) {
return false;
}
if (start < _dataPage.second || start > (_dataPage.second+ _pageSize)) return false;
outSize = std::min(size, _pageSize - (start-_dataPage.second));
::memcpy(dest, &_dataPage.first[start-_dataPage.second], outSize);
return true;
}
bool Unmask (uint64_t start, uint64_t &maskPos, const char *mask, const int maskLen, uint64_t size, uint64_t &outSize) {
if (!_dataPage.first) {
return false;
}
if (start < _dataPage.second || start > (_dataPage.second+ _pageSize)) return false;
outSize = std::min(size, _pageSize - (start-_dataPage.second));
//::memcpy(dest, &_dataPage.first[start-_dataPage.second], outSize);
for (uint64_t i = start-_dataPage.second; i < (start-_dataPage.second)+outSize; ++i) {
_dataPage.first[i] ^= mask[maskPos%maskLen];
++maskPos;
}
return true;
}
// Absolute offset
int Writev (uint64_t start, int fd, std::function <int(int, const struct iovec *, int)> &cb, uint64_t size) {
if (!_dataPage.first) return false;
if (start < _dataPage.second || start > (_dataPage.second+ _pageSize)) return false;
if ((start + size) >= (_dataPage.second +_pageSize)) return false;
struct iovec iov;
iov.iov_base = &_dataPage.first[start-_dataPage.second];
iov.iov_len = std::min(size, _pageSize - (start-_dataPage.second));
if (iov.iov_len > 0) {
return cb(fd, &iov, 1);
}
return 0;
}
char *GetBase (uint64_t offset) {
return &_dataPage.first[offset];
// &page->second->_dataPage._first[page_offset]; // not-portable
}
off64_t GetOffset () {
return _dataPage.second;
}
void Unmap() {
MMapProvider::MUnmap(_dataPage.first, _pageSize);
}
private:
LogReadPageBuf (const LogReadPageBuf &other);
LogReadPageBuf &operator= (const LogReadPageBuf &other);
off64_t _pageSize;
std::pair<char *, off64_t> _dataPage;
};
// TODO one shot cache. Dont call Map on LogReadPageBuf.
// When we read , we go through the offsets, and unmap anything old
// problem is the writebuf might call unmap unless we disable for anonymous
// one shot cache needs to clean up pages
template<typename MMapProvider, int CachePages>
class OneShotCache {
public:
typedef LogReadPageBuf <MMapProvider> store_type;
typedef std::shared_ptr<store_type> page_type;
typedef std::pair<uint32_t, page_type> pair_type;
typedef std::shared_ptr<pair_type> read_cache_type;
typedef uint32_t page_offset_type;
typedef uint64_t offset_type;
OneShotCache (off64_t pageSize, off64_t maxSize, int fd) : _pageSize(pageSize) {
}
virtual ~OneShotCache () {
while (!_pages.empty()) {
_pages.front()->second->Unmap();
_pages.pop_front();
}
}
int PeakPage (offset_type offset, read_cache_type &page) {
auto b = _pages.begin();
auto e = _pages.end();
for (;b != e; ++b) {
if (offset >= (*b)->first && offset < (*b)->first + _pageSize) {
page = *b;
return 0;
}
}
return -1;
}
int FindPage (offset_type offset, read_cache_type &page) {
while (!_pages.empty() && offset >= (_pages.front()->first + _pageSize)) {
_pages.front()->second->Unmap();
_pages.pop_front();
}
if (!_pages.empty()) {
if (offset >= _pages.front()->first &&
offset < _pages.front()->first + _pageSize) {
page= _pages.front();
return 0;
}
}
return -1;
}
void AddPage (char *p, off64_t o) {
assert((o % _pageSize) == 0);
if (!_pages.empty()) {
assert(_pages.back()->second->GetOffset() < o);
}
page_type page = std::make_shared<store_type>(_pageSize, p, o);
read_cache_type rc = std::make_shared<pair_type>(std::make_pair(o, page));
_pages.push_back(rc);
}
private:
OneShotCache (const OneShotCache &other);
OneShotCache &operator= (const OneShotCache &other);
uint64_t _pageSize;
std::deque<read_cache_type> _pages;
};
template<typename MMapProvider, int CachePages>
class LRUCache {
public:
typedef LogReadPageBuf <MMapProvider> store_type;
typedef std::shared_ptr<store_type> page_type;
typedef std::pair<uint32_t, page_type> pair_type;
typedef std::shared_ptr<pair_type> read_cache_type;
typedef uint32_t page_offset_type;
typedef uint64_t offset_type;
LRUCache (off64_t pageSize, off64_t maxSize, int fd) :
_pageSize(pageSize), _maxSize(maxSize), _fd(fd) {
}
virtual ~LRUCache () {
}
int PeakPage (offset_type offset, read_cache_type &page) {
return FindPage(offset, page);
}
int FindPage (offset_type offset, read_cache_type &page) {
page_offset_type pageIndex = offset / _pageSize;
typename std::deque<read_cache_type>::iterator b = _lruReadCache.begin();
typename std::deque<read_cache_type>::iterator e = _lruReadCache.end();
for (;b != e; ++b) {
if ((*b)->first == pageIndex) {
page = *b;
if (b != _lruReadCache.begin()) {
_lruReadCache.erase(b); // erase
_lruReadCache.push_front(page); // add to front - TODO optimize with bpf
}
return 0;
}
}
if (_lruReadCache.size() == _maxSize) {
page = _lruReadCache.back(); // re-use object
page->first = pageIndex;
_lruReadCache.erase(--e); // erase
} else {
page_type psp = std::make_shared<store_type>(_pageSize);
page = std::make_shared<pair_type>(std::make_pair(pageIndex, psp)); // allocate new page
}
if(page->second->Map(_fd, pageIndex * _pageSize) == 0) {
_lruReadCache.push_front(page); // add to front
return 0;
}
page = nullptr; // just in case
return -1;
}
void AddPage (char *, off64_t) {
// nop
}
private:
LRUCache (const LRUCache &other);
LRUCache &operator= (const LRUCache &other);
static constexpr int iov_size = CachePages;
uint16_t _cachePages;
uint64_t _pageSize;
uint64_t _maxSize;
int _fd;
// page index, page
std::deque<read_cache_type> _lruReadCache;
};
template <typename MMapProvider, template <typename, int> class ReadCache, int CacheSize>
class LogRWStream {
public:
typedef uint32_t page_offset_type;
typedef uint64_t offset_type;
typedef char value_type;
typedef LogRWStream<MMapProvider, ReadCache, CacheSize> log_type;
// anonymous=true will keep writebuf from unmap the write page
LogRWStream (off64_t pageSize, offset_type offset, int fd, bool anonymous, offset_type maxSize = UINT64_MAX) :
_writeBuf(pageSize, offset, fd, false, anonymous),
_readCache(pageSize, CacheSize, fd),
_pageSize(pageSize),
_available(offset),
_fd(fd),
_maxSize(maxSize) {
if (!anonymous) {
assert(_fd > 0);
}
std::function<void(char *, off64_t)> cb = [this] (char *page, off64_t offset) {
this->_readCache.AddPage(page, offset);
};
_writeBuf.SetAllocateCB(cb);
}
virtual ~LogRWStream () {
}
// https://gist.github.com/jeetsukumaran/307264
// https://stackoverflow.com/questions/12092448/code-for-a-basic-random-access-iterator-based-on-pointers
template <typename LogType>
class store_iterator : public std::iterator<std::random_access_iterator_tag, char> {
public:
typedef store_iterator<LogType> iterator_type;
typedef typename LogType::value_type value_type;
typedef typename LogType::value_type& reference;
typedef typename LogType::value_type* pointer;
// typedef int difference_type;
using difference_type = typename std::iterator<std::random_access_iterator_tag, char>::difference_type;
store_iterator(LogType *log, offset_type offset) : _log(log), _offset(offset) {
}
reference operator*() {
_log->Peak(_offset, _value);
return _value;
}
pointer operator->() {
_log->Peak(_offset, _value);
return &_value;
}
inline iterator_type& operator++() {++_offset; return *this;}
inline iterator_type& operator--() {--_offset; return *this;}
inline iterator_type operator++(int) const {iterator_type tmp(_log, *this); ++_offset; return tmp;}
inline iterator_type operator--(int) const {iterator_type tmp(_log, *this); --_offset; return tmp;}
/* inline Iterator operator+(const Iterator& rhs) {return Iterator(_ptr+rhs.ptr);} */
inline difference_type operator-(const iterator_type& rhs) const {return _offset-rhs._offset;}
inline iterator_type operator+(difference_type rhs) const {return iterator_type(_log, _offset+rhs);}
inline iterator_type operator-(difference_type rhs) const {return iterator_type(_log, _offset-rhs);}
friend inline iterator_type operator+(difference_type lhs, const iterator_type& rhs) {return iterator_type(rhs._log, lhs+rhs._offset);}
friend inline iterator_type operator-(difference_type lhs, const iterator_type& rhs) {return iterator_type(rhs._log, lhs-rhs._offset);}
inline bool operator==(const iterator_type& rhs) const {return _offset == rhs._offset;}
inline bool operator!=(const iterator_type& rhs) const {return _offset != rhs._offset;}
inline bool operator>(const iterator_type& rhs) const {return _offset > rhs._offset;}
inline bool operator<(const iterator_type& rhs) const {return _offset < rhs._offset;}
inline bool operator>=(const iterator_type& rhs) const {return _offset >= rhs._offset;}
inline bool operator<=(const iterator_type& rhs) const {return _offset <= rhs._offset;}
private:
LogType *_log;
offset_type _offset;
char _value;
};
typedef store_iterator<log_type> iterator;
iterator begin(offset_type offset) {
return store_iterator<log_type>(this, offset);
}
iterator end(offset_type end) {
return store_iterator<log_type>(this, end);
}
offset_type Available () const {
return _available;
}
bool IsEmpty () const {
return _available == 0;
}
inline offset_type Free() const {
return Capacity() - Available();
}
offset_type Capacity() const {
return _maxSize;
}
int ZeroCopyWriteNext (void **data, int *len) {
int i = _writeBuf.ZeroCopyNext(data, len);
if (i == 0) _available += *len;
return 0;
}
void ZeroCopyWriteBackup (int len) {
_writeBuf.Backup(len);
_available -= len;
}
int Push (const char *data, offset_type len) {
int r = _writeBuf.Push(data,len);
if (r == 0) _available += len;
return r;
}
int Readv (int fd, std::function <int(int, const struct iovec *, int)> &cb) {
int r = _writeBuf.Readv(fd, cb);
// LRU will ignore,
if (r > 0) _available += r;
return r;
}
bool Peak (offset_type offset, char &d) {
typename read_cache_type::read_cache_type page;
if (_readCache.PeakPage(offset, page)) return false;
if (offset >= _available) return false;
return page ? page->second->Peak(offset, d) : false;
}
bool ZeroCopyReadNext (offset_type offset, const void **data, int *len) {
typename read_cache_type::read_cache_type page;
if (_readCache.PeakPage(offset, page)) return false;
if (offset >= _available) return false;
return page ? page->second->ZeroCopyNextPeak(offset, data,len) : false;
}
bool Unmask (offset_type start_offset, offset_type len, const char *mask, int maskLen) {
page_offset_type startPage = start_offset / _pageSize;
page_offset_type maxPage = _available / _pageSize;
typename read_cache_type::read_cache_type page;
uint64_t read = 0, out_size = 0;
uint64_t maskPos = 0;
for (page_offset_type i = startPage; i <= maxPage; ++i) {
offset_type pageStart = i * _pageSize;
if (_readCache.PeakPage(pageStart, page) == 0) {
offset_type start_pos = std::max(start_offset, pageStart);
if (page->second && page->second->Unmask(start_pos, maskPos, mask, maskLen, len-read, out_size)) {
read += out_size;
if (read == len) return true;
} else {
return false;
}
}
}
return false;
}
bool Find (offset_type start_offset, char d, offset_type &offset) {
page_offset_type startPage = start_offset / _pageSize;
page_offset_type maxPage = _available / _pageSize;
typename read_cache_type::read_cache_type page;
for (page_offset_type i = startPage; i <= maxPage; ++i) {
offset_type pageStart = i * _pageSize;
if (_readCache.FindPage(pageStart, page) == 0) {
offset_type start_pos = std::max(start_offset, pageStart);
if (page->second->Find(start_pos, d, offset)) {
return true;
}
}
}
offset = UINT64_MAX;
return false;
}
// copy
bool Pop (offset_type start_offset, char *dest, uint64_t size) {
page_offset_type startPage = start_offset / _pageSize;
page_offset_type maxPage = _available / _pageSize;
typename read_cache_type::read_cache_type page;
uint64_t read = 0, out_size = 0;
// offset_type end_offset = start_offset + size - 1;
for (page_offset_type i = startPage; i <= maxPage; ++i) {
offset_type pageStart = i * _pageSize;
// offset_type pageEnd = pageStart + _pageSize - 1;
if (_readCache.FindPage(pageStart, page) == 0) {
offset_type start_pos = std::max(start_offset, pageStart);
// offset_type end_pos = std::min(end_offset, pageEnd); - not needed?
// Pop will only return min(page_size, size-read)
if (page->second && page->second->Pop (start_pos, &dest[read], size-read, out_size)) {
read += out_size;
if (read == size) return true;
} else {
return false;
}
}
}
return false;
}
// direct without a copy up to n bytes starting at start_offset
// maps up to CacheSize pages which means this could fail if n is significantly large.
int Writev (offset_type start_offset, offset_type size,
int fd, std::function <int(int, const struct iovec *, int)> &cb) {
size = std::min(size, (CacheSize * _pageSize));
struct iovec iov[CacheSize];
typename read_cache_type::read_cache_type page;
page_offset_type startPage = start_offset / _pageSize;
page_offset_type maxPage = _available / _pageSize;
// how to make sure pages are locked
offset_type queued = 0;
int iov_i = 0;
for (page_offset_type i = startPage; queued < size && i <= maxPage && iov_i < CacheSize; ++i, ++iov_i) {
offset_type pageStart = i * _pageSize;
offset_type page_offset = (start_offset+queued) % _pageSize;
if (_readCache.FindPage(pageStart, page) == 0) {
iov[iov_i].iov_len = std::min((size-queued), _pageSize - page_offset);
iov[iov_i].iov_base = page->second->GetBase(page_offset);
queued += iov[iov_i].iov_len;
} else {
return -2;
}
}
return cb(fd, iov, iov_i);
}
bool SetPosition (off64_t offset) {
return _writeBuf.SetPosition(offset);
}
bool Backup (int count) {
return true;
}
bool Skip (int count) {
// nop - should be enable_if
return true;
}
private:
LogRWStream (const LogRWStream &other);
LogRWStream &operator= (const LogRWStream &other);
LogWriteBuf <MMapProvider> _writeBuf;
typedef ReadCache<MMapProvider, CacheSize> read_cache_type;
read_cache_type _readCache;
uint64_t _pageSize;
uint64_t _available;
int _fd; // file descriptor
uint64_t _maxSize; // max size, defaults unbound
};
// Keeps track of current read position in stream
template <typename S>
class PositionedStream {
public:
// constexpr static bool is_positioned = true;
PositionedStream (const std::shared_ptr<S> &stream) : _stream(stream),
_curOffset(stream->Available()) {
}
virtual ~PositionedStream () {
}
typename S::offset_type Available () const {
return _stream->Available() - _curOffset;
}
typename S::offset_type TotalAvailable () const {
return _stream->Available();
}
bool Peak (typename S::offset_type offset, char &d) {
return _stream->Peak(_curOffset+offset, d);
}
bool Unmask (typename S::offset_type offset, typename S::offset_type len, const char *mask, int maskLen) {
return _stream->Unmask(offset, len, mask, maskLen);
}
bool Find (typename S::offset_type start_offset, char d, typename S::offset_type &offset) {
return _stream->Find(_curOffset+start_offset, d, offset);
}
bool Pop (char *dest, uint64_t size) {
if (_stream->Pop(_curOffset, dest, size)) {
_curOffset += size;
return true;
}
return false;
}
bool Pop (char *dest, typename S::offset_type offset, uint64_t size) {
if (_stream->Pop(offset, dest, size)) {
return true;
}
return false;
}
int Readv (int fd, std::function <int(int, const struct iovec *, int)> &cb) {
return _stream->Readv(fd, cb);
}
int Push (const char *data, typename S::offset_type len) {
return _stream->Push(data, len);
}
int Writev (typename S::offset_type size,
int fd, std::function <int(int, const struct iovec *, int)> &cb) {
int r = _stream->Writev(_curOffset, size, fd, cb);
if (r > 0) {
_curOffset += r;
}
return r;
}
bool Backup (typename S::offset_type size) {
if (size <= _curOffset) {
_curOffset -= size;
return true;
}
return false;
}
bool Skip (typename S::offset_type size) {
if (size <= Available()) {
_curOffset += size;
return true;
}
return false;
}
void ResetPosition () {
_curOffset = _stream->Available();
}
typename S::offset_type CurrentOffset() const {
return _curOffset;
}
bool ZeroCopyReadNext (typename S::offset_type offset, const void **data, int *len) {
bool b = _stream->ZeroCopyReadNext(offset, data, len);
if (b) {
_curOffset += *len;
}
return b;
}
private:
PositionedStream (const PositionedStream &other);
PositionedStream &operator=(const PositionedStream &other);
std::shared_ptr<S> _stream;
typename S::offset_type _curOffset;
};
template <typename S>
class MultiPositionedStreamLog {
public:
typedef typename S::offset_type offset_type;
MultiPositionedStreamLog (const std::shared_ptr<S> &stream) : _stream(stream) {
}
virtual ~MultiPositionedStreamLog () {
}
int Push (const char *data, typename S::offset_type len) {
// DTRACE_PROBE2(coypu, "multi-push", data, len);
return _stream->Push(data, len);
}
int ZeroCopyWriteNext (void **data, int *len) {
return _stream->ZeroCopyWriteNext(data, len);
}
void ZeroCopyWriteBackup (int len) {
_stream->ZeroCopyWriteBackup(len);
}
int Register (int fd, uint64_t offset) {
if (fd+1 > _curOffsets.size()) {
_curOffsets.resize(fd+1, UINT64_MAX);
}
assert(_curOffsets[fd] == UINT64_MAX);
_curOffsets[fd] = offset;
return 0;
}
bool Mark (int fd, uint64_t offset) {
if (fd < _curOffsets.size()) {
_curOffsets[fd] = offset;
return true;
}
return false;
}
bool MarkEnd (int fd) {
if (fd < _curOffsets.size()) {
_curOffsets[fd] = _stream->Available();
return true;
}
return false;
}
int Unregister (int fd) {
if (fd >= _curOffsets.size()) return -3;
_curOffsets[fd] = UINT64_MAX;
return 0;
}
int Writev (typename S::offset_type size,
int fd, std::function <int(int, const struct iovec *, int)> &cb) {
if (fd >= _curOffsets.size()) return -3;
if (_curOffsets[fd] == UINT64_MAX) return 0; // no work
int r = _stream->Writev(_curOffsets[fd], size, fd, cb);
if (r > 0) {
_curOffsets[fd] += r;
}
return r;
}
typename S::offset_type Available () const {
return _stream->Available();
}
typename S::offset_type TotalAvailable () const {
return _stream->TotalAvailable();
}
typename S::offset_type Available (int fd) const {
if (fd >= _curOffsets.size()) return 0;
if (_curOffsets[fd] == UINT64_MAX) return 0; //unregistered
return _stream->Available() - _curOffsets[fd];
}
// copy
bool Pop (char *dest, typename S::offset_type offset, typename S::offset_type size) {
if (_stream->Available() < offset) return false;
if (_stream->Available()+size < offset) return false;
if (_stream->Pop(offset, dest, size)) {
return true;
}
return false;
}
bool IsEmpty (int fd) const {
if (fd >= _curOffsets.size()) return true;
if (_curOffsets[fd] == UINT64_MAX) return true; //unregistered
return _stream->Available() - _curOffsets[fd] == 0;
}
inline typename S::offset_type Free() const {
return _stream->Free();
}
typename S::iterator begin(typename S::offset_type offset) {
return _stream->begin(offset);
}
typename S::iterator end(typename S::offset_type end) {
return _stream->end(end);
}
private:
MultiPositionedStreamLog (const MultiPositionedStreamLog &other);
MultiPositionedStreamLog &operator=(const MultiPositionedStreamLog &other);
std::shared_ptr<S> _stream;
std::vector<typename S::offset_type> _curOffsets;
};
}
}
| 31.021761 | 149 | 0.577209 |
7ce56953ec1f746594e8feab29a57e39c3e6d33b | 5,030 | h | C | src/Front/GeneralTextEdit/gentextedit.h | Igisid/Breeks-desktop | 0dfaa6ea64d1d2912a4aed9e1febb537b9a9eec6 | [
"Apache-2.0"
] | 10 | 2020-12-20T15:32:20.000Z | 2021-07-12T18:09:57.000Z | src/Front/GeneralTextEdit/gentextedit.h | Igisid/Breeks-desktop | 0dfaa6ea64d1d2912a4aed9e1febb537b9a9eec6 | [
"Apache-2.0"
] | 2 | 2022-01-04T12:51:00.000Z | 2022-01-04T14:40:19.000Z | src/Front/GeneralTextEdit/gentextedit.h | Igisid/Breeks-desktop | 0dfaa6ea64d1d2912a4aed9e1febb537b9a9eec6 | [
"Apache-2.0"
] | 3 | 2020-12-22T02:50:11.000Z | 2021-02-24T01:58:11.000Z | #ifndef TEXT_EDIT_H
#define TEXT_EDIT_H
#include <Qt>
#include <QWidget>
#include <QTextEdit>
#include <QKeyEvent>
#include <QTimer>
#include <QFile>
#include <QtSql>
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonValue>
#include <QByteArray>
#include "Back/filesystem.h"
#include "Front/datastructures.h"
#include "undoredotext.h"
#include "Front/Dictionary/russiandictionary.h"
class GenTextEdit : public QTextEdit
{
Q_OBJECT
public:
explicit GenTextEdit(QWidget *parent = nullptr);
void keyPressEvent(QKeyEvent *event) override;
//for work with file system, definition in filesystem.cpp
void readFromDB(const int currentFile);
void writeToDB(const int currentFile);
void setNumberCurrentFile(const int n);
int getNumberCurrentFile();
void clearCharStyleVector();
QVector<charStyle_t> getCharStyleVector();
//for work with char styles
enum charStyle {
Normal, // = 0
Bold, // = 1
Italic, // = 2
Underline, // = 3
Strike, // = 4
Item, // = 5
Star, // = 6
SpellChecker // = 7
};
using iterator = QVector< charStyle_t >::iterator;
//in ...-get-set.cpp
void fillCharStyleVector(int cursorPos, int count, charStyle_t ch);
static void setStylesToChar(charStyle_t& ch, QTextCharFormat& charFormat, const QJsonObject jChar);
void getCharStyle(const int index, charStyle_t& ch) const;
void setCharCounter(const int value);
int getCharCounter() const;
//in ...-keys-realization.cpp
void setCharStyle(const int style, const bool forBuffer = false);
void addTodoList();
void fillCharsAndSetText(QString text, const QJsonArray jArr);
void fillCharsAndSetTextt(QString&, QVector<charStyle_t>&);
public slots:
void recieveUsername(const QString);
void checkSpelling();
void sendServerRequest();
signals:
void sendServerRequest(int);
private:
UndoRedoText *undoRedoBuffer_;
void setCommandInfo(commandInfo_t& command, const enum command commandName,
const int pos, const QString text, int lenght = -1);
static RussianDictionary *rusDic_;
QTimer *timer_;
QTimer *requestTimer_;
//it is data storage
QString username_;
int nCurrentFile_;
QJsonObject note1_;
QJsonObject note2_;
QJsonObject note3_;
QJsonObject note4_;
QJsonObject note5_;
QJsonObject note6_;
const int MAX_COUNT_CHAR_ = 999; //fix count of chars in the one note
int charCounter_;
QVector< charStyle_t > charStyleVector_; //storrage of font style status of every char
const QVector< QChar > AVAILABLE_CHARS_ = {'!', '?', '.', ',', ';', ':', '\"', '\'', '&', '*', '@', '~', '`', '#','$', '^', '/',
'%', '(', ')', '[', ']', '{', '}', '|', '\\', '<', '>', '-', '_', '+', '='};
charStyle_t globCh;
const QString dashSign_ = "—";
const QString pointSign_ = "•";
const QString minusSign_ = "-";
const QString warrningSign_ = "⚠";
const int ITEM_LENGTH = 4;
const int TAB_LENGTH = 4;
const uint RUS_YO_UNICODE = 0x0435;
//keys-realization.cpp
void addTodoList(const QString itemSign);
void addStar();
void addTab(int& cursorPos);
void backTab(int& cursorPos);
void addSpace(const int cursorPos);
void deleteSmth(const Qt::KeyboardModifiers kmModifiers, const QTextCursor::MoveOperation whereMove,
int& cursorPos, const int blindSpot, const int a = 0);
void colorText(const QString color, const bool forBuffer = false);
void makeCharNormal();
void undoCommand();
void redoCommand();
void addNewWordToDic(const QString word);
//details.cpp - smth like namespace details
void detailsEraseSelectedText(int& cursorPos);
//if cursor in the middle of item and we are going to push Bs/del we should delete full item
void detailsCheckItemPosInDeleting(int& cursorPos, const bool isBS, Qt::KeyboardModifiers& mod);
//if we write smth in the middle of item, we won't have the item it will become a regular text
void detailsCheckItemAndCanselStatus(int& cursorPos);
void detailsCheckSelectionAndItem(int& cursorPos); //to unite common checkers
static void detailsSetCharStyle(charStyle_t& ch, const int style = charStyle::Normal);
static void detailsSetCharStyle(charStyle_t& ch, const int style, int& status);
static void detailsSetBoolByStatus(bool& a, int& status);
void detailsSetFormatFields(QTextCharFormat& fmt, const charStyle_t ch);
void detailsSetCharStyleByNeighbours(charStyle_t& ch, const int index);
void detailsSetCharStyleByIndex(const charStyle_t& ch, const int index);
void detailsColorText(QTextCursor c, const QString color);
void detailsUndoRedoInsertText(const commandInfo_t& command);
void detailsUndoRedoDeleteText(const commandInfo_t& command);
void detailsUndoRedoEffects(const commandInfo_t& command, const bool flag = false);
bool detailsIsLetter(const QChar ch);
void detailsUpdateCharStyle(const int pos, QTextCharFormat& fmt);
bool detailsCheckSpelling(QString& word, const int indexLastChar);
};
#endif // TEXT_EDIT
| 32.451613 | 130 | 0.716501 |
8ccc29e970f2353cb17c30474ca1c478747d9374 | 2,503 | h | C | src/include/syrah/lrb/LRB_intrin.h | boulos/syrah | 4ac08d54daa09fc4e7ac8424898d21deda18e103 | [
"BSD-3-Clause"
] | 12 | 2015-04-03T05:46:17.000Z | 2021-07-16T17:56:21.000Z | src/include/syrah/lrb/LRB_intrin.h | boulos/syrah | 4ac08d54daa09fc4e7ac8424898d21deda18e103 | [
"BSD-3-Clause"
] | null | null | null | src/include/syrah/lrb/LRB_intrin.h | boulos/syrah | 4ac08d54daa09fc4e7ac8424898d21deda18e103 | [
"BSD-3-Clause"
] | 1 | 2022-02-02T03:37:45.000Z | 2022-02-02T03:37:45.000Z | #ifndef _SYRAH_LRB_INTRIN_H_
#define _SYRAH_LRB_INTRIN_H_
#include "../Preprocessor.h"
namespace syrah {
// replace compressd with vloadu on LRB.
SYRAH_FORCEINLINE void DisableDenormals() {
// Figure out how to do this on lrb
}
SYRAH_FORCEINLINE __m512 _mm512_loadu_size4(const void* values) {
// UGH(boulos): Stupid LRB prototype thing didn't have const.
return _mm512_expandd(const_cast<void*>(values), _MM_FULLUPC_NONE, _MM_HINT_NONE);
}
SYRAH_FORCEINLINE __m512 _mm512_mask_loadu_size4(const void* values, __mmask mask, __m512 orig_val) {
return _mm512_mask_expandd(orig_val, mask, const_cast<void*>(values), _MM_FULLUPC_NONE, _MM_HINT_NONE);
}
SYRAH_FORCEINLINE void _mm512_storeu_size4(void* values, __m512 v) {
_mm512_compressd(values, v, _MM_DOWNC_NONE, _MM_HINT_NONE);
}
// These masked versions are tricky... Not sure if these are right.
SYRAH_FORCEINLINE void _mm512_mask_storeu_size4(void* values, __mmask mask, __m512 v) {
_mm512_mask_compressd(values, mask, v, _MM_DOWNC_NONE, _MM_HINT_NONE);
}
SYRAH_FORCEINLINE __m512 _mm512_loadu_ps(const float* values) {
return _mm512_loadu_size4(values);
}
SYRAH_FORCEINLINE __m512i _mm512_loadu_epi32(const int* values) {
return _mm512_castps_si512(_mm512_loadu_size4(values));
}
SYRAH_FORCEINLINE __m512 _mm512_mask_loadu_ps(const float* values, __mmask mask, __m512 v) {
return _mm512_mask_loadu_size4(values, mask, v);
}
SYRAH_FORCEINLINE __m512i _mm512_mask_loadu_epi32(const int* values, __mmask mask, __m512i v) {
return _mm512_castps_si512(_mm512_mask_loadu_size4(values, mask, _mm512_castsi512_ps(v)));
}
SYRAH_FORCEINLINE void _mm512_storeu_ps(float* values, __m512 v) {
return _mm512_storeu_size4(values, v);
}
SYRAH_FORCEINLINE void _mm512_storeu_epi32(int* values, __m512i v) {
return _mm512_storeu_size4(values, _mm512_castsi512_ps(v));
}
SYRAH_FORCEINLINE void _mm512_mask_storeu_ps(float* values, __mmask mask, __m512 v) {
return _mm512_mask_storeu_size4(values, mask, v);
}
SYRAH_FORCEINLINE void _mm512_mask_storeu_epi32(int* values, __mmask mask, __m512i v) {
return _mm512_mask_storeu_size4(values, mask, _mm512_castsi512_ps(v));
}
// NOTE(boulos): the external header had a terrible name.
SYRAH_FORCEINLINE int _mm512_reduce_min_epi32(__m512i a) {
return _mm512_reduce_min_pi(a);
}
SYRAH_FORCEINLINE int _mm512_reduce_max_epi32(__m512i a) {
return _mm512_reduce_max_pi(a);
}
}
#endif
| 35.253521 | 107 | 0.76668 |
87cbdaa23c630feb565f31d7c3715fab0e60fd91 | 4,338 | h | C | src/crl_camera/CRLBaseCamera.h | M-Gjerde/MultiSense | 921a1a62757a4831bd51b2659e2bff670641d962 | [
"MIT"
] | null | null | null | src/crl_camera/CRLBaseCamera.h | M-Gjerde/MultiSense | 921a1a62757a4831bd51b2659e2bff670641d962 | [
"MIT"
] | null | null | null | src/crl_camera/CRLBaseCamera.h | M-Gjerde/MultiSense | 921a1a62757a4831bd51b2659e2bff670641d962 | [
"MIT"
] | null | null | null | //
// Created by magnus on 2/20/22.
//
#ifndef MULTISENSE_CRLBASECAMERA_H
#define MULTISENSE_CRLBASECAMERA_H
#include <MultiSense/MultiSenseChannel.hh>
#include <mutex>
#include <unordered_set>
#include <unordered_map>
#include <MultiSense/src/core/Definitions.h>
typedef enum CRLCameraDataType {
CrlPointCloud,
CrlGrayscaleImage,
CrlColorImageYUV420,
CrlNone, CrlDisparityImage, CrlImage
} CRLCameraDataType;
typedef enum CRLCameraType {
DEFAULT_CAMERA_IP,
CUSTOM_CAMERA_IP,
VIRTUAL_CAMERA
} CRLCameraType;
struct Image
{
uint16_t height{0}, width{0};
uint32_t size{0};
int64_t frame_id{0};
crl::multisense::DataSource source{};
const void *data{nullptr};
};
struct BufferPair
{
std::mutex swap_lock;
crl::multisense::image::Header active, inactive;
void *activeCBBuf{nullptr}, *inactiveCBBuf{nullptr}; // weird multisense BufferStream object, only for freeing reserved data later
Image user_handle;
void refresh() // swap to latest if possible
{
std::scoped_lock lock(swap_lock);
auto handleFromHeader = [](const auto &h) {
return Image{static_cast<uint16_t>(h.height), static_cast<uint16_t>(h.width), h.imageLength, h.frameId, h.source, h.imageDataP};
};
if ((activeCBBuf == nullptr && inactiveCBBuf != nullptr) || // special case: first init
(active.frameId < inactive.frameId))
{
std::swap(active, inactive);
std::swap(activeCBBuf, inactiveCBBuf);
user_handle = handleFromHeader(active);
}
}
};
class CRLBaseCamera {
public:
CRLBaseCamera() = default;
static constexpr uint16_t DEFAULT_WIDTH = 1920, DEFAULT_HEIGHT = 1080;
std::unordered_map<crl::multisense::DataSource,BufferPair> buffers_;
std::unordered_map<crl::multisense::DataSource,crl::multisense::image::Header> imagePointers;
struct CameraInfo {
crl::multisense::system::DeviceInfo devInfo;
crl::multisense::image::Config imgConf;
crl::multisense::system::NetworkConfig netConfig;
crl::multisense::system::VersionInfo versionInfo;
crl::multisense::image::Calibration camCal{};
std::vector<crl::multisense::system::DeviceMode> supportedDeviceModes;
crl::multisense::DataSource supportedSources{0};
std::vector<uint8_t*> rawImages;
}cameraInfo;
struct PointCloudData {
void *vertices{};
uint32_t vertexCount{};
uint32_t *indices{};
uint32_t indexCount{};
PointCloudData(uint32_t width, uint32_t height) {
vertexCount = width * height;
// Virtual class can generate some mesh data here
vertices = calloc(vertexCount, sizeof(Basil::Vertex));
uint32_t v = 0;
auto *vP = (Basil::Vertex*) vertices;
for (uint32_t x = 0; x < width; ++x) {
for (uint32_t z = 0; z < height; ++z) {
Basil::Vertex vertex{};
vertex.pos = glm::vec3((float) x / 50, 0.0f, (float) z / 50);
vertex.uv0 = glm::vec2((float) x / (float) width, (float) z / (float) height);
vP[v] = vertex;
v++;
}
}
};
~PointCloudData() {
free(vertices);
delete[] indices;
}
};
PointCloudData *meshData{};
bool connect(const std::string& ip); // true if succeeds
virtual void initialize() {};
virtual void start(std::string string, std::string dataSourceStr) = 0;
virtual void stop(std::string dataSourceStr) = 0;
virtual PointCloudData *getStream() = 0;
bool connected = false;
crl::multisense::Channel * cameraInterface{};
protected:
void getCameraMetaData();
void getVirtualCameraMetaData();
void addCallbacks();
static void imageCallback(const crl::multisense::image::Header &header, void *userDataP);
void streamCallback(const crl::multisense::image::Header &image);
void selectFramerate(float FPS);
void selectDisparities(uint32_t disparities);
void selectResolution(uint32_t RequestedWidth, uint32_t RequestedHeight);
std::unordered_set<crl::multisense::DataSource> supportedSources();
};
#endif //MULTISENSE_CRLBASECAMERA_H
| 28.168831 | 140 | 0.64154 |
c6978a8607d825b2e2a6f6b5682b6e926facbd3f | 2,380 | c | C | SD/Driver/spi.c | MCLEANS/STM32F1_FatFs_SD | fa9e42b666782b78ab3cfe50f96de7ef4aa9378e | [
"MIT"
] | null | null | null | SD/Driver/spi.c | MCLEANS/STM32F1_FatFs_SD | fa9e42b666782b78ab3cfe50f96de7ef4aa9378e | [
"MIT"
] | null | null | null | SD/Driver/spi.c | MCLEANS/STM32F1_FatFs_SD | fa9e42b666782b78ab3cfe50f96de7ef4aa9378e | [
"MIT"
] | null | null | null | /*
spi.c file is a hardware Driver.
Copyright (C) 2018 Nima Mohammadi
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "spi.h"
void initSpi(void)
{
/* Enable SPI and GPIOB RCC */
RCC->APB1ENR |= RCC_APB1ENR_SPI2EN;
RCC->APB2ENR |= RCC_APB2ENR_IOPBEN;
/* Set SCK Pin to Alternate function Push_Pull */
GPIOB->CRH &= ~GPIO_CRH_MODE13;
GPIOB->CRH |= GPIO_CRH_MODE13;
GPIOB->CRH &= ~GPIO_CRH_CNF13;
GPIOB->CRH |= GPIO_CRH_CNF13_1;
/* Set MOSI Pin to Alternate function Push-Pull */
GPIOB->CRH &= ~GPIO_CRH_MODE15;
GPIOB->CRH |= GPIO_CRH_MODE15;
GPIOB->CRH &= ~GPIO_CRH_CNF15;
GPIOB->CRH |= GPIO_CRH_CNF15_1;
/* Set MISO pin to alternate function */
GPIOB->CRH &= ~GPIO_CRH_MODE14;
GPIOB->CRH &= ~GPIO_CRH_CNF14;
GPIOB->CRH |= GPIO_CRH_CNF14_1;
/* Set CS pin to General Purpose Output */
GPIOB->CRH |= GPIO_CRH_MODE12;
/* Set CS pin to High */
GPIOB->ODR |= GPIO_ODR_ODR12;
/* SPI Configuration */
SPI2->CR1 &= ~SPI_CR1_SPE; //Disable SPI
SPI2->CR1 &= ~ SPI_CR1_BR;
SPI2->CR1 |= SPI_CR1_BR_0 | SPI_CR1_BIDIOE ;
SPI2->CR1 |= SPI_CR1_CPHA; //CPHA 1 EDGE
SPI2->CR1 &= ~SPI_CR1_CPOL; //CPOL LOW
SPI2->CR1 &= ~SPI_CR1_DFF; //8-bit data frame
SPI2->CR1 &= ~SPI_CR1_LSBFIRST; //MSB_FIRST
SPI2->CR1 |= SPI_CR1_SSM | SPI_CR1_SSI;
SPI2->CR1 |= SPI_CR1_MSTR;
SPI2->CR1 |= SPI_CR1_SPE; // enable SPI
}
void SpiSendData(uint8_t data)
{
SPI2->DR = data;
while((SPI2->SR & SPI_SR_TXE) == RESET){}
}
uint8_t SpiTransceiveByte(uint8_t data)
{
SPI2->DR = data;
while ((SPI2->SR & SPI_SR_RXNE) == 0);
return SPI2->DR;
}
uint8_t SpiReceive()
{
while((SPI2->SR & SPI_SR_RXNE) == RESET){}
return SPI2->DR;
}
void SpiCsLow(void)
{
GPIOB->ODR &= ~GPIO_ODR_ODR12;
}
void SpiCsHigh(void)
{
GPIOB->ODR |= GPIO_ODR_ODR12;
}
| 25.869565 | 74 | 0.692017 |
0955824b4ad9bfd3904be502492e2964f04b414d | 3,078 | h | C | underworld/libUnderworld/gLucifer/DrawingObjects/src/HistoricalSwarmTrajectory.h | longgangfan/underworld2 | 5c8acc17fa4d97e86a62b13b8bfb2af6e81a8ee4 | [
"CC-BY-4.0"
] | 116 | 2015-09-28T10:30:55.000Z | 2022-03-22T04:12:38.000Z | underworld/libUnderworld/gLucifer/DrawingObjects/src/HistoricalSwarmTrajectory.h | longgangfan/underworld2 | 5c8acc17fa4d97e86a62b13b8bfb2af6e81a8ee4 | [
"CC-BY-4.0"
] | 561 | 2015-09-29T06:05:50.000Z | 2022-03-22T23:37:29.000Z | underworld/libUnderworld/gLucifer/DrawingObjects/src/HistoricalSwarmTrajectory.h | longgangfan/underworld2 | 5c8acc17fa4d97e86a62b13b8bfb2af6e81a8ee4 | [
"CC-BY-4.0"
] | 68 | 2015-12-14T21:57:46.000Z | 2021-08-25T04:54:26.000Z | /*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
** **
** This file forms part of the Underworld geophysics modelling application. **
** **
** For full license and copyright information, please refer to the LICENSE.md file **
** located at the project root, or contact the authors. **
** **
**~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*/
#ifndef __lucHistoricalSwarmTrajectory_h__
#define __lucHistoricalSwarmTrajectory_h__
/** Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
extern const Type lucHistoricalSwarmTrajectory_Type;
/** Class contents - this is defined as a macro so that sub-classes of this class can use this macro at the start of the definition of their struct */
#define __lucHistoricalSwarmTrajectory \
/* Parent info */ \
__lucDrawingObject \
/* Virtual functions go here */ \
/* Other info */\
Swarm* swarm; \
ExtensionInfo_Index particleIdExtHandle; \
/* Other Stuff */ \
Bool flat; \
float scaling; \
float arrowHead; \
unsigned int steps; \
double time; \
struct lucHistoricalSwarmTrajectory
{
__lucHistoricalSwarmTrajectory
};
/** Private Constructor: This will accept all the virtual functions for this class as arguments. */
#ifndef ZERO
#define ZERO 0
#endif
#define LUCHISTORICALSWARMTRAJECTORY_DEFARGS \
LUCDRAWINGOBJECT_DEFARGS
#define LUCHISTORICALSWARMTRAJECTORY_PASSARGS \
LUCDRAWINGOBJECT_PASSARGS
lucHistoricalSwarmTrajectory* _lucHistoricalSwarmTrajectory_New( LUCHISTORICALSWARMTRAJECTORY_DEFARGS );
void _lucHistoricalSwarmTrajectory_Delete( void* drawingObject ) ;
void _lucHistoricalSwarmTrajectory_Print( void* drawingObject, Stream* stream ) ;
/* 'Stg_Component' implementations */
void* _lucHistoricalSwarmTrajectory_DefaultNew( Name name ) ;
void _lucHistoricalSwarmTrajectory_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data );
void _lucHistoricalSwarmTrajectory_Build( void* drawingObject, void* data ) ;
void _lucHistoricalSwarmTrajectory_Initialise( void* drawingObject, void* data ) ;
void _lucHistoricalSwarmTrajectory_Execute( void* drawingObject, void* data );
void _lucHistoricalSwarmTrajectory_Destroy( void* drawingObject, void* data ) ;
void _lucHistoricalSwarmTrajectory_Draw( void* drawingObject, lucDatabase* database, void* _context ) ;
#endif
| 46.636364 | 157 | 0.583821 |
096820db6b8f0f4d9a6a9a382c9e18031a817dd9 | 6,628 | h | C | executionSystem/execution_system.h | InMechaSol/ccNOos | d8a5ed367af34adb12c3c79f857a3706aec3f1b1 | [
"Apache-2.0"
] | null | null | null | executionSystem/execution_system.h | InMechaSol/ccNOos | d8a5ed367af34adb12c3c79f857a3706aec3f1b1 | [
"Apache-2.0"
] | null | null | null | executionSystem/execution_system.h | InMechaSol/ccNOos | d8a5ed367af34adb12c3c79f857a3706aec3f1b1 | [
"Apache-2.0"
] | 1 | 2022-02-02T17:08:09.000Z | 2022-02-02T17:08:09.000Z | /** \file execution_system.h
* \brief <a href="https://www.inmechasol.org/" target="_blank">IMS</a>:
<a href="https://github.com/InMechaSol/ccNOos" target="_blank">ccNOos</a>,
Declarations for straight C and C++
Copyright 2021 <a href="https://www.inmechasol.org/" target="_blank">InMechaSol, Inc</a>
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.
Notes:
(.c includes .h) - for straight C or
(.cpp includes .c which includes .h) - for C++ wrapped straight C
*Always compiled to a single compilation unit, either C or CPP, not both
*/
#ifndef __EXECUTION_SYSTEM__
#define __EXECUTION_SYSTEM__
#include "version_config.h"
////////////////////////////////////////////////////////////////////////////////
// Time Constants
#define TIME_us_PER_MIN (60000000u)
#define TIME_uS_PER_HR (3600000000u)
#define TIME_uS_PER_SEC (1000000u)
#define TIME_SEC_PER_MIN (60u)
#define TIME_MIN_PER_HR (60u)
////////////////////////////////////////////////////////////////////////////////
// Exception Flag Index
#define EXP_SETUP (0u)
#define EXP_LOOP (1u)
#define EXP_SYSTICK (2u)
#define EXP_PLATFORM (3u)
#define EXP_HANDLER (4u)
// Platform Specific Configuration Functions
void platformSetup();
void platformStart();
void platformLoopDelay();
////////////////////////////////////////////////////////////////////////////////
// Cross-Platform, Reusable, C/C++ Execution System Data Structure
struct executionSystemStruct
{
UI_32 uSecTicks;
UI_32 hourTicks;
UI_32 uSecPerSysTick;
};
// Execution System Data Structure Creation
struct executionSystemStruct CreateExecutionSystemStruct(
UI_32 uSperTick
);
////////////////////////////////////////////////////////////////////////////////
// Cross-Platform, Reusable, C/C++ Module API Functions
UI_32 getuSecTicks();
UI_32 getHourTicks();
UI_32 getuSecPerSysTick();
#ifdef __cplusplus
#define _DeclareExeSys executionSystemClass exeSystem(uSEC_PER_CLOCK);
#define _ExeSys_ exeSystem.getExeDataPtr()->
#else
#define _DeclareExeSys struct executionSystemStruct exeSystem;
#define _ExeSys_ exeSystem.
#endif
#define __ExeSysAPIFuncsTemplate \
_DeclareExeSys \
UI_32 getuSecTicks()\
{\
return _ExeSys_ uSecTicks;\
}\
UI_32 getHourTicks()\
{\
return _ExeSys_ hourTicks;\
}\
UI_32 getuSecPerSysTick()\
{\
return _ExeSys_ uSecPerSysTick;\
}
#define ExeSysAPIFuncsTemplate __ExeSysAPIFuncsTemplate
////////////////////////////////////////////////////////////////////////////////
// C Execution System Base Components - not compiled in C++ build
#ifndef __cplusplus
struct computeModuleStruct; // forward declaration
struct ioDeviceStruct; // forward declaration
struct linkedIODeviceStruct
{
struct ioDeviceStruct* devPtr;
struct linkedIODeviceStruct* nextPtr;
};
struct linkedEntryPointStruct
{
struct linkedEntryPointStruct* nextPtr;
struct computeModuleStruct *dataPtr;
int (*entryPoint)(
struct computeModuleStruct *dataPtrIn
);
};
struct executionEntryStruct
{
struct linkedEntryPointStruct* setupListHead;
struct linkedEntryPointStruct* loopListHead;
struct linkedEntryPointStruct* sysTickListHead;
struct linkedEntryPointStruct* exceptionListHead;
};
void ModuleExeArea(
UI_32 ExcpIndex,
struct linkedEntryPointStruct* exeListHeadIn
);
void ModuleExceptionArea(
struct linkedEntryPointStruct* exeListHeadIn
);
// Entry Points of the Execution System (module execution areas)
int ExecuteMain(
struct executionSystemStruct* exeStructIn,
struct executionEntryStruct* exeEntryPtrsIn
);
int ExecuteSetup(
struct executionSystemStruct* exeStructIn,
struct executionEntryStruct* exeEntryPtrsIn
);
int ExecuteLoop(
struct executionSystemStruct* exeStructIn,
struct executionEntryStruct* exeEntryPtrsIn
);
void ExecuteSysTick(
struct executionSystemStruct* exeStructIn,
struct executionEntryStruct* exeEntryPtrsIn
);
// Application/Platform Configuration Function
void applicationConfig();
#endif // !__cplusplus
#ifdef __cplusplus
////////////////////////////////////////////////////////////////////////////////
// Cross-Platform, Reusable, C++ Only Execution System Classes
class IODeviceClass; // forward declaration
class computeModuleClass; // forward declaration
class linkedIODeviceClass
{
private:
IODeviceClass* devPtr = nullptr;
linkedIODeviceClass* nextPtr = nullptr;
public:
linkedIODeviceClass(
IODeviceClass* devPtrIn,
linkedIODeviceClass* nextPtrIn
);
IODeviceClass* getDevPtr();
linkedIODeviceClass* getNextIOClassPtr();
};
class linkedEntryPointClass
{
private:
computeModuleClass* modulePtr = nullptr;
linkedEntryPointClass* nextPtr = nullptr;
public:
linkedEntryPointClass(
computeModuleClass* modulePtrIn,
linkedEntryPointClass* nextPtrIn
);
computeModuleClass* getComputeModule();
linkedEntryPointClass* getNextEPClassPtr();
};
class executionSystemClass // declaration of execution system class
{
protected:
struct executionSystemStruct data;
linkedEntryPointClass* setupListHead = nullptr;
linkedEntryPointClass* loopListHead = nullptr;
linkedEntryPointClass* sysTickListHead = nullptr;
linkedEntryPointClass* exceptionListHead = nullptr;
void ModuleExeArea(int EXE_AREA_INDEX);
void ModuleExceptionArea();
public:
executionSystemClass(
UI_32 uSperTick
);
virtual void ExecuteSetup();
virtual void ExecuteLoop();
int ExecuteMain();
virtual void ExecuteSysTick();
struct executionSystemStruct* getExeDataPtr() {return &data;}
void LinkTheListsHead(
linkedEntryPointClass* setupListHeadIn,
linkedEntryPointClass* loopListHeadIn,
linkedEntryPointClass* sysTickListHeadIn,
linkedEntryPointClass* exceptionListHeadIn
);
};
#endif // !__cplusplus
#endif // ! __EXECUTION_SYSTEM__
| 28.324786 | 96 | 0.676373 |
51d63ce556ac1ab2ed1cafdba36e94034b861ec5 | 489 | h | C | Generator/Generator/Generator.h | Tejas7194/Generator | 9dc8adaa15530f9903d7b58efe982b5a9f7065ed | [
"MIT"
] | null | null | null | Generator/Generator/Generator.h | Tejas7194/Generator | 9dc8adaa15530f9903d7b58efe982b5a9f7065ed | [
"MIT"
] | null | null | null | Generator/Generator/Generator.h | Tejas7194/Generator | 9dc8adaa15530f9903d7b58efe982b5a9f7065ed | [
"MIT"
] | null | null | null | //
// Generator.h
// Generator
//
// Created by tejas on 13/05/19.
// Copyright © 2019 Loneranger. All rights reserved.
//
#import <UIKit/UIKit.h>
//! Project version number for Generator.
FOUNDATION_EXPORT double GeneratorVersionNumber;
//! Project version string for Generator.
FOUNDATION_EXPORT const unsigned char GeneratorVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <Generator/PublicHeader.h>
| 24.45 | 134 | 0.758691 |
99e6620b4b31b1490950253eef91bec0e4207e48 | 409 | h | C | ego_libs/pa_stickc/pa_stickc_priv.h | frameworklabs/ego | a830dad5a243fa0267870b7f9713c1f174566447 | [
"MIT"
] | null | null | null | ego_libs/pa_stickc/pa_stickc_priv.h | frameworklabs/ego | a830dad5a243fa0267870b7f9713c1f174566447 | [
"MIT"
] | null | null | null | ego_libs/pa_stickc/pa_stickc_priv.h | frameworklabs/ego | a830dad5a243fa0267870b7f9713c1f174566447 | [
"MIT"
] | null | null | null | // Copyright (c) 2022, Framework Labs.
#include <pa_utils.h> // for Delay
#include <proto_activities.h>
// Dimmer
pa_activity_ctx (DimDownController, pa_use(Delay); uint8_t brightness);
pa_activity_ctx (DimmController, pa_use(Delay); pa_use(DimDownController));
pa_activity_ctx (PressCopyMachine);
pa_activity_ctx (Dimmer, pa_co_res(2); pa_use(PressCopyMachine); pa_use(DimmController); bool isDimmed);
| 27.266667 | 104 | 0.782396 |
79d4bdbbf2af7a7a0a9a4b9e550b82d88f404d17 | 1,903 | c | C | Testing/Shimakaze.c | stmobo/VEX-Starstruck | 47490c2f8c17502134084cab274bd63be3793671 | [
"MIT"
] | null | null | null | Testing/Shimakaze.c | stmobo/VEX-Starstruck | 47490c2f8c17502134084cab274bd63be3793671 | [
"MIT"
] | null | null | null | Testing/Shimakaze.c | stmobo/VEX-Starstruck | 47490c2f8c17502134084cab274bd63be3793671 | [
"MIT"
] | null | null | null | #ifndef SHIMAKAZE_C
#define SHIMAKAZE_C
#include "../Enterprise.c"
/* Clawbot control state. */
struct control_t {
signed char left;
signed char right;
bool up;
bool down;
bool open;
bool close;
};
void controlToMotors(const control_t state) {
motor[leftMotor] = state.left;
motor[rightMotor] = state.right;
if(state.open) {
motor[clawMotor] = 127;
} else if(state.close) {
motor[clawMotor] = -127;
} else {
motor[clawMotor] = 0;
}
if(state.up) {
motor[armMotor] = 127;
} else if(state.down) {
motor[armMotor] = -127;
} else {
motor[armMotor] = 0;
}
}
void joystickToControl(control_t* state) {
state->left = vexRT[Ch3];
state->right = vexRT[Ch2];
state->up = vexRT[Btn5U];
state->down = vexRT[Btn5D];
state->open = vexRT[Btn6U];
state->close = vexRT[Btn6D];
}
void replayToControl(control_t* state, replay_t* replay) {
state->left = (signed char)readNextByte(replay);
state->right = (signed char)readNextByte(replay);
unsigned char btnState = readNextByte(replay);
writeDebugStreamLine("%d / %d / %d", state->left, state->right, btnState);
state->up = TEST_BIT(btnState, 0);
state->down = TEST_BIT(btnState, 1);
state->open = TEST_BIT(btnState, 2);
state->close = TEST_BIT(btnState, 3);
}
void controlToReplay(const control_t state, replay_t* replay) {
writeByte(replay, (unsigned char)state.left);
writeByte(replay, (unsigned char)state.right);
unsigned char btnState = 0;
btnState |= (state.up ? 1 : 0) << 0;
btnState |= (state.down ? 1 : 0) << 1;
btnState |= (state.open ? 1 : 0) << 2;
btnState |= (state.close ? 1 : 0) << 3;
writeByte(replay, btnState);
}
#endif /* end of include guard: SHIMAKAZE_C */
| 24.397436 | 79 | 0.591172 |
e861d9812f1a9963742df36db8994744b0eaffe9 | 3,677 | h | C | include/scilib/integrate_impl/quad.h | stigrs/scilib | c49f1f882bf2031a4de537e0f5701b2648af181f | [
"MIT"
] | null | null | null | include/scilib/integrate_impl/quad.h | stigrs/scilib | c49f1f882bf2031a4de537e0f5701b2648af181f | [
"MIT"
] | null | null | null | include/scilib/integrate_impl/quad.h | stigrs/scilib | c49f1f882bf2031a4de537e0f5701b2648af181f | [
"MIT"
] | null | null | null | // Copyright (c) 2021 Stig Rune Sellevag
//
// This file is distributed under the MIT License. See the accompanying file
// LICENSE.txt or http://www.opensource.org/licenses/mit-license.php for terms
// and conditions.
#ifndef SCILIB_INTEGRATE_QUAD_H
#define SCILIB_INTEGRATE_QUAD_H
#include <array>
#include <functional>
namespace Sci {
namespace Integrate {
// Return tabulated roots and weights for a Gauss-Legendre quadrature
// of order n.
template <int N = 8>
inline void gauss_legendre(std::array<double, N>& roots,
std::array<double, N>& weights,
double a = -1.0,
double b = 1.0)
{
static_assert(N == 5 || N == 8 || N == 16,
"bad order for Gauss-Legendre quadrature");
// 5-point:
std::array<double, 5> x5{
0.00000000000000000, -0.5384693101056831, 0.5384693101056831,
-0.9061798459386640, 0.9061798459386640,
};
std::array<double, 5> w5{
0.5688888888888889, 0.4786286704993665, 0.4786286704993665,
0.2369268850561891, 0.2369268850561891,
};
std::array<double, 8> x8{-0.1834346424956498, 0.1834346424956498,
-0.5255324099163290, 0.5255324099163290,
-0.7966664774136267, 0.7966664774136267,
-0.9602898564975363, 0.9602898564975363};
std::array<double, 8> w8{0.3626837833783620, 0.3626837833783620,
0.3137066458778873, 0.3137066458778873,
0.2223810344533745, 0.2223810344533745,
0.1012285362903763, 0.1012285362903763};
std::array<double, 16> x16{
-0.0950125098376374, 0.0950125098376374, -0.2816035507792589,
0.2816035507792589, -0.4580167776572274, 0.4580167776572274,
-0.6178762444026438, 0.6178762444026438, -0.7554044083550030,
0.7554044083550030, -0.8656312023878318, 0.8656312023878318,
-0.9445750230732326, 0.9445750230732326, -0.9894009349916499,
0.9894009349916499};
std::array<double, 16> w16{
0.1894506104550685, 0.1894506104550685, 0.1826034150449236,
0.1826034150449236, 0.1691565193950025, 0.1691565193950025,
0.1495959888165767, 0.1495959888165767, 0.1246289712555339,
0.1246289712555339, 0.0951585116824928, 0.0951585116824928,
0.0622535239386479, 0.0622535239386479, 0.0271524594117541,
0.0271524594117541};
switch (N) {
case 16:
std::copy(x16.begin(), x16.end(), roots.begin());
std::copy(w16.begin(), w16.end(), weights.begin());
break;
case 5:
std::copy(x5.begin(), x5.end(), roots.begin());
std::copy(w5.begin(), w5.end(), weights.begin());
break;
case 8:
default:
std::copy(x8.begin(), x8.end(), roots.begin());
std::copy(w8.begin(), w8.end(), weights.begin());
}
// Change of interval:
for (int i = 0; i < N; ++i) {
roots[i] = 0.5 * (b - a) * roots[i] + 0.5 * (a + b);
weights[i] *= 0.5 * (b - a);
}
}
// Integrate function from a to b using a Gauss-Legendre quadrature
// of order N.
template <int N = 8>
inline double quad(std::function<double(double)> f, double a, double b)
{
static_assert(N == 5 || N == 8 || N == 16,
"bad order for Gauss-Legendre quadrature");
std::array<double, N> x;
std::array<double, N> w;
gauss_legendre<N>(x, w, a, b);
double res = 0.0;
for (int i = 0; i < N; ++i) {
res += w[i] * f(x[i]);
}
return res;
}
} // namespace Integrate
} // namespace Sci
#endif // SCILIB_INTEGRATE_QUAD_H
| 34.688679 | 78 | 0.601305 |
e89051f7ebee44d769e3971627e4c7286341499d | 6,054 | h | C | Shared/include/DBufRequester.h | wayfinder/Wayfinder-Server | a688546589f246ee12a8a167a568a9c4c4ef8151 | [
"BSD-3-Clause"
] | 4 | 2015-08-17T20:12:22.000Z | 2020-05-30T19:53:26.000Z | Shared/include/DBufRequester.h | wayfinder/Wayfinder-Server | a688546589f246ee12a8a167a568a9c4c4ef8151 | [
"BSD-3-Clause"
] | null | null | null | Shared/include/DBufRequester.h | wayfinder/Wayfinder-Server | a688546589f246ee12a8a167a568a9c4c4ef8151 | [
"BSD-3-Clause"
] | null | null | null | /*
Copyright (c) 1999 - 2010, Vodafone Group Services Ltd
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 Vodafone Group Services Ltd 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 DATABUFFERREQUESTER_H
#define DATABUFFERREQUESTER_H
// Includes config.h if mc2
#include "TileMapConfig.h"
#include "NotCopyable.h"
class MC2SimpleString;
class BitBuffer;
/**
* Class waiting for a request.
*/
class DBufRequestListener {
public:
/**
* Called by the Requester when a request is done.
* @param descr The descr used to get the object.
* @param receivedObject The received object.
*/
virtual void requestReceived(const MC2SimpleString& descr,
BitBuffer* dataBuffer) = 0;
};
/**
* Class describing something that can request BitBuffers.
* <br />
* If you are making a DBufRequester which request stuff
* from an external source, you will have to override
* cancelAll and requestFromExternal and set parent to NULL.
* <br />
* If you are making a caching DBufRequester you will have to
* override requestCached and release and set parent == real parent.
*/
class DBufRequester: private NotCopyable {
public:
/**
* Creates a new DBufRequester with the supplied parent
* requester.
*/
DBufRequester(DBufRequester* parentRequester = NULL);
/**
* Deletes the parent.
*/
virtual ~DBufRequester() {
delete m_parentRequester;
}
/**
* Requests a BitBuffer from the DBufRequester. When the
* buffer is received caller->requestReceived(desc, buffer)
* will be called.
* <br />
* Default implementation calls requestCached and if it
* returns a buffer, caller->requestReceived will be called
* immideately, otherwise, if there is a parent, it will
* be called and if there is no parent requestFromExternal
* will be called.
* @param descr The description.
* @param caller The RequestListener that wants an update
* if a delayed answer comes back.
*/
virtual void request(const MC2SimpleString& descr,
DBufRequestListener* caller);
/**
* Deletes the cached version of the buffer.
*/
void removeBuffer( const MC2SimpleString& descr );
/**
* If the DBufRequester already has the map in cache it
* should return it here or NULL. The BitBuffer should be
* returned in release as usual.
* <br />Default implementation returns
* <code>m_parentRequester->requestCached</code>
* or <b>NULL</b> if <code>m_parentRequester</code> is
* <b>NULL</b>.
* @param descr Key for databuffer.
* @return Cached BitBuffer or NULL.
*/
virtual BitBuffer* requestCached(const MC2SimpleString& descr);
/**
* Makes it ok for the Requester to delete the BitBuffer
* or to put it in the cache. Requesters which use other
* requesters should hand the objects back to their parents
* and requesters which are top-requesters should delete them.
* It is important that the descr is the correct one.
* <br />
* This is where the caching requesters should save their buffers.
* <br />
* Default implementaion calls release in the parent if there
* is one or else deletes the buffer.
*/
virtual void release(const MC2SimpleString& descr,
BitBuffer* obj);
/**
* The same method as release but with the extra knowledge that the
* buffer is from requestCached.
* Default implementaion calls release.
*/
virtual void releaseCached( const MC2SimpleString& descr,
BitBuffer* obj );
/**
* Tries to cancel all requests in the requester.
* Note that the requests e.g. already sent to the server
* cannot be canceled.
* Default implementation calls the cancelAll in the parent
* requester if there is one.
*/
virtual void cancelAll();
protected:
/**
* Does the real requesting.
* Default implementation does nothing.
* This is the one to override if doing a requester which
* requests buffers from e.g. internet.
*/
virtual void requestFromExternal(const MC2SimpleString& descr,
DBufRequestListener* caller);
/**
* Should be overridden by the subclasses if they are caches.
* Should delete all occurances of the buffer associated
* with the descr.
*/
virtual void internalRemove(const MC2SimpleString& descr ) {}
/**
* The parent requester.
*/
DBufRequester* m_parentRequester;
};
#endif
| 38.807692 | 755 | 0.688305 |
b27a15ea65b82a593322f153290b6fb9d048268a | 1,154 | h | C | Sources/Internal/Animation/KeyframeAnimation.h | stinvi/dava.engine | 2b396ca49cdf10cdc98ad8a9ffcf7768a05e285e | [
"BSD-3-Clause"
] | 26 | 2018-09-03T08:48:22.000Z | 2022-02-14T05:14:50.000Z | Sources/Internal/Animation/KeyframeAnimation.h | ANHELL-blitz/dava.engine | ed83624326f000866e29166c7f4cccfed1bb41d4 | [
"BSD-3-Clause"
] | null | null | null | Sources/Internal/Animation/KeyframeAnimation.h | ANHELL-blitz/dava.engine | ed83624326f000866e29166c7f4cccfed1bb41d4 | [
"BSD-3-Clause"
] | 45 | 2018-05-11T06:47:17.000Z | 2022-02-03T11:30:55.000Z | #ifndef __DAVAENGINE_KEYFRAME_ANIMATION_H__
#define __DAVAENGINE_KEYFRAME_ANIMATION_H__
#include "Base/BaseTypes.h"
#include "Base/BaseObject.h"
#include "Animation/Animation.h"
#include "Animation/AnimatedObject.h"
namespace DAVA
{
class KeyframeData : public BaseObject
{
public:
struct Keyframe
{
Keyframe(int32 _frame, float32 _time)
{
frame = _frame;
time = _time;
next = 0;
}
int32 frame;
float32 time;
Keyframe* next;
};
protected:
virtual ~KeyframeData();
public:
KeyframeData();
void AddKeyframe(int32 frame, float32 time);
float32 GetLength();
Keyframe* head;
Keyframe* tail;
};
class KeyframeAnimation : public Animation
{
protected:
virtual ~KeyframeAnimation();
public:
KeyframeAnimation(AnimatedObject* _owner, int32* _var, KeyframeData* data, float32 _animationTimeLength);
virtual void Update(float32 timeElapsed);
virtual void OnStart();
private:
int32* var;
KeyframeData* data;
KeyframeData::Keyframe* currentFrame = nullptr;
};
};
#endif // __DAVAENGINE_KEYFRAME_ANIMATION_H__ | 19.896552 | 109 | 0.681976 |
b28c50d975ca9fe0b0559cd930feb55a29b0d152 | 129 | h | C | contrib/python/numpy/numpy/core/src/multiarray/sequence.h | HeyLey/catboost | f472aed90604ebe727537d9d4a37147985e10ec2 | [
"Apache-2.0"
] | 6,989 | 2017-07-18T06:23:18.000Z | 2022-03-31T15:58:36.000Z | numpy/core/src/multiarray/sequence.h | Kshitish555/numpy | 12c6000601c7665e52502ab4a67a54d290498266 | [
"BSD-3-Clause"
] | 1,978 | 2017-07-18T09:17:58.000Z | 2022-03-31T14:28:43.000Z | numpy/core/src/multiarray/sequence.h | Kshitish555/numpy | 12c6000601c7665e52502ab4a67a54d290498266 | [
"BSD-3-Clause"
] | 1,228 | 2017-07-18T09:03:13.000Z | 2022-03-29T05:57:40.000Z | #ifndef _NPY_ARRAY_SEQUENCE_H_
#define _NPY_ARRAY_SEQUENCE_H_
extern NPY_NO_EXPORT PySequenceMethods array_as_sequence;
#endif
| 18.428571 | 57 | 0.883721 |
d73aeb216a6b2c033a1e18fcf7408d98e28fe05b | 233 | h | C | src/ui/uitoolbar.h | keegangb/helios | 1079285c6f8b5fc1d8d83e8f3d436882e0506e89 | [
"MIT"
] | null | null | null | src/ui/uitoolbar.h | keegangb/helios | 1079285c6f8b5fc1d8d83e8f3d436882e0506e89 | [
"MIT"
] | null | null | null | src/ui/uitoolbar.h | keegangb/helios | 1079285c6f8b5fc1d8d83e8f3d436882e0506e89 | [
"MIT"
] | null | null | null | #ifndef UITOOLBAR_H
#define UITOOLBAR_H
#include <ui/uicontainer.h>
typedef struct UiToolbar
{
COMPONENT
UiContainer *container;
} UiToolbar;
void UiToolbar_Init(void);
void UiToolbar_Cleanup(void);
#endif // UITOOLBAR_H | 14.5625 | 29 | 0.763948 |
67f48119e45a6b482d0182374c13323fbd73e856 | 2,120 | h | C | vtorcs-RL-color/src/modules/simu/simuv2/SOLID-2.0/src/Convex.h | JasonXu12/gym_torcs | bbe5f3b62eba788b38a0a58f147dd4848c740b7f | [
"MIT"
] | 417 | 2016-05-27T03:16:21.000Z | 2022-03-30T03:34:55.000Z | vtorcs-RL-color/src/modules/simu/simuv2/SOLID-2.0/src/Convex.h | JasonXu12/gym_torcs | bbe5f3b62eba788b38a0a58f147dd4848c740b7f | [
"MIT"
] | 65 | 2016-08-21T22:48:05.000Z | 2022-01-13T09:16:42.000Z | vtorcs-RL-color/src/modules/simu/simuv2/SOLID-2.0/src/Convex.h | JasonXu12/gym_torcs | bbe5f3b62eba788b38a0a58f147dd4848c740b7f | [
"MIT"
] | 188 | 2016-05-28T10:13:12.000Z | 2021-12-09T15:26:16.000Z | /*
SOLID - Software Library for Interference Detection
Copyright (C) 1997-1998 Gino van den Bergen
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Please send remarks, questions and bug reports to gino@win.tue.nl,
or write to:
Gino van den Bergen
Department of Mathematics and Computing Science
Eindhoven University of Technology
P.O. Box 513, 5600 MB Eindhoven, The Netherlands
*/
#ifndef _CONVEX_H_
#define _CONVEX_H_
#ifdef _MSC_VER
#pragma warning(disable:4786) // identifier was truncated to '255'
#endif // _MSC_VER
#include <3D/Point.h>
#include "Shape.h"
#include "BBox.h"
#include "Transform.h"
class Convex : public Shape {
public:
ShapeType getType() const { return CONVEX; }
virtual ~Convex() {}
virtual Point support(const Vector& v) const = 0;
virtual BBox bbox(const Transform& t) const;
};
bool intersect(const Convex& a, const Convex& b,
const Transform& a2w, const Transform& b2w,
Vector& v);
bool intersect(const Convex& a, const Convex& b, const Transform& b2a,
Vector& v);
bool common_point(const Convex& a, const Convex& b,
const Transform& a2w, const Transform& b2w,
Vector& v, Point& pa, Point& pb);
bool common_point(const Convex& a, const Convex& b, const Transform& b2a,
Vector& v, Point& pa, Point& pb);
void closest_points(const Convex&, const Convex&,
const Transform&, const Transform&,
Point&, Point&);
#endif
| 31.176471 | 73 | 0.716981 |
d551a104ba0b54c344e460775623fde3c1b6f309 | 10,316 | c | C | TicTacToe.c | wappints/TicTacToe | 9c616c6858e47010a9ef5ff0577d8d988b6efbda | [
"MIT"
] | null | null | null | TicTacToe.c | wappints/TicTacToe | 9c616c6858e47010a9ef5ff0577d8d988b6efbda | [
"MIT"
] | null | null | null | TicTacToe.c | wappints/TicTacToe | 9c616c6858e47010a9ef5ff0577d8d988b6efbda | [
"MIT"
] | null | null | null | #include<stdio.h>
typedef char TwoD[3][3];
void display_TICTACTOE () //displays the words Tic Tac Toe
{
printf("\n\n\n\n\n\n\n\n");
printf("\n-----------------------------------------------------------------------------------------------------\n");
printf(" _________ _____ ______ _________ _ ______ _________ ___ ________ \n" );
printf("| _ _ ||_ _| .' ___ | | _ _ | / \\ .' ___ | | _ _ | .' `.|_ __ | \n");
printf("|_/ | | \\_| | | / .' \\_| |_/ | | \\_| / _ \\ / .' \\_| |_/ | | \\_|/ .-. \\ | |_ \\_| \n");
printf(" | | | | | | | | / ___ \\ | | | | | | | | | _| _ \n");
printf(" _| |_ _| |_ \\ `.___.'\\ _| |_ _/ / \\ \\_\\ `.___.'\\ _| |_ \\ `-' /_| |__/ | \n");
printf(" |_____| |_____| `. ____ .' |_____| |____| |____| `.____.' |_____| `.___.'|________| \n");
printf("\n\t\t\t\t\t with a twist\n");
}
void MainMenu(int *ptr) //displays the Main Menu and scans for which choice the player wants to make
{
display_TICTACTOE();
printf("\n [1] Play \n [2] How to Play \n [3] Exit\n\n Enter a valid choice: ");
do
{
scanf("%d", ptr);
switch (*ptr)
{
case 1: *ptr = 1;
break;
case 2: *ptr = 2;
break;
case 3: *ptr = 3;
break;
default :
fflush(stdin); // If user inputs a character
printf("Invalid Input! Type again! \n");
printf("\n\n=========================");
printf("\n [1] Play \n [2] How to Play \n [3] Exit\n\n Enter a valid choice: ");
break;
}
} while (*ptr != 1 && *ptr != 2 && *ptr != 3);
}
void PrintTicTacToe(TwoD XO) // The function basically just prints the updated board
{
printf("_____________________________________________________________________________\n"); // design layout
printf(" \n\n\n\n - 1 - 2 - 3 -\n");
printf(" -------------\n");
printf("1 | %c | %c | %c |\n", XO[0][0] ,XO[0][1] ,XO[0][2] );
printf(" ------------- \n");
printf("2 | %c | %c | %c |\n", XO[1][0] ,XO[1][1] ,XO[1][2] );
printf(" -------------\n");
printf("3 | %c | %c | %c |\n", XO[2][0] ,XO[2][1] ,XO[2][2] );
printf(" -------------\n\n\n\n");
printf("_____________________________________________________________________________\n");
}
void GameInput(TwoD XO, char Mark, int ctr) // the one for the input and mapping of the game
{
int RowNum = 0; // used for scanf to map Row Number
int ColNum = 0; // used for scanf to map Column Num
int RowNum2 = 0; // used for scanf to map Row Number
int ColNum2 = 0; // used for scanf to map Column Num
int Input = 0; // Input used to calculate the RowNum and ColNum
int Input2 = 0;
int checker = 0; // checker is the condition for the while-loop of the three rounds of each player before they can have the ability to
if (ctr == 7 || ctr == 8) // change the values of the position.
printf("\n\n\n\nIt is your FOURTH turn, Player %c\n\n", Mark);
do
{
if (ctr < 7)
{
do
{
printf("Enter Position: ");
scanf("%d", &Input);
printf("\n\n\n\n\n\n\n");
RowNum = Input / 10;
ColNum = Input % 10;
if(((RowNum > 3) || (RowNum < 1)) || ((ColNum < 1) || ( ColNum > 3)))
{
printf("\n The Address you've entered is incorrect\n" ); // If user did not input 11, 12, 13, 21, 22, 23, 31, 32, or 33
fflush(stdin); // If user inputs a character
}
else if (XO[RowNum-1][ColNum-1] != 95)
{
PrintTicTacToe(XO);
printf("\nCannot be placed since position is already occupied\n" );
}
else
checker = 1;
} while(checker == 0);
}
else
{
do
{
printf("Enter Position to be removed: ");
scanf("%d", &Input2);
printf("Enter Position to be placed: ");
scanf("%d", &Input);
RowNum2 = Input2 / 10;
ColNum2 = Input2 % 10;
printf("\n\n\n\n\n\n\n");
RowNum = Input / 10;
ColNum = Input % 10;
if(((RowNum > 3) || (RowNum < 1)) || ((ColNum < 1) || ( ColNum > 3)) || ((ColNum2 < 1) || ( ColNum2 > 3)) || ((RowNum2 > 3) || (RowNum2 < 1)))
{
PrintTicTacToe(XO);
printf("\nThe Address you've entered is incorrect\n" ); // If user did not input 11, 12, 13, 21, 22, 23, 31, 32, or 33
fflush(stdin); // If user inputs a character
}
else if (XO[RowNum2-1][ColNum2-1] == 95)
{
PrintTicTacToe(XO);
printf("\nCannot be replaced since position is empty\n" );
}
else if (XO[RowNum2-1][ColNum2-1] != Mark) // If user replaces an empty position or the value is not from the player's.
{
PrintTicTacToe(XO);
printf("\nPosition is owned by opposing player\n" );
if (XO[RowNum-1][ColNum-1] != 95)
printf("Position to be placed with value is ALSO not empty!\n\n" );
fflush(stdin); // If user inputs a character
}
else if (XO[RowNum-1][ColNum-1] != 95) // Position is not empty
{
PrintTicTacToe(XO);
printf("Position is not empty!\n" );
fflush(stdin); // If user inputs a character
}
else
checker = 1;
} while(checker == 0);
}
if (ctr >= 7)
XO[RowNum2-1][ColNum2-1] = 95;
XO[RowNum-1][ColNum-1] = Mark;
} while (checker == 0);
PrintTicTacToe(XO);
}
int CheckWinCond ( TwoD XO) // Win Condition Function
{
int WinFlag = 0;
if( ( (XO[0][1] == XO[1][1]) && (XO[1][1] == XO[2][1]) && ( (XO[1][1] == 'O') || (XO[1][1] == 'X') ) ) // Vertical
||
( (XO[1][0] == XO[1][1]) && (XO[1][1] == XO[1][2]) && ( (XO[1][1] == 'O') || (XO[1][1] == 'X') ) ) // Horizontal
||
( (XO[0][0] == XO[1][1]) && (XO[1][1] == XO[2][2]) && ( (XO[1][1] == 'O') || (XO[1][1] == 'X') ) ) // Diagonal TopLeft to BottomRight
||
( (XO[0][2] == XO[1][1]) && (XO[1][1] == XO[2][0]) && ( (XO[1][1] == 'O') || (XO[1][1] == 'X') ) ) ) // Diagonal BottomLeft to TopRight
WinFlag = 1;
return WinFlag;
}
void GameBody() // controls input and display in the game
{
printf("\n\n\n\n\n\n\n\n\n\n");
int Turnctr = 0; // ctr in order to modulo 2 to find out whose player's turn is it
int PlayerNum ; // used for printing Player '1' or PLayer '2', because modulo of Turnctr returns 0 or 1
int i,j;
TwoD XO;
for(i = 0; i < 3; i++) // 2D character array for the X's and O's
for(j = 0; j < 3; j++)
XO[i][j] = 95;
int WinCond = 0; //Win Condition variable, 0 for not yet done, 1 for someone won
char Mark; //for the X or O, depending on whose turn it is
while(WinCond == 0)
{
Turnctr++;
if (Turnctr % 2 == 1) // First player is always X
{
Mark = 'X';
PlayerNum = 1;
}
else // if the turn is now an even number, it'll go to player O
{
Mark = 'O';
PlayerNum = 2;
}
printf("\n\n\nPlayer %d, enter the Row and Column of where you want to place your %c\n\n", PlayerNum, Mark); // Instructions
if(Turnctr == 1) // Starting Display of the Game
{
PrintTicTacToe(XO);
printf("\nExample : 11 or 23 or 31\n\n");
}
GameInput( XO, Mark, Turnctr); // call function
WinCond = CheckWinCond(XO); // check condition and return WinFlag
if (WinCond == 1)
{
PrintTicTacToe(XO);
printf("\n\n\n\n\n\n\n\t-----------------------\n\t-----------------------\n\t-------ENDGAME---------\n\t-----------------------\n\t-----------------------\n\n\n\n");
printf("\n\n CONGRATULATIONS PLAYER %d, YOU WON!", PlayerNum);
}
}
}
void how_to_play () //this function displays the how to play the game
{
int choice;
printf("\n\n\n\n\n-----------------------------------------------------------------------------------------------------\n");
printf("-----------------------------------------------------------------------------------------------------\n");
printf("-----------------------------------------------------------------------------------------------------\n");
printf(" _ _ _____ __ _____ ___ ___ _ _ __ __\n");
printf("| || |/ _ \\ \\ / / |_ _/ _ \\ | _ \\ | /_\\\\ \\ / /\n");
printf("| __ | (_) \\ \\/\\/ / | || (_) | | _/ |__ / _ \\\\ v / \n");
printf("|_||_|\\___/ \\_/\\_/ |_| \\___/ |_| |____/_/ \\_\\|_| ");
printf("\n\n");
printf("\n THE RULES");
printf("\n 1. This game is played on a grid of 3x3 squares.");
printf("\n 2. Player 1 is X and Player 2 is O.");
printf("\n 3. Each player is given a maximum of 3 moves to mark 3 squares in a row. ");
printf("\n\n THE TWIST");
printf("\n 1. When the players consumed their 3 moves, they will be given a chance to change the position of one of their past\n moves and move it to a free space.");
printf("\n 2. To win the game, a player must mark 3 squares in a row in a specific place, not just anywhere. ");
printf("\n 3. With these, this Tic Tac Toe game will never end in a tie.");
printf("\n\n\n\n\n\n Press [1] to EXIT: ");
do
{
scanf("%d", &choice);
if ((choice != 1))
{
printf("\n Please enter a valid choice: ");
fflush(stdin);
}
} while ((choice != 1));
printf("\n\n\n\n\n\n\n\n");
}
int main()
{
int MMchoice; // choice to be inputted in the Main Menu
int *MMchoiceptr; // pointer to MMchoice
MMchoiceptr = &MMchoice;
do
{
printf("\n\n\n\n\n\n");
MainMenu(MMchoiceptr); // calls main menu function, void
if ((MMchoice == 1) || (MMchoice == 2)) // player chooses to play the game or how to play the game
{
if (MMchoice == 1) // player chooses to play the game
GameBody(); // calls game body
else // player chooses to know how to play the game
how_to_play();
}
} while (MMchoice != 1 && MMchoice != 3);
return 0;
}
| 35.695502 | 172 | 0.47373 |
41bef034fb2739f5c7af1388f39bea7f1743797d | 2,441 | h | C | PhotosUICore.framework/PXUIViewControllerTransition.h | reels-research/iOS-Private-Frameworks | 9a4f4534939310a51fdbf5a439dd22487efb0f01 | [
"MIT"
] | 4 | 2021-10-06T12:15:26.000Z | 2022-02-21T02:26:00.000Z | PhotosUICore.framework/PXUIViewControllerTransition.h | reels-research/iOS-Private-Frameworks | 9a4f4534939310a51fdbf5a439dd22487efb0f01 | [
"MIT"
] | null | null | null | PhotosUICore.framework/PXUIViewControllerTransition.h | reels-research/iOS-Private-Frameworks | 9a4f4534939310a51fdbf5a439dd22487efb0f01 | [
"MIT"
] | 1 | 2021-10-08T07:40:53.000Z | 2021-10-08T07:40:53.000Z | /* Generated by RuntimeBrowser
Image: /System/Library/PrivateFrameworks/PhotosUICore.framework/PhotosUICore
*/
@interface PXUIViewControllerTransition : NSObject <UIViewControllerAnimatedTransitioning> {
id __pauseToken;
UIPercentDrivenInteractiveTransition * _interactionController;
bool _interactive;
UIViewController * _internalDetailViewController;
UIViewController * _internalMasterViewController;
PXRegionOfInterest * _masterRegionOfInterest;
long long _state;
bool _supportsEdgeSwipeBackGesture;
id /* block */ _transitionAnimationCompletionHandler;
id /* block */ _transitionAnimationStartHandler;
bool _transitioningToDetail;
}
@property (setter=_setPauseToken:, nonatomic, retain) id _pauseToken;
@property (readonly, copy) NSString *debugDescription;
@property (readonly, copy) NSString *description;
@property (nonatomic, readonly) UIViewController *detailViewController;
@property (readonly) unsigned long long hash;
@property (nonatomic, readonly) UIPercentDrivenInteractiveTransition *interactionController;
@property (getter=isInteractive, nonatomic, readonly) bool interactive;
@property (nonatomic, retain) PXRegionOfInterest *masterRegionOfInterest;
@property (nonatomic, readonly) UIViewController *masterViewController;
@property (nonatomic) long long state;
@property (readonly) Class superclass;
@property (nonatomic, readonly) bool supportsEdgeSwipeBackGesture;
@property (getter=isTransitioningToDetail, nonatomic) bool transitioningToDetail;
+ (bool)isTransitionSupportedWithMasterViewController:(id)arg1 detailViewController:(id)arg2;
- (void).cxx_destruct;
- (id)_pauseToken;
- (void)_setPauseToken:(id)arg1;
- (void)animateTransition:(id)arg1;
- (id)detailViewController;
- (void)didEndTransition;
- (id)init;
- (id)initWithMasterViewController:(id)arg1 detailViewController:(id)arg2;
- (void)installTransitionAnimationCompletionHandler:(id /* block */)arg1;
- (void)installTransitionAnimationStartHandler:(id /* block */)arg1;
- (id)interactionController;
- (bool)isInteractive;
- (bool)isTransitioningToDetail;
- (id)masterRegionOfInterest;
- (id)masterViewController;
- (void)setMasterRegionOfInterest:(id)arg1;
- (void)setState:(long long)arg1;
- (void)setTransitioningToDetail:(bool)arg1;
- (long long)state;
- (bool)supportsEdgeSwipeBackGesture;
- (double)transitionDuration:(id)arg1;
- (void)willEndTransition;
- (void)willStartTransition;
@end
| 40.683333 | 93 | 0.799672 |
70a92a541d7981c614c370e5cd8bb5318dd4e5ce | 2,103 | c | C | IntroCompSci1/activities/42jogoDaVelha.c | LTKills/College | 8f72905f064effd31a712141cfaeda0021390ae8 | [
"MIT"
] | null | null | null | IntroCompSci1/activities/42jogoDaVelha.c | LTKills/College | 8f72905f064effd31a712141cfaeda0021390ae8 | [
"MIT"
] | 1 | 2016-04-12T18:55:20.000Z | 2016-04-12T18:55:55.000Z | IntroCompSci1/activities/42jogoDaVelha.c | LTKills/College | 8f72905f064effd31a712141cfaeda0021390ae8 | [
"MIT"
] | null | null | null | /*
* =====================================================================================
*
* Filename: 42jogoDaVelha.c
*
* Description: Jogo da velha
*
* Version: 1.0
* Created: 04/28/16 16:13:46
* Revision: none
* Compiler: gcc
*
* Author: LTKills
* Organization: USP
*
* =====================================================================================
*/
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char* argv[]){
char tab[3][3];
char check[3];
int i, j, m, n, k;
// transformando a porra toda em -1 (hehe)
for(i = 0; i < 3; i++){
for(j = 0; j < 3; j++){
tab[i][j] = -1;
}
}
for(i = 0; i < 3; i++){ // invalidando todos os elementos de check
check[i] = -1;
}
// recebendo jogadas... imprimindo resultados
for(k = 0; k < 9; k++){
scanf("%d %d", &m, &n);
if(k % 2 == 0) tab[m][n] = 'X'; // X para o jogador 0
else tab[m][n] = 'G'; // G para o jogador 1
// checando vencedores nas linhas
for(i = 0; i < 3; i++){
for(j = 0; j < 3; j++){
check[j] = tab[i][j];
}
if(check[0] == 'X' && check[1] == 'X' && check[2] == 'X'){
printf("0\n");
return 0;
}else if(check[0] == 'G' && check[1] == 'G' && check[2] == 'G'){
printf("1\n");
return 0;
}
}
// checando vencedores nas colunas
for(j = 0; j < 3; j++){
for(i = 0; i < 3; i++){
check[i] = tab[i][j];
}
if(check[0] == 'X' && check[1] == 'X' && check[2] == 'X'){
printf("0\n");
return 0;
}else if(check[0] == 'G' && check[1] == 'G' && check[2] == 'G'){
printf("1\n");
return 0;
}
}
// checando vencedores nas diagonais
if(tab[0][0] == 'X' && tab[1][1] == 'X' && tab[2][2] == 'X'){
printf("0\n");
return 0;
}else if(tab[2][0] == 'X' && tab[1][1] == 'X' && tab[0][2] == 'X'){
printf("0\n");
return 0;
}
if(tab[0][0] == 'G' && tab[1][1] == 'G' && tab[2][2] == 'G'){
printf("1\n");
return 0;
}else if(tab[2][0] == 'G' && tab[1][1] == 'G' && tab[0][2] == 'G'){
printf("1\n");
return 0;
}
}
printf("empate\n");
return 0;
}
| 23.10989 | 88 | 0.413219 |
279ca3df394b1461edea2c3d9997999b5196e5d9 | 1,484 | c | C | kernel/kernel/imps/imps.c | eyadhamdan4/xMach | 38272d98114715a10e77c2c014e16c9782f7807c | [
"BSD-3-Clause"
] | 32 | 2015-02-02T06:45:21.000Z | 2022-01-24T05:30:29.000Z | kernel/kernel/imps/imps.c | eyadhamdan4/xMach | 38272d98114715a10e77c2c014e16c9782f7807c | [
"BSD-3-Clause"
] | 4 | 2015-02-28T20:56:54.000Z | 2022-01-04T07:40:17.000Z | kernel/kernel/imps/imps.c | eyadhamdan4/xMach | 38272d98114715a10e77c2c014e16c9782f7807c | [
"BSD-3-Clause"
] | 8 | 2015-02-15T11:32:02.000Z | 2021-06-08T00:55:06.000Z | /*
* Copyright (c) 1994 The University of Utah and
* the Computer Systems Laboratory at the University of Utah (CSL).
* All rights reserved.
*
* Permission to use, copy, modify and distribute this software is hereby
* granted provided that (1) source code retains these copyright, permission,
* and disclaimer notices, and (2) redistributions including binaries
* reproduce the notices in supporting documentation, and (3) all advertising
* materials mentioning features or use of this software display the following
* acknowledgement: ``This product includes software developed by the
* Computer Systems Laboratory at the University of Utah.''
*
* THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
* IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
* ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* CSL requests users of this software to return to csl-dist@cs.utah.edu any
* improvements that they make and grant CSL redistribution rights.
*
* Author: Bryan Ford, University of Utah CSL
*/
#include <mach/kern_return.h>
void
interrupt_processor(int which_cpu)
{
panic("interrupt_processor");
}
void
start_other_cpus()
{
printf("start other CPUs please!!!\n");
}
kern_return_t
cpu_control(int cpu, int *info, int count)
{
printf("cpu_control %d\n", cpu);
return KERN_FAILURE;
}
kern_return_t
cpu_start(int cpu)
{
printf("cpu_start %d\n", cpu);
return KERN_FAILURE;
}
| 28.538462 | 79 | 0.752022 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.