text stringlengths 4 6.14k |
|---|
//
// LLCustomer.h
// Copyright (C) 2017 Char Software Inc., DBA Localytics
//
// This code is provided under the Localytics Modified BSD License.
// A copy of this license has been distributed in a file called LICENSE
// with this source code.
//
// Please visit www.localytics.com for more information.
//
#import <Foundation/Foundation.h>
/**
* A customer object builder used to set a customer's:
* - id
* - first name
* - last name
* - full name
* - email address
*/
@interface LLCustomerBuilder : NSObject
/**
* Builder setter for customer's id
*/
@property (nonatomic, strong, nullable) NSString* customerId;
/**
* Builder setter for customer's first name
*/
@property (nonatomic, strong, nullable) NSString* firstName;
/**
* Builder setter for customer's last name
*/
@property (nonatomic, strong, nullable) NSString* lastName;
/**
* Builder setter for customer's full name
*/
@property (nonatomic, strong, nullable) NSString* fullName;
/**
* Builder setter for customer's email address
*/
@property (nonatomic, strong, nullable) NSString* emailAddress;
@end
/**
* A customer object. A customer can have:
* - id
* - first name
* - last name
* - full name
* - email address
*/
@interface LLCustomer : NSObject
/**
* Customer's id
*/
@property (nonatomic, strong, readonly, nullable) NSString* customerId;
/**
* Customer's first name
*/
@property (nonatomic, strong, readonly, nullable) NSString* firstName;
/**
* Customer's last name
*/
@property (nonatomic, strong, readonly, nullable) NSString* lastName;
/**
* Customer's full name
*/
@property (nonatomic, strong, readonly, nullable) NSString* fullName;
/**
* Customer's email address
*/
@property (nonatomic, strong, readonly, nullable) NSString* emailAddress;
/**
* Constructor for a customer object using a customer builder
*/
+ (nullable instancetype)customerWithBlock:(nonnull void (^)(LLCustomerBuilder * __nonnull builder))block;
@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.
*/
/**
* @author Nikolay A. Sidelnikov
*/
#ifndef _PLATFORMDEPENDANT_H_
#define _PLATFORMDEPENDANT_H_
#ifndef _MSC_VER
#define strcmpi strcasecmp
#define stricmp strcasecmp
#define strnicmp strncasecmp
#else
#pragma warning( push, 4 )
#pragma warning( disable : 4100 4127 4201 4511 4512)
#pragma conform( forScope, on )
#define strdup _strdup
#define strcmpi _strcmpi
#define stricmp _stricmp
#define isnan _isnan
#define finite _finite
#endif //_MSC_VER
#undef stdcall__
#undef cdecl_
#ifdef PLATFORM_POSIX
#include <limits.h>
#ifndef __stdcall
#define __stdcall
#endif
#ifndef _cdecl
#define _cdecl
#endif
#define cdecl_ __attribute__ ((__cdecl__))
#ifdef _EM64T_
#define stdcall__
#else
#define stdcall__ __attribute__ ((__stdcall__))
#endif
#else
#define stdcall__
#define cdecl_
//--signbit implementation for windows platform
#include <float.h>
inline int signbit(double d) {
return _copysign(1, d) < 0;
}
inline int signbit(float f) {
return _copysign(1, f) < 0;
}
//----
#endif
inline bool fit32(int64 val) {
return (INT_MIN <= val) && (val <= INT_MAX);
}
#endif // _PLATFORMDEPENDANT_H_
|
#ifndef SF1R_COMMON_SCDTYPEWRITER_H_
#define SF1R_COMMON_SCDTYPEWRITER_H_
#include <sf1common/ScdTypeWriter.h>
namespace sf1r
{
using izenelib::ScdTypeWriter;
}
#endif
|
/* This file was generated by upbc (the upb compiler) from the input
* file:
*
* src/proto/grpc/health/v1/health.proto
*
* Do not edit -- your changes will be discarded when the file is
* regenerated. */
#include <stddef.h>
#include "upb/msg_internal.h"
#include "src/proto/grpc/health/v1/health.upb.h"
#include "upb/port_def.inc"
static const upb_msglayout_field grpc_health_v1_HealthCheckRequest__fields[1] = {
{1, UPB_SIZE(0, 0), 0, 0, 9, _UPB_MODE_SCALAR | (_UPB_REP_STRVIEW << _UPB_REP_SHIFT)},
};
const upb_msglayout grpc_health_v1_HealthCheckRequest_msginit = {
NULL,
&grpc_health_v1_HealthCheckRequest__fields[0],
UPB_SIZE(8, 16), 1, _UPB_MSGEXT_NONE, 1, 255,
};
static const upb_msglayout_field grpc_health_v1_HealthCheckResponse__fields[1] = {
{1, UPB_SIZE(0, 0), 0, 0, 14, _UPB_MODE_SCALAR | (_UPB_REP_4BYTE << _UPB_REP_SHIFT)},
};
const upb_msglayout grpc_health_v1_HealthCheckResponse_msginit = {
NULL,
&grpc_health_v1_HealthCheckResponse__fields[0],
UPB_SIZE(8, 8), 1, _UPB_MSGEXT_NONE, 1, 255,
};
static const upb_msglayout *messages_layout[2] = {
&grpc_health_v1_HealthCheckRequest_msginit,
&grpc_health_v1_HealthCheckResponse_msginit,
};
const upb_msglayout_file src_proto_grpc_health_v1_health_proto_upb_file_layout = {
messages_layout,
NULL,
2,
0,
};
#include "upb/port_undef.inc"
|
/*
* #%L
* Native ARchive plugin for Maven
* %%
* Copyright (C) 2002 - 2014 NAR Maven Plugin developers.
* %%
* 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.
* #L%
*/
#ifndef B1_H
#define B1_H
#ifdef WIN32
__declspec(dllexport)
#endif
class B1{
public:
const char* print();
};
#endif
|
#import "BTPayPalAccountNonce.h"
#if __has_include("BraintreeCore.h")
#import "BraintreeCore.h"
#else
#import <BraintreeCore/BraintreeCore.h>
#endif
@interface BTPayPalAccountNonce ()
- (instancetype)initWithNonce:(NSString *)nonce
description:(NSString *)description
email:(NSString *)email
firstName:(NSString *)firstName
lastName:(NSString *)lastName
phone:(NSString *)phone
billingAddress:(BTPostalAddress *)billingAddress
shippingAddress:(BTPostalAddress *)shippingAddress
clientMetadataId:(NSString *)clientMetadataId
payerId:(NSString *)payerId
isDefault:(BOOL)isDefault;
@end
|
/******************************************************************************
* $Id: ceosopen.h 31777 2015-11-26 14:14:41Z rouault $
*
* Project: CEOS Translator
* Purpose: Public (C callable) interface for CEOS and related formats such
* as Spot CAP. This stuff can be used independently of GDAL.
* Author: Frank Warmerdam, warmerdam@pobox.com
*
******************************************************************************
* Copyright (c) 1999, Frank Warmerdam
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
****************************************************************************/
#ifndef CEOSOPEN_H_INCLUDED
#define CEOSOPEN_H_INCLUDED
/* -------------------------------------------------------------------- */
/* Include standard portability stuff. */
/* -------------------------------------------------------------------- */
#include "cpl_conv.h"
#include "cpl_string.h"
/* -------------------------------------------------------------------- */
/* Base ``class'' for ceos records. */
/* -------------------------------------------------------------------- */
CPL_C_START
typedef struct {
int nRecordNum;
GUInt32 nRecordType;
int nLength;
char *pachData;
}CEOSRecord;
/* well known record types */
#define CRT_IMAGE_FDR 0x3FC01212
#define CRT_IMAGE_DATA 0xEDED1212
/* -------------------------------------------------------------------- */
/* Main CEOS info structure. */
/* -------------------------------------------------------------------- */
typedef struct {
/* public information */
int nPixels;
int nLines;
int nBands;
int nBitsPerPixel;
/* private information */
VSILFILE *fpImage;
int bLittleEndian;
int nImageRecCount;
int nImageRecLength;
int nPrefixBytes;
int nSuffixBytes;
int *panDataStart;
int nLineOffset;
} CEOSImage;
/* -------------------------------------------------------------------- */
/* External Prototypes */
/* -------------------------------------------------------------------- */
CEOSImage CPL_ODLL *CEOSOpen( const char *, const char * );
void CPL_ODLL CEOSClose( CEOSImage * );
CPLErr CPL_ODLL CEOSReadScanline( CEOSImage *psImage, int nBand,
int nScanline, void * pData );
/* -------------------------------------------------------------------- */
/* Internal prototypes. */
/* -------------------------------------------------------------------- */
CEOSRecord CPL_ODLL *CEOSReadRecord( CEOSImage * );
void CPL_ODLL CEOSDestroyRecord( CEOSRecord * );
CPL_C_END
#endif /* ndef CEOSOPEN_H_INCLUDED */
|
// @file bufreader.h parse a memory region into usable pieces
/**
* Copyright (C) 2009 10gen Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
namespace mongo {
/** helper to read and parse a block of memory
methods throw the eof exception if the operation would pass the end of the
buffer with which we are working.
*/
class BufReader : boost::noncopyable {
public:
class eof : public std::exception {
public:
eof() { }
virtual const char * what() { return "BufReader eof"; }
};
BufReader(const void *p, unsigned len) : _start(p), _pos(p), _end(((char *)_pos)+len) { }
bool atEof() const { return _pos == _end; }
/** read in the object specified, and advance buffer pointer */
template <typename T>
void read(T &t) {
T* cur = (T*) _pos;
T *next = cur + 1;
if( _end < next ) throw eof();
t = *cur;
_pos = next;
}
/** verify we can look at t, but do not advance */
template <typename T>
void peek(T &t) {
T* cur = (T*) _pos;
T *next = cur + 1;
if( _end < next ) throw eof();
t = *cur;
}
/** return current offset into buffer */
unsigned offset() const { return (char*)_pos - (char*)_start; }
/** return remaining bytes */
unsigned remaining() const { return (char*)_end -(char*)_pos; }
/** back up by nbytes */
void rewind(unsigned nbytes) {
_pos = ((char *) _pos) - nbytes;
assert( _pos >= _start );
}
/** return current position pointer, and advance by len */
const void* skip(unsigned len) {
const char *nxt = ((char *) _pos) + len;
if( _end < nxt ) throw eof();
const void *p = _pos;
_pos = nxt;
return p;
}
void readStr(string& s) {
StringBuilder b;
while( 1 ) {
char ch;
read(ch);
if( ch == 0 )
break;
b << ch;
}
s = b.str();
}
const void* pos() { return _pos; }
const void* start() { return _start; }
private:
const void *_start;
const void *_pos;
const void *_end;
};
}
|
///////////////////////////////////////////////////////////////////////////////////////////////
//
// Name: vrpn_Tracker_TrivisioColibri.h
//
// Author: David Borland
// Institut d'Investigacions Biomèdiques August Pi i Sunyer (IDIBAPS)
// Virtual Embodiment and Robotic Re-Embodiment (VERE) Project 257695
//
// Description: VRPN tracker class for Trivisio Colibri device
//
///////////////////////////////////////////////////////////////////////////////////////////////
#ifndef VRPN_TRACKER_TRIVISIOCOLIBRI
#define VRPN_TRACKER_TRIVISIOCOLIBRI
#include "vrpn_Configure.h" // IWYU pragma: keep
#ifdef VRPN_USE_TRIVISIOCOLIBRI
#include "vrpn_Tracker.h"
class vrpn_Tracker_TrivisioColibri : public vrpn_Tracker {
public:
// Constructor
//
// name: VRPN tracker name
//
// c: VRPN connection to use
//
// numSensors: The number of devices to connect to
//
// Hz: Update rate in Hertz
//
// bufLen: The buffer length for reading data.
//
// From the reference manual:
//
// An short buffer (0) ensures minimal delay until the sensor measurement is available at the risk
// of lost measurements. A long buffer guarantees that no data is dropped, at
// the same time if data is not read fast enough there is a potential risk of a
// bufLenfrequency before the measurement becomes available.
//
vrpn_Tracker_TrivisioColibri(const char* name, vrpn_Connection* c,
int numSensors = 1, int Hz = 60, int bufLen = 0);
~vrpn_Tracker_TrivisioColibri();
/// This function should be called each time through the main loop
/// of the server code. It checks for a report from the tracker and
/// sends it if there is one.
virtual void mainloop();
protected:
virtual void get_report();
virtual void send_report();
// Array of pointers to devices handles
void** imu;
};
#endif
#endif
|
/*
** Copyright (c) 2007-2009 Sendmail, Inc. and its suppliers.
** All rights reserved.
**
** Copyright (c) 2009, 2012-2014, 2016, 2017, The Trusted Domain Project.
** All rights reserved.
*/
#ifndef _OPENARC_AR_H_
#define _OPENARC_AR_H_
/* system includes */
/* system includes */
#include <sys/types.h>
/* openarc includes */
#include "openarc.h"
/* limits */
#define MAXARESULTS 16
#define MAXPROPS 16
#define MAXAVALUE 256
/* ARES_METHOD_T -- type for specifying an authentication method */
typedef int ares_method_t;
#define ARES_METHOD_UNKNOWN (-1)
#define ARES_METHOD_AUTH 0
#define ARES_METHOD_DKIM 1
#define ARES_METHOD_DOMAINKEYS 2
#define ARES_METHOD_SENDERID 3
#define ARES_METHOD_SPF 4
#define ARES_METHOD_DKIMADSP 5
#define ARES_METHOD_IPREV 6
#define ARES_METHOD_DKIMATPS 7
#define ARES_METHOD_DMARC 8
#define ARES_METHOD_SMIME 9
#define ARES_METHOD_RRVS 10
#define ARES_METHOD_ARC 11
/* ARES_RESULT_T -- type for specifying an authentication result */
typedef int ares_result_t;
#define ARES_RESULT_UNDEFINED (-1)
#define ARES_RESULT_PASS 0
#define ARES_RESULT_UNASSIGNED 1 /* UNASSIGNED */
#define ARES_RESULT_SOFTFAIL 2
#define ARES_RESULT_NEUTRAL 3
#define ARES_RESULT_TEMPERROR 4
#define ARES_RESULT_PERMERROR 5
#define ARES_RESULT_NONE 6
#define ARES_RESULT_FAIL 7
#define ARES_RESULT_POLICY 8
#define ARES_RESULT_NXDOMAIN 9
#define ARES_RESULT_SIGNED 10
#define ARES_RESULT_UNKNOWN 11
#define ARES_RESULT_DISCARD 12
/* ARES_PTYPE_T -- type for specifying an authentication property */
typedef int ares_ptype_t;
#define ARES_PTYPE_UNKNOWN (-1)
#define ARES_PTYPE_SMTP 0
#define ARES_PTYPE_HEADER 1
#define ARES_PTYPE_BODY 2
#define ARES_PTYPE_POLICY 3
/* RESULT structure -- a single result */
struct result
{
int result_props;
ares_method_t result_method;
ares_result_t result_result;
ares_ptype_t result_ptype[MAXPROPS];
unsigned char result_reason[MAXAVALUE + 1];
unsigned char result_comment[MAXAVALUE + 1];
unsigned char result_property[MAXPROPS][MAXAVALUE + 1];
unsigned char result_value[MAXPROPS][MAXAVALUE + 1];
};
/* AUTHRES structure -- the entire header parsed */
struct authres
{
int ares_count;
unsigned char ares_host[ARC_MAXHOSTNAMELEN + 1];
unsigned char ares_version[MAXAVALUE + 1];
struct result ares_result[MAXARESULTS];
};
/*
** ARES_PARSE -- parse an Authentication-Results: header, return a
** structure containing a parsed result
**
** Parameters:
** hdr -- NULL-terminated contents of an Authentication-Results:
** header field
** ar -- a pointer to a (struct authres) loaded by values after parsing
**
** Return value:
** 0 on success, -1 on failure.
*/
extern int ares_parse __P((u_char *, struct authres *));
extern const char *ares_getmethod __P((ares_method_t));
extern const char *ares_getresult __P((ares_result_t));
extern const char *ares_getptype __P((ares_ptype_t));
#endif /* _OPENARC_AR_H_ */
|
/* * Copyright (c) 2014, 2015 Zhang Xianyi
* 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.
*/
#include <stdio.h>
#define CTEST_MAIN
#include "vml_test.h"
CTEST_SETUP(check_result_s) {
init_test_parameter(&(data->parameter), 0, 0);
}
CTEST_SETUP(check_result_d) {
init_test_parameter(&(data->parameter), 0, 1);
}
CTEST_SETUP(check_result_c) {
init_test_parameter(&(data->parameter), 1, 0);
}
CTEST_SETUP(check_result_z) {
init_test_parameter(&(data->parameter), 1, 1);
}
CTEST_TEARDOWN(check_result_s) {
free_test_parameter(&(data->parameter));
}
CTEST_TEARDOWN(check_result_d) {
free_test_parameter(&(data->parameter));
}
CTEST_TEARDOWN(check_result_c) {
free_test_parameter(&(data->parameter));
}
CTEST_TEARDOWN(check_result_z) {
free_test_parameter(&(data->parameter));
}
int main(int argc, char ** argv){
int ctest_argc=1;
char * ctest_argv[3]={NULL,NULL,NULL};
int num_fail=0;
read_input_flags(argc, argv, &ctest_argc, ctest_argv);
num_fail=ctest_main(ctest_argc, (const char **)ctest_argv);
return num_fail;
}
|
/* S/MIME detached data encrypt example: rarely done but
* should the need arise this is an example....
*/
#include <openssl/pem.h>
#include <openssl/cms.h>
#include <openssl/err.h>
int main(int argc, char **argv)
{
BIO *in = NULL, *out = NULL, *tbio = NULL, *dout = NULL;
X509 *rcert = NULL;
STACK_OF(X509) *recips = NULL;
CMS_ContentInfo *cms = NULL;
int ret = 1;
int flags = CMS_STREAM|CMS_DETACHED;
OpenSSL_add_all_algorithms();
ERR_load_crypto_strings();
/* Read in recipient certificate */
tbio = BIO_new_file("signer.pem", "r");
if (!tbio)
goto err;
rcert = PEM_read_bio_X509(tbio, NULL, 0, NULL);
if (!rcert)
goto err;
/* Create recipient STACK and add recipient cert to it */
recips = sk_X509_new_null();
if (!recips || !sk_X509_push(recips, rcert))
goto err;
/* sk_X509_pop_free will free up recipient STACK and its contents
* so set rcert to NULL so it isn't freed up twice.
*/
rcert = NULL;
/* Open content being encrypted */
in = BIO_new_file("encr.txt", "r");
dout = BIO_new_file("smencr.out", "wb");
if (!in)
goto err;
/* encrypt content */
cms = CMS_encrypt(recips, in, EVP_des_ede3_cbc(), flags);
if (!cms)
goto err;
out = BIO_new_file("smencr.pem", "w");
if (!out)
goto err;
if (!CMS_final(cms, in, dout, flags))
goto err;
/* Write out CMS structure without content */
if (!PEM_write_bio_CMS(out, cms))
goto err;
ret = 0;
err:
if (ret)
{
fprintf(stderr, "Error Encrypting Data\n");
ERR_print_errors_fp(stderr);
}
if (cms)
CMS_ContentInfo_free(cms);
if (rcert)
X509_free(rcert);
if (recips)
sk_X509_pop_free(recips, X509_free);
if (in)
BIO_free(in);
if (out)
BIO_free(out);
if (dout)
BIO_free(dout);
if (tbio)
BIO_free(tbio);
return ret;
}
|
/*
* Copyright (c) 2012, Michael Lehn, Klaus Pototzky
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2) Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3) Neither the name of the FLENS 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
* 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.
*/
/* Based on
*
SUBROUTINE DGBTRF( M, N, KL, KU, AB, LDAB, IPIV, INFO )
SUBROUTINE ZGBTRF( M, N, KL, KU, AB, LDAB, IPIV, INFO )
*
* -- LAPACK 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
*/
#ifndef FLENS_LAPACK_GB_TRF_H
#define FLENS_LAPACK_GB_TRF_H 1
#include <flens/lapack/typedefs.h>
#include <flens/matrixtypes/matrixtypes.h>
#include <flens/vectortypes/vectortypes.h>
namespace flens { namespace lapack {
//== (gb)trf ===================================================================
//
// Real and complex variant
//
template <typename MA, typename VPIV>
typename RestrictTo<IsGbMatrix<MA>::value
&& IsIntegerDenseVector<VPIV>::value,
typename RemoveRef<MA>::Type::IndexType>::Type
trf(MA &&A, VPIV &&piv);
} } // namespace lapack, flens
#endif // FLENS_LAPACK_GB_TRF_H
|
/*
Plan 9 from User Space src/lib9/dirstat.c
http://code.swtch.com/plan9port/src/tip/src/lib9/dirstat.c
Copyright 2001-2007 Russ Cox. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include <u.h>
#define NOPLAN9DEFINES
#include <libc.h>
#include <sys/stat.h>
extern int _p9dir(struct stat*, struct stat*, char*, Dir*, char**, char*);
Dir*
dirstat(char *file)
{
struct stat lst;
struct stat st;
int nstr;
Dir *d;
char *str;
if(lstat(file, &lst) < 0)
return nil;
st = lst;
if((lst.st_mode&S_IFMT) == S_IFLNK)
stat(file, &st);
nstr = _p9dir(&lst, &st, file, nil, nil, nil);
d = malloc(sizeof(Dir)+nstr);
if(d == nil)
return nil;
memset(d, 0, sizeof(Dir)+nstr);
str = (char*)&d[1];
_p9dir(&lst, &st, file, d, &str, str+nstr);
return d;
}
|
/*
* Copyright (c) 2007, Kohsuke Ohtani
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the author nor the names of any co-contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/prex.h>
#include <sys/posix.h>
#include <ipc/fs.h>
#include <limits.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <dirent.h>
DIR *
opendir(const char *name)
{
struct open_msg m;
struct _dirdesc *dir;
if ((dir = malloc(sizeof(struct _dirdesc))) == NULL)
return NULL;
m.hdr.code = FS_OPENDIR;
strlcpy(m.path, (char *)name, PATH_MAX);
if (__posix_call(__fs_obj, &m, sizeof(m), 1) != 0)
return NULL;
dir->dd_fd = m.fd;
return dir;
}
|
/*
* Copyright (c) 2012, Michael Lehn
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2) Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3) Neither the name of the FLENS 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
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef FLENS_BLAS_CLOSURES_LEVEL2_MVSWITCH_H
#define FLENS_BLAS_CLOSURES_LEVEL2_MVSWITCH_H 1
#include <cxxblas/cxxblas.h>
#include <flens/blas/closures/tweaks/defaulteval.h>
#include <flens/blas/operators/operators.h>
#include <flens/matrixtypes/matrixtypes.h>
#include <flens/typedefs.h>
#include <flens/vectortypes/vectortypes.h>
namespace flens { namespace blas {
//
// This switch evaluates closures of the form
//
// y = beta*y + A*x
//
// If x is a closure then it gets evaluated and a temporary gets created to
// store the result. For matrix A we distinguish between three cases:
// case 1: A is no closure
// case 2: A is a scaling closure (i.e. scale*A)
// case 3: A is some other closure
//
// Entry point for mvSwitch
//
template <typename ALPHA, typename MA, typename VX, typename BETA, typename VY>
typename RestrictTo<IsSame<MA, typename MA::Impl>::value
&& IsSame<VX, typename VX::Impl>::value
&& IsSame<VY, typename VY::Impl>::value,
void>::Type
mvSwitch(Transpose trans, const ALPHA &alpha, const MA &A, const VX &x,
const BETA &beta, VY &y);
//
// case 1: A is no closure
//
template <typename ALPHA, typename MA, typename VX, typename BETA, typename VY>
typename RestrictTo<!IsClosure<MA>::value,
void>::Type
mvCase(Transpose trans, const ALPHA &alpha, const MA &A, const VX &x,
const BETA &beta, VY &y);
//
// case 2: A is closure of type scale*A
//
template <typename ALPHA, typename T, typename MA, typename VX, typename BETA,
typename VY>
void
mvCase(Transpose trans, const ALPHA &alpha,
const MatrixClosure<OpMult, ScalarValue<T>, MA> &scale_A,
const VX &x, const BETA &beta, VY &y);
//
// case 3: A is some other closure
//
template <typename ALPHA, typename Op, typename L, typename R, typename VX,
typename BETA, typename VY>
void
mvCase(Transpose trans, const ALPHA &alpha,
const MatrixClosure<Op, L, R> &A,
const VX &x, const BETA &beta, VY &y);
} } // namespace blas, flens
#endif // FLENS_BLAS_CLOSURES_LEVEL2_MVSWITCH_H
|
#ifndef ALIZDCFRAGMENT_H
#define ALIZDCFRAGMENT_H
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice */
////////////////////////////////////////////////////
// //
// Generate nuclear fragments parametrizing //
// resuslts of SIS and SPS energies //
// //
////////////////////////////////////////////////////
#include <TMath.h>
#include <TF1.h>
extern int comp(const void *, const void *);
class AliZDCFragment : public TNamed {
public:
AliZDCFragment();
AliZDCFragment(Float_t b);
virtual ~AliZDCFragment() {}
void GenerateIMF();
void GenerateIMFOO();
void AttachNeutrons();
Float_t DeuteronNumber();
// Setting parameters
virtual void SetImpactParameter(Float_t b) {fB=b;};
// Getting parameters
Float_t GetZbAverage() {return fZbAverage;}
Int_t GetFragmentNum() {return fNimf;}
Float_t GetZmax() {return fZmax;}
Int_t* GetZZ() {return (int*)fZZ;}
Int_t* GetNN() {return (int*)fNN;}
Int_t GetNalpha() {return fNalpha;}
Int_t GetZtot() {return fZtot;}
Int_t GetNtot() {return fNtot;}
protected:
Float_t fB; // Impact parameter
Float_t fZbAverage; // Mean value of Z bound
Int_t fNimf; // Number of IMF
Float_t fZmax; // Mean value of maximum Z of fragment
Float_t fTau; // Exponent of charge distribution: dN/dZ = Z*exp(-fTau)
Int_t fZZ[100]; // Array of atomic numbers of fragments
Int_t fNN[100]; // Array of number of neutrons of fragments
Int_t fNalpha; // Number of alpha particles
Int_t fZtot; // Total number of bound protons
Int_t fNtot; // Total number of bound neutrons
TF1 *fZboundvsbOO; // Parametrization of Zbound vs. b for O nucleus
ClassDef(AliZDCFragment,2) // Generator for AliZDC fragment class
};
#endif
|
// Copyright (c) 2012 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 CONTENT_BROWSER_SYSTEM_MESSAGE_WINDOW_WIN_H_
#define CONTENT_BROWSER_SYSTEM_MESSAGE_WINDOW_WIN_H_
#include <windows.h>
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "content/common/content_export.h"
class CONTENT_EXPORT SystemMessageWindowWin {
public:
SystemMessageWindowWin();
virtual ~SystemMessageWindowWin();
virtual LRESULT OnDeviceChange(UINT event_type, LPARAM data);
private:
void Init();
LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
WPARAM wparam, LPARAM lparam);
static LRESULT CALLBACK WndProcThunk(HWND hwnd,
UINT message,
WPARAM wparam,
LPARAM lparam) {
SystemMessageWindowWin* msg_wnd = reinterpret_cast<SystemMessageWindowWin*>(
GetWindowLongPtr(hwnd, GWLP_USERDATA));
if (msg_wnd)
return msg_wnd->WndProc(hwnd, message, wparam, lparam);
return ::DefWindowProc(hwnd, message, wparam, lparam);
}
HMODULE instance_;
HWND window_;
class DeviceNotifications;
scoped_ptr<DeviceNotifications> device_notifications_;
DISALLOW_COPY_AND_ASSIGN(SystemMessageWindowWin);
};
#endif // CONTENT_BROWSER_SYSTEM_MESSAGE_WINDOW_WIN_H_
|
/*
* Copyright (C) 2014 Google Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 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 APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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 TreeScopeEventContext_h
#define TreeScopeEventContext_h
#include "core/CoreExport.h"
#include "core/dom/Node.h"
#include "core/dom/TreeScope.h"
#include "core/events/EventTarget.h"
#include "wtf/PassRefPtr.h"
#include "wtf/RefPtr.h"
#include "wtf/Vector.h"
namespace blink {
class EventPath;
class EventTarget;
class Node;
template <typename NodeType> class StaticNodeTypeList;
using StaticNodeList = StaticNodeTypeList<Node>;
class TouchEventContext;
class TreeScope;
class CORE_EXPORT TreeScopeEventContext final : public RefCountedWillBeGarbageCollected<TreeScopeEventContext> {
DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(TreeScopeEventContext);
public:
static PassRefPtrWillBeRawPtr<TreeScopeEventContext> create(TreeScope&);
DECLARE_TRACE();
TreeScope& treeScope() const { return *m_treeScope; }
Node& rootNode() const { return *m_rootNode; }
EventTarget* target() const { return m_target.get(); }
void setTarget(PassRefPtrWillBeRawPtr<EventTarget>);
EventTarget* relatedTarget() const { return m_relatedTarget.get(); }
void setRelatedTarget(PassRefPtrWillBeRawPtr<EventTarget>);
TouchEventContext* touchEventContext() const { return m_touchEventContext.get(); }
TouchEventContext* ensureTouchEventContext();
WillBeHeapVector<RefPtrWillBeMember<EventTarget>>& ensureEventPath(EventPath&);
bool isInclusiveAncestorOf(const TreeScopeEventContext&) const;
bool isDescendantOf(const TreeScopeEventContext&) const;
#if ENABLE(ASSERT)
bool isExclusivePartOf(const TreeScopeEventContext&) const;
#endif
void addChild(TreeScopeEventContext& child) { m_children.append(&child); }
// For ancestor-descendant relationship check in O(1).
// Preprocessing takes O(N).
int calculateTreeOrderAndSetNearestAncestorClosedTree(int orderNumber, TreeScopeEventContext* nearestAncestorClosedTreeScopeEventContext);
TreeScopeEventContext* containingClosedShadowTree() const { return m_containingClosedShadowTree.get(); }
private:
TreeScopeEventContext(TreeScope&);
#if ENABLE(ASSERT)
bool isUnreachableNode(EventTarget&);
#endif
bool isUnclosedTreeOf(const TreeScopeEventContext& other);
RawPtrWillBeMember<TreeScope> m_treeScope;
RefPtrWillBeMember<Node> m_rootNode; // Prevents TreeScope from being freed. TreeScope itself isn't RefCounted.
RefPtrWillBeMember<EventTarget> m_target;
RefPtrWillBeMember<EventTarget> m_relatedTarget;
OwnPtrWillBeMember<WillBeHeapVector<RefPtrWillBeMember<EventTarget>>> m_eventPath;
RefPtrWillBeMember<TouchEventContext> m_touchEventContext;
RawPtrWillBeMember<TreeScopeEventContext> m_containingClosedShadowTree;
WillBeHeapVector<RawPtrWillBeMember<TreeScopeEventContext>> m_children;
int m_preOrder;
int m_postOrder;
};
#if ENABLE(ASSERT)
inline bool TreeScopeEventContext::isUnreachableNode(EventTarget& target)
{
// FIXME: Checks also for SVG elements.
return target.toNode() && !target.toNode()->isSVGElement() && !target.toNode()->treeScope().isInclusiveOlderSiblingShadowRootOrAncestorTreeScopeOf(treeScope());
}
#endif
inline void TreeScopeEventContext::setTarget(PassRefPtrWillBeRawPtr<EventTarget> target)
{
ASSERT(target);
ASSERT(!isUnreachableNode(*target));
m_target = target;
}
inline void TreeScopeEventContext::setRelatedTarget(PassRefPtrWillBeRawPtr<EventTarget> relatedTarget)
{
ASSERT(relatedTarget);
ASSERT(!isUnreachableNode(*relatedTarget));
m_relatedTarget = relatedTarget;
}
inline bool TreeScopeEventContext::isInclusiveAncestorOf(const TreeScopeEventContext& other) const
{
ASSERT(m_preOrder != -1 && m_postOrder != -1 && other.m_preOrder != -1 && other.m_postOrder != -1);
return m_preOrder <= other.m_preOrder && other.m_postOrder <= m_postOrder;
}
inline bool TreeScopeEventContext::isDescendantOf(const TreeScopeEventContext& other) const
{
ASSERT(m_preOrder != -1 && m_postOrder != -1 && other.m_preOrder != -1 && other.m_postOrder != -1);
return other.m_preOrder < m_preOrder && m_postOrder < other.m_postOrder;
}
#if ENABLE(ASSERT)
inline bool TreeScopeEventContext::isExclusivePartOf(const TreeScopeEventContext& other) const
{
ASSERT(m_preOrder != -1 && m_postOrder != -1 && other.m_preOrder != -1 && other.m_postOrder != -1);
return (m_preOrder < other.m_preOrder && m_postOrder < other.m_preOrder)
|| (m_preOrder > other.m_preOrder && m_preOrder > other.m_postOrder);
}
#endif
} // namespace blink
#endif // TreeScopeEventContext_h
|
/*
* TI Voxel Lib component.
*
* Copyright (c) 2014 Texas Instruments Inc.
*/
#ifndef VOXEL_UVCPRIVATE_LINUX_H
#define VOXEL_UVCPRIVATE_LINUX_H
#include "Common.h"
#include "Device.h"
#include "UVC.h"
namespace Voxel
{
/**
* \addtogroup IO
* @{
*/
class UVCPrivate
{
protected:
int _fd = -1;
String _deviceNode;
DevicePtr _usb;
Vector<UVCRawData> _mappedRawData;
bool _munmap(UVCRawData &data);
public:
UVCPrivate(DevicePtr usb);
inline bool isInitialized() { return _fd >= 0; }
int xioctl(int request, void *arg);
bool read(uint8_t *buffer, std::size_t size);
bool mmap(uint32_t offset, UVCRawData &data);
bool clearMMap();
// timeout in milli-seconds
bool isReadReady(TimeStampType timeout, bool &timedOut);
virtual ~UVCPrivate();
};
/**
* @}
*/
}
#endif // UVCPRIVATE_H
|
//===-- R600MachineScheduler.h - R600 Scheduler Interface -*- C++ -*-------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
/// \file
/// R600 Machine Scheduler interface
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIB_TARGET_AMDGPU_R600MACHINESCHEDULER_H
#define LLVM_LIB_TARGET_AMDGPU_R600MACHINESCHEDULER_H
#include "llvm/CodeGen/MachineScheduler.h"
#include <vector>
using namespace llvm;
namespace llvm {
class R600InstrInfo;
struct R600RegisterInfo;
class R600SchedStrategy final : public MachineSchedStrategy {
const ScheduleDAGMILive *DAG = nullptr;
const R600InstrInfo *TII = nullptr;
const R600RegisterInfo *TRI = nullptr;
MachineRegisterInfo *MRI = nullptr;
enum InstKind {
IDAlu,
IDFetch,
IDOther,
IDLast
};
enum AluKind {
AluAny,
AluT_X,
AluT_Y,
AluT_Z,
AluT_W,
AluT_XYZW,
AluPredX,
AluTrans,
AluDiscarded, // LLVM Instructions that are going to be eliminated
AluLast
};
std::vector<SUnit *> Available[IDLast], Pending[IDLast];
std::vector<SUnit *> AvailableAlus[AluLast];
std::vector<SUnit *> PhysicalRegCopy;
InstKind CurInstKind;
int CurEmitted;
InstKind NextInstKind;
unsigned AluInstCount;
unsigned FetchInstCount;
int InstKindLimit[IDLast];
int OccupedSlotsMask;
public:
R600SchedStrategy() = default;
~R600SchedStrategy() override = default;
void initialize(ScheduleDAGMI *dag) override;
SUnit *pickNode(bool &IsTopNode) override;
void schedNode(SUnit *SU, bool IsTopNode) override;
void releaseTopNode(SUnit *SU) override;
void releaseBottomNode(SUnit *SU) override;
private:
std::vector<MachineInstr *> InstructionsGroupCandidate;
bool VLIW5;
int getInstKind(SUnit *SU);
bool regBelongsToClass(unsigned Reg, const TargetRegisterClass *RC) const;
AluKind getAluKind(SUnit *SU) const;
void LoadAlu();
unsigned AvailablesAluCount() const;
SUnit *AttemptFillSlot (unsigned Slot, bool AnyAlu);
void PrepareNextSlot();
SUnit *PopInst(std::vector<SUnit*> &Q, bool AnyALU);
void AssignSlot(MachineInstr *MI, unsigned Slot);
SUnit* pickAlu();
SUnit* pickOther(int QID);
void MoveUnits(std::vector<SUnit *> &QSrc, std::vector<SUnit *> &QDst);
};
} // end namespace llvm
#endif // LLVM_LIB_TARGET_AMDGPU_R600MACHINESCHEDULER_H
|
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_BROWSER_TRACING_BACKGROUND_TRACING_MANAGER_IMPL_H_
#define CONTENT_BROWSER_TRACING_BACKGROUND_TRACING_MANAGER_IMPL_H_
#include <memory>
#include "base/lazy_instance.h"
#include "base/macros.h"
#include "base/memory/ref_counted_memory.h"
#include "base/memory/weak_ptr.h"
#include "base/metrics/histogram.h"
#include "content/browser/tracing/background_tracing_config_impl.h"
#include "content/browser/tracing/tracing_controller_impl.h"
#include "content/public/browser/background_tracing_manager.h"
namespace content {
class BackgroundTracingRule;
class TraceMessageFilter;
class TracingDelegate;
class BackgroundTracingManagerImpl : public BackgroundTracingManager {
public:
static CONTENT_EXPORT BackgroundTracingManagerImpl* GetInstance();
bool SetActiveScenario(std::unique_ptr<BackgroundTracingConfig>,
const ReceiveCallback&,
DataFiltering data_filtering) override;
void WhenIdle(IdleCallback idle_callback) override;
void TriggerNamedEvent(TriggerHandle, StartedFinalizingCallback) override;
TriggerHandle RegisterTriggerType(const char* trigger_name) override;
void OnHistogramTrigger(const std::string& histogram_name);
void OnRuleTriggered(const BackgroundTracingRule* triggered_rule,
StartedFinalizingCallback callback);
void AbortScenario();
bool HasActiveScenario() override;
// For tests
void InvalidateTriggerHandlesForTesting() override;
void SetTracingEnabledCallbackForTesting(
const base::Closure& callback) override;
CONTENT_EXPORT void SetRuleTriggeredCallbackForTesting(
const base::Closure& callback);
void FireTimerForTesting() override;
CONTENT_EXPORT bool IsTracingForTesting();
private:
BackgroundTracingManagerImpl();
~BackgroundTracingManagerImpl() override;
void StartTracing(std::string, base::trace_event::TraceRecordMode);
void StartTracingIfConfigNeedsIt();
void OnFinalizeStarted(std::unique_ptr<const base::DictionaryValue> metadata,
base::RefCountedString*);
void OnFinalizeComplete();
void BeginFinalizing(StartedFinalizingCallback);
void ValidateStartupScenario();
void AddCustomMetadata(TracingControllerImpl::TraceDataSink*) const;
std::string GetTriggerNameFromHandle(TriggerHandle handle) const;
bool IsTriggerHandleValid(TriggerHandle handle) const;
BackgroundTracingRule* GetRuleAbleToTriggerTracing(
TriggerHandle handle) const;
bool IsSupportedConfig(BackgroundTracingConfigImpl* config);
std::string GetCategoryFilterStringForCategoryPreset(
BackgroundTracingConfigImpl::CategoryPreset) const;
class TracingTimer {
public:
explicit TracingTimer(StartedFinalizingCallback);
~TracingTimer();
void StartTimer(int seconds);
void CancelTimer();
void FireTimerForTesting();
private:
void TracingTimerFired();
base::OneShotTimer tracing_timer_;
StartedFinalizingCallback callback_;
};
std::unique_ptr<TracingDelegate> delegate_;
std::unique_ptr<const content::BackgroundTracingConfigImpl> config_;
std::map<TriggerHandle, std::string> trigger_handles_;
std::unique_ptr<TracingTimer> tracing_timer_;
ReceiveCallback receive_callback_;
bool is_gathering_;
bool is_tracing_;
bool requires_anonymized_data_;
int trigger_handle_ids_;
TriggerHandle triggered_named_event_handle_;
IdleCallback idle_callback_;
base::Closure tracing_enabled_callback_for_testing_;
base::Closure rule_triggered_callback_for_testing_;
friend struct base::DefaultLazyInstanceTraits<BackgroundTracingManagerImpl>;
DISALLOW_COPY_AND_ASSIGN(BackgroundTracingManagerImpl);
};
} // namespace content
#endif // CONTENT_BROWSER_TRACING_BACKGROUND_TRACING_MANAGER_IMPL_H_
|
/*-
* Copyright (c) 2010 Isilon Systems, Inc.
* Copyright (c) 2010 iX Systems, Inc.
* Copyright (c) 2010 Panasas, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice unmodified, 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.
*/
#ifndef _LINUX_TIMER_H_
#define _LINUX_TIMER_H_
#include <linux/types.h>
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/callout.h>
struct timer_list {
struct callout timer_callout;
void (*function)(unsigned long);
unsigned long data;
unsigned long expires;
};
static inline void
_timer_fn(void *context)
{
struct timer_list *timer;
timer = context;
timer->function(timer->data);
}
#define setup_timer(timer, func, dat) \
do { \
(timer)->function = (func); \
(timer)->data = (dat); \
callout_init(&(timer)->timer_callout, CALLOUT_MPSAFE); \
} while (0)
#define init_timer(timer) \
do { \
(timer)->function = NULL; \
(timer)->data = 0; \
callout_init(&(timer)->timer_callout, CALLOUT_MPSAFE); \
} while (0)
#define mod_timer(timer, exp) \
do { \
(timer)->expires = (exp); \
callout_reset(&(timer)->timer_callout, (exp) - jiffies, \
_timer_fn, (timer)); \
} while (0)
#define add_timer(timer) \
callout_reset(&(timer)->timer_callout, \
(timer)->expires - jiffies, _timer_fn, (timer))
#define del_timer(timer) callout_stop(&(timer)->timer_callout)
#define del_timer_sync(timer) callout_drain(&(timer)->timer_callout)
#define timer_pending(timer) callout_pending(&(timer)->timer_callout)
static inline unsigned long
round_jiffies(unsigned long j)
{
return roundup(j, hz);
}
#endif /* _LINUX_TIMER_H_ */
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_NET_CONNECT_INTERCEPTOR_H_
#define CHROME_BROWSER_NET_CONNECT_INTERCEPTOR_H_
#include "base/gtest_prod_util.h"
#include "base/memory/mru_cache.h"
#include "base/time.h"
#include "net/url_request/url_request_job_factory.h"
namespace chrome_browser_net {
class Predictor;
//------------------------------------------------------------------------------
// An interceptor to monitor URLRequests so that we can do speculative DNS
// resolution and/or speculative TCP preconnections.
class ConnectInterceptor : public net::URLRequestJobFactory::Interceptor {
public:
// Construction includes registration as an URL.
explicit ConnectInterceptor(Predictor* predictor);
// Destruction includes unregistering.
virtual ~ConnectInterceptor();
protected:
// Overridden from net::URLRequest::Interceptor:
// Learn about referrers, and optionally preconnect based on history.
virtual net::URLRequestJob* MaybeIntercept(
net::URLRequest* request,
net::NetworkDelegate* network_delegate) const OVERRIDE;
virtual net::URLRequestJob* MaybeInterceptResponse(
net::URLRequest* request,
net::NetworkDelegate* network_delegate) const OVERRIDE;
virtual net::URLRequestJob* MaybeInterceptRedirect(
const GURL& location,
net::URLRequest* request,
net::NetworkDelegate* network_delegate) const OVERRIDE;
private:
// Provide access to local class TimedCache for testing.
FRIEND_TEST_ALL_PREFIXES(ConnectInterceptorTest, TimedCacheRecall);
FRIEND_TEST_ALL_PREFIXES(ConnectInterceptorTest, TimedCacheEviction);
// Define a LRU cache that recalls all navigations within the last N seconds.
// When we learn about subresources to possibly preconnect to, it would be a
// waste to preconnect when the original navigation was too long ago. Any
// connected, but unused TCP/IP connection, will generally be reset by the
// server if it is not used quickly (i.e., GET or POST is sent).
class TimedCache {
public:
explicit TimedCache(const base::TimeDelta& max_duration);
~TimedCache();
// Evicts any entries that have been in the FIFO "too long," and then checks
// to see if the given url is (still) in the FIFO cache.
bool WasRecentlySeen(const GURL& url) const;
// Adds the given url to the cache, where it will remain for max_duration_.
void SetRecentlySeen(const GURL& url) const;
private:
// Our cache will be keyed on a URL (actually, just a scheme/host/port).
// We will always track the time it was last added to the FIFO cache by
// remembering a TimeTicks value.
typedef base::MRUCache<GURL, base::TimeTicks> UrlMruTimedCache;
// mru_cache_ has to be mutable in order to be accessed from the overriden
// URLRequestJob functions. It is mutable because it tracks the urls and
// caches them.
mutable UrlMruTimedCache mru_cache_;
// The longest time an entry can persist in the cache, and still be found.
const base::TimeDelta max_duration_;
DISALLOW_COPY_AND_ASSIGN(TimedCache);
};
TimedCache timed_cache_;
Predictor* const predictor_;
DISALLOW_COPY_AND_ASSIGN(ConnectInterceptor);
};
} // namespace chrome_browser_net
#endif // CHROME_BROWSER_NET_CONNECT_INTERCEPTOR_H_
|
/*
* Copyright 2012 Samsung Electronics Co., Ltd.
* http://www.samsung.com/
*
* Header file for tmu support
*
* 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.
*/
#ifndef __ASM_ARCH_TMU_H
#define __ASM_ARCH_TMU_H
#define MUX_ADDR_VALUE 6
#define TMU_SAVE_NUM 10
#define TMU_DC_VALUE 25
#define EFUSE_MIN_VALUE 40
#define EFUSE_MAX_VALUE 100
#define UNUSED_THRESHOLD 0xFF
enum tmu_status_t {
TMU_STATUS_INIT = 0,
TMU_STATUS_NORMAL,
TMU_STATUS_THROTTLED,
TMU_STATUS_TRIPPED,
};
enum tmu_noti_state_t {
TMU_COLD,
TMU_NORMAL,
TMU_HOT,
TMU_CRITICAL,
};
struct temperature_params {
unsigned int stop_throttle;
unsigned int start_throttle;
unsigned int start_tripping; /* temp to do tripping */
unsigned int start_emergency;
unsigned int stop_mem_throttle;
unsigned int start_mem_throttle;
};
struct tmu_data {
struct temperature_params ts;
unsigned int efuse_value;
unsigned int slope;
int mode;
};
struct tmu_info {
int id;
void __iomem *tmu_base;
struct device *dev;
struct resource *ioarea;
int irq;
unsigned int te1; /* triminfo_25 */
unsigned int te2; /* triminfo_85 */
int tmu_state;
bool mem_throttled;
unsigned int auto_refresh_mem_throttle;
unsigned int auto_refresh_normal;
/* monitoring rate */
unsigned int sampling_rate;
struct delayed_work polling;
struct delayed_work monitor;
unsigned int reg_save[TMU_SAVE_NUM];
};
extern void exynos_tmu_set_platdata(struct tmu_data *pd);
extern struct tmu_info *exynos_tmu_get_platdata(void);
extern int exynos_tmu_get_irqno(int num);
extern struct platform_device exynos_device_tmu;
#ifdef CONFIG_EXYNOS_THERMAL
extern int exynos_tmu_add_notifier(struct notifier_block *n);
#else
static inline int exynos_tmu_add_notifier(struct notifier_block *n)
{
return 0;
}
#endif
#endif /* __ASM_ARCH_TMU_H */
|
//
// LinkedInAuthorizationViewController.h
// linkedinDemo
//
// Created by Ahmet Kazım Günay on 26/03/15.
// Copyright (c) 2015 ahmetkgunay. All rights reserved.
//
@class LinkedInServiceManager;
#import <UIKit/UIKit.h>
@interface LinkedInAuthorizationViewController : UIViewController
/*!
* @brief Initialize AuthorizationVC with service Manager
* @param manager the service manager that can handle url connections
*/
- (instancetype)initWithServiceManager:(LinkedInServiceManager *)manager;
/*!
* @brief Cancel Button's text while getting AuthorizationCode via webview (default is Close)
*/
@property (nonatomic, copy) NSString *cancelButtonText;
/*!
* @brief Returns successful user info which are requested via grantedAccess
*/
@property (nonatomic, copy) void (^authorizationCodeSuccessCallback)(NSString *code);
/*!
* @brief Returns the cancel statement of connection because of user canceled the auth
*/
@property (nonatomic, copy) void (^authorizationCodeCancelCallback)(void);
/*!
* @brief Returns the failure statement of connection
*/
@property (nonatomic, copy) void (^authorizationCodeFailureCallback)(NSError *err);
/*!
* @brief Yes if automaticly shows the activity indicator on the webview while getting authorization code
*/
@property (nonatomic, assign) BOOL showActivityIndicator;
@end
|
//
// Matrix3x3d.h
// iosvr
//
#ifndef __IOSVR__MATRIX3X3D__
#define __IOSVR__MATRIX3X3D__
#include "Vector3d.h"
#include <GLKit/GLKMatrix3.h>
namespace iosvr
{
class Matrix3x3d
{
public:
Matrix3x3d();
Matrix3x3d(double m00, double m01, double m02,
double m10, double m11, double m12,
double m20, double m21, double m22);
Matrix3x3d(Matrix3x3d *o);
void set(double m00, double m01, double m02,
double m10, double m11, double m12,
double m20, double m21, double m22);
void set(Matrix3x3d *o);
void setZero();
void setIdentity();
void setSameDiagonal(double d);
double get(int row, int col);
void set(int row, int col, double value);
void getColumn(int col, Vector3d *v);
void setColumn(int col, Vector3d *v);
void scale(double s);
void plusEquals(Matrix3x3d *b);
void minusEquals(Matrix3x3d *b);
void transpose();
void transpose(Matrix3x3d *result);
static void add(Matrix3x3d *a, Matrix3x3d *b, Matrix3x3d *result);
static void mult(Matrix3x3d *a, Matrix3x3d *b, Matrix3x3d *result);
static void mult(Matrix3x3d *a, Vector3d *v, Vector3d *result);
double determinant();
bool invert(Matrix3x3d *result);
GLKMatrix3 getGLKMatrix();
private:
double _m[9];
};
}
#endif // |
/*! sp804 counter (timer device) */
#ifdef SP804
#include "sp804.h"
#include <arch/interrupt.h>
#include <kernel/errno.h>
static void sp804_init ();
static void sp804_set ( uint cnt );
static uint sp804_get ();
static void sp804_enable_interrupt ();
static void sp804_disable_interrupt ();
static void sp804_register_interrupt ( void *handler );
static void sp804_set_time_to_counter ( timespec_t *time );
static void sp804_get_time_from_counter ( timespec_t *time );
static void (*sp804_handler) ();
/*! timer device sp804, wrapper for arch_timer_t interface */
arch_timer_t sp804 = (arch_timer_t)
{
.min_interval = { 0, 0 },
.max_interval = { 0, 0 },
.init = sp804_init,
.set_interval = sp804_set_time_to_counter,
.get_interval_remainder = sp804_get_time_from_counter,
.enable_interrupt = sp804_enable_interrupt,
.disable_interrupt = sp804_disable_interrupt,
.register_interrupt = sp804_register_interrupt
};
/* accessed from 'arch' layer via: extern arch_timer_t sp804 */
/*! Calculate min and max counting interval, and set initial counter */
static void sp804_init ()
{
volatile uint32 *ptr;
sp804_handler = NULL;
COUNT_TO_TIME ( ISP804_COUNT_MIN, &sp804.min_interval );
COUNT_TO_TIME ( ISP804_COUNT_MAX, &sp804.max_interval );
/* disable interrupt generation on timer1 */
ptr = (uint32 *) ( TIMER1_BASE + TIMER_CONTROL );
*ptr = *ptr & ( ~TIMER_INT_ENABLE );
/* set parameters for timer0 */
ptr = (uint32 *) ( TIMER0_BASE + TIMER_CONTROL );
*ptr = TIMER_SIZE_32;
sp804_set ( ISP804_COUNT_MAX );
*ptr = TIMER_ENABLE | TIMER_MODE_PERIODIC | TIMER_SIZE_32;
/* just don't generate interrupts yet */
/* enable interrupt on VIC */
arch_irq_enable ( TIMER01 + IRQ_OFFSET );
}
/*! Load sp804 counter with 'cnt' */
static void sp804_set ( uint cnt )
{
volatile uint32 *ptr;
ptr = (uint32 *) ( TIMER0_BASE + TIMER_LOAD );
*ptr = cnt;
}
/*! Read sp804 counter (its current value) */
static uint sp804_get ()
{
volatile uint32 *ptr;
ptr = (uint32 *) ( TIMER0_BASE + TIMER_VALUE );
return *ptr;
}
/*! Load counter with number equivalent to 'time' */
static void sp804_set_time_to_counter ( timespec_t *time )
{
uint cnt;
ASSERT ( time && time_cmp ( time, &sp804.max_interval ) <= 0 &&
time_cmp ( time, &sp804.min_interval ) >= 0 );
TIME_TO_COUNT ( time, cnt );
sp804_set ( cnt );
}
/*! Read current value from counter and convert it into 'time' */
static void sp804_get_time_from_counter ( timespec_t *time )
{
uint cnt;
ASSERT ( time );
cnt = sp804_get();
COUNT_TO_TIME ( cnt, time );
}
/*! Enable counter interrupts */
static void sp804_enable_interrupt ()
{
volatile uint32 *ptr;
/* enable interrupt generation on timer0 */
ptr = (uint32 *) ( TIMER0_BASE + TIMER_CONTROL );
*ptr = *ptr | TIMER_INT_ENABLE;
}
/*! Disable counter interrupts */
static void sp804_disable_interrupt ()
{
volatile uint32 *ptr;
/* disable interrupt generation on timer0 */
ptr = (uint32 *) ( TIMER0_BASE + TIMER_CONTROL );
*ptr = *ptr & ( ~TIMER_INT_ENABLE );
}
/* internal timer handler */
static void sp804_interrupt_handler ()
{
volatile uint32 *ptr;
/* clear interrupt request */
ptr = (uint32 *) ( TIMER0_BASE + TIMER_INTCLR );
*ptr = 0;
if ( sp804_handler )
sp804_handler ();
}
/*! Register function for counter interrupts */
static void sp804_register_interrupt ( void *handler )
{
sp804_handler = handler;
arch_register_interrupt_handler ( TIMER01 + IRQ_OFFSET,
sp804_interrupt_handler );
}
#endif /* SP804 */
|
/*
Implementation by the Keccak, Keyak and Ketje Teams, namely, Guido Bertoni,
Joan Daemen, Michaël Peeters, Gilles Van Assche and Ronny Van Keer, hereby
denoted as "the implementer".
For more information, feedback or questions, please refer to our websites:
http://keccak.noekeon.org/
http://keyak.noekeon.org/
http://ketje.noekeon.org/
To the extent possible under law, the implementer has waived all copyright
and related or neighboring rights to the source code in this file.
http://creativecommons.org/publicdomain/zero/1.0/
*/
#ifndef _SnP_Interface_h_
#define _SnP_Interface_h_
#include "KeccakF-1600-interface.h"
#include "SnP-FBWL-default.h"
#define SnP_width KeccakF_width
#define SnP_stateSizeInBytes KeccakF_stateSizeInBytes
#define SnP_laneLengthInBytes KeccakF_laneInBytes
#define SnP_laneCount 25
#define SnP_StaticInitialize KeccakF1600_Initialize
#define SnP_Initialize KeccakF1600_StateInitialize
#define SnP_XORBytes KeccakF1600_StateXORBytes
#define SnP_OverwriteBytes KeccakF1600_StateOverwriteBytes
#define SnP_OverwriteWithZeroes KeccakF1600_StateOverwriteWithZeroes
#define SnP_ComplementBit KeccakF1600_StateComplementBit
#define SnP_Permute KeccakF1600_StatePermute
#define SnP_ExtractBytes KeccakF1600_StateExtractBytes
#define SnP_ExtractAndXORBytes KeccakF1600_StateExtractAndXORBytes
#define SnP_FBWL_Absorb SnP_FBWL_Absorb_Default
#define SnP_FBWL_Squeeze SnP_FBWL_Squeeze_Default
#define SnP_FBWL_Wrap SnP_FBWL_Wrap_Default
#define SnP_FBWL_Unwrap SnP_FBWL_Unwrap_Default
#endif
|
/*
* NTThread.h
*
* Created on: Sep 21, 2012
* Author: Mitchell Wills
*/
#ifndef NTTHREAD_H_
#define NTTHREAD_H_
/**
* Represents a thread in the network tables system
* @author mwills
*
*/
class NTThread
{
public:
virtual ~NTThread()
{
}
;
/**
* stop the thread
*/
virtual void stop() = 0;
/**
* @return true if the thread is running
*/
virtual bool isRunning() = 0;
};
#endif /* NTTHREAD_H_ */
|
#ifndef FS_CONFIG_H__
#define FS_CONFIG_H__
#include <stdint.h>
#include "nrf.h"
/**
* @defgroup fstorage_config FStorage configuration
* @ingroup fstorage
* @{
* @brief FStorage configuration.
*/
/**@brief Macro for max number of operations in the fs cmd queue.
*/
#define FS_CMD_QUEUE_SIZE (8)
/**@brief Macro for max number of retries for a flash command before it notifies as failed.
*/
#define FS_CMD_MAX_RETRIES (3)
/**@brief Macro for the content of a flash address that has not been written to.
*/
#define FS_EMPTY_MASK (0xFFFFFFFF)
/**@brief Macro for flash page size according to chip family
*/
#if defined (NRF51)
#define FS_PAGE_SIZE (1024)
#elif defined (NRF52)
#define FS_PAGE_SIZE (4096)
#else
#error "Device family must be defined. See nrf.h."
#endif
/*@brief Macro for flash page size according to chip family
*/
#define FS_PAGE_SIZE_WORDS (FS_PAGE_SIZE/4)
/**@brief Static inline function that provides last page address
*
* @note If there is a bootloader present the bootloader address read from UICR
* will act as the page beyond the end of the available flash storage
*/
static __INLINE uint32_t fs_flash_page_end_addr()
{
uint32_t const bootloader_addr = NRF_UICR->NRFFW[0];
return ((bootloader_addr != FS_EMPTY_MASK) ?
bootloader_addr : NRF_FICR->CODESIZE * FS_PAGE_SIZE);
}
/**@brief Macro for last page address
*
* @note If there is a bootloader present the bootloader address read from UICR
* will act as the page beyond the end of the available flash storage
*/
#define FS_PAGE_END_ADDR fs_flash_page_end_addr()
/**@brief Macro to describe the write
*
*/
#if defined (NRF51)
#define FS_MAX_WRITE_SIZE_WORDS (256)
#elif defined (NRF52)
#define FS_MAX_WRITE_SIZE_WORDS (1024)
#else
#error "Device family must be defined. see nrf.h"
#endif
/** @} */
#endif // FS_CONFIG_H__
|
/******************************************************************************
*
*
*
* Copyright (C) 1997-2013 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation under the terms of the GNU General Public License is hereby
* granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
* Documents produced by Doxygen are derivative works derived from the
* input used in their production; they are not affected by this license.
*
*/
#ifndef PAGEDEF_H
#define PAGEDEF_H
#include "definition.h"
#include "sortdict.h"
class PageSDict;
class OutputList;
/** @brief A model of a page symbol. */
class PageDef : public Definition
{
public:
PageDef(const char *f,int l,const char *n,const char *d,const char *t);
~PageDef();
// setters
void setFileName(const char *name) { m_fileName = name; }
void setShowToc(bool b);
// getters
DefType definitionType() const { return TypePage; }
bool isLinkableInProject() const
{
return /*hasDocumentation() &&*/ !isReference();
}
bool isLinkable() const
{
return isLinkableInProject() || isReference();
}
// functions to get a uniform interface with Definitions
QCString getOutputFileBase() const;
QCString anchor() const { return QCString(); }
void findSectionsInDocumentation();
QCString title() const { return m_title; }
GroupDef * getGroupDef() const;
PageSDict * getSubPages() const { return m_subPageDict; }
void addInnerCompound(Definition *d);
bool visibleInIndex() const;
bool documentedPage() const;
bool hasSubPages() const;
bool hasParentPage() const;
bool showToc() const { return m_showToc; }
void setPageScope(Definition *d){ m_pageScope = d; }
Definition *getPageScope() const { return m_pageScope; }
QCString displayName(bool=TRUE) const { return !m_title.isEmpty() ? m_title : Definition::name(); }
void writeDocumentation(OutputList &ol);
private:
void setNestingLevel(int l);
void writePageDocumentation(OutputList &ol);
QCString m_fileName;
QCString m_title;
GroupDef *m_inGroup;
PageSDict *m_subPageDict; // list of pages in the group
Definition *m_pageScope;
int m_nestingLevel;
bool m_showToc;
};
class PageSDict : public SDict<PageDef>
{
public:
PageSDict(int size) : SDict<PageDef>(size) {}
virtual ~PageSDict() {}
int compareItems(QCollection::Item i1,QCollection::Item i2)
{
return qstricmp(((PageDef *)i1)->name(),((PageDef *)i2)->name());
}
};
#endif
|
// -*-c++-*-
/* $Id: rpcc.h 1201 2005-11-28 19:20:01Z max $ */
/*
*
* Copyright (C) 1998 David Mazieres (dm@uun.org)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
*/
/*
* netdb.h hack
*
* There is a conflict betwen flex version 2.5.4 and /usr/include/netdb.h
* on Linux. flex generates code that #define's __unused to be empty, but
* in struct gaicb within netdb.h, there is a member field of a struct
* called __unused, which gets blanked out, causing a compile error.
* (Note that netdb.h is included from sysconf.h). Use this hack to
* not include netdb.h for now...
*/
#ifndef _NETDB_H
# define _SKIP_NETDB_H
# define _NETDB_H
#endif
#include "amisc.h"
#ifdef _SKIP_NETDB_H
# undef _NETDB_H
# undef _SKIP_NETDB_H
#endif
/*
* end netdb.h hack
*/
#include "vec.h"
#include "union.h"
#include "qhash.h"
#if 1
#include "aios.h"
#else
#include <iostream.h>
inline ostream &
operator<< (ostream &os, const str &s)
{
return os.write (s.cstr (), s.len ());
}
#define aout cout
#endif
inline const strbuf &
strbuf_cat (const strbuf &sb, char c)
{
suio_copy (sb.tosuio (), &c, 1);
return sb;
}
extern str idprefix;
extern bhash<str> ids;
#define XDR_RETURN "bool_t" // XXX - should be bool
extern int lineno;
extern int printlit;
#undef yyerror
extern int yyerror (str);
#define yyerror yyerror // For some versions of yacc
int yywarn (str);
extern int yylex ();
extern int yyparse ();
extern void checkliterals ();
struct rpc_decl {
str id;
str type;
enum { SCALAR, PTR, ARRAY, VEC } qual;
str bound;
};
struct rpc_const {
str id;
str val;
};
struct rpc_struct {
str id;
vec<rpc_decl> decls;
};
struct rpc_enum {
str id;
vec<rpc_const> tags;
};
struct rpc_utag {
rpc_decl tag;
str swval;
bool tagvalid;
};
struct rpc_union {
str id;
str tagtype;
str tagid;
vec<rpc_utag> cases;
};
struct rpc_arg {
str type;
bool compressed;
};
struct rpc_proc {
str id;
u_int32_t val;
rpc_arg arg;
rpc_arg res;
};
struct rpc_vers {
str id;
u_int32_t val;
vec<rpc_proc> procs;
};
struct rpc_program {
str id;
u_int32_t val;
vec<rpc_vers> vers;
};
struct rpc_namespace {
str id;
vec<rpc_program> progs;
};
struct rpc_sym {
union {
union_entry_base _base;
union_entry<rpc_const> sconst;
union_entry<rpc_decl> stypedef;
union_entry<rpc_struct> sstruct;
union_entry<rpc_enum> senum;
union_entry<rpc_union> sunion;
union_entry<rpc_program> sprogram;
union_entry<str> sliteral;
union_entry<rpc_namespace> snamespace;
};
enum symtype { CONST, STRUCT, UNION, ENUM, TYPEDEF, PROGRAM, LITERAL,
NAMESPACE } type;
rpc_sym () { _base.init (); }
rpc_sym (const rpc_sym &s) : type (s.type) { _base.init (s._base); }
~rpc_sym () { _base.destroy (); }
private:
rpc_sym &operator= (const rpc_sym &n)
{ type = n.type; _base.assign (n._base); return *this; }
public:
symtype gettype () const { return type; }
void settype (symtype t) {
switch (type = t) {
case NAMESPACE:
snamespace.select ();
break;
case CONST:
sconst.select ();
break;
case STRUCT:
sstruct.select ();
break;
case UNION:
sunion.select ();
break;
case ENUM:
senum.select ();
break;
case TYPEDEF:
stypedef.select ();
break;
case PROGRAM:
sprogram.select ();
break;
case LITERAL:
sliteral.select ();
break;
}
}
};
struct YYSTYPE {
u_int32_t num;
struct rpc_arg arg;
struct rpc_decl decl;
struct rpc_const cnst;
::str str;
};
extern YYSTYPE yylval;
typedef vec<rpc_sym> symlist_t;
extern symlist_t symlist;
typedef vec<str> strlist_t;
extern strlist_t litq;
str rpcprog (const rpc_program *, const rpc_vers *);
void genheader (str);
void gencfile (str);
void pswitch (str prefix, const rpc_union *rs, str swarg,
void (*pt) (str, const rpc_union *rs, const rpc_utag *),
str suffix = "\n",
void (*defac) (str, const rpc_union *rs) = NULL);
#define XML_OBJ "XML_RPC_obj_t"
extern bool guess_defines;
extern bool skip_xml;
str stripfname (str s, bool suffix = true);
rpc_program *get_prog (bool creat);
str make_csafe_filename (str fname);
str make_constant_collect_hook (str fname);
|
/*
* Use SYS_CLK as system clock
*
* Copyright (c) 2005-2006 Kolja Waschk, rtemsdev/ixo.de
*/
#include <rtems.h>
#include <bsp.h>
#define CLOCK_REGS ((altera_avalon_timer_regs*)NIOS2_IO_BASE(CLOCK_BASE))
/*
* Periodic interval timer interrupt handler
*/
#define Clock_driver_support_at_tick() \
do { CLOCK_REGS->status = 0; } while(0)
/*
* Attach clock interrupt handler
*/
#define Clock_driver_support_install_isr(_new, _old) \
do { _old = (rtems_isr_entry)set_vector(_new, CLOCK_VECTOR, 1); } while(0)
/*
* Turn off the clock
*/
#define Clock_driver_support_shutdown_hardware() \
do { \
CLOCK_REGS->control = ALTERA_AVALON_TIMER_CONTROL_STOP_MSK; \
} while (0)
/*
* Set up the clock hardware
*/
static void Clock_driver_support_initialize_hardware(void)
{
uint32_t period;
CLOCK_REGS->control = ALTERA_AVALON_TIMER_CONTROL_STOP_MSK;
period = (CLOCK_FREQ/1000000L)*rtems_configuration_get_microseconds_per_tick() - 1;
CLOCK_REGS->period_hi = period >> 16;
CLOCK_REGS->period_lo = period & 0xFFFF;
CLOCK_REGS->control = ALTERA_AVALON_TIMER_CONTROL_ITO_MSK |
ALTERA_AVALON_TIMER_CONTROL_CONT_MSK |
ALTERA_AVALON_TIMER_CONTROL_START_MSK;
NIOS2_IENABLE(1 << CLOCK_VECTOR);
}
#define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
#include "../../../shared/clockdrv_shell.h"
|
/*
* File: intset.c
* Author: Vincent Gramoli <vincent.gramoli@sydney.edu.au>,
* Vasileios Trigonakis <vasileios.trigonakis@epfl.ch>
* Description:
* intset.c is part of ASCYLIB
*
* Copyright (c) 2014 Vasileios Trigonakis <vasileios.trigonakis@epfl.ch>,
* Tudor David <tudor.david@epfl.ch>
* Distributed Programming Lab (LPD), EPFL
*
* ASCYLIB is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, version 2
* of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#include "intset.h"
#define MAXLEVEL 32
sval_t
sl_contains(sl_intset_t *set, skey_t key)
{
sval_t result = 0;
#ifdef SEQUENTIAL /* Unprotected */
int i;
sl_node_t *node, *next;
node = set->head;
for (i = node->toplevel-1; i >= 0; i--)
{
next = node->next[i];
while (next->key < key)
{
node = next;
next = node->next[i];
}
}
node = node->next[0];
result = (node->key == key);
#else /* fraser lock-free */
result = fraser_find(set, key);
#endif
return result;
}
inline int
sl_seq_add(sl_intset_t *set, skey_t key, sval_t val)
{
int i, l, result;
sl_node_t *node, *next;
sl_node_t *preds[MAXLEVEL], *succs[MAXLEVEL];
node = set->head;
for (i = node->toplevel-1; i >= 0; i--)
{
next = node->next[i];
while (next->key < key)
{
node = next;
next = node->next[i];
}
preds[i] = node;
succs[i] = node->next[i];
}
node = node->next[0];
if ((result = (node->key != key)) == 1)
{
l = get_rand_level();
node = sl_new_simple_node(key, val, l, 1);
for (i = 0; i < l; i++)
{
node->next[i] = succs[i];
preds[i]->next[i] = node;
}
}
return result;
}
int
sl_add(sl_intset_t *set, skey_t key, sval_t val)
{
int result = 0;
#ifdef SEQUENTIAL
result = sl_seq_add(set, key, val);
#else /* fraser lock-free */
result = fraser_insert(set, key, val);
#endif
return result;
}
sval_t
sl_remove(sl_intset_t *set, skey_t key)
{
sval_t result = 0;
#ifdef SEQUENTIAL
int i;
sl_node_t *node, *next = NULL;
sl_node_t *preds[MAXLEVEL], *succs[MAXLEVEL];
node = set->head;
for (i = node->toplevel-1; i >= 0; i--)
{
next = node->next[i];
while (next->key < key)
{
node = next;
next = node->next[i];
}
preds[i] = node;
succs[i] = node->next[i];
}
if ((result = (next->key == key)) == 1)
{
for (i = 0; i < set->head->toplevel; i++)
if (succs[i]->key == key)
preds[i]->next[i] = succs[i]->next[i];
sl_delete_node(next);
}
#else
result = fraser_remove(set, key);
#endif
return result;
}
|
#ifndef UTF8_UTIL_H
#define UTF8_UTIL_H
/**
* UTF-8 utility functions
*
* (c) 2010 Steve Bennett <steveb@workware.net.au>
*
* See LICENCE for licence details.
*/
#include <jim-config.h>
/* Currently we support unicode points up to 2^22-1 */
#define MAX_UTF8_LEN 4
/**
* Converts the given unicode codepoint (0 - 0x1fffff) to utf-8
* and stores the result at 'p'.
*
* Returns the number of utf-8 characters (up to MAX_UTF8_LEN).
*/
int utf8_fromunicode(char *p, unsigned uc);
#ifndef JIM_UTF8
#include <ctype.h>
/* No utf-8 support. 1 byte = 1 char */
#define utf8_strlen(S, B) ((B) < 0 ? strlen(S) : (B))
#define utf8_tounicode(S, CP) (*(CP) = (unsigned char)*(S), 1)
#define utf8_upper(C) toupper(C)
#define utf8_title(C) toupper(C)
#define utf8_lower(C) tolower(C)
#define utf8_index(C, I) (I)
#define utf8_charlen(C) 1
#define utf8_prev_len(S, L) 1
#else
#if !defined(JIM_BOOTSTRAP)
/**
* Returns the length of the utf-8 sequence starting with 'c'.
*
* Returns 1-4, or -1 if this is not a valid start byte.
*
* Note that charlen=4 is not supported by the rest of the API.
*/
int utf8_charlen(int c);
/**
* Returns the number of characters in the utf-8
* string of the given byte length.
*
* Any bytes which are not part of an valid utf-8
* sequence are treated as individual characters.
*
* The string *must* be null terminated.
*
* Does not support unicode code points > \u1fffff
*/
int utf8_strlen(const char *str, int bytelen);
/**
* Returns the byte index of the given character in the utf-8 string.
*
* The string *must* be null terminated.
*
* This will return the byte length of a utf-8 string
* if given the char length.
*/
int utf8_index(const char *str, int charindex);
/**
* Returns the unicode codepoint corresponding to the
* utf-8 sequence 'str'.
*
* Stores the result in *uc and returns the number of bytes
* consumed.
*
* If 'str' is null terminated, then an invalid utf-8 sequence
* at the end of the string will be returned as individual bytes.
*
* If it is not null terminated, the length *must* be checked first.
*
* Does not support unicode code points > \u1fffff
*/
int utf8_tounicode(const char *str, int *uc);
/**
* Returns the number of bytes before 'str' that the previous
* utf-8 character sequence starts (which may be the middle of a sequence).
*
* Looks back at most 'len' bytes backwards, which must be > 0.
* If no start char is found, returns -len
*/
int utf8_prev_len(const char *str, int len);
/**
* Returns the upper-case variant of the given unicode codepoint.
*
* Unicode code points > \uffff are returned unchanged.
*/
int utf8_upper(int uc);
/**
* Returns the title-case variant of the given unicode codepoint.
*
* If none, returns utf8_upper().
*
* Unicode code points > \uffff are returned unchanged.
*/
int utf8_title(int uc);
/**
* Returns the lower-case variant of the given unicode codepoint.
*
* NOTE: Use utf8_upper() in preference for case-insensitive matching.
*
* Unicode code points > \uffff are returned unchanged.
*/
int utf8_lower(int uc);
#endif /* JIM_BOOTSTRAP */
#endif
#endif
|
/* /kernel/arch/arm/mach-msm/leds-iyokan.c
*
* Copyright (C) [2010] Sony Ericsson Mobile Communications AB.
*
* 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; either version 2
* of the License, or (at your option) any later version.
*/
#include <linux/leds-as3676.h>
#include <linux/leds.h>
static struct as3676_platform_led as3676_leds_mapping[] = {
{
.name = "lcd-backlight",
.sinks = BIT(AS3676_SINK_01),
.flags = AS3676_FLAG_PWM_CTRL | AS3676_FLAG_PWM_INIT
| AS3676_FLAG_WAIT_RESUME,
.max_current = 20000,
.hw_max_current = 25000,
.default_brightness = LED_FULL,
},
{
.name = "button-backlight",
.sinks = BIT(AS3676_SINK_RGB1),
.max_current = 4000,
.hw_max_current = 25000,
},
{
.name = "keyboard-backlight",
.sinks = BIT(AS3676_SINK_32) | BIT(AS3676_SINK_33),
.max_current = 38000,
.hw_max_current = 38000,
},
{
.name = "red",
.sinks = BIT(AS3676_SINK_41),
.flags = AS3676_FLAG_RGB | AS3676_FLAG_BLINK,
.max_current = 2000,
.hw_max_current = 25000,
},
{
.name = "green",
.sinks = BIT(AS3676_SINK_42),
.flags = AS3676_FLAG_RGB | AS3676_FLAG_BLINK,
.max_current = 2000,
.hw_max_current = 25000,
},
{
.name = "blue",
.sinks = BIT(AS3676_SINK_43),
.flags = AS3676_FLAG_RGB | AS3676_FLAG_BLINK,
.max_current = 2000,
.hw_max_current = 25000,
},
};
struct as3676_platform_data as3676_platform_data = {
.leds = as3676_leds_mapping,
.num_leds = ARRAY_SIZE(as3676_leds_mapping),
.als_connected = 1,
.als_wait = 100,
.dls_connected = false,
.ldo_mV = 3300,
};
|
/* -*- linux-c -*-
*
* $Id: sysrq.h,v 1.1.1.1 2010/04/15 12:28:23 khchen Exp $
*
* Linux Magic System Request Key Hacks
*
* (c) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
*
* (c) 2000 Crutcher Dunnavant <crutcher+kernel@datastacks.com>
* overhauled to use key registration
* based upon discusions in irc://irc.openprojects.net/#kernelnewbies
*/
#ifndef _LINUX_SYSRQ_H
#define _LINUX_SYSRQ_H
#include <linux/errno.h>
#include <linux/types.h>
/* Enable/disable SYSRQ support by default (0==no, 1==yes). */
#define SYSRQ_DEFAULT_ENABLE 1
/* Possible values of bitmask for enabling sysrq functions */
/* 0x0001 is reserved for enable everything */
#define SYSRQ_ENABLE_LOG 0x0002
#define SYSRQ_ENABLE_KEYBOARD 0x0004
#define SYSRQ_ENABLE_DUMP 0x0008
#define SYSRQ_ENABLE_SYNC 0x0010
#define SYSRQ_ENABLE_REMOUNT 0x0020
#define SYSRQ_ENABLE_SIGNAL 0x0040
#define SYSRQ_ENABLE_BOOT 0x0080
#define SYSRQ_ENABLE_RTNICE 0x0100
struct sysrq_key_op {
void (*handler)(int);
char *help_msg;
char *action_msg;
int enable_mask;
};
#ifdef CONFIG_MAGIC_SYSRQ
/* Generic SysRq interface -- you may call it from any device driver, supplying
* ASCII code of the key, pointer to registers and kbd/tty structs (if they
* are available -- else NULL's).
*/
void handle_sysrq(int key);
void __handle_sysrq(int key, bool check_mask);
int register_sysrq_key(int key, struct sysrq_key_op *op);
int unregister_sysrq_key(int key, struct sysrq_key_op *op);
struct sysrq_key_op *__sysrq_get_key_op(int key);
int sysrq_toggle_support(int enable_mask);
#else
static inline void handle_sysrq(int key)
{
}
static inline void __handle_sysrq(int key, bool check_mask)
{
}
static inline int register_sysrq_key(int key, struct sysrq_key_op *op)
{
return -EINVAL;
}
static inline int unregister_sysrq_key(int key, struct sysrq_key_op *op)
{
return -EINVAL;
}
#endif
#endif /* _LINUX_SYSRQ_H */
|
/*
* mallets.h - tuned instruments that one would bang upon
*
* Copyright (c) 2006-2008 Danny McRae <khjklujn/at/users.sourceforge.net>
*
*
* This file is part of LMMS - https://lmms.io
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _MALLET_H
#define _MALLET_H
#include "Instrmnt.h"
#include "ComboBox.h"
#include "Instrument.h"
#include "InstrumentView.h"
#include "Knob.h"
#include "NotePlayHandle.h"
#include "LedCheckbox.h"
// As of Stk 4.4 all classes and types have been moved to the namespace "stk".
// However in older versions this namespace does not exist, therefore declare it
// so this plugin builds with all versions of Stk.
namespace stk { } ;
using namespace stk;
static const int MALLETS_PRESET_VERSION = 1;
class malletsSynth
{
public:
// ModalBar
malletsSynth( const StkFloat _pitch,
const StkFloat _velocity,
const StkFloat _control1,
const StkFloat _control2,
const StkFloat _control4,
const StkFloat _control8,
const StkFloat _control11,
const int _control16,
const uint8_t _delay,
const sample_rate_t _sample_rate );
// TubeBell
malletsSynth( const StkFloat _pitch,
const StkFloat _velocity,
const int _preset,
const StkFloat _control1,
const StkFloat _control2,
const StkFloat _control4,
const StkFloat _control11,
const StkFloat _control128,
const uint8_t _delay,
const sample_rate_t _sample_rate );
// BandedWG
malletsSynth( const StkFloat _pitch,
const StkFloat _velocity,
const StkFloat _control2,
const StkFloat _control4,
const StkFloat _control11,
const int _control16,
const StkFloat _control64,
const StkFloat _control128,
const uint8_t _delay,
const sample_rate_t _sample_rate );
inline ~malletsSynth()
{
if (m_voice) {m_voice->noteOff(0.0);}
delete[] m_delay;
delete m_voice;
}
inline sample_t nextSampleLeft()
{
if( m_voice == NULL )
{
return( 0.0f );
}
else
{
StkFloat s = m_voice->tick();
m_delay[m_delayWrite] = s;
m_delayWrite++;
return( s );
}
}
inline sample_t nextSampleRight()
{
StkFloat s = m_delay[m_delayRead];
m_delayRead++;
return( s );
}
inline void setFrequency( const StkFloat _pitch )
{
if( m_voice )
{
m_voice->setFrequency( _pitch );
}
}
protected:
Instrmnt * m_voice;
StkFloat * m_delay;
uint8_t m_delayRead;
uint8_t m_delayWrite;
};
class malletsInstrument : public Instrument
{
Q_OBJECT
public:
malletsInstrument( InstrumentTrack * _instrument_track );
virtual ~malletsInstrument();
virtual void playNote( NotePlayHandle * _n,
sampleFrame * _working_buffer );
virtual void deleteNotePluginData( NotePlayHandle * _n );
virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
virtual void loadSettings( const QDomElement & _this );
virtual QString nodeName() const;
virtual PluginView * instantiateView( QWidget * _parent );
private:
FloatModel m_hardnessModel;
FloatModel m_positionModel;
FloatModel m_vibratoGainModel;
FloatModel m_vibratoFreqModel;
FloatModel m_stickModel;
FloatModel m_modulatorModel;
FloatModel m_crossfadeModel;
FloatModel m_lfoSpeedModel;
FloatModel m_lfoDepthModel;
FloatModel m_adsrModel;
FloatModel m_pressureModel;
FloatModel m_motionModel;
FloatModel m_vibratoModel;
FloatModel m_velocityModel;
BoolModel m_strikeModel;
ComboBoxModel m_presetsModel;
FloatModel m_spreadModel;
IntModel m_versionModel;
BoolModel m_isOldVersionModel;
QVector<sample_t> m_scalers;
bool m_filesMissing;
friend class malletsInstrumentView;
} ;
class malletsInstrumentView: public InstrumentView
{
Q_OBJECT
public:
malletsInstrumentView( malletsInstrument * _instrument,
QWidget * _parent );
virtual ~malletsInstrumentView();
public slots:
void changePreset();
private:
virtual void modelChanged();
void setWidgetBackground( QWidget * _widget, const QString & _pic );
QWidget * setupModalBarControls( QWidget * _parent );
QWidget * setupTubeBellControls( QWidget * _parent );
QWidget * setupBandedWGControls( QWidget * _parent );
QWidget * m_modalBarWidget;
Knob * m_hardnessKnob;
Knob * m_positionKnob;
Knob * m_vibratoGainKnob;
Knob * m_vibratoFreqKnob;
Knob * m_stickKnob;
QWidget * m_tubeBellWidget;
Knob * m_modulatorKnob;
Knob * m_crossfadeKnob;
Knob * m_lfoSpeedKnob;
Knob * m_lfoDepthKnob;
Knob * m_adsrKnob;
QWidget * m_bandedWGWidget;
Knob * m_pressureKnob;
// Knob * m_motionKnob;
// Knob * m_vibratoKnob;
Knob * m_velocityKnob;
// LedCheckBox * m_strikeLED;
ComboBox * m_presetsCombo;
Knob * m_spreadKnob;
};
#endif
|
/* Copyright (C) 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
The GNU C 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.
The GNU C 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 the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <fenv.h>
#include <math.h>
#include <math_private.h>
/* wrapper acosl */
long double
__acosl (long double x)
{
if (__builtin_expect (fabsl (x) > 1.0L, 0) && _LIB_VERSION != _IEEE_)
{
/* acos(|x|>1) */
feraiseexcept (FE_INVALID);
return __kernel_standard (x, x, 201);
}
return __ieee754_acosl (x);
}
weak_alias (__acosl, acosl)
|
/*
* Copyright (c) 2007 Neil Jagdish Patel <njpatel@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <pygobject.h>
#include <cairo/cairo.h>
#include <pycairo.h>
#include <gtk/gtk.h>
#include <libawn/awn-applet.h>
#include <libawn/awn-applet-simple.h>
#include <libawn/awn-defines.h>
#include <libawn/awn-cairo-utils.h>
#include <libawn/awn-enum-types.h>
#include <libawn/awn-effects.h>
#include <libawn/awn-tooltip.h>
/* the following symbols are declared in awn.c: */
void pyawn_add_constants (PyObject *module, const gchar *strip_prefix);
void pyawn_register_classes (PyObject *d);
extern PyMethodDef pyawn_functions[];
Pycairo_CAPI_t *Pycairo_CAPI;
void sink_awnoverlay (GObject *object)
{
if (g_object_is_floating (object))
{
g_object_ref_sink (object);
}
}
DL_EXPORT (void)
initawn (void)
{
PyObject *m, *d;
init_pygobject ();
Pycairo_IMPORT;
if (PyImport_ImportModule ("gtk") == NULL) {
PyErr_SetString (PyExc_ImportError,
"could not import gtk");
return;
}
pygobject_register_sinkfunc (AWN_TYPE_OVERLAY, sink_awnoverlay);
m = Py_InitModule ("awn", pyawn_functions);
d = PyModule_GetDict (m);
pyawn_register_classes (d);
pyawn_add_constants (m, "AWN_");
PyModule_AddIntConstant (m, "PANEL_ID_DEFAULT", AWN_PANEL_ID_DEFAULT);
if (PyErr_Occurred ()) {
Py_FatalError ("unable to initialise awn module");
}
}
|
/* Copyright (C) 2013-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C 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.
The GNU C 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 the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
#include <shlib-compat.h>
#include <gmon/mcount.c>
/* We forgot to add _mcount in glibc 2.17. We added it in 2.18
therefore we want it to be added with version GLIBC_2_18. However,
setting the version is not straight forward because a generic
Version file includes an earlier 2.xx version for each this symbol
and the linker uses the first version it sees. */
#if SHLIB_COMPAT (libc, GLIBC_2_17, GLIBC_2_18)
versioned_symbol (libc, __mcount, _mcount, GLIBC_2_18);
#else
strong_alias (__mcount, _mcount);
#endif
|
//------------------------------------------------------------------------------
// Copyright (c) 2004-2015 Darby Johnston
// 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 names of the copyright holders nor the names of any
// 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
// SUBSTITUE 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 djvViewViewActions.h
#ifndef DJV_VIEW_VIEW_ACTIONS_H
#define DJV_VIEW_VIEW_ACTIONS_H
#include <djvViewAbstractActions.h>
struct djvViewViewActionsPrivate;
//! \addtogroup djvViewView
//@{
//------------------------------------------------------------------------------
//! \class djvViewViewActions
//!
//! This class provides the view group actions.
//------------------------------------------------------------------------------
class DJV_VIEW_LIB_EXPORT djvViewViewActions : public djvViewAbstractActions
{
Q_OBJECT
Q_ENUMS(ACTION)
Q_ENUMS(GROUP)
public:
//! This enumeration provides the actions.
enum ACTION
{
LEFT,
RIGHT,
UP,
DOWN,
CENTER,
ZOOM_IN,
ZOOM_OUT,
ZOOM_RESET,
RESET,
FIT,
HUD,
ACTION_COUNT
};
//! This enumeration provides the action groups.
enum GROUP
{
GRID_GROUP,
GROUP_COUNT
};
//! Constructor.
explicit djvViewViewActions(djvViewContext *, QObject * parent = 0);
//! Destructor.
virtual ~djvViewViewActions();
private Q_SLOTS:
void update();
private:
DJV_PRIVATE_COPY(djvViewViewActions);
djvViewViewActionsPrivate * _p;
};
//@} // djvViewView
#endif // DJV_VIEW_VIEW_ACTIONS_H
|
/******************************************************************
* S-BOX for Twister
*
*
*******************************************************************/
#include "config.h"
#include <stdint.h>
#ifndef TWISTER_TABLES_H_
#define TWISTER_TABLES_H_
extern const uint8_t twister_sbox[256];
#ifndef TWISTER_MUL_TABLE
/* Twister MDS matrix */
extern const uint8_t twister_mds[8][8];
#else
extern const uint8_t twister_mds[8][8];
extern const uint8_t twister_multab[8][256];
#endif
#endif
|
/*
* File :hw_i2c.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2018-01-04 Sundm75 the first version
*/
#include <rtthread.h>
#include <rtdevice.h>
#include "ls1c_i2c.h"
#include "../libraries/ls1c_pin.h"
#ifdef RT_USING_I2C
struct ls1c_i2c_bus
{
struct rt_i2c_bus_device parent;
rt_uint32_t u32Module;
};
rt_size_t rt_i2c_master_xfer(struct rt_i2c_bus_device *bus,
struct rt_i2c_msg *msgs,
rt_uint32_t num)
{
struct ls1c_i2c_bus * i2c_bus = (struct ls1c_i2c_bus *)bus;
ls1c_i2c_info_t i2c_info;
struct rt_i2c_msg *msg;
int i;
rt_int32_t ret = RT_EOK;
i2c_info.clock = 50000; // 50kb/s
i2c_info.I2Cx = i2c_bus->u32Module;
i2c_init(&i2c_info);
for (i = 0; i < num; i++)
{
msg = &msgs[i];
if (msg->flags == RT_I2C_RD)
{
i2c_send_start_and_addr(&i2c_info, msg->addr, LS1C_I2C_DIRECTION_READ);
i2c_receive_ack(&i2c_info);
i2c_receive_data(&i2c_info, (rt_uint8_t *)msg->buf, msg->len);
i2c_send_stop(&i2c_info);
}
else if(msg->flags == RT_I2C_WR)
{
i2c_send_start_and_addr(&i2c_info, msg->addr, LS1C_I2C_DIRECTION_WRITE);
i2c_receive_ack(&i2c_info);
i2c_send_data(&i2c_info, (rt_uint8_t *)msg->buf, msg->len);
i2c_send_stop(&i2c_info);
}
ret++;
}
return ret;
}
rt_err_t rt_i2c_bus_control(struct rt_i2c_bus_device *bus,
rt_uint32_t cmd,
rt_uint32_t arg)
{
struct ls1c_i2c_bus * i2c_bus = (struct ls1c_i2c_bus *)bus;
RT_ASSERT(bus != RT_NULL);
i2c_bus = (struct ls1c_i2c_bus *)bus->parent.user_data;
RT_ASSERT(i2c_bus != RT_NULL);
switch (cmd)
{
case RT_DEVICE_CTRL_CONFIG :
break;
}
return RT_EOK;
}
static const struct rt_i2c_bus_device_ops ls1c_i2c_ops =
{
rt_i2c_master_xfer,
RT_NULL,
rt_i2c_bus_control
};
#ifdef RT_USING_I2C0
static struct ls1c_i2c_bus ls1c_i2c_bus_0 =
{
{1},
LS1C_I2C_0,
};
#endif
#ifdef RT_USING_I2C1
static struct ls1c_i2c_bus ls1c_i2c_bus_1 =
{
{1},
LS1C_I2C_1,
};
#endif
#ifdef RT_USING_I2C2
static struct ls1c_i2c_bus ls1c_i2c_bus_2 =
{
{1},
LS1C_I2C_2,
};
#endif
int ls1c_hw_i2c_init(void)
{
struct ls1c_i2c_bus* ls1c_i2c;
#ifdef RT_USING_I2C0
/*
pin_set_purpose(2, PIN_PURPOSE_OTHER);
pin_set_purpose(3, PIN_PURPOSE_OTHER);
pin_set_remap(2, PIN_REMAP_SECOND);
pin_set_remap(3, PIN_REMAP_SECOND);
*/
#endif
#ifdef RT_USING_I2C1
pin_set_purpose(2, PIN_PURPOSE_OTHER);
pin_set_purpose(3, PIN_PURPOSE_OTHER);
pin_set_remap(2, PIN_REMAP_SECOND);
pin_set_remap(3, PIN_REMAP_SECOND);
#endif
#ifdef RT_USING_I2C2
pin_set_purpose(51, PIN_PURPOSE_OTHER);
pin_set_purpose(50, PIN_PURPOSE_OTHER);
pin_set_remap(51, PIN_REMAP_FOURTH);
pin_set_remap(50, PIN_REMAP_FOURTH);
#endif
#ifdef RT_USING_I2C0
ls1c_i2c = &ls1c_i2c_bus_0;
ls1c_i2c->parent.ops = &ls1c_i2c_ops;
rt_i2c_bus_device_register(&ls1c_i2c->parent, "i2c0");
rt_kprintf("i2c0_init!\n");
#endif
#ifdef RT_USING_I2C1
ls1c_i2c = &ls1c_i2c_bus_1;
ls1c_i2c->parent.ops = &ls1c_i2c_ops;
rt_i2c_bus_device_register(&ls1c_i2c->parent, "i2c1");
rt_kprintf("i2c1_init!\n");
#endif
#ifdef RT_USING_I2C2
ls1c_i2c = &ls1c_i2c_bus_2;
ls1c_i2c->parent.ops = &ls1c_i2c_ops;
rt_i2c_bus_device_register(&ls1c_i2c->parent, "i2c2");
rt_kprintf("i2c2_init!\n");
#endif
return RT_EOK;
}
INIT_BOARD_EXPORT(ls1c_hw_i2c_init);
#endif
|
#ifndef MUDLET_TMXPTAGPARSER_H
#define MUDLET_TMXPTAGPARSER_H
/***************************************************************************
* Copyright (C) 2020 by Gustavo Sousa - gustavocms@gmail.com *
* Copyright (C) 2020 by Stephen Lyons - slysven@virginmedia.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "MxpTag.h"
#include "pre_guard.h"
#include <QList>
#include <QSharedPointer>
#include <QString>
#include "post_guard.h"
class TMxpTagParser
{
public:
static QList<QSharedPointer<MxpNode>> parseToMxpNodeList(const QString& tagText, bool ignoreText = false);
};
#endif //MUDLET_TMXPTAGPARSER_H
|
/* color_utils.h
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef COLOR_UTILS_H
#define COLOR_UTILS_H
#include <config.h>
#include <glib.h>
#include <epan/color_filters.h>
#include <QBrush>
#include <QColor>
#include <QObject>
class ColorUtils : public QObject
{
Q_OBJECT
public:
explicit ColorUtils(QObject *parent = 0);
static QColor fromColorT(const color_t *color);
static QColor fromColorT(color_t color);
static const color_t toColorT(const QColor color);
static QRgb alphaBlend(const QColor &color1, const QColor &color2, qreal alpha);
static QRgb alphaBlend(const QBrush &brush1, const QBrush &brush2, qreal alpha);
// ...because they don't really fit anywhere else?
static const QColor expert_color_comment; /* green */
static const QColor expert_color_chat; /* light blue */
static const QColor expert_color_note; /* bright turquoise */
static const QColor expert_color_warn; /* yellow */
static const QColor expert_color_error; /* pale red */
static const QColor expert_color_foreground; /* black */
static const QColor hidden_proto_item; /* gray */
static const QList<QRgb> graphColors() { return graph_colors_; }
static QRgb graphColor(int item) { return graph_colors_[item % graph_colors_.size()]; }
signals:
public slots:
private:
static const QList<QRgb> graph_colors_;
};
void color_filter_qt_add_cb(color_filter_t *colorf, gpointer user_data);
#endif // COLOR_UTILS_H
/*
* Editor modelines
*
* Local Variables:
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* ex: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/
|
/* This testcase is part of GDB, the GNU debugger.
Copyright 1998-2020 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/*
* Test program for tracing; circular buffer
*/
int n = 6;
int testload[13];
static void func0(void)
{
}
static void func1(void)
{
}
static void func2(void)
{
}
static void func3(void)
{
}
static void func4(void)
{
}
static void func5(void)
{
}
static void func6(void)
{
}
static void func7(void)
{
}
static void func8(void)
{
}
static void func9(void)
{
}
static void begin () /* called before anything else */
{
}
static void end () /* called after everything else */
{
}
int
main (argc, argv, envp)
int argc;
char *argv[], **envp;
{
int i;
begin ();
for (i = 0; i < sizeof(testload) / sizeof(testload[0]); i++)
testload[i] = i + 1;
func0 ();
func1 ();
func2 ();
func3 ();
func4 ();
func5();
func6 ();
func7 ();
func8 ();
func9 ();
end ();
return 0;
}
|
/* Use libjpeg instead of builtin jpeg decoder. */
/* #undef ENABLE_LIBJPEG */
/* Have FreeType2 include files */
#define HAVE_FREETYPE_H 1
/* Use splash for rendering. */
#define HAVE_SPLASH 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Enable multithreading support. */
#define MULTITHREADED 1
/* Poppler data dir */
#define POPPLER_DATADIR "poppler-data"
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Enable word list support. */
#define TEXTOUT_WORD_LIST 1
/* Throw exceptions to deal with not enough memory and similar problems */
/* #undef USE_EXCEPTIONS */
#define snprintf _snprintf
#define unlink _unlink
#define fileno _fileno
#define setmode _setmode
|
/*
* This file is part of the API Extractor project.
*
* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
*
* Contact: PySide team <contact@pyside.org>
*
* 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.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
#ifndef TESTREMOVEFIELD_H
#define TESTREMOVEFIELD_H
#include <QObject>
class TestRemoveField : public QObject
{
Q_OBJECT
private slots:
void testRemoveField();
};
#endif
|
/*
* Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2014 Vladimir Golovnev <glassez@yandex.ru>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*/
#ifndef WEBAPPLICATION_H
#define WEBAPPLICATION_H
#include <QStringList>
#include "abstractwebapplication.h"
class WebApplication: public AbstractWebApplication
{
Q_DISABLE_COPY(WebApplication)
public:
explicit WebApplication(QObject* parent = 0);
private:
// Actions
void action_public_webui();
void action_public_index();
void action_public_login();
void action_public_logout();
void action_public_theme();
void action_public_images();
void action_query_torrents();
void action_query_preferences();
void action_query_transferInfo();
void action_query_propertiesGeneral();
void action_query_propertiesTrackers();
void action_query_propertiesWebSeeds();
void action_query_propertiesFiles();
void action_query_getLog();
void action_query_getPeerLog();
void action_sync_maindata();
void action_sync_torrent_peers();
void action_command_shutdown();
void action_command_download();
void action_command_upload();
void action_command_addTrackers();
void action_command_resumeAll();
void action_command_pauseAll();
void action_command_resume();
void action_command_pause();
void action_command_setPreferences();
void action_command_setFilePrio();
void action_command_getGlobalUpLimit();
void action_command_getGlobalDlLimit();
void action_command_setGlobalUpLimit();
void action_command_setGlobalDlLimit();
void action_command_getTorrentsUpLimit();
void action_command_getTorrentsDlLimit();
void action_command_setTorrentsUpLimit();
void action_command_setTorrentsDlLimit();
void action_command_alternativeSpeedLimitsEnabled();
void action_command_toggleAlternativeSpeedLimits();
void action_command_toggleSequentialDownload();
void action_command_toggleFirstLastPiecePrio();
void action_command_setSuperSeeding();
void action_command_setForceStart();
void action_command_delete();
void action_command_deletePerm();
void action_command_increasePrio();
void action_command_decreasePrio();
void action_command_topPrio();
void action_command_bottomPrio();
void action_command_recheck();
void action_command_setCategory();
void action_command_addCategory();
void action_command_removeCategories();
void action_command_getSavePath();
void action_version_api();
void action_version_api_min();
void action_version_qbittorrent();
typedef void (WebApplication::*Action)();
QString scope_;
QString action_;
QStringList args_;
void processRequest();
bool isPublicScope();
void parsePath();
static QMap<QString, QMap<QString, Action> > initializeActions();
static QMap<QString, QMap<QString, Action> > actions_;
};
#endif // WEBAPPLICATION_H
|
#ifndef LETS_SPLIT_H
#define LETS_SPLIT_H
#ifdef SUBPROJECT_rev1
#include "rev1.h"
#endif
#ifdef SUBPROJECT_rev2
#include "rev2.h"
#endif
// Used to create a keymap using only KC_ prefixed keys
#define KC_KEYMAP( \
L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \
L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \
L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \
L30, L31, L32, L33, L34, L35, R30, R31, R32, R33, R34, R35 \
) \
KEYMAP( \
KC_##L00, KC_##L01, KC_##L02, KC_##L03, KC_##L04, KC_##L05, KC_##R00, KC_##R01, KC_##R02, KC_##R03, KC_##R04, KC_##R05, \
KC_##L10, KC_##L11, KC_##L12, KC_##L13, KC_##L14, KC_##L15, KC_##R10, KC_##R11, KC_##R12, KC_##R13, KC_##R14, KC_##R15, \
KC_##L20, KC_##L21, KC_##L22, KC_##L23, KC_##L24, KC_##L25, KC_##R20, KC_##R21, KC_##R22, KC_##R23, KC_##R24, KC_##R25, \
KC_##L30, KC_##L31, KC_##L32, KC_##L33, KC_##L34, KC_##L35, KC_##R30, KC_##R31, KC_##R32, KC_##R33, KC_##R34, KC_##R35 \
)
#include "quantum.h"
#endif |
/* $Id$ */
#ifndef __EKG_RC_RC_H
#define __EKG_RC_RC_H
typedef enum {
RC_INPUT_PIPE = 1, /* pipe:/home/user/.ekg/pipe */
RC_INPUT_UDP, /* udp:12345 */
RC_INPUT_TCP, /* tcp:12345 */
RC_INPUT_UNIX, /* unix:/home/user/.ekg/socket */
RC_INPUT_TCP_CLIENT,
RC_INPUT_UNIX_CLIENT
} rc_input_type_t;
typedef struct {
rc_input_type_t type; /* rodzaj wej¶cia */
char *path; /* ¶cie¿ka */
int fd; /* deskryptor */
int mark; /* do zaznaczania, wnêtrzno¶ci */
} rc_input_t;
int rc_input_new_tcp(const char *path);
int rc_input_new_udp(const char *path);
int rc_input_new_pipe(const char *path);
int rc_input_new_unix(const char *path);
#endif /* __EKG_RC_RC_H */
/*
* Local Variables:
* mode: c
* c-file-style: "k&r"
* c-basic-offset: 8
* indent-tabs-mode: t
* End:
*/
|
/****************************************************************************
**
** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** Commercial Usage
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License versions 2.0 or 3.0 as published by the Free
** Software Foundation and appearing in the file LICENSE.GPL included in
** the packaging of this file. Please review the following information
** to ensure GNU General Public Licensing requirements will be met:
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html. In addition, as a special
** exception, Nokia gives you certain additional rights. These rights
** are described in the Nokia Qt GPL Exception version 1.3, included in
** the file GPL_EXCEPTION.txt in this package.
**
** Qt for Windows(R) Licensees
** As a special exception, Nokia, as the sole copyright holder for Qt
** Designer, grants users of the Qt/Eclipse Integration plug-in the
** right for the Qt/Eclipse Integration to link to functionality
** provided by Qt Designer and its related libraries.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
****************************************************************************/
#ifndef QFRAME_P_H
#define QFRAME_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include "private/qwidget_p.h"
#include "qframe.h"
QT_BEGIN_NAMESPACE
class Q_GUI_EXPORT QFramePrivate : public QWidgetPrivate
{
Q_DECLARE_PUBLIC(QFrame)
public:
QFramePrivate();
void updateFrameWidth();
void updateStyledFrameWidths();
QRect frect;
int frameStyle;
short lineWidth;
short midLineWidth;
short frameWidth;
short leftFrameWidth, rightFrameWidth;
short topFrameWidth, bottomFrameWidth;
short oldFrameStyle;
inline void init();
};
QT_END_NAMESPACE
#endif // QFRAME_P_H
|
/*
* Scheduler code and data structures related to cpufreq.
*
* Copyright (C) 2016, Intel Corporation
* Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
*
* 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.
*/
#ifdef CONFIG_SCHED_MUQSS
#include "MuQSS.h"
#else
#include "sched.h"
#endif
DEFINE_PER_CPU(struct update_util_data *, cpufreq_update_util_data);
/**
* cpufreq_add_update_util_hook - Populate the CPU's update_util_data pointer.
* @cpu: The CPU to set the pointer for.
* @data: New pointer value.
* @func: Callback function to set for the CPU.
*
* Set and publish the update_util_data pointer for the given CPU.
*
* The update_util_data pointer of @cpu is set to @data and the callback
* function pointer in the target struct update_util_data is set to @func.
* That function will be called by cpufreq_update_util() from RCU-sched
* read-side critical sections, so it must not sleep. @data will always be
* passed to it as the first argument which allows the function to get to the
* target update_util_data structure and its container.
*
* The update_util_data pointer of @cpu must be NULL when this function is
* called or it will WARN() and return with no effect.
*/
void cpufreq_add_update_util_hook(int cpu, struct update_util_data *data,
void (*func)(struct update_util_data *data, u64 time,
unsigned int flags))
{
if (WARN_ON(!data || !func))
return;
if (WARN_ON(per_cpu(cpufreq_update_util_data, cpu)))
return;
data->func = func;
rcu_assign_pointer(per_cpu(cpufreq_update_util_data, cpu), data);
}
EXPORT_SYMBOL_GPL(cpufreq_add_update_util_hook);
/**
* cpufreq_remove_update_util_hook - Clear the CPU's update_util_data pointer.
* @cpu: The CPU to clear the pointer for.
*
* Clear the update_util_data pointer for the given CPU.
*
* Callers must use RCU-sched callbacks to free any memory that might be
* accessed via the old update_util_data pointer or invoke synchronize_sched()
* right after this function to avoid use-after-free.
*/
void cpufreq_remove_update_util_hook(int cpu)
{
rcu_assign_pointer(per_cpu(cpufreq_update_util_data, cpu), NULL);
}
EXPORT_SYMBOL_GPL(cpufreq_remove_update_util_hook);
|
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
* media and as a part of the software program in whole or part. Users
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
*
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
*
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
*
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
*
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
*
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*/
/*
* xdr_sizeof.c
*
* Copyright 1990 Sun Microsystems, Inc.
*
* General purpose routine to see how much space something will use
* when serialized using XDR.
*/
#include <gssrpc/types.h>
#include <gssrpc/xdr.h>
#include <sys/types.h>
/* ARGSUSED */
static bool_t
x_putlong(xdrs, longp)
XDR *xdrs;
long *longp;
{
xdrs->x_handy += BYTES_PER_XDR_UNIT;
return (TRUE);
}
/* ARGSUSED */
static bool_t
x_putbytes(xdrs, bp, len)
XDR *xdrs;
char *bp;
int len;
{
xdrs->x_handy += len;
return (TRUE);
}
static u_int
x_getpostn(xdrs)
XDR *xdrs;
{
return (xdrs->x_handy);
}
/* ARGSUSED */
static bool_t
x_setpostn(xdrs, pos)
XDR *xdrs;
u_int pos;
{
/* This is not allowed */
return (FALSE);
}
static long *
x_inline(xdrs, len)
XDR *xdrs;
int len;
{
if (len == 0) {
return (NULL);
}
if (xdrs->x_op != XDR_ENCODE) {
return (NULL);
}
if (len < (int) xdrs->x_base) {
/* x_private was already allocated */
xdrs->x_handy += len;
return ((long *) xdrs->x_private);
} else {
/* Free the earlier space and allocate new area */
if (xdrs->x_private)
free(xdrs->x_private);
if ((xdrs->x_private = (caddr_t) malloc(len)) == NULL) {
xdrs->x_base = 0;
return (NULL);
}
xdrs->x_base = (caddr_t) len;
xdrs->x_handy += len;
return ((long *) xdrs->x_private);
}
}
static int
harmless()
{
/* Always return FALSE/NULL, as the case may be */
return (0);
}
static void
x_destroy(xdrs)
XDR *xdrs;
{
xdrs->x_handy = 0;
xdrs->x_base = 0;
if (xdrs->x_private) {
free(xdrs->x_private);
xdrs->x_private = NULL;
}
return;
}
unsigned long
xdr_sizeof(func, data)
xdrproc_t func;
void *data;
{
XDR x;
struct xdr_ops ops;
bool_t stat;
/* to stop ANSI-C compiler from complaining */
typedef bool_t (* dummyfunc1)(XDR *, long *);
typedef bool_t (* dummyfunc2)(XDR *, caddr_t, int);
ops.x_putlong = x_putlong;
ops.x_putbytes = x_putbytes;
ops.x_inline = x_inline;
ops.x_getpostn = x_getpostn;
ops.x_setpostn = x_setpostn;
ops.x_destroy = x_destroy;
/* the other harmless ones */
ops.x_getlong = (dummyfunc1) harmless;
ops.x_getbytes = (dummyfunc2) harmless;
x.x_op = XDR_ENCODE;
x.x_ops = &ops;
x.x_handy = 0;
x.x_private = (caddr_t) NULL;
x.x_base = (caddr_t) 0;
stat = func(&x, data);
if (x.x_private)
free(x.x_private);
return (stat == TRUE ? (unsigned) x.x_handy: 0);
}
|
//============== Networked: IV - http://code.networked-iv.com ==============
//
// File: CSquirrelArguments.h
// Project: Server
// Author(s): mabako
// jenksta
// License: See LICENSE in root directory
//
//==========================================================================
#pragma once
#include <StdInc.h>
#include <squirrel/sqstdaux.h>
#include <squirrel/sqstdblob.h>
#include <squirrel/sqstdio.h>
#include <squirrel/sqstdmath.h>
#include <squirrel/sqstdstring.h>
#include <squirrel/sqstdsystem.h>
class CSquirrelArguments;
class CSquirrelArgument
{
private:
SQObjectType type;
public:
union {
int i;
bool b;
float f;
String* str;
CEntity* pEntity;
CSquirrelArguments* pArray;
} data;
CSquirrelArgument(){type=OT_NULL;}
CSquirrelArgument(int i){type=OT_INTEGER; data.i=i;}
CSquirrelArgument(bool b){type=OT_BOOL; data.b=b;}
CSquirrelArgument(float f){type=OT_FLOAT; data.f=f;}
CSquirrelArgument(String* str){type=OT_STRING; data.str = new String(*str);} // clone the string instead of referencing it
CSquirrelArgument(CEntity* pEntity){type=OT_FUNCPROTO; data.pEntity=pEntity;}
CSquirrelArgument(CSquirrelArguments* pArray, bool isArray);
~CSquirrelArgument();
SQObjectType GetType(){return type;}
bool push(SQVM* pVM);
};
class CSquirrelArguments : public std::list<CSquirrelArgument*>
{
public:
CSquirrelArguments(){}
~CSquirrelArguments(){for(iterator iter = begin(); iter != end(); ++iter){delete *iter;}}
void push_to_vm(SQVM* pVM);
// All kind of push functions
void push();
void push(SQObject o);
void push(int i);
void push(bool b);
void push(float f);
void push(const char* c);
void push(String str);
void push(CEntity* pEntity);
void push(CVector3 vec);
void push(CSquirrelArguments* pArray, bool isArray);
bool pushFromStack(SQVM* pVM, int idx);
void pushFromStack(SQVM* pVM, int startidx, int count);
};
|
/* raid6_recover.c - module to recover from faulty RAID6 arrays. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2006,2007,2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/dl.h>
#include <grub/disk.h>
#include <grub/mm.h>
#include <grub/err.h>
#include <grub/misc.h>
#include <grub/raid.h>
static grub_uint8_t raid6_table1[256][256];
static grub_uint8_t raid6_table2[256][256];
static void
grub_raid_block_mul (grub_uint8_t mul, char *buf, int size)
{
int i;
grub_uint8_t *p;
p = (grub_uint8_t *) buf;
for (i = 0; i < size; i++, p++)
*p = raid6_table1[mul][*p];
}
static void
grub_raid6_init_table (void)
{
int i, j;
for (i = 0; i < 256; i++)
raid6_table1[i][1] = raid6_table1[1][i] = i;
for (i = 2; i < 256; i++)
for (j = i; j < 256; j++)
{
int n;
grub_uint8_t c;
n = i >> 1;
c = raid6_table1[n][j];
c = (c << 1) ^ ((c & 0x80) ? 0x1d : 0);
if (i & 1)
c ^= j;
raid6_table1[j][i] = raid6_table1[i][j] = c;
}
raid6_table2[0][0] = 1;
for (i = 1; i < 256; i++)
raid6_table2[i][i] = raid6_table1[raid6_table2[i - 1][i - 1]][2];
for (i = 0; i < 254; i++)
for (j = 0; j < 254; j++)
{
grub_uint8_t c, n;
int k;
if (i == j)
continue;
k = i - j;
if (k < 0)
k += 255;
c = n = raid6_table2[k][k] ^ 1;
for (k = 0; k < 253; k++)
c = raid6_table1[c][n];
raid6_table2[i][j] = raid6_table1[raid6_table2[255 - j][255 - j]][c];
}
}
static grub_err_t
grub_raid6_recover (struct grub_raid_array *array, int disknr, int p,
char *buf, grub_disk_addr_t sector, int size)
{
int i, q, pos;
int bad1 = -1, bad2 = -1;
char *pbuf = 0, *qbuf = 0;
size <<= GRUB_DISK_SECTOR_BITS;
pbuf = grub_zalloc (size);
if (!pbuf)
goto quit;
qbuf = grub_zalloc (size);
if (!qbuf)
goto quit;
q = p + 1;
if (q == (int) array->total_devs)
q = 0;
pos = q + 1;
if (pos == (int) array->total_devs)
pos = 0;
for (i = 0; i < (int) array->total_devs - 2; i++)
{
if (pos == disknr)
bad1 = i;
else
{
if ((array->members[pos].device) &&
(! grub_disk_read (array->members[pos].device, sector,
0, size, buf)))
{
grub_raid_block_xor (pbuf, buf, size);
grub_raid_block_mul (raid6_table2[i][i], buf, size);
grub_raid_block_xor (qbuf, buf, size);
}
else
{
/* Too many bad devices */
if (bad2 >= 0)
goto quit;
bad2 = i;
grub_errno = GRUB_ERR_NONE;
}
}
pos++;
if (pos == (int) array->total_devs)
pos = 0;
}
/* Invalid disknr or p */
if (bad1 < 0)
goto quit;
if (bad2 < 0)
{
/* One bad device */
if ((array->members[p].device) &&
(! grub_disk_read (array->members[p].device, sector, 0, size, buf)))
{
grub_raid_block_xor (buf, pbuf, size);
goto quit;
}
if (! array->members[q].device)
{
grub_error (GRUB_ERR_READ_ERROR, "not enough disk to restore");
goto quit;
}
grub_errno = GRUB_ERR_NONE;
if (grub_disk_read (array->members[q].device, sector, 0, size, buf))
goto quit;
grub_raid_block_xor (buf, qbuf, size);
grub_raid_block_mul (raid6_table2[255 - bad1][255 - bad1], buf,
size);
}
else
{
/* Two bad devices */
grub_uint8_t c;
if ((! array->members[p].device) || (! array->members[q].device))
{
grub_error (GRUB_ERR_READ_ERROR, "not enough disk to restore");
goto quit;
}
if (grub_disk_read (array->members[p].device, sector, 0, size, buf))
goto quit;
grub_raid_block_xor (pbuf, buf, size);
if (grub_disk_read (array->members[q].device, sector, 0, size, buf))
goto quit;
grub_raid_block_xor (qbuf, buf, size);
c = raid6_table2[bad2][bad1];
grub_raid_block_mul (c, qbuf, size);
c = raid6_table1[raid6_table2[bad2][bad2]][c];
grub_raid_block_mul (c, pbuf, size);
grub_raid_block_xor (pbuf, qbuf, size);
grub_memcpy (buf, pbuf, size);
}
quit:
grub_free (pbuf);
grub_free (qbuf);
return grub_errno;
}
GRUB_MOD_INIT(raid6rec)
{
grub_raid6_init_table ();
grub_raid6_recover_func = grub_raid6_recover;
}
GRUB_MOD_FINI(raid6rec)
{
grub_raid6_recover_func = 0;
}
|
/*
IOHIDService.h ... I/O Kit HID Service
Copyright (c) 2009 KennyTM~ <kennytm@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the KennyTM~ 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.
*/
// With reference to http://www.opensource.apple.com/source/IOHIDFamily/IOHIDFamily-258.1/IOHIDLib/IOHIDEventServiceClass.h
#ifndef IOHID_SERVICE_H
#define IOHID_SERVICE_H
#include <CoreFoundation/CoreFoundation.h>
#include <IOKit/IOKitLib.h>
#include "IOHIDEvent.h"
#include "IOHIDNotification.h"
#if __cplusplus
extern "C" {
#endif
typedef struct __IOHIDService
#if 0
{
CFRuntimeBase _base; // 0, 4
CFTypeRef client; // 8
io_service_t service; // c
void** pluginInterface1; // 10; GUID = D12C833F-B15B-11DA-902D-0014519758EF
void** pluginInterface2; // 14;
IOCFPlugInInterface** interface; // 18
CFRunLoopRef runloop; // 1c
CFStringRef mode; // 20
IONotificationPortRef notify; // 24
CFMutableSetRef removalNotifications; // 2c
void* eventTarget; // 30
void* eventRefcon; // 34
IOHIDServiceEventCallback eventCallback; // 38
uint32_t previousButtonMask; // 3c
}
#endif
* IOHIDServiceRef;
typedef void(*IOHIDServiceEventCallback)(void* target, void* refcon, IOHIDServiceRef service, IOHIDEventRef event);
/*
metaObject->
[0] = NULL
[4] = IOHIDIUnknown::genericQueryInterface(void*, CFUUIDBytes, void**)
[8] = IOHIDIUnknown::genericAddRef(void*)
[0x0c] = IOHIDIUnknown::genericRelease(void*)
[0x10] = IOHIDEventServiceClass::_open(void*, unsigned long)
[0x14] = IOHIDEventServiceClass::_close(void*, unsigned long)
[0x18] = IOHIDEventServiceClass::_getProperty(void*, __CFString const*)
[0x1c] = IOHIDEventServiceClass::_setProperty(void*, __CFString const*, void const*)
[0x20] = IOHIDEventServiceClass::_setEventCallback(void*, void (*)(void*, void*, void*, __IOHIDEvent*, unsigned long), void*, void*)
[0x24] = IOHIDEventServiceClass::_scheduleWithRunLoop(void*, __CFRunLoop*, __CFString const*)
[0x28] = IOHIDEventServiceClass::_unscheduleFromRunLoop(void*, __CFRunLoop*, __CFString const*)
[0x2c] = IOHIDEventServiceClass::_copyEvent(void*, unsigned int, __IOHIDEvent*, unsigned long)
*/
#pragma mark -
#pragma mark Creators
CFTypeID IOHIDServiceGetTypeID(void);
IOHIDServiceRef _IOHIDServiceCreate(CFAllocatorRef allocator, io_service_t service);
#pragma mark -
#pragma mark Accessors
CFTypeRef IOHIDServiceGetProperty(IOHIDServiceRef service, CFStringRef property);
Boolean IOHIDServiceSetProperty(IOHIDServiceRef service, CFStringRef property, CFTypeRef value);
CFTypeRef _IOHIDServiceGetClient(IOHIDServiceRef service);
Boolean _IOHIDServiceMatchPropertyTable(IOHIDServiceRef service, CFDictionaryRef propertyTable);
IOHIDEventRef IOHIDServiceCopyEvent(IOHIDServiceRef service, IOHIDEventType type, IOHIDEventRef event, IOOptionBits options);
void _IOHIDServiceSetEventCallback(IOHIDServiceRef service, IOHIDServiceEventCallback eventCallback, void* target, void* refcon);
#pragma mark -
#pragma mark Actions
void _IOHIDServiceScheduleWithRunLoop(IOHIDServiceRef service, CFRunLoopRef runloop, CFStringRef mode);
void _IOHIDServiceUnscheduleWithRunLoop(IOHIDServiceRef service);
IOHIDNotificationRef IOHIDServiceCreateRemovalNotification(IOHIDServiceRef display, IOHIDNotificationCallback callback, void* target, void* refcon);
Boolean _IOHIDServiceOpen(IOHIDServiceRef service, CFTypeRef client, IOOptionBits options);
Boolean _IOHIDServiceClose(IOHIDServiceRef service, CFTypeRef client, IOOptionBits options);
#if __cplusplus
}
#endif
#endif
|
//
// PNPresenceEvent.h
// pubnub
//
// Object which is used to describe concrete
// presence event which arrived from PubNub
// services.
//
//
// Created by Sergey Mamontov.
//
//
#import <Foundation/Foundation.h>
#import "PNStructures.h"
#pragma mark Class forward
@class PNClient;
@interface PNPresenceEvent : NSObject
#pragma mark - Properties
// Stores reference on presence event type
@property (nonatomic, readonly, assign) PNPresenceEventType type;
// Stores reference on presence occurrence
// date
@property (nonatomic, readonly, strong) PNDate *date;
/**
Stores reference on client for which presence event has been generated.
*/
@property (nonatomic, readonly, strong) PNClient *client;
// Stores reference on number of persons in channel
// on which this event is occurred
@property (nonatomic, readonly, assign) NSUInteger occupancy;
// Stores reference on channel on which this event
// is fired
@property (nonatomic, readonly, assign) PNChannel *channel;
/**
Stores reference on user identifier which is triggered presence event.
Deprecated. Will be DISCARDED in 3.6.0.
*/
@property (nonatomic, readonly, copy) NSString *uuid DEPRECATED_MSG_ATTRIBUTE(" Use 'client.identifier' instead.");
#pragma mark - Class methods
/**
* Will return event object which will describe
* what kind of presence event occurred and provide
* all data from it to the user.
* If multiple presence events will be found in
* provided response this method will return array
* of events.
*/
+ (id)presenceEventForResponse:(id)presenceResponse;
/**
* Allow to check whether specified object is valid
* presence event information object or not
*/
+ (BOOL)isPresenceEventObject:(NSDictionary *)event;
#pragma mark - Instance methods
/**
* Initialize presence event instance from
* PubNub service response
*/
- (id)initWithResponse:(id)presenceResponse;
#pragma mark -
@end
|
#include <sys/time.h>
#include <ctype.h>
#include <stdio.h>
#include <time.h>
#include <string.h>
#include <fcntl.h>
#include <math.h>
#include <assert.h>
#include <stdlib.h>
#include <unistd.h>
#include <termios.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/wait.h>
#include <errno.h>
|
/*
-- ------------------------------------------------------------------------------------------------------------
-- Copyright notice below. Please read.
--
-- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE
-- Copyright(C) 2003-2005: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
--
-- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
-- documentation files (the "Software"), to deal in the Software without restriction, including without
-- limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
-- the Software, and to permit persons to whom the Software is furnished to do so, subject to the following
-- conditions:
--
-- The above copyright notice and this permission notice shall be included in all copies or substantial
-- portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
-- LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
-- EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-- AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
-- OR OTHER DEALINGS IN THE SOFTWARE.
--
-- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
-- ------------------------------------------------------------------------------------------------------------
*/
#if defined __USE_POSIX || defined __unix__ || defined _POSIX_C_SOURCE
int open_descriptor_for_read(char *filename) {
int result;
do
result = open (filename, O_RDONLY);
while (result == -1L && errno == EINTR);
return result;
}
int open_descriptor_for_create(char *filename) {
int result;
do
result = open (filename, O_WRONLY|O_TRUNC|O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
while (result == -1L && errno == EINTR);
return result;
}
int open_descriptor_for_append(char *filename) {
int result;
do
result = open (filename, O_WRONLY|O_APPEND|O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
while (result == -1L && errno == EINTR);
return result;
}
int open_descriptor_succeeded(int descriptor) {
return descriptor >= 0;
}
void close_descriptor(int descriptor) {
int result;
do
result = close (descriptor);
while (result == -1L && errno == EINTR);
}
#else
int open_descriptor_for_read(char *filename) {
return _open (filename, _O_RDONLY);
}
int open_descriptor_for_create(char *filename) {
#ifdef __BORLANDC__
return open (filename, _O_WRONLY|_O_TRUNC|_O_CREAT, _S_IREAD | _S_IWRITE);
#else
return _open (filename, _O_WRONLY|_O_TRUNC|_O_CREAT, _S_IREAD | _S_IWRITE);
#endif
}
int open_descriptor_for_append(char *filename) {
#ifdef __BORLANDC__
return open (filename, _O_WRONLY|_O_APPEND|_O_CREAT, _S_IREAD | _S_IWRITE);
#else
return _open (filename, _O_WRONLY|_O_APPEND|_O_CREAT, _S_IREAD | _S_IWRITE);
#endif
}
int open_descriptor_succeeded(int descriptor) {
return descriptor >= 0;
}
void close_descriptor(int descriptor) {
_close (descriptor);
}
#endif
|
#include "hw_config.h"
#include "flash_device_hal.h"
#include "module_info.h"
#include "module_info_hal.h"
#ifdef __cplusplus
extern "C" {
#endif
/* MAL access layer for Internal/Serial Flash Routines */
//New routines specific for BM09/BM14 flash usage
uint16_t FLASH_SectorToWriteProtect(uint8_t flashDeviceID, uint32_t startAddress);
uint16_t FLASH_SectorToErase(flash_device_t flashDeviceID, uint32_t startAddress);
bool FLASH_CheckValidAddressRange(flash_device_t flashDeviceID, uint32_t startAddress, uint32_t length);
bool FLASH_WriteProtectMemory(flash_device_t flashDeviceID, uint32_t startAddress, uint32_t length, bool protect);
bool FLASH_EraseMemory(flash_device_t flashDeviceID, uint32_t startAddress, uint32_t length);
typedef bool (*copymem_fn_t)(flash_device_t sourceDeviceID, uint32_t sourceAddress,
flash_device_t destinationDeviceID, uint32_t destinationAddress,
uint32_t length, uint8_t module_function, uint8_t flags);
/**
* Determines if the memory copy can be performed.
*/
bool FLASH_CheckCopyMemory(flash_device_t sourceDeviceID, uint32_t sourceAddress,
flash_device_t destinationDeviceID, uint32_t destinationAddress,
uint32_t length, uint8_t module_function, uint8_t flags);
/**
* @param validateDestinationAddress checks if the destination address corresponds with the start address in the module
*/
bool FLASH_CopyMemory(flash_device_t sourceDeviceID, uint32_t sourceAddress,
flash_device_t destinationDeviceID, uint32_t destinationAddress,
uint32_t length, uint8_t module_function, uint8_t flags);
bool FLASH_CompareMemory(flash_device_t sourceDeviceID, uint32_t sourceAddress,
flash_device_t destinationDeviceID, uint32_t destinationAddress,
uint32_t length);
bool FLASH_AddToNextAvailableModulesSlot(flash_device_t sourceDeviceID, uint32_t sourceAddress,
flash_device_t destinationDeviceID, uint32_t destinationAddress,
uint32_t length, uint8_t module_function, uint8_t flags);
bool FLASH_AddToFactoryResetModuleSlot(flash_device_t sourceDeviceID, uint32_t sourceAddress,
flash_device_t destinationDeviceID, uint32_t destinationAddress,
uint32_t length, uint8_t module_function, uint8_t flags);
bool FLASH_IsFactoryResetAvailable(void);
bool FLASH_ClearFactoryResetModuleSlot(void);
bool FLASH_RestoreFromFactoryResetModuleSlot(void);
void FLASH_UpdateModules(void (*flashModulesCallback)(bool isUpdating));
const module_info_t* FLASH_ModuleInfo(uint8_t flashDeviceID, uint32_t startAddress);
uint32_t FLASH_ModuleAddress(flash_device_t flashDeviceID, uint32_t startAddress);
uint32_t FLASH_ModuleLength(flash_device_t flashDeviceID, uint32_t startAddress);
uint16_t FLASH_ModuleVersion(uint8_t flashDeviceID, uint32_t startAddress);
bool FLASH_isUserModuleInfoValid(uint8_t flashDeviceID, uint32_t startAddress, uint32_t expectedAddress);
bool FLASH_VerifyCRC32(flash_device_t flashDeviceID, uint32_t startAddress, uint32_t length);
bool FLASH_InvalidCRC32(flash_device_t flashDeviceID, uint32_t startAddress, uint32_t length);
//Old routines with same signature both for Core and Photon
void FLASH_ClearFlags(void);
void FLASH_Erase(void);
void FLASH_Backup(uint32_t FLASH_Address);
void FLASH_Restore(uint32_t FLASH_Address);
void FLASH_Begin(uint32_t FLASH_Address, uint32_t imageSize);
int FLASH_Update(const uint8_t *pBuffer, uint32_t address, uint32_t bufferSize);
void FLASH_End(void);
#ifdef __cplusplus
}
#endif
|
/*
* Copyright (C) 1999-2001, 2004, 2005, 2007, 2016 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/*
* Principal Author: Brian Wellington
* $Id: dst_lib.c,v 1.5 2007/06/19 23:47:16 tbox Exp $
*/
/*! \file */
#include <config.h>
#include <stddef.h>
#include <isc/once.h>
#include <isc/msgcat.h>
#include <isc/util.h>
#include <dst/lib.h>
/***
*** Globals
***/
LIBDNS_EXTERNAL_DATA isc_msgcat_t * dst_msgcat = NULL;
/***
*** Private
***/
static isc_once_t msgcat_once = ISC_ONCE_INIT;
/***
*** Functions
***/
static void
open_msgcat(void) {
isc_msgcat_open("libdst.cat", &dst_msgcat);
}
void
dst_lib_initmsgcat(void) {
/*
* Initialize the DST library's message catalog, dst_msgcat, if it
* has not already been initialized.
*/
RUNTIME_CHECK(isc_once_do(&msgcat_once, open_msgcat) == ISC_R_SUCCESS);
}
|
//-*****************************************************************************
//
// Copyright (c) 2009-2011,
// Sony Pictures Imageworks Inc. and
// Industrial Light & Magic, a division of Lucasfilm Entertainment Company Ltd.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Industrial Light & Magic nor the names of
// its contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//-*****************************************************************************
#ifndef _Alembic_Util_Dimensions_h_
#define _Alembic_Util_Dimensions_h_
#include <Alembic/Util/Foundation.h>
#include <Alembic/Util/PlainOldDataType.h>
namespace Alembic {
namespace Util {
namespace ALEMBIC_VERSION_NS {
//-*****************************************************************************
template <class T>
class BaseDimensions
{
private:
typedef std::vector<T> SizeVec;
SizeVec m_vector;
public:
// Default is for a rank-0 dimension.
BaseDimensions()
: m_vector()
{}
// When you specify a single thing, you're specifying a rank-1
// dimension of a certain size.
explicit BaseDimensions( const T& t )
: m_vector( 1, t )
{}
BaseDimensions( const BaseDimensions © )
: m_vector( copy.m_vector )
{}
template <class Y>
BaseDimensions( const BaseDimensions<Y> © )
{
m_vector.resize( copy.rank() );
for ( size_t i = 0; i < copy.rank(); ++i )
{
Y val = copy[i];
m_vector[i] = static_cast<T>( val );
}
}
BaseDimensions& operator=( const BaseDimensions © )
{
m_vector = copy.m_vector;
return *this;
}
template <class Y>
BaseDimensions& operator=( const BaseDimensions<Y> © )
{
m_vector.resize( copy.rank() );
for ( size_t i = 0; i < copy.rank(); ++i )
{
Y val = copy[i];
m_vector[i] = static_cast<T>( val );
}
return *this;
}
size_t rank() const { return m_vector.size(); }
void setRank( size_t r )
{
size_t oldSize = m_vector.size();
m_vector.resize( r );
for ( size_t s = oldSize; s < r; ++s )
{
m_vector[s] = ( T )0;
}
}
T &operator[]( size_t i )
{ return m_vector[i]; }
const T &operator[]( size_t i ) const
{ return m_vector[i]; }
T *rootPtr() { return ( T * )( &( m_vector.front() ) ); }
const T *rootPtr() const
{ return ( const T * )( &( m_vector.front() ) ); }
size_t numPoints() const
{
if ( m_vector.size() == 0 ) { return 0; }
else
{
size_t npoints = 1;
for ( size_t i = 0 ; i < m_vector.size() ; i++ )
{
npoints *= (size_t)m_vector[i];
}
return npoints;
}
}
};
//-*****************************************************************************
template <class T, class Y>
bool operator==( const BaseDimensions<T> &a, const BaseDimensions<Y> &b )
{
size_t aRank = a.rank();
size_t bRank = b.rank();
if ( aRank != bRank ) { return false; }
if ( sizeof( Y ) > sizeof( T ) )
{
for ( size_t d = 0; d < aRank; ++d )
{
if ( static_cast<Y>( a[d] ) !=
static_cast<Y>( b[d] ) ) { return false; }
}
}
else
{
for ( size_t d = 0; d < aRank; ++d )
{
if ( static_cast<T>( a[d] ) !=
static_cast<T>( b[d] ) ) { return false; }
}
}
return true;
}
//-*****************************************************************************
template <class T, class Y>
inline bool operator!=( const BaseDimensions<T> &a,
const BaseDimensions<Y> &b )
{
return !( a == b );
}
//-*****************************************************************************
template <class T>
std::ostream &operator<<( std::ostream &ostr, const BaseDimensions<T> &a )
{
ostr << "{";
for ( size_t i = 0; i < a.rank(); ++i )
{
ostr << a[i];
if ( i != a.rank()-1 )
{
ostr << ", ";
}
}
ostr << "}";
return ostr;
}
//-*****************************************************************************
typedef BaseDimensions<size_t> Dimensions;
} // End namespace ALEMBIC_VERSION_NS
using namespace ALEMBIC_VERSION_NS;
} // End namespace Util
} // End namespace Alembic
#endif
|
/****************************************************************
* *
* Copyright 2001, 2004 Sanchez Computer Associates, Inc. *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
* under a license. If you do not know the terms of *
* the license, please stop and do not read further. *
* *
****************************************************************/
/*
* omi_buff_rsp.c ---
*
* Buffer a transaction response.
*
*/
#ifndef lint
static char rcsid[] = "$Header:$";
#endif
#include "mdef.h"
#include "omi.h"
void omi_buff_rsp(omi_req_hdr *rhptr, omi_err_hdr *ehptr, omi_status status, char *bptr, int len)
{
char *tptr;
tptr = bptr;
/* Fill in the header */
OMI_VI_WRIT(OMI_SI_SIZ + OMI_RH_SIZ + len, tptr);
OMI_SI_WRIT(OMI_RH_SIZ, tptr);
/* Set the error flags to the specified values */
if (ehptr)
{
OMI_LI_WRIT(ehptr->class, tptr);
OMI_SI_WRIT(ehptr->type, tptr);
OMI_LI_WRIT(ehptr->modifier, tptr);
} else
{ /* Otherwise set all to 0 (class, type, and modifier) */
OMI_LI_WRIT(0, tptr);
OMI_SI_WRIT(0, tptr);
OMI_LI_WRIT(0, tptr);
}
/* Server status */
OMI_LI_WRIT(status, tptr);
/* Sequence number */
OMI_LI_WRIT(rhptr->seq.value, tptr);
/* Reference ID */
OMI_LI_WRIT(rhptr->ref.value, tptr);
return;
}
|
/* SPDX-License-Identifier: LGPL-2.1+ */
#include "config.h"
#include <errno.h>
#include <fcntl.h>
#include <malloc.h>
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/file.h>
#include <unistd.h>
#include "lxc.h"
#include "log.h"
#include "lxclock.h"
#include "memory_utils.h"
#include "utils.h"
#ifdef MUTEX_DEBUGGING
#include <execinfo.h>
#endif
#define MAX_STACKDEPTH 25
lxc_log_define(lxclock, lxc);
#ifdef MUTEX_DEBUGGING
static pthread_mutex_t thread_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
static inline void dump_stacktrace(void)
{
void *array[MAX_STACKDEPTH];
size_t size;
char **strings;
size = backtrace(array, MAX_STACKDEPTH);
strings = backtrace_symbols(array, size);
/* Using fprintf here as our logging module is not thread safe. */
fprintf(stderr, "\tObtained %zu stack frames\n", size);
for (int i = 0; i < size; i++)
fprintf(stderr, "\t\t%s\n", strings[i]);
free(strings);
}
#else
static pthread_mutex_t thread_mutex = PTHREAD_MUTEX_INITIALIZER;
static inline void dump_stacktrace(void) {;}
#endif
static void lock_mutex(pthread_mutex_t *l)
{
int ret;
ret = pthread_mutex_lock(l);
if (ret != 0) {
SYSERROR("Failed to acquire mutex");
dump_stacktrace();
_exit(EXIT_FAILURE);
}
}
static void unlock_mutex(pthread_mutex_t *l)
{
int ret;
ret = pthread_mutex_unlock(l);
if (ret != 0) {
SYSERROR("Failed to release mutex");
dump_stacktrace();
_exit(EXIT_FAILURE);
}
}
static char *lxclock_name(const char *p, const char *n)
{
__do_free char *dest = NULL, *rundir = NULL;
int ret;
size_t len;
/* lockfile will be:
* "/run" + "/lxc/lock/$lxcpath/$lxcname + '\0' if root
* or
* $XDG_RUNTIME_DIR + "/lxc/lock/$lxcpath/$lxcname + '\0' if non-root
*/
/* length of "/lxc/lock/" + $lxcpath + "/" + "." + $lxcname + '\0' */
len = STRLITERALLEN("/lxc/lock/") + strlen(n) + strlen(p) + 3;
rundir = get_rundir();
if (!rundir)
return NULL;
len += strlen(rundir);
dest = malloc(len);
if (!dest)
return NULL;
ret = strnprintf(dest, len, "%s/lxc/lock/%s", rundir, p);
if (ret < 0)
return NULL;
ret = mkdir_p(dest, 0755);
if (ret < 0)
return NULL;
ret = strnprintf(dest, len, "%s/lxc/lock/%s/.%s", rundir, p, n);
if (ret < 0)
return NULL;
return move_ptr(dest);
}
static sem_t *lxc_new_unnamed_sem(void)
{
__do_free sem_t *s = NULL;
int ret;
s = malloc(sizeof(*s));
if (!s)
return ret_set_errno(NULL, ENOMEM);
ret = sem_init(s, 0, 1);
if (ret < 0)
return NULL;
return move_ptr(s);
}
struct lxc_lock *lxc_newlock(const char *lxcpath, const char *name)
{
__do_free struct lxc_lock *l = NULL;
l = zalloc(sizeof(*l));
if (!l)
return ret_set_errno(NULL, ENOMEM);
if (name) {
l->type = LXC_LOCK_FLOCK;
l->u.f.fname = lxclock_name(lxcpath, name);
if (!l->u.f.fname)
return ret_set_errno(NULL, ENOMEM);
l->u.f.fd = -EBADF;
} else {
l->type = LXC_LOCK_ANON_SEM;
l->u.sem = lxc_new_unnamed_sem();
if (!l->u.sem)
return ret_set_errno(NULL, ENOMEM);
}
return move_ptr(l);
}
int lxclock(struct lxc_lock *l, int timeout)
{
int ret = -1;
struct flock lk;
switch (l->type) {
case LXC_LOCK_ANON_SEM:
if (!timeout) {
ret = sem_wait(l->u.sem);
} else {
struct timespec ts;
ret = clock_gettime(CLOCK_REALTIME, &ts);
if (ret < 0)
return -2;
ts.tv_sec += timeout;
ret = sem_timedwait(l->u.sem, &ts);
}
break;
case LXC_LOCK_FLOCK:
if (timeout)
return log_error(-2, "Timeouts are not supported with file locks");
if (!l->u.f.fname)
return log_error(-2, "No filename set for file lock");
if (l->u.f.fd < 0) {
l->u.f.fd = open(l->u.f.fname, O_CREAT | O_RDWR | O_NOFOLLOW | O_CLOEXEC | O_NOCTTY, S_IWUSR | S_IRUSR);
if (l->u.f.fd < 0)
return log_error_errno(-2, errno, "Failed to open \"%s\"", l->u.f.fname);
}
memset(&lk, 0, sizeof(struct flock));
lk.l_type = F_WRLCK;
lk.l_whence = SEEK_SET;
ret = fcntl(l->u.f.fd, F_OFD_SETLKW, &lk);
if (ret < 0 && errno == EINVAL)
ret = flock(l->u.f.fd, LOCK_EX);
break;
default:
return ret_set_errno(-1, EINVAL);
}
return ret;
}
int lxcunlock(struct lxc_lock *l)
{
struct flock lk;
int ret = 0;
switch (l->type) {
case LXC_LOCK_ANON_SEM:
if (!l->u.sem)
return -2;
ret = sem_post(l->u.sem);
break;
case LXC_LOCK_FLOCK:
if (l->u.f.fd < 0)
return -2;
memset(&lk, 0, sizeof(struct flock));
lk.l_type = F_UNLCK;
lk.l_whence = SEEK_SET;
ret = fcntl(l->u.f.fd, F_OFD_SETLK, &lk);
if (ret < 0 && errno == EINVAL)
ret = flock(l->u.f.fd, LOCK_EX | LOCK_NB);
close_prot_errno_disarm(l->u.f.fd);
break;
default:
return ret_set_errno(-1, EINVAL);
}
return ret;
}
/*
* lxc_putlock() is only called when a container_new() fails,
* or during container_put(), which is already guaranteed to
* only be done by one task.
* So the only exclusion we need to provide here is for regular
* thread safety (i.e. file descriptor table changes).
*/
void lxc_putlock(struct lxc_lock *l)
{
if (!l)
return;
switch (l->type) {
case LXC_LOCK_ANON_SEM:
if (l->u.sem) {
sem_destroy(l->u.sem);
free_disarm(l->u.sem);
}
break;
case LXC_LOCK_FLOCK:
close_prot_errno_disarm(l->u.f.fd);
free_disarm(l->u.f.fname);
break;
}
free(l);
}
void process_lock(void)
{
lock_mutex(&thread_mutex);
}
void process_unlock(void)
{
unlock_mutex(&thread_mutex);
}
int container_mem_lock(struct lxc_container *c)
{
return lxclock(c->privlock, 0);
}
void container_mem_unlock(struct lxc_container *c)
{
lxcunlock(c->privlock);
}
int container_disk_lock(struct lxc_container *c)
{
int ret;
ret = lxclock(c->privlock, 0);
if (ret < 0)
return ret;
ret = lxclock(c->slock, 0);
if (ret < 0) {
lxcunlock(c->privlock);
return ret;
}
return 0;
}
void container_disk_unlock(struct lxc_container *c)
{
lxcunlock(c->slock);
lxcunlock(c->privlock);
}
|
/*
* Copyright (C) 2011 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef MeterShadowElement_h
#define MeterShadowElement_h
#if ENABLE(METER_ELEMENT)
#include "HTMLDivElement.h"
#include <wtf/Forward.h>
namespace WebCore {
class HTMLMeterElement;
class RenderMeter;
class MeterShadowElement : public HTMLDivElement {
public:
MeterShadowElement(Document*);
HTMLMeterElement* meterElement() const;
private:
virtual bool rendererIsNeeded(const NodeRenderingContext&);
};
class MeterInnerElement : public MeterShadowElement {
public:
MeterInnerElement(Document*);
static PassRefPtr<MeterInnerElement> create(Document*);
private:
virtual bool rendererIsNeeded(const NodeRenderingContext&) OVERRIDE;
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) OVERRIDE;
};
inline PassRefPtr<MeterInnerElement> MeterInnerElement::create(Document* document)
{
return adoptRef(new MeterInnerElement(document));
}
class MeterBarElement : public MeterShadowElement {
public:
MeterBarElement(Document* document)
: MeterShadowElement(document)
{
DEFINE_STATIC_LOCAL(AtomicString, pseudoId, ("-webkit-meter-bar", AtomicString::ConstructFromLiteral));
setPseudo(pseudoId);
}
static PassRefPtr<MeterBarElement> create(Document*);
};
inline PassRefPtr<MeterBarElement> MeterBarElement::create(Document* document)
{
return adoptRef(new MeterBarElement(document));
}
class MeterValueElement : public MeterShadowElement {
public:
MeterValueElement(Document* document)
: MeterShadowElement(document)
{
updatePseudo();
}
static PassRefPtr<MeterValueElement> create(Document*);
void setWidthPercentage(double);
void updatePseudo() { setPseudo(valuePseudoId()); }
private:
const AtomicString& valuePseudoId() const;
};
inline PassRefPtr<MeterValueElement> MeterValueElement::create(Document* document)
{
return adoptRef(new MeterValueElement(document));
}
}
#endif // ENABLE(METER_ELEMENT)
#endif // MeterShadowElement_h
|
/*************************************************************************
* *
* I|*j^3Cl|a "+!*% qt Nd gW *
* l]{y+l?MM* !#Wla\NNP NW MM I| *
* PW ?E| tWg Wg sC! AW ~@v~ *
* NC ?M! yN| WW MK MW@K1Y%M@ RM #Q QP@tim *
* CM| |WQCljAE| MD Mg RN cM~ NM WQ MQ *
* #M aQ? MW M3 Mg Q( HQ YR IM| *
* Dq {Ql MH iMX Mg MM QP QM Eg *
* !EWNaPRag2$ +M" $WNaHaN% MQE$%EXW QQ CM %M%a$D *
* *
* Website: https://github.com/zpublic/zpublic *
* *
************************************************************************/
#pragma once
NAMESPACE_ZL_BEGIN
typedef std::map<ZLAsynTaskBase*, HANDLE> ZLAsynTaskSet;
typedef std::map<ZLAsynTaskBase*, HANDLE>::iterator ZLAsynTaskSetIt;
class ZLAsynTaskMgr;
typedef struct _ZLAsynThreadStub
{
_ZLAsynThreadStub(ZLAsynTaskMgr* pThis, ZLAsynTaskBase* pTask, DWORD dwDelay)
{
_this = pThis;
_task = pTask;
_delay = dwDelay;
}
ZLAsynTaskMgr* _this;
ZLAsynTaskBase* _task;
DWORD _delay;
}ZLAsynThreadStub;
class ZLAsynTaskMgr
{
public:
ZLAsynTaskMgr() : _stop_event(true) {}
~ZLAsynTaskMgr()
{
WaitAndStop();
}
bool PostTask(ZLAsynTaskBase* pTask, DWORD dwMillisecondDelay = 0)
{
if (!pTask) return false;
///> ÒòΪ¿ÉÄÜ»¹Ã»¼Óµ½ÈÎÎñ¼¯£¬ÈÎÎñÏ߳̾ÍÅÜÍêÁËÀ´É¾ÈÎÎñÏ߳̾ä±ú£¬
///> ËùÒÔ£¬ÕâÀïÏȰÑÈÎÎñ¼Óµ½ÈÎÎñ¼¯ÔÙ´´½¨Ïß³Ì
{
z_mutex_guard g(_task_set_mutex);
_task_set[pTask] = NULL;
}
ZLAsynThreadStub* pStub = new ZLAsynThreadStub(this, pTask, dwMillisecondDelay);
HANDLE hThread = (HANDLE)_beginthreadex(
NULL,
0,
_Thread_Proc,
(void*)pStub,
0,
NULL);
if (hThread)
{
z_mutex_guard g(_task_set_mutex);
ZLAsynTaskSetIt it = _task_set.find(pTask);
if (it != _task_set.end())
it->second = hThread;
else
::CloseHandle(hThread); ///> ÈÎÎñÏß³ÌÒѾÅÜÍêµÄÇé¿ö
return true;
}
else
{
z_mutex_guard g(_task_set_mutex);
ZLAsynTaskSetIt it = _task_set.find(pTask);
if (it != _task_set.end())
_task_set.erase(it);
return false;
}
}
void WaitAndStop(DWORD dwMillisecondPerTask = 100)
{
z_mutex_guard g(_task_set_mutex);
_stop_event.Set();
ZLAsynTaskSetIt it = _task_set.begin();
while (it != _task_set.end())
{
if (it->second)
{
DWORD dwRet = ::WaitForSingleObject(it->second, dwMillisecondPerTask);
if (dwRet == WAIT_TIMEOUT)
{
::TerminateThread(it->second, 0);
it->second = NULL;
}
::CloseHandle(it->second);
}
++it;
}
_task_set.clear();
_stop_event.Reset();
}
private:
static unsigned int WINAPI _Thread_Proc(void* pParam)
{
ZLAsynThreadStub* pStub = (ZLAsynThreadStub*)pParam;
if (pStub)
{
if (pStub->_task)
{
if (pStub->_this->_stop_event.Wait(pStub->_delay) == WAIT_TIMEOUT)
pStub->_task->DoWork();
if (pStub->_this->_stop_event.Wait(0) == WAIT_TIMEOUT)
{
z_mutex_guard g(pStub->_this->_task_set_mutex);
ZLAsynTaskSetIt it = pStub->_this->_task_set.find(pStub->_task);
if (it != pStub->_this->_task_set.end())
{
if (it->second)
{
::CloseHandle(it->second);
}
pStub->_this->_task_set.erase(it);
}
}
delete pStub->_task;
}
delete pStub;
}
_endthreadex(0);
return 0;
}
ZLAsynTaskSet _task_set;
z_mutex _task_set_mutex;
ThreadSync::CEvent _stop_event;
};
NAMESPACE_ZL_END |
/*
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#pragma once
#include <aws/elasticmapreduce/EMR_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
namespace Aws
{
namespace EMR
{
namespace Model
{
enum class InstanceGroupType
{
NOT_SET,
MASTER,
CORE,
TASK
};
namespace InstanceGroupTypeMapper
{
AWS_EMR_API InstanceGroupType GetInstanceGroupTypeForName(const Aws::String& name);
AWS_EMR_API Aws::String GetNameForInstanceGroupType(InstanceGroupType value);
} // namespace InstanceGroupTypeMapper
} // namespace Model
} // namespace EMR
} // namespace Aws
|
// OCMockito by Jon Reid, http://qualitycoding.org/about/
// Copyright 2017 Jonathan M. Reid. See LICENSE.txt
#import "MKTArgumentGetter.h"
NS_ASSUME_NONNULL_BEGIN
@interface MKTUnsignedIntArgumentGetter : MKTArgumentGetter
- (instancetype)initWithSuccessor:(nullable MKTArgumentGetter *)successor NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithType:(char const *)handlerType successor:(nullable MKTArgumentGetter *)successor NS_UNAVAILABLE;
@end
NS_ASSUME_NONNULL_END
|
/*
*
* Copyright 2015, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_DATA_H
#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_DATA_H
/* Parser for GRPC streams embedded in DATA frames */
#include <grpc/support/slice.h>
#include <grpc/support/slice_buffer.h>
#include "src/core/ext/transport/chttp2/transport/frame.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/transport/byte_stream.h"
#include "src/core/lib/transport/transport.h"
typedef enum {
GRPC_CHTTP2_DATA_FH_0,
GRPC_CHTTP2_DATA_FH_1,
GRPC_CHTTP2_DATA_FH_2,
GRPC_CHTTP2_DATA_FH_3,
GRPC_CHTTP2_DATA_FH_4,
GRPC_CHTTP2_DATA_FRAME,
GRPC_CHTTP2_DATA_ERROR
} grpc_chttp2_stream_state;
typedef struct grpc_chttp2_incoming_byte_stream
grpc_chttp2_incoming_byte_stream;
typedef struct grpc_chttp2_incoming_frame_queue {
grpc_chttp2_incoming_byte_stream *head;
grpc_chttp2_incoming_byte_stream *tail;
} grpc_chttp2_incoming_frame_queue;
typedef struct {
grpc_chttp2_stream_state state;
uint8_t is_last_frame;
uint8_t frame_type;
uint32_t frame_size;
int is_frame_compressed;
grpc_chttp2_incoming_frame_queue incoming_frames;
grpc_chttp2_incoming_byte_stream *parsing_frame;
} grpc_chttp2_data_parser;
void grpc_chttp2_incoming_frame_queue_merge(
grpc_chttp2_incoming_frame_queue *head_dst,
grpc_chttp2_incoming_frame_queue *tail_src);
grpc_byte_stream *grpc_chttp2_incoming_frame_queue_pop(
grpc_chttp2_incoming_frame_queue *q);
/* initialize per-stream state for data frame parsing */
grpc_chttp2_parse_error grpc_chttp2_data_parser_init(
grpc_chttp2_data_parser *parser);
void grpc_chttp2_data_parser_destroy(grpc_exec_ctx *exec_ctx,
grpc_chttp2_data_parser *parser);
/* start processing a new data frame */
grpc_chttp2_parse_error grpc_chttp2_data_parser_begin_frame(
grpc_chttp2_data_parser *parser, uint8_t flags);
/* handle a slice of a data frame - is_last indicates the last slice of a
frame */
grpc_chttp2_parse_error grpc_chttp2_data_parser_parse(
grpc_exec_ctx *exec_ctx, void *parser,
grpc_chttp2_transport_parsing *transport_parsing,
grpc_chttp2_stream_parsing *stream_parsing, gpr_slice slice, int is_last);
void grpc_chttp2_encode_data(uint32_t id, gpr_slice_buffer *inbuf,
uint32_t write_bytes, int is_eof,
grpc_transport_one_way_stats *stats,
gpr_slice_buffer *outbuf);
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_DATA_H */
|
EXTERN_C REBDEV Dev_Signal;
struct devreq_posix_signal {
struct rebol_devreq devreq;
sigset_t mask; // signal mask
};
#define ReqPosixSignal(req) \
cast(struct devreq_posix_signal*, req)
|
/**
* WinPR: Windows Portable Runtime
* Asynchronous I/O Functions
*
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@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 WINPR_IO_H
#define WINPR_IO_H
#include <winpr/winpr.h>
#include <winpr/wtypes.h>
#ifndef _WIN32
typedef struct _OVERLAPPED
{
ULONG_PTR Internal;
ULONG_PTR InternalHigh;
union
{
struct
{
DWORD Offset;
DWORD OffsetHigh;
};
PVOID Pointer;
};
HANDLE hEvent;
} OVERLAPPED, *LPOVERLAPPED;
typedef struct _OVERLAPPED_ENTRY
{
ULONG_PTR lpCompletionKey;
LPOVERLAPPED lpOverlapped;
ULONG_PTR Internal;
DWORD dwNumberOfBytesTransferred;
} OVERLAPPED_ENTRY, *LPOVERLAPPED_ENTRY;
WINPR_API BOOL GetOverlappedResult(HANDLE hFile, LPOVERLAPPED lpOverlapped, LPDWORD lpNumberOfBytesTransferred, BOOL bWait);
WINPR_API BOOL GetOverlappedResultEx(HANDLE hFile, LPOVERLAPPED lpOverlapped, LPDWORD lpNumberOfBytesTransferred, DWORD dwMilliseconds, BOOL bAlertable);
WINPR_API BOOL DeviceIoControl(HANDLE hDevice, DWORD dwIoControlCode, LPVOID lpInBuffer, DWORD nInBufferSize,
LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped);
WINPR_API HANDLE CreateIoCompletionPort(HANDLE FileHandle, HANDLE ExistingCompletionPort, ULONG_PTR CompletionKey, DWORD NumberOfConcurrentThreads);
WINPR_API BOOL GetQueuedCompletionStatus(HANDLE CompletionPort, LPDWORD lpNumberOfBytesTransferred,
PULONG_PTR lpCompletionKey, LPOVERLAPPED* lpOverlapped, DWORD dwMilliseconds);
WINPR_API BOOL GetQueuedCompletionStatusEx(HANDLE CompletionPort, LPOVERLAPPED_ENTRY lpCompletionPortEntries,
ULONG ulCount, PULONG ulNumEntriesRemoved, DWORD dwMilliseconds, BOOL fAlertable);
WINPR_API BOOL PostQueuedCompletionStatus(HANDLE CompletionPort, DWORD dwNumberOfBytesTransferred, ULONG_PTR dwCompletionKey, LPOVERLAPPED lpOverlapped);
WINPR_API BOOL CancelIo(HANDLE hFile);
WINPR_API BOOL CancelIoEx(HANDLE hFile, LPOVERLAPPED lpOverlapped);
WINPR_API BOOL CancelSynchronousIo(HANDLE hThread);
#endif
#endif /* WINPR_IO_H */
|
// REQUIRES: darwin
// Always error about undefined 'TARGET_OS_*' macros on Darwin.
// RUN: %clang -### %s 2>&1 | FileCheck %s
// CHECK-DAG: "-Wundef-prefix=TARGET_OS_"
// CHECK-DAG: "-Werror=undef-prefix"
|
#ifndef vcl_complex_h_
#define vcl_complex_h_
#include <complex>
#include "vcl_compiler.h"
#endif // vcl_complex_h_
|
// Copyright 2017 The Ray 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.
#pragma once
#include <random>
#include "absl/time/clock.h"
// Randomly samples num_elements from the elements between first and last using reservoir
// sampling.
template <class Iterator, class T = typename std::iterator_traits<Iterator>::value_type>
void random_sample(Iterator begin, Iterator end, size_t num_elements,
std::vector<T> *out) {
out->resize(0);
if (num_elements == 0) {
return;
}
std::default_random_engine gen(absl::GetCurrentTimeNanos());
size_t current_index = 0;
for (auto it = begin; it != end; it++) {
if (current_index < num_elements) {
out->push_back(*it);
} else {
size_t random_index = std::uniform_int_distribution<size_t>(0, current_index)(gen);
if (random_index < num_elements) {
out->at(random_index) = *it;
}
}
current_index++;
}
return;
}
|
// NOLINT(namespace-envoy)
constexpr char TEST_SAN_DNS2_CERT_256_HASH[] =
"8d4a2b9321f29cfc8bfbe28e8ec1069c9f87b900fcbf37e6beb1c5f24b8d3d68";
constexpr char TEST_SAN_DNS2_CERT_1_HASH[] = "7badb47d6d1c1b8cb7eebde80328e2ae34563922";
constexpr char TEST_SAN_DNS2_CERT_SPKI[] = "RMX61rJ5+5ZBkIkGU0NgDRCXuIKMKkMNrrL81ed0I4Y=";
constexpr char TEST_SAN_DNS2_CERT_SERIAL[] = "6fb969e4475a4f2e8a09f2a3bdb4d76831d832dc";
constexpr char TEST_SAN_DNS2_CERT_NOT_BEFORE[] = "Aug 20 16:57:48 2020 GMT";
constexpr char TEST_SAN_DNS2_CERT_NOT_AFTER[] = "Aug 20 16:57:48 2022 GMT";
|
/*=========================================================================
*
* Copyright Insight Software Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#ifndef __itkFastMarchingImageToNodePairContainerAdaptor_h
#define __itkFastMarchingImageToNodePairContainerAdaptor_h
#include "itkObject.h"
#include "itkFastMarchingTraits.h"
namespace itk
{
/**
* \class FastMarchingImageToNodePairContainerAdaptor
* \brief Convenient adaptor class which converts Image into
* FastMarching::NodePairContainerType used for initializing the FastMarching.
*
* One provides images by means of SetAliveImage, SetTrialImage, SetForbiddenImage
* and get corresponding containers by means of GetAlivePoints, GetTrialPoints,
* GetForbiddenPoints.
*
* One can globally set the associated value for all FastMarchingTraitsBase::Alive
* points by means of SetAliveValue; and for all FastMarchingTraitsBase::Trial
* points by means of SetTrialValue.
*
* To restrict the evolution of the front in certain area, one can use
* SetForbiddenImage and SetIsForbiddenImageBinaryMask depending on the input
* image.
*
* \sa FastMarchingTraitsBase
* \sa FastMarchingBase
*
* \ingroup ITKFastMarching
*/
template< class TInput, class TOutput, class TImage >
class FastMarchingImageToNodePairContainerAdaptor :
public Object
{
public:
typedef FastMarchingImageToNodePairContainerAdaptor Self;
typedef LightObject Superclass;
typedef SmartPointer< Self > Pointer;
typedef SmartPointer< const Self > ConstPointer;
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** Run-time type information (and related methods). */
itkTypeMacro(FastMarchingImageToNodePairContainerAdaptor, LightObject);
typedef FastMarchingTraits< TInput, TOutput > Traits;
typedef typename Traits::NodePairType NodePairType;
typedef typename Traits::NodePairContainerType NodePairContainerType;
typedef typename Traits::NodePairContainerPointer NodePairContainerPointer;
typedef typename Traits::LabelType LabelType;
typedef typename Traits::OutputPixelType OutputPixelType;
typedef TImage ImageType;
typedef typename ImageType::Pointer ImagePointer;
typedef typename ImageType::ConstPointer ImageConstPointer;
typedef typename ImageType::PixelType ImagePixelType;
itkStaticConstMacro( ImageDimension, unsigned int,
Traits::ImageDimension );
/** \brief Set one Alive Image.
\note Only pixels with non null values are considered as
FastMarchingTraitsBase::Alive points.*/
void SetAliveImage( const ImageType* iImage );
/** \brief Set one Trial Image.
\note Only pixels with non null values are considered as
FastMarchingTraitsBase::Trialpoints.*/
void SetTrialImage( const ImageType* iImage );
/** \brief Set one Forbidden Image.
There are two possible behaviors here depending on
m_IsForbiddenImageBinaryMask:
\li if m_IsForbiddenImageBinaryMask is \c true, then the input image
is a binary mask; thus null values are considered as
FastMarchingTraitsBase::Forbidden points
\li else (m_IsForbiddenImageBinaryMask is \c fasle) non null values
represents FastMarchingTraitsBase::Forbidden points*/
void SetForbiddenImage( const ImageType* iImage );
itkSetMacro( IsForbiddenImageBinaryMask, bool );
itkBooleanMacro( IsForbiddenImageBinaryMask );
/** \brief Get resulting Alive Points container*/
NodePairContainerType* GetAlivePoints();
/** \brief Get resulting Trial Points container*/
NodePairContainerType* GetTrialPoints();
/** \brief Get resulting Forbidden Points container*/
NodePairContainerType* GetForbiddenPoints();
itkSetMacro( AliveValue, OutputPixelType );
itkSetMacro( TrialValue, OutputPixelType );
/** \brief Perform the conversion. */
void Update();
protected:
/** \brief Constructor */
FastMarchingImageToNodePairContainerAdaptor();
/** \brief Destructor */
virtual ~FastMarchingImageToNodePairContainerAdaptor() {}
ImageConstPointer m_AliveImage;
ImageConstPointer m_TrialImage;
ImageConstPointer m_ForbiddenImage;
NodePairContainerPointer m_AlivePoints;
NodePairContainerPointer m_TrialPoints;
NodePairContainerPointer m_ForbiddenPoints;
OutputPixelType m_AliveValue;
OutputPixelType m_TrialValue;
bool m_IsForbiddenImageBinaryMask;
virtual void GenerateData();
/** */
void
SetPointsFromImage( const ImageType* image, const LabelType& iLabel,
const OutputPixelType& iValue );
private:
FastMarchingImageToNodePairContainerAdaptor( const Self& );
void operator = ( const Self& );
};
}
#include "itkFastMarchingImageToNodePairContainerAdaptor.hxx"
#endif // __itkFastMarchingImageToNodePairContainerAdaptor_h
|
/*
* Copyright (c) 2015 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr.h>
#include <linker/sections.h>
#include <toolchain.h>
#include <misc/printk.h>
#include <net/net_core.h>
#include <net/net_ip.h>
#include <net/net_pkt.h>
#include "zperf.h"
#include "zperf_internal.h"
#include "shell_utils.h"
#include "zperf_session.h"
/* To get net_sprint_ipv{4|6}_addr() */
#define NET_LOG_ENABLED 1
#include "net_private.h"
#define TAG CMD_STR_TCP_DOWNLOAD" "
#define TCP_RX_FIBER_STACK_SIZE 1024
static K_THREAD_STACK_DEFINE(zperf_tcp_rx_stack, TCP_RX_FIBER_STACK_SIZE);
static struct k_thread zperf_tcp_rx_thread_data;
#if defined(CONFIG_NET_IPV6)
static struct sockaddr_in6 *in6_addr_my;
#endif
#if defined(CONFIG_NET_IPV4)
static struct sockaddr_in *in4_addr_my;
#endif
static void tcp_received(struct net_context *context,
struct net_pkt *pkt,
int status,
void *user_data)
{
struct session *session;
u32_t time;
if (!pkt) {
return;
}
time = k_cycle_get_32();
session = get_session(pkt, SESSION_TCP);
if (!session) {
printk(TAG "ERROR! cannot get a session!\n");
return;
}
switch (session->state) {
case STATE_NULL:
case STATE_COMPLETED:
printk(TAG "New session started\n");
zperf_reset_session_stats(session);
session->start_time = k_cycle_get_32();
session->state = STATE_ONGOING;
/* fall through */
case STATE_ONGOING:
session->counter++;
session->length += net_pkt_appdatalen(pkt);
if (status == 0) { /* EOF */
u32_t rate_in_kbps;
u32_t duration = HW_CYCLES_TO_USEC(
time_delta(session->start_time, time));
session->state = STATE_COMPLETED;
/* Compute baud rate */
if (duration != 0) {
rate_in_kbps = (u32_t)
(((u64_t)session->length *
(u64_t)8 *
(u64_t)USEC_PER_SEC) /
((u64_t)duration * 1024));
} else {
rate_in_kbps = 0;
}
printk(TAG "TCP session ended\n");
printk(TAG " duration:\t\t");
print_number(duration, TIME_US, TIME_US_UNIT);
printk("\n");
printk(TAG " rate:\t\t\t");
print_number(rate_in_kbps, KBPS, KBPS_UNIT);
printk("\n");
}
break;
case STATE_LAST_PACKET_RECEIVED:
break;
default:
printk(TAG "Error! Unsupported case\n");
}
net_pkt_unref(pkt);
}
static void tcp_accepted(struct net_context *context,
struct sockaddr *addr,
socklen_t addrlen,
int error,
void *user_data)
{
int ret;
ret = net_context_recv(context, tcp_received, K_NO_WAIT, user_data);
if (ret < 0) {
printk(TAG "Cannot receive TCP packet (family %d)",
net_context_get_family(context));
}
}
static void zperf_tcp_rx_thread(int port)
{
#if defined(CONFIG_NET_IPV4)
struct net_context *context4 = NULL;
#endif
#if defined(CONFIG_NET_IPV6)
struct net_context *context6 = NULL;
#endif
int ret, fail = 0;
#if defined(CONFIG_NET_IPV4) && defined(MY_IP4ADDR)
ret = net_context_get(AF_INET, SOCK_STREAM, IPPROTO_TCP, &context4);
if (ret < 0) {
printk(TAG "ERROR! Cannot get IPv4 TCP network context.\n");
return;
}
ret = zperf_get_ipv4_addr(MY_IP4ADDR, &in4_addr_my->sin_addr, TAG);
if (ret < 0) {
printk(TAG "ERROR! Unable to set IPv4\n");
return;
}
printk(TAG "Binding to %s\n",
net_sprint_ipv4_addr(&in4_addr_my->sin_addr));
in4_addr_my->sin_port = htons(port);
#endif
#if defined(CONFIG_NET_IPV6) && defined(MY_IP6ADDR)
ret = net_context_get(AF_INET6, SOCK_STREAM, IPPROTO_TCP, &context6);
if (ret < 0) {
printk(TAG "ERROR! Cannot get IPv6 TCP network context.\n");
return;
}
ret = zperf_get_ipv6_addr(MY_IP6ADDR, MY_PREFIX_LEN_STR,
&in6_addr_my->sin6_addr, TAG);
if (ret < 0) {
printk(TAG "ERROR! Unable to set IPv6\n");
return;
}
printk(TAG "Binding to %s\n",
net_sprint_ipv6_addr(&in6_addr_my->sin6_addr));
in6_addr_my->sin6_port = htons(port);
#endif
#if defined(CONFIG_NET_IPV6)
if (context6) {
ret = net_context_bind(context6,
(struct sockaddr *)in6_addr_my,
sizeof(struct sockaddr_in6));
if (ret < 0) {
printk(TAG "Cannot bind IPv6 TCP port %d (%d)\n",
ntohs(in6_addr_my->sin6_port), ret);
fail++;
}
ret = net_context_listen(context6, 0);
if (ret < 0) {
printk(TAG "Cannot listen IPv6 TCP (%d)", ret);
return;
}
ret = net_context_accept(context6, tcp_accepted, K_NO_WAIT, NULL);
if (ret < 0) {
printk(TAG "Cannot receive IPv6 TCP packets (%d)", ret);
return;
}
}
#endif
#if defined(CONFIG_NET_IPV4)
if (context4) {
ret = net_context_bind(context4,
(struct sockaddr *)in4_addr_my,
sizeof(struct sockaddr_in));
if (ret < 0) {
printk(TAG "Cannot bind IPv4 TCP port %d (%d)\n",
ntohs(in4_addr_my->sin_port), ret);
fail++;
}
ret = net_context_listen(context4, 0);
if (ret < 0) {
printk(TAG "Cannot listen IPv4 TCP (%d)", ret);
return;
}
ret = net_context_accept(context4, tcp_accepted, K_NO_WAIT, NULL);
if (ret < 0) {
printk(TAG "Cannot receive IPv4 TCP packets (%d)", ret);
return;
}
}
#endif
if (fail > 1) {
return;
}
k_sleep(K_FOREVER);
}
void zperf_tcp_receiver_init(int port)
{
#if defined(CONFIG_NET_IPV6)
in6_addr_my = zperf_get_sin6();
#endif
#if defined(CONFIG_NET_IPV4)
in4_addr_my = zperf_get_sin();
#endif
k_thread_create(&zperf_tcp_rx_thread_data, zperf_tcp_rx_stack,
K_THREAD_STACK_SIZEOF(zperf_tcp_rx_stack),
(k_thread_entry_t)zperf_tcp_rx_thread,
INT_TO_POINTER(port), 0, 0,
K_PRIO_COOP(7), 0, K_NO_WAIT);
}
|
#include "ide_bus.h"
void *bus_cookies[2];
ide_bus *buses[2];
|
/*
* tcpnice.c
*
* Slow down TCP connections already in progress.
*
* Copyright (c) 2000 Dug Song <dugsong@monkey.org>
*
* $Id: tcpnice.c,v 1.17 2001/03/17 07:41:51 dugsong Exp $
*/
#include "config.h"
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <err.h>
#include <libnet.h>
#include <pcap.h>
#include "pcaputil.h"
#include "version.h"
#define MIN_WIN 1 /* XXX */
#define MIN_MTU 68 /* RFC 1191 */
static int Opt_icmp;
static int Opt_pmtu;
static int Opt_win;
static int pcap_off;
static u_char buf[BUFSIZ];
static void
usage(void)
{
fprintf(stderr, "Version: " VERSION "\n"
"Usage: tcpnice [-A] [-I] [-M] [-i interface] expression\n");
exit(1);
}
static void
send_tcp_window_advertisement(libnet_t *l, struct libnet_ipv4_hdr *ip,
struct libnet_tcp_hdr *tcp)
{
int len;
ip->ip_hl = 5;
ip->ip_len = htons(LIBNET_IPV4_H + LIBNET_TCP_H);
ip->ip_id = libnet_get_prand(LIBNET_PRu16);
memcpy(buf, (u_char *)ip, LIBNET_IPV4_H);
tcp->th_off = 5;
tcp->th_win = htons(MIN_WIN);
memcpy(buf + LIBNET_IPV4_H, (u_char *)tcp, LIBNET_TCP_H);
libnet_do_checksum(l, buf, IPPROTO_TCP, LIBNET_TCP_H);
len = LIBNET_IPV4_H + LIBNET_TCP_H;
if (libnet_write_raw_ipv4(l, buf, len) != len)
warn("write");
fprintf(stderr, "%s:%d > %s:%d: . ack %lu win %d\n",
libnet_addr2name4(ip->ip_src.s_addr, 0), ntohs(tcp->th_sport),
libnet_addr2name4(ip->ip_dst.s_addr, 0), ntohs(tcp->th_dport),
ntohl(tcp->th_ack), 1);
}
static void
send_icmp_source_quench(libnet_t *l, struct libnet_ipv4_hdr *ip)
{
struct libnet_icmpv4_hdr *icmp;
int len;
len = (ip->ip_hl * 4) + 8;
icmp = (struct libnet_icmpv4_hdr *)(buf + LIBNET_IPV4_H);
icmp->icmp_type = ICMP_SOURCEQUENCH;
icmp->icmp_code = 0;
memcpy((u_char *)icmp + LIBNET_ICMPV4_ECHO_H, (u_char *)ip, len);
len += LIBNET_ICMPV4_ECHO_H;
libnet_build_ipv4(LIBNET_IPV4_H + len, 0,
libnet_get_prand(LIBNET_PRu16), 0, 64, IPPROTO_ICMP,
0, ip->ip_dst.s_addr, ip->ip_src.s_addr,
(u_int8_t *) icmp, len, l, 0);
if (libnet_write(l) != len)
warn("write");
fprintf(stderr, "%s > %s: icmp: source quench\n",
libnet_addr2name4(ip->ip_dst.s_addr, 0),
libnet_addr2name4(ip->ip_src.s_addr, 0));
}
static void
send_icmp_frag_needed(libnet_t *l, struct libnet_ipv4_hdr *ip)
{
struct libnet_icmpv4_hdr *icmp;
int len;
len = (ip->ip_hl * 4) + 8;
icmp = (struct libnet_icmpv4_hdr *)(buf + LIBNET_IPV4_H);
icmp->icmp_type = ICMP_UNREACH;
icmp->icmp_code = ICMP_UNREACH_NEEDFRAG;
icmp->hun.frag.pad = 0;
icmp->hun.frag.mtu = htons(MIN_MTU);
memcpy((u_char *)icmp + LIBNET_ICMPV4_MASK_H, (u_char *)ip, len);
len += LIBNET_ICMPV4_MASK_H;
libnet_build_ipv4(LIBNET_IPV4_H + len, 4,
libnet_get_prand(LIBNET_PRu16), 0, 64, IPPROTO_ICMP,
0, ip->ip_dst.s_addr, ip->ip_src.s_addr,
(u_int8_t *) icmp, len, l, 0);
if (libnet_write(l) != len)
warn("write");
fprintf(stderr, "%s > %s: icmp: ",
libnet_addr2name4(ip->ip_dst.s_addr, 0),
libnet_addr2name4(ip->ip_src.s_addr, 0));
fprintf(stderr, "%s unreachable - need to frag (mtu %d)\n",
libnet_addr2name4(ip->ip_src.s_addr, 0), MIN_MTU);
}
static void
tcp_nice_cb(u_char *user, const struct pcap_pkthdr *pcap, const u_char *pkt)
{
struct libnet_ipv4_hdr *ip;
struct libnet_tcp_hdr *tcp;
int len;
libnet_t *l;
l = (libnet_t *)user;
pkt += pcap_off;
len = pcap->caplen - pcap_off;
ip = (struct libnet_ipv4_hdr *)pkt;
if (ip->ip_p != IPPROTO_TCP)
return;
tcp = (struct libnet_tcp_hdr *)(pkt + (ip->ip_hl << 2));
if (tcp->th_flags & (TH_SYN|TH_FIN|TH_RST))
return;
if (ntohs(ip->ip_len) > (ip->ip_hl << 2) + (tcp->th_off << 2)) {
if (Opt_icmp)
send_icmp_source_quench(l, ip);
if (Opt_win)
send_tcp_window_advertisement(l, ip, tcp);
if (Opt_pmtu)
send_icmp_frag_needed(l, ip);
}
}
int
main(int argc, char *argv[])
{
extern char *optarg;
extern int optind;
int c;
char *intf, *filter, ebuf[PCAP_ERRBUF_SIZE];
char libnet_ebuf[LIBNET_ERRBUF_SIZE];
libnet_t *l;
pcap_t *pd;
intf = NULL;
while ((c = getopt(argc, argv, "i:AIMh?V")) != -1) {
switch (c) {
case 'i':
intf = optarg;
break;
case 'A':
Opt_win = 1;
break;
case 'I':
Opt_icmp = 1;
break;
case 'M':
Opt_pmtu = 1;
break;
default:
usage();
break;
}
}
if (intf == NULL && (intf = pcap_lookupdev(ebuf)) == NULL)
errx(1, "%s", ebuf);
argc -= optind;
argv += optind;
if (argc == 0)
usage();
if ((Opt_win | Opt_icmp | Opt_pmtu) == 0)
Opt_win = Opt_icmp = Opt_pmtu = 1;
filter = copy_argv(argv);
if ((pd = pcap_init(intf, filter, 128)) == NULL)
errx(1, "couldn't initialize sniffing");
if ((pcap_off = pcap_dloff(pd)) < 0)
errx(1, "couldn't determine link layer offset");
if ((l = libnet_init(LIBNET_RAW4, intf, libnet_ebuf)) == NULL)
errx(1, "couldn't initialize sending");
libnet_seed_prand(l);
warnx("listening on %s [%s]", intf, filter);
pcap_loop(pd, -1, tcp_nice_cb, (u_char *)l);
/* NOTREACHED */
exit(0);
}
|
// Copyright (c) 2012 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 CONTENT_UTILITY_UTILITY_THREAD_IMPL_H_
#define CONTENT_UTILITY_UTILITY_THREAD_IMPL_H_
#include <memory>
#include <string>
#include <vector>
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "build/build_config.h"
#include "content/child/child_thread_impl.h"
#include "content/common/content_export.h"
#include "content/common/process_control.mojom.h"
#include "content/public/utility/utility_thread.h"
#include "mojo/public/cpp/bindings/binding_set.h"
namespace base {
class FilePath;
}
namespace content {
class BlinkPlatformImpl;
class UtilityBlinkPlatformImpl;
class UtilityProcessControlImpl;
#if defined(COMPILER_MSVC)
// See explanation for other RenderViewHostImpl which is the same issue.
#pragma warning(push)
#pragma warning(disable: 4250)
#endif
// This class represents the background thread where the utility task runs.
class UtilityThreadImpl : public UtilityThread,
public ChildThreadImpl {
public:
UtilityThreadImpl();
// Constructor that's used when running in single process mode.
explicit UtilityThreadImpl(const InProcessChildThreadParams& params);
~UtilityThreadImpl() override;
void Shutdown() override;
void ReleaseProcessIfNeeded() override;
void EnsureBlinkInitialized() override;
private:
void Init();
// ChildThread implementation.
bool OnControlMessageReceived(const IPC::Message& msg) override;
// IPC message handlers.
void OnBatchModeStarted();
void OnBatchModeFinished();
void BindProcessControlRequest(
mojo::InterfaceRequest<content::mojom::ProcessControl> request);
// True when we're running in batch mode.
bool batch_mode_;
std::unique_ptr<UtilityBlinkPlatformImpl> blink_platform_impl_;
// Process control for Mojo application hosting.
std::unique_ptr<UtilityProcessControlImpl> process_control_;
// Bindings to the mojom::ProcessControl impl.
mojo::BindingSet<mojom::ProcessControl> process_control_bindings_;
DISALLOW_COPY_AND_ASSIGN(UtilityThreadImpl);
};
#if defined(COMPILER_MSVC)
#pragma warning(pop)
#endif
} // namespace content
#endif // CONTENT_UTILITY_UTILITY_THREAD_IMPL_H_
|
/*
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* (C) 2001 Dirk Mueller (mueller@kde.org)
* (C) 2006 Alexey Proskuryakov (ap@webkit.org)
* Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All rights reserved.
* Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
* Copyright (C) 2011 Google Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#ifndef TreeScopeStyleSheetCollection_h
#define TreeScopeStyleSheetCollection_h
#include "core/CoreExport.h"
#include "core/dom/Document.h"
#include "core/dom/DocumentOrderedList.h"
#include "core/dom/StyleSheetCollection.h"
#include "core/dom/TreeScope.h"
#include "wtf/HashMap.h"
#include "wtf/ListHashSet.h"
#include "wtf/Vector.h"
#include "wtf/text/WTFString.h"
namespace blink {
class Node;
class StyleSheetContents;
class StyleRuleFontFace;
class CORE_EXPORT TreeScopeStyleSheetCollection : public StyleSheetCollection {
public:
void addStyleSheetCandidateNode(Node*);
void removeStyleSheetCandidateNode(Node* node) { m_styleSheetCandidateNodes.remove(node); }
bool hasStyleSheetCandidateNodes() const { return !m_styleSheetCandidateNodes.isEmpty(); }
void clearMediaQueryRuleSetStyleSheets();
DECLARE_VIRTUAL_TRACE();
protected:
explicit TreeScopeStyleSheetCollection(TreeScope&);
Document& document() const { return treeScope().document(); }
TreeScope& treeScope() const { return *m_treeScope; }
enum StyleResolverUpdateType {
Reconstruct,
Reset,
Additive
};
class StyleSheetChange {
STACK_ALLOCATED();
public:
StyleResolverUpdateType styleResolverUpdateType;
bool requiresFullStyleRecalc;
HeapVector<Member<const StyleRuleFontFace>> fontFaceRulesToRemove;
StyleSheetChange()
: styleResolverUpdateType(Reconstruct)
, requiresFullStyleRecalc(true) { }
};
void analyzeStyleSheetChange(StyleResolverUpdateMode, const StyleSheetCollection&, StyleSheetChange&);
private:
static StyleResolverUpdateType compareStyleSheets(const HeapVector<Member<CSSStyleSheet>>& oldStyleSheets, const HeapVector<Member<CSSStyleSheet>>& newStylesheets, HeapVector<Member<StyleSheetContents>>& addedSheets);
bool activeLoadingStyleSheetLoaded(const HeapVector<Member<CSSStyleSheet>>& newStyleSheets);
friend class TreeScopeStyleSheetCollectionTest;
protected:
Member<TreeScope> m_treeScope;
bool m_hadActiveLoadingStylesheet;
DocumentOrderedList m_styleSheetCandidateNodes;
};
} // namespace blink
#endif
|
#ifndef _NPY_ARRAY_NUMBER_H_
#define _NPY_ARRAY_NUMBER_H_
typedef struct {
PyObject *add;
PyObject *subtract;
PyObject *multiply;
PyObject *divide;
PyObject *remainder;
PyObject *divmod;
PyObject *power;
PyObject *square;
PyObject *reciprocal;
PyObject *_ones_like;
PyObject *sqrt;
PyObject *cbrt;
PyObject *negative;
PyObject *positive;
PyObject *absolute;
PyObject *invert;
PyObject *left_shift;
PyObject *right_shift;
PyObject *bitwise_and;
PyObject *bitwise_xor;
PyObject *bitwise_or;
PyObject *less;
PyObject *less_equal;
PyObject *equal;
PyObject *not_equal;
PyObject *greater;
PyObject *greater_equal;
PyObject *floor_divide;
PyObject *true_divide;
PyObject *logical_or;
PyObject *logical_and;
PyObject *floor;
PyObject *ceil;
PyObject *maximum;
PyObject *minimum;
PyObject *rint;
PyObject *conjugate;
PyObject *matmul;
} NumericOps;
extern NPY_NO_EXPORT NumericOps n_ops;
extern NPY_NO_EXPORT PyNumberMethods array_as_number;
NPY_NO_EXPORT PyObject *
array_int(PyArrayObject *v);
NPY_NO_EXPORT int
_PyArray_SetNumericOps(PyObject *dict);
NPY_NO_EXPORT PyObject *
_PyArray_GetNumericOps(void);
NPY_NO_EXPORT PyObject *
PyArray_GenericBinaryFunction(PyArrayObject *m1, PyObject *m2, PyObject *op);
NPY_NO_EXPORT PyObject *
PyArray_GenericUnaryFunction(PyArrayObject *m1, PyObject *op);
NPY_NO_EXPORT PyObject *
PyArray_GenericReduceFunction(PyArrayObject *m1, PyObject *op, int axis,
int rtype, PyArrayObject *out);
NPY_NO_EXPORT PyObject *
PyArray_GenericAccumulateFunction(PyArrayObject *m1, PyObject *op, int axis,
int rtype, PyArrayObject *out);
#endif
|
/*-
* Copyright (c) 2009 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Alistair Crooks (agc@netbsd.org)
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef NETPGP_H_
#define NETPGP_H_
#ifndef __BEGIN_DECLS
# if defined(__cplusplus)
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
# else
# define __BEGIN_DECLS
# define __END_DECLS
# endif
#endif
__BEGIN_DECLS
/* structure used to hold (key,value) pair information */
typedef struct netpgp_t {
unsigned c; /* # of elements used */
unsigned size; /* size of array */
char **name; /* key names */
char **value; /* value information */
void *pubring; /* public key ring */
void *secring; /* s3kr1t key ring */
void *io; /* the io struct for results/errs */
void *passfp; /* file pointer for password input */
} netpgp_t;
/* begin and end */
int netpgp_init(netpgp_t *);
int netpgp_end(netpgp_t *);
/* debugging, reflection and information */
int netpgp_set_debug(const char *);
int netpgp_get_debug(const char *);
const char *netpgp_get_info(const char *);
int netpgp_list_packets(netpgp_t *, char *, int, char *);
/* variables */
int netpgp_setvar(netpgp_t *, const char *, const char *);
char *netpgp_getvar(netpgp_t *, const char *);
/* key management */
int netpgp_list_keys(netpgp_t *);
int netpgp_list_sigs(netpgp_t *, const char *);
int netpgp_find_key(netpgp_t *, char *);
char *netpgp_get_key(netpgp_t *, const char *);
int netpgp_export_key(netpgp_t *, char *);
int netpgp_import_key(netpgp_t *, char *);
int netpgp_generate_key(netpgp_t *, char *, int);
/* file management */
int netpgp_encrypt_file(netpgp_t *, const char *, const char *, char *, int);
int netpgp_decrypt_file(netpgp_t *, const char *, char *, int);
int netpgp_sign_file(netpgp_t *, const char *, const char *, char *, int, int, int);
int netpgp_verify_file(netpgp_t *, const char *, const char *, int);
/* memory signing */
int netpgp_sign_memory(netpgp_t *, const char *, char *, size_t, char *, size_t, const unsigned, const unsigned);
int netpgp_verify_memory(netpgp_t *, const void *, const size_t, const int);
__END_DECLS
#endif /* !NETPGP_H_ */
|
// Copyright 2013 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 NET_TOOLS_QUIC_TEST_TOOLS_MOCK_QUIC_DISPATCHER_H_
#define NET_TOOLS_QUIC_TEST_TOOLS_MOCK_QUIC_DISPATCHER_H_
#include "net/base/ip_endpoint.h"
#include "net/quic/crypto/quic_crypto_server_config.h"
#include "net/quic/quic_config.h"
#include "net/quic/quic_protocol.h"
#include "net/tools/epoll_server/epoll_server.h"
#include "net/tools/quic/quic_dispatcher.h"
#include "testing/gmock/include/gmock/gmock.h"
namespace net {
namespace tools {
namespace test {
class MockQuicDispatcher : public QuicDispatcher {
public:
MockQuicDispatcher(const QuicConfig& config,
const QuicCryptoServerConfig& crypto_config,
EpollServer* eps);
virtual ~MockQuicDispatcher();
MOCK_METHOD3(ProcessPacket, void(const IPEndPoint& server_address,
const IPEndPoint& client_address,
const QuicEncryptedPacket& packet));
};
} // namespace test
} // namespace tools
} // namespace net
#endif // NET_TOOLS_QUIC_TEST_TOOLS_MOCK_QUIC_DISPATCHER_H_
|
/*****************************************************************************
Copyright (c) 2014, Intel Corp.
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 Intel Corporation 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.
*****************************************************************************
* Contents: Native middle-level C interface to LAPACK function zsysv_aa
* Author: Intel Corporation
* Generated November 2017
*****************************************************************************/
#include "lapacke_utils.h"
lapack_int LAPACKE_zsysv_aa_2stage_work( int matrix_layout, char uplo, lapack_int n,
lapack_int nrhs, lapack_complex_double* a, lapack_int lda,
lapack_complex_double* tb, lapack_int ltb, lapack_int* ipiv,
lapack_int* ipiv2, lapack_complex_double* b, lapack_int ldb,
lapack_complex_double* work, lapack_int lwork )
{
lapack_int info = 0;
if( matrix_layout == LAPACK_COL_MAJOR ) {
/* Call LAPACK function and adjust info */
LAPACK_zsysv_aa_2stage( &uplo, &n, &nrhs, a, &lda, tb,
<b, ipiv, ipiv2, b, &ldb, work, &lwork,
&info );
if( info < 0 ) {
info = info - 1;
}
} else if( matrix_layout == LAPACK_ROW_MAJOR ) {
lapack_int lda_t = MAX(1,n);
lapack_int ldb_t = MAX(1,n);
lapack_complex_double* a_t = NULL;
lapack_complex_double* tb_t = NULL;
lapack_complex_double* b_t = NULL;
/* Check leading dimension(s) */
if( lda < n ) {
info = -6;
LAPACKE_xerbla( "LAPACKE_zsysv_aa_2stage_work", info );
return info;
}
if( ltb < 4*n ) {
info = -8;
LAPACKE_xerbla( "LAPACKE_zsysv_aa_2stage_work", info );
return info;
}
if( ldb < nrhs ) {
info = -12;
LAPACKE_xerbla( "LAPACKE_zsysv_aa_2stage_work", info );
return info;
}
/* Query optimal working array(s) size if requested */
if( lwork == -1 ) {
LAPACK_zsysv_aa_2stage( &uplo, &n, &nrhs, a, &lda_t,
tb, <b, ipiv, ipiv2, b, &ldb_t, work,
&lwork, &info );
return (info < 0) ? (info - 1) : info;
}
/* Allocate memory for temporary array(s) */
a_t = (lapack_complex_double*)LAPACKE_malloc( sizeof(lapack_complex_double) * lda_t * MAX(1,n) );
if( a_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_0;
}
tb_t = (lapack_complex_double*)LAPACKE_malloc( sizeof(lapack_complex_double) * ltb );
if( tb_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_1;
}
b_t = (lapack_complex_double*)LAPACKE_malloc( sizeof(lapack_complex_double) * ldb_t * MAX(1,nrhs) );
if( b_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_2;
}
/* Transpose input matrices */
LAPACKE_zsy_trans( matrix_layout, uplo, n, a, lda, a_t, lda_t );
LAPACKE_zge_trans( matrix_layout, n, nrhs, b, ldb, b_t, ldb_t );
/* Call LAPACK function and adjust info */
LAPACK_zsysv_aa_2stage( &uplo, &n, &nrhs, a_t, &lda_t,
tb_t, <b, ipiv, ipiv2, b_t, &ldb_t, work,
&lwork, &info );
if( info < 0 ) {
info = info - 1;
}
/* Transpose output matrices */
LAPACKE_zsy_trans( LAPACK_COL_MAJOR, uplo, n, a_t, lda_t, a, lda );
LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, nrhs, b_t, ldb_t, b, ldb );
/* Release memory and exit */
LAPACKE_free( b_t );
exit_level_2:
LAPACKE_free( tb_t );
exit_level_1:
LAPACKE_free( a_t );
exit_level_0:
if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
LAPACKE_xerbla( "LAPACKE_zsysv_aa_2stage_work", info );
}
} else {
info = -1;
LAPACKE_xerbla( "LAPACKE_zsysv_aa_2stage_work", info );
}
return info;
}
|
/*
libdeep - a library for deep learning
Copyright (C) 2013-2015 Bob Mottram <bob@robotics.uk.to>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
.
THIS SOFTWARE IS PROVIDED BY THE 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 HOLDERS 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 DEEPLEARN_IMAGES_H
#define DEEPLEARN_IMAGES_H
#define _SVID_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dirent.h>
#include <assert.h>
#include <unistd.h>
#include <stdio.h>
#include <stdarg.h>
#include "lodepng.h"
#include "backprop.h"
int deeplearn_read_png_file(char * filename,
unsigned int * width,
unsigned int * height,
unsigned int * bitsperpixel,
unsigned char ** buffer);
int deeplearn_write_png_file(char * filename,
unsigned int width, unsigned int height,
unsigned int bitsperpixel,
unsigned char buffer[]);
int deeplearn_load_training_images(char * images_directory,
unsigned char *** images,
char *** classifications,
int ** classification_number,
int width, int height);
void bp_plot_images(unsigned char **images,
int no_of_images,
int image_width, int image_height,
char * filename);
void deeplearn_downsample(unsigned char img[],
int width, int height,
unsigned char downsampled[],
int downsampled_width,
int downsampled_height);
#endif
|
/*
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "blockd.h"
typedef enum
{
PRED = 0,
DEST = 1
} BLOCKSET;
void vp8_setup_block
(
BLOCKD *b,
int mv_stride,
unsigned char **base,
int Stride,
int offset,
BLOCKSET bs
)
{
if (bs == DEST)
{
b->dst_stride = Stride;
b->dst = offset;
b->base_dst = base;
}
else
{
b->pre_stride = Stride;
b->pre = offset;
b->base_pre = base;
}
}
void vp8_setup_macroblock(MACROBLOCKD *x, BLOCKSET bs)
{
int block;
unsigned char **y, **u, **v;
if (bs == DEST)
{
y = &x->dst.y_buffer;
u = &x->dst.u_buffer;
v = &x->dst.v_buffer;
}
else
{
y = &x->pre.y_buffer;
u = &x->pre.u_buffer;
v = &x->pre.v_buffer;
}
for (block = 0; block < 16; block++) /* y blocks */
{
vp8_setup_block(&x->block[block], x->dst.y_stride, y, x->dst.y_stride,
(block >> 2) * 4 * x->dst.y_stride + (block & 3) * 4, bs);
}
for (block = 16; block < 20; block++) /* U and V blocks */
{
vp8_setup_block(&x->block[block], x->dst.uv_stride, u, x->dst.uv_stride,
((block - 16) >> 1) * 4 * x->dst.uv_stride + (block & 1) * 4, bs);
vp8_setup_block(&x->block[block+4], x->dst.uv_stride, v, x->dst.uv_stride,
((block - 16) >> 1) * 4 * x->dst.uv_stride + (block & 1) * 4, bs);
}
}
void vp8_setup_block_dptrs(MACROBLOCKD *x)
{
int r, c;
for (r = 0; r < 4; r++)
{
for (c = 0; c < 4; c++)
{
x->block[r*4+c].diff = &x->diff[r * 4 * 16 + c * 4];
x->block[r*4+c].predictor = x->predictor + r * 4 * 16 + c * 4;
}
}
for (r = 0; r < 2; r++)
{
for (c = 0; c < 2; c++)
{
x->block[16+r*2+c].diff = &x->diff[256 + r * 4 * 8 + c * 4];
x->block[16+r*2+c].predictor = x->predictor + 256 + r * 4 * 8 + c * 4;
}
}
for (r = 0; r < 2; r++)
{
for (c = 0; c < 2; c++)
{
x->block[20+r*2+c].diff = &x->diff[320+ r * 4 * 8 + c * 4];
x->block[20+r*2+c].predictor = x->predictor + 320 + r * 4 * 8 + c * 4;
}
}
x->block[24].diff = &x->diff[384];
for (r = 0; r < 25; r++)
{
x->block[r].qcoeff = x->qcoeff + r * 16;
x->block[r].dqcoeff = x->dqcoeff + r * 16;
}
}
void vp8_build_block_doffsets(MACROBLOCKD *x)
{
/* handle the destination pitch features */
vp8_setup_macroblock(x, DEST);
vp8_setup_macroblock(x, PRED);
}
|
// Copyright 2017 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#ifndef XFA_FXFA_PARSER_CXFA_CREATOR_H_
#define XFA_FXFA_PARSER_CXFA_CREATOR_H_
#include "xfa/fxfa/parser/cxfa_node.h"
class CXFA_Creator final : public CXFA_Node {
public:
CXFA_Creator(CXFA_Document* doc, XFA_PacketType packet);
~CXFA_Creator() override;
};
#endif // XFA_FXFA_PARSER_CXFA_CREATOR_H_
|
/*This file is prepared for Doxygen automatic documentation generation.*/
/*! \file *********************************************************************
*
* \brief Preprocessor token pasting utils.
*
* - Compiler: IAR EWAVR32 and GNU GCC for AVR32
* - Supported devices: All AVR32 devices can be used.
*
* \author Atmel Corporation: http://www.atmel.com \n
* Support and FAQ: http://support.atmel.no/
*
******************************************************************************/
/* Copyright (c) 2009 Atmel Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name of Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an Atmel
* AVR product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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 _TPASTE_H_
#define _TPASTE_H_
/*! \name Token Paste
*
* Paste N preprocessing tokens together, these tokens being allowed to be \#defined.
*
* May be used only within macros with the tokens passed as arguments if the tokens are \#defined.
*
* For example, writing TPASTE2(U, WIDTH) within a macro \#defined by
* UTYPE(WIDTH) and invoked as UTYPE(UL_WIDTH) with UL_WIDTH \#defined as 32 is
* equivalent to writing U32.
*/
//! @{
#define TPASTE2( a, b) a##b
#define TPASTE3( a, b, c) a##b##c
#define TPASTE4( a, b, c, d) a##b##c##d
#define TPASTE5( a, b, c, d, e) a##b##c##d##e
#define TPASTE6( a, b, c, d, e, f) a##b##c##d##e##f
#define TPASTE7( a, b, c, d, e, f, g) a##b##c##d##e##f##g
#define TPASTE8( a, b, c, d, e, f, g, h) a##b##c##d##e##f##g##h
#define TPASTE9( a, b, c, d, e, f, g, h, i) a##b##c##d##e##f##g##h##i
#define TPASTE10(a, b, c, d, e, f, g, h, i, j) a##b##c##d##e##f##g##h##i##j
//! @}
/*! \name Absolute Token Paste
*
* Paste N preprocessing tokens together, these tokens being allowed to be \#defined.
*
* No restriction of use if the tokens are \#defined.
*
* For example, writing ATPASTE2(U, UL_WIDTH) anywhere with UL_WIDTH \#defined
* as 32 is equivalent to writing U32.
*/
//! @{
#define ATPASTE2( a, b) TPASTE2( a, b)
#define ATPASTE3( a, b, c) TPASTE3( a, b, c)
#define ATPASTE4( a, b, c, d) TPASTE4( a, b, c, d)
#define ATPASTE5( a, b, c, d, e) TPASTE5( a, b, c, d, e)
#define ATPASTE6( a, b, c, d, e, f) TPASTE6( a, b, c, d, e, f)
#define ATPASTE7( a, b, c, d, e, f, g) TPASTE7( a, b, c, d, e, f, g)
#define ATPASTE8( a, b, c, d, e, f, g, h) TPASTE8( a, b, c, d, e, f, g, h)
#define ATPASTE9( a, b, c, d, e, f, g, h, i) TPASTE9( a, b, c, d, e, f, g, h, i)
#define ATPASTE10(a, b, c, d, e, f, g, h, i, j) TPASTE10(a, b, c, d, e, f, g, h, i, j)
//! @}
#endif // _TPASTE_H_
|
/*
* Copyright 2006 Intel Corporation
*
* 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 _SDNV_C_H_
#define _SDNV_C_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/types.h>
/**
* Return the number of bytes needed to encode the given value.
*/
extern size_t sdnv_encoding_len(u_int64_t val);
/**
* Convert the given 64-bit integer into an SDNV.
*
* @return The number of bytes used, or -1 on error.
*/
extern int sdnv_encode(u_int64_t val, u_char* bp, size_t len);
/**
* Convert an SDNV pointed to by bp into a unsigned 64-bit
* integer.
*
* @return The number of bytes of bp consumed, or -1 on error.
*/
extern int sdnv_decode(const u_char* bp, size_t len, u_int64_t* val);
#ifdef __cplusplus
}
#endif
#endif /* _SDNV_C_H_ */
|
/**
* \file
*
* \brief Sleep mode access
*
* Copyright (C) 2010 Atmel Corporation. All rights reserved.
*
* \page 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. The name of Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel AVR product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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 SLEEP_H
#define SLEEP_H
#ifdef __cplusplus
extern "C" {
#endif
#include <compiler.h>
#ifndef AVR32_PM_SMODE_GMCLEAR_MASK
#define AVR32_PM_SMODE_GMCLEAR_MASK 0x80
#else
#warning Define already present in the system toolchain header files!
#endif
/**
* \defgroup sleep_group Power Manager (PM)
*
* This is a stub on the AVR UC3 Power Manager(PM) for the sleepmgr service.
*
* \note To minimize the code overhead, these functions do not feature
* interrupt-protected access since they are likely to be called inside
* interrupt handlers or in applications where such protection is not
* necessary. If such protection is needed, it must be ensured by the calling
* code.
*
* @{
*/
#if defined(__DOXYGEN__)
/**
* \brief Sets the MCU in the specified sleep mode
* \param sleep_mode Sleep mode to set.
*/
#endif
#if (UC3A || UC3B) // For AVR UC3 A0/A1, UC3 B, UC3 A3 series
# ifndef AVR32_PM_SMODE_DEEPSTOP
# define AVR32_PM_SMODE_DEEPSTOP 0x00000004
# endif
# include "pm.h"
#elif UC3C // For AVR UC3 C series
# include "pm_uc3c.h"
#elif UC3D // For AVR UC3 D series
# include "pm_uc3d.h"
#elif UC3L // For AVR UC3 L series
# include "pm_uc3l.h"
#else
# error Unsupported AVR UC3 series.
#endif
static inline void pm_sleep(int sleep_mode)
{
switch (sleep_mode) {
case AVR32_PM_SMODE_IDLE:
SLEEP(AVR32_PM_SMODE_IDLE);
break;
case AVR32_PM_SMODE_GMCLEAR_MASK | AVR32_PM_SMODE_IDLE:
SLEEP(AVR32_PM_SMODE_GMCLEAR_MASK | AVR32_PM_SMODE_IDLE);
break;
case AVR32_PM_SMODE_FROZEN:
SLEEP(AVR32_PM_SMODE_FROZEN);
break;
case AVR32_PM_SMODE_GMCLEAR_MASK | AVR32_PM_SMODE_FROZEN:
SLEEP(AVR32_PM_SMODE_GMCLEAR_MASK | AVR32_PM_SMODE_FROZEN);
break;
case AVR32_PM_SMODE_STANDBY:
SLEEP(AVR32_PM_SMODE_STANDBY);
break;
case AVR32_PM_SMODE_GMCLEAR_MASK | AVR32_PM_SMODE_STANDBY:
SLEEP(AVR32_PM_SMODE_GMCLEAR_MASK | AVR32_PM_SMODE_STANDBY);
break;
case AVR32_PM_SMODE_STOP:
SLEEP(AVR32_PM_SMODE_STOP);
break;
case AVR32_PM_SMODE_GMCLEAR_MASK | AVR32_PM_SMODE_STOP:
SLEEP(AVR32_PM_SMODE_GMCLEAR_MASK | AVR32_PM_SMODE_STOP);
break;
case AVR32_PM_SMODE_DEEPSTOP:
SLEEP(AVR32_PM_SMODE_DEEPSTOP);
break;
case AVR32_PM_SMODE_GMCLEAR_MASK | AVR32_PM_SMODE_DEEPSTOP:
SLEEP(AVR32_PM_SMODE_GMCLEAR_MASK | AVR32_PM_SMODE_DEEPSTOP);
break;
case AVR32_PM_SMODE_STATIC:
SLEEP(AVR32_PM_SMODE_STATIC);
break;
case AVR32_PM_SMODE_GMCLEAR_MASK | AVR32_PM_SMODE_STATIC:
SLEEP(AVR32_PM_SMODE_GMCLEAR_MASK | AVR32_PM_SMODE_STATIC);
break;
#if UC3L
case AVR32_PM_SMODE_SHUTDOWN:
SLEEP(AVR32_PM_SMODE_SHUTDOWN);
break;
case AVR32_PM_SMODE_GMCLEAR_MASK | AVR32_PM_SMODE_SHUTDOWN:
SLEEP(AVR32_PM_SMODE_GMCLEAR_MASK | AVR32_PM_SMODE_SHUTDOWN);
break;
#endif
default:
break;
}
}
//! @}
#ifdef __cplusplus
}
#endif
#endif /* SLEEP_H */
|
/***************************************************************************/
/* */
/* svttglyf.h */
/* */
/* The FreeType TrueType glyph service. */
/* */
/* Copyright 2007-2015 by */
/* David Turner. */
/* */
/* 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. */
/* */
/***************************************************************************/
#ifndef __SVTTGLYF_H__
#define __SVTTGLYF_H__
#include FT_INTERNAL_SERVICE_H
#include FT_TRUETYPE_TABLES_H
FT_BEGIN_HEADER
#define FT_SERVICE_ID_TT_GLYF "tt-glyf"
typedef FT_ULong
(*TT_Glyf_GetLocationFunc)( FT_Face face,
FT_UInt gindex,
FT_ULong *psize );
FT_DEFINE_SERVICE( TTGlyf )
{
TT_Glyf_GetLocationFunc get_location;
};
#ifndef FT_CONFIG_OPTION_PIC
#define FT_DEFINE_SERVICE_TTGLYFREC( class_, get_location_ ) \
static const FT_Service_TTGlyfRec class_ = \
{ \
get_location_ \
};
#else /* FT_CONFIG_OPTION_PIC */
#define FT_DEFINE_SERVICE_TTGLYFREC( class_, get_location_ ) \
void \
FT_Init_Class_ ## class_( FT_Service_TTGlyfRec* clazz ) \
{ \
clazz->get_location = get_location_; \
}
#endif /* FT_CONFIG_OPTION_PIC */
/* */
FT_END_HEADER
#endif /* __SVTTGLYF_H__ */
/* END */
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* Cherokee
*
* Authors:
* Alvaro Lopez Ortega <alvaro@alobbs.com>
*
* Copyright (C) 2001-2014 Alvaro Lopez Ortega
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
#if !defined (CHEROKEE_INSIDE_CHEROKEE_H) && !defined (CHEROKEE_COMPILATION)
# error "Only <cherokee/cherokee.h> can be included directly, this file may disappear or change contents."
#endif
#ifndef CHEROKEE_PLUGIN_LOADER_H
#define CHEROKEE_PLUGIN_LOADER_H
#include <cherokee/common.h>
#include <cherokee/module.h>
#include <cherokee/avl.h>
#include <cherokee/plugin.h>
CHEROKEE_BEGIN_DECLS
typedef struct {
cherokee_plugin_info_t *info;
void *dlopen_ref;
cherokee_boolean_t built_in;
} cherokee_plugin_loader_entry_t;
typedef struct {
cherokee_avl_t table;
cherokee_buffer_t module_dir;
cherokee_buffer_t deps_dir;
} cherokee_plugin_loader_t;
#define MODINFO(x) ((cherokee_module_info_t *) (x))
#define MODLOADER(x) ((cherokee_plugin_loader_t *) (x))
ret_t cherokee_plugin_loader_init (cherokee_plugin_loader_t *loader);
ret_t cherokee_plugin_loader_mrproper (cherokee_plugin_loader_t *loader);
ret_t cherokee_plugin_loader_set_directory (cherokee_plugin_loader_t *loader, cherokee_buffer_t *dir);
ret_t cherokee_plugin_loader_set_deps_dir (cherokee_plugin_loader_t *loader, cherokee_buffer_t *dir);
ret_t cherokee_plugin_loader_load (cherokee_plugin_loader_t *loader, const char *modname);
ret_t cherokee_plugin_loader_load_no_global (cherokee_plugin_loader_t *loader, const char *modname);
ret_t cherokee_plugin_loader_unload (cherokee_plugin_loader_t *loader, const char *modname);
ret_t cherokee_plugin_loader_get (cherokee_plugin_loader_t *loader, const char *modname, cherokee_plugin_info_t **info);
ret_t cherokee_plugin_loader_get_info (cherokee_plugin_loader_t *loader, const char *modname, cherokee_plugin_info_t **info);
ret_t cherokee_plugin_loader_get_sym (cherokee_plugin_loader_t *loader, const char *modname, const char *name, void **sym);
ret_t cherokee_plugin_loader_get_mods_info (cherokee_plugin_loader_t *loader, cherokee_buffer_t *builtin);
CHEROKEE_END_DECLS
#endif /* CHEROKEE_PLUGIN_LOADER_H */
|
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 Sam Lantinga
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
Sam Lantinga
slouken@libsdl.org
*/
#ifndef _SDL_config_dreamcast_h
#define _SDL_config_dreamcast_h
#include "SDL_platform.h"
/* This is a set of defines to configure the SDL features */
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef signed short int16_t;
typedef unsigned short uint16_t;
typedef signed int int32_t;
typedef unsigned int uint32_t;
typedef signed long long int64_t;
typedef unsigned long long uint64_t;
typedef unsigned long uintptr_t;
#define SDL_HAS_64BIT_TYPE 1
/* Useful headers */
#define HAVE_SYS_TYPES_H 1
#define HAVE_STDIO_H 1
#define STDC_HEADERS 1
#define HAVE_STRING_H 1
#define HAVE_CTYPE_H 1
/* C library functions */
#define HAVE_MALLOC 1
#define HAVE_CALLOC 1
#define HAVE_REALLOC 1
#define HAVE_FREE 1
#define HAVE_ALLOCA 1
#define HAVE_GETENV 1
#define HAVE_PUTENV 1
#define HAVE_QSORT 1
#define HAVE_ABS 1
#define HAVE_BCOPY 1
#define HAVE_MEMSET 1
#define HAVE_MEMCPY 1
#define HAVE_MEMMOVE 1
#define HAVE_MEMCMP 1
#define HAVE_STRLEN 1
#define HAVE_STRDUP 1
#define HAVE_INDEX 1
#define HAVE_RINDEX 1
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
#define HAVE_STRTOL 1
#define HAVE_STRTOD 1
#define HAVE_ATOI 1
#define HAVE_ATOF 1
#define HAVE_STRCMP 1
#define HAVE_STRNCMP 1
#define HAVE_STRICMP 1
#define HAVE_STRCASECMP 1
#define HAVE_SSCANF 1
#define HAVE_SNPRINTF 1
#define HAVE_VSNPRINTF 1
/* Enable various audio drivers */
#define SDL_AUDIO_DRIVER_DC 1
#define SDL_AUDIO_DRIVER_DISK 1
#define SDL_AUDIO_DRIVER_DUMMY 1
/* Enable various cdrom drivers */
#define SDL_CDROM_DC 1
/* Enable various input drivers */
#define SDL_JOYSTICK_DC 1
/* Enable various shared object loading systems */
#define SDL_LOADSO_DUMMY 1
/* Enable various threading systems */
#define SDL_THREAD_DC 1
/* Enable various timer systems */
#define SDL_TIMER_DC 1
/* Enable various video drivers */
#define SDL_VIDEO_DRIVER_DC 1
#define SDL_VIDEO_DRIVER_DUMMY 1
#endif /* _SDL_config_dreamcast_h */
|
// =================================================================================================
// ADOBE SYSTEMS INCORPORATED
// Copyright 2010 Adobe Systems Incorporated
// All Rights Reserved
//
// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms
// of the Adobe license agreement accompanying it.
// =================================================================================================
#ifndef _INFOMetadata_h_
#define _INFOMetadata_h_
#include "public/include/XMP_Environment.h" // ! XMP_Environment.h must be the first included header.
#include "public/include/XMP_Const.h"
#include "public/include/XMP_IO.hpp"
#include "XMPFiles/source/NativeMetadataSupport/IMetadata.h"
namespace IFF_RIFF
{
/**
* LIST INFO Metadata model.
* Implements the IMetadata interface
*/
class INFOMetadata : public IMetadata
{
public:
enum
{
kArtist = 0x49415254, // 'IART' std::string
kComments = 0x49434d54, // 'ICMT' std::string
kCopyright = 0x49434f50, // 'ICOP' std::string
kCreationDate = 0x49435244, // 'ICRD' std::string
kEngineer = 0x49454e47, // 'IENG' std::string
kGenre = 0x49474e52, // 'IGNR' std::string
kName = 0x494e414d, // 'INAM' std::string
kSoftware = 0x49534654, // 'ISFT' std::string
kMedium = 0x494d4544, // 'IMED' std::string
kSourceForm = 0x49535246, // 'ISRF' std::string
// new mappings
kArchivalLocation = 0x4941524C, // 'IARL'
kCommissioned = 0x49434D53, // 'ICMS'
kKeywords = 0x494B4559, // 'IKEY'
kProduct = 0x49505244, // 'IPRD'
kSubject = 0x4953424A, // 'ISBJ'
kSource = 0x49535243, // 'ISRC'
kTechnican = 0x49544348, // 'ITCH'
};
public:
/**
*ctor/dtor
*/
INFOMetadata();
~INFOMetadata();
/**
* @see IMetadata::parse
*/
void parse( const XMP_Uns8* input, XMP_Uns64 size );
/**
* See IMetadata::parse( const LFA_FileRef input )
*/
void parse( XMP_IO* input ) { IMetadata::parse( input ); }
/**
* @see IMetadata::serialize
*/
XMP_Uns64 serialize( XMP_Uns8** outBuffer );
protected:
/**
* @see IMetadata::isEmptyValue
*/
virtual bool isEmptyValue( XMP_Uns32 id, ValueObject& valueObj );
private:
// Operators hidden on purpose
INFOMetadata( const INFOMetadata& ) {};
INFOMetadata& operator=( const INFOMetadata& ) { return *this; };
};
}
#endif
|
/*
* Copyright (C) 2009 Samsung Electronics
* Heungjun Kim <riverful.kim@samsung.com>
* Inki Dae <inki.dae@samsung.com>
* Minkyu Kang <mk7.kang@samsung.com>
*
* See file CREDITS for list of people who contributed to this
* project.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
#include <common.h>
#include <asm/io.h>
#include <asm/arch/pwm.h>
#include <asm/arch/clk.h>
#define PRESCALER_1 (16 - 1) /* prescaler of timer 2, 3, 4 */
#define MUX_DIV_2 1 /* 1/2 period */
#define MUX_DIV_4 2 /* 1/4 period */
#define MUX_DIV_8 3 /* 1/8 period */
#define MUX_DIV_16 4 /* 1/16 period */
#define MUX4_DIV_SHIFT 16
#define TCON_TIMER4_SHIFT 20
static unsigned long count_value;
/* Internal tick units */
static unsigned long long timestamp; /* Monotonic incrementing timer */
static unsigned long lastdec; /* Last decremneter snapshot */
/* macro to read the 16 bit timer */
static inline struct s5pc1xx_timer *s5pc1xx_get_base_timer(void)
{
if (cpu_is_s5pc110())
return (struct s5pc1xx_timer *)S5PC110_TIMER_BASE;
else
return (struct s5pc1xx_timer *)S5PC100_TIMER_BASE;
}
int timer_init(void)
{
struct s5pc1xx_timer *const timer = s5pc1xx_get_base_timer();
u32 val;
/*
* @ PWM Timer 4
* Timer Freq(HZ) =
* PCLK / { (prescaler_value + 1) * (divider_value) }
*/
/* set prescaler : 16 */
/* set divider : 2 */
writel((PRESCALER_1 & 0xff) << 8, &timer->tcfg0);
writel((MUX_DIV_2 & 0xf) << MUX4_DIV_SHIFT, &timer->tcfg1);
if (count_value == 0) {
/* reset initial value */
/* count_value = 2085937.5(HZ) (per 1 sec)*/
count_value = get_pclk() / ((PRESCALER_1 + 1) *
(MUX_DIV_2 + 1));
/* count_value / 100 = 20859.375(HZ) (per 10 msec) */
count_value = count_value / 100;
}
/* set count value */
writel(count_value, &timer->tcntb4);
lastdec = count_value;
val = (readl(&timer->tcon) & ~(0x07 << TCON_TIMER4_SHIFT)) |
S5PC1XX_TCON4_AUTO_RELOAD;
/* auto reload & manual update */
writel(val | S5PC1XX_TCON4_UPDATE, &timer->tcon);
/* start PWM timer 4 */
writel(val | S5PC1XX_TCON4_START, &timer->tcon);
timestamp = 0;
return 0;
}
/*
* timer without interrupts
*/
void reset_timer(void)
{
reset_timer_masked();
}
unsigned long get_timer(unsigned long base)
{
return get_timer_masked() - base;
}
void set_timer(unsigned long t)
{
timestamp = t;
}
/* delay x useconds */
void udelay(unsigned long usec)
{
unsigned long tmo, tmp;
if (usec >= 1000) {
/*
* if "big" number, spread normalization
* to seconds
* 1. start to normalize for usec to ticks per sec
* 2. find number of "ticks" to wait to achieve target
* 3. finish normalize.
*/
tmo = usec / 1000;
tmo *= (CONFIG_SYS_HZ * count_value / 10);
tmo /= 1000;
} else {
/* else small number, don't kill it prior to HZ multiply */
tmo = usec * CONFIG_SYS_HZ * count_value / 10;
tmo /= (1000 * 1000);
}
/* get current timestamp */
tmp = get_timer(0);
/* if setting this fordward will roll time stamp */
/* reset "advancing" timestamp to 0, set lastdec value */
/* else, set advancing stamp wake up time */
if ((tmo + tmp + 1) < tmp)
reset_timer_masked();
else
tmo += tmp;
/* loop till event */
while (get_timer_masked() < tmo)
; /* nop */
}
void reset_timer_masked(void)
{
struct s5pc1xx_timer *const timer = s5pc1xx_get_base_timer();
/* reset time */
lastdec = readl(&timer->tcnto4);
timestamp = 0;
}
unsigned long get_timer_masked(void)
{
struct s5pc1xx_timer *const timer = s5pc1xx_get_base_timer();
unsigned long now = readl(&timer->tcnto4);
if (lastdec >= now)
timestamp += lastdec - now;
else
timestamp += lastdec + count_value - now;
lastdec = now;
return timestamp;
}
/*
* This function is derived from PowerPC code (read timebase as long long).
* On ARM it just returns the timer value.
*/
unsigned long long get_ticks(void)
{
return get_timer(0);
}
/*
* This function is derived from PowerPC code (timebase clock frequency).
* On ARM it returns the number of timer ticks per second.
*/
unsigned long get_tbclk(void)
{
return CONFIG_SYS_HZ;
}
|
#ifndef _CNWTILESURFACEMESHAABBNODE_H_
#define _CNWTILESURFACEMESHAABBNODE_H_
#include "nwndef.h"
class CNWTileSurfaceMeshAABBNode
{
public:
~CNWTileSurfaceMeshAABBNode();
};
#endif
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.