text
stringlengths 4
6.14k
|
|---|
//
// Bluebird.h
// Bluebird
//
// Created by Alejandro Barros on 03/02/15.
// Copyright (c) 2015 Alejandro Barros Cuetos. All rights reserved.
//
#import <UIKit/UIKit.h>
//! Project version number for Bluebird.
FOUNDATION_EXPORT double BluebirdVersionNumber;
//! Project version string for Bluebird.
FOUNDATION_EXPORT const unsigned char BluebirdVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <Bluebird/PublicHeader.h>
|
/* $begin forkprob6 */
#include "csapp.h"
void doit() {
if (Fork() == 0) {
Fork();
printf("hello %d\n",getpid());
return;
}
}
int main() {
doit();
printf("hello\n");
//wait(NULL);
exit(0);
}
/* $end forkprob6 */
|
#ifndef COMMON_IPC_SH_MEM_H_
#define COMMON_IPC_SH_MEM_H_
#include "../constantes.h"
struct shmem_data {
int asientos[MAX_ASIENTOS];
int cantidad;
bool dirty;
};
struct shmem;
/* Utilizadas por proceso maestro (q crea y destruye la memoria) */
shmem* sh_mem_create(int n);
void sh_mem_destroy(shmem* mem);
/**************/
/* Utilizadas por procesos esclavos (q no crean ni destruyen la memoria) */
shmem* sh_mem_get(int n);
void sh_mem_release(shmem* mem);
/**************/
/* Locked read/write */
void sh_mem_write(shmem* mem, const shmem_data *data);
void sh_mem_read(shmem* mem, shmem_data *data);
#endif /* COMMON_IPC_SH_MEM_H_ */
|
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef __ESP_SPIRAM_H
#define __ESP_SPIRAM_H
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#include "esp_err.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Initialize spiram interface/hardware. Normally called from cpu_start.c.
*
* @return ESP_OK on success
*/
esp_err_t esp_spiram_init(void);
/**
* @brief Configure Cache/MMU for access to external SPI RAM.
*
* Normally this function is called from cpu_start, if CONFIG_SPIRAM_BOOT_INIT
* option is enabled. Applications which need to enable SPI RAM at run time
* can disable CONFIG_SPIRAM_BOOT_INIT, and call this function later.
*
* @attention this function must be called with flash cache disabled.
*/
void esp_spiram_init_cache(void);
/**
* @brief Memory test for SPI RAM. Should be called after SPI RAM is initialized and
* (in case of a dual-core system) the app CPU is online. This test overwrites the
* memory with crap, so do not call after e.g. the heap allocator has stored important
* stuff in SPI RAM.
*
* @return true on success, false on failed memory test
*/
bool esp_spiram_test(void);
/**
* @brief Add the initialized SPI RAM to the heap allocator.
*/
esp_err_t esp_spiram_add_to_heapalloc(void);
/**
* @brief Get the available physical size of the attached SPI RAM chip
*
* @note If ECC is enabled, the available physical size would be smaller than the physical size. See `CONFIG_SPIRAM_ECC_ENABLE`
*
* @return Size in bytes, or 0 if no external RAM chip support compiled in.
*/
size_t esp_spiram_get_size(void);
/**
* @brief Force a writeback of the data in the SPI RAM cache. This is to be called whenever
* cache is disabled, because disabling cache on the ESP32 discards the data in the SPI
* RAM cache.
*
* This is meant for use from within the SPI flash code.
*/
void esp_spiram_writeback_cache(void);
/**
* @brief If SPI RAM(PSRAM) has been initialized
*
* @return
* - true SPI RAM has been initialized successfully
* - false SPI RAM hasn't been initialized or initialized failed
*/
bool esp_spiram_is_initialized(void);
/**
* @brief get psram CS IO
*
* This interface should be called after PSRAM is enabled, otherwise it will
* return an invalid value -1/0xff.
*
* @return psram CS IO or -1/0xff if psram not enabled
*/
uint8_t esp_spiram_get_cs_io(void);
/**
* @brief Reserve a pool of internal memory for specific DMA/internal allocations
*
* @param size Size of reserved pool in bytes
*
* @return
* - ESP_OK on success
* - ESP_ERR_NO_MEM when no memory available for pool
*/
esp_err_t esp_spiram_reserve_dma_pool(size_t size);
/**
* @brief If SPI RAM(PSRAM) has been initialized
*
* @return
* - true SPI RAM has been initialized successfully
* - false SPI RAM hasn't been initialized or initialized failed
*/
bool esp_spiram_is_initialized(void);
#if CONFIG_SPIRAM_FETCH_INSTRUCTIONS
extern int _instruction_reserved_start, _instruction_reserved_end;
/**
* @brief Get the start page number of the instruction in SPI flash
*
* @return start page number
*/
uint32_t instruction_flash_start_page_get(void);
/**
* @brief Get the end page number of the instruction in SPI flash
*
* @return end page number
*/
uint32_t instruction_flash_end_page_get(void);
/**
* @brief Get the offset of instruction from SPI flash to SPI RAM
*
* @return instruction offset
*/
int instruction_flash2spiram_offset(void);
#endif
#if CONFIG_SPIRAM_RODATA
extern int _rodata_reserved_start, _rodata_reserved_end;
/**
* @brief Get the start page number of the rodata in SPI flash
*
* @return start page number
*/
uint32_t rodata_flash_start_page_get(void);
/**
* @brief Get the end page number of the rodata in SPI flash
*
* @return end page number
*/
uint32_t rodata_flash_end_page_get(void);
/**
* @brief Get the offset number of rodata from SPI flash to SPI RAM
*
* @return rodata offset
*/
int rodata_flash2spiram_offset(void);
#endif
#ifdef __cplusplus
}
#endif
#endif
|
//
// VSNOHeightButton.h
// newEye4+
//
// Created by xiao-- on 16/12/15.
// Copyright © 2016年 VStsrcam. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface VSNOHeightButton : UIButton
@end
|
/*
* utils.h
*
* Created on: Jan 19, 2015
* Author: amlogic
*/
#ifndef UTILS_H_
#define UTILS_H_
#include <stdlib.h>
#define FOURCC(c1, c2, c3, c4) \
(c1 << 24 | c2 << 16 | c3 << 8 | c4)
uint16_t U16_AT(const uint8_t *ptr);
uint32_t U32_AT(const uint8_t *ptr);
uint64_t U64_AT(const uint8_t *ptr);
uint16_t U16LE_AT(const uint8_t *ptr);
uint32_t U32LE_AT(const uint8_t *ptr);
uint64_t U64LE_AT(const uint8_t *ptr);
uint64_t ntoh64(uint64_t x);
uint64_t hton64(uint64_t x);
#endif /* UTILS_H_ */
|
/* lapack/double/dlae2.f -- translated by f2c (version 20090411).
You must link the resulting object file with libf2c:
on Microsoft Windows system, link with libf2c.lib;
on Linux or Unix systems, link with .../path/to/libf2c.a -lm
or, if you install libf2c.a in a standard place, with -lf2c -lm
-- in that order, at the end of the command line, as in
cc *.o -lf2c -lm
Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
http://www.netlib.org/f2c/libf2c.zip
*/
#ifdef __cplusplus
extern "C" {
#endif
#include "v3p_netlib.h"
/*< SUBROUTINE DLAE2( A, B, C, RT1, RT2 ) >*/
/* Subroutine */ int dlae2_(doublereal *a, doublereal *b, doublereal *c__,
doublereal *rt1, doublereal *rt2)
{
/* System generated locals */
doublereal d__1;
/* Builtin functions */
double sqrt(doublereal);
/* Local variables */
doublereal ab, df, tb, sm, rt, adf, acmn, acmx;
/* -- LAPACK auxiliary routine (version 3.2) -- */
/* -- LAPACK is a software package provided by Univ. of Tennessee, -- */
/* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */
/* November 2006 */
/* .. Scalar Arguments .. */
/*< DOUBLE PRECISION A, B, C, RT1, RT2 >*/
/* .. */
/* Purpose */
/* ======= */
/* DLAE2 computes the eigenvalues of a 2-by-2 symmetric matrix */
/* [ A B ] */
/* [ B C ]. */
/* On return, RT1 is the eigenvalue of larger absolute value, and RT2 */
/* is the eigenvalue of smaller absolute value. */
/* Arguments */
/* ========= */
/* A (input) DOUBLE PRECISION */
/* The (1,1) element of the 2-by-2 matrix. */
/* B (input) DOUBLE PRECISION */
/* The (1,2) and (2,1) elements of the 2-by-2 matrix. */
/* C (input) DOUBLE PRECISION */
/* The (2,2) element of the 2-by-2 matrix. */
/* RT1 (output) DOUBLE PRECISION */
/* The eigenvalue of larger absolute value. */
/* RT2 (output) DOUBLE PRECISION */
/* The eigenvalue of smaller absolute value. */
/* Further Details */
/* =============== */
/* RT1 is accurate to a few ulps barring over/underflow. */
/* RT2 may be inaccurate if there is massive cancellation in the */
/* determinant A*C-B*B; higher precision or correctly rounded or */
/* correctly truncated arithmetic would be needed to compute RT2 */
/* accurately in all cases. */
/* Overflow is possible only if RT1 is within a factor of 5 of overflow. */
/* Underflow is harmless if the input data is 0 or exceeds */
/* underflow_threshold / macheps. */
/* ===================================================================== */
/* .. Parameters .. */
/*< DOUBLE PRECISION ONE >*/
/*< PARAMETER ( ONE = 1.0D0 ) >*/
/*< DOUBLE PRECISION TWO >*/
/*< PARAMETER ( TWO = 2.0D0 ) >*/
/*< DOUBLE PRECISION ZERO >*/
/*< PARAMETER ( ZERO = 0.0D0 ) >*/
/*< DOUBLE PRECISION HALF >*/
/*< PARAMETER ( HALF = 0.5D0 ) >*/
/* .. */
/* .. Local Scalars .. */
/*< DOUBLE PRECISION AB, ACMN, ACMX, ADF, DF, RT, SM, TB >*/
/* .. */
/* .. Intrinsic Functions .. */
/*< INTRINSIC ABS, SQRT >*/
/* .. */
/* .. Executable Statements .. */
/* Compute the eigenvalues */
/*< SM = A + C >*/
sm = *a + *c__;
/*< DF = A - C >*/
df = *a - *c__;
/*< ADF = ABS( DF ) >*/
adf = abs(df);
/*< TB = B + B >*/
tb = *b + *b;
/*< AB = ABS( TB ) >*/
ab = abs(tb);
/*< IF( ABS( A ).GT.ABS( C ) ) THEN >*/
if (abs(*a) > abs(*c__)) {
/*< ACMX = A >*/
acmx = *a;
/*< ACMN = C >*/
acmn = *c__;
/*< ELSE >*/
} else {
/*< ACMX = C >*/
acmx = *c__;
/*< ACMN = A >*/
acmn = *a;
/*< END IF >*/
}
/*< IF( ADF.GT.AB ) THEN >*/
if (adf > ab) {
/*< RT = ADF*SQRT( ONE+( AB / ADF )**2 ) >*/
/* Computing 2nd power */
d__1 = ab / adf;
rt = adf * sqrt(d__1 * d__1 + 1.);
/*< ELSE IF( ADF.LT.AB ) THEN >*/
} else if (adf < ab) {
/*< RT = AB*SQRT( ONE+( ADF / AB )**2 ) >*/
/* Computing 2nd power */
d__1 = adf / ab;
rt = ab * sqrt(d__1 * d__1 + 1.);
/*< ELSE >*/
} else {
/* Includes case AB=ADF=0 */
/*< RT = AB*SQRT( TWO ) >*/
rt = ab * sqrt(2.);
/*< END IF >*/
}
/*< IF( SM.LT.ZERO ) THEN >*/
if (sm < 0.) {
/*< RT1 = HALF*( SM-RT ) >*/
*rt1 = (sm - rt) * .5;
/* Order of execution important. */
/* To get fully accurate smaller eigenvalue, */
/* next line needs to be executed in higher precision. */
/*< RT2 = ( ACMX / RT1 )*ACMN - ( B / RT1 )*B >*/
*rt2 = acmx / *rt1 * acmn - *b / *rt1 * *b;
/*< ELSE IF( SM.GT.ZERO ) THEN >*/
} else if (sm > 0.) {
/*< RT1 = HALF*( SM+RT ) >*/
*rt1 = (sm + rt) * .5;
/* Order of execution important. */
/* To get fully accurate smaller eigenvalue, */
/* next line needs to be executed in higher precision. */
/*< RT2 = ( ACMX / RT1 )*ACMN - ( B / RT1 )*B >*/
*rt2 = acmx / *rt1 * acmn - *b / *rt1 * *b;
/*< ELSE >*/
} else {
/* Includes case RT1 = RT2 = 0 */
/*< RT1 = HALF*RT >*/
*rt1 = rt * .5;
/*< RT2 = -HALF*RT >*/
*rt2 = rt * -.5;
/*< END IF >*/
}
/*< RETURN >*/
return 0;
/* End of DLAE2 */
/*< END >*/
} /* dlae2_ */
#ifdef __cplusplus
}
#endif
|
/*
Copyright 2017 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS-IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifndef LULLABY_UTIL_COLOR_H_
#define LULLABY_UTIL_COLOR_H_
#include <stdint.h>
#include "mathfu/glsl_mappings.h"
namespace lull {
struct Color4ub {
Color4ub() : r(255), g(255), b(255), a(255) {}
Color4ub(uint8_t r, uint8_t g, uint8_t b, uint8_t a)
: r(r), g(g), b(b), a(a) {}
explicit Color4ub(uint32_t packed) : packed(packed) {}
explicit Color4ub(const mathfu::vec4& v)
: r(static_cast<uint8_t>(v.x * 255)),
g(static_cast<uint8_t>(v.y * 255)),
b(static_cast<uint8_t>(v.z * 255)),
a(static_cast<uint8_t>(v.w * 255)) {}
bool operator==(Color4ub rhs) const {
return (packed == rhs.packed);
}
bool operator!=(Color4ub rhs) const {
return (packed != rhs.packed);
}
static mathfu::vec4 ToVec4(const Color4ub color) {
return mathfu::vec4(1.0f / 255.0f * static_cast<float>(color.r),
1.0f / 255.0f * static_cast<float>(color.g),
1.0f / 255.0f * static_cast<float>(color.b),
1.0f / 255.0f * static_cast<float>(color.a));
}
union {
struct {
uint8_t r;
uint8_t g;
uint8_t b;
uint8_t a;
};
uint32_t packed;
};
};
} // namespace lull
#endif // LULLABY_UTIL_COLOR_H_
|
//
// CustomerTableViewCell.h
// AutoRepairHelper
//
// Created by Points on 15/5/1.
// Copyright (c) 2015年 Poitns. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface CustomerTableViewCell : UITableViewCell
{
EGOImageView *m_head;
UILabel *m_carCodeLab;
UILabel *m_nameLab;
UILabel *m_telLab;
UILabel *m_carTypeLab;
}
@property (nonatomic,strong)ADTContacterInfo *infoData;
@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.
*/
#pragma once
#include "MutatorScheduler.h"
#include <wtf/Seconds.h>
#include <wtf/WeakRandom.h>
namespace JSC {
class Heap;
// The JSC concurrent GC sometimes stops the world in order to stay ahead of it. These deliberate,
// synthetic pauses ensure that the GC won't have to do one huge pause in order to catch up to the
// retreating wavefront. The scheduler is called "space-time" because it links the amount of time
// that the world is paused for to the amount of space that the world allocated since the GC cycle
// began.
class StochasticSpaceTimeMutatorScheduler : public MutatorScheduler {
public:
StochasticSpaceTimeMutatorScheduler(Heap&);
~StochasticSpaceTimeMutatorScheduler();
State state() const override;
void beginCollection() override;
void didStop() override;
void willResume() override;
void didReachTermination() override;
void didExecuteConstraints() override;
void synchronousDrainingDidStall() override;
MonotonicTime timeToStop() override;
MonotonicTime timeToResume() override;
void log() override;
void endCollection() override;
private:
class Snapshot;
friend class Snapshot;
double bytesAllocatedThisCycleImpl();
double bytesSinceBeginningOfCycle(const Snapshot&);
double maxHeadroom();
double headroomFullness(const Snapshot&);
double mutatorUtilization(const Snapshot&);
Heap& m_heap;
State m_state { Normal };
WeakRandom m_random;
Seconds m_minimumPause;
double m_pauseScale;
Seconds m_targetPause;
double m_bytesAllocatedThisCycleAtTheBeginning { 0 };
double m_bytesAllocatedThisCycleAtTheEnd { 0 };
MonotonicTime m_beforeConstraints;
MonotonicTime m_plannedResumeTime;
};
} // namespace JSC
|
/************************************************************************************
* xt_mm_api.c: Implementation File
*
* DESCRIPTION :
*
* AUTHOR : Sean Feng <SeanFeng2006@hotmail.com>
* DATE : Sep. 24, 2010
*
* Copyright (c) 2010-?. All Rights Reserved.
*
* REMARKS:
*
*
************************************************************************************/
#include "xt_mem_api.h"
int _safe_memcpy( void *dst, const void *src, xt_size_t count )
{
/************************************************************************
* Parameters:
*
* Return Value:
*
* Remarks:
************************************************************************/
xt_size_t i = 0;
if ( dst==NULL || src==NULL )
{
return FUN_RET_ERR_ILLEGAL_ARGS;
}
if ( count == 0 )
{
return FUN_RET_OK;
}
if ( (char*)src>(char*)dst && (char*)src<=((char*)dst+count) )
{
return -2;
}
if ( (char*)dst>(char*)src && (char*)dst<=((char*)src+count) )
{
return -3;
}
for ( i=0; i<count; ++i )
{
((char*)dst)[i] = ((char*)src)[i];
}
return count;
}
void* xt_malloc( xt_size_t nSize )
{
return malloc( nSize );
}
void xt_free( void *p )
{
free(p);
p = NULL;
}
void* xt_mem_alloc( xt_size_t size )
{
return xt_malloc( size );
}
void xt_mem_free( void *buf )
{
xt_free( buf );
}
|
// NOTE: This file was generated by the ServiceGenerator.
// ----------------------------------------------------------------------------
// API:
// Security Command Center API (securitycenter/v1)
// Description:
// Security Command Center API provides access to temporal views of assets and
// findings within an organization.
// Documentation:
// https://cloud.google.com/security-command-center
#if SWIFT_PACKAGE || GTLR_USE_MODULAR_IMPORT
@import GoogleAPIClientForRESTCore;
#elif GTLR_BUILT_AS_FRAMEWORK
#import "GTLR/GTLRService.h"
#else
#import "GTLRService.h"
#endif
#if GTLR_RUNTIME_VERSION != 3000
#error This file was generated by a different version of ServiceGenerator which is incompatible with this GTLR library source.
#endif
// Generated comments include content from the discovery document; avoid them
// causing warnings since clang's checks are some what arbitrary.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdocumentation"
NS_ASSUME_NONNULL_BEGIN
// ----------------------------------------------------------------------------
// Authorization scope
/**
* Authorization scope: See, edit, configure, and delete your Google Cloud data
* and see the email address for your Google Account.
*
* Value "https://www.googleapis.com/auth/cloud-platform"
*/
FOUNDATION_EXTERN NSString * const kGTLRAuthScopeSecurityCommandCenterCloudPlatform;
// ----------------------------------------------------------------------------
// GTLRSecurityCommandCenterService
//
/**
* Service for executing Security Command Center API queries.
*
* Security Command Center API provides access to temporal views of assets and
* findings within an organization.
*/
@interface GTLRSecurityCommandCenterService : GTLRService
// No new methods
// Clients should create a standard query with any of the class methods in
// GTLRSecurityCommandCenterQuery.h. The query can the be sent with
// GTLRService's execute methods,
//
// - (GTLRServiceTicket *)executeQuery:(GTLRQuery *)query
// completionHandler:(void (^)(GTLRServiceTicket *ticket,
// id object, NSError *error))handler;
// or
// - (GTLRServiceTicket *)executeQuery:(GTLRQuery *)query
// delegate:(id)delegate
// didFinishSelector:(SEL)finishedSelector;
//
// where finishedSelector has a signature of:
//
// - (void)serviceTicket:(GTLRServiceTicket *)ticket
// finishedWithObject:(id)object
// error:(NSError *)error;
//
// The object passed to the completion handler or delegate method
// is a subclass of GTLRObject, determined by the query method executed.
@end
NS_ASSUME_NONNULL_END
#pragma clang diagnostic pop
|
#ifndef __FATTESTER_H
#define __FATTESTER_H
#include "ff.h"
#include "sys.h"
u8 mf_mount(u8 drv);
u8 mf_open(u8*path,u8 mode);
u8 mf_close(void);
u8 mf_read(u16 len);
u8 mf_write(u8*dat,u16 len);
u8 mf_opendir(u8* path);
u8 mf_readdir(void);
u8 mf_scan_files(u8 * path);
u32 mf_showfree(u8 *drv);
u8 mf_lseek(u32 offset);
u32 mf_tell(void);
u32 mf_size(void);
u8 mf_mkdir(u8*name);
u8 mf_fmkfs(u8 drv,u8 mode,u16 au);
u8 mf_unlink(u8 *name);
u8 mf_rename(u8 *oldname,u8* newname);
void mf_gets(u16 size);
u8 mf_putc(u8 c);
u8 mf_puts(u8*c);
u8 mf_pfnmg_init(u8*path,u8 type);
u8 mf_pfnmg_get_pname(void);
u8 mf_pfnmg_get_plfname(void);
u8 mf_pfnmg_get_lfname(void);
u8 mf_pfnmg_get_ifname(u16 index);
u8 mf_cpymsg(u8*pname,u8 pct,u8 mode);
u32 mf_fdsize(u8 *fdname);//µÃµ½Îļþ¼Ð´óС
u8 mf_fcopy(u8 *psrc,u8 *pdst);
u8 mf_fdcopy(u8 *psrc,u8 *pdst);
#endif
|
#ifndef BEARER_TOKEN_H
#define BEARER_TOKEN_H
#include <stdint.h>
#include "json.h"
#include "json_object.h"
#ifdef __cplusplus
extern "C" {
#endif
#define ACCESS_ACTION_NONE 0
#define ACCESS_ACTION_PULL (1<<0)
#define ACCESS_ACTION_PUSH (1<<1)
typedef struct _bearer_token bearer_token_t;
typedef enum jwt_alg {
JWT_ALG_NONE = 0,
JWT_ALG_RS256,
JWT_ALG_HS256
} jwt_alg_t;
int bearer_token_new(bearer_token_t **bearer_token);
int bearer_token_set_alg(bearer_token_t *token, jwt_alg_t alg);
jwt_alg_t brarer_token_get_alg(bearer_token_t *token);
int bearer_token_set_pk_file_name(bearer_token_t *token, const char *pk_name);
int bearer_token_load_pk(bearer_token_t *token);
int bearer_token_init(bearer_token_t *token);
int bearer_token_set_expiration(bearer_token_t *token, int64_t expiration);
int bearer_token_set_iss(bearer_token_t *token, char *iss);
int bearer_token_set_sub(bearer_token_t *token, char *sub);
int bearer_token_set_aud(bearer_token_t *token, char *aud);
int bearer_token_add_access(bearer_token_t *token, char *type, char *name, int actions);
int bearer_token_del_all_access(bearer_token_t *token);
int bearer_token_dump_string(bearer_token_t *token, char **out);
void bearer_token_free(bearer_token_t *token);
#ifdef __cplusplus
}
#endif
#endif /* BEARER_TOKEN_H */
|
//
// Created by arrow on 9/13/16.
//
#ifndef RETHINKMUD_NETWORK_H
#define RETHINKMUD_NETWORK_H
#include <asio.hpp>
namespace rethinkmud
{
namespace net
{
void init();
void start();
void stop();
void clean();
asio::io_service& get_io_service();
}
}
#endif //RETHINKMUD_NETWORK_H
|
/*
* pubsubpluginUDP: Generic GUCEF COMCORE plugin for providing pubsub approximation via UDP
*
* Copyright (C) 1998 - 2020. Dinand Vanvelzen
*
* 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 PUBSUBPLUGIN_UDP_CUDPPUBSUBCLIENTTOPICCONFIG_H
#define PUBSUBPLUGIN_UDP_CUDPPUBSUBCLIENTTOPICCONFIG_H
/*-------------------------------------------------------------------------//
// //
// INCLUDES //
// //
//-------------------------------------------------------------------------*/
#include <vector>
#ifndef GUCEF_COMCORE_CHOSTADDRESS_H
#include "CHostAddress.h"
#define GUCEF_COMCORE_CHOSTADDRESS_H
#endif /* GUCEF_COMCORE_CHOSTADDRESS_H ? */
#ifndef GUCEF_COMCORE_CPUBSUBCLIENTTOPICCONFIG_H
#include "gucefCOMCORE_CPubSubClientTopicConfig.h"
#define GUCEF_COMCORE_CPUBSUBCLIENTTOPICCONFIG_H
#endif /* GUCEF_COMCORE_CPUBSUBCLIENTTOPICCONFIG_H ? */
#ifndef PUBSUBPLUGIN_UDP_MACROS_H
#include "pubsubpluginUDP_macros.h"
#define PUBSUBPLUGIN_UDP_MACROS_H
#endif /* PUBSUBPLUGIN_UDP_MACROS_H ? */
/*-------------------------------------------------------------------------//
// //
// NAMESPACE //
// //
//-------------------------------------------------------------------------*/
namespace GUCEF {
namespace PUBSUBPLUGIN {
namespace UDP {
/*-------------------------------------------------------------------------//
// //
// CLASSES //
// //
//-------------------------------------------------------------------------*/
class CUdpPubSubClient;
/**
* Standard pub-sub client config with some custom specifcs added for this
* specific pub-sub backend
*/
class PUBSUBPLUGIN_UDP_PLUGIN_PRIVATE_CPP CUdpPubSubClientTopicConfig : public COMCORE::CPubSubClientTopicConfig
{
public:
typedef std::vector< COMCORE::CHostAddress > HostAddressVector;
CUdpPubSubClientTopicConfig( void );
CUdpPubSubClientTopicConfig( const COMCORE::CPubSubClientTopicConfig& genericConfig );
virtual ~CUdpPubSubClientTopicConfig() GUCEF_VIRTUAL_OVERRIDE;
CUdpPubSubClientTopicConfig& operator=( const COMCORE::CPubSubClientTopicConfig& src );
CUdpPubSubClientTopicConfig& operator=( const CUdpPubSubClientTopicConfig& src );
bool LoadCustomConfig( const CORE::CDataNode& config );
COMCORE::CHostAddress udpInterface;
HostAddressVector udpMulticastToJoin;
bool wantsTestPackage;
CORE::UInt32 ticketRefillOnBusyCycle;
CORE::UInt32 nrOfUdpReceiveBuffersPerSocket;
CORE::UInt32 udpSocketOsReceiveBufferSize;
CORE::UInt32 udpSocketUpdateCyclesPerPulse;
bool addUdpSourceAddressAsMetaData;
bool translateUdpSourceAddressToString;
CORE::CString udpSourceAddressAsMetaDataKeyName;
CORE::UInt16 maxUdpPacketPayloadSizeInBytes;
bool addTimestampToReceivedPackages;
};
/*-------------------------------------------------------------------------//
// //
// NAMESPACE //
// //
//-------------------------------------------------------------------------*/
}; /* namespace UDP */
}; /* namespace PUBSUBPLUGIN */
}; /* namespace GUCEF */
/*--------------------------------------------------------------------------*/
#endif /* PUBSUBPLUGIN_UDP_CUDPPUBSUBCLIENTTOPICCONFIG_H ? */
|
/* The question is whether we can observe the result r2 = 1. This result is not
possible in this program, but it becomes possible after rewriting r3=y to r3=r2. */
#include <pthread.h>
int x = 0;
int y = 0;
int done1 = 0;
void thr1() {
int r1;
r1 = x;
y = r1;
done1 = 1;
}
void thr2() {
int r2, r3;
r2 = y;
if (r2 == 1) {
r3 = y;
x = r3;
} else { x = 1; }
// assertion is provable, the result 1 is not possible
if (done1 >= 1) { assert(r2 != 1); }
}
int main() {
pthread_t t1, t2;
pthread_create(&t1, NULL, thr1, NULL);
pthread_create(&t2, NULL, thr2, NULL);
return 0;
}
|
/**
* @license Apache-2.0
*
* Copyright (c) 2019 The Stdlib Authors.
*
* 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.
*/
/**
* Benchmark `ddot`.
*/
#include "stdlib/blas/base/ddot.h"
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <sys/time.h>
#define NAME "ddot"
#define ITERATIONS 10000000
#define REPEATS 3
#define MIN 1
#define MAX 6
/**
* Prints the TAP version.
*/
void print_version() {
printf( "TAP version 13\n" );
}
/**
* Prints the TAP summary.
*
* @param total total number of tests
* @param passing total number of passing tests
*/
void print_summary( int total, int passing ) {
printf( "#\n" );
printf( "1..%d\n", total ); // TAP plan
printf( "# total %d\n", total );
printf( "# pass %d\n", passing );
printf( "#\n" );
printf( "# ok\n" );
}
/**
* Prints benchmarks results.
*
* @param iterations number of iterations
* @param elapsed elapsed time in seconds
*/
void print_results( int iterations, double elapsed ) {
double rate = (double)iterations / elapsed;
printf( " ---\n" );
printf( " iterations: %d\n", iterations );
printf( " elapsed: %0.9f\n", elapsed );
printf( " rate: %0.9f\n", rate );
printf( " ...\n" );
}
/**
* Returns a clock time.
*
* @return clock time
*/
double tic() {
struct timeval now;
gettimeofday( &now, NULL );
return (double)now.tv_sec + (double)now.tv_usec/1.0e6;
}
/**
* Generates a random number on the interval [0,1].
*
* @return random number
*/
double rand_double() {
int r = rand();
return (double)r / ( (double)RAND_MAX + 1.0 );
}
/**
* Runs a benchmark.
*
* @param iterations number of iterations
* @param len array length
* @return elapsed time in seconds
*/
double benchmark( int iterations, int len ) {
double elapsed;
double x[ len ];
double y[ len ];
double z;
double t;
int i;
for ( i = 0; i < len; i++ ) {
x[ i ] = ( rand_double()*20000.0 ) - 10000.0;
y[ i ] = ( rand_double()*20000.0 ) - 10000.0;
}
z = 0.0;
t = tic();
for ( i = 0; i < iterations; i++ ) {
z = c_ddot( len, x, 1, y, 1 );
if ( z != z ) {
printf( "should not return NaN\n" );
break;
}
}
elapsed = tic() - t;
if ( z != z ) {
printf( "should not return NaN\n" );
}
return elapsed;
}
/**
* Main execution sequence.
*/
int main( void ) {
double elapsed;
int count;
int iter;
int len;
int i;
int j;
// Use the current time to seed the random number generator:
srand( time( NULL ) );
print_version();
count = 0;
for ( i = MIN; i <= MAX; i++ ) {
len = pow( 10, i );
iter = ITERATIONS / pow( 10, i-1 );
for ( j = 0; j < REPEATS; j++ ) {
count += 1;
printf( "# c::%s:len=%d\n", NAME, len );
elapsed = benchmark( iter, len );
print_results( iter, elapsed );
printf( "ok %d benchmark finished\n", count );
}
}
print_summary( count, count );
}
|
/*
*
* Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement
* or the like. Any license provided herein, whether implied or
* otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever.
*
* 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
*
* Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
* Mountain View, CA 94043, or:
*
* http://www.sgi.com
*
* For further information regarding this notice, see:
*
* http://oss.sgi.com/projects/GenInfo/NoticeExplan/
*
*/
// -*- C++ -*-
/*
* Copyright (C) 1990,91 Silicon Graphics, Inc.
*
_______________________________________________________________________
______________ S I L I C O N G R A P H I C S I N C . ____________
|
| $Revision: 1.1.1.1 $
|
| Description:
| This file defines the SoSwitch node class.
|
| Author(s) : Paul S. Strauss, Nick Thompson
|
______________ S I L I C O N G R A P H I C S I N C . ____________
_______________________________________________________________________
*/
#ifndef _SO_SWITCH_
#define _SO_SWITCH_
#include <Inventor/fields/SoSFInt32.h>
#include <Inventor/nodes/SoGroup.h>
//////////////////////////////////////////////////////////////////////////////
//
// Class: SoSwitch
//
// Switch group node: traverses only the child indicated by integer
// "whichChild" field. If this field is SO_SWITCH_NONE, no children
// are traversed, while SO_SWITCH_INHERIT means inherit the index
// from the current switch state, doing a modulo operation to make
// sure the child index is within the correct bounds of the switch
// node.
//
//////////////////////////////////////////////////////////////////////////////
#define SO_SWITCH_NONE (-1) /* Don't traverse any children */
#define SO_SWITCH_INHERIT (-2) /* Inherit value from state */
#define SO_SWITCH_ALL (-3) /* Traverse all children */
// C-api: public=whichChild
class INVENTOR_API SoSwitch : public SoGroup {
SO_NODE_HEADER(SoSwitch);
public:
// Fields
SoSFInt32 whichChild; // Child to traverse
// Default constructor
SoSwitch();
// Constructor that takes approximate number of children
// C-api: name=CreateN
SoSwitch(int nChildren);
// Overrides method in SoNode to return FALSE if there is no
// selected child or the selected child does not affect the state.
virtual SbBool affectsState() const;
SoEXTENDER public:
// Implement actions
virtual void doAction(SoAction *action);
virtual void callback(SoCallbackAction *action);
virtual void GLRender(SoGLRenderAction *action);
virtual void pick(SoPickAction *action);
virtual void getBoundingBox(SoGetBoundingBoxAction *action);
virtual void handleEvent(SoHandleEventAction *action);
virtual void getMatrix(SoGetMatrixAction *action);
virtual void search(SoSearchAction *action);
virtual void write(SoWriteAction *action);
SoINTERNAL public:
static void initClass();
protected:
// Generic traversal of children
void traverseChildren(SoAction *action);
virtual ~SoSwitch();
private:
// Traverses correct child. If matchIndex >=0, child index must match
void doChild(SoAction *action, int matchIndex = -1);
};
#endif /* _SO_SWITCH_ */
|
#ifndef TEXTURE_H__
#define TEXTURE_H__
#include "define.h"
#include <IL/il.h>
#include <string>
class Texture
{
public:
Texture(const std::string& filename = "");
~Texture();
bool Load(const std::string& filename);
bool IsValid() const;
void Bind() const;
private:
GLuint m_textureId;
bool m_isValid;
};
#endif // TEXTURE_H__
|
#pragma once
#include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <stdint.h>
#include "mscorlib_System_Object2689449295.h"
// System.Collections.Generic.IList`1<UnityEngine.Canvas>
struct IList_1_t750346367;
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Collections.ObjectModel.ReadOnlyCollection`1<UnityEngine.Canvas>
struct ReadOnlyCollection_1_t395191458 : public Il2CppObject
{
public:
// System.Collections.Generic.IList`1<T> System.Collections.ObjectModel.ReadOnlyCollection`1::list
Il2CppObject* ___list_0;
public:
inline static int32_t get_offset_of_list_0() { return static_cast<int32_t>(offsetof(ReadOnlyCollection_1_t395191458, ___list_0)); }
inline Il2CppObject* get_list_0() const { return ___list_0; }
inline Il2CppObject** get_address_of_list_0() { return &___list_0; }
inline void set_list_0(Il2CppObject* value)
{
___list_0 = value;
Il2CppCodeGenWriteBarrier(&___list_0, value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
|
#ifndef ARM_PACKET_DEFINE_H
#define ARM_PACKET_DEFINE_H
#endif // ARM_PACKET_DEFINE_H
typedef unsigned char byte;
const char COMMAND_WRITE= 0xC0;
const char COMMAND_READ= 0xC1;
const char COMMAND_CHECK_ERROR= 0xC2;
const char COMMAND_RETURN= 0xC3;
const char SET_ENABLE_SLIDER= 0x01;
const char SET_ENABLE_ARM_PUSH= 0x02;
const char SET_ENABLE_ARM_FREE= 0x03;
const char SET_ENABLE_RESET= 0x04;
const char GET_MOTOR_DEGREE= 0x05;
const char GET_ARM_MODE= 0x06;
const char RETURN_MOTOR_DEGREE= 0x01;
const char RETURN_ARM_MODE= 0x02;
|
/*
* Copyright (c) 2021 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <ipc/ipc_service.h>
#include <ipc/ipc_service_backend.h>
#include <logging/log.h>
#include <zephyr.h>
#include <device.h>
LOG_MODULE_REGISTER(ipc_service, CONFIG_IPC_SERVICE_LOG_LEVEL);
const static struct ipc_service_backend *backend;
int ipc_service_register_backend(const struct ipc_service_backend *bkd)
{
if (backend) {
return -EALREADY;
}
if (!bkd || !bkd->register_endpoint || !bkd->send) {
return -EINVAL;
}
backend = bkd;
LOG_DBG("Registered: %s", backend->name ? backend->name : "");
return 0;
}
int ipc_service_register_endpoint(struct ipc_ept **ept, const struct ipc_ept_cfg *cfg)
{
LOG_DBG("Register endpoint %s", cfg->name ? cfg->name : "");
if (!backend || !backend->register_endpoint) {
LOG_ERR("Backend not registered");
return -EIO;
}
if (!ept || !cfg) {
LOG_ERR("Invalid endpoint or configuration");
return -EINVAL;
}
return backend->register_endpoint(ept, cfg);
}
int ipc_service_send(struct ipc_ept *ept, const void *data, size_t len)
{
if (!backend || !backend->send) {
LOG_ERR("Backend not registered");
return -EIO;
}
return backend->send(ept, data, len);
}
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/ec2/EC2_EXPORTS.h>
#include <aws/ec2/EC2Request.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>
namespace Aws
{
namespace EC2
{
namespace Model
{
/**
*/
class AWS_EC2_API DeprovisionIpamPoolCidrRequest : public EC2Request
{
public:
DeprovisionIpamPoolCidrRequest();
// Service request name is the Operation name which will send this request out,
// each operation should has unique request name, so that we can get operation's name from this request.
// Note: this is not true for response, multiple operations may have the same response name,
// so we can not get operation's name from response.
inline virtual const char* GetServiceRequestName() const override { return "DeprovisionIpamPoolCidr"; }
Aws::String SerializePayload() const override;
protected:
void DumpBodyToUrl(Aws::Http::URI& uri ) const override;
public:
/**
* <p>A check for whether you have the required permissions for the action without
* actually making the request and provides an error response. If you have the
* required permissions, the error response is <code>DryRunOperation</code>.
* Otherwise, it is <code>UnauthorizedOperation</code>.</p>
*/
inline bool GetDryRun() const{ return m_dryRun; }
/**
* <p>A check for whether you have the required permissions for the action without
* actually making the request and provides an error response. If you have the
* required permissions, the error response is <code>DryRunOperation</code>.
* Otherwise, it is <code>UnauthorizedOperation</code>.</p>
*/
inline bool DryRunHasBeenSet() const { return m_dryRunHasBeenSet; }
/**
* <p>A check for whether you have the required permissions for the action without
* actually making the request and provides an error response. If you have the
* required permissions, the error response is <code>DryRunOperation</code>.
* Otherwise, it is <code>UnauthorizedOperation</code>.</p>
*/
inline void SetDryRun(bool value) { m_dryRunHasBeenSet = true; m_dryRun = value; }
/**
* <p>A check for whether you have the required permissions for the action without
* actually making the request and provides an error response. If you have the
* required permissions, the error response is <code>DryRunOperation</code>.
* Otherwise, it is <code>UnauthorizedOperation</code>.</p>
*/
inline DeprovisionIpamPoolCidrRequest& WithDryRun(bool value) { SetDryRun(value); return *this;}
/**
* <p>The ID of the pool that has the CIDR you want to deprovision.</p>
*/
inline const Aws::String& GetIpamPoolId() const{ return m_ipamPoolId; }
/**
* <p>The ID of the pool that has the CIDR you want to deprovision.</p>
*/
inline bool IpamPoolIdHasBeenSet() const { return m_ipamPoolIdHasBeenSet; }
/**
* <p>The ID of the pool that has the CIDR you want to deprovision.</p>
*/
inline void SetIpamPoolId(const Aws::String& value) { m_ipamPoolIdHasBeenSet = true; m_ipamPoolId = value; }
/**
* <p>The ID of the pool that has the CIDR you want to deprovision.</p>
*/
inline void SetIpamPoolId(Aws::String&& value) { m_ipamPoolIdHasBeenSet = true; m_ipamPoolId = std::move(value); }
/**
* <p>The ID of the pool that has the CIDR you want to deprovision.</p>
*/
inline void SetIpamPoolId(const char* value) { m_ipamPoolIdHasBeenSet = true; m_ipamPoolId.assign(value); }
/**
* <p>The ID of the pool that has the CIDR you want to deprovision.</p>
*/
inline DeprovisionIpamPoolCidrRequest& WithIpamPoolId(const Aws::String& value) { SetIpamPoolId(value); return *this;}
/**
* <p>The ID of the pool that has the CIDR you want to deprovision.</p>
*/
inline DeprovisionIpamPoolCidrRequest& WithIpamPoolId(Aws::String&& value) { SetIpamPoolId(std::move(value)); return *this;}
/**
* <p>The ID of the pool that has the CIDR you want to deprovision.</p>
*/
inline DeprovisionIpamPoolCidrRequest& WithIpamPoolId(const char* value) { SetIpamPoolId(value); return *this;}
/**
* <p>The CIDR which you want to deprovision from the pool.</p>
*/
inline const Aws::String& GetCidr() const{ return m_cidr; }
/**
* <p>The CIDR which you want to deprovision from the pool.</p>
*/
inline bool CidrHasBeenSet() const { return m_cidrHasBeenSet; }
/**
* <p>The CIDR which you want to deprovision from the pool.</p>
*/
inline void SetCidr(const Aws::String& value) { m_cidrHasBeenSet = true; m_cidr = value; }
/**
* <p>The CIDR which you want to deprovision from the pool.</p>
*/
inline void SetCidr(Aws::String&& value) { m_cidrHasBeenSet = true; m_cidr = std::move(value); }
/**
* <p>The CIDR which you want to deprovision from the pool.</p>
*/
inline void SetCidr(const char* value) { m_cidrHasBeenSet = true; m_cidr.assign(value); }
/**
* <p>The CIDR which you want to deprovision from the pool.</p>
*/
inline DeprovisionIpamPoolCidrRequest& WithCidr(const Aws::String& value) { SetCidr(value); return *this;}
/**
* <p>The CIDR which you want to deprovision from the pool.</p>
*/
inline DeprovisionIpamPoolCidrRequest& WithCidr(Aws::String&& value) { SetCidr(std::move(value)); return *this;}
/**
* <p>The CIDR which you want to deprovision from the pool.</p>
*/
inline DeprovisionIpamPoolCidrRequest& WithCidr(const char* value) { SetCidr(value); return *this;}
private:
bool m_dryRun;
bool m_dryRunHasBeenSet;
Aws::String m_ipamPoolId;
bool m_ipamPoolIdHasBeenSet;
Aws::String m_cidr;
bool m_cidrHasBeenSet;
};
} // namespace Model
} // namespace EC2
} // namespace Aws
|
/*
* font server atom manipulations
*/
/*
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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
OPEN GROUP 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.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
* Copyright 1990, 1991 Network Computing Devices;
* Portions Copyright 1987 by Digital Equipment Corporation
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the names of Network Computing Devices,
* or Digital not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. Network Computing Devices, or Digital
* make no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* NETWORK COMPUTING DEVICES, AND DIGITAL DISCLAIM ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES, OR DIGITAL BE
* LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
#include "config.h"
#include "misc.h"
#include "fsresource.h"
#include "difs.h"
#define InitialTableSize 100
#define FSA_LAST_PREDEFINED 0 /* only None is predefined */
typedef struct _Node {
struct _Node *left,
*right;
Atom a;
unsigned int fingerPrint;
char *string;
} NodeRec, *NodePtr;
static Atom lastAtom = None;
static NodePtr atomRoot = (NodePtr) NULL;
static unsigned long tableLength;
static NodePtr *nodeTable;
Atom
MakeAtom(const char *string, unsigned int len, Bool makeit)
{
register NodePtr *np;
unsigned i;
int comp;
register unsigned int fp = 0;
np = &atomRoot;
for (i = 0; i < (len + 1) / 2; i++) {
fp = fp * 27 + string[i];
fp = fp * 27 + string[len - 1 - i];
}
while (*np != (NodePtr) NULL) {
if (fp < (*np)->fingerPrint)
np = &((*np)->left);
else if (fp > (*np)->fingerPrint)
np = &((*np)->right);
else { /* now start testing the strings */
comp = strncmp(string, (*np)->string, len);
if ((comp < 0) || ((comp == 0) && (len < strlen((*np)->string))))
np = &((*np)->left);
else if (comp > 0)
np = &((*np)->right);
else
return (*np)->a;
}
}
if (makeit) {
register NodePtr nd;
nd = (NodePtr) fsalloc(sizeof(NodeRec));
if (!nd)
return BAD_RESOURCE;
#if FSA_LAST_PREDEFINED > 0
if (lastAtom < FSA_LAST_PREDEFINED) {
nd->string = string;
} else
#endif
{
nd->string = (char *) fsalloc(len + 1);
if (!nd->string) {
fsfree(nd);
return BAD_RESOURCE;
}
strncpy(nd->string, string, len);
nd->string[len] = 0;
}
if ((lastAtom + 1) >= tableLength) {
NodePtr *table;
table = (NodePtr *) fsrealloc(nodeTable,
tableLength * (2 * sizeof(NodePtr)));
if (!table) {
if (nd->string != string)
fsfree(nd->string);
fsfree(nd);
return BAD_RESOURCE;
}
tableLength <<= 1;
nodeTable = table;
}
*np = nd;
nd->left = nd->right = (NodePtr) NULL;
nd->fingerPrint = fp;
nd->a = (++lastAtom);
*(nodeTable + lastAtom) = nd;
return nd->a;
} else
return None;
}
int
ValidAtom(Atom atom)
{
return (atom != None) && (atom <= lastAtom);
}
char *
NameForAtom(Atom atom)
{
NodePtr node;
if (atom > lastAtom)
return NULL;
if ((node = nodeTable[atom]) == (NodePtr) NULL)
return NULL;
return node->string;
}
static void
atom_error(void)
{
FatalError("initializing atoms\n");
}
static void
free_atom(NodePtr patom)
{
if (patom->left)
free_atom(patom->left);
if (patom->right)
free_atom(patom->right);
if (patom->a > FSA_LAST_PREDEFINED)
fsfree(patom->string);
fsfree(patom);
}
static void
free_all_atoms(void)
{
if (atomRoot == (NodePtr) NULL)
return;
free_atom(atomRoot);
atomRoot = (NodePtr) NULL;
fsfree(nodeTable);
nodeTable = (NodePtr *) NULL;
lastAtom = None;
}
void
InitAtoms(void)
{
free_all_atoms();
tableLength = InitialTableSize;
nodeTable = (NodePtr *) fsalloc(InitialTableSize * sizeof(NodePtr));
if (!nodeTable)
atom_error();
nodeTable[None] = (NodePtr) NULL;
lastAtom = FSA_LAST_PREDEFINED;
}
|
//
// HHHTextField.h
// HHHFieldView
//
// Created by xiaoaihhh on 2018/2/12.
// Copyright © 2018年 com.hhh.www. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface HHHTextField : UITextField
@end
|
#ifndef crypto_box_curve25519xsalsa20poly1305_H
#define crypto_box_curve25519xsalsa20poly1305_H
#include <stddef.h>
#include "export.h"
#ifdef __cplusplus
# if __GNUC__
# pragma GCC diagnostic ignored "-Wlong-long"
# endif
extern "C" {
#endif
#define crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES 32U
SODIUM_EXPORT
size_t crypto_box_curve25519xsalsa20poly1305_publickeybytes(void);
#define crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES 32U
SODIUM_EXPORT
size_t crypto_box_curve25519xsalsa20poly1305_secretkeybytes(void);
#define crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES 32U
SODIUM_EXPORT
size_t crypto_box_curve25519xsalsa20poly1305_beforenmbytes(void);
#define crypto_box_curve25519xsalsa20poly1305_NONCEBYTES 24U
SODIUM_EXPORT
size_t crypto_box_curve25519xsalsa20poly1305_noncebytes(void);
#define crypto_box_curve25519xsalsa20poly1305_ZEROBYTES 32U
SODIUM_EXPORT
size_t crypto_box_curve25519xsalsa20poly1305_zerobytes(void);
#define crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES 16U
SODIUM_EXPORT
size_t crypto_box_curve25519xsalsa20poly1305_boxzerobytes(void);
#define crypto_box_curve25519xsalsa20poly1305_MACBYTES \
(crypto_box_curve25519xsalsa20poly1305_ZEROBYTES - \
crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES)
SODIUM_EXPORT
size_t crypto_box_curve25519xsalsa20poly1305_macbytes(void);
SODIUM_EXPORT
int crypto_box_curve25519xsalsa20poly1305(unsigned char *c,
const unsigned char *m,
unsigned long long mlen,
const unsigned char *n,
const unsigned char *pk,
const unsigned char *sk);
SODIUM_EXPORT
int crypto_box_curve25519xsalsa20poly1305_open(unsigned char *m,
const unsigned char *c,
unsigned long long clen,
const unsigned char *n,
const unsigned char *pk,
const unsigned char *sk);
SODIUM_EXPORT
int crypto_box_curve25519xsalsa20poly1305_keypair(unsigned char *pk, unsigned char *sk);
SODIUM_EXPORT
int crypto_box_curve25519xsalsa20poly1305_beforenm(unsigned char *k,
const unsigned char *pk,
const unsigned char *sk);
SODIUM_EXPORT
int crypto_box_curve25519xsalsa20poly1305_afternm(unsigned char *c,
const unsigned char *m,
unsigned long long mlen,
const unsigned char *n,
const unsigned char *k);
SODIUM_EXPORT
int crypto_box_curve25519xsalsa20poly1305_open_afternm(unsigned char *m,
const unsigned char *c,
unsigned long long clen,
const unsigned char *n,
const unsigned char *k);
#ifdef __cplusplus
}
#endif
#endif
|
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class com_yyh_lib_bsdiff_JPatch */
#ifndef _Included_com_yyh_lib_bsdiff_JPatch
#define _Included_com_yyh_lib_bsdiff_JPatch
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: com_yyh_lib_bsdiff_PatchUtils
* Method: genNewApk
* Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL Java_com_yyh_lib_bsdiff_PatchUtils_patch
(JNIEnv *, jclass, jstring, jstring, jstring);
#ifdef __cplusplus
}
#endif
#endif
|
#include "param.h"
#include "tty.h"
#include "systm.h"
#include "conf.h"
#include "buf.h"
/*
* The actual structure of a clist block manipulated by
* getc and putc (mch.s)
*/
struct cblock {
struct cblock *c_next;
char c_info[CBSIZE];
};
struct cblock cfree[NCLIST];
struct cblock *cfreelist;
int cbad;
/*
* Character list get/put
*/
int getclist (struct clist *p)
{
struct cblock *bp;
int c, s;
s = spl6();
if (p->c_cc <= 0) {
c = -1;
p->c_cc = 0;
p->c_cf = p->c_cl = NULL;
} else {
c = *p->c_cf++ & 0377;
if (--p->c_cc<=0) {
bp = (struct cblock *)(p->c_cf-1);
bp = (struct cblock *) ((int)bp & ~CROUND);
p->c_cf = NULL;
p->c_cl = NULL;
bp->c_next = cfreelist;
cfreelist = bp;
} else if (((int)p->c_cf & CROUND) == 0){
bp = (struct cblock *)(p->c_cf);
bp--;
p->c_cf = bp->c_next->c_info;
bp->c_next = cfreelist;
cfreelist = bp;
}
}
splx(s);
return(c);
}
/*
* copy clist to buffer.
* return number of bytes moved.
*/
int q_to_b (struct clist *q, caddr_t cp, int cc)
{
register struct cblock *bp;
register int s;
char *acp;
if (cc <= 0)
return(0);
s = spl6();
if (q->c_cc <= 0) {
q->c_cc = 0;
q->c_cf = q->c_cl = NULL;
return(0);
}
acp = cp;
cc++;
while (--cc) {
*cp++ = *q->c_cf++;
if (--q->c_cc <= 0) {
bp = (struct cblock *)(q->c_cf-1);
bp = (struct cblock *)((int)bp & ~CROUND);
q->c_cf = q->c_cl = NULL;
bp->c_next = cfreelist;
cfreelist = bp;
break;
}
if (((int)q->c_cf & CROUND) == 0) {
bp = (struct cblock *)(q->c_cf);
bp--;
q->c_cf = bp->c_next->c_info;
bp->c_next = cfreelist;
cfreelist = bp;
}
}
splx(s);
return(cp-acp);
}
/*
* Return count of contiguous characters
* in clist starting at q->c_cf.
* Stop counting if flag&character is non-null.
*/
int ndqb (struct clist *q, int flag)
{
int cc;
int s;
s = spl6();
if (q->c_cc <= 0) {
cc = -q->c_cc;
goto out;
}
cc = ((int)q->c_cf + CBSIZE) & ~CROUND;
cc -= (int)q->c_cf;
if (q->c_cc < cc)
cc = q->c_cc;
if (flag) {
char *p, *end;
p = q->c_cf;
end = p;
end += cc;
while (p < end) {
if (*p & flag) {
cc = (int)p;
cc -= (int)q->c_cf;
break;
}
p++;
}
}
out:
splx(s);
return(cc);
}
/*
* Update clist to show that cc characters
* were removed. It is assumed that cc < CBSIZE.
*/
void ndflush (struct clist *q, int cc)
{
int s;
s = spl6();
if (q->c_cc < 0) {
if (q->c_cf != NULL) {
q->c_cc += cc;
q->c_cf += cc;
goto out;
}
q->c_cc = 0;
goto out;
}
if (q->c_cc == 0) {
goto out;
}
if (cc > CBSIZE || cc <= 0) {
cbad++;
goto out;
}
q->c_cc -= cc;
q->c_cf += cc;
if (((int)q->c_cf & CROUND) == 0) {
register struct cblock *bp;
bp = (struct cblock *)(q->c_cf) -1;
if (bp->c_next) {
q->c_cf = bp->c_next->c_info;
} else {
q->c_cf = q->c_cl = NULL;
}
bp->c_next = cfreelist;
cfreelist = bp;
} else
if (q->c_cc == 0) {
register struct cblock *bp;
q->c_cf = (char *)((int)q->c_cf & ~CROUND);
bp = (struct cblock *)(q->c_cf);
bp->c_next = cfreelist;
cfreelist = bp;
q->c_cf = q->c_cl = NULL;
}
out:
splx(s);
}
int putclist (int c, struct clist *p)
{
struct cblock *bp;
char *cp;
int s;
s = spl6();
if ((cp = p->c_cl) == NULL || p->c_cc < 0 ) {
if ((bp = cfreelist) == NULL) {
splx(s);
return(-1);
}
cfreelist = bp->c_next;
bp->c_next = NULL;
p->c_cf = cp = bp->c_info;
} else if (((int)cp & CROUND) == 0) {
bp = (struct cblock *)cp - 1;
if ((bp->c_next = cfreelist) == NULL) {
splx(s);
return(-1);
}
bp = bp->c_next;
cfreelist = bp->c_next;
bp->c_next = NULL;
cp = bp->c_info;
}
*cp++ = c;
p->c_cc++;
p->c_cl = cp;
splx(s);
return(0);
}
/*
* copy buffer to clist.
* return number of bytes not transfered.
*/
int b_to_q (caddr_t cp, int cc, struct clist *q)
{
char *cq;
struct cblock *bp;
int s, acc;
if (cc <= 0)
return(0);
acc = cc;
s = spl6();
if ((cq = q->c_cl) == NULL || q->c_cc < 0) {
if ((bp = cfreelist) == NULL)
goto out;
cfreelist = bp->c_next;
bp->c_next = NULL;
q->c_cf = cq = bp->c_info;
}
while (cc) {
if (((int)cq & CROUND) == 0) {
bp = (struct cblock *) cq - 1;
if ((bp->c_next = cfreelist) == NULL)
goto out;
bp = bp->c_next;
cfreelist = bp->c_next;
bp->c_next = NULL;
cq = bp->c_info;
}
*cq++ = *cp++;
cc--;
}
out:
q->c_cl = cq;
q->c_cc += acc-cc;
splx(s);
return(cc);
}
/*
* Initialize clist by freeing all character blocks, then count
* number of character devices. (Once-only routine)
*/
void cinit (void)
{
int ccp;
struct cblock *cp;
struct cdevsw *cdp;
ccp = (int)cfree;
ccp = (ccp+CROUND) & ~CROUND;
for(cp=(struct cblock *)ccp; cp <= &cfree[NCLIST-1]; cp++) {
cp->c_next = cfreelist;
cfreelist = cp;
}
for(cdp = cdevsw; cdp->d_open; cdp++)
nchrdev++;
}
/*
* integer (2-byte) get/put
* using clists
*/
int
getwlist( struct clist *p)
{
int s;
if (p->c_cc <= 1)
return(-1);
s = getclist(p);
return(s | (getclist(p)<<8));
}
int
putwlist (int c, struct clist *p)
{
int s;
s = spl6();
if (cfreelist==NULL) {
splx(s);
return(-1);
}
putclist(c, p);
putclist(c>>8, p);
splx(s);
return(0);
}
|
//
// AppDelegate.h
// picker-sample
//
// Created by happy_ryo on 2014/08/01.
// Copyright (c) 2014年 happy_ryo. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
/*
* BTrie Sedna specialization
* Copyright (c) 2010 The Institute for System Programming of the Russian Academy of Sciences (ISP RAS)
*/
#ifndef SEDNABTRIE_H
#define SEDNABTRIE_H
#include <string.h>
#include "btrie.h"
#include <stdint.h>
void btrie_collect_stat(xptr entry_point);
inline
static btrie_record_t sbtrie_find_str(const xptr tree, const char * key) {
btrie_t btrie = btrie_open(tree);
btrie_record_t result = btrie_find(btrie, key, strlen(key));
btrie_close(btrie);
return result;
}
inline
static xptr sbtrie_insert(xptr tree, const char * key, size_t key_len, const char * obj, size_t obj_length, bool replace) {
btrie_t btrie = btrie_open(tree);
xptr result;
btrie_insert(btrie, key, key_len, obj, obj_length, replace);
result = btrie_get_root(btrie);
btrie_close(btrie);
return result;
}
inline
static xptr sbtrie_insert_str(xptr tree, const char * key, const char * obj, size_t obj_length, bool replace) {
btrie_t btrie = btrie_open(tree);
xptr result;
btrie_insert(btrie, key, strlen(key), obj, obj_length, replace);
result = btrie_get_root(btrie);
btrie_close(btrie);
return result;
}
inline
static xptr sbtrie_insert_str_str(xptr tree, const char * key, const char * obj, bool replace) {
btrie_t btrie = btrie_open(tree);
xptr result;
btrie_insert(btrie, key, strlen(key), obj, strlen(obj), replace);
result = btrie_get_root(btrie);
btrie_close(btrie);
return result;
}
inline
static xptr sbtrie_delete_str(xptr tree, const char * key) {
btrie_t btrie = btrie_open(tree);
btrie_delete(btrie, key, strlen(key));
xptr result = btrie_get_root(btrie);
btrie_close(btrie);
return result;
}
#endif /* SEDNABTRIE_H */
|
int nondet_int();
int main() {
int fail=0;
int x=nondet_int();
__ESBMC_assume(x>0);
while(x>0) {
__ESBMC_assume(fail!=1);
if(fail==1) {
x= -1;
// fail=2;
} else {
x--;
}
}
assert(x==0);
}
|
#ifndef AISTREAMS_UTIL_GRPC_STATUS_DELEGATE_H_
#define AISTREAMS_UTIL_GRPC_STATUS_DELEGATE_H_
#include "absl/strings/string_view.h"
#include "aistreams/port/status.h"
#include "grpcpp/grpcpp.h"
namespace aistreams {
namespace util {
// Creates a aistreams::Status from a grpc::Status.
aistreams::Status MakeStatusFromRpcStatus(grpc::Status const& status);
// Creates a aistreams::Status from a grpc::StatusCode and description.
aistreams::Status MakeStatusFromRpcStatus(grpc::StatusCode code,
absl::string_view message);
} // namespace util
} // namespace aistreams
#endif // AISTREAMS_UTIL_GRPC_STATUS_DELEGATE_H_
|
//
// AppDelegate.h
// 02.Masonry与scrollView
//
// Created by 陈泽嘉 on 15/12/20.
// Copyright (c) 2015年 dibadalu. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
/* Copyright (©) 2012 Sense Observation Systems B.V.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Author: Pim Nijdam (pim@sense-os.nl)
*/
#import <Foundation/Foundation.h>
#import "CSSensor.h"
/**
Sensor that stores rotation data.
See also CMDeviceMotion.h for more information about the data is stored here.
___JSON output value format___
{
"x-axis": FLOAT;
"y-axis": FLOAT;
"z-axis": FLOAT;
}
*/
@interface CSRotationSensor : CSSensor {
}
@end
|
//
// ChartsBootstrap.h
// ChartsBootstrap
//
// Created by Pavel Diatchenko on 27/06/2015.
// Copyright (c) 2015 Pavel Diatchenko. All rights reserved.
//
#import <UIKit/UIKit.h>
//! Project version number for ChartsBootstrap.
FOUNDATION_EXPORT double ChartsBootstrapVersionNumber;
//! Project version string for ChartsBootstrap.
FOUNDATION_EXPORT const unsigned char ChartsBootstrapVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <ChartsBootstrap/PublicHeader.h>
|
/**
* @copyright Copyright 2016 The J-PET Framework 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 find a copy of the License in the LICENCE file.
*
* 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.
*
* @file JPetScopeParamGetter.h
*/
#ifndef JPETSCOPEPARAMGETTER_H
#define JPETSCOPEPARAMGETTER_H
#include "../JPetParamBank/JPetParamBank.h"
#include "../JPetScopeConfigParser/JPetScopeConfigPOD.h" /// for generateParametersFromScopeConfig
#include <map>
class JPetParamManager;
class JPetScopeParamGetter
{
public:
JPetScopeParamGetter();
~JPetScopeParamGetter();
JPetParamBank* generateParamBank(const std::string& scopeConfFile);
static void clearParamCache(); ///Dangerous cause it is shared by all threads
private:
JPetScopeParamGetter(const JPetScopeParamGetter&);
JPetScopeParamGetter& operator=(const JPetScopeParamGetter&);
friend class JPetParamManager;
static std::map<std::string, JPetParamBank*> gParamCache; /// this static variable is shared among all threads
};
#endif /* !JPETSCOPEPARAMGETTER_H */
|
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* FreeRDP Proxy Server
*
* Copyright 2019 Kobi Mizrachi <kmizrachi18@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_SERVER_PROXY_RDPSND_H
#define FREERDP_SERVER_PROXY_RDPSND_H
#include <freerdp/client/rdpsnd.h>
#include <freerdp/server/rdpsnd.h>
#include <freerdp/server/proxy/proxy_context.h>
BOOL pf_server_rdpsnd_init(pServerContext* ps);
void pf_server_rdpsnd_free(pServerContext* ps);
#endif /* FREERDP_SERVER_PROXY_RDPSND_H */
|
/* -*- Mode: C++ -*-
*
* contextkit-meego
* Copyright © 2010, Intel Corporation.
* Copyright © 2012, Jolla.
*
* This program is licensed under the terms and conditions of the
* Apache License, version 2.0. The full text of the Apache License is at
* http://www.apache.org/licenses/LICENSE-2.0
*
*/
#ifndef CONNMANPROVIDER_H
#define CONNMANPROVIDER_H
#include <iproviderplugin.h>
#include <networkmanager.h>
#include <QSet>
#include <QMap>
#include <QString>
#include <QVariant>
using ContextSubscriber::IProviderPlugin;
extern "C"
{
IProviderPlugin* pluginFactory(const QString& constructionString);
}
class ConnmanProvider : public IProviderPlugin
{
Q_OBJECT;
public:
ConnmanProvider();
virtual ~ConnmanProvider();
virtual void subscribe(QSet<QString> keys);
virtual void unsubscribe(QSet<QString> keys);
virtual void blockUntilReady() {}
virtual void blockUntilSubscribed(const QString&) {}
static const QString networkType;
static const QString networkState;
static const QString networkName;
static const QString signalStrength;
static const QString trafficIn;
static const QString trafficOut;
protected:
void timerEvent(QTimerEvent* event);
private:
QString map(const QString &input) const;
;
QSet<QString> m_subscribedProperties;
QVariantMap m_properties;
NetworkManager *m_networkManager;
NetworkService *activeService;
int m_timerId;
QMap<QString, QString> m_nameMapper;
private slots:
void emitSubscribeFinished();
void emitChanged();
void defaultRouteChanged(NetworkService* item);
void stateChanged(QString State);
void signalStrengthChanged(uint);
void nameChanged(const QString &name);
};
#endif //CONNMANPROVIDER_H
|
/*
*
* Copyright (c) 2016-2017 Nest Labs, Inc.
* Copyright (c) 2019-2020 Google LLC.
* 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.
*/
/**
* @file
* Project-specific configuration file for iOS builds.
*
*/
#ifndef WEAVEPROJECTCONFIG_H
#define WEAVEPROJECTCONFIG_H
// Enable use of an ephemeral UDP source port for locally initiated Weave exchanges.
#define WEAVE_CONFIG_ENABLE_EPHEMERAL_UDP_PORT 0
// Enable UDP listening on demand in the WeaveDeviceManager
#define WEAVE_CONFIG_DEVICE_MGR_DEMAND_ENABLE_UDP 1
#define INET_CONFIG_OVERRIDE_SYSTEM_TCP_USER_TIMEOUT 0
// Enable passcode encryption configuration 1
#define WEAVE_CONFIG_SUPPORT_PASSCODE_CONFIG1_TEST_ONLY 1
#define WDM_UPDATE_MAX_ITEMS_IN_TRAIT_DIRTY_PATH_STORE 300
// Uncomment this for a large Tunnel MTU.
//#define WEAVE_CONFIG_TUNNEL_INTERFACE_MTU (9000)
// Max number of Bindings per WeaveExchangeManager
#define WEAVE_CONFIG_MAX_BINDINGS 8
#define WDM_ENFORCE_EXPIRY_TIME 1
#define WEAVE_CONFIG_ENABLE_WDM_UPDATE 1
#define WEAVE_CONFIG_LEGACY_CASE_AUTH_DELEGATE 0
#define WEAVE_CONFIG_LEGACY_KEY_EXPORT_DELEGATE 0
#define WEAVE_SYSTEM_CONFIG_PACKETBUFFER_MAXALLOC 300
#define WEAVE_CONFIG_ENABLE_FUNCT_ERROR_LOGGING 1
#define WEAVE_CONFIG_DATA_MANAGEMENT_CLIENT_EXPERIMENTAL 1
#define WEAVE_CONFIG_MAX_SOFTWARE_VERSION_LENGTH 128
#endif /* WEAVEPROJECTCONFIG_H */
|
#ifndef COORDINATES_H
#define COORDINATES_H
struct coord {
int x;
int y;
coord(int x, int y):
x(x), y(y){}
bool operator==(const coord& other) const {
return (other.x == x && other.y == y);
}
bool operator!=(const coord& other) const {
return !(other == *this);
}
};
#endif
|
/* Program to calculate the maximum distance from root to a node in graph with no cycles.
1. We do a BFS from starting from root of graph.
2. During BFS we also store the distance of a node from root.
3. If a node is already visited but still has more distance from incoming node then update its distance
and add it to queue again.
4, When the BFS is complete then visit all nodes and calculate the max distance.
*/
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <limits.h>
#define NODES 5
struct ListNode {
int dest;
struct ListNode *next;
};
struct AdjList {
struct Listnode *head;
int dist; // This field stores the max distance from root to itself.
};
struct Graph {
int V;
struct AdjList *list; // This is used as pointer to array of struct AdjList
};
struct Graph * create_graph(int V) {
struct Graph *graph = (struct Graph *) malloc(sizeof(struct Graph));
graph->V = V;
graph->list = (struct AdjList *) malloc(sizeof(struct AdjList) * V);
for(int i=0; i<V; i++) {
graph->list[i].head = NULL;
graph->list[i].dist = 0;
}
return graph;
}
void add_edge(struct Graph *graph, int u, int v) {
struct ListNode *node = (struct ListNode *) malloc(sizeof(struct ListNode));
node->dest = v;
node->next = graph->list[u].head;
graph->list[u].head = node;
}
void print_graph(struct Graph *graph) {
for(int i=0; i < graph->V; i++) {
struct ListNode *node = graph->list[i].head;
while(node) {
printf("Edge from node %d to %d \n", i, node->dest);
node = node->next;
}
}
}
#define MAX 100
struct queue {
int front, rear;
int item[MAX];
};
struct queue * create_queue() {
struct queue *Q = malloc(sizeof(struct queue));
Q->front = 0;
Q->rear = 0;
return Q;
}
void push_back(struct queue *Q, int i) {
Q->item[Q->front] = i;
Q->front++;
}
int pop_front(struct queue *Q) {
int temp;
temp = Q->item[Q->rear];
Q->rear++;
return temp;
}
bool isEmpty(struct queue *Q) {
return (Q->rear == Q->front);
}
void BFS(struct Graph *graph, int v, bool visited[]) {
struct queue *Q = create_queue();
int parent_dist;
push_back(Q, v);
while(!isEmpty(Q)) {
v = pop_front(Q);
parent_dist = graph->list[v].dist;
visited[v] = true;
// visit neighbours
struct ListNode *node = graph->list[v].head;
while(node) {
if(visited[node->dest] == false || graph->list[node->dest].dist < parent_dist + 1) {
graph->list[node->dest].dist = parent_dist + 1;
push_back(Q, node->dest);
}
node = node->next;
}
}
}
int calc_max(struct Graph *graph) {
int max_dist = INT_MIN;
for(int i=0; i<graph->V; i++) {
printf("distance upto node %d is %d\n", i, graph->list[i].dist);
if(max_dist < graph->list[i].dist) {
max_dist = graph->list[i].dist;
}
}
return max_dist;
}
int get_max_dist(struct Graph *graph, int v) {
bool visited[graph->V];
for(int i=0; i<graph->V; i++) {
visited[i] = false;
}
BFS(graph, v, visited);
return calc_max(graph);
}
void main() {
int V = NODES;
struct Graph *graph = create_graph(V);
add_edge(graph, 0, 1);
add_edge(graph, 0, 2);
add_edge(graph, 1, 3);
add_edge(graph, 2, 3);
//add_edge(graph, 2, 4);
add_edge(graph, 4, 2);
add_edge(graph, 3, 4);
print_graph(graph);
int res = get_max_dist(graph, 0); // get the max distace from root i.e. 0
printf("The maximum distance from root is %d\n",res);
}
|
/*
Textron
Based on Smultron Written by Peter Borg, pgw3@mac.com
Find the latest version at http://vijaykiran.com/textron
Copyright 2004-2009 Peter Borg
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 <Cocoa/Cocoa.h>
@interface SMLTableView : NSTableView {
}
@end
|
/*
* GUID definitions
*
* Copyright 2000 Alexandre Julliard
* Copyright 2000 Francois Gouget
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "objbase.h"
#include "oleauto.h"
#include "olectl.h"
#include "d3d9.h"
#include "initguid.h"
#include "uuids.h"
#include "strmif.h"
#include "control.h"
#include "amstream.h"
#include "qedit.h"
#include "vmr9.h"
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "annotation.h"
#include <vector>
#include <cassert>
namespace document {
struct SpanNode;
struct SpanTreeVisitor;
class SpanTree {
typedef std::vector<Annotation> AnnotationVector;
vespalib::string _name;
std::unique_ptr<SpanNode> _root;
std::vector<Annotation> _annotations;
public:
typedef std::unique_ptr<SpanTree> UP;
typedef AnnotationVector::const_iterator const_iterator;
template <typename T>
SpanTree(vespalib::stringref name, std::unique_ptr<T> root)
: _name(name),
_root(std::move(root)) {
assert(_root.get());
}
~SpanTree();
// The annotate functions return the annotation index.
size_t annotate(std::unique_ptr<Annotation> annotation);
size_t annotate(const SpanNode &node, std::unique_ptr<Annotation> a);
size_t annotate(const SpanNode &node, const AnnotationType &a_type);
Annotation & annotation(size_t index) { return _annotations[index]; }
const Annotation & annotation(size_t index) const { return _annotations[index]; }
void accept(SpanTreeVisitor &visitor) const;
const vespalib::string & getName() const { return _name; }
const SpanNode &getRoot() const { return *_root; }
size_t numAnnotations() const { return _annotations.size(); }
void reserveAnnotations(size_t sz) { _annotations.resize(sz); }
const_iterator begin() const { return _annotations.begin(); }
const_iterator end() const { return _annotations.end(); }
int compare(const SpanTree &other) const;
vespalib::string toString() const;
};
} // namespace document
|
/*!The Treasure Box Library
*
* 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.
*
* Copyright (C) 2009 - 2019, TBOOX Open Source Group.
*
* @author ruki
* @file strlcpy.c
* @ingroup libc
*
*/
/* //////////////////////////////////////////////////////////////////////////////////////
* includes
*/
#include "string.h"
#include "../../memory/impl/prefix.h"
#ifndef TB_CONFIG_LIBC_HAVE_STRLCPY
# if defined(TB_ARCH_x86)
# include "impl/x86/strlcpy.c"
# elif defined(TB_ARCH_ARM)
# include "impl/arm/strlcpy.c"
# elif defined(TB_ARCH_SH4)
# include "impl/sh4/strlcpy.c"
# endif
#else
# include <string.h>
#endif
/* //////////////////////////////////////////////////////////////////////////////////////
* macros
*/
/* suppress warning as error for clang compiler temporarily:
*
* implicit declaration of function 'strlcpy' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
*
* TODO: need improve xmake to check this interface more correctly.
*/
#if defined(TB_CONFIG_LIBC_HAVE_STRLCPY) && defined(TB_COMPILER_IS_CLANG)
# undef TB_CONFIG_LIBC_HAVE_STRLCPY
#endif
/* //////////////////////////////////////////////////////////////////////////////////////
* implementation
*/
#if defined(TB_CONFIG_LIBC_HAVE_STRLCPY)
static tb_size_t tb_strlcpy_impl(tb_char_t* s1, tb_char_t const* s2, tb_size_t n)
{
// check
tb_assert_and_check_return_val(s1 && s2, 0);
// copy it
return strlcpy(s1, s2, n);
}
#elif !defined(TB_LIBC_STRING_IMPL_STRLCPY)
/* copy s2 to s1 of size n
*
* - at most n - 1 characters will be copied.
* - always null terminates (unless n == 0).
*
* returns strlen(s2); if retval >= n, truncation occurred.
*/
static tb_size_t tb_strlcpy_impl(tb_char_t* s1, tb_char_t const* s2, tb_size_t n)
{
// check
tb_assert_and_check_return_val(s1 && s2, 0);
// init
tb_char_t* d = s1;
tb_char_t const* s = s2;
tb_size_t m = n;
// copy as many bytes as will fit
if (m != 0 && --m != 0)
{
do
{
if ((*d++ = *s++) == 0) break;
} while (--m != 0);
}
// not enough room in dst, add null and traverse rest of src
if (m == 0)
{
if (n != 0) *d = '\0';
while (*s++) ;
}
// count does not include null
return (s - s2 - 1);
}
#endif
/* //////////////////////////////////////////////////////////////////////////////////////
* interfaces
*/
tb_size_t tb_strlcpy(tb_char_t* s1, tb_char_t const* s2, tb_size_t n)
{
// check
#ifdef __tb_debug__
{
// overflow dst?
tb_size_t n2 = tb_strlen(s2);
// strlcpy overflow?
tb_size_t n1 = tb_pool_data_size(s1);
if (n1 && tb_min(n2 + 1, n) > n1)
{
tb_trace_i("[strlcpy]: [overflow]: [%p, %lu] => [%p, %lu]", s2, tb_min(n2 + 1, n), s1, n1);
tb_backtrace_dump("[strlcpy]: [overflow]: ", tb_null, 10);
tb_pool_data_dump(s2, tb_true, "\t[malloc]: [from]: ");
tb_abort();
}
}
#endif
// done
return tb_strlcpy_impl(s1, s2, n);
}
|
/****************************************************************************
* Copyright 2017 Gorgon Meducer (Email:embedded_zhuoran@hotmail.com) *
* *
* Licensed under the Apache License, Version 2.0 (the "License"); *
* you may not use this file except in compliance with the License. *
* You may obtain a copy of the License at *
* *
* http://www.apache.org/licenses/LICENSE-2.0 *
* *
* Unless required by applicable law or agreed to in writing, software *
* distributed under the License is distributed on an "AS IS" BASIS, *
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
* See the License for the specific language governing permissions and *
* limitations under the License. *
* *
****************************************************************************/
#ifndef __USE_SERVICE_H__
#define __USE_SERVICE_H__
/*============================ INCLUDES ======================================*/
#include ".\app_cfg.h"
#include ".\scheduler\scheduler.h"
#include ".\communication\communication.h"
#include ".\encryption\encryption.h"
#include ".\memory\memory.h"
#include ".\gui\gui.h"
#include ".\time\time.h"
/*============================ MACROS ========================================*/
/*============================ MACROFIED FUNCTIONS ===========================*/
/*============================ TYPES =========================================*/
/*============================ GLOBAL VARIABLES ==============================*/
/*============================ LOCAL VARIABLES ===============================*/
/*============================ PROTOTYPES ====================================*/
/*! \brief initialize all services
*! \param none
*! \retval TRUE initialize services succeed.
*! \retval FALSE initialize services failed.
*/
extern bool service_init(void);
#endif
|
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <errno.h>
#ifndef MATLAB_MEX_FILE
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <netinet/in.h>
#include <netdb.h>
#include <unistd.h>
#include <fcntl.h>
#endif
void udp_emission_init(int port);
void udp_send(char * message, int lg_message);
void udp_send_int32(int32_t value, int8_t command);
void udp_emission_terminate();
void udp_reception_init(int port);
int udp_recv(char * message, int lg_message);
int32_t udp_recv_int32(int8_t command);
void udp_reception_terminate();
|
//
// MeViewController.h
// Lebao
//
// Created by David on 15/12/4.
// Copyright © 2015年 David. All rights reserved.
//
#import "BaseViewController.h"
@interface MeViewController : BaseViewController
@end
typedef NS_ENUM(int,AuthenType) {
AuthenTypeNo =1,
AuthenTypeIng,
AuthenTypeYes,
AuthenTypeOther = 9,
};
@interface MeViewModal : NSObject
@property(nonatomic,strong)NSString *amount;
@property(nonatomic,assign)AuthenType authen;
@property(nonatomic,strong)NSString *imgurl;
@property(nonatomic,strong)NSString *realname;
@property(nonatomic,strong)NSString *rtmsg;
@property(nonatomic,assign)int rtcode;
@property(nonatomic,assign)BOOL newmsg;
@property(nonatomic,strong)NSString *follownum;
@property(nonatomic,strong)NSString *fansnum;
@property(nonatomic,strong)NSString *ID;
@property(nonatomic,strong)NSString *demandline;
@end
|
// 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.
#ifndef FPL_ZOOSHI_COMPONENTS_LAP_DEPENDENT_H_
#define FPL_ZOOSHI_COMPONENTS_LAP_DEPENDENT_H_
#include "components_generated.h"
#include "corgi/component.h"
#include "corgi/entity_manager.h"
namespace fpl {
namespace zooshi {
// Data for lap dependent components.
struct LapDependentData {
LapDependentData() : min_lap(0.0f), max_lap(0.0f), currently_active(false) {}
float min_lap;
float max_lap;
bool currently_active;
};
class LapDependentComponent : public corgi::Component<LapDependentData> {
public:
virtual ~LapDependentComponent() {}
virtual void Init();
virtual void AddFromRawData(corgi::EntityRef& entity, const void* raw_data);
virtual RawDataUniquePtr ExportRawData(const corgi::EntityRef& entity) const;
virtual void InitEntity(corgi::EntityRef& entity);
virtual void UpdateAllEntities(corgi::WorldTime delta_time);
void ActivateAllEntities();
void DeactivateAllEntities();
private:
void ActivateEntity(corgi::EntityRef& entity);
void DeactivateEntity(corgi::EntityRef& entity);
};
} // zooshi
} // fpl
CORGI_REGISTER_COMPONENT(fpl::zooshi::LapDependentComponent,
fpl::zooshi::LapDependentData)
#endif // FPL_ZOOSHI_COMPONENTS_LAP_DEPENDENT_H_
|
/* $NetBSD: convert.c,v 1.2 2011/02/16 03:46:58 christos Exp $ */
/*
* convert.c - convert domain name
*/
/*
* Copyright (c) 2000,2002 Japan Network Information Center.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set forth bellow.
*
* LICENSE TERMS AND CONDITIONS
*
* The following License Terms and Conditions apply, unless a different
* license is obtained from Japan Network Information Center ("JPNIC"),
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
* Chiyoda-ku, Tokyo 101-0047, Japan.
*
* 1. Use, Modification and Redistribution (including distribution of any
* modified or derived work) in source and/or binary forms is permitted
* under this License Terms and Conditions.
*
* 2. Redistribution of source code must retain the copyright notices as they
* appear in each source code file, this License Terms and Conditions.
*
* 3. Redistribution in binary form must reproduce the Copyright Notice,
* this License Terms and Conditions, in the documentation and/or other
* materials provided with the distribution. For the purposes of binary
* distribution the "Copyright Notice" refers to the following language:
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
*
* 4. The name of JPNIC may not be used to endorse or promote products
* derived from this Software without specific prior written approval of
* JPNIC.
*
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
* "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 JPNIC 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 DAMAGES.
*/
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "wrapcommon.h"
/*
* prepare/dispose conversion context
*/
void
idnConvDone(idn_resconf_t ctx)
{
if (ctx != NULL) {
idnLogReset();
idn_resconf_destroy(ctx);
}
}
idn_resconf_t
idnConvInit(void)
{
char encoding[256];
idn_resconf_t ctx;
idn_result_t r;
idnLogReset();
idnLogPrintf(idn_log_level_info, "idnkit version: %-.20s\n",
idn_version_getstring());
/*
* Initialize.
*/
if ((r = idn_resconf_initialize()) != idn_success) {
idnPrintf("idnConvInit: cannot initialize idn library: %s\n",
idn_result_tostring(r));
return NULL;
}
if ((r = idn_resconf_create(&ctx)) != idn_success) {
idnPrintf("idnConvInit: cannot create context: %s\n",
idn_result_tostring(r));
return NULL;
}
/*
* load configuration file.
*/
if ((r = idn_resconf_loadfile(ctx, NULL)) != idn_success) {
idnPrintf("idnConvInit: cannot read configuration file: %s\n",
idn_result_tostring(r));
if ((r = idn_resconf_setdefaults(ctx)) != idn_success) {
idnPrintf("idnConvInit: setting default configuration"
" failed: %s\n",
idn_result_tostring(r));
idnConvDone(ctx);
return (NULL);
}
idnPrintf("idnConvInit: using default configuration\n");
}
/*
* Set local codeset.
*/
if (idnGetPrgEncoding(encoding, sizeof(encoding)) == TRUE) {
idnPrintf("Encoding PRG <%-.100s>\n", encoding);
r = idn_resconf_setlocalconvertername(ctx, encoding,
IDN_CONVERTER_RTCHECK);
if (r != idn_success) {
idnPrintf("idnConvInit: invalid local codeset "
"\"%-.100s\": %s\n",
encoding, idn_result_tostring(r));
idnConvDone(ctx);
return NULL;
}
}
return ctx;
}
/*
* idnConvReq - convert domain name in a DNS request
*
* convert local encoding to DNS encoding
*/
BOOL
idnConvReq(idn_resconf_t ctx, const char FAR *from, char FAR *to, size_t tolen)
{
idn_result_t r;
idnLogReset();
idnLogPrintf(idn_log_level_trace, "idnConvReq(from=%-.100s)\n", from);
if (ctx == NULL) {
idnLogPrintf(idn_log_level_trace, "idnConvReq: ctx is NULL\n");
if (strlen(from) >= tolen)
return FALSE;
strcpy(to, from);
return TRUE;
}
r = idn_res_encodename(ctx, IDN_ENCODE_APP, from, to, tolen);
if (r == idn_success) {
return TRUE;
} else {
return FALSE;
}
}
/*
* idnConvRsp - convert domain name in a DNS response
*
* convert DNS encoding to local encoding
*/
BOOL
idnConvRsp(idn_resconf_t ctx, const char FAR *from, char FAR *to, size_t tolen)
{
idnLogReset();
idnLogPrintf(idn_log_level_trace, "idnConvRsp(from=%-.100s)\n", from);
if (ctx == NULL) {
if (strlen(from) >= tolen)
return FALSE;
strcpy(to, from);
return TRUE;
} else if (idn_res_decodename(ctx, IDN_DECODE_APP,
from, to, tolen) == idn_success) {
return TRUE;
} else {
return FALSE;
}
}
|
//==============================================================================
/*
Software License Agreement (BSD License)
Copyright (c) 2003-2016, CHAI3D.
(www.chai3d.org)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of CHAI3D nor the names of its contributors may
be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
\author <http://www.chai3d.org>
\author Francois Conti
\version 3.2.0 $Rev: 2015 $
*/
//==============================================================================
//------------------------------------------------------------------------------
#ifndef CFileModelSTLH
#define CFileModelSTLH
//------------------------------------------------------------------------------
#include "world/CMultiMesh.h"
#include "PQP/PQP.h"
//------------------------------------------------------------------------------
namespace chai3d {
//------------------------------------------------------------------------------
//==============================================================================
/*!
\file CFileModelSTL.h
\ingroup files
\brief
Implements STL model file support.
*/
//==============================================================================
//------------------------------------------------------------------------------
/*!
\addtogroup files
*/
//------------------------------------------------------------------------------
//@{
//! This function loads an STL model file.
bool cLoadFileSTL(cMultiMesh* a_object, const std::string& a_filename);
//UHAS implemented
//! This function loads an STL model file.
bool cLoadFileSTL2(cMesh* a_object, const std::string& a_filename, PQP_Model &m);
bool cLoadFileSTL2(cMesh* a_object, const std::string& a_filename);
//! This function saves an STL model file.
bool cSaveFileSTL(cMultiMesh* a_object, const std::string& a_filename);
//@}
//------------------------------------------------------------------------------
} // namespace chai3d
//------------------------------------------------------------------------------
#endif
//------------------------------------------------------------------------------
|
/*=========================================================================
Program: Diffusion Applications
Module: $HeadURL: http://svn.slicer.org/Slicer4/trunk/Modules/CLI/ResampleDTIVolume/itkDiffusionTensor3DInterpolateImageFunctionReimplementation.h $
Language: C++
Date: $Date: 2014-09-15 22:57:09 -0400 (Mon, 15 Sep 2014) $
Version: $Revision: 23682 $
Copyright (c) Brigham and Women's Hospital (BWH) All Rights Reserved.
See License.txt or http://www.slicer.org/copyright/copyright.txt for details.
==========================================================================*/
#ifndef __itkDiffusionTensor3DInterpolateImageFunctionReimplementation_h
#define __itkDiffusionTensor3DInterpolateImageFunctionReimplementation_h
#include "itkDiffusionTensor3DInterpolateImageFunction.h"
#include <itkImage.h>
// #include <itkImageRegionIteratorWithIndex.h>
#include <itkInterpolateImageFunction.h>
#include "itkSeparateComponentsOfADiffusionTensorImage.h"
// #include <itkMutexLock.h>
namespace itk
{
/*struct RegionType
{
ImageRegion< 3 > itkRegion ;
bool Done ;
Index< 3 > PositionInImage ;
bool Stop ;
};*/
/**
* \class DiffusionTensor3DInterpolateImageFunctionReimplementation
*
* Abstract class allowing to implement blockwise interpolation for diffusion tensor images
*/
template <class TData, class TCoordRep = double>
class DiffusionTensor3DInterpolateImageFunctionReimplementation :
public DiffusionTensor3DInterpolateImageFunction<TData, TCoordRep>
{
public:
typedef TData DataType;
typedef DiffusionTensor3DInterpolateImageFunctionReimplementation Self;
typedef DiffusionTensor3DInterpolateImageFunction<DataType, TCoordRep> Superclass;
typedef typename Superclass::TensorDataType TensorDataType;
typedef typename Superclass::DiffusionImageType DiffusionImageType;
typedef typename Superclass::DiffusionImageTypePointer DiffusionImageTypePointer;
typedef Image<DataType, 3> ImageType;
typedef typename ImageType::Pointer ImagePointer;
typedef typename Superclass::PointType PointType;
typedef SmartPointer<Self> Pointer;
typedef SmartPointer<const Self> ConstPointer;
typedef ImageRegionIteratorWithIndex<DiffusionImageType> IteratorDiffusionImageType;
typedef ImageRegionIteratorWithIndex<ImageType> IteratorImageType;
typedef InterpolateImageFunction<ImageType, double> InterpolateImageFunctionType;
typedef typename DiffusionImageType::RegionType itkRegionType;
typedef typename DiffusionImageType::SizeType SizeType;
typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
/** Evaluate the interpolated tensor at a position
*/
// TensorDataType Evaluate( const PointType &point ) ;
TensorDataType EvaluateAtContinuousIndex( const ContinuousIndexType & index ) const;
virtual void SetInputImage( const DiffusionImageType *inputImage );
itkSetMacro( NumberOfThreads, int );
protected:
DiffusionTensor3DInterpolateImageFunctionReimplementation();
virtual void AllocateInterpolator() = 0;
// void SeparateImages() ;
// void AllocateImages() ;
// bool DivideRegion( int currentThread ) ;
// int RegionToDivide() ;
typename InterpolateImageFunctionType::Pointer m_Interpol[6];
ImagePointer m_ImageVec[6];
int m_NumberOfThreads;
// Semaphore::Pointer m_Threads ;
// int m_SplitAxis ;
// bool m_SeparationDone ;
// bool m_CannotSplit ;
// MutexLock::Pointer m_Lock ;
// MutexLock::Pointer m_LockNewThreadDetected ;
// std::vector< RegionType > m_ListRegions ;
// int m_NbThread ;
// MutexLock::Pointer m_CheckRegionsDone ;
// bool m_ExceptionThrown ;
// SizeType m_Size ;
// bool m_AllocateInterpolatorsDone ;
};
} // end namespace itk
#ifndef ITK_MANUAL_INSTANTIATION
#include "itkDiffusionTensor3DInterpolateImageFunctionReimplementation.txx"
#endif
#endif
|
#include <stdio.h>
struct print_buf {
char *buf;
size_t size;
};
static void snprint_func(void *arg, char ch) {
struct print_buf *pbuf = arg;
if (pbuf->size < 2) {
/* Reserve last buffer position for the terminating character: */
return;
}
*(pbuf->buf)++ = ch;
pbuf->size--;
}
int snprintf(char *buf, size_t size, const char *cfmt, ...) {
int retval;
va_list ap;
struct print_buf arg;
arg.buf = buf;
arg.size = size;
va_start(ap, cfmt);
retval = kvprintf(&snprint_func, &arg, cfmt, ap);
va_end(ap);
if (arg.size >= 1)
*(arg.buf)++ = 0;
return retval;
}
|
//////////////////////////////////////////////////////////////////////
//
// Material.h - Implementation help for materials
//
// Author: Aravind Krishnaswamy
// Date of Birth: November 19, 2001
// Tabs: 4
// Comments: Changed February 26 / 2002 to support a more robust
// and much cooler material system. Note that our spiffy material
// system is taken from ggLibrary, and *should* be almost totally
// compatible. This was needed to facilitate my research work.
//
// License Information: Please see the attached LICENSE.TXT file
//
//////////////////////////////////////////////////////////////////////
#ifndef MATERIAL_
#define MATERIAL_
#include "../Interfaces/IMaterial.h"
#include "../Interfaces/IPainter.h"
#include "../Utilities/Reference.h"
namespace RISE
{
namespace Implementation
{
class NullMaterial :
public virtual IMaterial,
public virtual Reference
{
public:
inline IBSDF* GetBSDF( ) const { return 0; };
inline ISPF* GetSPF() const { return 0; };
inline IEmitter* GetEmitter() const { return 0; };
};
}
}
#endif
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#pragma once
/**
* This will hold all of our enums and types and such that we need to
* use in multiple files where the enum can't be mapped to a specific file.
*/
#include "DialogueTypes.generated.h"
UENUM()
namespace EGrammaticalGender
{
enum Type
{
Neuter UMETA( DisplayName = "Neuter" ),
Masculine UMETA( DisplayName = "Masculine" ),
Feminine UMETA( DisplayName = "Feminine" ),
Mixed UMETA( DisplayName = "Mixed" ),
};
}
UENUM()
namespace EGrammaticalNumber
{
enum Type
{
Singular UMETA( DisplayName = "Singular" ),
Plural UMETA( DisplayName = "Plural" ),
};
}
class UDialogueVoice;
USTRUCT(BlueprintType)
struct ENGINE_API FDialogueContext
{
GENERATED_USTRUCT_BODY()
FDialogueContext();
/* The person speaking the dialogue. */
UPROPERTY(EditAnywhere, Category=DialogueContext )
UDialogueVoice* Speaker;
/* The people being spoken to. */
UPROPERTY(EditAnywhere, Category=DialogueContext )
TArray<UDialogueVoice*> Targets;
/* Gets a generated key created from the source and targets. */
FString GetLocalizationKey() const;
};
bool operator==(const FDialogueContext& LHS, const FDialogueContext& RHS);
bool operator!=(const FDialogueContext& LHS, const FDialogueContext& RHS);
class UDialogueWave;
USTRUCT()
struct FDialogueWaveParameter
{
GENERATED_USTRUCT_BODY()
FDialogueWaveParameter();
/* The dialogue wave to play. */
UPROPERTY(EditAnywhere, Category=DialogueWaveParameter )
UDialogueWave* DialogueWave;
/* The context to use for the dialogue wave. */
UPROPERTY(EditAnywhere, Category=DialogueWaveParameter )
FDialogueContext Context;
};
UCLASS(abstract)
class UDialogueTypes : public UObject
{
GENERATED_UCLASS_BODY()
};
|
/*
* Copyright 2010-2022 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bx/blob/master/LICENSE
*/
#ifndef BX_FILEPATH_H_HEADER_GUARD
#define BX_FILEPATH_H_HEADER_GUARD
#include "error.h"
#include "string.h"
namespace bx
{
BX_ERROR_RESULT(kErrorAccess, BX_MAKEFOURCC('b', 'x', 1, 1) );
BX_ERROR_RESULT(kErrorNotDirectory, BX_MAKEFOURCC('b', 'x', 1, 2) );
constexpr int32_t kMaxFilePath = 1024;
/// Special predefined OS directories.
///
struct Dir
{
/// Special OS directories:
enum Enum
{
Current, //!< Current directory.
Temp, //!< Temporary directory.
Home, //!< User's home directory.
Count
};
};
/// FilePath parser and helper.
///
/// /abv/gd/555/333/pod.mac
/// ppppppppppppppppbbbeeee
/// ^ ^ ^
/// +-path base-+ +-ext
/// ^^^^^^^
/// +-filename
///
class FilePath
{
public:
/// Default constructor, creates empty file path.
///
FilePath();
/// Construct file path from special OS directory.
///
FilePath(Dir::Enum _dir);
/// Construct file path from C string.
///
FilePath(const char* _str);
/// Construct file path from string.
///
FilePath(const StringView& _str);
/// Assign file path from string.
///
FilePath& operator=(const StringView& _rhs);
/// Clear file path.
///
void clear();
/// Set file path from special OS directory.
///
void set(Dir::Enum _dir);
/// Set file path.
///
void set(const StringView& _str);
/// Join directory to file path.
///
void join(const StringView& _str);
/// Implicitly converts FilePath to StringView.
///
operator StringView() const;
/// Returns zero-terminated C string pointer to file path.
///
const char* getCPtr() const;
/// If path is `/abv/gd/555/333/pod.mac` returns `/abv/gd/555/333/`.
///
StringView getPath() const;
/// If path is `/abv/gd/555/333/pod.mac` returns `pod.mac`.
///
StringView getFileName() const;
/// If path is `/abv/gd/555/333/pod.mac` returns `pod`.
///
StringView getBaseName() const;
/// If path is `/abv/gd/555/333/pod.mac` returns `.mac`.
///
StringView getExt() const;
/// Returns true if file path is absolute.
///
bool isAbsolute() const;
/// Returns true if file path is empty.
///
bool isEmpty() const;
private:
char m_filePath[kMaxFilePath];
};
} // namespace bx
#endif // BX_FILEPATH_H_HEADER_GUARD
|
/*
% Version: v0.9d
% Build: 14061709
% Date: Jun-17 2014, 9:30 AM EST
% Author: Chih-Chung Chang and Chih-Jen Lin, NTU CSIE, Taiwan
% Editor: Jochen Weber, SCAN Unit, Columbia University, NYC, NY, USA
% URL/Info: http://www.csie.ntu.edu.tw/~cjlin/libsvm/
*/
const char *model_to_matlab_structure(mxArray *plhs[], int num_of_feature, struct svm_model *model);
struct svm_model *matlab_matrix_to_model(const mxArray *matlab_struct, const char **error_message);
|
/*
Copyright (c) 2011, Ole K. Christensen
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
¥ Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
¥ Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
#include "BackView.h"
#include "DataView.h"
#include "DataHeaderView.h"
#include "AnalysisState.h"
#include "Move.h"
#include "Search.h"
class GameWindow;
class VariationView : public DataView
{
public:
VariationView (CViewOwner *parent, CRect frame);
virtual void HandleUpdate (CRect updateRect);
virtual void HandleActivate (BOOL wasActivated);
virtual BOOL HandleMouseDown (CPoint pt, INT modifiers, BOOL doubleClick);
virtual void HandleResize (void);
void Reset (void);
void SetMainLine (INT pvNo);
void CalcCoord (void);
private:
void DrawMainLine (INT pvNo); // pvNo: 1 (MainLine) ... maxMultiPV (0 = all)
void DrawMainLine_Vertical (INT pvNo);
void DrawMainLine_Horizontal (INT pvNo);
void DrawVarMove (MOVE *m, CHAR *moveStr);
void DrawScore (INT h, INT v, INT pvNo);
void CalcMultiPVRect (INT pvNo, CRect *r, INT *pvLines);
INT maxLines;
CRect dataRect;
CRect MultiPVRect[uci_MaxMultiPVcount + 1]; // Horizontal MultiPV rects
INT PVLines[uci_MaxMultiPVcount + 1];
GameWindow *win;
ANALYSIS_STATE *Analysis;
};
|
#ifndef seal_quadColours_triangles_h
#define seal_quadColours_triangles_h
#include <OpenGL/OpenGL.h>
class seal_QuadColours_Triangles
{
public:
GLfloat m_rgba[ 24 ];
public:
seal_QuadColours_Triangles( void ){}
seal_QuadColours_Triangles( const GLfloat r, const GLfloat g, const GLfloat b, const GLfloat a )
{
p_Set( r, g, b, a );
}
seal_QuadColours_Triangles( seal_QuadColours_Triangles *p )
{
p_Set( p );
}
void p_Set( const GLfloat r, const GLfloat g, const GLfloat b, const GLfloat a )
{
size_t i = 0;
for( ; i < 24; i += 4 )
{
m_rgba[ i ] = r;
m_rgba[ i + 1 ] = g;
m_rgba[ i + 2 ] = b;
m_rgba[ i + 3 ] = a;
}
}
void p_Set( seal_QuadColours_Triangles *p )
{
size_t i = 0;
for( ; i < 24; i ++ )
m_rgba[ i ] = p->m_rgba[ i ];
}
void p_SetTopLeftCorner( const GLfloat r, const GLfloat g, const GLfloat b, const GLfloat a )
{
m_rgba[ 20 ] = r;
m_rgba[ 21 ] = g;
m_rgba[ 22 ] = b;
m_rgba[ 23 ] = a;
}
void p_SetTopRightCorner( const GLfloat r, const GLfloat g, const GLfloat b, const GLfloat a )
{
m_rgba[ 8 ] = m_rgba[ 16 ] = r;
m_rgba[ 9 ] = m_rgba[ 17 ] = g;
m_rgba[ 10 ] = m_rgba[ 18 ] = b;
m_rgba[ 11 ] = m_rgba[ 19 ] = a;
}
void p_SetBottomRightCorner( const GLfloat r, const GLfloat g, const GLfloat b, const GLfloat a )
{
m_rgba[ 4 ] = r;
m_rgba[ 5 ] = g;
m_rgba[ 6 ] = b;
m_rgba[ 7 ] = a;
}
void p_SetBottomLeftCorner( const GLfloat r, const GLfloat g, const GLfloat b, const GLfloat a )
{
m_rgba[ 0 ] = m_rgba[ 12 ] = r;
m_rgba[ 1 ] = m_rgba[ 13 ] = g;
m_rgba[ 2 ] = m_rgba[ 14 ] = b;
m_rgba[ 3 ] = m_rgba[ 15 ] = a;
}
};
#endif
|
/*********************************************************************************
*
* Inviwo - Interactive Visualization Workshop
*
* Copyright (c) 2012-2021 Inviwo Foundation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*********************************************************************************/
#pragma once
#include <inviwo/qt/editor/inviwoqteditordefine.h>
#include <inviwo/qt/editor/inviwomainwindow.h>
#include <modules/qtwidgets/inviwodockwidget.h>
class QObject;
class QHelpEngineCore;
class QResizeEvent;
namespace inviwo {
class QCHFileObserver;
class HelpBrowser;
class IVW_QTEDITOR_API HelpWidget : public InviwoDockWidget {
public:
HelpWidget(InviwoMainWindow* parent);
virtual ~HelpWidget();
HelpWidget(const HelpWidget&) = delete;
HelpWidget& operator=(const HelpWidget&) = delete;
void showDocForClassName(std::string className);
void registerQCHFiles();
protected:
virtual void resizeEvent(QResizeEvent* event) override;
private:
void updateDoc();
InviwoMainWindow* mainwindow_;
QHelpEngineCore* helpEngine_;
HelpBrowser* helpBrowser_;
std::string requested_;
std::string current_;
std::unique_ptr<QCHFileObserver> fileObserver_;
// Called after modules have been registered
std::shared_ptr<std::function<void()>> onModulesDidRegister_;
// Called before modules have been unregistered
std::shared_ptr<std::function<void()>> onModulesWillUnregister_;
};
} // namespace inviwo
|
/*
* Copyright 2014, NICTA
*
* This software may be distributed and modified according to the terms of
* the BSD 2-Clause license. Note that NO WARRANTY is provided.
* See "LICENSE_BSD2.txt" for details.
*
* @TAG(NICTA_BSD)
*/
struct s {
char c;
int x;
};
char f(struct s *sptr, int byteno)
{
char array[sizeof(struct s)];
for (int i = 0; i < sizeof *sptr; i++)
array[i] = *(((char *)sptr) + i);
return array[byteno];
}
|
/*
* YAFFS: Yet another FFS. A NAND-flash specific file system.
*
* Copyright (C) 2002-2018 Aleph One Ltd.
*
* Created by Timothy Manning <timothy@yaffs.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include "test_yaffs_mount.h"
int test_yaffs_mount(void)
{
int output = 0;
output = yaffs_mount(YAFFS_MOUNT_POINT);
yaffs_mkdir(TEST_DIR,S_IWRITE | S_IREAD);
return output;
}
int test_yaffs_mount_clean(void)
{
return 1;
}
|
/*
+--------------------------------------------------------------------+
| PECL :: http |
+--------------------------------------------------------------------+
| Redistribution and use in source and binary forms, with or without |
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
| Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
#include "php_http_api.h"
ZEND_BEGIN_ARG_INFO_EX(ai_HttpClientResponse_getCookies, 0, 0, 0)
ZEND_ARG_INFO(0, flags)
ZEND_ARG_INFO(0, allowed_extras)
ZEND_END_ARG_INFO();
static PHP_METHOD(HttpClientResponse, getCookies)
{
long flags = 0;
zval *allowed_extras_array = NULL;
int i = 0;
char **allowed_extras = NULL;
zval *header = NULL, **entry = NULL;
HashPosition pos;
php_http_message_object_t *msg;
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|la!", &flags, &allowed_extras_array)) {
return;
}
msg = zend_object_store_get_object(getThis() TSRMLS_CC);
array_init(return_value);
if (allowed_extras_array) {
allowed_extras = ecalloc(zend_hash_num_elements(Z_ARRVAL_P(allowed_extras_array)) + 1, sizeof(char *));
FOREACH_VAL(pos, allowed_extras_array, entry) {
zval *data = php_http_ztyp(IS_STRING, *entry);
allowed_extras[i++] = estrndup(Z_STRVAL_P(data), Z_STRLEN_P(data));
zval_ptr_dtor(&data);
}
}
if ((header = php_http_message_header(msg->message, ZEND_STRL("Set-Cookie"), 0))) {
php_http_cookie_list_t *list;
if (Z_TYPE_P(header) == IS_ARRAY) {
zval **single_header;
FOREACH_VAL(pos, header, single_header) {
zval *data = php_http_ztyp(IS_STRING, *single_header);
if ((list = php_http_cookie_list_parse(NULL, Z_STRVAL_P(data), Z_STRLEN_P(data), flags, allowed_extras TSRMLS_CC))) {
zval *cookie;
MAKE_STD_ZVAL(cookie);
ZVAL_OBJVAL(cookie, php_http_cookie_object_new_ex(php_http_cookie_class_entry, list, NULL TSRMLS_CC), 0);
add_next_index_zval(return_value, cookie);
}
zval_ptr_dtor(&data);
}
} else {
zval *data = php_http_ztyp(IS_STRING, header);
if ((list = php_http_cookie_list_parse(NULL, Z_STRVAL_P(data), Z_STRLEN_P(data), flags, allowed_extras TSRMLS_CC))) {
zval *cookie;
MAKE_STD_ZVAL(cookie);
ZVAL_OBJVAL(cookie, php_http_cookie_object_new_ex(php_http_cookie_class_entry, list, NULL TSRMLS_CC), 0);
add_next_index_zval(return_value, cookie);
}
zval_ptr_dtor(&data);
}
zval_ptr_dtor(&header);
}
if (allowed_extras) {
for (i = 0; allowed_extras[i]; ++i) {
efree(allowed_extras[i]);
}
efree(allowed_extras);
}
}
ZEND_BEGIN_ARG_INFO_EX(ai_HttpClientResponse_getTransferInfo, 0, 0, 0)
ZEND_ARG_INFO(0, element)
ZEND_END_ARG_INFO();
static PHP_METHOD(HttpClientResponse, getTransferInfo)
{
char *info_name = NULL;
int info_len = 0;
zval *info;
php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &info_name, &info_len), invalid_arg, return);
info = zend_read_property(php_http_client_response_class_entry, getThis(), ZEND_STRL("transferInfo"), 0 TSRMLS_CC);
/* request completed? */
if (Z_TYPE_P(info) != IS_OBJECT) {
php_http_throw(bad_method_call, "Incomplete state", NULL);
return;
}
if (info_len && info_name) {
info = zend_read_property(NULL, info, php_http_pretty_key(info_name, info_len, 0, 0), info_len, 0 TSRMLS_CC);
if (!info) {
php_http_throw(unexpected_val, "Could not find transfer info with name '%s'", info_name);
return;
}
}
RETURN_ZVAL(info, 1, 0);
}
static zend_function_entry php_http_client_response_methods[] = {
PHP_ME(HttpClientResponse, getCookies, ai_HttpClientResponse_getCookies, ZEND_ACC_PUBLIC)
PHP_ME(HttpClientResponse, getTransferInfo, ai_HttpClientResponse_getTransferInfo, ZEND_ACC_PUBLIC)
EMPTY_FUNCTION_ENTRY
};
zend_class_entry *php_http_client_response_class_entry;
PHP_MINIT_FUNCTION(http_client_response)
{
zend_class_entry ce = {0};
INIT_NS_CLASS_ENTRY(ce, "http\\Client", "Response", php_http_client_response_methods);
php_http_client_response_class_entry = zend_register_internal_class_ex(&ce, php_http_message_class_entry, NULL TSRMLS_CC);
zend_declare_property_null(php_http_client_response_class_entry, ZEND_STRL("transferInfo"), ZEND_ACC_PROTECTED TSRMLS_CC);
return SUCCESS;
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/
|
//=================================================================================================
/*!
// \file blaze/math/Functors.h
// \brief Header file for all functors
//
// Copyright (C) 2012-2017 Klaus Iglberger - All Rights Reserved
//
// This file is part of the Blaze library. You can redistribute it and/or modify it under
// the terms of the New (Revised) BSD License. Redistribution and use in source and binary
// forms, with or without modification, are permitted provided that the following conditions
// are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other materials
// provided with the distribution.
// 3. Neither the names of the Blaze development group nor the names of its contributors
// may be used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
// SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
// DAMAGE.
*/
//=================================================================================================
#ifndef _BLAZE_MATH_FUNCTORS_H_
#define _BLAZE_MATH_FUNCTORS_H_
//*************************************************************************************************
// Includes
//*************************************************************************************************
#include <blaze/math/functors/Abs.h>
#include <blaze/math/functors/Acos.h>
#include <blaze/math/functors/Acosh.h>
#include <blaze/math/functors/Asin.h>
#include <blaze/math/functors/Asinh.h>
#include <blaze/math/functors/Atan.h>
#include <blaze/math/functors/Atanh.h>
#include <blaze/math/functors/Cbrt.h>
#include <blaze/math/functors/Ceil.h>
#include <blaze/math/functors/Clamp.h>
#include <blaze/math/functors/Conj.h>
#include <blaze/math/functors/Cos.h>
#include <blaze/math/functors/Cosh.h>
#include <blaze/math/functors/CTrans.h>
#include <blaze/math/functors/DeclDiag.h>
#include <blaze/math/functors/DeclHerm.h>
#include <blaze/math/functors/DeclId.h>
#include <blaze/math/functors/DeclLow.h>
#include <blaze/math/functors/DeclSym.h>
#include <blaze/math/functors/DeclUpp.h>
#include <blaze/math/functors/Erf.h>
#include <blaze/math/functors/Erfc.h>
#include <blaze/math/functors/Eval.h>
#include <blaze/math/functors/Exp.h>
#include <blaze/math/functors/Exp2.h>
#include <blaze/math/functors/Exp10.h>
#include <blaze/math/functors/Floor.h>
#include <blaze/math/functors/Imag.h>
#include <blaze/math/functors/Inv.h>
#include <blaze/math/functors/InvCbrt.h>
#include <blaze/math/functors/InvSqrt.h>
#include <blaze/math/functors/Log.h>
#include <blaze/math/functors/Log2.h>
#include <blaze/math/functors/Log10.h>
#include <blaze/math/functors/Max.h>
#include <blaze/math/functors/Min.h>
#include <blaze/math/functors/Noop.h>
#include <blaze/math/functors/Pow.h>
#include <blaze/math/functors/Real.h>
#include <blaze/math/functors/Round.h>
#include <blaze/math/functors/Serial.h>
#include <blaze/math/functors/Sin.h>
#include <blaze/math/functors/Sinh.h>
#include <blaze/math/functors/Sqrt.h>
#include <blaze/math/functors/Tan.h>
#include <blaze/math/functors/Tanh.h>
#include <blaze/math/functors/Trans.h>
#include <blaze/math/functors/Trunc.h>
#endif
|
/* lens_quantile.c
Marina C., 19 Feb 2018
FreeBSD-style copyright and disclaimer apply
*/
// -----------------------------------------------------------------------------
// struct
// -----------------------------------------------------------------------------
struct optics_packed lens_quantile
{
double target_quantile;
double original_estimate;
double adjustment_value;
atomic_int_fast64_t multiplier;
atomic_int_fast64_t count[2];
};
// -----------------------------------------------------------------------------
// impl
// -----------------------------------------------------------------------------
static struct lens *
lens_quantile_alloc(
struct optics *optics,
const char *name,
double target_quantile,
double original_estimate,
double adjustment_value)
{
struct lens *lens = lens_alloc(optics, optics_quantile, sizeof(struct lens_quantile), name);
if (!lens) goto fail_alloc;
struct lens_quantile *quantile = lens_sub_ptr(lens, optics_quantile);
if (!quantile) goto fail_sub;
quantile->target_quantile = target_quantile;
quantile->original_estimate = original_estimate;
quantile->adjustment_value = adjustment_value;
return lens;
fail_sub:
lens_free(optics, lens);
fail_alloc:
return NULL;
}
static double calculate_quantile(struct lens_quantile *quantile)
{
double adjustment =
atomic_load_explicit(&quantile->multiplier, memory_order_relaxed) *
quantile->adjustment_value;
return quantile->original_estimate + adjustment;
}
static bool
lens_quantile_update(struct optics_lens *lens, optics_epoch_t epoch, double value)
{
struct lens_quantile *quantile = lens_sub_ptr(lens->lens, optics_quantile);
if (!quantile) return false;
double current_estimate = calculate_quantile(quantile);
bool probability_check = rng_gen_prob(rng_global(), quantile->target_quantile);
if (value < current_estimate) {
if (!probability_check)
atomic_fetch_sub_explicit(&quantile->multiplier, 1, memory_order_relaxed);
}
else {
if (probability_check)
atomic_fetch_add_explicit(&quantile->multiplier, 1, memory_order_relaxed);
}
// Since we don't care too much how exact the count is (not used to modify
// our estimates) then the write ordering doesn't matter so relaxed is fine.
atomic_fetch_add_explicit(&quantile->count[epoch], 1, memory_order_relaxed);
return true;
}
static enum optics_ret
lens_quantile_read(
struct optics_lens *lens, optics_epoch_t epoch, struct optics_quantile *value)
{
struct lens_quantile *quantile = lens_sub_ptr(lens->lens, optics_quantile);
if (!quantile) return optics_err;
double sample = calculate_quantile(quantile);
size_t count = atomic_exchange_explicit(&quantile->count[epoch], 0, memory_order_relaxed);
if (!value->quantile) {
value->quantile = quantile->target_quantile;
value->sample = sample;
value->sample_count = value->count = count;
return optics_ok;
}
else if (value->quantile != quantile->target_quantile) return optics_err;
/* We basically have no good option for merging here which means that we
have to somehow find the most representative sample without knowing how
many samples we'll end up seeing.
The reasoning behind our current (probably terrible) approach:
1) Averaging quantiles is bad because it reintroduces the biases of large
extremum values. You end up with the worst of both mesuring methods.
2) If we have to pick one of the samples we see then ideally we want to
introduce some randomness to make sure that all the values we see have a
fair chance of being represented. This avoids bias that could be
introduced by one the value sources consistently having a slightly higher
sampling count with a skewed sample.
3) Should weight for the number of samples being represented. A sample
that represents a million values should take precendence over one that
represents ten as it's more likely to be accurate.
4) Probability should be skewed in favour of the quantile being
estimated. If we're estimating the 90th quantile on even sample counts
then the larger value is more likely to represent to true 90th quantile
so we should skew in its favour. If we're estimating the median than we
can't do better then 50/50.
5) Sample count should weight more heavily then the quantile value
as the larger sample count should be more representative.
*/
bool pick = false;
double delta = count > value->sample_count ?
count - value->sample_count : value->sample_count - count;
// If there's a large difference in sample count then prefer the larger sample.
if (rng_gen_prob(rng_global(), delta / (count + value->sample_count)))
pick = count >= value->sample_count;
// Otherwise sample based on quantile probability
else if (sample > value->sample)
pick = rng_gen_prob(rng_global(), quantile->target_quantile);
else
pick = rng_gen_prob(rng_global(), 1.0 - quantile->target_quantile);
if (pick) {
value->sample = sample;
value->sample_count = count;
}
value->count += count;
return optics_ok;
}
static bool
lens_quantile_normalize(
const struct optics_poll *poll, optics_normalize_cb_t cb, void *ctx)
{
return cb(ctx, poll->ts, poll->key, poll->value.quantile.sample);
}
|
//
// pso.h
// psobase
//
// Copyright (c) 2011, Jianhua Zhang
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this
// list of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
// SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
// OF SUCH DAMAGE.
#ifndef psobase_pso_h
#define psobase_pso_h
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include "defines.h"
// 适应值函数指针类型
// 参数:问题维数和粒子向量
typedef double (*FITNESS_FUN)(int dimense, double * fitness_fun, void * fitness_data);
typedef struct in_para_pso {
// para c1
double c1;
// para c2
double c2;
// dimense: 问题维数
int dimense;
// pop_number: 种群规模
int pop_number;
// max_gen: 最大进化代数
int max_gen;
// max_no_improve: 最大无进化代数
int max_no_improve;
// max_no_improve_stop: 最大无进化代数达到后是否进化停止
int max_no_improve_stop; //1: 达到后停止;0: 达到后变异种群
// val_max: 各维取值的最大值. TODO:如果希望各维取值范围不同, 将此项改为double数组并修改相应条件判断代码
double val_max;
// val_min: 各维取值的最小值. TODO:如果希望各维取值范围不同, 将此项改为double数组并修改相应条件判断代码
double val_min;
// spd_max: 最大速度. TODO:如果希望各维最大速度不同, 将此项改为double数组并修改相应条件判断代码
double spd_max;
// fitness_fun: 适应值函数
FITNESS_FUN fitness_fun;
// 适应值函数所需用到的数据
void * fitness_data;
// 是否使用结束条件
int use_break_condition;
// 结束条件,fitness小于这个值阶数进化迭代
double break_condition;
}IN_PARA_PSO;
typedef struct out_para_pso {
// 问题维数,主要用于确定best_position数组的大小
int dimense;
// 最优适应值
double best_fitness;
// 最优适应值对应的粒子
double * best_particle;
}OUT_PARA_PSO;
EXPORT void begin_pso();
EXPORT int pso(IN_PARA_PSO in_para, OUT_PARA_PSO** result);
EXPORT void end_pso(OUT_PARA_PSO * rst);
#ifdef DEBUG
EXPORT
#endif
double* init_popular(int dimense, int pop_number, double val_max, double val_min);
#ifdef DEBUG
EXPORT
#endif
double* init_speed(int is_zero, int dimense, int pop_number, double spd_max);
#ifdef DEBUG
EXPORT
#endif
double get_min(int num, double * arrays);
#ifdef DEBUG
EXPORT
#endif
double get_wight(int current_gen,int max_gen);
////////////////////////////////////////////////////////////////////////
// DEBUG
void print_popular(int dimense, int pop_number, double * popular, double * speed);
void print_fitness(int pop_number, double * fitness);
#endif
|
/*
INVERSÃO. Escreva uma função que inverta a ordem
das células de uma lista encadeada (a primeira passa a
ser a última, a segunda passa a ser a penúltima etc.).
Faça isso sem criar novas células; apenas altera os
ponteiros.
*/
#include <stdio.h>
#include <stdlib.h>
typedef struct cell{
int conteudo;
struct cell * proximo;
}CELULA;
void
insere(CELULA * celula, int conteudo){
CELULA * nova = malloc(sizeof(CELULA));
nova -> conteudo = conteudo;
nova -> proximo = celula -> proximo;
celula -> proximo = nova;
}
void
inverte(CELULA * celula){
CELULA * atual, * proximo, * temp;
atual = celula;
proximo = celula -> proximo;
while(proximo != NULL){
temp = proximo -> proximo;
proximo -> proximo = atual;
atual = proximo;
proximo = temp;
}
celula -> proximo -> proximo = NULL;
celula -> proximo = atual;
}
void
exibe(CELULA * celula){
CELULA * p = celula -> proximo;
while(p != NULL){
printf(" %d ", p -> conteudo);
p = p -> proximo;
}
printf("\n");
}
void
main(void){
CELULA * cabeca = malloc(sizeof(CELULA));
cabeca -> proximo = NULL;
for(int i = 0; i < 10; i++)
insere(cabeca, i * 10);
printf("Antes de inverter\n");
exibe(cabeca);
printf("Depois de inverter\n");
inverte(cabeca);
exibe(cabeca);
}
|
/*
+------------------------------------------------------------------------+
| Phalcon Framework |
+------------------------------------------------------------------------+
| Copyright (c) 2011-2014 Phalcon Team (http://www.phalconphp.com) |
+------------------------------------------------------------------------+
| This source file is subject to the New BSD License that is bundled |
| with this package in the file docs/LICENSE.txt. |
| |
| If you did not receive a copy of the license and are unable to |
| obtain it through the world-wide-web, please send an email |
| to license@phalconphp.com so we can send you a copy immediately. |
+------------------------------------------------------------------------+
| Authors: Andres Gutierrez <andres@phalconphp.com> |
| Eduar Carvajal <eduar@phalconphp.com> |
+------------------------------------------------------------------------+
*/
#ifndef PHALCON_FORMS_ELEMENT_SUBMIT_H
#define PHALCON_FORMS_ELEMENT_SUBMIT_H
#include "php_phalcon.h"
extern zend_class_entry *phalcon_forms_element_submit_ce;
PHALCON_INIT_CLASS(Phalcon_Forms_Element_Submit);
#endif /* PHALCON_FORMS_ELEMENT_SUBMIT_H */
|
//
// AppDelegate.h
// PhotoBroswer
//
// Created by FelixYin on 15/8/5.
// Copyright © 2015年 felixios. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
/*
* Copyright 2017 Two Pore Guys, Inc.
* All rights reserved
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted providing that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE 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.
*
*/
/**
* @example fd-transport.c
*
* An example that shows how to use file descriptor (fd) transport.
*/
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <glib.h>
#include <sys/socket.h>
#include <rpc/object.h>
#include <rpc/client.h>
#include <rpc/server.h>
#include <rpc/service.h>
int
main(int argc, const char *argv[])
{
rpc_context_t ctx;
rpc_server_t server;
rpc_client_t client;
rpc_connection_t conn;
rpc_object_t result;
int fd[2];
if (socketpair(AF_UNIX, SOCK_STREAM, 0, fd) != 0) {
fprintf(stderr, "socketpair() failed: %s", strerror(errno));
return (EXIT_FAILURE);
}
ctx = rpc_context_create();
rpc_context_register_block(ctx, NULL, "hello", NULL,
^(void *cookie, rpc_object_t args) {
return rpc_string_create("world");
});
server = rpc_server_create("fd://", ctx);
if (server == NULL) {
fprintf(stderr, "cannot create server: %s", strerror(errno));
return (1);
}
client = rpc_client_create(g_strdup_printf("fd://%d", fd[1]), NULL);
if (client == NULL) {
fprintf(stderr, "cannot connect: %s", strerror(errno));
return (1);
}
rpc_server_resume(server);
conn = rpc_client_get_connection(client);
result = rpc_connection_call_simple(conn, "hello", "[s]", "world");
printf("result = %s\n", rpc_string_get_string_ptr(result));
rpc_client_close(client);
rpc_server_close(server);
return (0);
}
|
//
// NWLAppDelegate.h
// NWLoggingCocoaDemo
//
// Copyright (c) 2012 noodlewerk. All rights reserved.
//
@interface NWLAppDelegate : NSObject <NSApplicationDelegate>
@property (assign) IBOutlet NSWindow *window;
@end
|
/*
* Generated by asn1c-0.9.23 (http://lionet.info/asn1c)
* From ASN.1 module "CDR"
* found in "../cdr.asn1"
* `asn1c -fskeletons-copy -fnative-types`
*/
#include "AddressString.h"
int
AddressString_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr;
size_t size;
if(!sptr) {
_ASN_CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
size = st->size;
if((size >= 1 && size <= 20)) {
/* Constraint check succeeded */
return 0;
} else {
_ASN_CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
}
/*
* This type is implemented using OCTET_STRING,
* so here we adjust the DEF accordingly.
*/
static void
AddressString_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
td->free_struct = asn_DEF_OCTET_STRING.free_struct;
td->print_struct = asn_DEF_OCTET_STRING.print_struct;
td->ber_decoder = asn_DEF_OCTET_STRING.ber_decoder;
td->der_encoder = asn_DEF_OCTET_STRING.der_encoder;
td->xer_decoder = asn_DEF_OCTET_STRING.xer_decoder;
td->xer_encoder = asn_DEF_OCTET_STRING.xer_encoder;
td->uper_decoder = asn_DEF_OCTET_STRING.uper_decoder;
td->uper_encoder = asn_DEF_OCTET_STRING.uper_encoder;
if(!td->per_constraints)
td->per_constraints = asn_DEF_OCTET_STRING.per_constraints;
td->elements = asn_DEF_OCTET_STRING.elements;
td->elements_count = asn_DEF_OCTET_STRING.elements_count;
td->specifics = asn_DEF_OCTET_STRING.specifics;
}
void
AddressString_free(asn_TYPE_descriptor_t *td,
void *struct_ptr, int contents_only) {
AddressString_1_inherit_TYPE_descriptor(td);
td->free_struct(td, struct_ptr, contents_only);
}
int
AddressString_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
AddressString_1_inherit_TYPE_descriptor(td);
return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}
asn_dec_rval_t
AddressString_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, const void *bufptr, size_t size, int tag_mode) {
AddressString_1_inherit_TYPE_descriptor(td);
return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
}
asn_enc_rval_t
AddressString_encode_der(asn_TYPE_descriptor_t *td,
void *structure, int tag_mode, ber_tlv_tag_t tag,
asn_app_consume_bytes_f *cb, void *app_key) {
AddressString_1_inherit_TYPE_descriptor(td);
return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
}
asn_dec_rval_t
AddressString_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, const char *opt_mname, const void *bufptr, size_t size) {
AddressString_1_inherit_TYPE_descriptor(td);
return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
}
asn_enc_rval_t
AddressString_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
int ilevel, enum xer_encoder_flags_e flags,
asn_app_consume_bytes_f *cb, void *app_key) {
AddressString_1_inherit_TYPE_descriptor(td);
return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
}
static ber_tlv_tag_t asn_DEF_AddressString_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (4 << 2))
};
asn_TYPE_descriptor_t asn_DEF_AddressString = {
"AddressString",
"AddressString",
AddressString_free,
AddressString_print,
AddressString_constraint,
AddressString_decode_ber,
AddressString_encode_der,
AddressString_decode_xer,
AddressString_encode_xer,
0, 0, /* No PER support, use "-gen-PER" to enable */
0, /* Use generic outmost tag fetcher */
asn_DEF_AddressString_tags_1,
sizeof(asn_DEF_AddressString_tags_1)
/sizeof(asn_DEF_AddressString_tags_1[0]), /* 1 */
asn_DEF_AddressString_tags_1, /* Same as above */
sizeof(asn_DEF_AddressString_tags_1)
/sizeof(asn_DEF_AddressString_tags_1[0]), /* 1 */
0, /* No PER visible constraints */
0, 0, /* No members */
0 /* No specifics */
};
|
#if defined(__cplusplus)
} /* extern "C" */
#endif /* defined(__cplusplus) */
#endif /* BEE_MODULE_H_INCLUDED */
|
/*
*@brief RDTSC implementation
*
*@date 22.10.2013
*
*
*/
#include <stdint.h>
#include <lib/libcpu_info.h>
uint64_t get_cpu_counter(void) {
uint32_t hi = 0, lo = 0;
asm volatile ( "rdtsc\n\t"
"movl %%eax, %0\n\t"
"movl %%edx, %1\n\t" :
"=r"(lo), "=r"(hi) :);
return (((uint64_t) hi) << 32) + lo;
}
|
#ifndef STRINGUTIL_H
#define STRINGUTIL_H
#include "common.h"
#include "Win32Util.h"
#include <string>
#include <limits>
#include <Windows.h>
/**
* Typedef for unicode/non-unicode strings
* equivalent of TCHAR for stl strings
* @author Cookiemon
*/
typedef std::basic_string<TCHAR> tstring;
/**
* Does a case insensitive comparison of two characters
* @author Cookiemon
*/
class CompareTolower
{
public:
/**
* Compares the lowercase version of both characters
* @author Cookiemon
* @param left A character
* @param right A character
* @return true iff lowercase version of both characters are equal,
*/
bool operator() (const char left, const char right)
{
return tolower(left) == tolower(right);
}
};
/**
* Checks if a string starts with a specified sequence
* Does case insensitive comparison
* @author Cookiemon
* @param left String whose start is checked
* @param right Start sequence that is checked for
* @return true iff left starts with right as a sequence
*/
inline bool StrStartsWithLC(const std::string& str, const std::string& with)
{
if(str.length() < with.length())
return false;
return std::equal(with.begin(), with.end(), str.begin(), CompareTolower());
}
inline bool StrStartsWithLC(const char* str, const char* with)
{
CompareTolower cmp;
while(str != '\0' && with != '\0' && cmp(*str, *with))
{
str += 1;
with += 1;
}
return *with == '\0';
}
inline bool StrStartsWith(const char* str, const char* with)
{
while(*str != '\0' && *with != '\0' && *str == *with)
{
str += 1;
with += 1;
}
return *with == '\0';
}
/**
* Checks if a given character is space
* introduced because char is signed by default
* and isspace casts them internally to unsigned
* which produces values > 256
* Also isspace uses locales
* @author Cookiemon
* @param c Character to check
*/
inline bool CharIsSpace(char c)
{
return c == 0x20 || (0x09 <= c && c <= 0x0D);
}
/**
* Removes whitespaces from the beginning of a string
* @author Cookiemon
* @param str String from which the whitespaces are removed
*/
inline void TrimLeft(std::string& str)
{
str.erase(str.begin(), std::find_if_not(str.begin(), str.end(), &CharIsSpace));
}
/**
* Removes whitespaces from the end of a string
* @author Cookiemon
* @param str String from which the whitespaces are removed
*/
inline void TrimRight(std::string& str)
{
str.erase(std::find_if_not(str.rbegin(), str.rend(), &CharIsSpace).base(), str.end());
}
/**
* Removes whitespaces from the beginning and end of a string
* @author Cookiemon
* @param str String from which the whitespaces are removed
*/
inline void Trim(std::string& str)
{
TrimRight(str);
TrimLeft(str);
}
/**
* Converts a wide string to UTF-8
* @author Cookiemon
* @param str String to convert
*/
inline void ToUtf8(const std::wstring& str, std::string& out)
{
size_t numChars = WideCharToMultiByte(CP_UTF8, 0, str.c_str(), -1, NULL, 0, NULL, NULL);
if(numChars == 0)
throw Win32Exception();
char* outBuf = new char[numChars];
numChars = WideCharToMultiByte(CP_UTF8, 0, str.c_str(), -1, outBuf, numChars, NULL, NULL);
if(numChars == 0)
{
delete[] outBuf;
throw Win32Exception();
}
out = outBuf;
delete[] outBuf;
}
/**
* Converts a wide string to UTF-8
* @author Cookiemon
* @param str String to convert
* @tparam T type of string to convert to (default: pfc::string8)
*/
template<typename T>
T ToUtf8(const std::wstring& str)
{
size_t numChars = WideCharToMultiByte(CP_UTF8, 0, str.c_str(), -1, NULL, 0, NULL, NULL);
if(numChars == 0)
throw Win32Exception();
std::vector<char> outBuf(numChars);
numChars = WideCharToMultiByte(CP_UTF8, 0, str.c_str(), -1, &outBuf[0], numChars, NULL, NULL);
if(numChars == 0)
throw Win32Exception();
return T(&outBuf[0]);
}
/**
* Converts a UTF-8 string to wide char
* @author Cookiemon
* @param str String to convert
*/
inline std::wstring ToWChar(const char* str)
{
size_t numChars = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0);
if(numChars == 0)
throw Win32Exception();
std::vector<WCHAR> outBuf(numChars);
numChars = MultiByteToWideChar(CP_UTF8, 0, str, -1, &outBuf[0], numChars);
if(numChars == 0)
throw Win32Exception();
return std::wstring(outBuf.begin(), outBuf.end());
}
/**
* Converts a UTF-8 string to wide char
* @author Cookiemon
* @param str String to convert
*/
inline std::wstring ToWChar(const std::string& str)
{
return ToWChar(str.c_str());
}
/**
* Returns if a name is contained in a path by TODO
*/
bool PathStartsWith(const std::string& path, std::string with)
{
if(path.size() > with.size() && !with.empty())
return StrStartsWithLC(path, with + "\\");
else
return StrStartsWithLC(path, with);
}
/**
* Returns if a name is contained in a path by TODO
*/
bool PathStartsWith(const pfc::string_base& path, pfc::string8 with)
{
if(path.get_length() > with.get_length() && !with.is_empty())
with.add_char('\\');
return StrStartsWithLC(path, with);
}
pfc::string8 ConcatenateFolder(pfc::string8 base, const pfc::string8& toAdd)
{
if(!base.is_empty() && !toAdd.is_empty() && !base.ends_with('\\'))
base.add_char('\\');
base.add_string(toAdd);
return base;
}
#endif
|
/***************************************************************************/
/* */
/* ftxf86.c */
/* */
/* FreeType utility file for X11 support (body). */
/* */
/* Copyright 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#include <plugin/FT_fontsys/ft2build.h>
#include FT_XFREE86_H
#include FT_INTERNAL_OBJECTS_H
#include FT_SERVICE_XFREE86_NAME_H
/* documentation is in ftxf86.h */
FT_EXPORT_DEF( const char* )
FT_Get_X11_Font_Format( FT_Face face )
{
const char* result = NULL;
if ( face )
FT_FACE_FIND_SERVICE( face, result, XF86_NAME );
return result;
}
/* END */
|
/* DO NOT EDIT MANUALLY!!!
This file was generated by CIDL.
Copyright 2014, NICTA
This software may be distributed and modified according to the terms of
the BSD 2-Clause license. Note that NO WARRANTY is provided.
See "LICENSE_BSD2.txt" for details.
@TAG(NICTA_BSD)
*/
// DO NOT EDIT MANUALLY!!!
// This file was generated by CIDL - Simple C IDL Compiler.
#include <refos-rpc/rpc.h>
#include <refos-rpc/serv_server.h>
#include <refos/refos.h>
#include <refos/vmlayout.h>
int rpc_sv_serv_dispatcher(void *rpc_userptr, uint32_t label) {
switch (label) {
case RPC_SERV_CONNECT_DIRECT:
assert(serv_connect_direct_handler);
server_serv_connect_direct(rpc_userptr);
break;
case RPC_SERV_PING:
assert(serv_ping_handler);
server_serv_ping(rpc_userptr);
break;
case RPC_SERV_SET_PARAM_BUFFER:
assert(serv_set_param_buffer_handler);
server_serv_set_param_buffer(rpc_userptr);
break;
case RPC_SERV_DISCONNECT_DIRECT:
assert(serv_disconnect_direct_handler);
server_serv_disconnect_direct(rpc_userptr);
break;
default:
return -1;
}
return 0;
}
|
/*
*****************************************************************************
* @file mcu_config.h
* @author Y3288231
* @date jan 15, 2014
* @brief Hardware abstraction for communication
*****************************************************************************
*/
#ifndef STM32F4_CONFIG_H_
#define STM32F4_CONFIG_H_
#include "stm32f3xx_hal.h"
#include "stm32f3xx_nucleo.h"
#include "firmware_version.h"
//#include "usb_device.h"
#include "math.h"
#include "err_list.h"
#define IDN_STRING "STM32F303-Nucleo" //max 30 chars
#define MCU "STM32F303RE"
// Communication constatnts ===================================================
#define COMM_BUFFER_SIZE 512
#define UART_SPEED 115200
#define USART_GPIO GPIOA
#define USART_TX GPIO_PIN_2
#define USART_RX GPIO_PIN_3
#define USART_TX_PIN_STR "PA2_" //must be 4 chars
#define USART_RX_PIN_STR "PA3_" //must be 4 chars
#define USB_DP_PIN_STR "PA12" //must be 4 chars
#define USB_DM_PIN_STR "PA11" //must be 4 chars
// Scope constatnts ===================================================
#define MAX_SAMPLING_FREQ 5000000 //smps
#define MAX_ADC_CHANNELS 4
#define MAX_SCOPE_BUFF_SIZE 50000 //in bytes
#define SCOPE_BUFFER_MARGIN 100
#define SCOPE_CH1_PIN_STR "A5__" //must be 4 chars
#define SCOPE_CH2_PIN_STR "A4__" //must be 4 chars
#define SCOPE_CH3_PIN_STR "A3__" //must be 4 chars
#define SCOPE_CH4_PIN_STR "PB14" //must be 4 chars
#define SCOPE_VREF 3300
#define RANGE_1_LOW 0
#define RANGE_1_HI SCOPE_VREF
#define RANGE_2_LOW -SCOPE_VREF
#define RANGE_2_HI SCOPE_VREF*2
#define RANGE_3_LOW 0
#define RANGE_3_HI 0
#define RANGE_4_LOW 0
#define RANGE_4_HI 0
#define MAX_GENERATING_FREQ 2000000 //smps
#define MAX_DAC_CHANNELS 2
#define MAX_GENERATOR_BUFF_SIZE 2000
#define DAC_DATA_DEPTH 12
#define GEN_VREF 3300
#define GEN_CH1_PIN_STR "A2__" //must be 4 chars
#define GEN_CH2_PIN_STR "D13_" //must be 4 chars
#endif /* STM32F4_CONFIG_H_ */
|
/* { dg-do run } */
int main ()
{
unsigned long long a;
if (! (a = 0xfedcba9876543210ULL))
abort ();
exit (0);
}
|
/*
Copyright (c) 1996 Blake McBride
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "generics.h"
int main(int argc, char *argv[])
{
object obj1, obj2;
InitDynace(&argc);
/* Create two instances of the Class1 class. */
obj1 = gNew(Class1);
obj2 = gNew(Class1);
/* Set each instance to a different name. */
gSetName(obj1, "Object One");
gSetName(obj2, "Object Two");
/* Display the independent values associated with each instance. */
printf("obj1's name is %s\n", gGetName(obj1));
printf("obj2's name is %s\n", gGetName(obj2));
gDispose(obj1);
gDispose(obj2);
return 0;
}
|
#ifndef __MONO_NATIVE_MSCORLIB_SYSTEM_RUNTIME_INTEROPSERVICES_COMTYPES_BIND_OPTS_H
#define __MONO_NATIVE_MSCORLIB_SYSTEM_RUNTIME_INTEROPSERVICES_COMTYPES_BIND_OPTS_H
#include <mscorlib/System/mscorlib_System_ValueType.h>
#include <mscorlib/System/mscorlib_System_Object.h>
namespace mscorlib
{
namespace System
{
class String;
class Type;
}
}
namespace mscorlib
{
namespace System
{
namespace Runtime
{
namespace InteropServices
{
namespace ComTypes
{
class BIND_OPTS
: public mscorlib::System::ValueType
{
public:
BIND_OPTS(mscorlib::NativeTypeInfo *nativeTypeInfo)
: mscorlib::System::ValueType(nativeTypeInfo)
{
};
BIND_OPTS(MonoObject *nativeObject)
: mscorlib::System::ValueType(nativeObject)
{
};
~BIND_OPTS()
{
};
BIND_OPTS & operator=(BIND_OPTS &value) { __native_object__ = value.GetNativeObject(); return value; };
bool operator==(BIND_OPTS &value) { return mscorlib::System::Object::Equals(value); };
operator MonoObject*() { return __native_object__; };
MonoObject* operator=(MonoObject* value) { return __native_object__ = value; };
virtual MonoObject* GetNativeObject() override { return __native_object__; };
//Public Fields
__declspec(property(get=get_cbStruct, put=set_cbStruct)) mscorlib::System::Int32 cbStruct;
__declspec(property(get=get_grfFlags, put=set_grfFlags)) mscorlib::System::Int32 grfFlags;
__declspec(property(get=get_grfMode, put=set_grfMode)) mscorlib::System::Int32 grfMode;
__declspec(property(get=get_dwTickCountDeadline, put=set_dwTickCountDeadline)) mscorlib::System::Int32 dwTickCountDeadline;
// Get/Set:cbStruct
mscorlib::System::Int32 get_cbStruct() const;
void set_cbStruct(mscorlib::System::Int32 value);
// Get/Set:grfFlags
mscorlib::System::Int32 get_grfFlags() const;
void set_grfFlags(mscorlib::System::Int32 value);
// Get/Set:grfMode
mscorlib::System::Int32 get_grfMode() const;
void set_grfMode(mscorlib::System::Int32 value);
// Get/Set:dwTickCountDeadline
mscorlib::System::Int32 get_dwTickCountDeadline() const;
void set_dwTickCountDeadline(mscorlib::System::Int32 value);
protected:
private:
};
}
}
}
}
}
#endif
|
#ifndef AGENT_H
#define AGENT_H
#include <boost/shared_ptr.hpp>
#include <agent/lockable.h>
namespace boost {
class thread;
}
typedef boost::shared_ptr<boost::thread> ThreadPtr;
//! All of this is highly experimental.
class Agent : public SharedLockable
{
public:
Agent() : SharedLockable(), quitting_(false), running_(false) {}
// Should this call stop()?
virtual ~Agent() {}
//! TODO: Get rid of this function?
void quit();
void stop();
bool running();
void run();
virtual void _run() = 0;
//! This should be a void function.
ThreadPtr launch();
ThreadPtr thread() const { return thread_; }
//! This should maybe not exist at all.
void detach();
protected:
ThreadPtr thread_;
bool quitting_;
bool running_;
};
#endif // AGENT_H
|
/*
This file is a part of libcds - Concurrent Data Structures library
(C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
Source code repo: http://github.com/khizmax/libcds/
Download: http://sourceforge.net/projects/libcds/files/
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CDSLIB_MEMORY_MICHAEL_ALLOCATOR_OSALLOC_STAT_H
#define CDSLIB_MEMORY_MICHAEL_ALLOCATOR_OSALLOC_STAT_H
#include <cds/algo/atomic.h>
namespace cds { namespace memory { namespace michael {
/// Statistics for large (allocated directly from %OS) block
struct os_allocated_atomic
{
///@cond
atomics::atomic<size_t> nAllocCount ; ///< Event count of large block allocation from %OS
atomics::atomic<size_t> nFreeCount ; ///< Event count of large block deallocation to %OS
atomics::atomic<unsigned long long> nBytesAllocated ; ///< Total size of allocated large blocks, in bytes
atomics::atomic<unsigned long long> nBytesDeallocated ; ///< Total size of deallocated large blocks, in bytes
os_allocated_atomic()
: nAllocCount(0)
, nFreeCount(0)
, nBytesAllocated(0)
, nBytesDeallocated(0)
{}
///@endcond
/// Adds \p nSize to nBytesAllocated counter
void incBytesAllocated( size_t nSize )
{
nAllocCount.fetch_add( 1, atomics::memory_order_relaxed);
nBytesAllocated.fetch_add( nSize, atomics::memory_order_relaxed );
}
/// Adds \p nSize to nBytesDeallocated counter
void incBytesDeallocated( size_t nSize )
{
nFreeCount.fetch_add( 1, atomics::memory_order_relaxed );
nBytesDeallocated.fetch_add( nSize, atomics::memory_order_relaxed );
}
/// Returns count of \p alloc and \p alloc_aligned function call (for large block allocated directly from %OS)
size_t allocCount() const
{
return nAllocCount.load(atomics::memory_order_relaxed);
}
/// Returns count of \p free and \p free_aligned function call (for large block allocated directly from %OS)
size_t freeCount() const
{
return nFreeCount.load(atomics::memory_order_relaxed);
}
/// Returns current value of nBytesAllocated counter
uint64_t allocatedBytes() const
{
return nBytesAllocated.load(atomics::memory_order_relaxed);
}
/// Returns current value of nBytesAllocated counter
uint64_t deallocatedBytes() const
{
return nBytesDeallocated.load(atomics::memory_order_relaxed);
}
};
/// Dummy statistics for large (allocated directly from %OS) block
/**
This class does not gather any statistics.
Class interface is the same as \ref os_allocated_atomic.
*/
struct os_allocated_empty
{
//@cond
/// Adds \p nSize to nBytesAllocated counter
void incBytesAllocated( size_t nSize )
{ CDS_UNUSED(nSize); }
/// Adds \p nSize to nBytesDeallocated counter
void incBytesDeallocated( size_t nSize )
{ CDS_UNUSED(nSize); }
/// Returns count of \p alloc and \p alloc_aligned function call (for large block allocated directly from OS)
size_t allocCount() const
{
return 0;
}
/// Returns count of \p free and \p free_aligned function call (for large block allocated directly from OS)
size_t freeCount() const
{
return 0;
}
/// Returns current value of nBytesAllocated counter
uint64_t allocatedBytes() const
{
return 0;
}
/// Returns current value of nBytesAllocated counter
uint64_t deallocatedBytes() const
{
return 0;
}
//@endcond
};
}}} // namespace cds::memory::michael
#endif /// CDSLIB_MEMORY_MICHAEL_ALLOCATOR_OSALLOC_STAT_H
|
// -*- c++ -*-
// Generated by gtkmmproc -- DO NOT MODIFY!
#ifndef _GTKMM_ITEM_H
#define _GTKMM_ITEM_H
#include <glibmm.h>
/* $Id: item.hg,v 1.1 2003/01/21 13:40:28 murrayc Exp $ */
/* item.h
*
* Copyright (C) 1998-2002 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gtkmm/bin.h>
#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef struct _GtkItem GtkItem;
typedef struct _GtkItemClass GtkItemClass;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
namespace Gtk
{ class Item_Class; } // namespace Gtk
namespace Gtk
{
/** This class should be considered as a virtual base class.
* Only the signals and methods it provides are of any interest.
* You don't want to instantiate any objects of that class.
*
* @ingroup Widgets
*/
class Item : public Bin
{
public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef Item CppObjectType;
typedef Item_Class CppClassType;
typedef GtkItem BaseObjectType;
typedef GtkItemClass BaseClassType;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
virtual ~Item();
#ifndef DOXYGEN_SHOULD_SKIP_THIS
private:
friend class Item_Class;
static CppClassType item_class_;
// noncopyable
Item(const Item&);
Item& operator=(const Item&);
protected:
explicit Item(const Glib::ConstructParams& construct_params);
explicit Item(GtkItem* castitem);
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
static GType get_type() G_GNUC_CONST;
static GType get_base_type() G_GNUC_CONST;
#endif
///Provides access to the underlying C GtkObject.
GtkItem* gobj() { return reinterpret_cast<GtkItem*>(gobject_); }
///Provides access to the underlying C GtkObject.
const GtkItem* gobj() const { return reinterpret_cast<GtkItem*>(gobject_); }
public:
//C++ methods used to invoke GTK+ virtual functions:
protected:
//GTK+ Virtual Functions (override these to change behaviour):
//Default Signal Handlers::
virtual void on_select();
virtual void on_deselect();
virtual void on_toggle();
private:
public:
void select();
/**
* @par Prototype:
* <tt>void on_my_%select()</tt>
*/
Glib::SignalProxy0< void > signal_select();
void deselect();
/**
* @par Prototype:
* <tt>void on_my_%deselect()</tt>
*/
Glib::SignalProxy0< void > signal_deselect();
void toggle();
/**
* @par Prototype:
* <tt>void on_my_%toggle()</tt>
*/
Glib::SignalProxy0< void > signal_toggle();
protected:
Item();
};
} /* namespace Gtk */
namespace Glib
{
/** A Glib::wrap() method for this object.
*
* @param object The C instance.
* @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
* @result A C++ instance that wraps this C instance.
*
* @relates Gtk::Item
*/
Gtk::Item* wrap(GtkItem* object, bool take_copy = false);
} //namespace Glib
#endif /* _GTKMM_ITEM_H */
|
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by heapstat.rc
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
|
#include "appengine/base/fxp.h"
#define T int
#define LL long long
T smull_fxp16(T x, T y)
{
return (T) (((LL) x * (LL) y) >> 16);
}
|
#ifndef TASK_WAIT_FOR_STATUS_SYNC_H
#define TASK_WAIT_FOR_STATUS_SYNC_H
#include "task_manager_lib/TaskDefinition.h"
#include "task_manager_sync/TaskEnvironmentSync.h"
#include "task_manager_sync/TaskWaitForStatusSyncConfig.h"
using namespace task_manager_lib;
namespace task_manager_sync {
class TaskWaitForStatusSync : public TaskInstance<TaskWaitForStatusSyncConfig,TaskEnvironmentSync>
{
public:
TaskWaitForStatusSync(TaskDefinitionPtr def, TaskEnvironmentPtr env) : Parent(def,env) {}
virtual ~TaskWaitForStatusSync() {};
virtual TaskIndicator initialise() ;
virtual TaskIndicator iterate();
virtual TaskIndicator terminate();
};
class TaskFactoryWaitForStatusSync : public TaskDefinition<TaskWaitForStatusSyncConfig, TaskEnvironmentSync, TaskWaitForStatusSync>
{
public:
TaskFactoryWaitForStatusSync(TaskEnvironmentPtr env) :
Parent("WaitForStatusSync","Wait for a sync object to get the desired status",true,env) {}
virtual ~TaskFactoryWaitForStatusSync() {};
};
};
#endif // TASK_WAIT_FOR_STATUS_SYNC_H
|
//
// JBTableViewCell.h
// Go2
//
// Created by Jonathan Buys on 10/24/10.
// Copyright 2010 Farmdog Software. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface JBTableViewCell : NSCell
{
NSImage *backgroundImage;
NSMutableParagraphStyle *myDefaultStyle;
}
@end
|
/*Robert Maynard
MIRARCO
Aug 287 2008
vtkGocadTSolid handles reading tetra based gocad objects
*/
#ifndef __vtkGocadTSolid_h
#define __vtkGocadTSolid_h
#include "vtkGocadAtomic.h"
//BTX
class vtkInternalMap;
class vtkInternalProps;
//ETX
class VTK_EXPORT vtkGocadTSolid : public vtkGocadAtomic
{
public:
static vtkGocadTSolid* New();
vtkTypeRevisionMacro(vtkGocadTSolid,vtkGocadAtomic);
protected:
vtkGocadTSolid();
~vtkGocadTSolid();
//the request data will call Read that does the real work
virtual int RequestData(vtkInformation* request, vtkInformationVector** inputVector, vtkInformationVector* outputVector);
private:
vtkGocadTSolid(const vtkGocadTSolid&); // Not implemented.
void operator=(const vtkGocadTSolid&); // Not implemented.
};
#endif
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_NETWORK_HINTS_RENDERER_WEB_PRESCIENT_NETWORKING_IMPL_H_
#define COMPONENTS_NETWORK_HINTS_RENDERER_WEB_PRESCIENT_NETWORKING_IMPL_H_
#include "base/macros.h"
#include "components/network_hints/common/network_hints.mojom.h"
#include "components/network_hints/renderer/renderer_dns_prefetch.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "third_party/blink/public/platform/web_prescient_networking.h"
namespace content {
class RenderFrame;
}
namespace network_hints {
// The main entry point from blink for sending DNS prefetch requests to the
// network stack.
class WebPrescientNetworkingImpl : public blink::WebPrescientNetworking {
public:
explicit WebPrescientNetworkingImpl(content::RenderFrame* render_frame);
~WebPrescientNetworkingImpl() override;
// blink::WebPrescientNetworking methods:
void PrefetchDNS(const blink::WebString& hostname) override;
void Preconnect(const blink::WebURL& url, bool allow_credentials) override;
private:
mojo::Remote<mojom::NetworkHintsHandler> handler_;
RendererDnsPrefetch dns_prefetch_;
DISALLOW_COPY_AND_ASSIGN(WebPrescientNetworkingImpl);
};
} // namespace network_hints
#endif // COMPONENTS_NETWORK_HINTS_RENDERER_WEB_PRESCIENT_NETWORKING_IMPL_H_
|
/*-
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <phk@FreeBSD.org> wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
* $FreeBSD$
*/
#ifndef _SYS_SMP_H_
#define _SYS_SMP_H_
#ifdef _KERNEL
#ifndef LOCORE
#include <sys/cpuset.h>
/*
* Topology of a NUMA or HTT system.
*
* The top level topology is an array of pointers to groups. Each group
* contains a bitmask of cpus in its group or subgroups. It may also
* contain a pointer to an array of child groups.
*
* The bitmasks at non leaf groups may be used by consumers who support
* a smaller depth than the hardware provides.
*
* The topology may be omitted by systems where all CPUs are equal.
*/
struct cpu_group {
struct cpu_group *cg_parent; /* Our parent group. */
struct cpu_group *cg_child; /* Optional children groups. */
cpuset_t cg_mask; /* Mask of cpus in this group. */
int32_t cg_count; /* Count of cpus in this group. */
int16_t cg_children; /* Number of children groups. */
int8_t cg_level; /* Shared cache level. */
int8_t cg_flags; /* Traversal modifiers. */
};
typedef struct cpu_group *cpu_group_t;
/*
* Defines common resources for CPUs in the group. The highest level
* resource should be used when multiple are shared.
*/
#define CG_SHARE_NONE 0
#define CG_SHARE_L1 1
#define CG_SHARE_L2 2
#define CG_SHARE_L3 3
/*
* Behavior modifiers for load balancing and affinity.
*/
#define CG_FLAG_HTT 0x01 /* Schedule the alternate core last. */
#define CG_FLAG_SMT 0x02 /* New age htt, less crippled. */
#define CG_FLAG_THREAD (CG_FLAG_HTT | CG_FLAG_SMT) /* Any threading. */
/*
* Convenience routines for building topologies.
*/
#ifdef SMP
struct cpu_group *smp_topo(void);
struct cpu_group *smp_topo_none(void);
struct cpu_group *smp_topo_1level(int l1share, int l1count, int l1flags);
struct cpu_group *smp_topo_2level(int l2share, int l2count, int l1share,
int l1count, int l1flags);
struct cpu_group *smp_topo_find(struct cpu_group *top, int cpu);
extern void (*cpustop_restartfunc)(void);
extern int smp_active;
extern int smp_cpus;
extern volatile cpuset_t started_cpus;
extern volatile cpuset_t stopped_cpus;
extern volatile cpuset_t suspended_cpus;
extern cpuset_t hlt_cpus_mask;
extern cpuset_t logical_cpus_mask;
#endif /* SMP */
extern u_int mp_maxid;
extern int mp_maxcpus;
extern int mp_ncpus;
extern volatile int smp_started;
extern cpuset_t all_cpus;
/*
* Macro allowing us to determine whether a CPU is absent at any given
* time, thus permitting us to configure sparse maps of cpuid-dependent
* (per-CPU) structures.
*/
#define CPU_ABSENT(x_cpu) (!CPU_ISSET(x_cpu, &all_cpus))
/*
* Macros to iterate over non-absent CPUs. CPU_FOREACH() takes an
* integer iterator and iterates over the available set of CPUs.
* CPU_FIRST() returns the id of the first non-absent CPU. CPU_NEXT()
* returns the id of the next non-absent CPU. It will wrap back to
* CPU_FIRST() once the end of the list is reached. The iterators are
* currently implemented via inline functions.
*/
#define CPU_FOREACH(i) \
for ((i) = 0; (i) <= mp_maxid; (i)++) \
if (!CPU_ABSENT((i)))
static __inline int
cpu_first(void)
{
int i;
for (i = 0;; i++)
if (!CPU_ABSENT(i))
return (i);
}
static __inline int
cpu_next(int i)
{
for (;;) {
i++;
if (i > mp_maxid)
i = 0;
if (!CPU_ABSENT(i))
return (i);
}
}
#define CPU_FIRST() cpu_first()
#define CPU_NEXT(i) cpu_next((i))
#ifdef SMP
/*
* Machine dependent functions used to initialize MP support.
*
* The cpu_mp_probe() should check to see if MP support is present and return
* zero if it is not or non-zero if it is. If MP support is present, then
* cpu_mp_start() will be called so that MP can be enabled. This function
* should do things such as startup secondary processors. It should also
* setup mp_ncpus, all_cpus, and smp_cpus. It should also ensure that
* smp_active and smp_started are initialized at the appropriate time.
* Once cpu_mp_start() returns, machine independent MP startup code will be
* executed and a simple message will be output to the console. Finally,
* cpu_mp_announce() will be called so that machine dependent messages about
* the MP support may be output to the console if desired.
*
* The cpu_setmaxid() function is called very early during the boot process
* so that the MD code may set mp_maxid to provide an upper bound on CPU IDs
* that other subsystems may use. If a platform is not able to determine
* the exact maximum ID that early, then it may set mp_maxid to MAXCPU - 1.
*/
struct thread;
struct cpu_group *cpu_topo(void);
void cpu_mp_announce(void);
int cpu_mp_probe(void);
void cpu_mp_setmaxid(void);
void cpu_mp_start(void);
void forward_signal(struct thread *);
int restart_cpus(cpuset_t);
int stop_cpus(cpuset_t);
int stop_cpus_hard(cpuset_t);
#if defined(__amd64__) || defined(__i386__)
int suspend_cpus(cpuset_t);
int resume_cpus(cpuset_t);
#endif
void smp_rendezvous_action(void);
extern struct mtx smp_ipi_mtx;
#endif /* SMP */
int quiesce_all_cpus(const char *, int);
int quiesce_cpus(cpuset_t, const char *, int);
void smp_no_rendevous_barrier(void *);
void smp_rendezvous(void (*)(void *),
void (*)(void *),
void (*)(void *),
void *arg);
void smp_rendezvous_cpus(cpuset_t,
void (*)(void *),
void (*)(void *),
void (*)(void *),
void *arg);
#endif /* !LOCORE */
#endif /* _KERNEL */
#endif /* _SYS_SMP_H_ */
|
/*Copyright (c) 2007 by Ben Sunshine-Hill
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
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, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.*/
#ifndef EVENT_H
#define EVENT_H
#define MAX_EVENT_ARGS 8
#include "FastDelegate.h"
#include <boost/noncopyable.hpp>
#include <boost/preprocessor/iteration.hpp>
#include <boost/preprocessor/repetition.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/if.hpp>
#include <boost/preprocessor/comparison.hpp>
#include <boost/preprocessor/empty.hpp>
#include <boost/preprocessor/arithmetic.hpp>
#include <boost/preprocessor/logical.hpp>
#include <boost/preprocessor/comma_if.hpp>
#include <vector>
#include <utility>
namespace events
{
namespace detail
{
template<typename T>
struct Node
{
Node(T const& data, Node<T>* next) : next(next), refCount(0), data(data) { }
Node<T>* next;
// refCount is as follows:
// n>0: Connection is still active, thanks to n holders
// n<0: Event has been destroyed, but -n holders are left
// n=0: Connection has been closed, but Event still exists
int refCount;
T data;
};
class NullType{};
}
class Connection
{
public:
Connection() : m_node(0) { }
template<typename DelegateType>
explicit Connection(detail::Node<DelegateType>* m_node) :
m_node(reinterpret_cast<AnyNodeType*>(m_node))
{
if(m_node)
{
m_node->refCount++;
}
}
Connection(Connection const& c) : m_node(c.m_node && c.m_node->refCount > 0 ? c.m_node : 0)
{
if(m_node)
{
m_node->refCount++;
}
}
Connection& operator=(Connection const& c)
{
if(&c == this) return *this;
if(m_node)
{
if(m_node->refCount > 0)
{
m_node->refCount--;
}
else if(m_node->refCount < 0)
{
m_node->refCount++;
if(m_node->refCount == 0)
{
delete m_node;
}
}
}
m_node = c.m_node && c.m_node->refCount > 0 ? c.m_node : 0;
if(m_node)
{
m_node->refCount++;
}
return *this;
}
~Connection()
{
if(m_node)
{
if(m_node->refCount > 0)
{
m_node->refCount--;
}
else if(m_node->refCount < 0)
{
m_node->refCount++;
if(m_node->refCount == 0)
{
delete m_node;
}
}
}
}
bool Active() const
{
return m_node != NULL && m_node->refCount > 0;
}
private:
typedef detail::Node<detail::NullType> AnyNodeType;
AnyNodeType* m_node;
friend inline void std::swap<Connection>(Connection & left, Connection & right);
};
class ConnectionSet
{
public:
void Add(Connection const& c)
{
m_connections.push_back(c);
}
void Clear()
{
m_connections.clear();
}
private:
typedef std::vector<Connection> ConnectionContainer;
ConnectionContainer m_connections;
};
template<BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(MAX_EVENT_ARGS, typename T, detail::NullType)>
class Event;
class AutoTracked : private ConnectionSet
{
private:
template<BOOST_PP_ENUM_PARAMS(MAX_EVENT_ARGS, typename T)>
friend class Event;
};
#define BOOST_PP_ITERATION_LIMITS (0, BOOST_PP_SUB(MAX_EVENT_ARGS,1))
#define BOOST_PP_FILENAME_1 "event_impl.hxx"
#include BOOST_PP_ITERATE()
#undef BOOST_PP_ITERATION_LIMITS
#undef BOOST_PP_FILENAME_1
#undef NULLTYPE_MACRO
}
namespace std
{
template<>
inline void swap<events::Connection>(events::Connection & left, events::Connection & right)
{
std::swap(left.m_node, right.m_node);
}
}
#endif
|
/* The quaternion is encoded into a vf4_t as { i, j, k, a }. */
#ifndef AOSQ_H
#define AOSQ_H
#include "simd.h"
struct aosf33;
/* Set operations. */
static FINLINE vf4_t
aosq_identity(void)
{
return vf4_set(0.f, 0.f, 0.f, 1.f);
}
static FINLINE vf4_t
aosq_set_axis_angle(vf4_t xyz_, vf4_t aaaa)
{
const vf4_t half_angle = vf4_mul(aaaa, vf4_set1(0.5f));
vf4_t s, c;
vf4_sincos(half_angle, &s, &c);
const vf4_t axis1 = vf4_xyzd(xyz_, vf4_set1(1.f));
const vf4_t sssc = vf4_xyzd(s, c);
/* { x*sin(a/2), y*sin(a/2), z*sin(a/2), cos(a/2) } */
return vf4_mul(axis1, sssc);
}
/* Comparison operations. */
static FINLINE vf4_t
aosq_eq(vf4_t q0, vf4_t q1)
{
const vf4_t r0 = vf4_eq(q0, q1);
const vf4_t r1 = vf4_and(vf4_xxyy(r0), vf4_zzww(r0));
return vf4_and(vf4_xxyy(r1), vf4_zzww(r1));
}
static FINLINE vf4_t
aosq_eq_eps(vf4_t q0, vf4_t q1, vf4_t eps)
{
const vf4_t r0 = vf4_eq_eps(q0, q1, eps);
const vf4_t r1 = vf4_and(vf4_xxyy(r0), vf4_zzww(r0));
return vf4_and(vf4_xxyy(r1), vf4_zzww(r1));
}
/* Arithmetic operations. */
static FINLINE vf4_t
aosq_mul(vf4_t q0, vf4_t q1)
{
const vf4_t r0 =
vf4_mul(vf4_mul(vf4_set(1.f, 1.f, -1.f, 1.f), q0), vf4_wzyx(q1));
const vf4_t r1 =
vf4_mul(vf4_mul(vf4_set(-1.f, 1.f, 1.f, 1.f), q0), vf4_zwxy(q1));
const vf4_t r2 =
vf4_mul(vf4_mul(vf4_set(1.f, -1.f, 1.f, 1.f), q0), vf4_yxwz(q1));
const vf4_t r3 =
vf4_mul(vf4_mul(vf4_set(-1.f, -1.f, -1.f, 1.f), q0), q1);
const vf4_t ijij = vf4_xayb(vf4_sum(r0), vf4_sum(r1));
const vf4_t kaka = vf4_xayb(vf4_sum(r2), vf4_sum(r3));
return vf4_xyab(ijij, kaka);
}
static FINLINE vf4_t
aosq_conj(vf4_t q) /* { -ix, -jy, -jz, a } */
{
return vf4_mul(q, vf4_set(-1.f, -1.f, -1.f, 1.f));
}
static FINLINE vf4_t
aosq_calca(vf4_t ijk_)
{
const vf4_t ijk_square_len = vf4_dot3(ijk_, ijk_);
return vf4_sqrt(vf4_abs(vf4_sub(vf4_set1(1.f), ijk_square_len)));
}
static FINLINE vf4_t
aosq_nlerp(vf4_t from, vf4_t to, vf4_t aaaa)
{
return vf4_normalize(vf4_lerp(from, to, aaaa));
}
#ifdef __cplusplus
extern "C" {
#endif
SNLMATH_API vf4_t aosq_slerp(vf4_t from, vf4_t to, vf4_t aaaa);
/* Conversion operations. */
SNLMATH_API void aosq_to_aosf33(vf4_t q, struct aosf33* out);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* AOSQ_H */
|
#include "common.h"
#include <stdio.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
void xerbla(
const char* SRNAME,
integer INFO)
{
fprintf(stderr, " ** On entry to %s parameter number %ld had an illegal value\n", SRNAME, INFO);
#ifdef HAVE_STDLIB_H
exit(EXIT_FAILURE);
#endif
}
|
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include <ABI44_0_0React/ABI44_0_0renderer/attributedstring/TextAttributes.h>
#include <ABI44_0_0React/ABI44_0_0renderer/components/text/BaseTextProps.h>
#include <ABI44_0_0React/ABI44_0_0renderer/core/Props.h>
#include <ABI44_0_0React/ABI44_0_0renderer/graphics/Color.h>
#include <ABI44_0_0React/ABI44_0_0renderer/graphics/Geometry.h>
namespace ABI44_0_0facebook {
namespace ABI44_0_0React {
class TextProps : public Props, public BaseTextProps {
public:
TextProps() = default;
TextProps(const TextProps &sourceProps, const RawProps &rawProps);
#pragma mark - DebugStringConvertible
#if ABI44_0_0RN_DEBUG_STRING_CONVERTIBLE
SharedDebugStringConvertibleList getDebugProps() const override;
#endif
};
} // namespace ABI44_0_0React
} // namespace ABI44_0_0facebook
|
// This file is part of MANTIS OS, Operating System
// See http://mantis.cs.colorado.edu/
//
// Copyright (C) 2003-2005 University of Colorado, Boulder
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the mos license (see file LICENSE)
#include "run.h"
#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include <stdbool.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <stdio.h>
void parse_function(char *input, char *delim, char ***argv, int *argc);
void get_paths(char ***paths, int *argc);
char *get_full_path(char *cmd);
bool check_file_perm(char *filename);
bool run_command(char *command)
{
char *parse_keys = " \t\n";
char *full_path;
char **args;
int argc=0;
pid_t pid;
parse_function(command, parse_keys, &args, &argc);
if(args[0] == NULL)
return false;
full_path = get_full_path(args[0]);
if(full_path == NULL){
printf("Error: [%s] not found!", args[0]);
free(args);
return false;
}
free(args[0]);
args[0] = full_path;
pid = vfork();
if(pid == 0)
execv(args[0],args);
else
waitpid(pid, NULL, 0);
free(args);
return true;
}
char *get_full_path(char *cmd)
{
//parse the path variable
char **paths;
int pathc=0;
int i=0;
get_paths(&paths, &pathc);
char *tmp_cmd=NULL;
//check for absolute path
if(cmd[0] == '/' ||
strstr(cmd,"./") == cmd ||
strstr(cmd,"../") == cmd){
if(check_file_perm(cmd)){ //check perms
tmp_cmd = strdup(cmd);
return tmp_cmd;
}
else {
return NULL;
}
} else { //relative path
for(i=0;i<pathc;i++){
//get some memory
int tmp_size = strlen(paths[i]);
int cmd_size = strlen(cmd);
if(tmp_cmd) //free unused memory
free(tmp_cmd);
tmp_cmd = (char *)malloc(tmp_size + cmd_size + 2); //1 for null 1 for '/'
memcpy(tmp_cmd, paths[i], tmp_size); //copy in path
memcpy(tmp_cmd + tmp_size, "/",1); //copy a slash
memcpy(tmp_cmd + tmp_size + 1,cmd,cmd_size+1);//copy program
int ret_val = check_file_perm(tmp_cmd);
if(ret_val){ //check perms
return tmp_cmd;
}
}
} //if we get here everything failed...
if(tmp_cmd)
free(tmp_cmd);
tmp_cmd = NULL;
return NULL;
}
void get_paths(char ***paths, int *argc)
{
parse_function(getenv("PATH"), ":", paths, argc);
}
bool check_file_perm(char *filename)
{
struct stat statbuf;
int retval = stat(filename, &statbuf);
if(!retval){
if(statbuf.st_uid == getuid() &&
(S_IXUSR & statbuf.st_mode)){
return true;
} else if(statbuf.st_gid == getgid() &&
(S_IXGRP & statbuf.st_mode)){
return true;
} else if(S_IXOTH & statbuf.st_mode){
return true;
} else {
return false;
}
} else {
return false;
}
}
bool file_exists(char *filename)
{
struct stat statbuf;
int retval = stat(filename, &statbuf);
if(!retval)
if(S_IFREG & statbuf.st_mode)
return true;
return false;
}
void parse_function(char *input, char *delim, char ***argv, int *argc)
{
char *start = strdup(input);
char *pch = start;
int letter_count;
int i=0;
*argc=0;
letter_count = strcspn (pch, delim);
while (*pch != '\0')
{
if(strlen(pch) == 0) break;
(*argc)++;
pch += letter_count; //go past letters
letter_count = strspn (pch, delim);
pch += letter_count; //go past space
letter_count = strcspn (pch, delim);
}
*argv = malloc(sizeof(char *) * (*argc + 1));
pch = start;
letter_count = strcspn (pch, delim);
while (*pch != '\0')
{
(*argv)[i] = calloc(letter_count+1,sizeof(char));
strncpy((*argv)[i++], pch, letter_count);
pch += letter_count; //go past letters
letter_count = strspn (pch, delim);
pch += letter_count; //go past space
letter_count = strcspn (pch, delim);
}
(*argv)[i++] = 0;
if(start != NULL){
free(start);
}
}
|
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKUSTelemedImageSource_H_HEADER_INCLUDED_
#define MITKUSTelemedImageSource_H_HEADER_INCLUDED_
#include "mitkUSImageSource.h"
#include "mitkUSTelemedSDKHeader.h"
#include "mitkUSTelemedScanConverterPlugin.h"
#include "itkFastMutexLock.h"
namespace mitk {
/**
* \brief Implementation of mitk::USImageSource for Telemed API devices.
* The method mitk::USImageSource::GetNextRawImage() is implemented for
* getting images from the Telemed API.
*
* A method for connecting this ImageSource to the Telemed API is
* implemented (mitk::USTelemedImageSource::CreateAndConnectConverterPlugin()).
* This method is available for being used by mitk::USTelemedDevice.
*/
class USTelemedImageSource : public USImageSource
{
public:
mitkClassMacro(USTelemedImageSource, USImageSource);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
* Implementation of the superclass method. Returns the pointer
* to the mitk::Image filled by Telemed API callback.
*/
virtual void GetNextRawImage( mitk::Image::Pointer& );
/**
* \brief Connect this object to the Telemed API.
* This method is for being used by mitk::USTelemedDevice.
*/
bool CreateAndConnectConverterPlugin( Usgfw2Lib::IUsgDataView*, Usgfw2Lib::tagScanMode );
protected:
USTelemedImageSource( );
virtual ~USTelemedImageSource( );
Usgfw2Lib::IUsgScanConverterPlugin* m_Plugin;
USTelemedScanConverterPlugin* m_PluginCallback;
mitk::Image::Pointer m_Image;
itk::FastMutexLock::Pointer m_ImageMutex;
};
} // namespace mitk
#endif // MITKUSTelemedImageSource_H
|
/* This file is part of the YAZ toolkit.
* Copyright (C) 1995-2013 Index Data.
* All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Index Data nor the names of its contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* \file mutex.h
* \brief Header for Mutex functions
*/
#ifndef YAZ_MUTEX_H
#define YAZ_MUTEX_H
#include <stddef.h>
#include <time.h>
#include <yaz/yconfig.h>
YAZ_BEGIN_CDECL
/** \brief YAZ MUTEX opaque pointer */
typedef struct yaz_mutex *YAZ_MUTEX;
/** \brief YAZ condition opaque pointer */
typedef struct yaz_cond *YAZ_COND;
/** \brief create MUTEX
\param mutexp is pointer to MUTEX handle (*mutexp must be NULL)
It is important that *mutexp is NULL. If not, yaz_mutex_create will
not modify the handle (assumes it is already created!)
*/
YAZ_EXPORT void yaz_mutex_create(YAZ_MUTEX *mutexp);
/** \brief enter critical section / AKA lock
\param mutex MUTEX handle
*/
YAZ_EXPORT void yaz_mutex_enter(YAZ_MUTEX mutex);
/** \brief leave critical section / AKA unlock
\param mutex MUTEX handle
*/
YAZ_EXPORT void yaz_mutex_leave(YAZ_MUTEX mutex);
/** \brief destroy MUTEX
\param mutexp pointer to MUTEX handle
If *mutexp is NULL, then this function does nothing.
*/
YAZ_EXPORT void yaz_mutex_destroy(YAZ_MUTEX *mutexp);
/** \brief sets name of MUTEX for debugging purposes
\param mutex MUTEX handle
\param log_level YAZ log level
\param name user-given name associated with MUTEX
If log_level != 0 and name != 0 this function will make yaz_mutex_enter
and yaz_mutex_leave print information for each invocation using yaz_log
with the level given. In particular when YAZ is compiled with pthreads,
yaz_mutex_enter will inform if a lock is not immediately acquired.
This function should be called after a MUTEX is created but before
it is used for locking.
*/
YAZ_EXPORT
void yaz_mutex_set_name(YAZ_MUTEX mutex, int log_level, const char *name);
/** \brief creates condition variable
\param p reference to condition handle
Upon successful completion *p holds the condition handle; *p = 0
on error.
*/
YAZ_EXPORT void yaz_cond_create(YAZ_COND *p);
/** \brief destroys condition variable
\param p reference to condition handle
Upon completion *p holds 0.
*/
YAZ_EXPORT
void yaz_cond_destroy(YAZ_COND *p);
struct timeval;
/** \brief waits for condition
\param p condition variable handle
\param m mutex
\param abstime wait until this time; 0 for indefinite wait
Semantics like pthread_cond_wait.
*/
YAZ_EXPORT
int yaz_cond_wait(YAZ_COND p, YAZ_MUTEX m, const struct timeval *abstime);
/** \brief unblock one thread waiting for block
\param p condition variable handle
*/
YAZ_EXPORT
int yaz_cond_signal(YAZ_COND p);
/** \brief unblock all threads waiting for block
\param p condition variable handle
*/
YAZ_EXPORT
int yaz_cond_broadcast(YAZ_COND p);
YAZ_END_CDECL
#endif
/*
* Local variables:
* c-basic-offset: 4
* c-file-style: "Stroustrup"
* indent-tabs-mode: nil
* End:
* vim: shiftwidth=4 tabstop=8 expandtab
*/
|
/*
* mwt_request.c
*
* Created on: 2014年10月12日
* Author: macbook
*/
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.