text stringlengths 4 6.14k |
|---|
/*
* Hex.h
*
* Created on: Nov 16, 2013
* Author: count zero
*/
#ifndef HEX_H_
#define HEX_H_
#include "Graph.h"
#include <sstream>
using std::stringstream;
class Hex {
public:
Hex();
virtual ~Hex();
void DrawGraph();
bool Winner();
void ReadInputs();
stringstream hex_board;
Graph board;
stringstream fill_line;
State winner;
private:
vector<char> direction_characters;
vector<char> state_characters;
};
#endif /* HEX_H_ */
|
#pragma once
#include <wchar.h>
#if !defined(THCRAP_I18N_DONTALIAS) && defined(THCRAP_I18N_APPDOMAIN)
#define _(s) (i18n_w(THCRAP_I18N_APPDOMAIN, s))
#define C_(c,s) (i18n_wp(THCRAP_I18N_APPDOMAIN, c, s))
#define N_(s,p,n) (i18n_wn(THCRAP_I18N_APPDOMAIN, s, p, n))
#define NC_(c,s,p,n) (i18n_wpn(THCRAP_I18N_APPDOMAIN, c, s, p, n))
#define _A(s) (i18n_(THCRAP_I18N_APPDOMAIN, s))
#define C_A(c,s) (i18n_p(THCRAP_I18N_APPDOMAIN, c, s))
#define N_A(s,p,n) (i18n_n(THCRAP_I18N_APPDOMAIN, s, p, n))
#define NC_A(c,s,p,n) (i18n_pn(THCRAP_I18N_APPDOMAIN, c, s, p, n))
#endif
/**
* Naming for the functions
* i18n_[w][n][p]
* w - wide
* n - plurals
* p - context
*/
#ifdef __cplusplus
extern "C" {
#endif
#ifdef THCRAP_I18N_DISABLE
#define i18n_translate(d,c,s,p,n) (((n)==1)?(s):(p))
#define i18n_translate_wide(d,c,s,p,n) (((n)==1)?(s):(p))
#define i18n_load_narrow(domain)
#define i18n_load_wide(domain)
#define i18n_load_narrow_only(domain)
#define i18n_load_wide_only(domain)
#define i18n_langid() "en"
#define i18n_lang_selector(domain)
#define i18n_lang_init(domain)
#define i18n_lang_init_quiet()
#else
/*** translation functions ***/
const char *i18n_translate(const char *domain, const char *s, const char *def_s, const char *def_p, unsigned long num);
const wchar_t *i18n_translate_wide(const char *domain, const wchar_t *s, const wchar_t *def_s, const wchar_t *def_p, unsigned long num);
/*** explicit domain loading functions ***/
/**
* Loads and selects a given domain.
* First call to any of the translation functions will implicitly do this.
*/
void i18n_load_narrow(const char *domain);
void i18n_load_wide(const char *domain);
/**
* Loads domain, and preemptively forbids conversion to wide.
*/
void i18n_load_narrow_only(const char *domain);
/**
* Loads domain, converts it to wide, and then frees the narrow strings.
* This function is not thread-safe. If a narrow translation func gets called
* on the same domain while it's being freed, bad stuff happens.
*/
void i18n_load_wide_only(const char *domain);
/*** language functions ***/
const char* i18n_langid();
void i18n_lang_selector(const char *domain);
void i18n_lang_init(const char *domain);
void i18n_lang_init_quiet();
#endif
#define THCRAP_I18N_CTXSEP "\f"
#define THCRAP_I18N_CTXSEPW L"\f"
#define i18n_(d,s) i18n_translate(d,s,s,s,ULONG_MAX)
#define i18n_p(d,c,s) i18n_translate(d,c THCRAP_I18N_CTXSEP s,s,s,ULONG_MAX)
#define i18n_n(d,s,p,n) i18n_translate(d,s,s,p,n)
#define i18n_pn(d,c,s,p,n) i18n_translate(d,c THCRAP_I18N_CTXSEP s,s,p,n)
#define i18n_w(d,s) i18n_translate_wide(d,s,s,s,ULONG_MAX)
#define i18n_wp(d,c,s) i18n_translate_wide(d,c THCRAP_I18N_CTXSEPW s,s,s,ULONG_MAX)
#define i18n_wn(d,s,p,n) i18n_translate_wide(d,s,s,p,n)
#define i18n_wpn(d,c,s,p,n) i18n_translate_wide(d,c THCRAP_I18N_CTXSEPW s,s,p,n)
#ifdef __cplusplus
}
#endif
|
/* _PDCLIB_initclocale( locale_t )
This file is part of the Public Domain C Library (PDCLib).
Permission is granted to use, modify, and / or redistribute at will.
*/
#ifndef REGTEST
#include "_PDCLIB_clocale.h"
#include "_PDCLIB_locale.h"
void _PDCLIB_initclocale( locale_t l )
{
// TODO: There will be more added here...
l->_WCType = _PDCLIB_wcinfo;
l->_WCTypeSize = _PDCLIB_wcinfo_size;
}
#endif
#ifdef TEST
#include <_PDCLIB_test.h>
int main()
{
return TEST_RESULTS;
}
#endif |
#include <core/Unsigned8.h>
#include <core/macro/define_opaque_type_alias.h>
#ifndef _core_whatwg_url_PercentEncodedByte
#define _core_whatwg_url_PercentEncodedByte ::core_whatwg_url::PercentEncodedByte
namespace core_whatwg_url {
_core_macro_define_opaque_type_alias(PercentEncodedByte, core::Unsigned8);
}
#endif
|
/*
* release.h
*/
#define VERSION 2
#define RELEASE 16
#define PATCH 0
#define BUILD 0
|
/* Copyright (C) 2017 haniu (niuhao.cn@gmail.com)
*
* 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.
*/
////////////////////////////////////////////////////////////
// import header files
////////////////////////////////////////////////////////////
#include <network/netif/tt_netif_group.h>
#include <algorithm/tt_algorithm_def.h>
////////////////////////////////////////////////////////////
// internal macro
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
// internal type
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
// extern declaration
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
// global variant
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
// interface declaration
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
// interface implementation
////////////////////////////////////////////////////////////
tt_result_t tt_netif_group_create(OUT tt_netif_group_t *group, IN tt_u32_t flag)
{
TT_ASSERT(group != NULL);
if (!TT_OK(tt_netif_group_create_ntv(&group->sys_group))) {
return TT_FAIL;
}
tt_list_init(&group->netif_list);
group->flag = flag;
return TT_SUCCESS;
}
void tt_netif_group_destroy(IN tt_netif_group_t *group)
{
tt_lnode_t *node;
TT_ASSERT(group != NULL);
tt_netif_group_destroy_ntv(&group->sys_group);
while ((node = tt_list_pop_head(&group->netif_list)) != NULL) {
tt_netif_destroy(TT_CONTAINER(node, tt_netif_t, node));
}
}
tt_result_t tt_netif_group_add(IN tt_netif_group_t *group,
IN OPT const tt_char_t *netif_name)
{
tt_netif_t *netif;
tt_u32_t idx;
TT_ASSERT(group != NULL);
if (netif_name == NULL) {
// todo: enum all netif name and add to group
return TT_FAIL;
}
netif = tt_netif_group_find(group, netif_name);
if (netif != NULL) {
TT_ERROR("netif[%s] already in group", netif_name);
return TT_E_EXIST;
}
if (!TT_OK(tt_netif_name2idx(netif_name, &idx))) {
#if 0
TT_ERROR("invalid interface name: %s", netif_name);
return TT_E_BADARG;
#else
idx = TT_POS_NULL;
#endif
}
netif = tt_netif_create(netif_name, idx);
if (netif == NULL) {
return TT_FAIL;
}
tt_list_push_tail(&group->netif_list, &netif->node);
return TT_SUCCESS;
}
void tt_netif_group_remove(IN tt_netif_group_t *group,
IN OPT const tt_char_t *netif_name)
{
tt_netif_t *netif;
TT_ASSERT(group != NULL);
if (netif_name != NULL) {
netif = tt_netif_group_find(group, netif_name);
if (netif != NULL) {
tt_list_remove(&netif->node);
tt_netif_destroy(netif);
}
} else {
tt_lnode_t *node;
while ((node = tt_list_pop_head(&group->netif_list)) != NULL) {
tt_netif_destroy(TT_CONTAINER(node, tt_netif_t, node));
}
}
}
void tt_netif_group_refresh_prepare(IN tt_netif_group_t *group)
{
tt_lnode_t *node;
TT_ASSERT(group != NULL);
node = tt_list_head(&group->netif_list);
while (node != NULL) {
tt_netif_t *netif = TT_CONTAINER(node, tt_netif_t, node);
node = node->next;
netif->internal_flag = 0;
tt_netif_refresh_prepare(netif);
}
}
tt_u32_t tt_netif_group_refresh_done(IN tt_netif_group_t *group)
{
tt_u32_t internal_flag = 0;
tt_lnode_t *node;
TT_ASSERT(group != NULL);
node = tt_list_head(&group->netif_list);
while (node != NULL) {
tt_netif_t *netif = TT_CONTAINER(node, tt_netif_t, node);
node = node->next;
tt_netif_refresh_done(netif);
internal_flag |= TT_NETIF_DIFF(netif->internal_flag);
}
return internal_flag;
}
void tt_netif_group_dump(IN tt_netif_group_t *group)
{
tt_lnode_t *node;
TT_ASSERT(group != NULL);
TT_INFO("network interface group: \n");
node = tt_list_head(&group->netif_list);
while (node != NULL) {
tt_netif_dump(TT_CONTAINER(node, tt_netif_t, node), " ");
node = node->next;
}
}
tt_netif_t *tt_netif_group_find(IN tt_netif_group_t *group,
IN const tt_char_t *netif_name)
{
tt_lnode_t *node;
node = tt_list_head(&group->netif_list);
while (node != NULL) {
tt_netif_t *netif = TT_CONTAINER(node, tt_netif_t, node);
node = node->next;
if (tt_strncmp(netif->name, netif_name, TT_NETIF_MAX_NAME_LEN) == 0) {
return netif;
}
}
return NULL;
}
|
// Measures the RAM read and write bandwidth
//
// Get the RAM badwith in us
LONGLONG GetRAM_Page_Fault(); |
#pragma once
#include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <stdint.h>
#include "mscorlib_System_ValueType1744280289.h"
#include "UnityEngine_UnityEngine_Color4194546905.h"
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.ColorBlock
struct ColorBlock_t508458230
{
public:
// UnityEngine.Color UnityEngine.UI.ColorBlock::m_NormalColor
Color_t4194546905 ___m_NormalColor_0;
// UnityEngine.Color UnityEngine.UI.ColorBlock::m_HighlightedColor
Color_t4194546905 ___m_HighlightedColor_1;
// UnityEngine.Color UnityEngine.UI.ColorBlock::m_PressedColor
Color_t4194546905 ___m_PressedColor_2;
// UnityEngine.Color UnityEngine.UI.ColorBlock::m_DisabledColor
Color_t4194546905 ___m_DisabledColor_3;
// System.Single UnityEngine.UI.ColorBlock::m_ColorMultiplier
float ___m_ColorMultiplier_4;
// System.Single UnityEngine.UI.ColorBlock::m_FadeDuration
float ___m_FadeDuration_5;
public:
inline static int32_t get_offset_of_m_NormalColor_0() { return static_cast<int32_t>(offsetof(ColorBlock_t508458230, ___m_NormalColor_0)); }
inline Color_t4194546905 get_m_NormalColor_0() const { return ___m_NormalColor_0; }
inline Color_t4194546905 * get_address_of_m_NormalColor_0() { return &___m_NormalColor_0; }
inline void set_m_NormalColor_0(Color_t4194546905 value)
{
___m_NormalColor_0 = value;
}
inline static int32_t get_offset_of_m_HighlightedColor_1() { return static_cast<int32_t>(offsetof(ColorBlock_t508458230, ___m_HighlightedColor_1)); }
inline Color_t4194546905 get_m_HighlightedColor_1() const { return ___m_HighlightedColor_1; }
inline Color_t4194546905 * get_address_of_m_HighlightedColor_1() { return &___m_HighlightedColor_1; }
inline void set_m_HighlightedColor_1(Color_t4194546905 value)
{
___m_HighlightedColor_1 = value;
}
inline static int32_t get_offset_of_m_PressedColor_2() { return static_cast<int32_t>(offsetof(ColorBlock_t508458230, ___m_PressedColor_2)); }
inline Color_t4194546905 get_m_PressedColor_2() const { return ___m_PressedColor_2; }
inline Color_t4194546905 * get_address_of_m_PressedColor_2() { return &___m_PressedColor_2; }
inline void set_m_PressedColor_2(Color_t4194546905 value)
{
___m_PressedColor_2 = value;
}
inline static int32_t get_offset_of_m_DisabledColor_3() { return static_cast<int32_t>(offsetof(ColorBlock_t508458230, ___m_DisabledColor_3)); }
inline Color_t4194546905 get_m_DisabledColor_3() const { return ___m_DisabledColor_3; }
inline Color_t4194546905 * get_address_of_m_DisabledColor_3() { return &___m_DisabledColor_3; }
inline void set_m_DisabledColor_3(Color_t4194546905 value)
{
___m_DisabledColor_3 = value;
}
inline static int32_t get_offset_of_m_ColorMultiplier_4() { return static_cast<int32_t>(offsetof(ColorBlock_t508458230, ___m_ColorMultiplier_4)); }
inline float get_m_ColorMultiplier_4() const { return ___m_ColorMultiplier_4; }
inline float* get_address_of_m_ColorMultiplier_4() { return &___m_ColorMultiplier_4; }
inline void set_m_ColorMultiplier_4(float value)
{
___m_ColorMultiplier_4 = value;
}
inline static int32_t get_offset_of_m_FadeDuration_5() { return static_cast<int32_t>(offsetof(ColorBlock_t508458230, ___m_FadeDuration_5)); }
inline float get_m_FadeDuration_5() const { return ___m_FadeDuration_5; }
inline float* get_address_of_m_FadeDuration_5() { return &___m_FadeDuration_5; }
inline void set_m_FadeDuration_5(float value)
{
___m_FadeDuration_5 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Native definition for marshalling of: UnityEngine.UI.ColorBlock
struct ColorBlock_t508458230_marshaled_pinvoke
{
Color_t4194546905_marshaled_pinvoke ___m_NormalColor_0;
Color_t4194546905_marshaled_pinvoke ___m_HighlightedColor_1;
Color_t4194546905_marshaled_pinvoke ___m_PressedColor_2;
Color_t4194546905_marshaled_pinvoke ___m_DisabledColor_3;
float ___m_ColorMultiplier_4;
float ___m_FadeDuration_5;
};
// Native definition for marshalling of: UnityEngine.UI.ColorBlock
struct ColorBlock_t508458230_marshaled_com
{
Color_t4194546905_marshaled_com ___m_NormalColor_0;
Color_t4194546905_marshaled_com ___m_HighlightedColor_1;
Color_t4194546905_marshaled_com ___m_PressedColor_2;
Color_t4194546905_marshaled_com ___m_DisabledColor_3;
float ___m_ColorMultiplier_4;
float ___m_FadeDuration_5;
};
|
/*
* InsightIteration.h
*
* Created on: Jan 30, 2014
* Author: jan
*/
#ifndef INSIGHTITERATION_H_
#define INSIGHTITERATION_H_
#include "ParticleEvaluatorInsight.h"
#include "ParticleSampler.h"
#include "ParticleSet.h"
#include "IterationLogger.h"
namespace INSIGHTv3 {
class InsightIteration {
public:
InsightIteration(sampler_ptr prior_sampler);
virtual ~InsightIteration();
virtual void doIteration(int num_particles, int num_parameters, sampler_ptr sampler, evaluator_ptr evaluator,
ParticleSet* particle_set, IterationLogger* logger);
private:
sampler_ptr _prior_sampler;
};
} /* namespace INSIGHTv3 */
#endif /* INSIGHTITERATION_H_ */
|
//
// ViewController.h
// HypnoNerd
//
// Created by 张苗 on 5/7/16.
// Copyright © 2016 张苗. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@end
|
/*
* This program finds the longest common prefix string for an array or list
* of strings. For more iformation on the problem, please refer to the
* following link:- http://www.geeksforgeeks.org/longest-common-prefix-set-1-word-by-word-matching/
*/
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<assert.h>
#include<limits.h>
/*
* This function returns the longest common prefix string for the list of
* string. If this is no common prefix string, then this function returns
* NULL. The time complexity of this function is O(m * n), where 'm' is the
* number of string and 'n' is the maximum length of the string in this
* list of strings. The space complexity of this function is O(p), where
* 'p' is the length of the shortest length of the string in this list of
* strings.
*/
char* longestCommonPrefix(char** strs, int len)
{
int index;
int min_len, common_prefix_index;
char* common_prefix = NULL;
/*
* If the array of string is empty or its length is
* invalid, then return NULL as the longest common
* prefix
*/
if (!strs || (len <= 0)) {
return(NULL);
}
/*
* Find the minimum length of a string among the list
* of strings
*/
min_len = INT_MAX;
for (index = 0; index < len; ++index) {
if (!strs[index]) {
min_len = 0;
} else {
if (min_len > strlen(strs[index])) {
min_len = strlen(strs[index]);
}
}
}
/*
* If the minimum length of the string is found to be zero,
* then return NULL
*/
if (min_len == 0) {
return(NULL);
}
/*
* Allocate a string which can store 'min_len' characters
*/
common_prefix = (char*)malloc(sizeof(char) * (min_len + 1));
/*
* If the memory alloation fails, then return NULL
*/
if (!common_prefix) {
return(NULL);
}
/*
* Set the allocated memory to zero
*/
memset(common_prefix, 0, sizeof(char) * (min_len + 1));
/*
* Iterate over the number of characters in the smallest
* string among the list of strings
*/
for (common_prefix_index = 0; common_prefix_index < min_len;
++common_prefix_index) {
/*
* Iterate over all the strings to check if the character
* at index position 'common_prefix_index' is same in all
* the strings
*/
for (index = 1; index < len; ++index) {
if (strs[index - 1][common_prefix_index] !=
strs[index][common_prefix_index]) {
break;
}
}
if (index < len) {
/*
* If the character at at index position is not same in all
* the strings, then we have found the longest common prefix.
* Break from the loop.
*/
break;
} else {
/*
* Otherwise set the common character in the longest common
* prefix string
*/
common_prefix[common_prefix_index] =
strs[0][common_prefix_index];
}
}
if (!common_prefix_index) {
/*
* If there were no common prefix characers found in the string
* then free the allocated string and return NULL
*/
free(common_prefix);
return(NULL);
}
/*
* Return the longest common prefix string
*/
return(common_prefix);
}
int main ()
{
/*
* Test 0: Test when the list of strings is empty. The longest
* common prefix string should be NULL.
*/
char* list0[] = {};
int len0 = sizeof(list0)/sizeof(char*);
assert(NULL == longestCommonPrefix(list0, len0));
/*
* Test 1: Test the case when there is only one string in the
* list of strings. The longest common prefix string should
* be the only string itself.
*/
char* list1[] = {"abc"};
int len1 = sizeof(list1)/sizeof(char*);
assert(strcmp("abc", longestCommonPrefix(list1, len1)) == 0);
/*
* Test 2: Test the case when there are multiple string and there
* exists a longest common prefix string. The longest common
* prefix string returned should be non-NULL.
*/
char* list2[] = {"abc", "abcd", "abef", "abdc"};
int len2 = sizeof(list2)/sizeof(char*);
assert(strcmp("ab", longestCommonPrefix(list2, len2)) == 0);
/*
* Test 3: Test the case when there are multiple string and there
* doesn't exist a longest common prefix string. The longest
* common prefix string returned should be NULL.
*/
char* list3[] = {"bc", "bcd", "abef", "abdc"};
int len3 = sizeof(list3)/sizeof(char*);
assert(NULL == longestCommonPrefix(list3, len3));
/*
* Test 4: Test the case when there are multiple string all the strings
* are same. The longest common prefix string returned should
* be non-NULL and equal to one of the strings.
*/
char* list4[] = {"abcd", "abcd", "abcd", "abcd", "abcd", "abcd"};
int len4 = sizeof(list4)/sizeof(char*);
assert(strcmp(list4[0], longestCommonPrefix(list4, len4)) == 0);
/*
* Test 5: Test the case when there are multiple string and there
* exist a NULL string among these list of strings. The
* longest common prefix string returned should be NULL.
*/
char* list5[] = {"bc", NULL, "abef", "abdc"};
int len5 = sizeof(list5)/sizeof(char*);
assert(NULL == longestCommonPrefix(list5, len5));
/*
* Test 6: Test the case when there are multiple string and there
* exist an empty string among these list of strings. The
* longest common prefix string returned should be NULL.
*/
char* list6[] = {"bc", "", "abef", "abdc"};
int len6 = sizeof(list6)/sizeof(char*);
assert(NULL == longestCommonPrefix(list6, len6));
return(0);
}
|
/* test.c */
#include "test.h"
#include "mongo.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#ifndef SEED_START_PORT
#define SEED_START_PORT 30000
#endif
int test_connect( const char* set_name ) {
mongo_connection conn[1];
int res;
INIT_SOCKETS_FOR_WINDOWS;
mongo_replset_init_conn( conn, set_name );
mongo_replset_add_seed( conn, TEST_SERVER, SEED_START_PORT );
mongo_replset_add_seed( conn, TEST_SERVER, SEED_START_PORT + 1 );
if( res = mongo_replset_connect( conn ) ) {
mongo_destroy( conn );
return res;
}
else {
mongo_disconnect( conn );
return mongo_reconnect( conn );
}
}
int test_reconnect( const char* set_name ) {
mongo_connection conn[1];
int res;
int e = 0;
bson b;
INIT_SOCKETS_FOR_WINDOWS;
mongo_replset_init_conn( conn, set_name );
mongo_replset_add_seed( conn, TEST_SERVER, SEED_START_PORT );
mongo_replset_add_seed( conn, TEST_SERVER, SEED_START_PORT + 1 );
if( res = mongo_replset_connect( conn ) ) {
mongo_destroy( conn );
return res;
}
else {
fprintf( stderr, "Disconnect now:\n");
sleep( 10 );
do {
MONGO_TRY {
e = 1;
res = mongo_find_one( conn, "foo.bar", bson_empty(&b), bson_empty(&b), NULL);
e = 0;
} MONGO_CATCH {
sleep( 2 );
if( e++ < 30) {
fprintf( stderr, "Attempting reconnect %d.\n", e);
mongo_reconnect( conn );
} else {
fprintf( stderr, "Fail.\n");
return -1;
}
}
} while(e);
}
return 0;
}
int main() {
ASSERT( test_connect( "test-rs" ) == 0 );
ASSERT( test_connect( "test-foobar" ) == mongo_conn_bad_set_name );
/* Run this for testing failover.
ASSERT( test_reconnect( "test-rs" ) == 0 );
*/
return 0;
}
|
//
// Created by zhangrongxiang on 2018/1/16 10:24
// File 6
//
#include <stdio.h>
//打印输入中单词长度的直方图。水平方向的直方图比较容易绘制,垂直方向的直方图则要困难写。
#define MAXHIST 15
#define MAXWORD 11
int word_stats(int wl[]) {
int flag;
int c, nc, i, ovflow;
flag = 0;
nc = 0;
ovflow = 0;
for (i = 0; i < MAXWORD; i++)
wl[i] = 0;
while ((c = getchar()) != EOF) {
if (c == ' ' || c == '\n' || c == '\t') {
if (flag) {
flag = 0;
// if(nc>0)
if (nc < MAXWORD)
wl[nc]++;
else
ovflow++;
nc = 0;
}
} else if (!flag) {
flag = 1;
nc = 1;
} else
nc++;
}
return ovflow;
}
void hist_h(int wl[]) {
int i;
int maxvlaue = 0;
int len;
for (i = 1; i < MAXWORD; i++)
if (wl[i] > maxvlaue)
maxvlaue = wl[i];
for (i = 1; i < MAXWORD; ++i) {
printf("%5d - %5d :", i, wl[i]);
if (wl[i] > 0) {
if ((len = wl[i] * MAXHIST / maxvlaue) <= 0)
len = 1;
} else
len = 0;
while (len > 0) {
putchar('*');
len--;
}
putchar('\n');
}
}
void hist_v(int wl[]) {
int i, j;
int maxvlaue = 0;
int len;
for (i = 1; i < MAXWORD; i++)
if (wl[i] > maxvlaue)
maxvlaue = wl[i];
for (i = MAXHIST; i > 0; i--) {
for (j = 1; j < MAXWORD; j++)
if (wl[j] * MAXHIST / maxvlaue >= i)
printf(" * ");
else
printf(" ");
putchar('\n');
}
for (i = 1; i < MAXWORD; i++)
printf("%4d ", i);
putchar('\n');
for (i = 1; i < MAXWORD; i++)
printf("%4d ", wl[i]);
putchar('\n');
}
int main() {
int wl[MAXWORD];
int ovflow;
ovflow = word_stats(wl);
hist_h(wl);
hist_v(wl);
if (ovflow)
printf("Overflow: %d\n", ovflow);
} |
#ifndef REALJOY_H
#define REALJOY_H
#define LJOYMASK 0x01
#define RJOYMASK 0x02
#define UJOYMASK 0x04
#define DJOYMASK 0x08
#define B1JOYMASK 0x10
#define B2JOYMASK 0x20
/* This should be called from xxx_keyb.c */
int
get_realjoy(int stick);
/* This should be called once per frame */
void
update_realjoy(void);
/* These can be called from anywhere. */
void
calibrate_realjoy(int stick);
void
init_realjoy(void);
void
close_realjoy(void);
#endif
|
/*
* Copyright (c) 2010 Yahoo! Inc. All rights reserved. Licensed under
* the Apache License, Version 2.0 (the "License"); you may not use
* this file except in compliance with the License. You may obtain a
* copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License. See accompanying
* LICENSE file.
*
* $Id$
*/
#ifndef _CL_ZKEXEPTIONS_H_
#define _CL_ZKEXEPTIONS_H_
namespace zk {
/**
* Generic exception for the Zookeeper namespace.
*/
class Exception
: public clusterlib::Exception
{
public:
/**
* Constructor.
*/
explicit Exception(const std::string &msg) throw()
: clusterlib::Exception(msg),
m_errorCode(0),
m_connected(true) {}
/**
* Constructor.
*/
Exception(const std::string &msg,
int32_t errorCode,
bool connected) throw()
: clusterlib::Exception(msg),
m_errorCode(errorCode),
m_connected(connected) {}
/**
* Returns the error code.
*/
int32_t getErrorCode() const
{
return m_errorCode;
}
/**
* \brief Returns whether the cause of the exception is that
* the ZooKeeper connection is disconnected.
*/
bool isConnected()
{
return m_connected;
}
private:
/**
* Saved error code.
*/
int32_t m_errorCode;
/**
* Whether the connection is open.
*/
bool m_connected;
};
/**
* Zookeeper internals are in an inconsistent state
*/
class InconsistentInternalStateException
: public Exception
{
public:
/**
* Constructor.
*/
explicit InconsistentInternalStateException(
const std::string &msg) throw()
: Exception(msg) {}
};
/**
* Invalid arguments given to a zookeeper member function.
*/
class InvalidArgumentsException
: public Exception
{
public:
/**
* Constructor.
*/
explicit InvalidArgumentsException(const std::string &msg) throw()
: Exception(msg) {}
};
/**
* Invalid zookeeper method called (should not have called this method).
*/
class InvalidMethodException
: public Exception
{
public:
/**
* Constructor.
*/
explicit InvalidMethodException(const std::string &msg) throw()
: Exception(msg) {}
};
/**
* System failure (i.e. gethostname, pthread_self, etc)
*/
class SystemFailureException
: public Exception
{
public:
/**
* Constructor.
*/
explicit SystemFailureException(const std::string &msg) throw()
: Exception(msg) {}
};
/**
* Client doesn't have permission to this ZooKeeper node.
*/
class NoAuthException
: public Exception
{
public:
/**
* Constructor
*/
NoAuthException(const std::string &msg,
int32_t errorCode,
bool connected)
: Exception(msg, errorCode, connected) {}
};
/**
* Node doesn't exist that the client is trying to access.
*/
class NoNodeExistsException
: public Exception
{
public:
/**
* Constructor.
*/
NoNodeExistsException(const std::string &msg,
int32_t errorCode,
bool connected)
: Exception(msg, errorCode, connected) {}
};
/**
* There was a version mismatch when trying to set a node.
*/
class BadVersionException
: public Exception
{
public:
/**
* Constructor.
*/
BadVersionException(const std::string &msg,
int32_t errorCode,
bool connected)
: Exception(msg, errorCode, connected) {}
};
/**
* Invalid state when trying to do the Zookeeper operation.
*/
class InvalidStateException
: public Exception
{
public:
/**
* Constructor.
*/
InvalidStateException(const std::string &msg,
int32_t errorCode,
bool connected)
: Exception(msg, errorCode, connected) {}
};
/**
* Unknown or unable to handle this error code.
*/
class UnknownErrorCodeException
: public Exception
{
public:
/**
* Constructor.
*/
UnknownErrorCodeException(const std::string &msg,
int32_t errorCode,
bool connected)
: Exception(msg, errorCode, connected) {}
};
} /* End of 'zk' */
#endif /* _CL_ZKEXEPTIONS_H_ */
|
/*=========================================================================
*
* Copyright Insight Software Consortium
*
* 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.txt
*
* 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 __itkScalarAnisotropicDiffusionFunction_h
#define __itkScalarAnisotropicDiffusionFunction_h
#include "itkAnisotropicDiffusionFunction.h"
namespace itk
{
/**
* \class ScalarAnisotropicDiffusionFunction
* This class forms the base for any anisotropic diffusion function that
* operates on scalar data (see itkAnisotropicDiffusionFunction). It provides
* some common functionality used in classes like
* CurvatureNDAnisotropicDiffusionFunction and
* GradientNDAnisotropicDiffusionFunction.
*
* \sa AnisotropicDiffusionFunction
* \sa AnisotropicDiffusionImageFilter
* \sa VectorAnisotropicDiffusionFunction
* \ingroup FiniteDifferenceFunctions
* \ingroup ImageEnhancement
* \ingroup ITKAnisotropicSmoothing
*/
template< class TImage >
class ScalarAnisotropicDiffusionFunction:
public AnisotropicDiffusionFunction< TImage >
{
public:
/** Standard class typedefs. */
typedef ScalarAnisotropicDiffusionFunction Self;
typedef AnisotropicDiffusionFunction< TImage > Superclass;
typedef SmartPointer< Self > Pointer;
typedef SmartPointer< const Self > ConstPointer;
/** Inherit some parameters from the superclass type. */
itkStaticConstMacro(ImageDimension, unsigned int,
Superclass::ImageDimension);
/** Inherit some parameters from the superclass type. */
typedef typename Superclass::ImageType ImageType;
typedef typename Superclass::PixelType PixelType;
typedef typename Superclass::PixelRealType PixelRealType;
typedef typename Superclass::RadiusType RadiusType;
typedef typename Superclass::NeighborhoodType NeighborhoodType;
typedef typename Superclass::TimeStepType TimeStepType;
/** Run-time type information (and related methods). */
itkTypeMacro(ScalarAnisotropicDiffusionFunction,
AnisotropicDiffusionFunction);
virtual void CalculateAverageGradientMagnitudeSquared(TImage *);
protected:
ScalarAnisotropicDiffusionFunction() {}
~ScalarAnisotropicDiffusionFunction() {}
private:
ScalarAnisotropicDiffusionFunction(const Self &); //purposely not implemented
void operator=(const Self &); //purposely not implemented
};
} // end namespace itk
#ifndef ITK_MANUAL_INSTANTIATION
#include "itkScalarAnisotropicDiffusionFunction.hxx"
#endif
#endif
|
//
// BSTitleButton.h
// BaiSiBuDeJie
//
// Created by 侯宝伟 on 15/11/10.
// Copyright © 2015年 ZHUNJIEE. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface BSTitleButton : UIButton
@end
|
// Copyright 2022 Google LLC
//
// 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
//
// https://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.
// Generated by the Codegen C++ plugin.
// If you make any local changes, they will be lost.
// source: google/cloud/functions/v1/functions.proto
#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_FUNCTIONS_INTERNAL_CLOUD_FUNCTIONS_METADATA_DECORATOR_H
#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_FUNCTIONS_INTERNAL_CLOUD_FUNCTIONS_METADATA_DECORATOR_H
#include "google/cloud/functions/internal/cloud_functions_stub.h"
#include "google/cloud/version.h"
#include <google/longrunning/operations.grpc.pb.h>
#include <memory>
#include <string>
namespace google {
namespace cloud {
namespace functions_internal {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
class CloudFunctionsServiceMetadata : public CloudFunctionsServiceStub {
public:
~CloudFunctionsServiceMetadata() override = default;
explicit CloudFunctionsServiceMetadata(
std::shared_ptr<CloudFunctionsServiceStub> child);
StatusOr<google::cloud::functions::v1::ListFunctionsResponse> ListFunctions(
grpc::ClientContext& context,
google::cloud::functions::v1::ListFunctionsRequest const& request)
override;
StatusOr<google::cloud::functions::v1::CloudFunction> GetFunction(
grpc::ClientContext& context,
google::cloud::functions::v1::GetFunctionRequest const& request) override;
future<StatusOr<google::longrunning::Operation>> AsyncCreateFunction(
google::cloud::CompletionQueue& cq,
std::unique_ptr<grpc::ClientContext> context,
google::cloud::functions::v1::CreateFunctionRequest const& request)
override;
future<StatusOr<google::longrunning::Operation>> AsyncUpdateFunction(
google::cloud::CompletionQueue& cq,
std::unique_ptr<grpc::ClientContext> context,
google::cloud::functions::v1::UpdateFunctionRequest const& request)
override;
future<StatusOr<google::longrunning::Operation>> AsyncDeleteFunction(
google::cloud::CompletionQueue& cq,
std::unique_ptr<grpc::ClientContext> context,
google::cloud::functions::v1::DeleteFunctionRequest const& request)
override;
StatusOr<google::cloud::functions::v1::CallFunctionResponse> CallFunction(
grpc::ClientContext& context,
google::cloud::functions::v1::CallFunctionRequest const& request)
override;
StatusOr<google::cloud::functions::v1::GenerateUploadUrlResponse>
GenerateUploadUrl(
grpc::ClientContext& context,
google::cloud::functions::v1::GenerateUploadUrlRequest const& request)
override;
StatusOr<google::cloud::functions::v1::GenerateDownloadUrlResponse>
GenerateDownloadUrl(
grpc::ClientContext& context,
google::cloud::functions::v1::GenerateDownloadUrlRequest const& request)
override;
StatusOr<google::iam::v1::Policy> SetIamPolicy(
grpc::ClientContext& context,
google::iam::v1::SetIamPolicyRequest const& request) override;
StatusOr<google::iam::v1::Policy> GetIamPolicy(
grpc::ClientContext& context,
google::iam::v1::GetIamPolicyRequest const& request) override;
StatusOr<google::iam::v1::TestIamPermissionsResponse> TestIamPermissions(
grpc::ClientContext& context,
google::iam::v1::TestIamPermissionsRequest const& request) override;
future<StatusOr<google::longrunning::Operation>> AsyncGetOperation(
google::cloud::CompletionQueue& cq,
std::unique_ptr<grpc::ClientContext> context,
google::longrunning::GetOperationRequest const& request) override;
future<Status> AsyncCancelOperation(
google::cloud::CompletionQueue& cq,
std::unique_ptr<grpc::ClientContext> context,
google::longrunning::CancelOperationRequest const& request) override;
private:
void SetMetadata(grpc::ClientContext& context,
std::string const& request_params);
void SetMetadata(grpc::ClientContext& context);
std::shared_ptr<CloudFunctionsServiceStub> child_;
std::string api_client_header_;
};
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
} // namespace functions_internal
} // namespace cloud
} // namespace google
#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_FUNCTIONS_INTERNAL_CLOUD_FUNCTIONS_METADATA_DECORATOR_H
|
//
// FuViewController.h
// PrisonerFitnessRecord
//
// Created by dong on 2018/3/28.
// Copyright © 2018年 董永胜. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface FuViewController : UIViewController
@end
|
/* $NetBSD: bench_http.c,v 1.1.1.1.6.1 2014/12/24 00:05:26 riz Exp $ */
/*
* Copyright 2008-2012 Niels Provos and Nick Mathewson
*
* 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.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <sys/types.h>
#include <sys/stat.h>
#ifdef _WIN32
#include <winsock2.h>
#else
#include <sys/socket.h>
#include <sys/resource.h>
#include <sys/time.h>
#include <unistd.h>
#endif
#include <fcntl.h>
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include "event2/event.h"
#include "event2/buffer.h"
#include "event2/util.h"
#include "event2/http.h"
#include "event2/thread.h"
static void http_basic_cb(struct evhttp_request *req, void *arg);
static char *content;
static size_t content_len = 0;
static void
http_basic_cb(struct evhttp_request *req, void *arg)
{
struct evbuffer *evb = evbuffer_new();
evbuffer_add(evb, content, content_len);
/* allow sending of an empty reply */
evhttp_send_reply(req, HTTP_OK, "Everything is fine", evb);
evbuffer_free(evb);
}
#if LIBEVENT_VERSION_NUMBER >= 0x02000200
static void
http_ref_cb(struct evhttp_request *req, void *arg)
{
struct evbuffer *evb = evbuffer_new();
evbuffer_add_reference(evb, content, content_len, NULL, NULL);
/* allow sending of an empty reply */
evhttp_send_reply(req, HTTP_OK, "Everything is fine", evb);
evbuffer_free(evb);
}
#endif
int
main(int argc, char **argv)
{
struct event_config *cfg = event_config_new();
struct event_base *base;
struct evhttp *http;
int i;
int c;
int use_iocp = 0;
unsigned short port = 8080;
char *endptr = NULL;
#ifdef _WIN32
WSADATA WSAData;
WSAStartup(0x101, &WSAData);
#else
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR)
return (1);
#endif
for (i = 1; i < argc; ++i) {
if (*argv[i] != '-')
continue;
c = argv[i][1];
if ((c == 'p' || c == 'l') && i + 1 >= argc) {
fprintf(stderr, "-%c requires argument.\n", c);
exit(1);
}
switch (c) {
case 'p':
if (i+1 >= argc || !argv[i+1]) {
fprintf(stderr, "Missing port\n");
exit(1);
}
port = (int)strtol(argv[i+1], &endptr, 10);
if (*endptr != '\0') {
fprintf(stderr, "Bad port\n");
exit(1);
}
break;
case 'l':
if (i+1 >= argc || !argv[i+1]) {
fprintf(stderr, "Missing content length\n");
exit(1);
}
content_len = (size_t)strtol(argv[i+1], &endptr, 10);
if (*endptr != '\0' || content_len == 0) {
fprintf(stderr, "Bad content length\n");
exit(1);
}
break;
#ifdef _WIN32
case 'i':
use_iocp = 1;
evthread_use_windows_threads();
event_config_set_flag(cfg,EVENT_BASE_FLAG_STARTUP_IOCP);
break;
#endif
default:
fprintf(stderr, "Illegal argument \"%c\"\n", c);
exit(1);
}
}
base = event_base_new_with_config(cfg);
if (!base) {
fprintf(stderr, "creating event_base failed. Exiting.\n");
return 1;
}
http = evhttp_new(base);
content = malloc(content_len);
if (content == NULL) {
fprintf(stderr, "Cannot allocate content\n");
exit(1);
} else {
int i = 0;
for (i = 0; i < (int)content_len; ++i)
content[i] = (i & 255);
}
evhttp_set_cb(http, "/ind", http_basic_cb, NULL);
fprintf(stderr, "/ind - basic content (memory copy)\n");
evhttp_set_cb(http, "/ref", http_ref_cb, NULL);
fprintf(stderr, "/ref - basic content (reference)\n");
fprintf(stderr, "Serving %d bytes on port %d using %s\n",
(int)content_len, port,
use_iocp? "IOCP" : event_base_get_method(base));
evhttp_bind_socket(http, "0.0.0.0", port);
#ifdef _WIN32
if (use_iocp) {
struct timeval tv={99999999,0};
event_base_loopexit(base, &tv);
}
#endif
event_base_dispatch(base);
#ifdef _WIN32
WSACleanup();
#endif
/* NOTREACHED */
return (0);
}
|
/*
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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 <aws/cloudsearch/CloudSearch_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSStreamFwd.h>
#include <aws/cloudsearch/model/IndexField.h>
#include <aws/cloudsearch/model/OptionStatus.h>
#include <utility>
namespace Aws
{
namespace Utils
{
namespace Xml
{
class XmlNode;
} // namespace Xml
} // namespace Utils
namespace CloudSearch
{
namespace Model
{
/**
* <p>The value of an <code>IndexField</code> and its current status.</p><p><h3>See
* Also:</h3> <a
* href="http://docs.aws.amazon.com/goto/WebAPI/cloudsearch-2013-01-01/IndexFieldStatus">AWS
* API Reference</a></p>
*/
class AWS_CLOUDSEARCH_API IndexFieldStatus
{
public:
IndexFieldStatus();
IndexFieldStatus(const Aws::Utils::Xml::XmlNode& xmlNode);
IndexFieldStatus& operator=(const Aws::Utils::Xml::XmlNode& xmlNode);
void OutputToStream(Aws::OStream& ostream, const char* location, unsigned index, const char* locationValue) const;
void OutputToStream(Aws::OStream& oStream, const char* location) const;
inline const IndexField& GetOptions() const{ return m_options; }
inline void SetOptions(const IndexField& value) { m_optionsHasBeenSet = true; m_options = value; }
inline void SetOptions(IndexField&& value) { m_optionsHasBeenSet = true; m_options = std::move(value); }
inline IndexFieldStatus& WithOptions(const IndexField& value) { SetOptions(value); return *this;}
inline IndexFieldStatus& WithOptions(IndexField&& value) { SetOptions(std::move(value)); return *this;}
inline const OptionStatus& GetStatus() const{ return m_status; }
inline void SetStatus(const OptionStatus& value) { m_statusHasBeenSet = true; m_status = value; }
inline void SetStatus(OptionStatus&& value) { m_statusHasBeenSet = true; m_status = std::move(value); }
inline IndexFieldStatus& WithStatus(const OptionStatus& value) { SetStatus(value); return *this;}
inline IndexFieldStatus& WithStatus(OptionStatus&& value) { SetStatus(std::move(value)); return *this;}
private:
IndexField m_options;
bool m_optionsHasBeenSet;
OptionStatus m_status;
bool m_statusHasBeenSet;
};
} // namespace Model
} // namespace CloudSearch
} // namespace Aws
|
//
// Project Management
//
//
// Copyright (C) 2016 Peter Niekamp
//
#pragma once
#include "api.h"
//-------------------------- ProjectPlugin ----------------------------------
//---------------------------------------------------------------------------
class ProjectPlugin : public Studio::Plugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "ProjectPlugin" FILE "projectplugin.json")
Q_INTERFACES(Studio::Plugin)
public:
ProjectPlugin();
virtual ~ProjectPlugin();
bool initialise(QStringList const &arguments, QString *errormsg);
void shutdown();
protected:
void on_mainwindow_closing(bool *cancel);
protected slots:
void on_NewProject_triggered();
void on_OpenProject_triggered();
void on_SaveProject_triggered();
};
|
/*
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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 <aws/frauddetector/FraudDetector_EXPORTS.h>
namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;
namespace Utils
{
namespace Json
{
class JsonValue;
} // namespace Json
} // namespace Utils
namespace FraudDetector
{
namespace Model
{
class AWS_FRAUDDETECTOR_API DeleteDetectorVersionResult
{
public:
DeleteDetectorVersionResult();
DeleteDetectorVersionResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
DeleteDetectorVersionResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
};
} // namespace Model
} // namespace FraudDetector
} // namespace Aws
|
/* 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.
*/
#ifndef QTCMISLIB_GLOBAL_H
#define QTCMISLIB_GLOBAL_H
#include <QtCore/qglobal.h>
#if defined(QTCMISLIB_LIBRARY)
# define QTCMISLIBSHARED_EXPORT Q_DECL_EXPORT
#else
# define QTCMISLIBSHARED_EXPORT Q_DECL_IMPORT
#endif
#endif // QTCMISLIB_GLOBAL_H
|
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt_private.h"
/**
@file rsa_verify_hash.c
RSA PKCS #1 v1.5 or v2 PSS signature verification, Tom St Denis and Andreas Lange
*/
#ifdef LTC_MRSA
/**
PKCS #1 de-sign then v1.5 or PSS depad
@param sig The signature data
@param siglen The length of the signature data (octets)
@param hash The hash of the message that was signed
@param hashlen The length of the hash of the message that was signed (octets)
@param padding Type of padding (LTC_PKCS_1_PSS, LTC_PKCS_1_V1_5 or LTC_PKCS_1_V1_5_NA1)
@param hash_idx The index of the desired hash
@param saltlen The length of the salt used during signature
@param stat [out] The result of the signature comparison, 1==valid, 0==invalid
@param key The public RSA key corresponding to the key that performed the signature
@return CRYPT_OK on success (even if the signature is invalid)
*/
int rsa_verify_hash_ex(const unsigned char *sig, unsigned long siglen,
const unsigned char *hash, unsigned long hashlen,
int padding,
int hash_idx, unsigned long saltlen,
int *stat, const rsa_key *key)
{
unsigned long modulus_bitlen, modulus_bytelen, x;
int err;
unsigned char *tmpbuf;
LTC_ARGCHK(hash != NULL);
LTC_ARGCHK(sig != NULL);
LTC_ARGCHK(stat != NULL);
LTC_ARGCHK(key != NULL);
/* default to invalid */
*stat = 0;
/* valid padding? */
if ((padding != LTC_PKCS_1_V1_5) &&
(padding != LTC_PKCS_1_PSS) &&
(padding != LTC_PKCS_1_V1_5_NA1)) {
return CRYPT_PK_INVALID_PADDING;
}
if (padding != LTC_PKCS_1_V1_5_NA1) {
/* valid hash ? */
if ((err = hash_is_valid(hash_idx)) != CRYPT_OK) {
return err;
}
}
/* get modulus len in bits */
modulus_bitlen = mp_count_bits( (key->N));
/* outlen must be at least the size of the modulus */
modulus_bytelen = mp_unsigned_bin_size( (key->N));
if (modulus_bytelen != siglen) {
return CRYPT_INVALID_PACKET;
}
/* allocate temp buffer for decoded sig */
tmpbuf = XMALLOC(siglen);
if (tmpbuf == NULL) {
return CRYPT_MEM;
}
/* RSA decode it */
x = siglen;
if ((err = ltc_mp.rsa_me(sig, siglen, tmpbuf, &x, PK_PUBLIC, key)) != CRYPT_OK) {
XFREE(tmpbuf);
return err;
}
/* make sure the output is the right size */
if (x != siglen) {
XFREE(tmpbuf);
return CRYPT_INVALID_PACKET;
}
if (padding == LTC_PKCS_1_PSS) {
/* PSS decode and verify it */
if(modulus_bitlen%8 == 1){
err = pkcs_1_pss_decode(hash, hashlen, tmpbuf+1, x-1, saltlen, hash_idx, modulus_bitlen, stat);
}
else{
err = pkcs_1_pss_decode(hash, hashlen, tmpbuf, x, saltlen, hash_idx, modulus_bitlen, stat);
}
} else {
/* PKCS #1 v1.5 decode it */
unsigned char *out;
unsigned long outlen;
int decoded;
/* allocate temp buffer for decoded hash */
outlen = ((modulus_bitlen >> 3) + (modulus_bitlen & 7 ? 1 : 0)) - 3;
out = XMALLOC(outlen);
if (out == NULL) {
err = CRYPT_MEM;
goto bail_2;
}
if ((err = pkcs_1_v1_5_decode(tmpbuf, x, LTC_PKCS_1_EMSA, modulus_bitlen, out, &outlen, &decoded)) != CRYPT_OK) {
XFREE(out);
goto bail_2;
}
if (padding == LTC_PKCS_1_V1_5) {
unsigned long loid[16], reallen;
ltc_asn1_list digestinfo[2], siginfo[2];
/* not all hashes have OIDs... so sad */
if (hash_descriptor[hash_idx].OIDlen == 0) {
err = CRYPT_INVALID_ARG;
goto bail_2;
}
/* now we must decode out[0...outlen-1] using ASN.1, test the OID and then test the hash */
/* construct the SEQUENCE
SEQUENCE {
SEQUENCE {hashoid OID
blah NULL
}
hash OCTET STRING
}
*/
LTC_SET_ASN1(digestinfo, 0, LTC_ASN1_OBJECT_IDENTIFIER, loid, sizeof(loid)/sizeof(loid[0]));
LTC_SET_ASN1(digestinfo, 1, LTC_ASN1_NULL, NULL, 0);
LTC_SET_ASN1(siginfo, 0, LTC_ASN1_SEQUENCE, digestinfo, 2);
LTC_SET_ASN1(siginfo, 1, LTC_ASN1_OCTET_STRING, tmpbuf, siglen);
if ((err = der_decode_sequence_strict(out, outlen, siginfo, 2)) != CRYPT_OK) {
/* fallback to Legacy:missing NULL */
LTC_SET_ASN1(siginfo, 0, LTC_ASN1_SEQUENCE, digestinfo, 1);
if ((err = der_decode_sequence_strict(out, outlen, siginfo, 2)) != CRYPT_OK) {
XFREE(out);
goto bail_2;
}
}
if ((err = der_length_sequence(siginfo, 2, &reallen)) != CRYPT_OK) {
XFREE(out);
goto bail_2;
}
/* test OID */
if ((reallen == outlen) &&
(digestinfo[0].size == hash_descriptor[hash_idx].OIDlen) &&
(XMEMCMP(digestinfo[0].data, hash_descriptor[hash_idx].OID, sizeof(unsigned long) * hash_descriptor[hash_idx].OIDlen) == 0) &&
(siginfo[1].size == hashlen) &&
(XMEMCMP(siginfo[1].data, hash, hashlen) == 0)) {
*stat = 1;
}
} else {
/* only check if the hash is equal */
if ((hashlen == outlen) &&
(XMEMCMP(out, hash, hashlen) == 0)) {
*stat = 1;
}
}
#ifdef LTC_CLEAN_STACK
zeromem(out, outlen);
#endif
XFREE(out);
}
bail_2:
#ifdef LTC_CLEAN_STACK
zeromem(tmpbuf, siglen);
#endif
XFREE(tmpbuf);
return err;
}
#endif /* LTC_MRSA */
/* ref: HEAD -> develop */
/* git commit: 9c0d7085234bd6baba2ab8fd9eee62254599341c */
/* commit time: 2018-10-15 10:51:17 +0200 */
|
/**************************************************************************
* This code is licensed under the Apache License 2.0. See ../LICENSE *
* Copyright 2016 John Denholm *
* *
* c3db_create.c - Create a C3DB file from the command line *
* *
* Updates: *
**************************************************************************/
#include <c3db.h>
#include "tools.h"
void usage( void )
{
printf( "Usage: c3db_create -h\n" );
printf( " c3db_create [OPTIONS] -f <name>\n\n" );
printf( "Options:\n" );
printf( " -h Print this help.\n" );
printf( " -V More verbose output.\n" );
printf( " -d Delete after successful creation.\n" );
printf( " -s Report file size.\n" );
printf( " -f <file> Filename to write (default: %s)\n", DEFAULT_FILE );
printf( " -r <policy> Retention policy (default: %s)\n", DEFAULT_RETAIN );
printf( " -v <vers> Specify db version (default: %d)\n\n", C3DB_CURR_VERSION );
printf( "Retention policy is a semi-colon-delimited list of time spec pairs. Each\n" );
printf( "pair is of the form 'seconds:duration' where duration is of the form\n" );
printf( "<number>[y|w|d|h|m], years to minutes.\n" );
exit( 0 );
}
int main( int ac, char **av )
{
int oc, stats, l, vers, del, chat;
char *ret, file[512];
uint64_t sz;
C3HDL *h;
strncpy( file, DEFAULT_FILE, 512 );
ret = DEFAULT_RETAIN;
chat = 0;
vers = C3DB_CURR_VERSION;
stats = 0;
del = 0;
while( ( oc = getopt( ac, av, "hVsdv:r:f:" ) ) != -1 )
switch( oc )
{
case 'h':
usage( );
break;
case 'V':
chat = 1;
break;
case 's':
stats = 1;
break;
case 'd':
del = 1;
break;
case 'r':
ret = strdup( optarg );
break;
case 'f':
strncpy( file, optarg, 511 );
file[511] = '\0';
break;
case 'v':
vers = atoi( optarg );
break;
}
// add the file extn if it's not there and there is room
l = strlen( file );
if( strcmp( file + l - ( 1 + C3DB_FILE_EXTN_LEN ), "." C3DB_FILE_EXTN )
&& ( l < ( 510 - C3DB_FILE_EXTN_LEN ) ) )
snprintf( file + l, 512 - l, ".%s", C3DB_FILE_EXTN );
h = c3db_create( file, vers, ret );
if( ! C3DB_HANDLE_OK( h ) )
{
fprintf( stderr, "Could not create C3DB '%s' -- %s\n", file, c3db_error( h ) );
c3db_close( h );
return 1;
}
if( chat )
printf( "Created C3DB '%s'.\n", file );
if( stats )
{
sz = c3db_file_size( h );
printf( "File size: %lu bytes.\n", sz );
}
c3db_close( h );
if( del )
{
if( unlink( file ) )
{
fprintf( stderr, "Error removing file '%s' -- %s\n", file, Err );
return 1;
}
else if( chat )
printf( "Deleted C3DB '%s' after successful creation.\n", file );
}
return 0;
}
|
/*
*
* Copyright 2013 Mario Alviano, Carmine Dodaro, and Francesco Ricca.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef WASP_OPTIONS_H
#define WASP_OPTIONS_H
#include <vector>
#include <map>
#include "WaspConstants.h"
#include "WaspTrace.h"
using namespace std;
class WaspFacade;
namespace wasp
{
/**
* This class contains a field for each option of wasp.
*
*/
class Options
{
public:
#ifdef TRACE_ON
static TraceLevels traceLevels;
#endif
static void parse( int argc, char* const* argv );
static void setOptions( WaspFacade& waspFacade );
static unsigned int maxCost;
static bool forwardPartialChecks;
static bool heuristicPartialChecks;
static unsigned int queryAlgorithm;
static unsigned int queryVerbosity;
static bool computeFirstModel;
static unsigned int budget;
static bool printLastModelOnly;
static bool printBounds;
static bool printAtomTable;
static bool stratification;
static unsigned int interpreter;
static char* heuristic_scriptname;
static vector< string > pluginsFilenames;
static SHIFT_STRATEGY shiftStrategy;
static string scriptDirectory;
static bool oneDefShift;
static bool simplifications;
static unsigned int minimizationStrategy;
static unsigned int minimizationBudget;
static unsigned int enumerationStrategy;
static WEAK_CONSTRAINTS_ALG weakConstraintsAlg;
static unsigned int kthreshold;
static unsigned int silent;
static bool printOnlyOptimum;
static bool useLazyWeakConstraints;
static unsigned int chunkPercentage;
static unsigned int chunkSize;
static unsigned int minimizePredicateChunkPercentage;
static unsigned int modelcheckerAlgorithm;
static bool compactReasonsForHCC;
static DELETION_POLICY deletionPolicy;
static unsigned int deletionThreshold;
static vector< const char* > inputFiles;
static unsigned int maxModels;
static OUTPUT_POLICY outputPolicy;
static bool minisatPolicy;
static RESTARTS_POLICY restartsPolicy;
static unsigned int restartsThreshold;
static unsigned int timeLimit;
static bool disjCoresPreprocessing;
static bool minimizeUnsatCore;
static bool callPyFinalize;
static double sizeLBDQueue;
static double sizeTrailQueue;
static double K;
static double R;
static int nbclausesBeforeReduce;
static int incReduceDB;
static int specialIncReduceDB;
static unsigned int lbLBDFrozenClause;
static unsigned int lbLBDMinimizingClause;
static bool stats;
static unsigned int statsVerbosity;
static double initVariableIncrement;
static double initVariableDecay;
static unsigned int initValue;
static unsigned int initMinisatHeuristic;
static unsigned int initSign;
static bool multiAggregates;
static bool queryCoreCache;
static unsigned int predMinimizationAlgorithm;
static vector< string > predicatesToMinimize;
static vector< string > predicatesMUS;
static unsigned int multiThreshold;
static map< string, WEAK_CONSTRAINTS_ALG > stringToWeak;
static map< string, SHIFT_STRATEGY > stringToShift;
static map< string, unsigned int > stringToMinimization;
static map< string, unsigned int > stringToQueryAlgorithms;
static map< string, unsigned int > stringToInitMinisatHeuristic;
static map< string, unsigned int > stringToPredMinimization;
static WEAK_CONSTRAINTS_ALG getAlgorithm( const string& s );
static SHIFT_STRATEGY getShiftStrategy( const string& s );
static unsigned int getMinimizationStrategy( const string& s );
static unsigned int getEnumerationStrategy( const string& s );
static unsigned int getQueryAlgorithm( const string& s );
static unsigned int getInitMinisatHeuristic( const string& s );
static void initMap();
static void checkOptions();
};
}
#endif
|
/*
* Copyright (C) 2012 BMW Car IT GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef CAPU_UNIXBASED_LIGHTWEIGHTMUTEX_H
#define CAPU_UNIXBASED_LIGHTWEIGHTMUTEX_H
#include <pthread.h>
namespace capu
{
namespace posix
{
//forward declaration in order to use it in friend declaration
class CondVar;
class LightweightMutex
{
public:
friend class capu::posix::CondVar;
LightweightMutex();
~LightweightMutex();
status_t lock();
bool trylock();
status_t unlock();
private:
pthread_mutex_t mLock;
};
inline
LightweightMutex::LightweightMutex()
{
pthread_mutex_init(&mLock, NULL);
}
inline
LightweightMutex::~LightweightMutex()
{
pthread_mutex_destroy(&mLock);
}
inline
status_t
LightweightMutex::lock()
{
if (pthread_mutex_lock(&mLock) == 0)
{
return CAPU_OK;
}
else
{
return CAPU_ERROR;
}
}
inline
status_t
LightweightMutex::unlock()
{
if (pthread_mutex_unlock(&mLock) == 0)
{
return CAPU_OK;
}
else
{
return CAPU_ERROR;
}
}
inline
bool
LightweightMutex::trylock()
{
if (pthread_mutex_trylock(&mLock) == 0)
{
return true;
}
else
{
return false;
}
}
}
}
#endif // CAPU_UNIXBASED_LIGHTWEIGHTMUTEX_H
|
/*
* Copyright (C) 2015, Albert Krzymowski
* Copyright (C) 2015, Invenire Aude Limited
*
* File: IAS-QSystemMod-ODBC/src/ds/Impl/ODBC/SessionXAManaged.h
*
* Licensed under the Invenire Aude Commercial License (the "License");
* you may not use this file except in compliance with the License.
* You may find the license terms and conditions in the LICENSE.txt file.
* or at http://www.invenireaude.com/licenses/license.txt
*
* This file and any derived form, including but not limited to object
* executable, represents the Confidential Materials.
*
*/
#ifndef _IAS_DS_ODBC_SessionXAManaged_H_
#define _IAS_DS_ODBC_SessionXAManaged_H_
#include "Session.h"
namespace IAS {
namespace DS {
namespace Impl {
namespace ODBC {
class Connection;
/*************************************************************************/
/** The SessionXAManaged class.
*
*/
class SessionXAManaged :
public virtual Session{
public:
virtual ~SessionXAManaged() throw();
virtual void commit();
virtual void rollback();
virtual TransactionMode getMode()const;
protected:
SessionXAManaged(Connection* pConnection);
friend class Factory<SessionXAManaged>;
};
/*************************************************************************/
}
}
}
}
#endif /* _IAS_DS_ODBC_SessionXAManaged_H_ */
|
//
// MHGameSeries.h
// CoreHound
//
// Copyright (c) 2015 MediaHound. All rights reserved.
//
#import "MHMedia.h"
/**
* An MHGameSeries
*/
@interface MHGameSeries : MHMedia
@end
|
/*
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.
*/
#import "CredentialsManager.h"
#import "CustomHTTPProtocol.h"
#import "WebViewController.h"
#import <Cordova/CDVPlugin.h>
#import <Cordova/CDVInvokedUrlCommand.h>
#import <Cordova/CDVScreenOrientationDelegate.h>
#ifdef __CORDOVA_4_0_0
#import <Cordova/CDVUIWebViewDelegate.h>
#else
#import <Cordova/CDVWebViewDelegate.h>
#endif
@class CDVInAppBrowserViewController;
@interface CDVInAppBrowser : CDVPlugin {
}
@property (nonatomic, strong, readwrite) CredentialsManager * credentialsManager;
@property (nonatomic, retain) CDVInAppBrowserViewController* inAppBrowserViewController;
@property (nonatomic, copy) NSString* callbackId;
@property (nonatomic, copy) NSRegularExpression *callbackIdPattern;
/*! For threadInfoByThreadID, each key is an NSNumber holding a thread ID and each
value is a ThreadInfo object. The dictionary is protected by @synchronized on
the app delegate object itself.
In the debugger you can dump this info with:
(lldb) po [[[UIApplication sharedApplication] delegate] threadInfoByThreadID]
*/
@property (atomic, strong, readwrite) NSMutableDictionary * threadInfoByThreadID;
@property (atomic, assign, readwrite) NSUInteger nextThreadNumber; ///< Protected by @synchronized on the delegate object.
- (void)open:(CDVInvokedUrlCommand*)command;
- (void)close:(CDVInvokedUrlCommand*)command;
- (void)injectScriptCode:(CDVInvokedUrlCommand*)command;
- (void)show:(CDVInvokedUrlCommand*)command;
@end
@interface CDVInAppBrowserOptions : NSObject {}
@property (nonatomic, assign) BOOL location;
@property (nonatomic, assign) BOOL toolbar;
@property (nonatomic, copy) NSString* closebuttoncaption;
@property (nonatomic, copy) NSString* toolbarposition;
@property (nonatomic, assign) BOOL clearcache;
@property (nonatomic, assign) BOOL clearsessioncache;
@property (nonatomic, copy) NSString* presentationstyle;
@property (nonatomic, copy) NSString* transitionstyle;
@property (nonatomic, assign) BOOL enableviewportscale;
@property (nonatomic, assign) BOOL mediaplaybackrequiresuseraction;
@property (nonatomic, assign) BOOL allowinlinemediaplayback;
@property (nonatomic, assign) BOOL keyboarddisplayrequiresuseraction;
@property (nonatomic, assign) BOOL suppressesincrementalrendering;
@property (nonatomic, assign) BOOL hidden;
@property (nonatomic, assign) BOOL disallowoverscroll;
+ (CDVInAppBrowserOptions*)parseOptions:(NSString*)options;
@end
@interface CDVInAppBrowserViewController : WebViewController <WebViewControllerDelegate, CustomHTTPProtocolDelegate, UIWebViewDelegate, CDVScreenOrientationDelegate>{
@private
NSString* _userAgent;
NSString* _prevUserAgent;
NSInteger _userAgentLockToken;
CDVInAppBrowserOptions *_browserOptions;
#ifdef __CORDOVA_4_0_0
CDVUIWebViewDelegate* _webViewDelegate;
#else
CDVWebViewDelegate* _webViewDelegate;
#endif
}
@property (nonatomic, strong) IBOutlet UIWebView* webView;
@property (nonatomic, strong) IBOutlet UIBarButtonItem* closeButton;
@property (nonatomic, strong) IBOutlet UILabel* addressLabel;
@property (nonatomic, strong) IBOutlet UIBarButtonItem* backButton;
@property (nonatomic, strong) IBOutlet UIBarButtonItem* forwardButton;
@property (nonatomic, strong) IBOutlet UIActivityIndicatorView* spinner;
@property (nonatomic, strong) IBOutlet UIToolbar* toolbar;
@property (nonatomic, weak) id <CDVScreenOrientationDelegate> orientationDelegate;
@property (nonatomic, weak) CDVInAppBrowser* navigationDelegate;
@property (nonatomic) NSURL* currentURL;
- (void)close;
- (void)navigateTo:(NSURL*)url;
- (void)showLocationBar:(BOOL)show;
- (void)showToolBar:(BOOL)show : (NSString *) toolbarPosition;
- (void)setCloseButtonTitle:(NSString*)title;
- (id)initWithUserAgent:(NSString*)userAgent prevUserAgent:(NSString*)prevUserAgent browserOptions: (CDVInAppBrowserOptions*) browserOptions;
@end
@interface CDVInAppBrowserNavigationController : UINavigationController
@property (nonatomic, weak) id <CDVScreenOrientationDelegate> orientationDelegate;
@end
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/transcribestreaming/TranscribeStreamingService_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
namespace Aws
{
namespace TranscribeStreamingService
{
namespace Model
{
enum class ContentIdentificationType
{
NOT_SET,
PII
};
namespace ContentIdentificationTypeMapper
{
AWS_TRANSCRIBESTREAMINGSERVICE_API ContentIdentificationType GetContentIdentificationTypeForName(const Aws::String& name);
AWS_TRANSCRIBESTREAMINGSERVICE_API Aws::String GetNameForContentIdentificationType(ContentIdentificationType value);
} // namespace ContentIdentificationTypeMapper
} // namespace Model
} // namespace TranscribeStreamingService
} // namespace Aws
|
#ifndef STROMX_CVIMGPROC_DISTANCETRANSFORM_H
#define STROMX_CVIMGPROC_DISTANCETRANSFORM_H
#include "stromx/cvimgproc/Config.h"
#include <stromx/cvsupport/Matrix.h>
#include <stromx/runtime/Enum.h>
#include <stromx/runtime/EnumParameter.h>
#include <stromx/runtime/List.h>
#include <stromx/runtime/MatrixDescription.h>
#include <stromx/runtime/MatrixParameter.h>
#include <stromx/runtime/NumericParameter.h>
#include <stromx/runtime/OperatorException.h>
#include <stromx/runtime/OperatorKernel.h>
#include <stromx/runtime/Primitive.h>
namespace stromx
{
namespace cvimgproc
{
class STROMX_CVIMGPROC_API DistanceTransform : public runtime::OperatorKernel
{
public:
enum DistanceTypeId
{
DIST_L1,
DIST_L2,
DIST_C
};
enum MaskSizeId
{
SIZE_3,
SIZE_5,
SIZE_PRECISE
};
enum DataFlowId
{
MANUAL,
ALLOCATE
};
enum ConnectorId
{
SRC,
DST
};
enum ParameterId
{
DISTANCE_TYPE,
MASK_SIZE,
DATA_FLOW
};
DistanceTransform();
virtual OperatorKernel* clone() const { return new DistanceTransform; }
virtual void setParameter(const unsigned int id, const runtime::Data& value);
virtual const runtime::DataRef getParameter(const unsigned int id) const;
void initialize();
virtual void execute(runtime::DataProvider& provider);
private:
static const std::string PACKAGE;
static const runtime::Version VERSION;
static const std::string TYPE;
const std::vector<const runtime::Parameter*> setupInitParameters();
const std::vector<const runtime::Parameter*> setupParameters();
const std::vector<const runtime::Description*> setupInputs();
const std::vector<const runtime::Description*> setupOutputs();
int convertDistanceType(const runtime::Enum & value);
int convertMaskSize(const runtime::Enum & value);
runtime::Enum m_distanceType;
runtime::Enum m_maskSize;
runtime::Enum m_dataFlow;
runtime::EnumParameter* m_distanceTypeParameter;
runtime::Description* m_dstDescription;
runtime::EnumParameter* m_maskSizeParameter;
runtime::Description* m_srcDescription;
runtime::EnumParameter* m_dataFlowParameter;
};
} // cvimgproc
} // stromx
#endif // STROMX_CVIMGPROC_DISTANCETRANSFORM_H
|
/* Copyright 2013-2014 IBM Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <device.h>
#include "spira.h"
#include <cpu.h>
#include <vpd.h>
#include <ccan/str/str.h>
#include <device_tree.h>
#include <interrupts.h>
#include "hdata.h"
static struct dt_node *fsp_create_node(const void *spss, int i,
struct dt_node *parent)
{
const struct spss_sp_impl *sp_impl;
struct dt_node *node;
unsigned int mask;
/* Find an check the SP Implementation structure */
sp_impl = HDIF_get_idata(spss, SPSS_IDATA_SP_IMPL, NULL);
if (!CHECK_SPPTR(sp_impl)) {
prerror("FSP #%d: SPSS/SP_Implementation not found !\n", i);
return NULL;
}
prlog(PR_INFO, "FSP #%d: FSP HW version %d, SW version %d,"
" chip DD%d.%d\n", i,
be16_to_cpu(sp_impl->hw_version),
be16_to_cpu(sp_impl->sw_version),
sp_impl->chip_version >> 4, sp_impl->chip_version & 0xf);
mask = SPSS_SP_IMPL_FLAGS_INSTALLED | SPSS_SP_IMPL_FLAGS_FUNCTIONAL;
if ((be16_to_cpu(sp_impl->func_flags) & mask) != mask) {
prerror("FSP #%d: FSP not installed or not functional\n", i);
return NULL;
}
node = dt_new_addr(parent, "fsp", i);
assert(node);
dt_add_property_cells(node, "reg", i);
if (be16_to_cpu(sp_impl->hw_version) == 1) {
dt_add_property_strings(node, "compatible", "ibm,fsp",
"ibm,fsp1");
/* Offset into the FSP MMIO space where the mailbox
* registers are */
/* seen in the FSP1 spec */
dt_add_property_cells(node, "reg-offset", 0xb0016000);
} else if (be16_to_cpu(sp_impl->hw_version) == 2) {
dt_add_property_strings(node, "compatible", "ibm,fsp",
"ibm,fsp2");
dt_add_property_cells(node, "reg-offset", 0xb0011000);
}
dt_add_property_cells(node, "hw-version", be16_to_cpu(sp_impl->hw_version));
dt_add_property_cells(node, "sw-version", be16_to_cpu(sp_impl->sw_version));
if (be16_to_cpu(sp_impl->func_flags) & SPSS_SP_IMPL_FLAGS_PRIMARY)
dt_add_property(node, "primary", NULL, 0);
return node;
}
static uint32_t fsp_create_link(const struct spss_iopath *iopath, int index,
int fsp_index)
{
struct dt_node *node;
const char *ststr;
bool current = false;
bool working = false;
uint32_t chip_id;
switch(be16_to_cpu(iopath->psi.link_status)) {
case SPSS_IO_PATH_PSI_LINK_BAD_FRU:
ststr = "Broken";
break;
case SPSS_IO_PATH_PSI_LINK_CURRENT:
ststr = "Active";
current = working = true;
break;
case SPSS_IO_PATH_PSI_LINK_BACKUP:
ststr = "Backup";
working = true;
break;
default:
ststr = "Unknown";
}
prlog(PR_DEBUG, "FSP #%d: IO PATH %d is %s PSI Link, GXHB at %llx\n",
fsp_index, index, ststr, (long long)be64_to_cpu(iopath->psi.gxhb_base));
chip_id = pcid_to_chip_id(be32_to_cpu(iopath->psi.proc_chip_id));
node = dt_find_compatible_node_on_chip(dt_root, NULL, "ibm,psihb-x",
chip_id);
if (!node) {
prerror("FSP #%d: Can't find psihb node for link %d\n",
fsp_index, index);
} else {
if (current)
dt_add_property(node, "boot-link", NULL, 0);
dt_add_property_strings(node, "status", working ? "ok" : "bad");
}
return chip_id;
}
static void fsp_create_links(const void *spss, int index,
struct dt_node *fsp_node)
{
uint32_t *links = NULL;
unsigned int i, lp, lcount = 0;
int count;
count = HDIF_get_iarray_size(spss, SPSS_IDATA_SP_IOPATH);
if (count < 0) {
prerror("FSP #%d: Can't find IO PATH array size !\n", index);
return;
}
prlog(PR_DEBUG, "FSP #%d: Found %d IO PATH\n", index, count);
/* Iterate all links */
for (i = 0; i < count; i++) {
const struct spss_iopath *iopath;
unsigned int iopath_sz;
uint32_t chip;
iopath = HDIF_get_iarray_item(spss, SPSS_IDATA_SP_IOPATH,
i, &iopath_sz);
if (!CHECK_SPPTR(iopath)) {
prerror("FSP #%d: Can't find IO PATH %d\n", index, i);
break;
}
if (be16_to_cpu(iopath->iopath_type) != SPSS_IOPATH_TYPE_PSI) {
prerror("FSP #%d: Unsupported IO PATH %d type 0x%04x\n",
index, i, iopath->iopath_type);
continue;
}
chip = fsp_create_link(iopath, i, index);
lp = lcount++;
links = realloc(links, 4 * lcount);
links[lp] = chip;
}
if (links)
dt_add_property(fsp_node, "ibm,psi-links", links, lcount * 4);
free(links);
}
void fsp_parse(void)
{
const void *base_spss, *spss;
struct dt_node *fsp_root, *fsp_node;
int i;
/*
* Note on DT representation of the PSI links and FSPs:
*
* We create a XSCOM node for each PSI host bridge(one per chip),
*
* This is done in spira.c
*
* We do not create the /psi MMIO variant at this stage, it will
* be added by the psi driver in skiboot.
*
* We do not put the FSP(s) as children of these. Instead, we create
* a top-level /fsps node with the FSPs as children.
*
* Each FSP then has a "links" property which is an array of chip IDs
*/
/* Find SPSS in SPIRA */
base_spss = get_hdif(&spira.ntuples.sp_subsys, SPSS_HDIF_SIG);
if (!base_spss) {
prlog(PR_WARNING, "FSP: No SPSS in SPIRA !\n");
return;
}
fsp_root = dt_new(dt_root, "fsps");
assert(fsp_root);
dt_add_property_cells(fsp_root, "#address-cells", 1);
dt_add_property_cells(fsp_root, "#size-cells", 0);
/* Iterate FSPs in SPIRA */
for_each_ntuple_idx(&spira.ntuples.sp_subsys, spss, i, SPSS_HDIF_SIG) {
fsp_node = fsp_create_node(spss, i, fsp_root);
if (fsp_node)
fsp_create_links(spss, i, fsp_node);
}
}
|
////////////////////////////////////////////////////////////////////////////////
/// DISCLAIMER
///
/// Copyright 2014-2022 ArangoDB GmbH, Cologne, Germany
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
///
/// @author Jan Steemann
/// @author Jan Christoph Uhde
////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "ApplicationFeatures/ApplicationFeature.h"
#include "Basics/Common.h"
#include "RestServer/arangod.h"
namespace arangodb {
// a stub class that other features can use to check whether a storage
// engine (no matter what type) is ready
class StorageEngineFeature final : public ArangodFeature {
public:
static constexpr std::string_view name() noexcept { return "StorageEngine"; }
explicit StorageEngineFeature(Server& server)
: ArangodFeature(server, Server::id<StorageEngineFeature>(), name()) {
setOptional(false);
startsAfter<application_features::BasicFeaturePhaseServer>();
}
};
} // namespace arangodb
|
#ifndef __QUEUE_H__
#define __QUEUE_H__
// queue
//#define ENABLE_QUEUE_LOCK
namespace cg{
namespace core{
template<typename T> struct QueueItem{
//friend class Queue<T>;
// needs to access to item and next
// private class: no public section
QueueItem(const T &t): item(t), next(0){}
T item;
QueueItem * next;
};
template <typename T> class Queue{
QueueItem<T> * head;
QueueItem<T> * tail;
CRITICAL_SECTION section;
// destroy the whole queue
void destroy(){
while(!empty())
pop();
}
void copy_elems(const Queue &org){
for(QueueItem<T> * pt = org.head; pt; pt = pt->next)
push(pt->item);
}
template<typename Iter> void copy_elems(Iter, Iter){
}
public:
Queue():head(0), tail(0){
InitializeCriticalSection(§ion);
}
template<class It> Queue(It beg, It end): head(0), tail(0){
copy_elems(beg, end);
}
~Queue(){
destroy();
DeleteCriticalSection(§ion);
}
// copy
Queue(const Queue & q): head(0), tail(0){
InitializeCriticalSection(§ion);
copy_elems(q);
}
// =
Queue & operator=(const Queue &q){
head = 0;
tail = 0;
copy_elems(q);
return *this;
}
template<class Iter> void assign(Iter begin, Iter end){
while(begin != end){
push(begin);
begin++;
}
}
bool empty()const{
bool ret = false;
#ifdef ENABLE_QUEUE_LOCK
EnterCriticalSection((LPCRITICAL_SECTION)§ion);
#endif
ret = head == 0 ? true: false;
#ifdef ENABLE_QUEUE_LOCK
LeaveCriticalSection((LPCRITICAL_SECTION)§ion);
#endif
return ret;
}
// get the head item, not remove
T & front(){
#ifdef ENABLE_QUEUE_LOCK
EnterCriticalSection((LPCRITICAL_SECTION)§ion);
#endif
T &tm = head->item;
#ifdef ENABLE_QUEUE_LOCK
LeaveCriticalSection((LPCRITICAL_SECTION)§ion);
#endif
return tm;
}
const T & front() const{
#ifdef ENABLE_QUEUE_LOCK
EnterCriticalSection((LPCRITICAL_SECTION)§ion);
#endif
const T & tm = head->item;
#ifdef ENABLE_QUEUE_LOCK
LeaveCriticalSection((LPCRITICAL_SECTION)§ion);
#endif
return tm;
}
// just remove the head
void pop(){
QueueItem<T> * p = head;
head = head->next;
delete p;
}
// push to the tail
void push(const T &val){
// allocate new QueueItem object
QueueItem<T> * pt = new QueueItem<T>(val);
// put item onto existing queue
if(empty())
head = tail = pt; // only on elem
else
{
#ifdef ENABLE_QUEUE_LOCK
EnterCriticalSection((LPCRITICAL_SECTION)§ion);
#endif
tail->next = pt;
tail = pt;
#ifdef ENABLE_QUEUE_LOCK
LeaveCriticalSection((LPCRITICAL_SECTION)§ion);
#endif
}
}
};
}
}
#endif |
/*
* Copyright 2010-2012 Esrille Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ORG_W3C_DOM_BOOTSTRAP_HTMLCANVASELEMENTIMP_H_INCLUDED
#define ORG_W3C_DOM_BOOTSTRAP_HTMLCANVASELEMENTIMP_H_INCLUDED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <org/w3c/dom/html/HTMLCanvasElement.h>
#include "HTMLElementImp.h"
#include <org/w3c/dom/html/HTMLElement.h>
#include <org/w3c/dom/file/FileCallback.h>
namespace org
{
namespace w3c
{
namespace dom
{
namespace bootstrap
{
class HTMLCanvasElementImp : public ObjectMixin<HTMLCanvasElementImp, HTMLElementImp>
{
public:
HTMLCanvasElementImp(DocumentImp* ownerDocument) :
ObjectMixin(ownerDocument, u"canvas")
{
}
// Node - override
virtual Node cloneNode(bool deep = true) {
auto node = std::make_shared<HTMLCanvasElementImp>(*this);
node->cloneAttributes(this);
if (deep)
node->cloneChildren(this);
return node;
}
// HTMLCanvasElement
unsigned int getWidth();
void setWidth(unsigned int width);
unsigned int getHeight();
void setHeight(unsigned int height);
std::u16string toDataURL();
std::u16string toDataURL(const std::u16string& type, Variadic<Any> args = Variadic<Any>());
void toBlob(file::FileCallback callback);
void toBlob(file::FileCallback callback, const std::u16string& type, Variadic<Any> args = Variadic<Any>());
Object getContext(const std::u16string& contextId, Variadic<Any> args = Variadic<Any>());
// Object
virtual Any message_(uint32_t selector, const char* id, int argc, Any* argv)
{
return html::HTMLCanvasElement::dispatch(this, selector, id, argc, argv);
}
static const char* const getMetaData()
{
return html::HTMLCanvasElement::getMetaData();
}
};
}
}
}
}
#endif // ORG_W3C_DOM_BOOTSTRAP_HTMLCANVASELEMENTIMP_H_INCLUDED
|
#include "dft.h"
#include <stddef.h>
static void destroy(problem *ego_)
{
problem_dft *ego = (problem_dft *) ego_;
fftwf_tensor_destroy2(ego->vecsz, ego->sz);
fftwf_ifree(ego_);
}
static void hash(const problem *p_, md5 *m)
{
const problem_dft *p = (const problem_dft *) p_;
fftwf_md5puts(m, "dft");
fftwf_md5int(m, p->ri == p->ro);
fftwf_md5INT(m, p->ii - p->ri);
fftwf_md5INT(m, p->io - p->ro);
fftwf_md5int(m,fftwf_alignment_of(p->ri));
fftwf_md5int(m,fftwf_alignment_of(p->ii));
fftwf_md5int(m,fftwf_alignment_of(p->ro));
fftwf_md5int(m,fftwf_alignment_of(p->io));
fftwf_tensor_md5(m, p->sz);
fftwf_tensor_md5(m, p->vecsz);
}
static void print(const problem *ego_, printer *p)
{
const problem_dft *ego = (const problem_dft *) ego_;
p->print(p, "(dft %d %d %d %D %D %T %T)",
ego->ri == ego->ro,
fftwf_alignment_of(ego->ri),
fftwf_alignment_of(ego->ro),
(INT)(ego->ii - ego->ri),
(INT)(ego->io - ego->ro),
ego->sz,
ego->vecsz);
}
static void zero(const problem *ego_)
{
const problem_dft *ego = (const problem_dft *) ego_;
tensor *sz =fftwf_tensor_append(ego->vecsz, ego->sz);
fftwf_dft_zerotens(sz, UNTAINT(ego->ri), UNTAINT(ego->ii));
fftwf_tensor_destroy(sz);
}
static const problem_adt padt =
{
PROBLEM_DFT,
hash,
zero,
print,
destroy
};
problem *fftwf_mkproblem_dft(const tensor *sz, const tensor *vecsz,
float *ri,float *ii,float *ro,float *io)
{
problem_dft *ego;
/* enforce pointer equality if untainted pointers are equal */
if (UNTAINT(ri) == UNTAINT(ro))
ri = ro = JOIN_TAINT(ri, ro);
if (UNTAINT(ii) == UNTAINT(io))
ii = io = JOIN_TAINT(ii, io);
/* more correctness conditions: */
A(TAINTOF(ri) == TAINTOF(ii));
A(TAINTOF(ro) == TAINTOF(io));
A(fftwf_tensor_kosherp(sz));
A(fftwf_tensor_kosherp(vecsz));
if (ri == ro || ii == io) {
/* If either real or imag pointers are in place, both must be. */
if (ri != ro || ii != io || !fftwf_tensor_inplace_locations(sz, vecsz))
return fftwf_mkproblem_unsolvable();
}
ego = (problem_dft *)fftwf_mkproblem(sizeof(problem_dft), &padt);
ego->sz =fftwf_tensor_compress(sz);
ego->vecsz =fftwf_tensor_compress_contiguous(vecsz);
ego->ri = ri;
ego->ii = ii;
ego->ro = ro;
ego->io = io;
A(FINITE_RNK(ego->sz->rnk));
return &(ego->super);
}
/* Same asfftwf_mkproblem_dft), but also destroy input tensors. */
problem *fftwf_mkproblem_dft_d(tensor *sz, tensor *vecsz,
float *ri,float *ii,float *ro,float *io)
{
problem *p =fftwf_mkproblem_dft(sz, vecsz, ri, ii, ro, io);
fftwf_tensor_destroy2(vecsz, sz);
return p;
}
|
/*
Copyright 2015 Google Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "libaddb/addb-istore.h"
#include "libaddb/addbp.h"
/**
* @brief Initialize a reference
*
* Once this call completes, a later call to addb_istore_reference_free()
* is harmless, even if the data has not been written to by
* a call to addb_istore_read() or addb_istore_alloc().
*
* @param iref pointer to undefined data
*/
void addb_istore_reference_initialize(addb_istore_reference* iref) {
if (iref != NULL) {
iref->iref_td = NULL;
ADDB_TILED_REFERENCE_INITIALIZE(iref->iref_tref);
}
}
/**
* @brief Release a reference.
* @param iref part of a data reference created by an earlier
* call to addb_istore_alloc() or addb_istore_read(),
* or initialized with addb_istore_reference_initialize().
* @param file __FILE__ of calling context, filled in by
* addb_istore_reference_free macro.
* @param line __LINE__ of calling context, filled in by
* addb_istore_reference_free macro.
*/
void addb_istore_reference_free_loc(addb_istore_reference* iref,
char const* file, int line) {
if (iref != NULL && iref->iref_td != NULL) {
addb_tiled_free_loc(iref->iref_td, &iref->iref_tref, file, line);
ADDB_TILED_REFERENCE_INITIALIZE(iref->iref_tref);
}
}
/**
* @brief Make a duplicate of a reference.
* @param iref part of a data reference created by an earlier
* call to addb_istore_alloc() or addb_istore_read(),
* or initialized with addb_istore_reference_initialize().
* @param file __FILE__ of calling code (inserted by
* addb_istore_reference_dup macro.)
* @param line __LINE__ of calling code (inserted by
* addb_istore_reference_dup macro.)
*/
void addb_istore_reference_dup_loc(addb_istore_reference* iref,
char const* file, int line) {
if (iref != NULL && iref->iref_td != NULL)
addb_tiled_link_loc(iref->iref_td, &iref->iref_tref, file, line);
}
/**
* @brief Create a reference from a piece of data.
* @param iref reference to create
* @param data data to create it from
* @param file __FILE__ of calling code (inserted by
* addb_istore_reference_from_data macro.)
* @param line __LINE__ of calling code (inserted by
* addb_istore_reference_from_data macro.)
*/
void addb_istore_reference_from_data_loc(addb_istore_reference* iref,
addb_data const* data,
char const* file, int line) {
if (data == NULL || data->data_type != ADDB_DATA_ISTORE)
addb_istore_reference_initialize(iref);
else {
addb_tiled_link_loc(data->data_iref.iref_td, &data->data_iref.iref_tref,
file, line);
*iref = data->data_iref;
}
}
|
#ifndef BIT_SCAN_H
#define BIT_SCAN_H
#ifdef __has_builtin
#define HAS_BUILTIN(x) __has_builtin(x)
#else
#define HAS_BUILTIN(x) 0
#endif
#if __GNUC__ >= 4 || HAS_BUILTIN(__builtin_clzll)
#define leadingZeros(x) __builtin_clzll(x)
#define trailingZeros(x) __builtin_ctzll(x)
#endif
#ifndef leadingZeros
#ifdef _MSC_VER
#include <intrin.h>
inline unsigned long leadingZeros(unsigned __int64 x) {
unsigned long result;
#ifdef _WIN64
_BitScanReverse64(&result, x);
#else
// Scan the high 32 bits.
if (_BitScanReverse(&result, static_cast<unsigned long>(x >> 32)))
return 63 - (result + 32);
// Scan the low 32 bits.
_BitScanReverse(&result, static_cast<unsigned long>(x));
#endif // _WIN64
return 63 - result;
}
inline unsigned long trailingZeros(unsigned __int64 x) {
unsigned long result;
#ifdef _WIN64
_BitScanForward64(&result, x);
return result;
#else
// Scan the Low Word.
if (_BitScanForward(&result, static_cast<unsigned long>(x))) return result;
// Scan the High Word.
_BitScanForward(&result, static_cast<unsigned long>(x >> 32));
return result + 32;
#endif // _WIN64
}
#else
inline unsigned long leadingZeros(unsigned long long x) {
unsigned long r = 0;
while (x >>= 1) r++;
return 64 - r;
}
inline unsigned long trailingZeros(unsigned long long x) {
unsigned long r;
for (r = 0; x != 0; x >>= 1) {
if (x & 01)
break;
else
r++;
}
return r;
}
#endif // _MSC_VER
#endif // leadingZeros
#endif // BIT_SCAN_H
|
/********************************************************************
filename : Log.h
author : z00233055
created : 2015/01/04
description : ÈÕ־ģ¿é
copyright : Copyright (C) 2014-2016
history : 2015/01/04 ³õʼ°æ±¾
*********************************************************************/
#ifndef _LOG_H_
#define _LOG_H_
#include <stdio.h>
#include <string>
#include <stdarg.h>
#include <WinBase.h>
#include "eSDKLogAPI.h"
using namespace std;
#define MSG_LEN 4096
#define TIME_LEN 256
#define PRODUCT_NAME "UC"
typedef enum
{
TRACE_INFO,
TRACE_DEBUG
}TRACE_LEVEL_E;
//lint -e438
//lint -e1788
class CLogTrace
{
public:
CLogTrace(void);
CLogTrace(TRACE_LEVEL_E level, const char *file, int line, const char *func, const char *fmt, ...)
:m_Func(func), m_File(file), m_Line(line), m_Level(level)
{
va_list args;
va_start(args, fmt);
memset(m_Msg, 0, MSG_LEN);
(void)_vsnprintf_s(m_Msg, MSG_LEN - 1, fmt, args);
va_end(args);
std::string msg("Enter ");
msg.append(m_Func);
if (0 != strlen(m_Msg))
{
msg.append(" ");
msg.append(m_Msg);
}
Log_Run_Debug(PRODUCT_NAME,msg.c_str());
GetLocalTime(&m_ReqTime);
GetLocalTime(&m_RspTime);
}
~CLogTrace()
{
try
{
std::string msg("Leave ");
msg.append(m_Func);
Log_Run_Debug(PRODUCT_NAME,msg.c_str());
if (TRACE_INFO == m_Level)
{
GetLocalTime(&m_RspTime);
char reqTime[TIME_LEN] = {0};
char rspTime[TIME_LEN] = {0};
(void)_snprintf_s(reqTime, TIME_LEN-1, "%04d-%02d-%02d %02d:%02d:%02d.%03d", m_ReqTime.wYear, m_ReqTime.wMonth, m_ReqTime.wDay, m_ReqTime.wHour, m_ReqTime.wMinute, m_ReqTime.wSecond, m_ReqTime.wMilliseconds);
(void)_snprintf_s(rspTime, TIME_LEN-1, "%04d-%02d-%02d %02d:%02d:%02d.%03d", m_RspTime.wYear, m_RspTime.wMonth, m_RspTime.wDay, m_RspTime.wHour, m_RspTime.wMinute, m_RspTime.wSecond, m_RspTime.wMilliseconds);
Log_Interface_Info(PRODUCT_NAME, "1", "C", m_Func, "", "", "", reqTime, rspTime, "", m_Msg);
}
}
catch(...){} ;
m_Func = NULL;
m_File = NULL;
}
private:
const char *m_Func;
const char *m_File;
int m_Line;
TRACE_LEVEL_E m_Level;
SYSTEMTIME m_ReqTime;
SYSTEMTIME m_RspTime;
char m_Msg[MSG_LEN];
};
#define INFO_TRACE(fmt, ...) CLogTrace trace(TRACE_INFO,__FILE__, __LINE__, __FUNCTION__, fmt, ##__VA_ARGS__)
#define DEBUG_TRACE(fmt, ...) CLogTrace trace(TRACE_DEBUG,__FILE__, __LINE__, __FUNCTION__, fmt, ##__VA_ARGS__)
static std::string FormatedMsg(const char *fmt, ...)
{
char msg[MSG_LEN] = {0};
va_list args;
va_start(args, fmt);
(void)_vsnprintf_s(msg, MSG_LEN - 1, fmt, args);
va_end(args);
return std::string(msg);
}
#define DEBUG_LOG(fmt, ...) Log_Run_Debug(PRODUCT_NAME,FormatedMsg(fmt, ##__VA_ARGS__).c_str())
#define INFO_LOG(fmt, ...) Log_Run_Info(PRODUCT_NAME,FormatedMsg(fmt, ##__VA_ARGS__).c_str())
#define WARN_LOG(fmt, ...) Log_Run_Warn(PRODUCT_NAME,FormatedMsg(fmt, ##__VA_ARGS__).c_str())
#define ERROR_LOG(fmt, ...) Log_Run_Error(PRODUCT_NAME,FormatedMsg(fmt, ##__VA_ARGS__).c_str())
//lint +e438
#endif //_LOG_H_
|
//
// YJTitleButton.h
// YJHweibo
//
// Created by YJH on 16/4/9.
// Copyright © 2016年 YJH. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface YJTitleButton : UIButton
@end
|
//
// ViewController.h
// Cool3DSidebarAnimation_OC
//
// Created by Mazy on 2017/8/3.
// Copyright © 2017年 Mazy. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "DetailViewController.h"
@interface ViewController : UIViewController
@property (nonatomic, strong) DetailViewController *detailVC;
@property (nonatomic, assign) BOOL showingMenu;
@property (nonatomic, strong) NSDictionary *menuItem;
- (void) hideOrShowMenu:(BOOL)show animated: (BOOL)animated;
@end
|
//
// CLVideoPlayerControls.h
// CLMoviePlayer
//
// Created by Jotiram Bhagat on 24/06/14.
// Copyright (c) 2014-2016 Jotiram Bhagat. All rights reserved.
//
NS_ASSUME_NONNULL_BEGIN
@class CLVideoPlayer;
@class OEXHelperVideoDownload;
typedef enum
{
/** Controls will appear in a bottom bar */
CLVideoPlayerControlsStyleEmbedded,
/** Controls will appear in a top bar and bottom bar */
CLVideoPlayerControlsStyleFullscreen,
/** Controls will appear as CLVideoPlayerControlsStyleFullscreen when in fullscreen and CLVideoPlayerControlsStyleEmbedded at all other times */
CLVideoPlayerControlsStyleDefault,
/** Controls will not appear */
CLVideoPlayerControlsStyleNone,
} CLVideoPlayerControlsStyle;
typedef enum
{
/** Controls are not doing anything */
CLVideoPlayerControlsStateIdle,
/** Controls are waiting for movie to finish loading */
CLVideoPlayerControlsStateLoading,
/** Controls are ready to play and/or playing */
CLVideoPlayerControlsStateReady,
} CLVideoPlayerControlsState;
@protocol CLVideoPlayerControlsDelegate <NSObject>
- (void) videoPlayerTapped:(id) sender;
@end
@interface CLVideoPlayerControls : UIView
@property (strong, nonatomic) OEXHelperVideoDownload* video;
/**
The style of the controls. Can be changed on the fly.
Default value is CLVideoPlayerControlsStyleDefault
*/
@property (nonatomic, assign) CLVideoPlayerControlsStyle style;
/**
The state of the controls.
*/
@property (nonatomic, readonly) CLVideoPlayerControlsState state;
/**
The color of the control bars.
Default value is black with a hint of transparency.
*/
@property (nonatomic, strong) UIColor* barColor;
/**
The height of the control bars.
Default value is 70.f for iOS7+ and 50.f for previous versions.
*/
@property (nonatomic, assign) CGFloat barHeight;
/**
The amount of time that the controls should stay on screen before automatically hiding.
The default value is set using the constant OEXVideoControlsFadeDelay in the implementation file.
*/
@property (nonatomic, assign) NSTimeInterval fadeDelay;
/**
The rate at which the movie should fastforward or rewind.
Default value is 3x.
*/
@property (nonatomic, assign) float seekRate;
/**
Should the time-remaining number decrement as the video plays?
Default value is NO.
*/
@property (nonatomic) BOOL timeRemainingDecrements;
/**
Are the controls currently showing on screen?
*/
@property (nonatomic, readonly, getter = isShowing) BOOL showing;
/**
Checks if the parent viewController is at the top of the stack
*/
@property (nonatomic) BOOL isVisibile;
/// Are the next/previous buttons hidden
@property (assign, nonatomic) BOOL hidesNextPrev;
/**
The default initializer method. The parameter may not be nil.
*/
- (id)initWithMoviePlayer:(CLVideoPlayer*)moviePlayer style:(CLVideoPlayerControlsStyle)style;
- (void)resetControls;
- (void)hideOptionsAndValues;
// For Closed Captioning
@property (nonatomic, weak, nullable) CLVideoPlayer* moviePlayer;
@property (nonatomic, assign) float playbackRate;
@property (nonatomic, weak) id <CLVideoPlayerControlsDelegate> delegate;
@end
NS_ASSUME_NONNULL_END
|
#include "defines.h"
#define CS PORTDbits.RD7
#define CLK PORTDbits.RD6
#define DIO PORTDbits.RD11
#define T_CS TRISDbits.TRISD7
#define T_CLK TRISDbits.TRISD6
#define T_DIO TRISDbits.TRISD11
#define X_AXIS 0b1000
#define Y_AXIS 0b1001
#define Z_AXIS 0b1010
void setPins(void);
void start(void);
void end(void);
void sample(void);
void shiftOut(byte data);
int shiftIn(void);
int getValue(byte command);
int getX(void);
int getY(void);
int getZ(void); |
/*
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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 <aws/ec2/EC2_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
namespace Aws
{
namespace EC2
{
namespace Model
{
enum class NetworkInterfaceType
{
NOT_SET,
interface,
natGateway,
efa
};
namespace NetworkInterfaceTypeMapper
{
AWS_EC2_API NetworkInterfaceType GetNetworkInterfaceTypeForName(const Aws::String& name);
AWS_EC2_API Aws::String GetNameForNetworkInterfaceType(NetworkInterfaceType value);
} // namespace NetworkInterfaceTypeMapper
} // namespace Model
} // namespace EC2
} // namespace Aws
|
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdbool.h>
#include <time.h>
#include "Hacl_Streaming_Poly1305_32.h"
#include "test_helpers.h"
#include "poly1305_vectors.h"
typedef struct Hacl_Streaming_Poly1305_32_poly1305_32_state_s poly1305_state;
int main() {
bool ok = true;
// Here, I can't really loop over the vectors... because I want to exercise
// the streaming API with various lengths. Otherwise, in an exemplary test,
// one would write a for-loop over the test vectors.
uint8_t tag[16] = {};
poly1305_test_vector *v = vectors;
poly1305_state *s = Hacl_Streaming_Poly1305_32_create_in(v->key);
Hacl_Streaming_Poly1305_32_update(s, v->input, 8);
Hacl_Streaming_Poly1305_32_update(s, v->input+8, 6);
Hacl_Streaming_Poly1305_32_update(s, v->input+14, v->input_len - 14);
Hacl_Streaming_Poly1305_32_finish(s, tag);
ok &= compare_and_print(16, tag, v->tag);
v++;
Hacl_Streaming_Poly1305_32_init(v->key, s);
Hacl_Streaming_Poly1305_32_update(s, NULL, 0);
Hacl_Streaming_Poly1305_32_update(s, v->input, v->input_len);
Hacl_Streaming_Poly1305_32_finish(s, tag);
ok &= compare_and_print(16, tag, v->tag);
v++;
Hacl_Streaming_Poly1305_32_init(v->key, s);
Hacl_Streaming_Poly1305_32_update(s, NULL, 0);
Hacl_Streaming_Poly1305_32_update(s, v->input, 8);
Hacl_Streaming_Poly1305_32_update(s, v->input+8, 8);
Hacl_Streaming_Poly1305_32_update(s, v->input+16, 16);
Hacl_Streaming_Poly1305_32_update(s, v->input+32, 8);
Hacl_Streaming_Poly1305_32_update(s, v->input+40, v->input_len - 40);
Hacl_Streaming_Poly1305_32_finish(s, tag);
ok &= compare_and_print(16, tag, v->tag);
Hacl_Streaming_Poly1305_32_free(s);
if (ok)
return EXIT_SUCCESS;
else
return EXIT_FAILURE;
}
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/iotsitewise/IoTSiteWise_EXPORTS.h>
#include <aws/iotsitewise/model/AssetModelState.h>
#include <aws/iotsitewise/model/ErrorDetails.h>
#include <utility>
namespace Aws
{
namespace Utils
{
namespace Json
{
class JsonValue;
class JsonView;
} // namespace Json
} // namespace Utils
namespace IoTSiteWise
{
namespace Model
{
/**
* <p>Contains current status information for an asset model. For more information,
* see <a
* href="https://docs.aws.amazon.com/iot-sitewise/latest/userguide/asset-and-model-states.html">Asset
* and model states</a> in the <i>AWS IoT SiteWise User Guide</i>.</p><p><h3>See
* Also:</h3> <a
* href="http://docs.aws.amazon.com/goto/WebAPI/iotsitewise-2019-12-02/AssetModelStatus">AWS
* API Reference</a></p>
*/
class AWS_IOTSITEWISE_API AssetModelStatus
{
public:
AssetModelStatus();
AssetModelStatus(Aws::Utils::Json::JsonView jsonValue);
AssetModelStatus& operator=(Aws::Utils::Json::JsonView jsonValue);
Aws::Utils::Json::JsonValue Jsonize() const;
/**
* <p>The current state of the asset model.</p>
*/
inline const AssetModelState& GetState() const{ return m_state; }
/**
* <p>The current state of the asset model.</p>
*/
inline bool StateHasBeenSet() const { return m_stateHasBeenSet; }
/**
* <p>The current state of the asset model.</p>
*/
inline void SetState(const AssetModelState& value) { m_stateHasBeenSet = true; m_state = value; }
/**
* <p>The current state of the asset model.</p>
*/
inline void SetState(AssetModelState&& value) { m_stateHasBeenSet = true; m_state = std::move(value); }
/**
* <p>The current state of the asset model.</p>
*/
inline AssetModelStatus& WithState(const AssetModelState& value) { SetState(value); return *this;}
/**
* <p>The current state of the asset model.</p>
*/
inline AssetModelStatus& WithState(AssetModelState&& value) { SetState(std::move(value)); return *this;}
/**
* <p>Contains associated error information, if any.</p>
*/
inline const ErrorDetails& GetError() const{ return m_error; }
/**
* <p>Contains associated error information, if any.</p>
*/
inline bool ErrorHasBeenSet() const { return m_errorHasBeenSet; }
/**
* <p>Contains associated error information, if any.</p>
*/
inline void SetError(const ErrorDetails& value) { m_errorHasBeenSet = true; m_error = value; }
/**
* <p>Contains associated error information, if any.</p>
*/
inline void SetError(ErrorDetails&& value) { m_errorHasBeenSet = true; m_error = std::move(value); }
/**
* <p>Contains associated error information, if any.</p>
*/
inline AssetModelStatus& WithError(const ErrorDetails& value) { SetError(value); return *this;}
/**
* <p>Contains associated error information, if any.</p>
*/
inline AssetModelStatus& WithError(ErrorDetails&& value) { SetError(std::move(value)); return *this;}
private:
AssetModelState m_state;
bool m_stateHasBeenSet;
ErrorDetails m_error;
bool m_errorHasBeenSet;
};
} // namespace Model
} // namespace IoTSiteWise
} // namespace Aws
|
//
// Copyright (C) 2016 OpenSim Ltd.
//
// This program 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
// 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 Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program; if not, see http://www.gnu.org/licenses/.
//
#ifndef __INET_RX_H
#define __INET_RX_H
#include "inet/linklayer/ieee80211/mac/contract/IRx.h"
#include "inet/linklayer/ieee80211/mac/Ieee80211Frame_m.h"
#include "inet/physicallayer/contract/packetlevel/IRadio.h"
namespace inet {
namespace ieee80211 {
class ITx;
class IContention;
class IStatistics;
/**
* The default implementation of IRx.
*/
class INET_API Rx : public cSimpleModule, public IRx
{
protected:
std::vector<IContention *> contentions;
IStatistics *statistics = nullptr;
MACAddress address;
cMessage *endNavTimer = nullptr;
IRadio::ReceptionState receptionState = IRadio::RECEPTION_STATE_UNDEFINED;
IRadio::TransmissionState transmissionState = IRadio::TRANSMISSION_STATE_UNDEFINED;
IRadioSignal::SignalPart receivedPart = IRadioSignal::SIGNAL_PART_NONE;
bool mediumFree = true; // cached state
protected:
virtual int numInitStages() const override { return NUM_INIT_STAGES; }
virtual void initialize(int stage) override;
virtual void handleMessage(cMessage *msg) override;
virtual void setOrExtendNav(simtime_t navInterval);
virtual bool isFcsOk(Ieee80211Frame *frame) const;
virtual void recomputeMediumFree();
virtual void refreshDisplay() const override;
public:
Rx();
~Rx();
virtual bool isReceptionInProgress() const override;
virtual bool isMediumFree() const override { return mediumFree; }
virtual void receptionStateChanged(IRadio::ReceptionState newReceptionState) override;
virtual void transmissionStateChanged(IRadio::TransmissionState transmissionState) override;
virtual void receivedSignalPartChanged(IRadioSignal::SignalPart part) override;
virtual bool lowerFrameReceived(Ieee80211Frame *frame) override;
virtual void frameTransmitted(simtime_t durationField) override;
virtual void registerContention(IContention *contention) override;
};
} // namespace ieee80211
} // namespace inet
#endif
|
/* Copyright 2014 APPNEXUS INC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#import "ANAdView.h"
#import "ANAdViewInternalDelegate.h"
#import "ANUniversalAdFetcher.h"
@interface ANAdView (PrivateMethods) <ANAdViewInternalDelegate, ANMultiAdProtocol>
@property (nonatomic, readwrite, strong, nonnull) ANUniversalAdFetcher *universalAdFetcher;
@property (nonatomic, readwrite) BOOL allowSmallerSizes;
/**
List of views added as Friendly Obstructions
*/
@property (nonatomic, readonly, strong, nullable) NSMutableArray<UIView *> *obstructionViews;
//
- (void)initialize;
- (BOOL)errorCheckConfiguration;
- (void)loadAd;
- (void)loadAdFromHtml:(nonnull NSString *)html
width:(int)width
height:(int)height;
- (void)loadAdFromVast: (nonnull NSString *)xml width: (int)width
height: (int)height;
- (void)setAdResponseInfo:(nonnull ANAdResponseInfo *)adResponseInfo;
- (void)setCreativeId:(nonnull NSString *)creativeId;
@end
|
//
// ViewController.h
// page
//
// Created by Jay on 7/8/18.
// Copyright © 2018年 Jay. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface SPPageViewController : UIViewController
@end
|
// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include <list>
#include <memory>
#include <queue>
#include <vector>
#include "ThreadPool.h"
#include "paddle/fluid/framework/reader.h"
#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP)
#include "paddle/fluid/platform/device/gpu/gpu_info.h"
#include "paddle/fluid/platform/device/gpu/gpu_resource_pool.h"
#endif
#ifdef PADDLE_WITH_ASCEND_CL
#include "paddle/fluid/platform/device/npu/npu_info.h"
#include "paddle/fluid/platform/device/npu/npu_resource_pool.h"
#endif
#ifdef PADDLE_WITH_MLU
#include "paddle/fluid/platform/device/mlu/mlu_info.h"
#include "paddle/fluid/platform/device/mlu/mlu_resource_pool.h"
#endif
namespace paddle {
namespace operators {
namespace reader {
class BufferedReader : public framework::DecoratedReader {
using TensorVec = std::vector<framework::LoDTensor>;
using VecFuture = std::future<TensorVec>;
public:
BufferedReader(const std::shared_ptr<framework::ReaderBase>& reader,
const platform::Place& place, size_t buffer_size,
bool pin_memory = false);
~BufferedReader() override;
private:
void ReadTillBufferFullAsync();
void ReadAsync(size_t i);
protected:
void ShutdownImpl() override;
void StartImpl() override;
void ReadNextImpl(std::vector<framework::LoDTensor>* out) override;
private:
ThreadPool thread_pool_;
platform::Place place_;
const size_t buffer_size_;
bool pin_memory_;
std::queue<std::future<size_t>> position_;
// The buffer for reading data.
// NOTE: the simplest way to implement buffered reader is do not use any
// buffer, just read async and create futures as buffer size. However, to
// malloc tensors every time is extremely slow. Here we store all data in
// buffers and prevent alloc every time.
std::vector<TensorVec> cpu_buffer_;
std::vector<TensorVec> cuda_buffer_;
std::vector<TensorVec> npu_buffer_;
std::vector<TensorVec> mlu_buffer_;
size_t prev_pos_{-1UL};
#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP)
gpuStream_t compute_stream_;
std::shared_ptr<platform::CudaStreamObject> stream_;
std::vector<std::shared_ptr<platform::CudaEventObject>> events_;
#endif
#ifdef PADDLE_WITH_ASCEND_CL
aclrtStream compute_stream_;
std::shared_ptr<platform::NpuStreamObject> stream_;
std::vector<std::shared_ptr<platform::NpuEventObject>> events_;
#endif
#ifdef PADDLE_WITH_MLU
mluStream compute_stream_;
std::shared_ptr<platform::MluStreamObject> stream_;
std::vector<std::shared_ptr<platform::MluEventObject>> events_;
#endif
};
} // namespace reader
} // namespace operators
} // namespace paddle
|
/*
* $Source: /project/arl/arlcvs/cvsroot/wu_arl/wusrc/wulib/kern.h,v $
* $Author: fredk $
* $Date: 2007/03/06 21:30:14 $
* $Revision: 1.3 $
* $Name: $
*
* File:
* Author: Fred Kuhns <fredk@arl.wustl.edu>
* Organization: Applied Research Laboratory,
* Washington University in St. Louis
* Description:
*
*
*/
#ifndef _WU_KERN_H
#define _WU_KERN_H
#ifdef __KERNEL__
# include <linux/kernel.h> /* Needed for KERN_ALERT, printk */
# include <linux/init.h> /* Needed for the macros */
# include <linux/types.h> /* Needed for the macros */
# include <linux/config.h>
# include <linux/time.h> /* struct timeval */
# include <linux/spinlock.h>
# include <linux/string.h>
# define printf printk
# define PRIx8 "x"
# define PRIx16 "x"
# define PRIx32 "x"
# define PRIx64 "llx"
# define PRId32 "d"
#else
# include <stdio.h>
# include <stdlib.h>
# include <inttypes.h> // also includes #include <stdint.h>
# include <string.h>
# include <wulib/wulog.h>
#endif
#endif /* _WU_KERN_H */
|
/*
* Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
*/
#ifndef __IFMAP_LOG_H__
#define __IFMAP_LOG_H__
#include "sandesh/sandesh_types.h"
#include "sandesh/sandesh.h"
#include "sandesh/sandesh_trace.h"
#include "sandesh/common/vns_types.h"
#include "sandesh/common/vns_constants.h"
extern SandeshTraceBufferPtr IFMapTraceBuf;
extern SandeshTraceBufferPtr IFMapBigMsgTraceBuf;
// Log and trace regular messages
#define IFMAP_DEBUG_LOG(obj, ...) \
do { \
if (!LoggingDisabled()) { \
obj::Send(g_vns_constants.CategoryNames.find(Category::IFMAP)->second, \
SandeshLevel::SYS_DEBUG, __FILE__, __LINE__, ##__VA_ARGS__); \
} \
} while(0)
#define IFMAP_TRACE(obj, ...) \
do { \
obj::TraceMsg(IFMapTraceBuf, __FILE__, __LINE__, __VA_ARGS__); \
} while(0)
#define IFMAP_DEBUG(obj, ...) \
do { \
IFMAP_DEBUG_LOG(obj, __VA_ARGS__); \
IFMAP_TRACE(obj##Trace, __VA_ARGS__); \
} while(0)
// Log and trace big-sized messages
#define IFMAP_DEBUG_LOG_BIG_MSG(obj, ...) \
do { \
if (!LoggingDisabled()) { \
obj::Send(g_vns_constants.CategoryNames.find(Category::IFMAP)->second, \
SandeshLevel::SYS_DEBUG, __FILE__, __LINE__, ##__VA_ARGS__); \
} \
} while(0)
#define IFMAP_TRACE_BIG_MSG(obj, ...) \
do { \
obj::TraceMsg(IFMapBigMsgTraceBuf, __FILE__, __LINE__, __VA_ARGS__); \
} while(0)
#define IFMAP_LOG_POLL_RESP(obj, ...) \
do { \
IFMAP_DEBUG_LOG_BIG_MSG(obj, __VA_ARGS__); \
IFMAP_TRACE_BIG_MSG(obj##Trace, __VA_ARGS__); \
} while(0)
// Warnings
#define IFMAP_WARN_LOG(obj, ...) \
do { \
if (!LoggingDisabled()) { \
obj::Send(g_vns_constants.CategoryNames.find(Category::IFMAP)->second, \
SandeshLevel::SYS_WARN, __FILE__, __LINE__, ##__VA_ARGS__); \
} \
} while(0)
#define IFMAP_WARN(obj, ...) \
do { \
IFMAP_WARN_LOG(obj, __VA_ARGS__); \
IFMAP_TRACE(obj##Trace, __VA_ARGS__); \
} while(0)
#endif // __IFMAP_LOG_H__
|
// Copyright 2015-2020 Espressif Systems (Shanghai) PTE 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.
#pragma once
#include <stdint.h>
#include "esp_flash.h"
#include "spi_flash_chip_driver.h"
/**
* Winbond SPI flash chip_drv, uses all the above functions for its operations. In
* default autodetection, this is used as a catchall if a more specific chip_drv
* is not found.
*/
extern const spi_flash_chip_t esp_flash_chip_winbond;
|
//
// MTHomeDropdown.h
// meituan
//
// Created by MC on 16/2/22.
// Copyright © 2016年 MC. All rights reserved.
//
#import <UIKit/UIKit.h>
@class MTHomeDropdown;
//@protocol MTHomeDropdownData <NSObject>
//
//- (NSString *)tital;
//- (NSString *)icon;
//- (NSString *)selectedIcon;
//- (NSArray *)subData;
//
//@end
@protocol MTHomeDropdownDataSource <NSObject>
/**
* 左边的表格一共有多少行
*
*/
- (NSInteger)numberOfRowsInMainTable:(MTHomeDropdown *)homeDropdown;
- (NSString *)homeDropdown:(MTHomeDropdown *)homeDropdown titleForRowInMainTable:(int)row;
- (NSArray *)homeDropdown:(MTHomeDropdown *)homeDropdown subDataForRowInMainTable:(int)row;
@optional
- (NSString *)homeDropdown:(MTHomeDropdown *)homeDropdown iconForRowInMainTable:(int)row;
- (NSString *)homeDropdown:(MTHomeDropdown *)homeDropdown selectedIconForRowInMainTable:(int)row;
@end
@interface MTHomeDropdown : UIView
+ (instancetype) dropdown;
@property (nonatomic, weak) id dataSource;
//@property (nonatomic, strong) NSArray *categories;
@end
|
#pragma once
struct Coordinates {
Coordinates();
Coordinates(int x, int y);
int X;
int Y;
}; |
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2010 by feed, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*
* WARNING: This is generated code. Modify at your own risk and without support.
*/
#import "TiBase.h"
#ifdef USE_TI_FILESYSTEM
#import "TiFile.h"
@interface TiFilesystemBlobProxy : TiFile {
@private
NSURL *url;
NSData *data;
}
-(id)initWithURL:(NSURL*)url data:(NSData*)data;
@end
#endif |
#pragma once
#include "core/utility/resource_manager.h"
#include <istream>
#include <map>
#include <string>
#include <unordered_map>
namespace eversim { namespace core { namespace world {
class level;
struct tile_descriptor;
class tile_loader;
class level_loader final: public utility::resource_manager<level_loader, std::string, level> {
public:
using tile_loader_ptr = std::shared_ptr<tile_loader>;
explicit level_loader(tile_loader_ptr = nullptr);
static std::map<uint32_t, std::string> load_id_table(std::istream& data);
void register_tile_descriptor(tile_descriptor const*);
std::vector<std::string> get_level_tiles(std::string const& name) const;
protected:
ptr_type load_file(std::string const& filename) override;
private:
tile_loader_ptr tile_loader_;
std::unordered_map<std::string, tile_descriptor const*> descriptors;
};
}}}
|
/*
* SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "soc/rtc.h"
#include "esp_err.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief This function is used to enable the digital 8m rtc clock,
* to support the peripherals.
*
* @note If this function is called a number of times, the `periph_rtc_dig_clk8m_disable`
* function needs to be called same times to disable.
*
* @return true: success for enable the rtc 8M clock, false: rtc 8M clock enable failed
*/
bool periph_rtc_dig_clk8m_enable(void);
/**
* @brief This function is used to disable the rtc digital clock, which should be called
* with the `periph_rtc_dig_clk8m_enable` pairedly
*
* @note If this function is called a number of times, the `periph_rtc_dig_clk8m_disable`
* function needs to be called same times to disable.
*/
void periph_rtc_dig_clk8m_disable(void);
/**
* @brief This function is used to get the real clock frequency value of the rtc clock
*
* @return The real clock value
*/
uint32_t periph_rtc_dig_clk8m_get_freq(void);
#if SOC_CLK_APLL_SUPPORTED
/**
* @brief Enable APLL power if it has not enabled
*/
void periph_rtc_apll_acquire(void);
/**
* @brief Shut down APLL power if no peripherals using APLL
*/
void periph_rtc_apll_release(void);
/**
* @brief Calculate and set APLL coefficients by given frequency
* @note Have to call 'periph_rtc_apll_acquire' to enable APLL power before setting frequency
* @note This calculation is based on the inequality:
* xtal_freq * (4 + sdm2 + sdm1/256 + sdm0/65536) >= SOC_APLL_MULTIPLIER_OUT_MIN_HZ(350 MHz)
* It will always calculate the minimum coefficients that can satisfy the inequality above, instead of loop them one by one.
* which means more appropriate coefficients are likely to exist.
* But this algorithm can meet almost all the cases and the accuracy can be guaranteed as well.
* @note The APLL frequency is only allowed to set when there is only one peripheral refer to it.
* If APLL is already set by another peripheral, this function will return `ESP_ERR_INVALID_STATE`
* and output the current frequency by parameter `real_freq`.
*
* @param expt_freq Expected APLL frequency (unit: Hz)
* @param real_freq APLL real working frequency [output] (unit: Hz)
* @return
* - ESP_OK: APLL frequency set success
* - ESP_ERR_INVALID_ARG: The input expt_freq is out of APLL support range
* - ESP_ERR_INVALID_STATE: APLL is refered by more than one peripherals, not allowed to change its frequency now
*/
esp_err_t periph_rtc_apll_freq_set(uint32_t expt_freq, uint32_t *real_freq);
#endif // SOC_CLK_APLL_SUPPORTED
#ifdef __cplusplus
}
#endif
|
/* MBEDTLS_USER_CONFIG_FILE for testing.
* Only used for a few test configurations.
*
* Typical usage (note multiple levels of quoting):
* make CFLAGS="'-DMBEDTLS_USER_CONFIG_FILE=\"../tests/configs/user-config-for-test.h\"'"
*/
/*
* Copyright The Mbed TLS Contributors
* SPDX-License-Identifier: Apache-2.0
*
* 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.
*/
#if defined(PSA_CRYPTO_DRIVER_TEST_ALL)
/* Enable the use of the test driver in the library, and build the generic
* part of the test driver. */
#define PSA_CRYPTO_DRIVER_TEST
/* Use the accelerator driver for all cryptographic mechanisms for which
* the test driver implemented. */
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_AES
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_CAMELLIA
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR
#define MBEDTLS_PSA_ACCEL_ALG_CBC_NO_PADDING
#define MBEDTLS_PSA_ACCEL_ALG_CBC_PKCS7
#define MBEDTLS_PSA_ACCEL_ALG_CTR
#define MBEDTLS_PSA_ACCEL_ALG_CFB
#define MBEDTLS_PSA_ACCEL_ALG_ECDSA
#define MBEDTLS_PSA_ACCEL_ALG_DETERMINISTIC_ECDSA
#define MBEDTLS_PSA_ACCEL_ALG_MD5
#define MBEDTLS_PSA_ACCEL_ALG_OFB
#define MBEDTLS_PSA_ACCEL_ALG_RIPEMD160
#define MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_SIGN
#define MBEDTLS_PSA_ACCEL_ALG_RSA_PSS
#define MBEDTLS_PSA_ACCEL_ALG_SHA_1
#define MBEDTLS_PSA_ACCEL_ALG_SHA_224
#define MBEDTLS_PSA_ACCEL_ALG_SHA_256
#define MBEDTLS_PSA_ACCEL_ALG_SHA_384
#define MBEDTLS_PSA_ACCEL_ALG_SHA_512
#define MBEDTLS_PSA_ACCEL_ALG_XTS
#define MBEDTLS_PSA_ACCEL_ALG_CMAC
#define MBEDTLS_PSA_ACCEL_ALG_HMAC
#endif /* PSA_CRYPTO_DRIVER_TEST_ALL */
|
/*
* (c) 2015 - Copyright Marlin Trust Management Organization
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __CENC_INIT_FORMAT_DATA_H__
#define __CENC_INIT_FORMAT_DATA_H__
#include <vector>
#include "MarlinCommonTypes.h"
#include "InitDataParserErrors.h"
#include "CommonHeaderParser.h"
namespace marlincdm {
static const INIT_DATA_KEY KEY_CENC_DATA = "cenc";
static const INIT_DATA_KEY KEY_LICENSE_EMBEDDED = "license_embedded";
static const INIT_DATA_KEY KEY_PSSH_DATA = "pssh";
static const INIT_DATA_KEY KEY_KIDS_DATA = "kids";
static const INIT_DATA_KEY KEY_KEYIDS_DATA = "keyids";
static const INIT_DATA_KEY KEY_SESSION_ID_DATA = "sessionid";
class CencInitFormatData {
public:
CencInitFormatData();
virtual ~CencInitFormatData();
parse_status_t parse(const string& data);
parse_status_t parseKeyIds(const string& data);
bool& getLicenseEmbedded();
mcdm_data_t& getPssh();
vector<uint8_t*>& getKidList();
string& getContentId();
private:
bool mLicenseEmbedded;
mcdm_SessionId_t mSessionId;
mcdm_data_t mPssh;
vector<uint8_t*> mKidList;
string mCID;
}; // class
}; // namespace
#endif /* __CENC_INIT_FORMAT_DATA_H__ */
|
//
// HeadView.h
// TinyDay
//
// Created by 臻 曦 on 16/8/15.
// Copyright © 2016年 Icemelt. All rights reserved.
//
#import <UIKit/UIKit.h>
@class TDTinyHeadView;
@protocol headViewDataSource <NSObject>
- (NSInteger)numberOfItems:(TDTinyHeadView *)headView;
- (NSURL *)headView:(TDTinyHeadView *)headView iconURLForIndex:(NSInteger)index;
@end
@protocol headViewDelegate <NSObject>
- (void)headView:(TDTinyHeadView *)headView didSelsctedItemIndex:(NSInteger)index;
@end
@interface TDTinyHeadView : UIView<iCarouselDelegate,iCarouselDataSource>
@property (nonatomic) iCarousel *ic;
@property (nonatomic) UIPageControl *pc;
//刷新页面;
- (void)reloadData;
//为了防止循环引用问题 一定要使用weak修饰
@property (nonatomic, weak) id<headViewDelegate> delegate;
@property (nonatomic, weak) id<headViewDataSource> dataSource;
@property (nonatomic) NSTimer *timer;
//默认为YES; 自动滚动;
@property (nonatomic) BOOL autoScroll;
//滚动的间隔时间,默认2秒;
@property (nonatomic) NSTimeInterval duration;
//点击事件;
@property (nonatomic, copy) void(^btnClicked)(UIControl *btn);
@end
|
/*******************************************************************************
* Copyright (c) 2015-2018 Skymind, Inc.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://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.
*
* SPDX-License-Identifier: Apache-2.0
******************************************************************************/
//
// Created by raver119 on 16.10.2017.
// Modified by GS <sgazeos@gmail.com> on 19.10.2018
// Modified by GS <sgazeos@gmail.com> on 19.10.2018
//
#ifndef LIBND4J__LEGACY_TRANSFORM_BOOL_OP__H
#define LIBND4J__LEGACY_TRANSFORM_BOOL_OP__H
#include <ops/declarable/LegacyOp.h>
namespace sd {
namespace ops {
/**
* This class provides wrapper for Transform operations (i.e. Pow or OneMinus)
*/
class ND4J_EXPORT LegacyTransformBoolOp : public LegacyOp {
protected:
Nd4jStatus validateAndExecute(Context &block) override;
public:
LegacyTransformBoolOp();
LegacyTransformBoolOp(int opNum);
ShapeList* calculateOutputShape(ShapeList* inputShape, sd::graph::Context &block) override;
LegacyOp* clone() override;
};
}
}
#endif //LIBND4J__LEGACY_TRANSFORM_SAME_OP__H
|
#include <chrono>
#include <list>
#include <string>
#include <tuple>
#include <vector>
#include "envoy/api/api.h"
#include "envoy/config/cluster/v3/cluster.pb.h"
#include "envoy/http/codec.h"
#include "envoy/upstream/cluster_manager.h"
#include "common/network/address_impl.h"
#include "common/upstream/cluster_factory_impl.h"
#include "server/transport_socket_config_impl.h"
#include "test/common/upstream/utility.h"
#include "test/integration/clusters/cluster_factory_config.pb.h"
#include "test/integration/clusters/cluster_factory_config.pb.validate.h"
#include "test/test_common/registry.h"
namespace Envoy {
class CustomStaticCluster : public Upstream::ClusterImplBase {
public:
CustomStaticCluster(const envoy::config::cluster::v3::Cluster& cluster, Runtime::Loader& runtime,
Server::Configuration::TransportSocketFactoryContext& factory_context,
Stats::ScopePtr&& stats_scope, bool added_via_api, uint32_t priority,
std::string address, uint32_t port)
: ClusterImplBase(cluster, runtime, factory_context, std::move(stats_scope), added_via_api),
priority_(priority), address_(std::move(address)), port_(port), host_(makeHost()) {}
InitializePhase initializePhase() const override { return InitializePhase::Primary; }
private:
struct LbImpl : public Upstream::LoadBalancer {
LbImpl(const Upstream::HostSharedPtr& host) : host_(host) {}
Upstream::HostConstSharedPtr chooseHost(Upstream::LoadBalancerContext*) override {
return host_;
}
const Upstream::HostSharedPtr host_;
};
struct LbFactory : public Upstream::LoadBalancerFactory {
LbFactory(const Upstream::HostSharedPtr& host) : host_(host) {}
Upstream::LoadBalancerPtr create() override { return std::make_unique<LbImpl>(host_); }
const Upstream::HostSharedPtr host_;
};
struct ThreadAwareLbImpl : public Upstream::ThreadAwareLoadBalancer {
ThreadAwareLbImpl(const Upstream::HostSharedPtr& host) : host_(host) {}
Upstream::LoadBalancerFactorySharedPtr factory() override {
return std::make_shared<LbFactory>(host_);
}
void initialize() override {}
const Upstream::HostSharedPtr host_;
};
Upstream::ThreadAwareLoadBalancerPtr threadAwareLb();
// ClusterImplBase
void startPreInit() override;
Upstream::HostSharedPtr makeHost();
const uint32_t priority_;
const std::string address_;
const uint32_t port_;
const Upstream::HostSharedPtr host_;
friend class CustomStaticClusterFactoryBase;
};
class CustomStaticClusterFactoryBase : public Upstream::ConfigurableClusterFactoryBase<
test::integration::clusters::CustomStaticConfig> {
protected:
CustomStaticClusterFactoryBase(const std::string& name, bool create_lb)
: ConfigurableClusterFactoryBase(name), create_lb_(create_lb) {}
private:
std::pair<Upstream::ClusterImplBaseSharedPtr, Upstream::ThreadAwareLoadBalancerPtr>
createClusterWithConfig(
const envoy::config::cluster::v3::Cluster& cluster,
const test::integration::clusters::CustomStaticConfig& proto_config,
Upstream::ClusterFactoryContext& context,
Server::Configuration::TransportSocketFactoryContext& socket_factory_context,
Stats::ScopePtr&& stats_scope) override {
auto new_cluster = std::make_shared<CustomStaticCluster>(
cluster, context.runtime(), socket_factory_context, std::move(stats_scope),
context.addedViaApi(), proto_config.priority(), proto_config.address(),
proto_config.port_value());
return std::make_pair(new_cluster, create_lb_ ? new_cluster->threadAwareLb() : nullptr);
}
const bool create_lb_;
};
class CustomStaticClusterFactoryNoLb : public CustomStaticClusterFactoryBase {
public:
CustomStaticClusterFactoryNoLb()
: CustomStaticClusterFactoryBase("envoy.clusters.custom_static", false) {}
};
class CustomStaticClusterFactoryWithLb : public CustomStaticClusterFactoryBase {
public:
CustomStaticClusterFactoryWithLb()
: CustomStaticClusterFactoryBase("envoy.clusters.custom_static_with_lb", true) {}
};
} // namespace Envoy
|
#ifndef __MZX_BUCKET_SORT_H__
#define __MZX_BUCKET_SORT_H__
#include <map>
#include <vector>
#include <mzx/algorithm/sort/insert_sort.h>
#include <mzx/logger.h>
namespace mzx
{
template <typename RandIt, typename Compare>
void BucketSort(RandIt begin, RandIt end, Compare comp)
{
MZX_CHECK_STATIC(
std::is_same<
std::random_access_iterator_tag,
typename std::iterator_traits<RandIt>::iterator_category>::value);
MZX_CHECK_STATIC(
std::is_integral<typename std::decay<decltype(*begin)>::type>::value);
MZX_CHECK(end > begin);
using T = typename std::decay<decltype(*begin)>::type;
T num = 10;
std::map<T, std::vector<T>> buckets;
for (auto iter = begin; iter != end; ++iter)
{
buckets[*iter / num].emplace_back(std::move(*iter));
}
auto iter_copy = begin;
for (auto iter = buckets.begin(); iter != buckets.end(); ++iter)
{
if (iter->second.empty())
{
continue;
}
InsertSort(iter->second.begin(), iter->second.end(), comp);
for (auto &tmp : iter->second)
{
*iter_copy++ = std::move(tmp);
}
}
}
template <typename RandIt>
void BucketSort(RandIt begin, RandIt end)
{
BucketSort(begin, end, std::less<decltype(*begin)>());
}
} // namespace mzx
#endif
|
// Licensed to the Software Freedom Conservancy (SFC) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The SFC 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.
#ifndef WEBDRIVER_IE_COMMANDHANDLER_H_
#define WEBDRIVER_IE_COMMANDHANDLER_H_
#include <map>
#include <memory>
#include <string>
#include "command_handler.h"
#include "command.h"
#include "Element.h"
#include "response.h"
#include "Script.h"
#define BROWSER_NAME_CAPABILITY "browserName"
#define BROWSER_VERSION_CAPABILITY "version"
#define PLATFORM_CAPABILITY "platform"
#define JAVASCRIPT_ENABLED_CAPABILITY "javascriptEnabled"
#define TAKES_SCREENSHOT_CAPABILITY "takesScreenshot"
#define HANDLES_ALERTS_CAPABILITY "handlesAlerts"
#define UNEXPECTED_ALERT_BEHAVIOR_CAPABILITY "unexpectedAlertBehaviour"
#define CSS_SELECTOR_ENABLED_CAPABILITY "cssSelectorsEnabled"
#define NATIVE_EVENTS_CAPABILITY "nativeEvents"
#define PROXY_CAPABILITY "proxy"
#define PAGE_LOAD_STRATEGY_CAPABILITY "pageLoadStrategy"
#define IGNORE_PROTECTED_MODE_CAPABILITY "ignoreProtectedModeSettings"
#define IGNORE_ZOOM_SETTING_CAPABILITY "ignoreZoomSetting"
#define INITIAL_BROWSER_URL_CAPABILITY "initialBrowserUrl"
#define ELEMENT_SCROLL_BEHAVIOR_CAPABILITY "elementScrollBehavior"
#define ENABLE_PERSISTENT_HOVER_CAPABILITY "enablePersistentHover"
#define ENABLE_ELEMENT_CACHE_CLEANUP_CAPABILITY "enableElementCacheCleanup"
#define REQUIRE_WINDOW_FOCUS_CAPABILITY "requireWindowFocus"
#define BROWSER_ATTACH_TIMEOUT_CAPABILITY "browserAttachTimeout"
#define BROWSER_COMMAND_LINE_SWITCHES_CAPABILITY "ie.browserCommandLineSwitches"
#define FORCE_CREATE_PROCESS_API_CAPABILITY "ie.forceCreateProcessApi"
#define USE_PER_PROCESS_PROXY_CAPABILITY "ie.usePerProcessProxy"
#define ENSURE_CLEAN_SESSION_CAPABILITY "ie.ensureCleanSession"
#define FORCE_SHELL_WINDOWS_API_CAPABILITY "ie.forceShellWindowsApi"
#define VALIDATE_COOKIE_DOCUMENT_TYPE_CAPABILITY "ie.validateCookieDocumentType"
#define RESIZE_WHEN_TAKING_SCREENSHOT_CAPABILITY "ie.resizeWhenTakingScreenshot"
using namespace std;
namespace webdriver {
// Forward declaration of classes to avoid
// circular include files.
class IECommandExecutor;
class IECommandHandler : public CommandHandler<IECommandExecutor> {
public:
IECommandHandler(void);
virtual ~IECommandHandler(void);
protected:
virtual void ExecuteInternal(const IECommandExecutor& executor,
const ParametersMap& command_parameters,
Response* response);
int GetElement(const IECommandExecutor& executor,
const std::string& element_id,
ElementHandle* element_wrapper);
Json::Value RecreateJsonParameterObject(const ParametersMap& command_parameters);
};
typedef std::tr1::shared_ptr<IECommandHandler> CommandHandlerHandle;
} // namespace webdriver
#endif // WEBDRIVER_IE_COMMANDHANDLER_H_
|
/*
** %Z% %I% %W% %G% %U%
**
** ZZ_Copyright_BEGIN
**
**
** Licensed Materials - Property of IBM
**
** IBM Linear Tape File System Single Drive Edition Version 1.3.0.2 for Linux and Mac OS X
**
** Copyright IBM Corp. 2010, 2013
**
** This file is part of the IBM Linear Tape File System Single Drive Edition for Linux and Mac OS X
** (formally known as IBM Linear Tape File System)
**
** The IBM Linear Tape File System Single Drive Edition for Linux and Mac OS X 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,
** version 2.1 of the License.
**
** The IBM Linear Tape File System Single Drive Edition for Linux and Mac OS X 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
** or download the license from <http://www.gnu.org/licenses/>.
**
**
** ZZ_Copyright_END
*/
#ifndef __ltfslogging_h
#define __ltfslogging_h
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include <stdbool.h>
#include <inttypes.h>
#include "ltfsprintf.h"
enum ltfs_log_levels {
LTFS_ERR = 0, /* Fatal error or operation failed unexpectedly */
LTFS_WARN = 1, /* Unexpected condition, but the program can continue */
LTFS_INFO = 2, /* Helpful message */
LTFS_DEBUG = 3, /* Diagnostic messages */
LTFS_TRACE = 4, /* Full call tracing */
};
extern int ltfs_log_level;
/* Put this macro in front of a function definition to prevent gcc from tracing it. */
#ifdef mingw_PLATFORM
#define NOTRACE_FN
#else
#define NOTRACE_FN __attribute__((no_instrument_function))
#endif
/* Wrapper for ltfsmsg_internal. It only invokes the message print function if the requested
* log level is not too verbose. */
#define ltfsmsg(level, id, ...) \
do { \
if (level <= ltfs_log_level) \
ltfsmsg_internal(true, level, NULL, id, ##__VA_ARGS__); \
} while (0)
/* Wrapper for ltfsmsg_internal. It only invokes the message print function if the requested
* log level is not too verbose. */
#define ltfsmsg_buffer(level, id, buffer, ...) \
do { \
*buffer = NULL; \
if (level <= ltfs_log_level) \
ltfsmsg_internal(true, level, buffer, id, ##__VA_ARGS__); \
} while (0)
/* Wrapper for ltfsmsg_internal that prints a message without the LTFSnnnnn prefix. It
* always invokes the message print function, regardless of the message level. */
#define ltfsresult(id, ...) \
do { \
ltfsmsg_internal(false, LTFS_TRACE + 1, NULL, id, ##__VA_ARGS__); \
} while (0)
/* Shortcut for asserting that a function argument is not NULL. It generates an error-level
* message if the given argument is NULL. Functions for which a NULL argument is a warning
* should not use this macro. */
#define CHECK_ARG_NULL(var, ret) \
do { \
if (! (var)) { \
ltfsmsg(LTFS_ERR, "10005E", #var, __FUNCTION__); \
return ret; \
} \
} while (0)
/**
* Initialize the logging and error reporting functions.
* @param log_level Logging level (generally one of LTFS_ERROR...LTFS_TRACE).
* @param use_syslog Send error/warning/info messages to syslog? This function does not call
* openlog(); the calling application may do so if it wants to.
* @return 0 on success or a negative value on error.
*/
int ltfsprintf_init(int log_level, bool use_syslog);
/**
* Tear down the logging and error reporting framework.
*/
void ltfsprintf_finish();
/**
* Update ltfs_log_level
*/
int ltfsprintf_set_log_level(int log_level);
/**
* Load messages for a plugin from the specified resource name.
* @param bundle_name Message bundle name.
* @param bundle_data Message bundle data structure.
* @param messages On success, contains a handle to the loaded message bundles. That handle
* should be passed to @ltfsprintf_unload_plugin later.
* @return 0 on success or a negative value on error.
*/
int ltfsprintf_load_plugin(const char *bundle_name, void *bundle_data, void **messages);
/**
* Stop using messages from the given plugin message bundle.
* @param handle Message bundle handle, as returned by @ltfsprintf_load_plugin.
*/
void ltfsprintf_unload_plugin(void *handle);
/**
* Print a message in the system locale. Any extra arguments are substituted into the
* format string. The current logging level is ignored, so the ltfsmsg macro
* (which calls this function) should be used instead.
* The generated output goes to stderr. If syslog is enabled, messages of severity LTFS_INFO
* through LTFS_ERR go to syslog as well. LTFS_DEBUG and LTFS_TRACE level messages always go
* only to stderr.
* @param print_id Print the message prefix LTFSnnnnn ?
* @param level Log level of this message, must be one of the ltfs_log_levels (LTFS_ERROR, etc.).
* @param id Unique ID of this error.
* @return 0 if a message was printed or a negative value on error.
*/
NOTRACE_FN int ltfsmsg_internal(bool print_id, int level, char **msg_out, const char *id, ...);
#ifdef __cplusplus
}
#endif
#endif /* __ltfslogging_h */
|
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2009-2011 by Felicidades, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*
* WARNING: This is generated code. Modify at your own risk and without support.
*/
#import <Foundation/Foundation.h>
#import "TiProxy.h"
#import "TiBlob.h"
// TODO: Support array-style access of bytes
/**
The class represents a buffer of bytes.
*/
@interface TiBuffer : TiProxy {
NSMutableData* data;
NSNumber* byteOrder;
}
/**
Provides access to raw data.
*/
@property(nonatomic, retain) NSMutableData* data;
// Public API
-(NSNumber*)append:(id)args;
-(NSNumber*)insert:(id)args;
-(NSNumber*)copy:(id)args;
-(TiBuffer*)clone:(id)args;
-(void)fill:(id)args;
-(void)clear:(id)_void;
-(void)release:(id)_void;
-(TiBlob*)toBlob:(id)_void;
-(NSString*)toString:(id)_void;
/**
Provides access to the buffer length.
*/
@property(nonatomic,assign) NSNumber* length;
/**
Provides access to the data byte order.
The byte order values are: 1 - little-endian, 2 - big-endian.
*/
@property(nonatomic,retain) NSNumber* byteOrder;
// SPECIAL NOTES:
// Ti.Buffer objects have an 'overloaded' Ti.Buffer[x] operation for x==int (making them behave like arrays).
// See the code for how this works.
@end
|
/*
* File: IAS-LangLib/src/lang/printer/expr/xpath/XPathVariableAccessNodeHandler.h
*
* Copyright (C) 2015, Albert Krzymowski
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _IAS_AS_Lang_Printer_Expr_XPath_VariableAccessNodeHandler_H_
#define _IAS_AS_Lang_Printer_Expr_XPath_VariableAccessNodeHandler_H_
#include <lang/printer/CallbackSignature.h>
namespace IAS {
namespace Lang {
namespace Printer {
namespace Expr {
namespace XPath {
/*************************************************************************/
/** The class. */
class XPathVariableAccessNodeHandler :
public ::IAS::Lang::Printer::CallbackSignature {
public:
virtual ~XPathVariableAccessNodeHandler() throw();
virtual void call(const Model::Node* pNode, CallbackCtx *pCtx, std::ostream& os);
protected:
XPathVariableAccessNodeHandler()throw();
friend class ::IAS::Factory<XPathVariableAccessNodeHandler>;
};
/*************************************************************************/
}
}
}
}
}
#endif /* _IAS_AS_Lang_Printer_Expr_XPath_VariableAccessNodeHandler_H_ */
|
#include <MakerSpaceMQTT.h>
#include <Print.h>
#ifndef _H_SyslogStream
#define _H_SyslogStream
class SyslogStream : public ACLog {
public:
const char * name() { return "SyslogStream"; }
SyslogStream(const uint16_t syslogPort = 514) : _syslogPort(syslogPort) {};
void setPort(uint16_t port) { _syslogPort = port; }
void setDestination(const char * dest) { _dest = dest; }
void setRaw(bool raw) { _raw = raw; }
virtual size_t write(uint8_t c);
private:
const char * _dest;
uint16_t _syslogPort;
char logbuff[1024];
size_t at = 0;
bool _raw;
protected:
};
#endif
|
//
// PIAppDelegate.h
// Polipo-iOS
//
// Created by Yifan Lu on 8/4/13.
// Copyright (c) 2013 Yifan Lu. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface PIAppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
/**
* Copyright (c) 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#include "CSSNodeList.h"
struct CSSNodeList {
uint32_t capacity;
uint32_t count;
CSSNodeRef *items;
};
CSSNodeListRef CSSNodeListNew(const uint32_t initialCapacity) {
const CSSNodeListRef list = malloc(sizeof(struct CSSNodeList));
CSS_ASSERT(list != NULL, "Could not allocate memory for list");
list->capacity = initialCapacity;
list->count = 0;
list->items = malloc(sizeof(CSSNodeRef) * list->capacity);
CSS_ASSERT(list->items != NULL, "Could not allocate memory for items");
return list;
}
void CSSNodeListFree(const CSSNodeListRef list) {
if (list) {
free(list->items);
free(list);
}
}
uint32_t CSSNodeListCount(const CSSNodeListRef list) {
if (list) {
return list->count;
}
return 0;
}
void CSSNodeListAdd(CSSNodeListRef *listp, const CSSNodeRef node) {
if (!*listp) {
*listp = CSSNodeListNew(4);
}
CSSNodeListInsert(listp, node, (*listp)->count);
}
void CSSNodeListInsert(CSSNodeListRef *listp, const CSSNodeRef node, const uint32_t index) {
if (!*listp) {
*listp = CSSNodeListNew(4);
}
CSSNodeListRef list = *listp;
if (list->count == list->capacity) {
list->capacity *= 2;
list->items = realloc(list->items, sizeof(CSSNodeRef) * list->capacity);
CSS_ASSERT(list->items != NULL, "Could not extend allocation for items");
}
for (uint32_t i = list->count; i > index; i--) {
list->items[i] = list->items[i - 1];
}
list->count++;
list->items[index] = node;
}
CSSNodeRef CSSNodeListRemove(const CSSNodeListRef list, const uint32_t index) {
const CSSNodeRef removed = list->items[index];
list->items[index] = NULL;
for (uint32_t i = index; i < list->count - 1; i++) {
list->items[i] = list->items[i + 1];
list->items[i + 1] = NULL;
}
list->count--;
return removed;
}
CSSNodeRef CSSNodeListDelete(const CSSNodeListRef list, const CSSNodeRef node) {
for (uint32_t i = 0; i < list->count; i++) {
if (list->items[i] == node) {
return CSSNodeListRemove(list, i);
}
}
return NULL;
}
CSSNodeRef CSSNodeListGet(const CSSNodeListRef list, const uint32_t index) {
if (CSSNodeListCount(list) > 0) {
return list->items[index];
}
return NULL;
}
|
/*
* TestManager.h
*
* Created on: 30.07.2015
* Author: Steffen Heyne
*/
#ifndef TESTMANAGER_H_
#define TESTMANAGER_H_
#include "MinHashEncoder.h"
#include "Data.h"
#include "Parameters.h"
#include <math.h>
class TestManager: public HistogramIndex {
public:
TestManager(Parameters* apParameters, Data* apData);
unsigned mNumSequences;
valarray<double> metaHist;
valarray<double> metaHistNum;
unsigned mClassifiedInstances;
ProgressBar pb;
std::atomic_bool done_output;
// void finishUpdate(ChunkP& myData);
void finishUpdate(ChunkP& myData, unsigned& min, unsigned& max);
void Exec();
void ClassifySeqs();
ogzstream* PrepareResultsFile();
};
#endif /* TESTMANAGER_H_ */
|
/*******************************************************************************
**NOTE** This code was generated by a tool and will occasionally be
overwritten. We welcome comments and issues regarding this code; they will be
addressed in the generation tool. If you wish to submit pull requests, please
do so for the templates in that tool.
This code was generated by Vipr (https://github.com/microsoft/vipr) using
the T4TemplateWriter (https://github.com/msopentech/vipr-t4templatewriter).
Copyright (c) Microsoft Corporation. All Rights Reserved.
Licensed under the Apache License 2.0; see LICENSE in the source repository
root for authoritative license information.
******************************************************************************/
#ifndef MSGRAPHSERVICECONTACTCOLLECTIONFETCHER_H
#define MSGRAPHSERVICECONTACTCOLLECTIONFETCHER_H
@class MSGraphServiceContactFetcher;
#import "core/MSOrcCollectionFetcher.h"
#import "api/api.h"
#import "core/core.h"
#import "MSGraphServiceModels.h"
/** MSGraphServiceContactCollectionFetcher
*
*/
__deprecated_msg("This SDK is deprecated. Please review the README for further information (https://github.com/OfficeDev/Microsoft-Graph-SDK-iOS).")
@interface MSGraphServiceContactCollectionFetcher : MSOrcCollectionFetcher
- (instancetype)initWithUrl:(NSString *)urlComponent parent:(id<MSOrcExecutable>)parent;
- (void)readWithCallback:(void (^)(NSArray *, MSOrcError *))callback;
- (MSGraphServiceContactFetcher *)getById: (id) identifier;
- (void)add:(MSGraphServiceContact *)entity callback:(void (^)(MSGraphServiceContact *, MSOrcError *))callback;
- (MSGraphServiceContactCollectionFetcher *)select:(NSString *)params;
- (MSGraphServiceContactCollectionFetcher *)filter:(NSString *)params;
- (MSGraphServiceContactCollectionFetcher *)search:(NSString *)params;
- (MSGraphServiceContactCollectionFetcher *)top:(int)value;
- (MSGraphServiceContactCollectionFetcher *)skip:(int)value;
- (MSGraphServiceContactCollectionFetcher *)expand:(NSString *)value;
- (MSGraphServiceContactCollectionFetcher *)orderBy:(NSString *)params;
- (MSGraphServiceContactCollectionFetcher *)addCustomParametersWithName:(NSString *)name value:(id)value;
- (MSGraphServiceContactCollectionFetcher *)addCustomHeaderWithName:(NSString *)name value:(NSString *)value;
@end
#endif
|
/**
* Copyright 2012 Batis Degryll Ludo
* @file InteractionTester.h
* @since 2017-06-26
* @date 2018-02-25
* @author Batis Degryll Ludo
* @brief Interface for an avatar capable of test if a collisionData meets a given condition.
*/
#ifndef ZBE_ENTITIES_AVATARS_INTERACTIONTESTER_H_
#define ZBE_ENTITIES_AVATARS_INTERACTIONTESTER_H_
#include "ZBE/core/events/generators/util/ReactObject.h"
#include "ZBE/core/events/generators/util/CollisionData.h"
#include "ZBE/core/system/system.h"
namespace zbe {
/** @brief Interface for an avatar capable of test if a collisionData meets a given condition.
*/
class InteractionTester {
public:
using Base = void; //!< inheritance info
/** \brief Virtual destructor.
*/
virtual ~InteractionTester(){}
/** \brief Tells if interaction condition is fullfilled.
* \return true if interaction condition is fullfilled.
*/
virtual bool test(CollisionData *data) = 0;
};
} // namespace zbe
#endif // ZBE_ENTITIES_AVATARS_INTERACTIONTESTER_H_
|
/*-------------------------------------------------------------------------
*
* geqo_gene.h
* genome representation in optimizer/geqo
*
* Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/optimizer/geqo_gene.h
*
*-------------------------------------------------------------------------
*/
/* contributed by:
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
* Martin Utesch * Institute of Automatic Control *
= = University of Mining and Technology =
* utesch@aut.tu-freiberg.de * Freiberg, Germany *
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
*/
#ifndef GEQO_GENE_H
#define GEQO_GENE_H
#include "nodes/nodes.h"
/* we presume that int instead of Relid
is o.k. for Gene; so don't change it! */
typedef int Gene;
typedef struct Chromosome
{
Gene *string;
Cost worth;
} Chromosome;
typedef struct Pool
{
Chromosome *data;
int size;
int string_length;
} Pool;
#endif /* GEQO_GENE_H */
|
#ifndef AlgDs_adjacency_list_h
#define AlgDs_adjacency_list_h
#endif
|
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2009-2011 by NookColor, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*
* WARNING: This is generated code. Modify at your own risk and without support.
*/
#ifdef USE_TI_FACEBOOK
#import "TiUIView.h"
#import "FBConnect/FBLoginButton.h"
#import "FacebookModule.h"
@interface TiFacebookLoginButton : TiUIView<TiFacebookStateListener> {
FBLoginButton2 *button;
}
@end
#endif |
/*
* copyright 2016 wink saville
*
* 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.
*/
//#define NDEBUG
#include <ac_debug_printf.h>
#include <ac_printf.h>
#include <ac_memset.h>
#include <ac_memcpy.h>
#include <ac_string.h>
/**
* Display a buffer
*
* @param p = pointer to buffer
* @param len = length of buffe3r
*/
void ac_print_buff(AcU8 *p, AcS32 len) {
while (len > 0) {
ac_printf("%p: ", p);
if (len > 8) {
ac_print_mem(AC_NULL, p, 8, 1, "%02x", " ", " ");
len -= 8;
p += 8;
}
AcU32 cnt;
if (len > 8) {
cnt = 8;
} else {
cnt = len;
}
ac_print_mem(AC_NULL, p, cnt, 1, "%02x", " ", "\n");
len -= cnt;
p += cnt;
}
}
|
//
// BSBaseTableViewController.h
// 百思不得姐
//
// Created by 张树 on 16/5/20.
// Copyright © 2016年 com.zs. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface BSBaseTableViewController : UITableViewController
//这个参数是需要其它控制器传进来的
@property(nonatomic,assign)BSType type;
@end
|
#include <stdint.h>
#include <stdlib.h>
/*Wired up Port D, Pin 2 as the voltage supply to the UVIS25 so that it can be placed in low power down mode
when the AVR is sleeping. So we want a power up and a power down method*/
#ifndef UVIS25_h
#define UVIS25_h
#ifdef __cplusplus
#include <Arduino.h>
#endif
#if defined(ARDUINO_AVR_UNO) || defined(ARDUINO_AVR_DUEMILANOVE) || defined(__AVR_ATmega328__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328PB__) || defined (__AVR_ATmega168__)
#if defined(__AVR_ATmega328PB__)
#define __digitalPinToPortReg(__pin) (((__pin) <= 7) ? &PORTD : (((__pin) >= 8 && (__pin) <= 13) ? &PORTB : (((__pin) >= 14 && (__pin) <= 19) ? &PORTC : &PORTE)))
#define __digitalPinToDDRReg(__pin) (((__pin) <= 7) ? &DDRD : (((__pin) >= 8 && (__pin) <= 13) ? &DDRB : (((__pin) >= 14 && (__pin) <= 19) ? &DDRC : &DDRE)))
#define __digitalPinToPINReg(__pin) (((__pin) <= 7) ? &PIND : (((__pin) >= 8 && (__pin) <= 13) ? &PINB : (((__pin) >= 14 && (__pin) <= 19) ? &PINC : &PINE)))
#define __digitalPinToBit(__pin) (((__pin) <= 7) ? (__pin) : (((__pin) >= 8 && (__pin) <= 13) ? (__pin) - 8 : (((__pin) >= 14 && (__pin) <= 19) ? (__pin) - 14 : (((__pin) >= 20 && (__pin) <= 21) ? (__pin) - 18 : (__pin) - 22))))
#else
#define __digitalPinToPortReg(__pin) (((__pin) <= 7) ? &PORTD : (((__pin) >= 8 && (__pin) <= 13) ? &PORTB : &PORTC))
#define __digitalPinToDDRReg(__pin) (((__pin) <= 7) ? &DDRD : (((__pin) >= 8 && (__pin) <= 13) ? &DDRB : &DDRC))
#define __digitalPinToPINReg(__pin) (((__pin) <= 7) ? &PIND : (((__pin) >= 8 && (__pin) <= 13) ? &PINB : &PINC))
#define __digitalPinToBit(__pin) (((__pin) <= 7) ? (__pin) : (((__pin) >= 8 && (__pin) <= 13) ? (__pin) - 8 : (__pin) - 14))
#endif
#define digitalWriteFast(__pin, __value) do { if (__builtin_constant_p(__pin) && __builtin_constant_p(__value)) { bitWrite(*__digitalPinToPortReg(__pin), (uint8_t)__digitalPinToBit(__pin), (__value)); } else { digitalWrite((__pin), (__value)); } } while (0)
#define pinModeFast(__pin, __mode) do { if (__builtin_constant_p(__pin) && __builtin_constant_p(__mode) && (__mode!=INPUT_PULLUP)) { bitWrite(*__digitalPinToDDRReg(__pin), (uint8_t)__digitalPinToBit(__pin), (__mode)); } else { pinMode((__pin), (__mode)); } } while (0)
#define digitalReadFast(__pin) ( (bool) (__builtin_constant_p(__pin) ) ? (( bitRead(*__digitalPinToPINReg(__pin), (uint8_t)__digitalPinToBit(__pin))) ) : digitalRead((__pin)) )
#else
// for all other archs use built-in pin access functions
#define digitalWriteFast(__pin, __value) digitalWrite(__pin, __value)
#define pinModeFast(__pin, __value) pinMode(__pin, __value)
#define digitalReadFast(__pin) digitalRead(__pin)
#endif
// Define these as macros to save valuable space
#define hwDigitalWrite(__pin, __value) digitalWriteFast(__pin, __value)
#define hwDigitalRead(__pin) digitalReadFast(__pin)
#define hwPinMode(__pin, __value) pinModeFast(__pin, __value)
class UVIS25
{
public:
UVIS25(uint8_t powerPin);
static uint8_t sensorAddress;
uint8_t init(void);
uint8_t readUV(void);
uint8_t readReg(uint8_t);
void readReg(uint8_t, uint8_t *, uint8_t);
uint8_t writeReg(uint8_t, uint8_t);
uint8_t writeReg(uint8_t, uint8_t *, size_t);
void applyPower(bool enable=true);
protected:
uint8_t _powerPin;
};
#endif
#ifndef aistin_h
#define aistin_h
class aistin {
private:
public:
static uint8_t readReg(uint8_t, uint8_t);
static uint8_t readReg(uint8_t, uint8_t, uint8_t *, uint8_t, bool autoIncrement=true);
static uint8_t writeReg(uint8_t, uint8_t, uint8_t);
static uint8_t writeReg(uint8_t, uint8_t, uint8_t *, size_t, bool autoIncrement=true);
};
#endif |
// CRC-32 Polynomial Table
static unsigned long crc_table[256] = {
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d,
};
|
/**
Atomix project, ORILIB_DataDecodeDecisionInit_i.h, TODO: insert summary here
Copyright (c) 2015 Stanford University
Released under the Apache License v2.0. See the LICENSE file for details.
Author(s): Manu Bansal
*/
#ifndef ORILIB_DATADECODEDECISIONINIT_I_H_
#define ORILIB_DATADECODEDECISIONINIT_I_H_
#include "ORILIB_DataDecodeDecisionInit_t.h"
void ORILIB_DataDecodeDecisionInit_i (
OUT ORILIB_t_DataDecodeState *bOutDecodeState
);
#endif
|
////////////////////////////////////////////////////////////////////////////////
/// DISCLAIMER
///
/// Copyright 2014-2022 ArangoDB GmbH, Cologne, Germany
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
///
/// @author Simon Grätzer
/// @author Daniel Larkin-York
////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <rocksdb/types.h>
#include "ApplicationFeatures/ApplicationFeature.h"
#include "Basics/Common.h"
#include "StorageEngine/StorageEngine.h"
namespace rocksdb {
class TransactionDB;
} // namespace rocksdb
namespace arangodb {
class RocksDBRecoveryManager final
: public application_features::ApplicationFeature {
public:
explicit RocksDBRecoveryManager(
application_features::ApplicationServer& server);
static std::string featureName() { return "RocksDBRecoveryManager"; }
void start() override;
void runRecovery();
RecoveryState recoveryState() const noexcept {
return _recoveryState.load(std::memory_order_acquire);
}
/// @brief current recovery tick
rocksdb::SequenceNumber recoveryTick() const noexcept { return _tick; }
private:
Result parseRocksWAL();
protected:
/// @brief rocksdb instance
rocksdb::TransactionDB* _db;
rocksdb::SequenceNumber _tick;
std::atomic<RecoveryState> _recoveryState;
};
} // namespace arangodb
|
/*
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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 <aws/ecs/ECS_EXPORTS.h>
#include <aws/ecs/model/TaskSet.h>
#include <utility>
namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;
namespace Utils
{
namespace Json
{
class JsonValue;
} // namespace Json
} // namespace Utils
namespace ECS
{
namespace Model
{
class AWS_ECS_API DeleteTaskSetResult
{
public:
DeleteTaskSetResult();
DeleteTaskSetResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
DeleteTaskSetResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
inline const TaskSet& GetTaskSet() const{ return m_taskSet; }
inline void SetTaskSet(const TaskSet& value) { m_taskSet = value; }
inline void SetTaskSet(TaskSet&& value) { m_taskSet = std::move(value); }
inline DeleteTaskSetResult& WithTaskSet(const TaskSet& value) { SetTaskSet(value); return *this;}
inline DeleteTaskSetResult& WithTaskSet(TaskSet&& value) { SetTaskSet(std::move(value)); return *this;}
private:
TaskSet m_taskSet;
};
} // namespace Model
} // namespace ECS
} // namespace Aws
|
/**
* 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
namespace JSC {
typedef uintptr_t Bits;
class TinyBloomFilter {
public:
TinyBloomFilter();
void add(Bits);
void add(TinyBloomFilter&);
bool ruleOut(Bits) const; // True for 0.
void reset();
private:
Bits m_bits;
};
inline TinyBloomFilter::TinyBloomFilter()
: m_bits(0)
{
}
inline void TinyBloomFilter::add(Bits bits)
{
m_bits |= bits;
}
inline void TinyBloomFilter::add(TinyBloomFilter& other)
{
m_bits |= other.m_bits;
}
inline bool TinyBloomFilter::ruleOut(Bits bits) const
{
if (!bits)
return true;
if ((bits & m_bits) != bits)
return true;
return false;
}
inline void TinyBloomFilter::reset()
{
m_bits = 0;
}
} // namespace JSC
|
/* vim:set et sts=4: */
/*
* Keyman Input Method for IBUS (The Input Bus)
*
* Copyright (C) 2018, 2020 SIL International
*
* kmflutil is dual licensed under the MIT or GPL licenses as described below.
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* MIT license
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* OR
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* 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 library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
#ifndef __KEYMANUTIL_H__
#define __KEYMANUTIL_H__
#include <ibus.h>
#include <gmodule.h>
#include <keyman/keyboardprocessor.h>
// Number of default Keyboard processor environment options for: "platform", "baseLayout", and "baseLayoutAlt"
#define KEYMAN_ENVIRONMENT_OPTIONS 3
// Path information for Keyman keyboard options in DConf
#define KEYMAN_DCONF_NAME "com.keyman.options"
#define KEYMAN_CHILD_DCONF_NAME "com.keyman.options.child"
#define KEYMAN_DCONF_PATH "/desktop/ibus/keyman/options/"
#define KEYMAN_DCONF_OPTIONS_KEY "options"
void ibus_keyman_init (void);
GList *ibus_keyman_list_engines (void);
IBusComponent *ibus_keyman_get_component (void);
// Obtain Keyboard Options from DConf and parse into a GQueue of struct km_kbp_option_item
// DConf options are in a list of strings like ['option_key1=value1', 'option_key2=value2']
//
// Parameters:
// package_id (gchar *): Package ID
// keyboard_id (gchar *): Keyboard ID
//
// Returns a newly allocated gchar**; free with g_strfreev()
gchar** keyman_get_options_fromdconf
(gchar *package_id,
gchar *keyboard_id);
// Obtain Keyboard Options from DConf and parse into a GQueue of struct km_kbp_option_item
// DConf options are in a list of strings like ['option_key1=value1', 'option_key2=value2']
//
// Parameters:
// package_id (gchar *): Package ID
// keyboard_id (gchar *): Keyboard ID
//
// Return a newly allocated GQueue; free with g_queue_free_full()
GQueue* keyman_get_options_queue_fromdconf
(gchar *package_id,
gchar *keyboard_id);
// Write new keyboard option to DConf.
// DConf options are in a list of strings like ['option_key1=value1', 'option_key2=value2']
// If the option key already exists, the value is updated. Otherwise a new string 'option_key=option_value' is appended.
//
// Parameters:
// package_id (gchar *): Package ID
// keyboard_id (gchar *): Keyboard ID
// option_key (gchar *): Key for the new option
// option_value (gchar *): Value of the new option
void keyman_put_options_todconf
(gchar *package_id,
gchar *keyboard_id,
gchar *option_key,
gchar *option_value);
#endif
|
//
// PYAppDelegate.h
// FB Gallery Example
//
// Created by Philip Yu on 5/18/13.
// Copyright (c) 2013 Philip Yu. All rights reserved.
//
#import <UIKit/UIKit.h>
@class PYTimelineViewController;
@interface PYAppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) PYTimelineViewController *viewController;
@end
|
//
// AppDelegate.h
// VQKitDemo
//
// Created by zhoubin on 16/7/22.
// Copyright © 2016年 VQBoy. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
//
// BOXClient+Authentication.h
// BoxContentSDK
//
// Created by Rico Yao on 11/12/14.
// Copyright (c) 2014 Box. All rights reserved.
//
#import "BOXContentClient.h"
#import <UIKit/UIKit.h>
@class BOXUser;
@interface BOXContentClient (Authentication)
/**
* Authenticate a user. If necessary, this will present a UIViewController to allow the user to enter their credentials,
* or launch the Box app to allow the user to automatically be authenticated to that account (if possible).
* If a user is already authenticated, then a UIViewController will not be presented and the completionBlock will be called.
*
* @param completionBlock Called when the authentication has completed.
*/
- (void)authenticateWithCompletionBlock:(void (^)(BOXUser *user, NSError *error))completion;
/**
* Authenticate a user. If necessary, this will present a UIViewController to allow the user to enter their credentials.
* If a user is already authenticated, then a UIViewController will not be presented and the completionBlock will be called.
*
* @param completionBlock Called when the authentication has completed.
*/
- (void)authenticateInAppWithCompletionBlock:(void (^)(BOXUser *user, NSError *error))completion;
/**
* Authenticate a user. If necessary and possible, this will launch the Box app to allow the user to autmatically
* be authenticated to that account.
* If App-To-App authentication is not possible, an error is returned in the completion block.
* If a user is already authenticated, then a UIViewController will not be presented and the completionBlock will be called.
*
* @param completionBlock Called when the authentication has completed.
*/
- (void)authenticateAppToAppWithCompletionBlock:(void (^)(BOXUser *user, NSError *error))completion;
/**
* Discerns whether a launch URL is associated with Box App-to-App authentication - if it is the return URL that should be used
* to complete the user's authentication in the case of authenticating App-to-App using the Box app.
*
* @param authenticationURL The URL with which the app was launched.
*/
+ (BOOL)canCompleteAppToAppAuthenticationWithURL:(NSURL *)authenticationURL;
/**
* Complete the user's authentication to the account that is in use in the Box app. (App-to-App)
* On completion, the original completionBlock will be called.
*
* @param authenticationURL The URL with which the app was launched.
*/
+ (void)completeAppToAppAuthenticationWithURL:(NSURL *)authenticationURL;
/**
* Log out the user associated with this BOXContentClient. It is a good practice to call this when the user's session is no longer necessary.
*/
- (void)logOut;
/**
* Log out all users that have ever been authenticated.
*/
+ (void)logOutAll;
/**
* By default, the Content SDK stores some information in the keychain to persist the user's session with a default prefix.
* You can override this prefix.
*
* @param keychainIdentifierPrefix prefix for keychain entries.
*/
- (void)setKeychainIdentifierPrefix:(NSString *)keychainIdentifierPrefix;
/**
* By default, the Content SDK stores some information in the keychain to persist the user's session with no access group defined.
* You may need to set this if you need to use the SDK in multiple processes (e.g. extensions)
*
* @param keychainAccessGroup keychain access group
*/
- (void)setKeychainAccessGroup:(NSString *)keychainAccessGroup;
@end
|
#include <stdio.h> /* standard i/o */
#include <stdlib.h> /* standard library */
#include <string.h> /* string functions */
#include <ctype.h> /* character functions */
#include <sms.h> /* Sega Master System hw funcs */
#include "rdt_conf.h" /* Language configurations */
#include "rdt_defs.h" /* Language definitions */
#include "rdt_cons.h" /* Console routines */
#include "rdt_load.h" /* Program loader */
#include "rdt_itfc.h" /* Machine-dependant interface */
#include "mfs.h" /* SMS virtual file system */
/*****************************************************************************/
/* #defines */
/*****************************************************************************/
#define CHEESE_EXT ".chs" /* default source file extension */
unsigned char pal1[] = {0x00, 0xFF, 0x08, 0x28, 0x02, 0x22, 0x0A, 0x2A,
0x15, 0x35, 0x1D, 0x3D, 0x17, 0x37, 0x1F, 0x3F};
void rdt_interface_init(cheese_envyro *envyro) {
set_vdp_reg(VDP_REG_FLAGS1, VDP_REG_FLAGS1_SCREEN);
load_tiles(standard_font, 0, 255, 1);
load_palette(pal1, 0, 16);
load_palette(pal1, 16, 16);
}
void rdt_interface_loadprog(cheese_envyro *envyro, char *name) {
char fname[16];
mfs_dir_entry *dir;
mfs_pointer dest;
strcpy(fname, name);
strcat(fname, ".cho");
strupr(fname);
dir = mfs_find_dir_entry(fname);
if (!dir) {
rdt_display_str(envyro, fname);
rdt_display_str(envyro, " not found.");
}
mfs_decode_entry(&dest, dir);
envyro->prog = mfs_fetch(&dest);
envyro->proglen = dir->len;
}
void rdt_interface_runprog(cheese_envyro *envyro, char *name) {
envyro->prog = NULL;
envyro->disaster = 0;
rdt_interface_loadprog(envyro, name);
if (envyro->disaster) { /* if no load problems.. */
return;
}
/*---------------------------------------------------------------------------*/
/* If load went OK, then define macros and run the interpreter. */
/*---------------------------------------------------------------------------*/
rdt_makedeftable(envyro); /* create macro definition table */
rdt_interpret(envyro); /* and run interpreter */
}
void rdt_interface_setscreenmode(cheese_envyro *envyro, int mode) {
}
void rdt_interface_setwrap(cheese_envyro *envyro, int mode) {
}
void rdt_interface_setautopause(cheese_envyro *envyro, int mode) {
}
void rdt_interface_setautoscroll(cheese_envyro *envyro, int mode) {
}
int rdt_interface_clrimg(cheese_envyro *envyro) {
}
void rdt_interface_setimg(cheese_envyro *envyro, int imgnum) {
}
int rdt_interface_clrtxt(cheese_envyro *envyro) {
}
void rdt_interface_gotoxy(cheese_envyro *envyro, int x, int y) {
}
int rdt_interface_getx(cheese_envyro *envyro) {
}
int rdt_interface_gety(cheese_envyro *envyro) {
}
int rdt_interface_getw(cheese_envyro *envyro) {
return 32;
}
int rdt_interface_geth(cheese_envyro *envyro) {
}
void rdt_interface_outputchar(cheese_envyro *envyro, char c) {
fputc_cons(c);
}
char rdt_interface_inputchar(cheese_envyro *envyro) {
}
int rdt_interface_inputint(cheese_envyro *envyro) {
}
int rdt_interface_inputcursor(cheese_envyro *envyro) {
}
|
//
// ZScrollBar.h
// ZNews
//
// Created by zhaowei on 2017/7/11.
// Copyright © 2017年 wei zhao. All rights reserved.
//
#import <UIKit/UIKit.h>
@protocol ZScrollBarDelegate <NSObject>
- (void) refreshNewsListWithType:(int) type;
@end
@interface ZScrollBar : UIScrollView
@property (nonatomic,weak) id<ZScrollBarDelegate> mdeletage;
@property (nonatomic,assign) int selectedIndex;
- (instancetype) init;
@end
|
// Copyright 2022 Google LLC
//
// 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
//
// https://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.
// Generated by the Codegen C++ plugin.
// If you make any local changes, they will be lost.
// source: google/cloud/translate/v3/translation_service.proto
#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_TRANSLATE_INTERNAL_TRANSLATION_LOGGING_DECORATOR_H
#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_TRANSLATE_INTERNAL_TRANSLATION_LOGGING_DECORATOR_H
#include "google/cloud/translate/internal/translation_stub.h"
#include "google/cloud/tracing_options.h"
#include "google/cloud/version.h"
#include <google/longrunning/operations.grpc.pb.h>
#include <memory>
#include <set>
#include <string>
namespace google {
namespace cloud {
namespace translate_internal {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
class TranslationServiceLogging : public TranslationServiceStub {
public:
~TranslationServiceLogging() override = default;
TranslationServiceLogging(std::shared_ptr<TranslationServiceStub> child,
TracingOptions tracing_options,
std::set<std::string> components);
StatusOr<google::cloud::translation::v3::TranslateTextResponse> TranslateText(
grpc::ClientContext& context,
google::cloud::translation::v3::TranslateTextRequest const& request)
override;
StatusOr<google::cloud::translation::v3::DetectLanguageResponse>
DetectLanguage(grpc::ClientContext& context,
google::cloud::translation::v3::DetectLanguageRequest const&
request) override;
StatusOr<google::cloud::translation::v3::SupportedLanguages>
GetSupportedLanguages(
grpc::ClientContext& context,
google::cloud::translation::v3::GetSupportedLanguagesRequest const&
request) override;
StatusOr<google::cloud::translation::v3::TranslateDocumentResponse>
TranslateDocument(
grpc::ClientContext& context,
google::cloud::translation::v3::TranslateDocumentRequest const& request)
override;
future<StatusOr<google::longrunning::Operation>> AsyncBatchTranslateText(
google::cloud::CompletionQueue& cq,
std::unique_ptr<grpc::ClientContext> context,
google::cloud::translation::v3::BatchTranslateTextRequest const& request)
override;
future<StatusOr<google::longrunning::Operation>> AsyncBatchTranslateDocument(
google::cloud::CompletionQueue& cq,
std::unique_ptr<grpc::ClientContext> context,
google::cloud::translation::v3::BatchTranslateDocumentRequest const&
request) override;
future<StatusOr<google::longrunning::Operation>> AsyncCreateGlossary(
google::cloud::CompletionQueue& cq,
std::unique_ptr<grpc::ClientContext> context,
google::cloud::translation::v3::CreateGlossaryRequest const& request)
override;
StatusOr<google::cloud::translation::v3::ListGlossariesResponse>
ListGlossaries(grpc::ClientContext& context,
google::cloud::translation::v3::ListGlossariesRequest const&
request) override;
StatusOr<google::cloud::translation::v3::Glossary> GetGlossary(
grpc::ClientContext& context,
google::cloud::translation::v3::GetGlossaryRequest const& request)
override;
future<StatusOr<google::longrunning::Operation>> AsyncDeleteGlossary(
google::cloud::CompletionQueue& cq,
std::unique_ptr<grpc::ClientContext> context,
google::cloud::translation::v3::DeleteGlossaryRequest const& request)
override;
future<StatusOr<google::longrunning::Operation>> AsyncGetOperation(
google::cloud::CompletionQueue& cq,
std::unique_ptr<grpc::ClientContext> context,
google::longrunning::GetOperationRequest const& request) override;
future<Status> AsyncCancelOperation(
google::cloud::CompletionQueue& cq,
std::unique_ptr<grpc::ClientContext> context,
google::longrunning::CancelOperationRequest const& request) override;
private:
std::shared_ptr<TranslationServiceStub> child_;
TracingOptions tracing_options_;
std::set<std::string> components_;
}; // TranslationServiceLogging
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
} // namespace translate_internal
} // namespace cloud
} // namespace google
#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_TRANSLATE_INTERNAL_TRANSLATION_LOGGING_DECORATOR_H
|
#ifndef timer_h
#define timer_h
#include "types.h"
#include "devices.h"
/* Units */
#define UNIT_MICROHZ 0
#define UNIT_VBLANK 1
#define UNIT_ECLOCK 2
#define UNIT_WAITUNTIL 3
#define UNIT_WAITECLOCK 4
#define UNIT_MAX 5
/* IO-Commands */
#define TR_ADDREQUEST (CMD_NONSTD+0)
#define TR_GETSYSTIME (CMD_NONSTD+1)
#define TR_SETSYSTIME (CMD_NONSTD+2)
#define VERSION 0
#define REVISION 2
#define DEVNAME "timer"
#define DEVVER " 0.2 __DATE__"
struct EClockVal
{
UINT32 ev_hi;
UINT32 ev_lo;
};
struct TimeVal
{
UINT32 tv_secs;
UINT32 tv_micro;
};
struct TimeRequest
{
IOStdReq tr_node;
struct TimeVal tr_time;
};
struct TimerUnit
{
struct Unit tu_unit;
APTR AddRequest;
};
typedef struct TimerBase
{
struct Device Device;
APTR Timer_SysBase;
UINT32 MiscFlags;
struct TimeVal CurrentTime;
struct TimeVal VBlankTime;
struct TimeVal Elapsed;
UINT32 TimerIRQ;
struct Interrupt *TimerVBLIntServer;
struct Interrupt *TimerMICROHZIntServer;
UINT16 TimerCounter; // used in AddMHZDelay to know how much time the timer has already spent when we see a "new request"
struct TimeVal TimerIntTime; // used in TimerMICROHZIRQServer to subtract this time from all delay requests
struct TimeVal RequestedMinDelay; // used in AddMHZDelay to compare "newly requested delay" with "minimum delay requested till now"
struct TimerUnit TimerUnit[UNIT_MAX];
} TimerBase;
struct rtc_time
{
int tm_sec;
int tm_min;
int tm_hour;
int tm_mday;
int tm_mon;
int tm_year;
int tm_wday;
int tm_yday;
int tm_isdst;
};
extern void (*TimerCmdVector[])(TimerBase *, pIOStdReq);
//extern INT8 TimerCmdQuick[];
void INTERN_EndCommand(TimerBase *TimerBase, UINT32 error, pIOStdReq ioreq);
void INTERN_QueueRequest(TimerBase *TimerBase, pIOStdReq ioreq);
void timer_BeginIO(TimerBase *TimerBase, pIOStdReq ioreq);
void timer_AbortIO(TimerBase *TimerBase, pIOStdReq ioreq);
INT32 timer_CmpTime(TimerBase *TimerBase, struct TimeVal *src, struct TimeVal *dst);
void timer_AddTime(TimerBase *TimerBase, struct TimeVal *src, struct TimeVal *dst);
void timer_SubTime(TimerBase *TimerBase, struct TimeVal *src, struct TimeVal *dst);
void timer_GetSysTime(struct TimerBase *TimerBase, struct TimeVal *src);
UINT32 timer_ReadEClock(struct TimerBase *TimerBase, struct EClockVal *src);
void TimerInvalid(TimerBase *TimerBase, pIOStdReq ioreq);
void TimerAddRequest(TimerBase *TimerBase, pIOStdReq ioreq);
void TimerGetSysTime(TimerBase *TimerBase, pIOStdReq ioreq);
void TimerSetSysTime(TimerBase *TimerBase, pIOStdReq ioreq);
void AddAlarm(TimerBase *TimerBase, pIOStdReq ioreq);
void AddDelay(TimerBase *TimerBase, pIOStdReq ioreq);
void AddMHZDelay(TimerBase *TimerBase, pIOStdReq ioreq);
void update_counter_value(TimerBase *TimerBase, struct TimeVal delay);
void update_interval_time(TimerBase *TimerBase, struct TimeVal delay);
UINT16 convert_microsec_to_counterval(TimerBase *TimerBase, UINT32 micro_sec);
void convert_counterval_to_microsec(TimerBase *TimerBase, UINT16 count, struct TimeVal *tval);
#endif
|
/****************************************************************************
* Copyright (c) 2011 Yahoo! Inc. All rights reserved. Licensed under the
* Apache License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of the License
* at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable
* law or agreed to in writing, software distributed under the License is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
* See accompanying LICENSE file.
************************************************************************** */
#include <upkeeper.h>
#include <sqlite3.h>
#include <sys/file.h>
#include "controller.h"
#include "ctrl_sql.h"
#include "ctrl_data.h"
sqlite3 *ctrl_dbh;
static char flockpath[UPK_MAX_STRING_LEN] = "";
static int flock_fd;
/** ******************************************************************************************************************
@brief controller state initialization.
******************************************************************************************************************* */
void
upk_state_init(void)
{
struct stat st;
int errno_tmp;
int flock_fd = -1;
errno = 0;
upk_mkdir_p(upk_runtime_configuration.StateDir);
errno = errno_tmp;
if((stat(upk_runtime_configuration.StateDir, &st) != 0)
|| !S_ISDIR(st.st_mode)) {
upk_fatal("State directory doesn't exist and could not be created: %s: %s\n", upk_runtime_configuration.StateDir, errno_tmp);
}
strncpy(flockpath, upk_runtime_configuration.StateDir, UPK_MAX_STRING_LEN - 1);
strncat(flockpath, "/.lock", UPK_MAX_STRING_LEN - 1 - strnlen(upk_runtime_configuration.StateDir, UPK_MAX_STRING_LEN));
errno = 0;
flock_fd = open(flockpath, O_CREAT);
if(errno)
upk_fatal("Could not open %s: %s\n", flockpath, strerror(errno));
fcntl(flock_fd, F_SETFD, FD_CLOEXEC);
if(flock(flock_fd, LOCK_EX) != 0)
upk_fatal("Another instance of controller is already running\n");
return;
}
/** ******************************************************************************************************************
******************************************************************************************************************* */
static void
upk_db_path(char **pathbuf)
{
strcat(*pathbuf, upk_runtime_configuration.StateDir);
strcat(*pathbuf, "/db");
errno = 0;
if(mkdir(*pathbuf, 0700) != 0 && errno != EEXIST)
upk_fatal("Cannot create database dir %s", *pathbuf);
}
/** ******************************************************************************************************************
******************************************************************************************************************* */
void
upk_ctrl_attach_db(sqlite3 * dbh, char *db_path, char *db_name)
{
char *sqlerr;
int rc = 0;
char attach_str[UPK_MAX_PATH_LEN] = "";
snprintf(attach_str, UPK_MAX_STRING_LEN, "ATTACH \"%s/%s.sqlite3\" AS \"%s\";", db_path, db_name, db_name);
rc = sqlite3_exec(dbh, attach_str, NULL, NULL, &sqlerr);
if(rc != SQLITE_OK) {
upk_fatal("failed to execute: %d: %s\n", rc, sqlerr);
sqlite3_free(sqlerr);
}
}
/** ******************************************************************************************************************
******************************************************************************************************************* */
sqlite3 *
upk_ctrl_init_db(char *db_path)
{
sqlite3 *dbh = NULL;
int rc = 0;
char *db_pathp = NULL;
char *sqlerr = NULL;
// char table_id[UPK_MAX_STRING_LEN] = "";
db_pathp = db_path + strnlen(db_path, UPK_MAX_PATH_LEN);
strcpy(db_pathp, "/upkeeper.sqlite3");
if((rc = sqlite3_open(db_path, &dbh)) != 0) {
upk_fatal("Cannot open database: %d\n", rc);
}
*db_pathp = '\0';
upk_ctrl_attach_db(dbh, db_path, "upk_cfg");
upk_ctrl_attach_db(dbh, db_path, "upk_audit");
rc = sqlite3_exec(dbh, (char *) ctrl_create_audit_sql, NULL, NULL, &sqlerr);
if(rc != SQLITE_OK) {
upk_fatal("failed to execute: %d: %s\n", rc, sqlerr);
sqlite3_free(sqlerr);
}
rc = sqlite3_exec(dbh, (char *) ctrl_create_cfg_sql, NULL, NULL, &sqlerr);
if(rc != SQLITE_OK) {
upk_fatal("failed to execute: %d: %s\n", rc, sqlerr);
sqlite3_free(sqlerr);
}
return dbh;
}
/** ******************************************************************************************************************
******************************************************************************************************************* */
void
upk_ctrl_exit(void)
{
if(ctrl_dbh)
sqlite3_close(ctrl_dbh);
upk_ctrl_free_config();
close(flock_fd);
unlink(flockpath);
}
/** ******************************************************************************************************************
******************************************************************************************************************* */
int
upk_ctrl_init(void)
{
char ctrl_db_path[UPK_MAX_PATH_LEN] = "", *p;
p = ctrl_db_path;
upk_ctrl_load_config();
upk_state_init();
upk_db_path(&p);
atexit(upk_ctrl_exit);
ctrl_dbh = upk_ctrl_init_db(ctrl_db_path);
upk_load_runtime_services();
UPKLIST_FOREACH(upk_file_configuration.svclist) {
upk_db_insert_cfg(ctrl_dbh, upk_file_configuration.svclist->thisp);
}
return 0;
}
|
//===----------------------------------------------------------------------===//
//
// Peloton
//
// merge_join_plan.h
//
// Identification: src/include/planner/merge_join_plan.h
//
// Copyright (c) 2015-16, Carnegie Mellon University Database Group
//
//===----------------------------------------------------------------------===//
#pragma once
#include <memory>
#include <string>
#include <vector>
#include "abstract_join_plan.h"
#include "common/types.h"
#include "expression/abstract_expression.h"
#include "planner/project_info.h"
namespace peloton {
namespace planner {
class MergeJoinPlan : public AbstractJoinPlan {
public:
struct JoinClause {
JoinClause(const expression::AbstractExpression *left,
const expression::AbstractExpression *right, bool reversed)
: left_(left), right_(right), reversed_(reversed) {}
JoinClause(const JoinClause &other) = delete;
JoinClause(JoinClause &&other)
: left_(std::move(other.left_)),
right_(std::move(other.right_)),
reversed_(other.reversed_) {}
std::unique_ptr<const expression::AbstractExpression> left_;
std::unique_ptr<const expression::AbstractExpression> right_;
bool reversed_;
};
MergeJoinPlan(const MergeJoinPlan &) = delete;
MergeJoinPlan &operator=(const MergeJoinPlan &) = delete;
MergeJoinPlan(MergeJoinPlan &&) = delete;
MergeJoinPlan &operator=(MergeJoinPlan &&) = delete;
MergeJoinPlan(
PelotonJoinType join_type,
std::unique_ptr<const expression::AbstractExpression> &&predicate,
std::unique_ptr<const ProjectInfo> &&proj_info,
std::shared_ptr<const catalog::Schema> &proj_schema,
std::vector<JoinClause> &join_clauses)
: AbstractJoinPlan(join_type, std::move(predicate), std::move(proj_info),
proj_schema),
join_clauses_(std::move(join_clauses)) {
// Nothing to see here...
}
inline PlanNodeType GetPlanNodeType() const {
return PLAN_NODE_TYPE_MERGEJOIN;
}
const std::vector<JoinClause> *GetJoinClauses() const {
return &join_clauses_;
}
const std::string GetInfo() const { return "MergeJoin"; }
void SetParameterValues(UNUSED_ATTRIBUTE std::vector<Value>* values) { };
std::unique_ptr<AbstractPlan> Copy() const {
std::vector<JoinClause> new_join_clauses;
for (size_t i = 0; i < join_clauses_.size(); i++) {
new_join_clauses.push_back(JoinClause(join_clauses_[i].left_->Copy(),
join_clauses_[i].right_->Copy(),
join_clauses_[i].reversed_));
}
std::unique_ptr<const expression::AbstractExpression> predicate_copy(
GetPredicate()->Copy());
std::shared_ptr<const catalog::Schema> schema_copy(
catalog::Schema::CopySchema(GetSchema()));
MergeJoinPlan *new_plan = new MergeJoinPlan(
GetJoinType(), std::move(predicate_copy),
std::move(GetProjInfo()->Copy()), schema_copy, new_join_clauses);
return std::unique_ptr<AbstractPlan>(new_plan);
}
private:
std::vector<JoinClause> join_clauses_;
};
} // namespace planner
} // namespace peloton
|
/*******************************************ÉêÃ÷***************************************
±¾Ç¶Èëʽ²Ù×÷ϵͳδ¾ÊÚȨ£¬½ûÖ¹Ó¦ÓÃÓÚÈκÎÉÌÒµÓÃ;
°æÈ¨ËùÓУ¬ÇÖȨ±Ø¾¿
**************************************************************************************/
/******************** (C) COPYRIGHT 2010 STMicroelectronics ********************
* File Name : usb_type.h
* Author : MCD Application Team
* Version : V3.1.1
* Date : 04/07/2010
* Description : Type definitions used by the USB Library
********************************************************************************
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*******************************************************************************/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __USB_TYPE_H
#define __USB_TYPE_H
/* Includes ------------------------------------------------------------------*/
#include "usb_conf.h"
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
#ifndef NULL
#define NULL ((void *)0)
#endif
#ifndef __STM32F10x_H
typedef signed long s32;
typedef signed short s16;
typedef signed char s8;
typedef volatile signed long vs32;
typedef volatile signed short vs16;
typedef volatile signed char vs8;
typedef unsigned long u32;
typedef unsigned short u16;
typedef unsigned char u8;
typedef unsigned long const uc32; /* Read Only */
typedef unsigned short const uc16; /* Read Only */
typedef unsigned char const uc8; /* Read Only */
typedef volatile unsigned long vu32;
typedef volatile unsigned short vu16;
typedef volatile unsigned char vu8;
typedef volatile unsigned long const vuc32; /* Read Only */
typedef volatile unsigned short const vuc16; /* Read Only */
typedef volatile unsigned char const vuc8; /* Read Only */
typedef enum
{
FALSE = 0, TRUE = !FALSE
}
bool;
typedef enum { RESET = 0, SET = !RESET } FlagStatus, ITStatus;
typedef enum { DISABLE = 0, ENABLE = !DISABLE} FunctionalState;
typedef enum { ERROR = 0, SUCCESS = !ERROR} ErrorStatus;
#endif
/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
/* External variables --------------------------------------------------------*/
#endif /* __USB_TYPE_H */
/******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Hashtable Keys.
*
* The Initial Developer of the Original Code is
* Benjamin Smedberg <bsmedberg@covad.net>
*
* Portions created by the Initial Developer are Copyright (C) 2003
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsURIHashKey_h__
#define nsURIHashKey_h__
#include "pldhash.h"
#include "nsCOMPtr.h"
#include "nsCRT.h"
#include "nsIURI.h"
/**
* Hashtable key class to use with nsTHashtable/nsBaseHashtable
*/
class nsURIHashKey : public PLDHashEntryHdr
{
public:
typedef nsIURI* KeyType;
typedef const nsIURI* KeyTypePointer;
nsURIHashKey(const nsIURI* aKey) :
mKey(const_cast<nsIURI*>(aKey)) { MOZ_COUNT_CTOR(nsURIHashKey); }
nsURIHashKey(const nsURIHashKey& toCopy) :
mKey(toCopy.mKey) { MOZ_COUNT_CTOR(nsURIHashKey); }
~nsURIHashKey() { MOZ_COUNT_DTOR(nsURIHashKey); }
nsIURI* GetKey() const { return mKey; }
bool KeyEquals(const nsIURI* aKey) const {
bool eq;
if (NS_SUCCEEDED(mKey->Equals(const_cast<nsIURI*>(aKey), &eq))) {
return eq;
}
return false;
}
static const nsIURI* KeyToPointer(nsIURI* aKey) { return aKey; }
static PLDHashNumber HashKey(const nsIURI* aKey) {
nsCAutoString spec;
const_cast<nsIURI*>(aKey)->GetSpec(spec);
return nsCRT::HashCode(spec.get());
}
enum { ALLOW_MEMMOVE = true };
protected:
nsCOMPtr<nsIURI> mKey;
};
#endif // nsURIHashKey_h__
|
// Copyright 2021 The IREE Authors
//
// Licensed under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
// A example of setting up the the cuda driver.
#include <stddef.h>
#include "iree/base/api.h"
#include "iree/hal/api.h"
#include "iree/hal/cuda/registration/driver_module.h"
// Compiled module embedded here to avoid file IO:
#include "iree/samples/simple_embedding/simple_embedding_test_bytecode_module_cuda_c.h"
iree_status_t create_sample_device(iree_allocator_t host_allocator,
iree_hal_device_t** out_device) {
// Only register the CUDA HAL driver.
IREE_RETURN_IF_ERROR(
iree_hal_cuda_driver_module_register(iree_hal_driver_registry_default()));
// Create the HAL driver from the name.
iree_hal_driver_t* driver = NULL;
iree_string_view_t identifier = iree_make_cstring_view("cuda");
iree_status_t status = iree_hal_driver_registry_try_create_by_name(
iree_hal_driver_registry_default(), identifier, host_allocator, &driver);
// Create the default device (primary GPU).
if (iree_status_is_ok(status)) {
status = iree_hal_driver_create_default_device(driver, host_allocator,
out_device);
}
iree_hal_driver_release(driver);
return iree_ok_status();
}
const iree_const_byte_span_t load_bytecode_module_data() {
const struct iree_file_toc_t* module_file_toc =
iree_samples_simple_embedding_test_module_cuda_create();
return iree_make_const_byte_span(module_file_toc->data,
module_file_toc->size);
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.