text stringlengths 4 6.14k |
|---|
// 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 UI_GFX_COLOR_UTILS_H_
#define UI_GFX_COLOR_UTILS_H_
#pragma once
#include "third_party/skia/include/core/SkColor.h"
class SkBitmap;
namespace color_utils {
// Represents an HSL color.
struct HSL {
double h;
double s;
double l;
};
unsigned char GetLuminanceForColor(SkColor color);
// Calculated according to http://www.w3.org/TR/WCAG20/#relativeluminancedef
double RelativeLuminance(SkColor color);
// Note: these transformations assume sRGB as the source color space
void SkColorToHSL(SkColor c, HSL* hsl);
SkColor HSLToSkColor(const HSL& hsl, SkAlpha alpha);
// HSL-Shift an SkColor. The shift values are in the range of 0-1, with the
// option to specify -1 for 'no change'. The shift values are defined as:
// hsl_shift[0] (hue): The absolute hue value - 0 and 1 map
// to 0 and 360 on the hue color wheel (red).
// hsl_shift[1] (saturation): A saturation shift, with the
// following key values:
// 0 = remove all color.
// 0.5 = leave unchanged.
// 1 = fully saturate the image.
// hsl_shift[2] (lightness): A lightness shift, with the
// following key values:
// 0 = remove all lightness (make all pixels black).
// 0.5 = leave unchanged.
// 1 = full lightness (make all pixels white).
SkColor HSLShift(SkColor color, const HSL& shift);
// Determine if a given alpha value is nearly completely transparent.
bool IsColorCloseToTransparent(SkAlpha alpha);
// Determine if a color is near grey.
bool IsColorCloseToGrey(int r, int g, int b);
// Gets a color representing a bitmap. The definition of "representing" is the
// average color in the bitmap. The color returned is modified to have the
// specified alpha.
SkColor GetAverageColorOfFavicon(SkBitmap* bitmap, SkAlpha alpha);
// Builds a histogram based on the Y' of the Y'UV representation of
// this image.
void BuildLumaHistogram(SkBitmap* bitmap, int histogram[256]);
// Returns a blend of the supplied colors, ranging from |background| (for
// |alpha| == 0) to |foreground| (for |alpha| == 255). The alpha channels of
// the supplied colors are also taken into account, so the returned color may
// be partially transparent.
SkColor AlphaBlend(SkColor foreground, SkColor background, SkAlpha alpha);
// Given a foreground and background color, try to return a foreground color
// that is "readable" over the background color by luma-inverting the foreground
// color and then picking whichever foreground color has higher contrast against
// the background color.
//
// NOTE: This won't do anything but waste time if the supplied foreground color
// has a luma value close to the midpoint (0.5 in the HSL representation).
SkColor GetReadableColor(SkColor foreground, SkColor background);
// Gets a Windows system color as a SkColor
SkColor GetSysSkColor(int which);
} // namespace color_utils
#endif // UI_GFX_COLOR_UTILS_H_
|
//
// NSRegularExpression+RFExtension.h
// libObjCAttr
//
// Copyright (c) 2014 EPAM Systems, 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 the EPAM Systems, 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 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.
//
// See the NOTICE file and the LICENSE file distributed with this work
// for additional information regarding copyright ownership and licensing
#import <Foundation/Foundation.h>
@interface NSRegularExpression (RFExtension)
+ (NSRegularExpression *)RF_regexFromString:(NSString *)regexString;
+ (NSString *)RF_stringByReplacingRegex:(NSString *)regexString withTemplate:(NSString *)template inString:(NSString *)sourceString;
+ (void)RF_replaceRegex:(NSString *)regexString withTemplate:(NSString *)template inString:(NSMutableString *)sourceString;
+ (NSUInteger)RF_numberOfMatchesToRegex:(NSString *)regexString inString:(NSString *)sourceString;
@end
|
/*
* Copyright (C) 2009 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 THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_LAYOUT_RUBY_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_LAYOUT_RUBY_H_
#include "third_party/blink/renderer/core/layout/layout_block_flow.h"
#include "third_party/blink/renderer/core/layout/layout_inline.h"
namespace blink {
// Following the HTML 5 spec, the box object model for a <ruby> element allows
// several runs of ruby
// bases with their respective ruby texts looks as follows:
//
// 1 LayoutRuby object, corresponding to the whole <ruby> HTML element
// 1+ LayoutRubyRun (anonymous)
// 0 or 1 LayoutRubyText - shuffled to the front in order to re-use
// existing block layouting
// 0-n inline object(s)
// 0 or 1 LayoutRubyBase - contains the inline objects that make up the
// ruby base
// 1-n inline object(s)
//
// Note: <rp> elements are defined as having 'display:none' and thus normally
// are not assigned a layoutObject.
//
// Generated :before/:after content is shunted into anonymous inline blocks
// <ruby> when used as 'display:inline'
class LayoutRubyAsInline final : public LayoutInline {
public:
LayoutRubyAsInline(Element*);
~LayoutRubyAsInline() override;
void AddChild(LayoutObject* child,
LayoutObject* before_child = nullptr) override;
void RemoveChild(LayoutObject* child) override;
const char* GetName() const override {
NOT_DESTROYED();
return "LayoutRuby (inline)";
}
protected:
void StyleDidChange(StyleDifference, const ComputedStyle* old_style) override;
private:
bool IsOfType(LayoutObjectType type) const override {
NOT_DESTROYED();
return type == kLayoutObjectRuby || LayoutInline::IsOfType(type);
}
bool CreatesAnonymousWrapper() const override {
NOT_DESTROYED();
return true;
}
};
// <ruby> when used as 'display:block' or 'display:inline-block'
class LayoutRubyAsBlock : public LayoutBlockFlow {
public:
LayoutRubyAsBlock(Element*);
~LayoutRubyAsBlock() override;
void AddChild(LayoutObject* child,
LayoutObject* before_child = nullptr) override;
void RemoveChild(LayoutObject* child) override;
const char* GetName() const override {
NOT_DESTROYED();
return "LayoutRuby (block)";
}
protected:
void StyleDidChange(StyleDifference, const ComputedStyle* old_style) override;
bool IsOfType(LayoutObjectType type) const override {
NOT_DESTROYED();
return type == kLayoutObjectRuby || LayoutBlockFlow::IsOfType(type);
}
private:
bool CreatesAnonymousWrapper() const override {
NOT_DESTROYED();
return true;
}
void RemoveLeftoverAnonymousBlock(LayoutBlock*) override {
NOT_DESTROYED();
NOTREACHED();
}
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_LAYOUT_RUBY_H_
|
#pragma once
#include <geode/utility/type_traits.h>
namespace geode {
class ValueBase;
class PropBase;
template<class T> class Value;
template<class T> class ValueRef;
class Action;
template<class T> class Prop;
template<class T> class PropRef;
class Listen;
class PropManager;
template<class T> struct has_clamp : public mpl::false_{};
template<> struct has_clamp<int> : public mpl::true_{};
template<> struct has_clamp<double> : public mpl::true_{};
}
|
// Copyright 2010-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 MOZC_BASE_DEBUG_H_
#define MOZC_BASE_DEBUG_H_
#include "base/port.h"
namespace mozc {
class Debug {
public:
// A NOP function to make the compiler/linker think |variable| is aliased.
// You can use this method to ensure the |variable| exists against
// optimization and is alive at the point of this method is called so that
// |variable| can be seen when a crash happens at that point.
static void Alias(const void *variable);
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(Debug);
};
} // namespace mozc
#endif // MOZC_BASE_DEBUG_H_
|
//
// GADRewardBasedVideoAd.h
// Google Mobile Ads SDK
//
// Copyright 2015 Google Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <GoogleMobileAds/GADRequest.h>
#import <GoogleMobileAds/GADRewardBasedVideoAdDelegate.h>
NS_ASSUME_NONNULL_BEGIN
/// The GADRewardBasedVideoAd class is used for requesting and presenting a reward based video ad.
/// This class isn't thread safe.
GAD_SUBCLASSING_RESTRICTED
@interface GADRewardBasedVideoAd : NSObject
/// Delegate for receiving video notifications.
@property(nonatomic, weak, nullable) id<GADRewardBasedVideoAdDelegate> delegate;
/// Indicates if the receiver is ready to be presented full screen.
@property(nonatomic, readonly, getter=isReady) BOOL ready;
/// The ad network class name that fetched the current ad. Returns nil while the latest ad request
/// is in progress or if the latest ad request failed. For both standard and mediated Google AdMob
/// ads, this property returns @"GADMAdapterGoogleAdMobAds". For ads fetched via mediation custom
/// events, this property returns the mediated custom event adapter.
@property(nonatomic, readonly, copy, nullable) NSString *adNetworkClassName;
/// A unique identifier used to identify the user when making server-to-server reward callbacks.
/// This value is used at both request time and during ad display. New values must only be set
/// before ad requests.
@property(nonatomic, copy, nullable) NSString *userIdentifier;
/// Optional custom reward string to include in the server-to-server callback.
@property(nonatomic, copy, nullable) NSString *customRewardString;
/// Returns the shared GADRewardBasedVideoAd instance.
+ (GADRewardBasedVideoAd *)sharedInstance;
/// Initiates the request to fetch the reward based video ad. The |request| object supplies ad
/// targeting information and must not be nil. The adUnitID is the ad unit id used for fetching an
/// ad and must not be nil.
- (void)loadRequest:(GADRequest *)request withAdUnitID:(NSString *)adUnitID;
/// Presents the reward based video ad with the provided view controller.
- (void)presentFromRootViewController:(UIViewController *)viewController;
@end
NS_ASSUME_NONNULL_END
|
// Copyright (c) 2015-2016 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_TEST_TEST_BITCOIN_H
#define BITCOIN_TEST_TEST_BITCOIN_H
#include "chainparamsbase.h"
#include "fs.h"
#include "key.h"
#include "pubkey.h"
#include "random.h"
#include "txdb.h"
#include "txmempool.h"
#include <boost/thread.hpp>
extern uint256 insecure_rand_seed;
extern FastRandomContext insecure_rand_ctx;
static inline void SeedInsecureRand(bool fDeterministic = false)
{
if (fDeterministic) {
insecure_rand_seed = uint256();
} else {
insecure_rand_seed = GetRandHash();
}
insecure_rand_ctx = FastRandomContext(insecure_rand_seed);
}
static inline uint32_t InsecureRand32() { return insecure_rand_ctx.rand32(); }
static inline uint256 InsecureRand256() { return insecure_rand_ctx.rand256(); }
static inline uint64_t InsecureRandBits(int bits) { return insecure_rand_ctx.randbits(bits); }
static inline uint64_t InsecureRandRange(uint64_t range) { return insecure_rand_ctx.randrange(range); }
static inline bool InsecureRandBool() { return insecure_rand_ctx.randbool(); }
/** Basic testing setup.
* This just configures logging and chain parameters.
*/
struct BasicTestingSetup {
ECCVerifyHandle globalVerifyHandle;
BasicTestingSetup(const std::string& chainName = CBaseChainParams::MAIN);
~BasicTestingSetup();
};
/** Testing setup that configures a complete environment.
* Included are data directory, coins database, script check threads setup.
*/
class CConnman;
struct TestingSetup: public BasicTestingSetup {
CCoinsViewDB *pcoinsdbview;
fs::path pathTemp;
boost::thread_group threadGroup;
CConnman* connman;
TestingSetup(const std::string& chainName = CBaseChainParams::MAIN);
~TestingSetup();
};
class CBlock;
struct CMutableTransaction;
class CScript;
//
// Testing fixture that pre-creates a
// 100-block REGTEST-mode block chain
//
struct TestChain100Setup : public TestingSetup {
TestChain100Setup();
// Create a new block with just given transactions, coinbase paying to
// scriptPubKey, and try to add it to the current chain.
CBlock CreateAndProcessBlock(const std::vector<CMutableTransaction>& txns,
const CScript& scriptPubKey);
~TestChain100Setup();
std::vector<CTransaction> coinbaseTxns; // For convenience, coinbase transactions
CKey coinbaseKey; // private/public key needed to spend coinbase transactions
};
class CTxMemPoolEntry;
struct TestMemPoolEntryHelper
{
// Default values
CAmount nFee;
int64_t nTime;
unsigned int nHeight;
bool spendsCoinbase;
unsigned int sigOpCost;
LockPoints lp;
TestMemPoolEntryHelper() :
nFee(0), nTime(0), nHeight(1),
spendsCoinbase(false), sigOpCost(4) { }
CTxMemPoolEntry FromTx(const CMutableTransaction &tx);
CTxMemPoolEntry FromTx(const CTransaction &tx);
// Change the default value
TestMemPoolEntryHelper &Fee(CAmount _fee) { nFee = _fee; return *this; }
TestMemPoolEntryHelper &Time(int64_t _time) { nTime = _time; return *this; }
TestMemPoolEntryHelper &Height(unsigned int _height) { nHeight = _height; return *this; }
TestMemPoolEntryHelper &SpendsCoinbase(bool _flag) { spendsCoinbase = _flag; return *this; }
TestMemPoolEntryHelper &SigOpsCost(unsigned int _sigopsCost) { sigOpCost = _sigopsCost; return *this; }
};
#endif
|
/*
* Name: outputMetricsData
* Input: FILE pointer for output, file
* metrics structure, metrics
* Output: none
* Return: void
* Description: The routine displays the metrics collected during a
* execution of the baseline application. The routine
* calcMetricsData() is called to setup all of the displayed
* fields.
* Calls: calcMetricsData()
* System: fprintf()
* Author: M.L.Rivas
*
* Revision History:
*
* Date Name Revision
* ------- --------------- ------------------------------
* 28May99 Matthew Rivas Created
*
* Copyright 1999, Atlantic Aerospace Electronics Corp.
*/
#include <assert.h> /* for assert() */
#include <stdio.h> /* for fprintf() definition */
#include "dataManagement.h" /* for primitive type definitions */
#include "metrics.h" /* for Metrics definitions */
/*
* Function prototype
*/
extern void calcMetricsData( Metrics *metrics );
void outputMetricsData( FILE *file, /* output file */
Metrics *metrics ) /* metrics to output */
{ /* beginning of outputMetricsData() */
assert( file );
assert( metrics );
/*
* Calculate the metric statistical values
*/
calcMetricsData( metrics );
/*
* Display the metric statistical values
*/
fprintf( file, "DIS Data Management Metrics\n" );
fprintf( file, " total time = %li msecs\n", metrics->totalTime );
fprintf( file, " input time = %li msecs\n", metrics->inputTime );
fprintf( file, " output time = %li msecs\n", metrics->outputTime );
fprintf( file, " Insert Commmand Metrics:\n" );
fprintf( file, " best time = %li msecs\n",
metrics->insertCommandMetric.best );
fprintf( file, " worst time = %li msecs\n",
metrics->insertCommandMetric.worst );
fprintf( file, " average = %f msecs\n",
metrics->insertCommandMetric.avg );
fprintf( file, " standard deviation = %f msecs\n",
metrics->insertCommandMetric.deviation );
fprintf( file, " Query Commmand Metrics:\n" );
fprintf( file, " best time = %li msecs\n",
metrics->queryCommandMetric.best );
fprintf( file, " worst time = %li msecs\n",
metrics->queryCommandMetric.worst );
fprintf( file, " average = %f msecs\n",
metrics->queryCommandMetric.avg );
fprintf( file, " standard deviation = %f msecs\n",
metrics->queryCommandMetric.deviation );
fprintf( file, " Delete Commmand Metrics:\n" );
fprintf( file, " best time = %li msecs\n",
metrics->deleteCommandMetric.best );
fprintf( file, " worst time = %li msecs\n",
metrics->deleteCommandMetric.worst );
fprintf( file, " average = %f msecs\n",
metrics->deleteCommandMetric.avg );
fprintf( file, " standard deviation = %f msecs\n",
metrics->deleteCommandMetric.deviation );
return;
} /* end of outputMetricsData() */
|
// diStorm64 library sample
// http://ragestorm.net/distorm/
// Arkon, Stefan, 2005
// Mikhail, 2006
// JvW, 2007
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <errno.h>
#include <sys/stat.h>
// For the compilers who don't have sysexits.h, which is not an ISO/ANSI include!
#define EX_OK 0
#define EX_USAGE 64
#define EX_DATAERR 65
#define EX_NOINPUT 66
#define EX_NOUSER 67
#define EX_NOHOST 68
#define EX_UNAVAILABLE 69
#define EX_SOFTWARE 70
#define EX_OSERR 71
#define EX_OSFILE 72
#define EX_CANTCREAT 73
#define EX_IOERR 74
#define EX_TEMPFAIL 75
#define EX_PROTOCOL 76
#define EX_NOPERM 77
#define EX_CONFIG 78
#include "../../include/distorm.h"
// The number of the array of instructions the decoder function will use to return the disassembled instructions.
// Play with this value for performance...
#define MAX_INSTRUCTIONS (1000)
int main(int argc, char **argv)
{
// Version of used compiled library.
unsigned int dver = 0;
// Holds the result of the decoding.
_DecodeResult res;
// Decoded instruction information.
_DecodedInst decodedInstructions[MAX_INSTRUCTIONS];
// next is used for instruction's offset synchronization.
// decodedInstructionsCount holds the count of filled instructions' array by the decoder.
unsigned int decodedInstructionsCount = 0, i, next;
// Default decoding mode is 32 bits, could be set by command line.
_DecodeType dt = Decode32Bits;
// Default offset for buffer is 0, could be set in command line.
_OffsetType offset = 0;
char* errch = NULL;
// Index to file name in argv.
int param = 1;
// Handling file.
FILE* f;
unsigned long filesize = 0, bytesread = 0;
struct stat st;
// Buffer to disassemble.
unsigned char *buf, *buf2;
// Disassembler version.
dver = distorm_version();
printf("diStorm version: %u.%u.%u\n", (dver >> 16), ((dver) >> 8) & 0xff, dver & 0xff);
// Check params.
if (argc < 2 || argc > 4) {
printf("Usage: ./disasm [-b16] [-b64] filename [memory offset]\r\nRaw disassembler output.\r\nMemory offset is origin of binary file in memory (address in hex).\r\nDefault decoding mode is -b32.\r\nexample: disasm -b16 demo.com 789a\r\n");
return EX_USAGE;
}
if (strncmp(argv[param], "-b16", 4) == 0) {
dt = Decode16Bits;
param++;
} else if (strncmp(argv[param], "-b64", 4) == 0) {
dt = Decode64Bits;
param++;
} else if (*argv[param] == '-') {
fputs("Decoding mode size isn't specified!\n", stderr);
return EX_USAGE;
} else if (argc == 4) {
fputs("Too many parameters are set.\n", stderr);
return EX_USAGE;
}
if (param >= argc) {
fputs("Filename is missing.\n", stderr);
return EX_USAGE;
}
if (param + 1 == argc-1) { // extra param?
#ifdef SUPPORT_64BIT_OFFSET
offset = strtoull(argv[param + 1], &errch, 16);
#else
offset = strtoul(argv[param + 1], &errch, 16);
#endif
if (*errch != '\0') {
fprintf(stderr, "Offset `%s' couldn't be converted.\n", argv[param + 1]);
return EX_USAGE;
}
}
f = fopen(argv[param], "rb");
if (f == NULL) {
perror(argv[param]);
return EX_NOINPUT;
}
if (fstat(fileno(f), &st) != 0) {
perror("fstat");
fclose(f);
return EX_NOINPUT;
}
filesize = st.st_size;
// We read the whole file into memory in order to make life easier,
// otherwise we would have to synchronize the code buffer as well (so instructions won't be split).
buf2 = buf = malloc(filesize);
if (buf == NULL) {
perror("File too large.");
fclose(f);
return EX_UNAVAILABLE;
}
bytesread = fread(buf, 1, filesize, f);
if (bytesread != filesize) {
perror("Can't read file into memory.");
free(buf);
fclose(f);
return EX_IOERR;
}
fclose(f);
printf("bits: %d\nfilename: %s\norigin: ", dt == Decode16Bits ? 16 : dt == Decode32Bits ? 32 : 64, argv[param]);
#ifdef SUPPORT_64BIT_OFFSET
if (dt != Decode64Bits) printf("%08llx\n", offset);
else printf("%016llx\n", offset);
#else
printf("%08x\n", offset);
#endif
// Decode the buffer at given offset (virtual address).
while (1) {
// If you get an undefined reference linker error for the following line,
// change the SUPPORT_64BIT_OFFSET in distorm.h.
res = distorm_decode(offset, (const unsigned char*)buf, filesize, dt, decodedInstructions, MAX_INSTRUCTIONS, &decodedInstructionsCount);
if (res == DECRES_INPUTERR) {
// Null buffer? Decode type not 16/32/64?
fputs("Input error, halting!\n", stderr);
free(buf2);
return EX_SOFTWARE;
}
for (i = 0; i < decodedInstructionsCount; i++)
#ifdef SUPPORT_64BIT_OFFSET
printf("%0*llx (%02d) %-24s %s%s%s\r\n", dt != Decode64Bits ? 8 : 16, decodedInstructions[i].offset, decodedInstructions[i].size, (char*)decodedInstructions[i].instructionHex.p, (char*)decodedInstructions[i].mnemonic.p, decodedInstructions[i].operands.length != 0 ? " " : "", (char*)decodedInstructions[i].operands.p);
#else
printf("%08x (%02d) %-24s %s%s%s\r\n", decodedInstructions[i].offset, decodedInstructions[i].size, (char*)decodedInstructions[i].instructionHex.p, (char*)decodedInstructions[i].mnemonic.p, decodedInstructions[i].operands.length != 0 ? " " : "", (char*)decodedInstructions[i].operands.p);
#endif
if (res == DECRES_SUCCESS) break; // All instructions were decoded.
else if (decodedInstructionsCount == 0) break;
// Synchronize:
next = (unsigned int)(decodedInstructions[decodedInstructionsCount-1].offset - offset);
next += decodedInstructions[decodedInstructionsCount-1].size;
// Advance ptr and recalc offset.
buf += next;
filesize -= next;
offset += next;
}
// Release buffer
free(buf2);
return EX_OK;
}
|
/*
* DIS Data Management Index
*
* This file contains the index structures for the DIS R-Tree basline
* application. The two structures defined are for index entries and for
* index nodes.
*
* An index entry will reference either an index node or a
* data object. All entries which are in the index reside on an index
* node. An entry which resides on a leaf node (level = 0) references a
* data object, while an entry which resides on a non-leaf node (level > 0)
* references an index node. Since the entry may reference two different
* types of objects, the member is a union between the two types. The
* entry contains an index key which is used for traversals of the index.
* For the R-Tree index, the index key is the hyper-cube which minimally
* encloses the object it references. If the child reference is a data
* object, the index key for the entry is the appropriate values of the
* data object. If the child reference is an index node, the index key of
* the entry is the bounding hyper-cube of all of the entries residing on
* that node. The final member of the index entry structure is a pointer
* to another index entry structure which gives linked-list behavior to
* entries.
*
* An index node is a container of a list of index entries. Each node
* contains an integer level value. Note that the leaf level is zero and
* the level increases as the tree is ascended, i.e., the root level is
* always greater than or equal to the leaf level. The number of entries
* in the list is always between one and the fan or order of the index.
* Note that the fan of the index is read at run-time, so a fixed array of
* entries is not permitted.
*
* Revision History:
*
* Date Name Revision
* ------- --------------- ------------------------------
* 24May99 Matthew Rivas Created
*
* Copyright 1999, Atlantic Aerospace Electronics Corp.
*/
#ifndef DIS_INDEX_H
#define DIS_INDEX_H
#include "dataManagement.h" /* for basic data types */
#include "dataObject.h" /* for data object definition */
#include "indexKey.h" /* for index key definition */
/*
* Index Node
* - contains a list of entries which reside on node
* - has a level specifier where all levels are greater than or equal to
* the LEAF level.
*/
typedef struct
{
Int level; /* level where node resides in index */
struct IndexEntry *entries; /* list of entries on node */
} IndexNode;
/*
* Prototypes for routines which create, delete, and display IndexNode
* structures.
*/
extern IndexNode *createIndexNode( Int level );
extern void deleteIndexNode( IndexNode * node );
extern void outputIndexNode( IndexNode * node, Int indent );
/*
* Index Entry
* - references a child object, either a data object or index node
* - has a key which "encloses" the child object
* - has a pointer to support single link-list capability
*/
struct IndexEntry
{
union {
IndexNode *node;
DataObject *dataObject;
} child;
IndexKey key;
struct IndexEntry *next;
};
typedef struct IndexEntry IndexEntry;
/*
* Prototypes for routines which create, delete, and display IndexEntry
* structures.
*/
extern IndexEntry *createIndexEntry( void );
extern void deleteIndexEntry( IndexEntry * entry, Int level );
extern void outputIndexEntry( IndexEntry * entry, Int level, Int indent );
#endif /* DIS_INDEX_H */
|
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
#pragma once
#include "Scenario3.g.h"
namespace winrt::SDKTemplate::implementation
{
struct Scenario3 : Scenario3T<Scenario3>
{
Scenario3();
fire_and_forget GetFilesButton_Click(Windows::Foundation::IInspectable const&, Windows::UI::Xaml::RoutedEventArgs const&);
private:
static hstring GetPropertyDisplayValue(Windows::Foundation::IInspectable const& rawValue);
};
}
namespace winrt::SDKTemplate::factory_implementation
{
struct Scenario3 : Scenario3T<Scenario3, implementation::Scenario3>
{
};
}
|
#include "os.h"
#include <mp.h>
#include <libsec.h>
DSApub*
dsaprivtopub(DSApriv *priv)
{
DSApub *pub;
pub = dsapuballoc();
pub->p = mpcopy(priv->pub.p);
pub->q = mpcopy(priv->pub.q);
pub->alpha = mpcopy(priv->pub.alpha);
pub->key = mpcopy(priv->pub.key);
return pub;
}
|
//
// ViewController.h
// NuweScoreDevApp
//
// Created by Ahmed Ghalab on 11/10/14.
// Copyright (c) 2014 Nu Wellness Ltd. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <NuweScoreCharts/NuweScoreCharts.h>
@interface ViewController : UIViewController <NUDialChartDataSource, NUDialChartDelegate>
@property (strong, nonatomic) IBOutlet UIView *BigDialChartContainerView;
@property (strong, nonatomic) IBOutlet NUDialChart *BigDialChart;
@end
|
/***********************************************************************
created: 12/2/2012
author: Paul D Turner
*************************************************************************/
/***************************************************************************
* Copyright (C) 2004 - 2012 Paul D Turner & The CEGUI Development Team
*
* 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 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 _CEGuiGLFWSharedBase_h_
#define _CEGuiGLFWSharedBase_h_
#include "CEGuiBaseApplication.h"
#include "CEGUI/MouseCursor.h"
#include <GL/glfw.h>
class SamplesFrameworkBase;
class CEGuiGLFWSharedBase : public CEGuiBaseApplication
{
public:
CEGuiGLFWSharedBase();
~CEGuiGLFWSharedBase();
protected:
// implementation of base class abstract functions.
void run();
void destroyWindow();
void beginRendering(const float elapsed);
void endRendering();
/*************************************************************************
Implementation Methods
*************************************************************************/
static void initGLFW();
static void createGLFWWindow();
static void setGLFWAppConfiguration();
void drawFrame();
static void GLFWCALL glfwKeyCallback(int key, int action);
static void GLFWCALL glfwCharCallback(int character, int action);
static void GLFWCALL glfwMouseButtonCallback(int key, int action);
static void GLFWCALL glfwMouseWheelCallback(int position);
static void GLFWCALL glfwMousePosCallback(int x, int y );
static int GLFWCALL glfwWindowCloseCallback(void);
static void GLFWCALL glfwWindowResizeCallback(int width, int height);
static CEGUI::Key::Scan GlfwToCeguiKey(int glfwKey);
static CEGUI::MouseButton GlfwToCeguiMouseButton(int glfwButton);
/*************************************************************************
Data fields
*************************************************************************/
static CEGuiGLFWSharedBase* d_appInstance;
static double d_frameTime;
static int d_modifiers;
static bool d_windowSized;
static int d_newWindowWidth;
static int d_newWindowHeight;
static bool d_mouseLeftWindow;
static bool d_mouseDisableCalled;
static int d_oldMousePosX;
static int d_oldMousePosY;
};
#endif // end of guard _CEGuiGLFWSharedBase_h_
|
//******************************************************************************
//
// Copyright (c) 2015 Microsoft Corporation. All rights reserved.
//
// This code is licensed under the MIT License (MIT).
//
// 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.
//
//******************************************************************************
// WindowsDataPdf.h
// Generated from winmd2objc
#pragma once
#ifndef OBJCUWPWINDOWSDATAPDFEXPORT
#define OBJCUWPWINDOWSDATAPDFEXPORT __declspec(dllimport)
#ifndef IN_WinObjC_Frameworks_UWP_BUILD
#pragma comment(lib, "ObjCUWPWindowsDataPdf.lib")
#endif
#endif
#include <UWP/interopBase.h>
@class WDPPdfPageRenderOptions, WDPPdfPageDimensions, WDPPdfPage, WDPPdfDocument;
@protocol WDPIPdfPageDimensions, WDPIPdfPageRenderOptions, WDPIPdfPage, WDPIPdfDocument, WDPIPdfDocumentStatics;
// Windows.Data.Pdf.PdfPageRotation
enum _WDPPdfPageRotation {
WDPPdfPageRotationNormal = 0,
WDPPdfPageRotationRotate90 = 1,
WDPPdfPageRotationRotate180 = 2,
WDPPdfPageRotationRotate270 = 3,
};
typedef unsigned WDPPdfPageRotation;
#include "WindowsUI.h"
#include "WindowsFoundation.h"
#include "WindowsStorageStreams.h"
#include "WindowsStorage.h"
#import <Foundation/Foundation.h>
// Windows.Data.Pdf.PdfPageRenderOptions
#ifndef __WDPPdfPageRenderOptions_DEFINED__
#define __WDPPdfPageRenderOptions_DEFINED__
OBJCUWPWINDOWSDATAPDFEXPORT
@interface WDPPdfPageRenderOptions : RTObject
+ (instancetype)make __attribute__ ((ns_returns_retained));
#if defined(__cplusplus)
+ (instancetype)createWith:(IInspectable*)obj __attribute__ ((ns_returns_autoreleased));
#endif
@property (retain) WFRect* sourceRect;
@property BOOL isIgnoringHighContrast;
@property unsigned int destinationWidth;
@property unsigned int destinationHeight;
@property WFGUID* bitmapEncoderId;
@property (retain) WUColor* backgroundColor;
@end
#endif // __WDPPdfPageRenderOptions_DEFINED__
// Windows.Data.Pdf.PdfPageDimensions
#ifndef __WDPPdfPageDimensions_DEFINED__
#define __WDPPdfPageDimensions_DEFINED__
OBJCUWPWINDOWSDATAPDFEXPORT
@interface WDPPdfPageDimensions : RTObject
#if defined(__cplusplus)
+ (instancetype)createWith:(IInspectable*)obj __attribute__ ((ns_returns_autoreleased));
#endif
@property (readonly) WFRect* artBox;
@property (readonly) WFRect* bleedBox;
@property (readonly) WFRect* cropBox;
@property (readonly) WFRect* mediaBox;
@property (readonly) WFRect* trimBox;
@end
#endif // __WDPPdfPageDimensions_DEFINED__
// Windows.Foundation.IClosable
#ifndef __WFIClosable_DEFINED__
#define __WFIClosable_DEFINED__
@protocol WFIClosable
- (void)close;
@end
OBJCUWPWINDOWSDATAPDFEXPORT
@interface WFIClosable : RTObject <WFIClosable>
@end
#endif // __WFIClosable_DEFINED__
// Windows.Data.Pdf.PdfPage
#ifndef __WDPPdfPage_DEFINED__
#define __WDPPdfPage_DEFINED__
OBJCUWPWINDOWSDATAPDFEXPORT
@interface WDPPdfPage : RTObject <WFIClosable>
#if defined(__cplusplus)
+ (instancetype)createWith:(IInspectable*)obj __attribute__ ((ns_returns_autoreleased));
#endif
@property (readonly) WDPPdfPageDimensions* dimensions;
@property (readonly) unsigned int index;
@property (readonly) float preferredZoom;
@property (readonly) WDPPdfPageRotation rotation;
@property (readonly) WFSize* size;
- (RTObject<WFIAsyncAction>*)renderToStreamAsync:(RTObject<WSSIRandomAccessStream>*)outputStream;
- (RTObject<WFIAsyncAction>*)renderWithOptionsToStreamAsync:(RTObject<WSSIRandomAccessStream>*)outputStream options:(WDPPdfPageRenderOptions*)options;
- (RTObject<WFIAsyncAction>*)preparePageAsync;
- (void)close;
@end
#endif // __WDPPdfPage_DEFINED__
// Windows.Data.Pdf.PdfDocument
#ifndef __WDPPdfDocument_DEFINED__
#define __WDPPdfDocument_DEFINED__
OBJCUWPWINDOWSDATAPDFEXPORT
@interface WDPPdfDocument : RTObject
+ (void)loadFromFileAsync:(RTObject<WSIStorageFile>*)file success:(void (^)(WDPPdfDocument*))success failure:(void (^)(NSError*))failure;
+ (void)loadFromFileWithPasswordAsync:(RTObject<WSIStorageFile>*)file password:(NSString *)password success:(void (^)(WDPPdfDocument*))success failure:(void (^)(NSError*))failure;
+ (void)loadFromStreamAsync:(RTObject<WSSIRandomAccessStream>*)inputStream success:(void (^)(WDPPdfDocument*))success failure:(void (^)(NSError*))failure;
+ (void)loadFromStreamWithPasswordAsync:(RTObject<WSSIRandomAccessStream>*)inputStream password:(NSString *)password success:(void (^)(WDPPdfDocument*))success failure:(void (^)(NSError*))failure;
#if defined(__cplusplus)
+ (instancetype)createWith:(IInspectable*)obj __attribute__ ((ns_returns_autoreleased));
#endif
@property (readonly) BOOL isPasswordProtected;
@property (readonly) unsigned int pageCount;
- (WDPPdfPage*)getPage:(unsigned int)pageIndex;
@end
#endif // __WDPPdfDocument_DEFINED__
|
/*
The MIT License
Copyright (c) 2012 by Jorrit Tyberghein
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 __appares_projectdata_h
#define __appares_projectdata_h
#include <crystalspace.h>
#include <wx/wx.h>
#include <wx/imaglist.h>
#include <wx/listctrl.h>
#include <wx/xrc/xmlres.h>
#include <wx/dirctrl.h>
class UIManager;
class ProjectDataDialog : public wxDialog
{
private:
iObjectRegistry* object_reg;
UIManager* uiManager;
void OnOkButton (wxCommandEvent& event);
void OnCancelButton (wxCommandEvent& event);
public:
ProjectDataDialog (wxWindow* parent, iObjectRegistry* object_reg, UIManager* uiManager);
~ProjectDataDialog ();
void Show ();
DECLARE_EVENT_TABLE ();
};
#endif // __appares_projectdata_h
|
/* Fig. 8.38: fig08_38.c
Using strlen */
#include <stdio.h>
#include <string.h>
int main( void )
{
/* initialize 3 char pointers */
const char *string1 = "abcdefghijklmnopqrstuvwxyz";
const char *string2 = "four";
const char *string3 = "Boston";
printf("%s\"%s\"%s%lu\n%s\"%s\"%s%lu\n%s\"%s\"%s%lu\n",
"The length of ", string1, " is ",
( unsigned long ) strlen( string1 ),
"The length of ", string2, " is ",
( unsigned long ) strlen( string2 ),
"The length of ", string3, " is ",
( unsigned long ) strlen( string3 ) );
return 0; /* indicates successful termination */
} /* end main */
/**************************************************************************
* (C) Copyright 1992-2010 by Deitel & Associates, Inc. and *
* Pearson Education, Inc. All Rights Reserved. *
* *
* DISCLAIMER: The authors and publisher of this book have used their *
* best efforts in preparing the book. These efforts include the *
* development, research, and testing of the theories and programs *
* to determine their effectiveness. The authors and publisher make *
* no warranty of any kind, expressed or implied, with regard to these *
* programs or to the documentation contained in these books. The authors *
* and publisher shall not be liable in any event for incidental or *
* consequential damages in connection with, or arising out of, the *
* furnishing, performance, or use of these programs. *
*************************************************************************/
|
/*
* CRRCsim - the Charles River Radio Control Club Flight Simulator Project
*
* Copyright (C) 2005, 2007-2009 Jan Reucker (original author)
* Copyright (C) 2007, 2008 Jens Wilhelm Wulf
*
* 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., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
/** \file crrc_graphics.h
*
* The public declarations for crrc_graphics.cpp.
*/
#ifndef CRRC_GRAPHICS_H
#define CRRC_GRAPHICS_H
#include <plib/ssg.h>
#include "../include_gl.h"
#include "../config.h"
#include "../mod_math/vector3.h"
namespace Video
{
/**
* Struct for storing video buffer depth information.
*/
typedef struct
{
int red; ///< bpp of red component
int green; ///< bpp of green component
int blue; ///< bpp of blue component
int alpha; ///< bpp of alpha component
int depth; ///< bpp of depth buffer
int stencil; ///< bpp of stencil buffer
} T_VideoBitDepthInfo;
// --- global variables defined in crrc_graphics.cpp -------
extern T_VideoBitDepthInfo vidbits;
extern ssgRoot *scene;
extern int window_xsize; // Size of window in x direction
extern int window_ysize; // Size of window in y direction
extern int screen_xsize; // Size of screen in x direction
extern int screen_ysize; // Size of screen in y direction
extern float flSloppyCam;
extern CRRCMath::Vector3 looking_pos;
// --- functions defined in crrc_graphics.cpp --------------
unsigned char * read_bwimage(const char *name, int *w, int *h);
unsigned char * read_rgbimage(const char *name,int *w, int *h);
GLuint make_texture(unsigned char *pixel_data, GLint pixel_format, GLint format,
GLsizei width, GLsizei height, bool use_mipmaps);
void reshape(int w, int h);
void drawSolidCube(GLfloat size);
void dumpGLStackInfo(FILE* pFile);
ssgContext* getGlobalRenderingContext();
} // end namespace Video::
#endif
|
/*
* include/linux/venet.h
*
* Copyright (C) 2005 SWsoft
* All rights reserved.
*
* Licensing governed by "linux/COPYING.SWsoft" file.
*
*/
#ifndef _VENET_H
#define _VENET_H
#include <linux/list.h>
#include <linux/spinlock.h>
#include <uapi/linux/vzcalluser.h>
#include <linux/veip.h>
#include <linux/netdevice.h>
#define VEIP_HASH_SZ 512
struct ve_struct;
struct venet_stat;
struct venet_stats {
struct net_device_stats stats;
struct net_device_stats *real_stats;
};
struct ip_entry_struct
{
struct ve_addr_struct addr;
struct ve_struct *active_env;
struct veip_struct *tgt_veip;
struct hlist_node ip_hash;
union {
struct list_head ve_list;
struct rcu_head rcu;
};
};
struct ext_entry_struct
{
struct list_head list;
struct ve_addr_struct addr;
struct rcu_head rcu;
};
struct veip_struct
{
struct list_head src_lh;
struct list_head dst_lh;
struct list_head ip_lh;
struct list_head list;
struct list_head ext_lh;
envid_t veid;
struct venet_stat *stat;
struct rcu_head rcu;
};
struct veip_pool_ops {
int (*veip_create)(struct ve_struct *);
void (*veip_release)(struct ve_struct *);
void (*veip_free)(struct veip_struct *);
struct ve_struct *(*veip_lookup)(struct ve_struct *, struct sk_buff *);
};
extern struct veip_pool_ops *veip_pool_ops;
static inline struct net_device_stats *
venet_stats(struct net_device *dev, int cpu)
{
struct venet_stats *stats;
stats = (struct venet_stats*)dev->ml_priv;
return per_cpu_ptr(stats->real_stats, cpu);
}
void ip_entry_hash(struct ip_entry_struct *entry, struct veip_struct *veip);
void ip_entry_unhash(struct ip_entry_struct *entry);
void ip_entry_unhash(struct ip_entry_struct *entry);
struct ip_entry_struct *venet_entry_lookup(struct ve_addr_struct *);
struct veip_struct *veip_find(envid_t veid);
struct veip_struct *veip_findcreate(envid_t veid);
int veip_put(struct veip_struct *veip);
void veip_cleanup(void);
int in4_to_veaddr(const char *addr, struct ve_addr_struct *veaddr);
int in6_to_veaddr(const char *addr, struct ve_addr_struct *veaddr);
extern struct list_head veip_lh;
struct ext_entry_struct *venet_ext_lookup(struct ve_struct *ve,
struct ve_addr_struct *addr);
extern struct hlist_head ip_entry_hash_table[];
extern spinlock_t veip_lock;
extern void (*venet_free_stat)(struct ve_struct *);
#define NIPQUAD(addr) \
((unsigned char *)&addr)[0], \
((unsigned char *)&addr)[1], \
((unsigned char *)&addr)[2], \
((unsigned char *)&addr)[3]
#endif
|
/*
** Copyright (C) 2010 Stefaan Lippens
**
** 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.
*/
#ifndef MARSYAS_DELTAFIRSTORDERREGRESSION_H
#define MARSYAS_DELTAFIRSTORDERREGRESSION_H
#include <marsyas/system/MarSystem.h>
namespace Marsyas
{
/**
\class DeltaFirstOrderRegression
\ingroup Processing
\brief Calculate simple time domain delta in first order regression fashion.
This Delta calculation is typically used for Delta-MFCC features.
The calculation of the first order regression delta is as follows.
Given a signal \f$x[t]\f$ (discrete time \f$t\f$). For the delta at
time \f$t\f$, we consider the three samples \f$x[t-1]\f$, \f$x[t]\f$ and \f$x[t+1]\f$
and fit a linear function \f$y=a t + b\f$ to these points in the least squares sense.
The slope \f$a\f$ of this function is used as delta \f$\Delta[t]\f$ for time \f$t\f$.
Mathematically, this regression problem with three points at uniform time
point simplifies to a simple calculation \f[\Delta[t] = \frac{x[t+1] - x[t-1]}{2}\f].
This MarSystem uses the calculation above, but adds a time lag of one sample
to make the calculation causal (otherwise we need a sample from the future).
Works with multiple observation channels and works across slices
(the MarSystem keeps an internal buffer of two samples from previous
slice).
This MarSystem has no additional controls.
*/
class marsyas_EXPORT DeltaFirstOrderRegression: public MarSystem
{
private:
/// Add specific controls needed by this MarSystem.
void addControls();
/// Reads changed controls and sets up variables if necessary.
void myUpdate(MarControlPtr sender);
/// Buffers of previous samples.
realvec memory_;
public:
/// DeltaFirstOrderRegression constructor.
DeltaFirstOrderRegression(std::string name);
/// DeltaFirstOrderRegression copy constructor.
DeltaFirstOrderRegression(const DeltaFirstOrderRegression& a);
/// DeltaFirstOrderRegression destructor.
~DeltaFirstOrderRegression();
/// Implementation of the MarSystem::clone() method.
MarSystem* clone() const;
/// Implementation of the MarSystem::myProcess method.
void myProcess(realvec& in, realvec& out);
};
}
//namespace Marsyas
#endif
//MARSYAS_DELTAFIRSTORDERREGRESSION_H
|
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* 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.
* -------------------------------------------------------------------
*/
// -*- c++ -*-
// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
// O S C L _ F I L E _ SERVER
// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
/*! \addtogroup osclio OSCL IO
*
* @{
*/
/*! \file oscl_file_server.h
\brief The file oscl_file_server.h defines the class Oscl_FileServer.
This is the porting layer for file server implementations.
*/
#ifndef OSCL_FILE_SERVER_H_INCLUDED
#define OSCL_FILE_SERVER_H_INCLUDED
#ifndef OSCLCONFIG_IO_H_INCLUDED
#include "osclconfig_io.h"
#endif
#ifndef OSCL_BASE_H_INCLUDED
#include "oscl_base.h"
#endif
class Oscl_File;
class Oscl_FileServer
{
public:
/**
* Constructor
*/
OSCL_IMPORT_REF Oscl_FileServer();
/**
* Destructor
*/
OSCL_IMPORT_REF ~Oscl_FileServer();
/**
* Connects the server. This must be called before a file
* server can be used.
*
* @return returns 0 on success and a non-zero value otherwise
*/
OSCL_IMPORT_REF int32 Connect(bool aShareSession = false);
/**
* Closes a file server.
*
* @return returns 0 on success and a non-zero value otherwise
*/
OSCL_IMPORT_REF int32 Close();
/**
* Deletes a file from the filesystem
* * @param filename name of the file to delete (Utf8)
*
* @return returns 0 if successful, and a non-zero value otherwise.
*/
OSCL_IMPORT_REF int32 Oscl_DeleteFile(const char *filename);
/**
* Deletes a file from the filesystem
*
* @param filename name of the file to delete (Unicode)
*
* @return returns 0 if successful, and a non-zero value otherwise.
*/
OSCL_IMPORT_REF int32 Oscl_DeleteFile(const oscl_wchar *filename);
protected:
friend class Oscl_File;
friend class OsclNativeFile;
//file server objects (if appropriate)
};
#endif // OSCL_FILE_SERVER_H_INCLUDED
/*! @} */
|
/*
* Copyright (C) 2010, 2012 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence.
*
* A copy of the licence is included with the program, and can also be obtained from Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/**
* @file mali_osk_specific.h
* Defines per-OS Kernel level specifics, such as unusual workarounds for
* certain OSs.
*/
#ifndef __MALI_OSK_SPECIFIC_H__
#define __MALI_OSK_SPECIFIC_H__
#ifdef __cplusplus
extern "C"
{
#endif
#define MALI_STATIC_INLINE static inline
#define MALI_NON_STATIC_INLINE inline
#ifdef __cplusplus
}
#endif
/** The list of events supported by the Mali DDK. */
typedef enum
{
/* Vertex processor activity */
ACTIVITY_VP = 0,
/* Fragment processor activity */
ACTIVITY_FP0,
ACTIVITY_FP1,
ACTIVITY_FP2,
ACTIVITY_FP3,
/* L2 cache counters */
COUNTER_L2_C0,
COUNTER_L2_C1,
/* Vertex processor counters */
COUNTER_VP_C0,
COUNTER_VP_C1,
/* Fragment processor counters */
COUNTER_FP0_C0,
COUNTER_FP0_C1,
COUNTER_FP1_C0,
COUNTER_FP1_C1,
COUNTER_FP2_C0,
COUNTER_FP2_C1,
COUNTER_FP3_C0,
COUNTER_FP3_C1,
/*
* If more hardware counters are added, the _mali_osk_hw_counter_table
* below should also be updated.
*/
/* EGL software counters */
COUNTER_EGL_BLIT_TIME,
/* GLES software counters */
COUNTER_GLES_DRAW_ELEMENTS_CALLS,
COUNTER_GLES_DRAW_ELEMENTS_NUM_INDICES,
COUNTER_GLES_DRAW_ELEMENTS_NUM_TRANSFORMED,
COUNTER_GLES_DRAW_ARRAYS_CALLS,
COUNTER_GLES_DRAW_ARRAYS_NUM_TRANSFORMED,
COUNTER_GLES_DRAW_POINTS,
COUNTER_GLES_DRAW_LINES,
COUNTER_GLES_DRAW_LINE_LOOP,
COUNTER_GLES_DRAW_LINE_STRIP,
COUNTER_GLES_DRAW_TRIANGLES,
COUNTER_GLES_DRAW_TRIANGLE_STRIP,
COUNTER_GLES_DRAW_TRIANGLE_FAN,
COUNTER_GLES_NON_VBO_DATA_COPY_TIME,
COUNTER_GLES_UNIFORM_BYTES_COPIED_TO_MALI,
COUNTER_GLES_UPLOAD_TEXTURE_TIME,
COUNTER_GLES_UPLOAD_VBO_TIME,
COUNTER_GLES_NUM_FLUSHES,
COUNTER_GLES_NUM_VSHADERS_GENERATED,
COUNTER_GLES_NUM_FSHADERS_GENERATED,
COUNTER_GLES_VSHADER_GEN_TIME,
COUNTER_GLES_FSHADER_GEN_TIME,
COUNTER_GLES_INPUT_TRIANGLES,
COUNTER_GLES_VXCACHE_HIT,
COUNTER_GLES_VXCACHE_MISS,
COUNTER_GLES_VXCACHE_COLLISION,
COUNTER_GLES_CULLED_TRIANGLES,
COUNTER_GLES_CULLED_LINES,
COUNTER_GLES_BACKFACE_TRIANGLES,
COUNTER_GLES_GBCLIP_TRIANGLES,
COUNTER_GLES_GBCLIP_LINES,
COUNTER_GLES_TRIANGLES_DRAWN,
COUNTER_GLES_DRAWCALL_TIME,
COUNTER_GLES_TRIANGLES_COUNT,
COUNTER_GLES_INDEPENDENT_TRIANGLES_COUNT,
COUNTER_GLES_STRIP_TRIANGLES_COUNT,
COUNTER_GLES_FAN_TRIANGLES_COUNT,
COUNTER_GLES_LINES_COUNT,
COUNTER_GLES_INDEPENDENT_LINES_COUNT,
COUNTER_GLES_STRIP_LINES_COUNT,
COUNTER_GLES_LOOP_LINES_COUNT,
/* Framebuffer capture pseudo-counter */
COUNTER_FILMSTRIP,
NUMBER_OF_EVENTS
} _mali_osk_counter_id;
#define FIRST_ACTIVITY_EVENT ACTIVITY_VP
#define LAST_ACTIVITY_EVENT ACTIVITY_FP3
#define FIRST_HW_COUNTER COUNTER_L2_C0
#define LAST_HW_COUNTER COUNTER_FP3_C1
#define FIRST_SW_COUNTER COUNTER_EGL_BLIT_TIME
#define LAST_SW_COUNTER COUNTER_GLES_LOOP_LINES_COUNT
#define FIRST_SPECIAL_COUNTER COUNTER_FILMSTRIP
#define LAST_SPECIAL_COUNTER COUNTER_FILMSTRIP
#endif /* __MALI_OSK_SPECIFIC_H__ */
|
/*
* Copyright 2012 GE Intelligent Platforms, Inc.
* Copyright 2009-2011 Freescale Semiconductor, 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 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.
*
*/
/*
* P2020RDB board configuration file
*/
#ifndef __CONFIG_H
#define __CONFIG_H
#ifndef __ASSEMBLY__
extern unsigned long get_board_sys_clk(unsigned long dummy);
#endif
#define CFG_SYS_CLK_FREQ get_board_sys_clk(0)
#define CFG_DDR_CLK_FREQ 66666666
/*
* Base addresses -- Note these are effective addresses where the
* actual resources get mapped (not physical addresses)
*/
#define CFG_CCSRBAR_DEFAULT 0xff700000
#define CFG_CCSRBAR 0xffe00000 /* relocated CCSRBAR */
#define CFG_CCSRBAR_PHYS CFG_CCSRBAR
#define CFG_IMMR CFG_CCSRBAR
/* DDR Setup */
#define CFG_CHIP_SELECTS_PER_CTRL 1
#define CFG_SDRAM_BASE 0x00000000
/* These timings are adjusted for a 667Mhz clock. */
#define CFG_SYS_DDR_CS0_BNDS 0x0000003f /* 1GB */
#define CFG_SYS_DDR_CS0_CONFIG 0x80014202
#define CFG_SYS_DDR_TIMING_3 0x00030000
#define CFG_SYS_DDR_TIMING_0 0x55770802
#define CFG_SYS_DDR_TIMING_1 0x5f599543
#define CFG_SYS_DDR_TIMING_2 0x0fa074d1
#define CFG_SYS_DDR_CONTROL 0xc3000000
#define CFG_SYS_DDR_CONTROL2 0x24401000
#define CFG_SYS_DDR_MODE_1 0x00040852
#define CFG_SYS_DDR_MODE_2 0x00000000
#define CFG_SYS_MD_CNTL 0x00000000
#define CFG_SYS_DDR_INTERVAL 0x0a280100
#define CFG_SYS_DDR_DATA_INIT 0xdeadbeef
#define CFG_SYS_DDR_CLK_CTRL 0x03000000
/*
* Memory map
*
* 0x0000_0000 0x3fff_ffff DDR 1G cacheablen
*
* Localbus non-cacheable
* 0xef00_0000 0xefff_ffff FLASH 16M non-cacheable
* 0xffd0_0000 0xffd0_3fff L1 for stack 16K Cacheable TLB0
*/
/*
* Local Bus Definitions
*/
#define CFG_FLASH_BASE 0xef000000
#define CFG_FLASH_BASE_PHYS CFG_FLASH_BASE
#define CFG_INIT_RAM_ADDR 0xffd00000 /* stack in RAM */
/* Leave 256 bytes for global data */
#define CFG_INIT_SP_OFFSET (0x00004000 - 256)
#endif /* __CONFIG_H */
|
/* -*- c-basic-offset: 2 -*- */
/*
Copyright(C) 2009-2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License version 2.1 as published by the Free Software Foundation.
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 Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef GRN_CTX_IMPL_H
#define GRN_CTX_IMPL_H
#ifndef GRN_CTX_H
#include "grn_ctx.h"
#endif /* GRN_CTX_H */
#ifndef GRN_COM_H
#include "grn_com.h"
#endif /* GRN_COM_H */
#ifdef GRN_WITH_MESSAGE_PACK
#include <msgpack.h>
#endif
#ifdef GRN_WITH_MRUBY
# include <mruby.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/**** grn_expr ****/
#define GRN_EXPR_MISSING_NAME "expr_missing"
/**** grn_ctx_impl ****/
#define GRN_CTX_INITED 0x00
#define GRN_CTX_QUITTING 0x0f
typedef enum {
GRN_LOADER_BEGIN = 0,
GRN_LOADER_TOKEN,
GRN_LOADER_STRING,
GRN_LOADER_SYMBOL,
GRN_LOADER_NUMBER,
GRN_LOADER_STRING_ESC,
GRN_LOADER_UNICODE0,
GRN_LOADER_UNICODE1,
GRN_LOADER_UNICODE2,
GRN_LOADER_UNICODE3,
GRN_LOADER_END
} grn_loader_stat;
typedef struct {
grn_obj values;
grn_obj level;
grn_obj columns;
uint32_t emit_level;
int32_t key_offset;
grn_obj *table;
grn_obj *last;
grn_obj *ifexists;
grn_obj *each;
uint32_t unichar;
uint32_t values_size;
uint32_t nrecords;
grn_loader_stat stat;
grn_content_type input_type;
} grn_loader;
#define GRN_CTX_N_SEGMENTS 512
#ifdef USE_MEMORY_DEBUG
typedef struct _grn_alloc_info grn_alloc_info;
struct _grn_alloc_info
{
void *address;
int freed;
char alloc_backtrace[4096];
char free_backtrace[4096];
char *file;
int line;
char *func;
grn_alloc_info *next;
};
#endif
#ifdef GRN_WITH_MRUBY
typedef struct _grn_mrb_data grn_mrb_data;
struct _grn_mrb_data {
mrb_state *state;
char base_directory[PATH_MAX];
struct RClass *module;
struct RClass *object_class;
grn_hash *checked_procs;
grn_hash *registered_plugins;
struct {
grn_obj from;
grn_obj to;
} buffer;
struct {
struct RClass *time_class;
} builtin;
};
#endif
struct _grn_ctx_impl {
grn_encoding encoding;
/* memory pool portion */
int32_t lifoseg;
int32_t currseg;
grn_critical_section lock;
grn_io_mapinfo segs[GRN_CTX_N_SEGMENTS];
#ifdef USE_DYNAMIC_MALLOC_CHANGE
/* memory allocation portion */
grn_malloc_func malloc_func;
grn_calloc_func calloc_func;
grn_realloc_func realloc_func;
grn_strdup_func strdup_func;
#endif
#ifdef USE_MEMORY_DEBUG
/* memory debug portion */
grn_alloc_info *alloc_info;
#endif
/* expression portion */
grn_obj *stack[GRN_STACK_SIZE];
uint32_t stack_curr;
grn_hash *expr_vars;
grn_obj *curr_expr;
grn_obj *qe_next;
void *parser;
grn_timeval tv;
/* loader portion */
grn_edge *edge;
grn_loader loader;
/* plugin portion */
const char *plugin_path;
/* output portion */
grn_content_type output_type;
const char *mime_type;
grn_obj names;
grn_obj levels;
/* command portion */
grn_command_version command_version;
/* match escalation portion */
int64_t match_escalation_threshold;
/* lifetime portion */
grn_proc_func *finalizer;
grn_obj *db;
grn_array *values; /* temporary objects */
grn_hash *ios; /* IOs */
grn_obj *outbuf;
void (*output)(grn_ctx *, int, void *);
grn_com *com;
unsigned int com_status;
union {
void *ptr;
int fd;
uint32_t u32;
uint64_t u64;
} data;
grn_obj query_log_buf;
char previous_errbuf[GRN_CTX_MSGSIZE];
unsigned int n_same_error_messages;
#ifdef GRN_WITH_MESSAGE_PACK
msgpack_packer msgpacker;
#endif
#ifdef GRN_WITH_MRUBY
grn_mrb_data mrb;
#endif
};
#ifdef __cplusplus
}
#endif
#endif /* GRN_CTX_IMPL_H */
|
/*
* Copyright (C) 2015 MediaTek Inc.
*
* 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.
*/
#ifndef __EINT_H
#define __EINT_H
/*
* Hardware registers and settings.
*/
#define EINT_STA_BASE (((unsigned long)EINT_BASE + 0x000))
#define EINT_INTACK_BASE (((unsigned long)EINT_BASE + 0x040))
#define EINT_MASK_BASE (((unsigned long)EINT_BASE + 0x080))
#define EINT_MASK_SET_BASE (((unsigned long)EINT_BASE + 0x0c0))
#define EINT_MASK_CLR_BASE (((unsigned long)EINT_BASE + 0x100))
#define EINT_SENS_BASE (((unsigned long)EINT_BASE + 0x140))
#define EINT_SENS_SET_BASE (((unsigned long)EINT_BASE + 0x180))
#define EINT_SENS_CLR_BASE (((unsigned long)EINT_BASE + 0x1c0))
#define EINT_SOFT_BASE (((unsigned long)EINT_BASE + 0x200))
#define EINT_SOFT_SET_BASE (((unsigned long)EINT_BASE + 0x240))
#define EINT_SOFT_CLR_BASE (((unsigned long)EINT_BASE + 0x280))
#define EINT_POL_BASE (((unsigned long)EINT_BASE + 0x300))
#define EINT_POL_SET_BASE (((unsigned long)EINT_BASE + 0x340))
#define EINT_POL_CLR_BASE (((unsigned long)EINT_BASE + 0x380))
#define EINT_D0_EN_BASE (((unsigned long)EINT_BASE + 0x400))
#define EINT_D1_EN_BASE (((unsigned long)EINT_BASE + 0x420))
#define EINT_D2_EN_BASE (((unsigned long)EINT_BASE + 0x440))
#define EINT_DBNC_BASE (((unsigned long)EINT_BASE + 0x500))
#define EINT_DBNC_SET_BASE (((unsigned long)EINT_BASE + 0x600))
#define EINT_DBNC_CLR_BASE (((unsigned long)EINT_BASE + 0x700))
#define DEINT_CON_BASE (((unsigned long)EINT_BASE + 0x800))
#define DEINT_SEL_BASE (((unsigned long)EINT_BASE + 0x840))
#define DEINT_SEL_SET_BASE (((unsigned long)EINT_BASE + 0x880))
#define DEINT_SEL_CLR_BASE (((unsigned long)EINT_BASE + 0x8c0))
#define EINT_EEVT_BASE (((unsigned long)EINT_BASE + 0x900))
#define EINT_RAW_STA_BASE (((unsigned long)EINT_BASE + 0xA00))
#define EINT_EMUL_BASE (((unsigned long)EINT_BASE + 0xF00))
#define SECURE_DIR_EINT_EN (((unsigned long)EINT_BASE + 0xB10))
#define EINT_DBNC_SET_DBNC_BITS (4)
#define EINT_DBNC_CLR_DBNC_BITS (4)
#define EINT_DBNC_SET_EN_BITS (0)
#define EINT_DBNC_CLR_EN_BITS (0)
#define EINT_DBNC_SET_RST_BITS (1)
#define EINT_DBNC_EN_BIT (0x1)
#define EINT_DBNC_RST_BIT (0x1)
#define EINT_DBNC_0_MS (0x7)
#define EINT_DBNC (0xF)
#define EINT_DBNC_SET_EN (0x1)
#define EINT_DBNC_CLR_EN (0x1)
#define EINT_STA_DEFAULT 0x00000000
#define EINT_INTACK_DEFAULT 0x00000000
#define EINT_EEVT_DEFAULT 0x00000001
#define EINT_MASK_DEFAULT 0x00000000
#define EINT_MASK_SET_DEFAULT 0x00000000
#define EINT_MASK_CLR_DEFAULT 0x00000000
#define EINT_SENS_DEFAULT 0x0000FFFF
#define EINT_SENS_SET_DEFAULT 0x00000000
#define EINT_SENS_CLR_DEFAULT 0x00000000
#define EINT_D0EN_DEFAULT 0x00000000
#define EINT_D1EN_DEFAULT 0x00000000
#define EINT_D2EN_DEFAULT 0x00000000
#define EINT_DBNC_DEFAULT(n) 0x00000000
#define DEINT_MASK_DEFAULT 0x00000000
#define DEINT_MASK_SET_DEFAULT 0x00000000
#define DEINT_MASK_CLR_DEFAULT 0x00000000
/*
* Define constants.
*/
#define MT_EINT_POL_NEG 0
#define MT_EINT_POL_POS 1
#define EINTF_TRIGGER_RISING 0x00000001
#define EINTF_TRIGGER_FALLING 0x00000002
#define EINTF_TRIGGER_HIGH 0x00000004
#define EINTF_TRIGGER_LOW 0x00000008
#define EINT_IRQ(eint) (eint+EINT_IRQ_BASE)
#define DEMUX_EINT_IRQ(irq) (irq-EINT_IRQ_BASE)
#define EINT_GPIO(eint) eint
#define GPIOPIN 0
#define DEBOUNCE 1
#define EINT_DELAY_WARNING 3000000
#define MT_EDGE_SENSITIVE 0
#define MT_LEVEL_SENSITIVE 1
#define MT_POLARITY_LOW 0
#define MT_POLARITY_HIGH 1
/*
* Define function prototypes.
*/
extern void _print_status(void);
extern int mt_gpio_set_debounce(unsigned int gpio, unsigned int debounce);
extern unsigned int mt_gpio_to_irq(unsigned gpio);
extern int mt_get_supported_irq_num_ex(void) __attribute__((weak));
void mt_eint_mask(unsigned int eint_num);
void mt_eint_unmask(unsigned int eint_num);
void mt_eint_set_hw_debounce(unsigned int eint_num, unsigned int us);
void mt_eint_set_polarity(unsigned int eint_num, unsigned int pol);
unsigned int mt_eint_set_sens(unsigned int eint_num, unsigned int sens);
void mt_eint_virq_soft_clr(unsigned int virq);
extern void dump_eint_trigger_history(void);
/* used to access the gic device tree resource */
extern int mt_get_supported_irq_num(void);
/*
* Define structure prototypes
*/
struct EINT_HEADER {
unsigned int is_autounmask;
};
struct pin_node {
struct rb_node node;
u32 gpio_pin;
u32 eint_pin;
};
#endif
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
*
* 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.
*
*/
#ifndef __GSD_KEYBINDINGS_PLUGIN_H__
#define __GSD_KEYBINDINGS_PLUGIN_H__
#include <glib.h>
#include <glib-object.h>
#include <gmodule.h>
#include "gnome-settings-plugin.h"
G_BEGIN_DECLS
#define GSD_TYPE_KEYBINDINGS_PLUGIN (gsd_keybindings_plugin_get_type ())
#define GSD_KEYBINDINGS_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_KEYBINDINGS_PLUGIN, GsdKeybindingsPlugin))
#define GSD_KEYBINDINGS_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_KEYBINDINGS_PLUGIN, GsdKeybindingsPluginClass))
#define GSD_IS_KEYBINDINGS_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_KEYBINDINGS_PLUGIN))
#define GSD_IS_KEYBINDINGS_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_KEYBINDINGS_PLUGIN))
#define GSD_KEYBINDINGS_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_KEYBINDINGS_PLUGIN, GsdKeybindingsPluginClass))
typedef struct GsdKeybindingsPluginPrivate GsdKeybindingsPluginPrivate;
typedef struct
{
GnomeSettingsPlugin parent;
GsdKeybindingsPluginPrivate *priv;
} GsdKeybindingsPlugin;
typedef struct
{
GnomeSettingsPluginClass parent_class;
} GsdKeybindingsPluginClass;
GType gsd_keybindings_plugin_get_type (void) G_GNUC_CONST;
/* All the plugins must implement this function */
G_MODULE_EXPORT GType register_gnome_settings_plugin (GTypeModule *module);
G_END_DECLS
#endif /* __GSD_KEYBINDINGS_PLUGIN_H__ */
|
/*
* uids12c887rtc.h - DS12C887 RTC cartridge UI interface for MS-DOS.
*
* Written by
* Marco van den Heuvel <blackystardust68@yahoo.com>
*
* This file is part of VICE, the Versatile Commodore Emulator.
* See README for copyright notice.
*
* 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.
*
*/
#ifndef UIDS12C887RTC_H
#define UIDS12C887RTC_H
struct tui_menu;
extern void uids12c887rtc_c64_init(struct tui_menu *parent_submenu);
extern void uids12c887rtc_c128_init(struct tui_menu *parent_submenu);
extern void uids12c887rtc_vic20_init(struct tui_menu *parent_submenu);
#endif
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/*
* 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright (C) 2014 Red Hat, Inc.
* Author: Pavel Šimerda <psimerda@redhat.com>
*/
#include "config.h"
#include "nm-dns-unbound.h"
#include "NetworkManagerUtils.h"
G_DEFINE_TYPE (NMDnsUnbound, nm_dns_unbound, NM_TYPE_DNS_PLUGIN)
/*******************************************/
static gboolean
update (NMDnsPlugin *plugin,
const GSList *vpn_configs,
const GSList *dev_configs,
const GSList *other_configs,
const char *hostname)
{
/* TODO: We currently call a script installed with the dnssec-trigger
* package that queries all information itself. Later, the dependency
* on that package will be optional and the only hard dependency will
* be unbound.
*
* Unbound configuration should be later handled by this plugin directly,
* without calling custom scripts. The dnssec-trigger functionality
* may be eventually merged into NetworkManager.
*/
return nm_spawn_process ("/usr/libexec/dnssec-trigger-script --async --update") == 0;
}
static gboolean
is_caching (NMDnsPlugin *plugin)
{
return TRUE;
}
static const char *
get_name (NMDnsPlugin *plugin)
{
return "unbound";
}
/****************************************************************/
NMDnsPlugin *
nm_dns_unbound_new (void)
{
return g_object_new (NM_TYPE_DNS_UNBOUND, NULL);
}
static void
nm_dns_unbound_init (NMDnsUnbound *unbound)
{
}
static void
nm_dns_unbound_class_init (NMDnsUnboundClass *klass)
{
NMDnsPluginClass *plugin_class = NM_DNS_PLUGIN_CLASS (klass);
plugin_class->update = update;
plugin_class->is_caching = is_caching;
plugin_class->get_name = get_name;
}
|
/*
* UAE - The Un*x Amiga Emulator
*
* Memory access functions
*
* Copyright 1996 Bernd Schmidt
*/
STATIC_INLINE uae_u32 do_get_mem_long(uae_u32 *a)
{
return *a;
}
STATIC_INLINE uae_u16 do_get_mem_word(uae_u16 *a)
{
return *a;
}
STATIC_INLINE uae_u8 do_get_mem_byte(uae_u8 *a)
{
return *a;
}
STATIC_INLINE void do_put_mem_long(uae_u32 *a, uae_u32 v)
{
*a = v;
}
STATIC_INLINE void do_put_mem_word(uae_u16 *a, uae_u16 v)
{
*a = v;
}
STATIC_INLINE void do_put_mem_byte(uae_u8 *a, uae_u8 v)
{
*a = v;
}
#define call_mem_get_func(func, addr) ((*func)(addr))
#define call_mem_put_func(func, addr, v) ((*func)(addr, v))
#undef NO_INLINE_MEMORY_ACCESS
#undef MD_HAVE_MEM_1_FUNCS
|
/*
* Copyright (c) 2007, Swedish Institute of Computer Science
* 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 Institute 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 INSTITUTE 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 INSTITUTE 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 MSP430DEF_H
#define MSP430DEF_H
#ifdef __IAR_SYSTEMS_ICC__
#include <intrinsics.h>
#include <in430.h>
#include <msp430.h>
#define dint() __disable_interrupt()
#define eint() __enable_interrupt()
#define __MSP430__ 1
#define CC_CONF_INLINE
#else /* __IAR_SYSTEMS_ICC__ */
#include <msp430.h>
//#include <legacymsp430.h>
#define CC_CONF_INLINE inline
#endif /* __IAR_SYSTEMS_ICC__ */
#ifndef BV
#define BV(x) (1 << x)
#endif
#include <stdint.h>
/* default DCOSYNCH Period is 30 seconds */
#ifdef DCOSYNCH_CONF_PERIOD
#define DCOSYNCH_PERIOD DCOSYNCH_CONF_PERIOD
#else
#define DCOSYNCH_PERIOD 30
#endif
void msp430_cpu_init(void); /* Rename to cpu_init() later! */
void msp430_sync_dco(void);
#define cpu_init() msp430_cpu_init()
void *sbrk(int);
typedef int spl_t;
/* void splx_(spl_t); */
spl_t splhigh_(void);
#define splhigh() splhigh_()
#ifdef __IAR_SYSTEMS_ICC__
#define splx(sr) __bis_SR_register(sr)
#else
#define splx(sr) __asm__ __volatile__("bis %0, r2" : : "r" (sr))
#endif
/* Workaround for bug in msp430-gcc compiler */
#if defined(__MSP430__) && defined(__GNUC__) && MSP430_MEMCPY_WORKAROUND
#ifndef memcpy
#include <string.h>
void *w_memcpy(void *out, const void *in, size_t n);
#define memcpy(dest, src, count) w_memcpy(dest, src, count)
void *w_memset(void *out, int value, size_t n);
#define memset(dest, value, count) w_memset(dest, value, count)
#endif /* memcpy */
#endif /* __GNUC__ && __MSP430__ && MSP430_MEMCPY_WORKAROUND */
/* Moved from the msp430.h file with other msp430 related defines */
#ifdef F_CPU
#define MSP430_CPU_SPEED F_CPU
#else
#define MSP430_CPU_SPEED 2457600UL
#endif
#define MSP430_REQUIRE_CPUON 0
#define MSP430_REQUIRE_LPM1 1
#define MSP430_REQUIRE_LPM2 2
#define MSP430_REQUIRE_LPM3 3
void msp430_add_lpm_req(int req);
void msp430_remove_lpm_req(int req);
#endif /* MSP430DEF_H */
|
/*
* UAE - The Un*x Amiga Emulator
*
* Unix file system handler for AmigaDOS
*
* Copyright 1997 Bernd Schmidt
*/
#ifndef UAE_FILESYS_H
#define UAE_FILESYS_H
#include "uae/types.h"
#ifdef FSUAE
#include "options.h"
#include <time.h>
#endif
struct hardfilehandle;
#define MAX_HDF_CACHE_BLOCKS 128
#define MAX_SCSI_SENSE 36
struct hdf_cache
{
bool valid;
uae_u8 *data;
uae_u64 block;
bool dirty;
int readcount;
int writecount;
time_t lastaccess;
};
struct hardfiledata {
uae_u64 virtsize; // virtual size
uae_u64 physsize; // physical size (dynamic disk)
uae_u64 offset;
struct uaedev_config_info ci;
struct hardfilehandle *handle;
int handle_valid;
int dangerous;
int flags;
uae_u8 *cache;
int cache_valid;
uae_u64 cache_offset;
TCHAR vendor_id[8 + 1];
TCHAR product_id[16 + 1];
TCHAR product_rev[4 + 1];
/* geometry from possible RDSK block */
int rdbcylinders;
int rdbsectors;
int rdbheads;
uae_u8 *virtual_rdb;
uae_u64 virtual_size;
int unitnum;
int byteswap;
int adide;
int hfd_type;
uae_u8 *vhd_header;
uae_u32 vhd_bamoffset;
uae_u32 vhd_bamsize;
uae_u32 vhd_blocksize;
uae_u8 *vhd_sectormap;
uae_u64 vhd_sectormapblock;
uae_u32 vhd_bitmapsize;
uae_u64 vhd_footerblock;
void *chd_handle;
int drive_empty;
TCHAR *emptyname;
struct hdf_cache bcache[MAX_HDF_CACHE_BLOCKS];
uae_u8 scsi_sense[MAX_SCSI_SENSE];
struct uaedev_config_info delayedci;
int reinsertdelay;
bool isreinsert;
bool unit_stopped;
};
#define HFD_FLAGS_REALDRIVE 1
#define HFD_FLAGS_REALDRIVEPARTITION 2
struct hd_hardfiledata {
struct hardfiledata hfd;
uae_u64 size;
int cyls;
int heads;
int secspertrack;
int cyls_def;
int secspertrack_def;
int heads_def;
int ansi_version;
};
#define HD_CONTROLLER_EXPANSION_MAX 50
#define HD_CONTROLLER_NEXT_UNIT 200
#define HD_CONTROLLER_TYPE_UAE 0
#define HD_CONTROLLER_TYPE_IDE_AUTO (HD_CONTROLLER_TYPE_UAE + 1)
#define HD_CONTROLLER_TYPE_IDE_FIRST (HD_CONTROLLER_TYPE_IDE_AUTO)
#define HD_CONTROLLER_TYPE_IDE_MB (HD_CONTROLLER_TYPE_IDE_FIRST + 1)
#define HD_CONTROLLER_TYPE_IDE_EXPANSION_FIRST (HD_CONTROLLER_TYPE_IDE_MB + 1)
#define HD_CONTROLLER_TYPE_IDE_LAST (HD_CONTROLLER_TYPE_IDE_EXPANSION_FIRST + HD_CONTROLLER_EXPANSION_MAX - 1)
#define HD_CONTROLLER_TYPE_SCSI_AUTO (HD_CONTROLLER_TYPE_IDE_LAST + 1)
#define HD_CONTROLLER_TYPE_SCSI_FIRST (HD_CONTROLLER_TYPE_SCSI_AUTO)
#define HD_CONTROLLER_TYPE_SCSI_A3000 (HD_CONTROLLER_TYPE_SCSI_FIRST + 1)
#define HD_CONTROLLER_TYPE_SCSI_A4000T (HD_CONTROLLER_TYPE_SCSI_A3000 + 1)
#define HD_CONTROLLER_TYPE_SCSI_CDTV (HD_CONTROLLER_TYPE_SCSI_A4000T + 1)
#define HD_CONTROLLER_TYPE_SCSI_EXPANSION_FIRST (HD_CONTROLLER_TYPE_SCSI_CDTV + 1)
#define HD_CONTROLLER_TYPE_SCSI_LAST (HD_CONTROLLER_TYPE_SCSI_EXPANSION_FIRST + HD_CONTROLLER_EXPANSION_MAX - 1)
#define HD_CONTROLLER_TYPE_PCMCIA_SRAM (HD_CONTROLLER_TYPE_SCSI_LAST + 1)
#define HD_CONTROLLER_TYPE_PCMCIA_IDE (HD_CONTROLLER_TYPE_PCMCIA_SRAM + 1)
#define FILESYS_VIRTUAL 0
#define FILESYS_HARDFILE 1
#define FILESYS_HARDFILE_RDB 2
#define FILESYS_HARDDRIVE 3
#define FILESYS_CD 4
#define FILESYS_TAPE 5
#define MAX_FILESYSTEM_UNITS 30
struct uaedev_mount_info;
extern struct uaedev_mount_info options_mountinfo;
extern struct hardfiledata *get_hardfile_data (int nr);
#define FILESYS_MAX_BLOCKSIZE 2048
extern int hdf_open (struct hardfiledata *hfd);
extern int hdf_open (struct hardfiledata *hfd, const TCHAR *altname);
extern int hdf_dup (struct hardfiledata *dhfd, const struct hardfiledata *shfd);
extern void hdf_close (struct hardfiledata *hfd);
extern int hdf_read_rdb (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len);
extern int hdf_read (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len);
extern int hdf_write (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len);
extern int hdf_getnumharddrives (void);
extern TCHAR *hdf_getnameharddrive (int index, int flags, int *sectorsize, int *dangerousdrive);
extern int isspecialdrive(const TCHAR *name);
extern int get_native_path(uae_u32 lock, TCHAR *out);
extern void hardfile_do_disk_change (struct uaedev_config_data *uci, bool insert);
extern void hardfile_send_disk_change (struct hardfiledata *hfd, bool insert);
extern int hardfile_media_change (struct hardfiledata *hfd, struct uaedev_config_info *ci, bool inserted, bool timer);
extern int hardfile_added (struct uaedev_config_info *ci);
void hdf_hd_close(struct hd_hardfiledata *hfd);
int hdf_hd_open(struct hd_hardfiledata *hfd);
extern int vhd_create (const TCHAR *name, uae_u64 size, uae_u32);
extern int hdf_init_target (void);
extern int hdf_open_target (struct hardfiledata *hfd, const TCHAR *name);
extern int hdf_dup_target (struct hardfiledata *dhfd, const struct hardfiledata *shfd);
extern void hdf_close_target (struct hardfiledata *hfd);
extern int hdf_read_target (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len);
extern int hdf_write_target (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len);
extern int hdf_resize_target (struct hardfiledata *hfd, uae_u64 newsize);
extern void getchsgeometry (uae_u64 size, int *pcyl, int *phead, int *psectorspertrack);
extern void getchsgeometry_hdf (struct hardfiledata *hfd, uae_u64 size, int *pcyl, int *phead, int *psectorspertrack);
extern void getchspgeometry (uae_u64 total, int *pcyl, int *phead, int *psectorspertrack, bool idegeometry);
void add_cpuboard_unit(int unit, struct uaedev_config_info *uci, struct romconfig *rc);
#endif /* UAE_FILESYS_H */
|
/*
* MMC definitions for OMAP2
*
* Copyright (C) 2006 Nokia Corporation
*
* 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 __OMAP2_MMC_H
#define __OMAP2_MMC_H
#include <linux/types.h>
#include <linux/device.h>
#include <linux/mmc/host.h>
#include <asm/arch/board.h>
#define OMAP_MMC_MAX_SLOTS 2
struct omap_mmc_platform_data {
struct omap_mmc_conf conf;
/* number of slots on board */
unsigned nr_slots:2;
/* set if your board has components or wiring that limits the
* maximum frequency on the MMC bus */
unsigned int max_freq;
/* switch the bus to a new slot */
int (* switch_slot)(struct device *dev, int slot);
/* initialize board-specific MMC functionality, can be NULL if
* not supported */
int (* init)(struct device *dev);
void (* cleanup)(struct device *dev);
void (* shutdown)(struct device *dev);
/* To handle board related suspend/resume functionality for MMC */
int (*suspend)(struct device *dev, int slot);
int (*resume)(struct device *dev, int slot);
struct omap_mmc_slot_data {
int (* set_bus_mode)(struct device *dev, int slot, int bus_mode);
int (* set_power)(struct device *dev, int slot, int power_on, int vdd);
int (* get_ro)(struct device *dev, int slot);
/* return MMC cover switch state, can be NULL if not supported.
*
* possible return values:
* 0 - open
* 1 - closed
*/
int (* get_cover_state)(struct device *dev, int slot);
const char *name;
u32 ocr_mask;
/* Card detection IRQs */
int card_detect_irq;
int (* card_detect)(int irq);
unsigned int ban_openended:1;
} slots[OMAP_MMC_MAX_SLOTS];
};
extern void omap_set_mmc_info(int host, const struct omap_mmc_platform_data *info);
/* called from board-specific card detection service routine */
extern void omap_mmc_notify_cover_event(struct device *dev, int slot, int is_closed);
#endif
|
/* vi: set sw=4 ts=4: */
/*
* Utility routines.
*
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
#include "libbb.h"
ssize_t FAST_FUNC safe_write(int fd, const void *buf, size_t count)
{
ssize_t n;
for (;;) {
n = write(fd, buf, count);
if (n >= 0 || errno != EINTR)
break;
/* Some callers set errno=0, are upset when they see EINTR.
* Returning EINTR is wrong since we retry write(),
* the "error" was transient.
*/
errno = 0;
/* repeat the write() */
}
return n;
}
|
/* Measure memcpy functions with large data sizes.
Copyright (C) 2016-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/>. */
#ifndef MEMCPY_RESULT
# define MEMCPY_RESULT(dst, len) dst
# define START_SIZE (64 * 1024)
# define MIN_PAGE_SIZE (getpagesize () + 32 * 1024 * 1024)
# define TEST_MAIN
# define TEST_NAME "memcpy"
# define TIMEOUT (20 * 60)
# include "bench-string.h"
IMPL (memcpy, 1)
#endif
typedef char *(*proto_t) (char *, const char *, size_t);
static void
do_one_test (impl_t *impl, char *dst, const char *src,
size_t len)
{
size_t i, iters = 16;
timing_t start, stop, cur;
/* Must clear the destination buffer updated by the previous run. */
for (i = 0; i < len; i++)
dst[i] = 0;
if (CALL (impl, dst, src, len) != MEMCPY_RESULT (dst, len))
{
error (0, 0, "Wrong result in function %s %p %p", impl->name,
CALL (impl, dst, src, len), MEMCPY_RESULT (dst, len));
ret = 1;
return;
}
if (memcmp (dst, src, len) != 0)
{
error (0, 0, "Wrong result in function %s dst \"%s\" src \"%s\"",
impl->name, dst, src);
ret = 1;
return;
}
TIMING_NOW (start);
for (i = 0; i < iters; ++i)
{
CALL (impl, dst, src, len);
}
TIMING_NOW (stop);
TIMING_DIFF (cur, start, stop);
TIMING_PRINT_MEAN ((double) cur, (double) iters);
}
static void
do_test (size_t align1, size_t align2, size_t len)
{
size_t i, j;
char *s1, *s2;
align1 &= 63;
if (align1 + len >= page_size)
return;
align2 &= 63;
if (align2 + len >= page_size)
return;
s1 = (char *) (buf1 + align1);
s2 = (char *) (buf2 + align2);
for (i = 0, j = 1; i < len; i++, j += 23)
s1[i] = j;
printf ("Length %4zd, alignment %2zd/%2zd:", len, align1, align2);
FOR_EACH_IMPL (impl, 0)
do_one_test (impl, s2, s1, len);
putchar ('\n');
}
int
test_main (void)
{
size_t i;
test_init ();
printf ("%23s", "");
FOR_EACH_IMPL (impl, 0)
printf ("\t%s", impl->name);
putchar ('\n');
for (i = START_SIZE; i <= MIN_PAGE_SIZE; i <<= 1)
{
do_test (0, 0, i + 7);
do_test (0, 3, i + 15);
do_test (3, 0, i + 31);
do_test (3, 5, i + 63);
}
return ret;
}
#include <support/test-driver.c>
|
/*
* include/linux/irqflags.h
*
* IRQ flags tracing: follow the state of the hardirq and softirq flags and
* provide callbacks for transitions between ON and OFF states.
*
* This file gets included from lowlevel asm headers too, to provide
* wrapped versions of the local_irq_*() APIs, based on the
* raw_local_irq_*() macros from the lowlevel headers.
*/
#ifndef _LINUX_TRACE_IRQFLAGS_H
#define _LINUX_TRACE_IRQFLAGS_H
#include <linux/typecheck.h>
#include <asm/irqflags.h>
/* merge qcom DEBUG_CODE for RPC crashes */
#ifdef CONFIG_HUAWEI_RPC_CRASH_DEBUG
extern int htc_debug_irq_disabled;
#endif
#ifdef CONFIG_TRACE_IRQFLAGS
extern void trace_softirqs_on(unsigned long ip);
extern void trace_softirqs_off(unsigned long ip);
extern void trace_hardirqs_on(void);
extern void trace_hardirqs_off(void);
# define trace_hardirq_context(p) ((p)->hardirq_context)
# define trace_softirq_context(p) ((p)->softirq_context)
# define trace_hardirqs_enabled(p) ((p)->hardirqs_enabled)
# define trace_softirqs_enabled(p) ((p)->softirqs_enabled)
# define trace_hardirq_enter() do { current->hardirq_context++; } while (0)
# define trace_hardirq_exit() do { current->hardirq_context--; } while (0)
# define lockdep_softirq_enter() do { current->softirq_context++; } while (0)
# define lockdep_softirq_exit() do { current->softirq_context--; } while (0)
# define INIT_TRACE_IRQFLAGS .softirqs_enabled = 1,
#else
# define trace_hardirqs_on() do { } while (0)
# define trace_hardirqs_off() do { } while (0)
# define trace_softirqs_on(ip) do { } while (0)
# define trace_softirqs_off(ip) do { } while (0)
# define trace_hardirq_context(p) 0
# define trace_softirq_context(p) 0
# define trace_hardirqs_enabled(p) 0
# define trace_softirqs_enabled(p) 0
# define trace_hardirq_enter() do { } while (0)
# define trace_hardirq_exit() do { } while (0)
# define lockdep_softirq_enter() do { } while (0)
# define lockdep_softirq_exit() do { } while (0)
# define INIT_TRACE_IRQFLAGS
#endif
#if defined(CONFIG_IRQSOFF_TRACER) || \
defined(CONFIG_PREEMPT_TRACER)
extern void stop_critical_timings(void);
extern void start_critical_timings(void);
#else
# define stop_critical_timings() do { } while (0)
# define start_critical_timings() do { } while (0)
#endif
/*
* Wrap the arch provided IRQ routines to provide appropriate checks.
*/
#define raw_local_irq_disable() arch_local_irq_disable()
#define raw_local_irq_enable() arch_local_irq_enable()
#define raw_local_irq_save(flags) \
do { \
typecheck(unsigned long, flags); \
flags = arch_local_irq_save(); \
} while (0)
#define raw_local_irq_restore(flags) \
do { \
typecheck(unsigned long, flags); \
arch_local_irq_restore(flags); \
} while (0)
#define raw_local_save_flags(flags) \
do { \
typecheck(unsigned long, flags); \
flags = arch_local_save_flags(); \
} while (0)
#define raw_irqs_disabled_flags(flags) \
({ \
typecheck(unsigned long, flags); \
arch_irqs_disabled_flags(flags); \
})
#define raw_irqs_disabled() (arch_irqs_disabled())
#define raw_safe_halt() arch_safe_halt()
/*
* The local_irq_*() APIs are equal to the raw_local_irq*()
* if !TRACE_IRQFLAGS.
*/
#ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT
/* merge qcom DEBUG_CODE for RPC crashes */
#ifndef CONFIG_HUAWEI_RPC_CRASH_DEBUG
#define local_irq_enable() \
do { trace_hardirqs_on(); raw_local_irq_enable(); } while (0)
#else
#define local_irq_enable() \
do { \
htc_debug_irq_disabled = 0; \
trace_hardirqs_on(); \
raw_local_irq_enable(); \
} while (0)
#endif
#ifndef CONFIG_HUAWEI_RPC_CRASH_DEBUG
#define local_irq_disable() \
do { raw_local_irq_disable(); trace_hardirqs_off(); } while (0)
#else
#define local_irq_disable() \
do { \
htc_debug_irq_disabled = 1; \
raw_local_irq_disable(); \
trace_hardirqs_off(); \
} while (0)
#endif
#define local_irq_save(flags) \
do { \
raw_local_irq_save(flags); \
trace_hardirqs_off(); \
} while (0)
#define local_irq_restore(flags) \
do { \
if (raw_irqs_disabled_flags(flags)) { \
raw_local_irq_restore(flags); \
trace_hardirqs_off(); \
} else { \
trace_hardirqs_on(); \
raw_local_irq_restore(flags); \
} \
} while (0)
#define local_save_flags(flags) \
do { \
raw_local_save_flags(flags); \
} while (0)
#define irqs_disabled_flags(flags) \
({ \
raw_irqs_disabled_flags(flags); \
})
#define irqs_disabled() \
({ \
unsigned long _flags; \
raw_local_save_flags(_flags); \
raw_irqs_disabled_flags(_flags); \
})
#define safe_halt() \
do { \
trace_hardirqs_on(); \
raw_safe_halt(); \
} while (0)
#else /* !CONFIG_TRACE_IRQFLAGS_SUPPORT */
#define local_irq_enable() do { raw_local_irq_enable(); } while (0)
#define local_irq_disable() do { raw_local_irq_disable(); } while (0)
#define local_irq_save(flags) \
do { \
raw_local_irq_save(flags); \
} while (0)
#define local_irq_restore(flags) do { raw_local_irq_restore(flags); } while (0)
#define local_save_flags(flags) do { raw_local_save_flags(flags); } while (0)
#define irqs_disabled() (raw_irqs_disabled())
#define irqs_disabled_flags(flags) (raw_irqs_disabled_flags(flags))
#define safe_halt() do { raw_safe_halt(); } while (0)
#endif /* CONFIG_TRACE_IRQFLAGS_SUPPORT */
#endif
|
/*
Copyright (C) 2001 Paul Davis
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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __gtkmm2ext_grouped_buttons_h__
#define __gtkmm2ext_grouped_buttons_h__
#include <stdint.h>
#include <vector>
#include <sigc++/signal.h>
namespace Gtk {
class ToggleButton;
};
class GroupedButtons : public sigc::trackable
{
public:
GroupedButtons (uint32_t nbuttons, uint32_t first_active);
GroupedButtons (std::vector<Gtk::ToggleButton *>&);
Gtk::ToggleButton& button (uint32_t which) {
return *buttons[which];
}
private:
std::vector<Gtk::ToggleButton *> buttons;
uint32_t current_active;
void one_clicked (uint32_t which);
};
#endif /* __gtkmm2ext_grouped_buttons_h__ */
|
/*
* This file is part of the libsigrok project.
*
* Copyright (C) 2013 Aurelien Jacobs <aurel@gnuage.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 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/>.
*/
#include <config.h>
#include <string.h>
#include "protocol.h"
static const uint32_t scanopts[] = {
SR_CONF_CONN,
SR_CONF_SERIALCOMM,
};
static const uint32_t drvopts[] = {
SR_CONF_THERMOMETER,
};
static const uint32_t devopts[] = {
SR_CONF_CONTINUOUS,
SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET,
SR_CONF_LIMIT_MSEC | SR_CONF_GET | SR_CONF_SET,
SR_CONF_DATA_SOURCE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
};
static const char *data_sources[] = {
"Live",
"Memory",
};
static GSList *scan(struct sr_dev_driver *di, GSList *options)
{
struct dev_context *devc;
struct sr_serial_dev_inst *serial;
struct sr_dev_inst *sdi;
struct sr_config *src;
GSList *devices, *l;
const char *conn, *serialcomm;
uint8_t buf[50];
size_t len;
len = sizeof(buf);
devices = NULL;
conn = serialcomm = NULL;
for (l = options; l; l = l->next) {
src = l->data;
switch (src->key) {
case SR_CONF_CONN:
conn = g_variant_get_string(src->data, NULL);
break;
case SR_CONF_SERIALCOMM:
serialcomm = g_variant_get_string(src->data, NULL);
break;
}
}
if (!conn)
return NULL;
if (!serialcomm)
serialcomm = "9600/8n1";
serial = sr_serial_dev_inst_new(conn, serialcomm);
if (serial_open(serial, SERIAL_RDONLY) != SR_OK)
return NULL;
sr_info("Probing serial port %s.", conn);
serial_flush(serial);
/* Let's get a bit of data and see if we can find a packet. */
if (serial_stream_detect(serial, buf, &len, 25,
appa_55ii_packet_valid, 500, 9600) != SR_OK)
goto scan_cleanup;
sr_info("Found device on port %s.", conn);
sdi = g_malloc0(sizeof(struct sr_dev_inst));
sdi->status = SR_ST_INACTIVE;
sdi->vendor = g_strdup("APPA");
sdi->model = g_strdup("55II");
devc = g_malloc0(sizeof(struct dev_context));
devc->data_source = DEFAULT_DATA_SOURCE;
sdi->inst_type = SR_INST_SERIAL;
sdi->conn = serial;
sdi->priv = devc;
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "T1");
sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "T2");
devices = g_slist_append(devices, sdi);
scan_cleanup:
serial_close(serial);
return std_scan_complete(di, devices);
}
static int config_get(uint32_t key, GVariant **data,
const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
{
struct dev_context *devc = sdi->priv;
(void)cg;
switch (key) {
case SR_CONF_LIMIT_SAMPLES:
case SR_CONF_LIMIT_MSEC:
return sr_sw_limits_config_get(&devc->limits, key, data);
case SR_CONF_DATA_SOURCE:
*data = g_variant_new_string(data_sources[devc->data_source]);
break;
default:
return SR_ERR_NA;
}
return SR_OK;
}
static int config_set(uint32_t key, GVariant *data,
const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
{
struct dev_context *devc;
int idx;
(void)cg;
devc = sdi->priv;
switch (key) {
case SR_CONF_LIMIT_SAMPLES:
case SR_CONF_LIMIT_MSEC:
return sr_sw_limits_config_set(&devc->limits, key, data);
case SR_CONF_DATA_SOURCE:
if ((idx = std_str_idx(data, ARRAY_AND_SIZE(data_sources))) < 0)
return SR_ERR_ARG;
devc->data_source = idx;
break;
default:
return SR_ERR_NA;
}
return SR_OK;
}
static int config_list(uint32_t key, GVariant **data,
const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
{
switch (key) {
case SR_CONF_SCAN_OPTIONS:
case SR_CONF_DEVICE_OPTIONS:
return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts);
case SR_CONF_DATA_SOURCE:
*data = g_variant_new_strv(ARRAY_AND_SIZE(data_sources));
break;
default:
return SR_ERR_NA;
}
return SR_OK;
}
static int dev_acquisition_start(const struct sr_dev_inst *sdi)
{
struct sr_serial_dev_inst *serial;
struct dev_context *devc;
serial = sdi->conn;
devc = sdi->priv;
sr_sw_limits_acquisition_start(&devc->limits);
std_session_send_df_header(sdi);
serial_source_add(sdi->session, serial, G_IO_IN, 50,
appa_55ii_receive_data, (void *)sdi);
return SR_OK;
}
static struct sr_dev_driver appa_55ii_driver_info = {
.name = "appa-55ii",
.longname = "APPA 55II",
.api_version = 1,
.init = std_init,
.cleanup = std_cleanup,
.scan = scan,
.dev_list = std_dev_list,
.dev_clear = std_dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
.dev_open = std_serial_dev_open,
.dev_close = std_serial_dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = std_serial_dev_acquisition_stop,
.context = NULL,
};
SR_REGISTER_DEV_DRIVER(appa_55ii_driver_info);
|
/*****************************************************************************
*
* PROJECT: Multi Theft Auto v1.0
* (Shared logic for modifications)
* LICENSE: See LICENSE in the top level directory
* FILE: mods/shared_logic/CClientEffect.h
* PURPOSE: Effect entity
*
*****************************************************************************/
#pragma once
#include <game/CFxSystem.h>
#include "CClientEntity.h"
class CClientManager;
class CClientEffect : public CClientEntity
{
DECLARE_CLASS(CClientEffect, CClientEntity)
public:
CClientEffect(CClientManager* pManager, CFxSystem* pFx, SString strEffectName, ElementID ID);
~CClientEffect();
void Unlink();
void GetPosition(CVector& vecPosition) const;
void SetPosition(const CVector& vecPosition);
void GetRotationRadians(CVector& vecRotation) const;
void SetRotationRadians(const CVector& vecRotation);
bool GetMatrix(CMatrix& matrix) const;
bool SetMatrix(const CMatrix& matrix);
void SetEffectSpeed(float fSpeed);
float GetEffectSpeed() const;
bool SetEffectDensity(float fDensity);
float GetEffectDensity() const;
void SetDrawDistance(float fDrawDistance);
float GetDrawDistance() const;
eClientEntityType GetType() const { return CCLIENTEFFECT; };
protected:
friend class CClientEffectManager;
CFxSystem* GetFxSystem() const { return m_pFxSystem; }
void SetFxSystem(CFxSystem* pFx) { m_pFxSystem = pFx; }
private:
CClientManager* m_pManager;
CFxSystem* m_pFxSystem;
SString m_strEffectName;
float m_fMaxDensity;
};
|
/* -----------------------------------------------------------------------------
*
* Copyright (C) 1997-2010 Krzysztof M. Gorski, Eric Hivon,
* Benjamin D. Wandelt, Anthony J. Banday,
* Matthias Bartelmann,
* Reza Ansari & Kenneth M. Ganga
*
*
* This file is part of HEALPix.
*
* HEALPix 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.
*
* HEALPix 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 HEALPix; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* For more information about HEALPix see http://healpix.jpl.nasa.gov
*
*----------------------------------------------------------------------------- */
/* nside2npix.c
*
*/
long nside2npix(const long nside) {
return 12*nside*nside;
}
|
/*
** CXSC is a C++ library for eXtended Scientific Computing (V 2.5.4)
**
** Copyright (C) 1990-2000 Institut fuer Angewandte Mathematik,
** Universitaet Karlsruhe, Germany
** (C) 2000-2014 Wiss. Rechnen/Softwaretechnologie
** Universitaet Wuppertal, Germany
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Library General Public
** License as published by the Free Software Foundation; either
** version 2 of the License, or (at your option) any later version.
**
** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Library General Public License for more details.
**
** You should have received a copy of the GNU Library General Public
** License along with this library; if not, write to the Free
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* CVS $Id: i_cnst.c,v 1.21 2014/01/30 17:24:08 cxsc Exp $ */
/****************************************************************/
/* */
/* Filename : i_cnst.c */
/* */
/* Entries : a_intv i_cnst(str) */
/* a_char *str; */
/* */
/* Arguments : str - input string */
/* */
/* Description : Convert a character string */
/* to IEEE double format rounded */
/* to interval. */
/* */
/****************************************************************/
#ifndef ALL_IN_ONE
#ifdef AIX
#include "/u/p88c/runtime/o_defs.h"
#else
#include "o_defs.h"
#endif
#define local
extern a_real *r_zero;
extern dotprecision b_cp__;
#endif
#ifdef LINT_ARGS
local a_intv i_cnst(a_char *str)
#else
local a_intv i_cnst(str)
a_char *str;
#endif
{
a_intv s;
a_char *next;
a_intg dp,expo,length,size;
a_bool sign;
char *buffer;
a_btyp rc;
E_TPUSH("i_cnst")
R_ASSIGN(s.INF,*r_zero);
R_ASSIGN(s.SUP,*r_zero);
buffer = (char *)b_cp__;
size = BUFFERSIZE;
switch (b_chck(str,&buffer,&size,&expo,&dp,&length,&sign,&next))
{
case 1: e_trap(ALLOCATION,2,E_TMSG,66);
E_TPOPP("i_cnst")
return(s);
case 2:
case 3:
case 4: e_trap(I_O_ERROR,4,E_TMSG,58,E_TSTR+E_TEXT(10),str);
E_TPOPP("i_cnst")
return(s);
case 5: e_trap(NO_ERROR+E_EMSG+E_ECNT,2,E_TSTR+E_TEXT(10),str);
default: ;
}
if ((rc = b_form((a_btyp *)buffer,&size,
expo,dp,length,sign,(a_intg)-1,&s.INF))!=0)
e_trap(rc,2,E_TSTR+E_TEXT(10),str);
else if ((rc = b_form((a_btyp *)buffer,&size,
expo,dp,length,sign,(a_intg)1,&s.SUP))!=0)
e_trap(rc,2,E_TSTR+E_TEXT(10),str);
if (size!=BUFFERSIZE)
{
#ifdef HEAP_CHECK
b_freh((a_char *)&buffer,(a_char *)buffer,(a_char *)"i_cnst");
#endif
free(buffer);
}
E_TPOPP("i_cnst")
return(s);
}
|
/****************************************************************/
/* DO NOT MODIFY THIS HEADER */
/* MOOSE - Multiphysics Object Oriented Simulation Environment */
/* */
/* (c) 2010 Battelle Energy Alliance, LLC */
/* ALL RIGHTS RESERVED */
/* */
/* Prepared by Battelle Energy Alliance, LLC */
/* Under Contract No. DE-AC07-05ID14517 */
/* With the U. S. Department of Energy */
/* */
/* See COPYRIGHT for full restrictions */
/****************************************************************/
#ifndef VOLUMEPOSTPROCESSOR_H
#define VOLUMEPOSTPROCESSOR_H
#include "ElementIntegralPostprocessor.h"
//Forward Declarations
class VolumePostprocessor;
template<>
InputParameters validParams<VolumePostprocessor>();
/**
* This postprocessor computes the volume of a specified block.
*/
class VolumePostprocessor : public ElementIntegralPostprocessor
{
public:
VolumePostprocessor(const InputParameters & parameters);
VolumePostprocessor(const std::string & deprecated_name, InputParameters parameters); // DEPRECATED CONSTRUCTOR
virtual void threadJoin(const UserObject & y);
protected:
virtual Real computeQpIntegral();
};
#endif
|
// @(#)root/graf:$Id$
// Author: Otto Schaile 20/11/99
/*************************************************************************
* Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#ifndef ROOT_TCurlyLine
#define ROOT_TCurlyLine
//
// This class implements a curly or wavy polyline typically
// used to draw Feynman diagrams.
#ifndef ROOT_Riosfwd
#include "Riosfwd.h"
#endif
#ifndef ROOT_TPolyLine
#include "TPolyLine.h"
#endif
class TCurlyLine : public TPolyLine {
protected:
Double_t fX1; // start x, center for arc
Double_t fY1; // start y, center for arc
Double_t fX2; // end x
Double_t fY2; // end y
Double_t fWaveLength; // wavelength of sinusoid in percent of pad height
Double_t fAmplitude; // amplitude of sinusoid in percent of pad height
Int_t fNsteps; // used internally (controls precision)
Bool_t fIsCurly; // true: Gluon, false: Gamma
static Double_t fgDefaultWaveLength; //default wavelength
static Double_t fgDefaultAmplitude; //default amplitude
static Bool_t fgDefaultIsCurly; //default curly type
public:
// TCurlyLine status bits
enum {
kTooShort = BIT(11)
};
TCurlyLine();
TCurlyLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2,
Double_t wl = .02,
Double_t amp = .01);
virtual ~TCurlyLine(){;}
virtual void Build();
Int_t DistancetoPrimitive(Int_t px, Int_t py);
void ExecuteEvent(Int_t event, Int_t px, Int_t py);
Bool_t GetCurly() const {return fIsCurly;}
Double_t GetWaveLength() const{return fWaveLength;}
Double_t GetAmplitude() const {return fAmplitude;}
Double_t GetStartX() const {return fX1;}
Double_t GetEndX() const {return fX2;}
Double_t GetStartY() const {return fY1;}
Double_t GetEndY() const {return fY2;}
virtual void SetCurly(); // *MENU*
virtual void SetWavy(); // *MENU*
virtual void SetWaveLength(Double_t WaveLength); // *MENU* *ARGS={WaveLength=>fWaveLength}
virtual void SetAmplitude(Double_t x); // *MENU* *ARGS={x=>fAmplitude}
virtual void SetStartPoint(Double_t x1, Double_t y1);
virtual void SetEndPoint (Double_t x2, Double_t y2);
virtual void SavePrimitive(std::ostream &out, Option_t * = "");
static void SetDefaultWaveLength(Double_t WaveLength);
static void SetDefaultAmplitude (Double_t Amplitude );
static void SetDefaultIsCurly (Bool_t IsCurly );
static Double_t GetDefaultWaveLength();
static Double_t GetDefaultAmplitude ();
static Bool_t GetDefaultIsCurly ();
ClassDef(TCurlyLine,2) // A curly polyline
};
#endif
|
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://www.qt.io/licensing. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef SIDEBYSIDEDIFFEDITORWIDGET_H
#define SIDEBYSIDEDIFFEDITORWIDGET_H
#include "diffeditor_global.h"
#include "differ.h"
#include "diffeditorcontroller.h"
#include <QWidget>
#include <QTextCharFormat>
namespace TextEditor { class FontSettings; }
QT_BEGIN_NAMESPACE
class QSplitter;
class QMenu;
QT_END_NAMESPACE
namespace DiffEditor {
class DiffEditorGuiController;
class SideDiffEditorWidget;
class ChunkData;
class FileData;
class DIFFEDITOR_EXPORT SideBySideDiffEditorWidget : public QWidget
{
Q_OBJECT
public:
SideBySideDiffEditorWidget(QWidget *parent = 0);
~SideBySideDiffEditorWidget();
void setDiffEditorGuiController(DiffEditorGuiController *controller);
DiffEditorGuiController *diffEditorGuiController() const;
private slots:
void clear(const QString &message = QString());
void clearAll(const QString &message = QString());
void setDiff(const QList<FileData> &diffFileList,
const QString &workingDirectory);
void setCurrentDiffFileIndex(int diffFileIndex);
void setFontSettings(const TextEditor::FontSettings &fontSettings);
void slotLeftJumpToOriginalFileRequested(int diffFileIndex,
int lineNumber, int columnNumber);
void slotRightJumpToOriginalFileRequested(int diffFileIndex,
int lineNumber, int columnNumber);
void slotLeftContextMenuRequested(QMenu *menu, int diffFileIndex,
int chunkIndex);
void slotRightContextMenuRequested(QMenu *menu, int diffFileIndex,
int chunkIndex);
void slotSendChunkToCodePaster();
void slotApplyChunk();
void slotRevertChunk();
void leftVSliderChanged();
void rightVSliderChanged();
void leftHSliderChanged();
void rightHSliderChanged();
void leftCursorPositionChanged();
void rightCursorPositionChanged();
// void leftDocumentSizeChanged();
// void rightDocumentSizeChanged();
private:
void showDiff();
// void synchronizeFoldings(SideDiffEditorWidget *source, SideDiffEditorWidget *destination);
void jumpToOriginalFile(const QString &fileName,
int lineNumber, int columnNumber);
void patch(bool revert);
DiffEditorGuiController *m_guiController;
DiffEditorController *m_controller;
SideDiffEditorWidget *m_leftEditor;
SideDiffEditorWidget *m_rightEditor;
QSplitter *m_splitter;
QList<FileData> m_contextFileData; // ultimate data to be shown, contextLinesNumber taken into account
bool m_ignoreCurrentIndexChange;
bool m_foldingBlocker;
int m_contextMenuFileIndex;
int m_contextMenuChunkIndex;
QTextCharFormat m_spanLineFormat;
QTextCharFormat m_fileLineFormat;
QTextCharFormat m_chunkLineFormat;
QTextCharFormat m_leftLineFormat;
QTextCharFormat m_leftCharFormat;
QTextCharFormat m_rightLineFormat;
QTextCharFormat m_rightCharFormat;
};
} // namespace DiffEditor
#endif // SIDEBYSIDEDIFFEDITORWIDGET_H
|
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://www.qt.io/licensing. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef QBSINSTALLSTEP_H
#define QBSINSTALLSTEP_H
#include "qbsbuildconfiguration.h"
#include <projectexplorer/buildstep.h>
#include <projectexplorer/task.h>
#include <qbs.h>
namespace QbsProjectManager {
namespace Internal {
class QbsInstallStepConfigWidget;
class QbsInstallStep : public ProjectExplorer::BuildStep
{
Q_OBJECT
public:
QbsInstallStep(ProjectExplorer::BuildStepList *bsl);
QbsInstallStep(ProjectExplorer::BuildStepList *bsl, const QbsInstallStep *other);
~QbsInstallStep();
bool init();
void run(QFutureInterface<bool> &fi);
ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
bool runInGuiThread() const;
void cancel();
bool fromMap(const QVariantMap &map);
QVariantMap toMap() const;
qbs::InstallOptions installOptions() const;
QString installRoot() const;
QString absoluteInstallRoot() const;
bool removeFirst() const;
bool dryRun() const;
bool keepGoing() const;
signals:
void changed();
private slots:
void installDone(bool success);
void handleTaskStarted(const QString &desciption, int max);
void handleProgress(int value);
private:
void createTaskAndOutput(ProjectExplorer::Task::TaskType type,
const QString &message, const QString &file, int line);
void setInstallRoot(const QString &ir);
void setRemoveFirst(bool rf);
void setDryRun(bool dr);
void setKeepGoing(bool kg);
qbs::InstallOptions m_qbsInstallOptions;
QFutureInterface<bool> *m_fi;
qbs::InstallJob *m_job;
int m_progressBase;
bool m_showCompilerOutput;
ProjectExplorer::IOutputParser *m_parser;
friend class QbsInstallStepConfigWidget;
};
namespace Ui { class QbsInstallStepConfigWidget; }
class QbsInstallStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
{
Q_OBJECT
public:
QbsInstallStepConfigWidget(QbsInstallStep *step);
~QbsInstallStepConfigWidget();
QString summaryText() const;
QString displayName() const;
private slots:
void updateState();
void changeInstallRoot();
void changeRemoveFirst(bool rf);
void changeDryRun(bool dr);
void changeKeepGoing(bool kg);
private:
Ui::QbsInstallStepConfigWidget *m_ui;
QbsInstallStep *m_step;
QString m_summary;
bool m_ignoreChange;
};
class QbsInstallStepFactory : public ProjectExplorer::IBuildStepFactory
{
Q_OBJECT
public:
explicit QbsInstallStepFactory(QObject *parent = 0);
// used to show the list of possible additons to a target, returns a list of types
QList<Core::Id> availableCreationIds(ProjectExplorer::BuildStepList *parent) const;
// used to translate the types to names to display to the user
QString displayNameForId(Core::Id id) const;
bool canCreate(ProjectExplorer::BuildStepList *parent, Core::Id id) const;
ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, Core::Id id);
// used to recreate the runConfigurations when restoring settings
bool canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const;
ProjectExplorer::BuildStep *restore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map);
bool canClone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product) const;
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product);
};
} // namespace Internal
} // namespace QbsProjectManager
#endif // QBSINSTALLSTEP_H
|
/* $XConsortium: free.c /main/5 1995/07/15 20:38:35 drk $ */
/*
* Motif
*
* Copyright (c) 1987-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them 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.
*
* These libraries and programs are distributed in the hope that
* they 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 these librararies and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*
*/
/*
* HISTORY
*/
#include "wsm_proto.h"
#include <X11/Xatom.h>
static void FreeWinData(
WSMWinData *data, int num
);
/* Function Name: FreeRequest
* Description: Frees data in the request that has been allocated.
* Arguments: request - the request.
* Returns: none.
*/
void
FreeRequest(WSMRequest *request)
{
register int i;
if (!request->any.allocated)
return; /* Nothing to free. */
switch(request->any.type) {
case WSM_CONNECT:
XtFree((XtPointer) request->connect.known_versions);
break;
case WSM_EXTENSIONS:
{
register int num = request->extensions.num_extensions;
register String *ptr;
num = request->extensions.num_extensions;
ptr = request->extensions.extension_suggestions;
for (i = 0; i < num; i++, ptr++)
XtFree((XtPointer) *ptr);
XtFree((XtPointer) request->extensions.extension_suggestions);
}
break;
case WSM_SET_STATE:
{
register int num = request->set_state.num_win_info_list;
WSMWinInfo *win_info = request->set_state.win_info_list;
for (i = 0; i < num; i++, win_info++)
FreeWinData(win_info->data_list, win_info->num_data_list);
XtFree((XtPointer) request->set_state.win_info_list);
}
break;
default:
break;
}
}
/* Function Name: FreeRequest
* Description: Frees data in the request that has been allocated.
* Arguments: reply - the reply.
* Returns: none.
*/
void
FreeReply(WSMReply *reply)
{
register int i;
if (!reply->any.allocated)
return; /* Nothing to free. */
switch(reply->any.type) {
case WSM_EXTENSIONS:
{
register int num = reply->extensions.num_extensions;
register String *ptr;
num = reply->extensions.num_extensions;
ptr = reply->extensions.extensions;
for (i = 0; i < num; i++, ptr++)
XtFree((XtPointer) *ptr);
XtFree((XtPointer) reply->extensions.extensions);
}
break;
case WSM_GET_STATE:
{
WSMWinInfo *win_info = reply->get_state.win_info_list;
register int num = reply->get_state.num_win_info_list;
for (i = 0; i < num; i++, win_info++)
FreeWinData(win_info->data_list, win_info->num_data_list);
XtFree((XtPointer) reply->get_state.win_info_list);
}
break;
case WSM_REG_WINDOW:
FreeWinData(reply->register_window.window_data,
reply->register_window.num_window_data);
break;
default:
break;
}
}
/************************************************************
*
* Internal routines
*
************************************************************/
/* Function Name: FreeWinData
* Description: Frees the data associated with this window.
* Arguments: data - The data to free.
* num - number of elements in data.
* Returns: none.
*/
static void
FreeWinData(WSMWinData *data, int num)
{
register int i;
WSMWinData *top = data;
for (i = 0; i < num; i++, data++) {
switch (data->type) {
case WSM_CHAR_LIST_DATA:
XtFree((XtPointer) data->data.char_ptr);
break;
case WSM_SHORT_LIST_DATA:
XtFree((XtPointer) data->data.short_ptr);
break;
case WSM_LONG_LIST_DATA:
XtFree((XtPointer) data->data.long_ptr);
break;
default:
break;
}
}
XtFree((XtPointer) top);
}
|
/*
* This file is part of NetSurf's LibNSGIF, http://www.netsurf-browser.org/
* Licensed under the MIT License,
* http://www.opensource.org/licenses/mit-license.php
*
* Copyright 2017 Michael Drake <michael.drake@codethink.co.uk>
*/
#ifndef LZW_H_
#define LZW_H_
/**
* \file
* \brief LZW decompression (interface)
*
* Decoder for GIF LZW data.
*/
/** Maximum LZW code size in bits */
#define LZW_CODE_MAX 12
/* Declare lzw internal context structure */
struct lzw_ctx;
/** LZW decoding response codes */
typedef enum lzw_result {
LZW_OK, /**< Success */
LZW_OK_EOD, /**< Success; reached zero-length sub-block */
LZW_NO_MEM, /**< Error: Out of memory */
LZW_NO_DATA, /**< Error: Out of data */
LZW_EOI_CODE, /**< Error: End of Information code */
LZW_BAD_ICODE, /**< Error: Bad initial LZW code */
LZW_BAD_CODE, /**< Error: Bad LZW code */
} lzw_result;
/**
* Create an LZW decompression context.
*
* \param[out] ctx Returns an LZW decompression context. Caller owned,
* free with lzw_context_destroy().
* \return LZW_OK on success, or appropriate error code otherwise.
*/
lzw_result lzw_context_create(
struct lzw_ctx **ctx);
/**
* Destroy an LZW decompression context.
*
* \param[in] ctx The LZW decompression context to destroy.
*/
void lzw_context_destroy(
struct lzw_ctx *ctx);
/**
* Initialise an LZW decompression context for decoding.
*
* Caller owns neither `stack_base_out` or `stack_pos_out`.
*
* \param[in] ctx The LZW decompression context to initialise.
* \param[in] compressed_data The compressed data.
* \param[in] compressed_data_len Byte length of compressed data.
* \param[in] compressed_data_pos Start position in data. Must be position
* of a size byte at sub-block start.
* \param[in] code_size The initial LZW code size to use.
* \param[out] stack_base_out Returns base of decompressed data stack.
* \param[out] stack_pos_out Returns current stack position.
* There are `stack_pos_out - stack_base_out`
* current stack entries.
* \return LZW_OK on success, or appropriate error code otherwise.
*/
lzw_result lzw_decode_init(
struct lzw_ctx *ctx,
const uint8_t *compressed_data,
uint32_t compressed_data_len,
uint32_t compressed_data_pos,
uint8_t code_size,
const uint8_t ** const stack_base_out,
const uint8_t ** const stack_pos_out);
/**
* Fill the LZW stack with decompressed data
*
* Ensure anything on the stack is used before calling this, as anything
* on the stack before this call will be trampled.
*
* Caller does not own `stack_pos_out`.
*
* \param[in] ctx LZW reading context, updated.
* \param[out] stack_pos_out Returns current stack position.
* Use with `stack_base_out` value from previous
* lzw_decode_init() call.
* There are `stack_pos_out - stack_base_out`
* current stack entries.
* \return LZW_OK on success, or appropriate error code otherwise.
*/
lzw_result lzw_decode(
struct lzw_ctx *ctx,
const uint8_t ** const stack_pos_out);
#endif
|
/* Copyright 2014 IPB, Universite de Bordeaux, INRIA & CNRS
**
** This file is part of the Scotch software package for static mapping,
** graph partitioning and sparse matrix ordering.
**
** This software is governed by the CeCILL-C license under French law
** and abiding by the rules of distribution of free software. You can
** use, modify and/or redistribute the software under the terms of the
** CeCILL-C license as circulated by CEA, CNRS and INRIA at the following
** URL: "http://www.cecill.info".
**
** As a counterpart to the access to the source code and rights to copy,
** modify and redistribute granted by the license, users are provided
** only with a limited warranty and the software's author, the holder of
** the economic rights, and the successive licensors have only limited
** liability.
**
** In this respect, the user's attention is drawn to the risks associated
** with loading, using, modifying and/or developing or reproducing the
** software by the user in light of its specific status of free software,
** that may mean that it is complicated to manipulate, and that also
** therefore means that it is reserved for developers and experienced
** professionals having in-depth computer knowledge. Users are therefore
** encouraged to load and test the software's suitability as regards
** their requirements in conditions enabling the security of their
** systems and/or data to be ensured and, more generally, to use and
** operate it in the same conditions as regards security.
**
** The fact that you are presently reading this means that you have had
** knowledge of the CeCILL-C license and that you accept its terms.
*/
/************************************************************/
/** **/
/** NAME : library_memory.c **/
/** **/
/** AUTHOR : Francois PELLEGRINI **/
/** **/
/** FUNCTION : This module is the API for the memory **/
/** handling routines. **/
/** **/
/** DATES : # Version 6.0 : from : 21 sep 2014 **/
/** to 23 sep 2014 **/
/** **/
/************************************************************/
/*
** The defines and includes.
*/
#define LIBRARY
#include "module.h"
#include "common.h"
#include "scotch.h"
/************************************/
/* */
/* These routines are the C API for */
/* the memory management routines. */
/* */
/************************************/
/*+ This routine frees a structure allocated
*** by a SCOTCH_*Alloc () routine.
*** It returns:
*** - void : in all cases.
+*/
void
SCOTCH_memFree (
void * const dataptr)
{
memFree (dataptr);
}
/*+ This routine returns the size, in bytes,
*** of a SCOTCH_Num.
*** It returns:
*** - void : in all cases.
+*/
int
SCOTCH_numSizeof ()
{
return (sizeof (SCOTCH_Num));
}
|
#ifndef _Exception_h_
#define _Exception_h_
/* -------------------------------------------------------------------------- *
* OpenSim: Exception.h *
* -------------------------------------------------------------------------- *
* The OpenSim API is a toolkit for musculoskeletal modeling and simulation. *
* See http://opensim.stanford.edu and the NOTICE file for more information. *
* OpenSim is developed at Stanford University and supported by the US *
* National Institutes of Health (U54 GM072970, R24 HD065690) and by DARPA *
* through the Warrior Web program. *
* *
* Copyright (c) 2005-2012 Stanford University and the Authors *
* Author(s): Frank C. Anderson *
* *
* 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. *
* -------------------------------------------------------------------------- */
/* Note: This code was originally developed by Realistic Dynamics Inc.
* Author: Frank C. Anderson
*/
// INCLUDES
#include "osimCommonDLL.h"
#include <string>
//using namespace std;
#ifdef WIN32
#pragma warning( disable : 4251 ) // VC2010 no-dll export of std::string
#endif
//=============================================================================
//=============================================================================
/**
* A class for basic exception functionality.
*
* @version 1.0
* @author Frank C. Anderson
*/
#ifdef SWIG
#ifdef OSIMCOMMON_API
#undef OSIMCOMMON_API
#define OSIMCOMMON_API
#endif
#endif
namespace OpenSim {
class OSIMCOMMON_API Exception : public std::exception {
//=============================================================================
// DATA
//=============================================================================
protected:
/** A user set message for the exception. */
std::string _msg;
/** File in which the error occurred. */
std::string _file;
/** Line number at which the error occurred. */
int _line;
//=============================================================================
// METHODS
//=============================================================================
public:
// CONSTRUCTORS
Exception(const std::string &aMsg="",const std::string &aFile="",int aLine=-1);
virtual ~Exception() throw() {}
private:
void setNull();
public:
// SET AND GET
void setMessage(const std::string &aMsg);
const char* getMessage() const;
#ifndef SWIG
// PRINT
virtual void print(std::ostream &aOut) const;
#endif
// override virtual function from std::exception
const char* what() const throw() {return getMessage();}
//=============================================================================
}; // END CLASS Exception
}; //namespace
//=============================================================================
//=============================================================================
#endif // __Exception_h__
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _ACTIVEMQ_CMSUTIL_MESSAGECONTEXT_H_
#define _ACTIVEMQ_CMSUTIL_MESSAGECONTEXT_H_
#include <cms/Destination.h>
#include <cms/Message.h>
namespace activemq {
namespace cmsutil {
class MessageContext {
public:
class SendListener {
public:
virtual ~SendListener() {}
virtual void onSend(const cms::Destination* destination,
cms::Message* message, int deliveryMode, int priority,
long long timeToLive) = 0;
virtual cms::Message* doReceive(const cms::Destination* dest,
const std::string& selector,
bool noLocal,
long long timeout) = 0;
};
private:
MessageContext(const MessageContext&);
MessageContext& operator= (const MessageContext&);
private:
SendListener* listener;
public:
MessageContext() : listener(NULL) {
}
virtual ~MessageContext(){}
void setSendListener(SendListener* listener) {
this->listener = listener;
}
void send(const cms::Destination* destination,
cms::Message* message, int deliveryMode, int priority, long long timeToLive) {
if( listener != NULL ) {
listener->onSend(destination, message, deliveryMode, priority, timeToLive);
}
}
cms::Message* receive(const cms::Destination* dest, const std::string& selector,
bool noLocal, long long timeout) {
if (listener != NULL) {
return listener->doReceive(dest, selector, noLocal, timeout);
}
return NULL;
}
};
}}
#endif /*_ACTIVEMQ_CMSUTIL_MESSAGECONTEXT_H_*/
|
/* $NetBSD: isapnpvar.h,v 1.4 2008/12/14 17:03:43 christos Exp $ */
/*
* Copyright (c) 1997
* Matthias Drochner. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE 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.
*
*/
int isapnp_finddev(int, int*, int*);
|
/*
* librdkafka - Apache Kafka C library
*
* Copyright (c) 2012-2015, Magnus Edenhill
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
/* Typical include path would be <librdkafka/rdkafka.h>, but this program
* is built from within the librdkafka source tree and thus differs. */
#include "rdkafka.h" /* for Kafka driver */
/**
* Various regression tests for hangs on destroy.
*/
/**
* Issue #530:
* "Legacy Consumer. Delete hangs if done right after RdKafka::Consumer::create.
* But If I put a start and stop in between, there is no issue."
*/
static int legacy_consumer_early_destroy (void) {
rd_kafka_t *rk;
rd_kafka_topic_t *rkt;
int pass;
const char *topic = test_mk_topic_name(__FUNCTION__, 0);
for (pass = 0 ; pass < 2 ; pass++) {
TEST_SAY("%s: pass #%d\n", __FUNCTION__, pass);
rk = test_create_handle(RD_KAFKA_CONSUMER, NULL);
if (pass == 1) {
/* Second pass, create a topic too. */
rkt = rd_kafka_topic_new(rk, topic, NULL);
TEST_ASSERT(rkt, "failed to create topic: %s",
rd_kafka_err2str(
rd_kafka_last_error()));
rd_sleep(1);
rd_kafka_topic_destroy(rkt);
}
rd_kafka_destroy(rk);
}
return 0;
}
int main_0037_destroy_hang_local (int argc, char **argv) {
int fails = 0;
test_conf_init(NULL, NULL, 30);
fails += legacy_consumer_early_destroy();
if (fails > 0)
TEST_FAIL("See %d previous error(s)\n", fails);
return 0;
}
|
#ifndef _SLAYER_HTTP_SERVER_H_
#define _SLAYER_HTTP_SERVER_H_
#include <apr_atomic.h>
#include <apr_file_info.h>
#include <apr_general.h>
#include <apr_network_io.h>
#include <apr_poll.h>
#include <apr_queue.h>
#include <apr_strings.h>
#include <apr_thread_proc.h>
#include <apr_thread_rwlock.h>
#include <apr_time.h>
#include <apr_uri.h>
#include "slayer_server_logging.h"
#include "slayer_server_stats.h"
#include "slayer_http_parse.h"
#define SLAYER_MT_TEXT_PLAIN "text/plain; charset=utf-8"
typedef struct _slayer_http_service_map_t _slayer_http_service_map_t;
// SERVER
typedef struct _slayer_http_server_t {
apr_pool_t *mpool;
slayer_server_log_manager_t *lmanager;
slayer_server_log_manager_t *elmanager;
slayer_server_stats_t *stats;
apr_queue_t *in_queue;
apr_queue_t *out_queue;
volatile apr_uint32_t shutdown;
int argc;
const char **argv;
char *startup_args;
char *hostname;
char *config;
char *debug ;
char *basedir;
char *logfile;
char *elogfile;
int thread_count;
int port;
int socket_timeout;
int nslice;
int tslice;
_slayer_http_service_map_t **service_map;
int service_map_size;
int uri_size;
const char *server_name;
} slayer_http_server_t;
typedef struct _slayer_http_request_t {
apr_pool_t *mpool;
apr_time_t begin_request;
slayer_http_request_parse_t *parse; // this needs to cleaned up
apr_uri_t uri;
char *message;
char *message_marker;
char *message_end;
int payload_size;
int response_code;
int read_done;
int done;
} slayer_http_request_t;
typedef struct _slayer_http_connection_t {
apr_pool_t *mpool;
apr_socket_t *conn;
apr_pollfd_t pollfd;
slayer_http_request_t *request;
} slayer_http_connection_t;
typedef struct _slayer_http_service_t {
char * help_string;
void * (*service_global_init_func)(apr_pool_t *, int, char **);
void (*service_global_destroy_func)(void *);
void * (*service_thread_init_func)(apr_pool_t *, void * /*global_config_chunk*/);
void (*service_thread_destroy_func)(void *);
void * (*service_handler_func)(slayer_http_server_t *server, void *global_config,
slayer_http_connection_t *client, void *local_config);
} slayer_http_service_t;
typedef struct _slayer_http_service_map_t {
char **urls;
slayer_http_service_t *service;
void *global_config;
} slayer_http_service_map_t;
int slayer_server_run(int service_map_size, slayer_http_service_map_t **service_map, int argc, char **argv, int uri_size,const char *server_name);
int slayer_http_handle_response(slayer_http_server_t *server, slayer_http_connection_t *connection, const char *mime_type, const char *message, int message_size);
#endif //_SLAYER_HTTP_SERVER_H_
|
//
// JWTagScrollView.h
// YuWa
//
// Created by Tian Wei You on 16/10/15.
// Copyright © 2016年 Shanghai DuRui Information Technology Company. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface JWTagScrollView : UIScrollView
@property (nonatomic,copy)void (^chooseTagBlock)(NSString * tag);
@property (nonatomic,strong)NSArray * tagArr;
@end
|
/*
Copyright (C) 2010-2012, Parrot Foundation.
=head1 NAME
include/parrot/pointer_array.h - Storage of pointers.
=head1 DESCRIPTION
Storage for pointers used in GC implementation.
Storage organized in 4KB chunks. Every cell in chunk either real pointer
or pointer to next free cell.
Lower bit in cell masked to indicate pointer-to-free-cell.
*/
#ifndef PARROT_POINTER_ARRAY_H_GUARD
#define PARROT_POINTER_ARRAY_H_GUARD
#include <parrot/memory.h>
/* Calculate size of chunk data "header" */
#define CHUNK_SIZE 4096
#define CELL_PER_CHUNK ((CHUNK_SIZE - 2 * sizeof(size_t)) / sizeof (void *))
typedef struct Parrot_Pointer_Array_Chunk {
size_t num_free;
size_t next_free; /* Index of next free element within chunk */
void *data[CELL_PER_CHUNK];
} Parrot_Pointer_Array_Chunk;
typedef struct Parrot_Pointer_Array {
/* Next free cell (used after freeing some cells) */
/* "Look, ma! Pointer to pointer to void!!!" */
void **next_free;
/* Index of last used chunk */
size_t current_chunk;
/* Total number of allocated chunks */
size_t total_chunks;
Parrot_Pointer_Array_Chunk **chunks;
} Parrot_Pointer_Array;
/* Poor man C++ templating... */
#define POINTER_ARRAY_ITER(_array, _code) \
do { \
size_t _i; \
for (_i = 0; _i < (_array)->total_chunks; _i++) { \
Parrot_Pointer_Array_Chunk *chunk = (_array)->chunks[_i]; \
size_t _j; \
\
for (_j = 0; _j < CELL_PER_CHUNK - chunk->num_free; _j++) { \
void *ptr = chunk->data[_j]; \
if ((ptrcast_t)(ptr) & 1) \
continue; \
\
{ _code } \
} \
} \
} while (0);
/*
Inline functions for faster access.
*/
/*
=over 4
=item C<static void * Parrot_pa_insert(Parrot_Pointer_Array *self, void *ptr)>
Insert pointer into the array.
=cut
*/
static
PARROT_INLINE
void *
Parrot_pa_insert(ARGMOD(Parrot_Pointer_Array *self), ARGIN(void *ptr))
{
void *ret;
/* Reuse removed cell */
if (self->next_free) {
void **next = (void**)((ptrcast_t)*self->next_free & ~1);
ret = self->next_free;
*self->next_free = ptr;
self->next_free = next;
}
else {
Parrot_Pointer_Array_Chunk *chunk;
/* If there is no free chunks */
if (self->current_chunk >= self->total_chunks
|| !self->chunks[self->current_chunk]->num_free) {
self->current_chunk = self->total_chunks++;
mem_internal_realloc_n_typed(self->chunks,
self->total_chunks,
Parrot_Pointer_Array_Chunk*);
self->chunks[self->current_chunk] =
mem_internal_allocate_typed(Parrot_Pointer_Array_Chunk);
self->chunks[self->current_chunk]->num_free = CELL_PER_CHUNK;
self->chunks[self->current_chunk]->next_free = 0;
}
chunk = self->chunks[self->current_chunk];
--chunk->num_free;
/* Invariant: all chunks after chunk->next_free are free */
/* We handle previously freed chunks early */
ret = &chunk->data[chunk->next_free];
chunk->data[chunk->next_free++] = ptr;
}
return ret;
}
/*
=item C<static void Parrot_pa_remove(PARROT_INTERP, Parrot_Pointer_Array *self,
void *ptr)>
Remove pointer from array.
=back
=cut
*/
static
PARROT_INLINE
void
Parrot_pa_remove(SHIM_INTERP, ARGIN(Parrot_Pointer_Array *self), ARGIN(void *ptr))
{
/* Mark cell to avoid iterating over */
*(void**)ptr = (void*)((ptrcast_t)self->next_free | 1);
self->next_free = (void**)ptr;
}
/* HEADERIZER BEGIN: src/pointer_array.c */
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
PARROT_EXPORT
void Parrot_pa_destroy(PARROT_INTERP, ARGFREE(Parrot_Pointer_Array *self));
PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
int Parrot_pa_is_owned(
ARGIN(const Parrot_Pointer_Array *self),
ARGIN(const void *orig),
ARGIN_NULLOK(const void *ref))
__attribute__nonnull__(1)
__attribute__nonnull__(2);
PARROT_EXPORT
PARROT_MALLOC
PARROT_CANNOT_RETURN_NULL
Parrot_Pointer_Array * Parrot_pa_new(PARROT_INTERP);
PARROT_WARN_UNUSED_RESULT
PARROT_PURE_FUNCTION
size_t Parrot_pa_count_allocated(PARROT_INTERP,
ARGIN(const Parrot_Pointer_Array *self))
__attribute__nonnull__(2);
PARROT_WARN_UNUSED_RESULT
size_t Parrot_pa_count_used(PARROT_INTERP,
ARGIN(const Parrot_Pointer_Array *self))
__attribute__nonnull__(2);
#define ASSERT_ARGS_Parrot_pa_destroy __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
#define ASSERT_ARGS_Parrot_pa_is_owned __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(self) \
, PARROT_ASSERT_ARG(orig))
#define ASSERT_ARGS_Parrot_pa_new __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
#define ASSERT_ARGS_Parrot_pa_count_allocated __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(self))
#define ASSERT_ARGS_Parrot_pa_count_used __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(self))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: src/pointer_array.c */
#endif /* PARROT_POINTER_ARRAY_H_GUARD */
/*
* Local variables:
* c-file-style: "parrot"
* End:
* vim: expandtab shiftwidth=4 cinoptions='\:2=2' :
*/
|
#ifndef __EVAS_ENGINE_H__
#define __EVAS_ENGINE_H__
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
#include "evas_common.h"
#include "evas_common_soft16.h"
extern int _evas_engine_soft16_wince_log_dom;
#ifdef ERR
# undef ERR
#endif
#define ERR(...) EINA_LOG_DOM_ERR(_evas_engine_soft16_wince_log_dom, __VA_ARGS__)
#ifdef DBG
# undef DBG
#endif
#define DBG(...) EINA_LOG_DOM_DBG(_evas_engine_soft16_wince_log_dom, __VA_ARGS__)
#ifdef INF
# undef INF
#endif
#define INF(...) EINA_LOG_DOM_INFO(_evas_engine_soft16_wince_log_dom, __VA_ARGS__)
#ifdef WRN
# undef WRN
#endif
#define WRN(...) EINA_LOG_DOM_WARN(_evas_engine_soft16_wince_log_dom, __VA_ARGS__)
#ifdef CRIT
# undef CRIT
#endif
#define CRIT(...) EINA_LOG_DOM_CRIT(_evas_engine_soft16_wince_log_dom, __VA_ARGS__)
typedef struct _FB_Output_Buffer FB_Output_Buffer;
struct _FB_Output_Buffer
{
Soft16_Image *im;
void *priv;
};
/* Raw FrameBuffer */
void *evas_software_wince_fb_init (HWND window,
int width,
int height);
FB_Output_Buffer *evas_software_wince_fb_output_buffer_new (void *priv,
int width,
int height);
void evas_software_wince_fb_shutdown(void *priv);
void evas_software_wince_fb_output_buffer_free (FB_Output_Buffer *fbob);
void evas_software_wince_fb_output_buffer_paste (FB_Output_Buffer *fbob);
void evas_software_wince_fb_surface_resize(FB_Output_Buffer *fbob);
/* GAPI */
void *evas_software_wince_gapi_init (HWND window,
int width,
int height);
FB_Output_Buffer *evas_software_wince_gapi_output_buffer_new (void *priv,
int width,
int height);
void evas_software_wince_gapi_shutdown(void *priv);
void evas_software_wince_gapi_output_buffer_free (FB_Output_Buffer *fbob);
void evas_software_wince_gapi_output_buffer_paste (FB_Output_Buffer *fbob);
void evas_software_wince_gapi_surface_resize(FB_Output_Buffer *fbob);
void *evas_software_wince_gapi_default_keys(void);
int evas_software_wince_gapi_suspend(void);
int evas_software_wince_gapi_resume(void);
/* DirectDraw */
#ifdef __cplusplus
extern "C" {
#endif
void *evas_software_wince_ddraw_init (HWND window,
int width,
int height);
FB_Output_Buffer *evas_software_wince_ddraw_output_buffer_new (void *priv,
int width,
int height);
void evas_software_wince_ddraw_shutdown(void *priv);
void evas_software_wince_ddraw_output_buffer_free (FB_Output_Buffer *fbob);
void evas_software_wince_ddraw_output_buffer_paste (FB_Output_Buffer *fbob);
void evas_software_wince_ddraw_surface_resize(FB_Output_Buffer *fbob);
#ifdef __cplusplus
}
#endif
/* GDI */
void *evas_software_wince_gdi_init (HWND window,
int width,
int height,
int fullscreen);
FB_Output_Buffer *evas_software_wince_gdi_output_buffer_new (void *priv,
int width,
int height);
void evas_software_wince_gdi_shutdown(void *priv);
void evas_software_wince_gdi_output_buffer_free (FB_Output_Buffer *fbob);
void evas_software_wince_gdi_output_buffer_paste (FB_Output_Buffer *fbob);
void evas_software_wince_gdi_surface_resize(FB_Output_Buffer *fbob);
#endif /* __EVAS_ENGINE_H__ */
|
#if ! defined _Bag_h
#define _Bag_h 1
#include <basic/bool.h>
#include <stdio.h>
#include <basic/assert.h>
#include <basic/Iterator.h>
#include <basic/Collection.h>
#include <basic/Link.h>
//#include <basic/enter_Bag.h>
namespace omega {
template<class T> class Bag : public Collection<T> {
public:
virtual ~Bag();
Bag();
Bag(const Bag<T>&);
Bag & operator=(const Bag<T>&);
virtual void operator |= (const Bag<T> & b); // add elements in b
Iterator<T> *new_iterator();
bool empty() const;
void remove(T);
virtual void insert(T);
void clear();
virtual bool contains(T) const;
int size() const;
T extract();
// protected: breaks g++ 261
List_Element<T>* contents;
};
template<class T> class Ordered_Bag : public Bag<T> {
public:
Ordered_Bag();
// virtual ~Ordered_Bag();
Ordered_Bag(const Ordered_Bag<T>& B) : Bag<T>(B) {}
void insert(T);
virtual void operator |= (const Ordered_Bag<T> & b); // add elements in b
void operator |= (const Bag<T> & b);
bool contains(T) const;
bool operator == (const Ordered_Bag<T>&) const;
bool operator != (const Ordered_Bag<T>&) const;
bool operator < (const Ordered_Bag<T>&) const;
};
template <class T> class Set : public Ordered_Bag <T> {
public:
Set();
// virtual ~Set();
Set(T);
Set(const Set<T>& S) : Ordered_Bag<T>(S) {}
bool contains (const Set<T>& b) const;
bool contains (T t) const { return Ordered_Bag<T>::contains(t); }
// the above makes "standard" C++ happy
virtual void operator |= (const Set<T> & b); // add elements in b
void operator |= (const Ordered_Bag<T> & b);
void operator |= (const Bag<T> & b);
void operator -= (const Set<T> & b); // delete items also in b
void operator &= (const Set<T> & b); // delete items not in b
bool operator & (const Set<T> &) const; // check for elements in common
};
} // end of namespace omega
#if ! defined DONT_INCLUDE_TEMPLATE_CODE
#include <basic/Bag.c>
#endif
namespace omega {
#define instantiate_Bag(T) template class Bag<T>; \
instantiate_List_Element(T);
#define instantiate_Ordered_Bag(T) template class Ordered_Bag<T>; \
instantiate_Bag(T)
#define instantiate_Set(T) template class Set<T>; \
instantiate_Ordered_Bag(T)
}
#endif
|
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITKEXTACTIONBARADVISOR_H_
#define QMITKEXTACTIONBARADVISOR_H_
#include <berryActionBarAdvisor.h>
#include <org_mitk_gui_qt_ext_Export.h>
class MITK_QT_COMMON_EXT_EXPORT QmitkExtActionBarAdvisor : public berry::ActionBarAdvisor
{
public:
QmitkExtActionBarAdvisor(berry::IActionBarConfigurer::Pointer configurer);
protected:
void FillMenuBar(void* menuBar);
};
#endif /*QMITKEXTACTIONBARADVISOR_H_*/
|
/*
Copyright (C) 2014, The University of Texas at Austin
This file is part of libflame and is available under the 3-Clause
BSD license, which can be found in the LICENSE file at the top-level
directory, or at http://opensource.org/licenses/BSD-3-Clause
*/
#include "FLAME.h"
#ifdef FLA_ENABLE_NON_CRITICAL_CODE
FLA_Error FLA_Gemm_tn_blk_var6( FLA_Obj alpha, FLA_Obj A, FLA_Obj B, FLA_Obj beta, FLA_Obj C, fla_gemm_t* cntl )
{
FLA_Obj AT, A0,
AB, A1,
A2;
FLA_Obj BT, B0,
BB, B1,
B2;
dim_t b;
FLA_Scal_internal( beta, C,
FLA_Cntl_sub_scal( cntl ) );
FLA_Part_2x1( A, &AT,
&AB, 0, FLA_BOTTOM );
FLA_Part_2x1( B, &BT,
&BB, 0, FLA_BOTTOM );
while ( FLA_Obj_length( AB ) < FLA_Obj_length( A ) ){
b = FLA_Determine_blocksize( AT, FLA_TOP, FLA_Cntl_blocksize( cntl ) );
FLA_Repart_2x1_to_3x1( AT, &A0,
&A1,
/* ** */ /* ** */
AB, &A2, b, FLA_TOP );
FLA_Repart_2x1_to_3x1( BT, &B0,
&B1,
/* ** */ /* ** */
BB, &B2, b, FLA_TOP );
/*------------------------------------------------------------*/
/* C = alpha * A1' * B1 + C; */
FLA_Gemm_internal( FLA_TRANSPOSE, FLA_NO_TRANSPOSE,
alpha, A1, B1, FLA_ONE, C,
FLA_Cntl_sub_gemm( cntl ) );
/*------------------------------------------------------------*/
FLA_Cont_with_3x1_to_2x1( &AT, A0,
/* ** */ /* ** */
A1,
&AB, A2, FLA_BOTTOM );
FLA_Cont_with_3x1_to_2x1( &BT, B0,
/* ** */ /* ** */
B1,
&BB, B2, FLA_BOTTOM );
}
return FLA_SUCCESS;
}
#endif
|
/*
* AliFemtoPairCleanerHists.h
*
* Created on: 22 Dec 2017
* Author: bernhardhohlweger
*/
#ifndef ALIFEMTODREAMPAIRCLEANERHISTS_H_
#define ALIFEMTODREAMPAIRCLEANERHISTS_H_
#include "Rtypes.h"
#include "TH1F.h"
#include "TList.h"
class AliFemtoDreamPairCleanerHists {
public:
AliFemtoDreamPairCleanerHists();
AliFemtoDreamPairCleanerHists(int nTrackDecays,int nDecayDecays);
virtual ~AliFemtoDreamPairCleanerHists();
void FillDaughtersSharedTrack(int Hist,int counter) {
fTrackDecays[Hist]->Fill(counter);
};
void FillDaughtersSharedDaughter(int Hist,int counter) {
fDecayDecays[Hist]->Fill(counter);
};
TList *GetHistList(){return fOutput;};
TH1F **fTrackDecays;
TH1F **fDecayDecays;
TList *fOutput;
ClassDef(AliFemtoDreamPairCleanerHists,2)
};
#endif /* ALIFEMTODREAMPAIRCLEANERHISTS_H_ */
|
/*
* Copyright (c) 2016 - present
*
* Programming Research Laboratory (ROPAS)
* Seoul National University, Korea
* All rights reserved.
*
* This source code is licensed under the BSD style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
void while_loop() {
int i = 0;
char* a = malloc(10);
while (*(a + i) && i < 10) /* BUG */
a[i++] = 1; /* SAFE */
}
|
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITKPROGRESSBAR_H
#define QMITKPROGRESSBAR_H
#include <MitkQtWidgetsExports.h>
#include <mitkProgressBarImplementation.h>
#include <QProgressBar>
/**
* \ingroup QmitkModule
* \brief QT-Toolkit/GUI dependent class that provides the QT's ProgressBar
*
* All mitk-classes will call this class for output:
* mitk::ProgressBar::GetInstance();
*/
class MITKQTWIDGETS_EXPORT QmitkProgressBar : public QProgressBar, public mitk::ProgressBarImplementation
{
Q_OBJECT
public:
//##Documentation
//##@brief Constructor;
//## holds param instance internally and connects this to the mitkProgressBar
QmitkProgressBar(QWidget * parent = nullptr, const char * name = nullptr);
//##Documentation
//##@brief Destructor
virtual ~QmitkProgressBar();
//##Documentation
//## @brief Sets whether the current progress value is displayed.
virtual void SetPercentageVisible(bool visible) override;
//##Documentation
//## @brief Adds steps to totalSteps.
virtual void AddStepsToDo(unsigned int steps) override;
//##Documentation
//## @brief Sets the current amount of progress to current progress + steps.
//## @param: steps the number of steps done since last Progress(int steps) call.
virtual void Progress(unsigned int steps) override;
signals:
void SignalAddStepsToDo(unsigned int steps);
void SignalProgress(unsigned int steps);
void SignalSetPercentageVisible(bool visible);
protected slots:
virtual void SlotAddStepsToDo(unsigned int steps);
virtual void SlotProgress(unsigned int steps);
virtual void SlotSetPercentageVisible(bool visible);
private:
//##Documentation
//## @brief Reset the progress bar. The progress bar "rewinds" and shows no progress.
void Reset() override;
unsigned int m_TotalSteps;
unsigned int m_Progress;
};
#endif /* define QMITKPROGRESSBAR_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 MEDIA_CAST_FRAMER_FRAME_BUFFER
#define MEDIA_CAST_FRAMER_FRAME_BUFFER
#include <map>
#include <vector>
#include "media/cast/cast_config.h"
#include "media/cast/rtp_receiver/rtp_receiver_defines.h"
namespace media {
namespace cast {
typedef std::map<uint16, std::vector<uint8> > PacketMap;
class FrameBuffer {
public:
FrameBuffer();
~FrameBuffer();
void InsertPacket(const uint8* payload_data,
size_t payload_size,
const RtpCastHeader& rtp_header);
bool Complete() const;
bool GetEncodedAudioFrame(transport::EncodedAudioFrame* audio_frame) const;
bool GetEncodedVideoFrame(transport::EncodedVideoFrame* video_frame) const;
bool is_key_frame() const { return is_key_frame_; }
uint32 last_referenced_frame_id() const { return last_referenced_frame_id_; }
private:
uint32 frame_id_;
uint16 max_packet_id_;
uint16 num_packets_received_;
bool is_key_frame_;
size_t total_data_size_;
uint32 last_referenced_frame_id_;
uint32 rtp_timestamp_;
PacketMap packets_;
DISALLOW_COPY_AND_ASSIGN(FrameBuffer);
};
} // namespace cast
} // namespace media
#endif // MEDIA_CAST_FRAMER_FRAME_BUFFER
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef TRACE_TEMPLATED_SUPER_H_
#define TRACE_TEMPLATED_SUPER_H_
#include "heap/stubs.h"
namespace blink {
class HeapObject;
class Mixin : public GarbageCollectedMixin {
public:
virtual void Trace(Visitor*) override { }
};
template<typename T>
class Super : public GarbageCollected<Super<T> >, public Mixin {
USING_GARBAGE_COLLECTED_MIXIN(Super);
public:
virtual void Trace(Visitor*) override;
void clearWeakMembers(Visitor*);
private:
Member<HeapObject> m_obj;
WeakMember<HeapObject> m_weak;
};
template<typename T>
class Sub : public Super<T> {
public:
virtual void Trace(Visitor* visitor) override;
private:
Member<HeapObject> m_obj;
};
class HeapObject : public Sub<HeapObject> {
public:
virtual void Trace(Visitor*) override;
private:
Member<HeapObject> m_obj;
};
}
#endif
|
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include <stdint.h>
#include <tap.h>
#include "http_req_range.h"
#include "log.h"
int main(void) {
http_req_range *r, *ranges = http_request_range_init();
buffer *b = buffer_init();
log_init();
plan_tests(7);
buffer_copy_string_len(b, CONST_STR_LEN("bytes=0-0"));
ok(PARSE_SUCCESS == http_request_range_parse(b, ranges), "0-0");
for (r = ranges; r; r = r->next) {
diag(".. %jd - %jd", (intmax_t) r->start, (intmax_t) r->end);
}
http_request_range_reset(ranges);
buffer_copy_string_len(b, CONST_STR_LEN("bytes=1-2,3-4"));
ok(PARSE_SUCCESS == http_request_range_parse(b, ranges), "1-2,3-4");
for (r = ranges; r; r = r->next) {
diag(".. %jd - %jd", (intmax_t) r->start, (intmax_t) r->end);
}
http_request_range_reset(ranges);
buffer_copy_string_len(b, CONST_STR_LEN("bytes=-0"));
ok(PARSE_SUCCESS == http_request_range_parse(b, ranges), "-0");
for (r = ranges; r; r = r->next) {
diag(".. %jd - %jd", (intmax_t) r->start, (intmax_t) r->end);
}
http_request_range_reset(ranges);
buffer_copy_string_len(b, CONST_STR_LEN("bytes=0-"));
ok(PARSE_SUCCESS == http_request_range_parse(b, ranges), "0-");
for (r = ranges; r; r = r->next) {
diag(".. %jd - %jd", (intmax_t) r->start, (intmax_t) r->end);
}
http_request_range_reset(ranges);
buffer_copy_string_len(b, CONST_STR_LEN("bytes=0-0,0-"));
ok(PARSE_SUCCESS == http_request_range_parse(b, ranges), "0-0,0-");
for (r = ranges; r; r = r->next) {
diag(".. %jd - %jd", (intmax_t) r->start, (intmax_t) r->end);
}
http_request_range_reset(ranges);
buffer_copy_string_len(b, CONST_STR_LEN("bytes=0-0,-0"));
ok(PARSE_SUCCESS == http_request_range_parse(b, ranges), "0-0,-0");
for (r = ranges; r; r = r->next) {
diag(".. %jd - %jd", (intmax_t) r->start, (intmax_t) r->end);
}
http_request_range_reset(ranges);
buffer_copy_string_len(b, CONST_STR_LEN("bytes=1-2,3-4,5-"));
ok(PARSE_SUCCESS == http_request_range_parse(b, ranges), "1-2,3-4,5-");
for (r = ranges; r; r = r->next) {
diag(".. %jd - %jd", (intmax_t) r->start, (intmax_t) r->end);
}
http_request_range_free(ranges);
buffer_free(b);
log_free();
return exit_status();
}
|
// 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 UI_GFX_RANGE_RANGE_H_
#define UI_GFX_RANGE_RANGE_H_
#include <stddef.h>
#include <stdint.h>
#include <ostream>
#include <string>
#include "build/build_config.h"
#include "ui/gfx/gfx_export.h"
#if defined(OS_MACOSX)
#if __OBJC__
#import <Foundation/Foundation.h>
#else
typedef struct _NSRange NSRange;
#endif
#endif // defined(OS_MACOSX)
#if defined(OS_WIN)
#include <windows.h>
#include <richedit.h>
#endif
namespace gfx {
// A Range contains two integer values that represent a numeric range, like the
// range of characters in a text selection. A range is made of a start and end
// position; when they are the same, the Range is akin to a caret. Note that
// |start_| can be greater than |end_| to respect the directionality of the
// range.
class GFX_EXPORT Range {
public:
// Creates an empty range {0,0}.
Range();
// Initializes the range with a start and end.
Range(uint32_t start, uint32_t end);
// Initializes the range with the same start and end positions.
explicit Range(uint32_t position);
// Platform constructors.
#if defined(OS_MACOSX)
explicit Range(const NSRange& range);
#elif defined(OS_WIN)
// The |total_length| paramater should be used if the CHARRANGE is set to
// {0,-1} to indicate the whole range.
Range(const CHARRANGE& range, LONG total_length = -1);
#endif
// Returns a range that is invalid, which is {UINT32_MAX,UINT32_MAX}.
static const Range InvalidRange();
// Checks if the range is valid through comparison to InvalidRange().
bool IsValid() const;
// Getters and setters.
uint32_t start() const { return start_; }
void set_start(uint32_t start) { start_ = start; }
uint32_t end() const { return end_; }
void set_end(uint32_t end) { end_ = end; }
// Returns the absolute value of the length.
uint32_t length() const {
return GetMax() - GetMin();
}
bool is_reversed() const { return start() > end(); }
bool is_empty() const { return start() == end(); }
// Returns the minimum and maximum values.
uint32_t GetMin() const;
uint32_t GetMax() const;
bool operator==(const Range& other) const;
bool operator!=(const Range& other) const;
bool EqualsIgnoringDirection(const Range& other) const;
// Returns true if this range intersects the specified |range|.
bool Intersects(const Range& range) const;
// Returns true if this range contains the specified |range|.
bool Contains(const Range& range) const;
// Computes the intersection of this range with the given |range|.
// If they don't intersect, it returns an InvalidRange().
// The returned range is always empty or forward (never reversed).
Range Intersect(const Range& range) const;
#if defined(OS_MACOSX)
Range& operator=(const NSRange& range);
// NSRange does not store the directionality of a range, so if this
// is_reversed(), the range will get flipped when converted to an NSRange.
NSRange ToNSRange() const;
#elif defined(OS_WIN)
CHARRANGE ToCHARRANGE() const;
#endif
// GTK+ has no concept of a range.
std::string ToString() const;
private:
// Note: we use uint32_t instead of size_t because this struct is sent over
// IPC which could span 32 & 64 bit processes. This is fine since text spans
// shouldn't exceed UINT32_MAX even on 64 bit builds.
uint32_t start_;
uint32_t end_;
};
GFX_EXPORT std::ostream& operator<<(std::ostream& os, const Range& range);
} // namespace gfx
#endif // UI_GFX_RANGE_RANGE_H_
|
/*=========================================================================
Program: CMake - Cross-Platform Makefile Generator
Module: $RCSfile: cmOrderDirectories.h,v $
Language: C++
Date: $Date: 2012/03/29 17:21:08 $
Version: $Revision: 1.1.1.1 $
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef cmOrderDirectories_h
#define cmOrderDirectories_h
#include "cmStandardIncludes.h"
#include <cmsys/RegularExpression.hxx>
class cmGlobalGenerator;
class cmOrderDirectoriesConstraint;
class cmOrderDirectoriesConstraintLibrary;
class cmTarget;
/** \class cmOrderDirectories
* \brief Compute a safe runtime path order for a set of shared libraries.
*/
class cmOrderDirectories
{
public:
cmOrderDirectories(cmGlobalGenerator* gg, cmTarget* target,
const char* purpose);
~cmOrderDirectories();
void AddRuntimeLibrary(std::string const& fullPath, const char* soname = 0);
void AddLinkLibrary(std::string const& fullPath);
void AddUserDirectories(std::vector<std::string> const& extra);
void SetImplicitDirectories(std::set<cmStdString> const& implicitDirs);
void SetLinkExtensionInfo(std::vector<std::string> const& linkExtensions,
std::string const& removeExtRegex);
std::vector<std::string> const& GetOrderedDirectories();
private:
cmGlobalGenerator* GlobalGenerator;
cmTarget* Target;
std::string Purpose;
bool Computed;
std::vector<std::string> OrderedDirectories;
bool OrderedDirectoriesComputed;
std::vector<cmOrderDirectoriesConstraint*> ConstraintEntries;
std::vector<cmOrderDirectoriesConstraint*> ImplicitDirEntries;
std::vector<std::string> UserDirectories;
cmsys::RegularExpression RemoveLibraryExtension;
std::vector<std::string> LinkExtensions;
std::set<cmStdString> ImplicitDirectories;
std::set<cmStdString> EmmittedConstraintSOName;
std::set<cmStdString> EmmittedConstraintLibrary;
std::vector<std::string> OriginalDirectories;
std::map<cmStdString, int> DirectoryIndex;
std::vector<int> DirectoryVisited;
void CollectOriginalDirectories();
int AddOriginalDirectory(std::string const& dir);
void FindConflicts();
void FindImplicitConflicts();
void OrderDirectories();
void VisitDirectory(unsigned int i);
void DiagnoseCycle();
bool CycleDiagnosed;
int WalkId;
// Adjacency-list representation of runtime path ordering graph.
// This maps from directory to those that must come *before* it.
// Each entry that must come before is a pair. The first element is
// the index of the directory that must come first. The second
// element is the index of the runtime library that added the
// constraint.
typedef std::pair<int, int> ConflictPair;
struct ConflictList: public std::vector<ConflictPair> {};
std::vector<ConflictList> ConflictGraph;
friend class cmOrderDirectoriesConstraint;
friend class cmOrderDirectoriesConstraintLibrary;
};
#endif
|
/*
* File: Result.h
* Author: kjell
*
* https://github.com/weberr13/FileIO
* Created on April 21
*/
#pragma once
#include <string>
/**
* Example Usage:
* return Result<bool> success{true};
* or in case of a failure
* return Result<bool> failure{false, error};
*/
template<typename T> struct Result {
const T result;
const std::string error;
/**
* Result of an operation.
* @param output whatever the expected output would be
* @param err error message to the client, default is empty which means successful operation
*/
Result(T output, const std::string& err)
: result{output}, error{err} {
}
Result(T output) : result{output}, error{""}{
}
Result() = delete;
Result(const Result&) = default; // Copy constructor
Result(Result&&) = default; // Move constructor
Result& operator=(const Result&) & = default; // Copy assignment operator
Result& operator=(Result&&) & = default; // Move assignment operator
~Result() = default;
/** @return status whether or not the Result contains a failure*/
bool HasFailed() const {
return (!error.empty());
}
/// convenience function @return status whether or not the Result was a success
bool HasSuccess() const {
return (error.empty());
}
};
|
//
// CDGroupAddMemberController.h
// LeanChat
//
// Created by lzw on 14/11/7.
// Copyright (c) 2014年 LeanCloud. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "CDConvDetailVC.h"
#import "CDBaseTableVC.h"
@interface CDAddMemberVC : CDBaseTableVC
@property (nonatomic) CDConvDetailVC *groupDetailVC;
@end
|
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(c) 2015-2020 Beijing WangXun Technology Co., Ltd.
* Copyright(c) 2010-2017 Intel Corporation
*/
#ifndef _TXGBE_STATUS_H_
#define _TXGBE_STATUS_H_
/* Error Codes:
* common error
* module error(simple)
* module error(detailed)
*
* (-256, 256): reserved for non-txgbe defined error code
*/
#define TERR_BASE (0x100)
enum txgbe_error {
TERR_NULL = TERR_BASE,
TERR_ANY,
TERR_NOSUPP,
TERR_NOIMPL,
TERR_NOMEM,
TERR_NOSPACE,
TERR_NOENTRY,
TERR_CONFIG,
TERR_ARGS,
TERR_PARAM,
TERR_INVALID,
TERR_TIMEOUT,
TERR_VERSION,
TERR_REGISTER,
TERR_FEATURE,
TERR_RESET,
TERR_AUTONEG,
TERR_MBX,
TERR_I2C,
TERR_FC,
TERR_FLASH,
TERR_DEVICE,
TERR_HOSTIF,
TERR_SRAM,
TERR_EEPROM,
TERR_EEPROM_CHECKSUM,
TERR_EEPROM_PROTECT,
TERR_EEPROM_VERSION,
TERR_MAC,
TERR_MAC_ADDR,
TERR_SFP,
TERR_SFP_INITSEQ,
TERR_SFP_PRESENT,
TERR_SFP_SUPPORT,
TERR_SFP_SETUP,
TERR_PHY,
TERR_PHY_ADDR,
TERR_PHY_INIT,
TERR_FDIR_CMD,
TERR_FDIR_REINIT,
TERR_SWFW_SYNC,
TERR_SWFW_COMMAND,
TERR_FC_CFG,
TERR_FC_NEGO,
TERR_LINK_SETUP,
TERR_PCIE_PENDING,
TERR_PBA_SECTION,
TERR_OVERTEMP,
TERR_UNDERTEMP,
TERR_XPCS_POWERUP,
};
/* WARNING: just for legacy compatibility */
#define TXGBE_NOT_IMPLEMENTED 0x7FFFFFFF
#define TXGBE_ERR_OPS_DUMMY 0x3FFFFFFF
/* Error Codes */
#define TXGBE_ERR_EEPROM -(TERR_BASE + 1)
#define TXGBE_ERR_EEPROM_CHECKSUM -(TERR_BASE + 2)
#define TXGBE_ERR_PHY -(TERR_BASE + 3)
#define TXGBE_ERR_CONFIG -(TERR_BASE + 4)
#define TXGBE_ERR_PARAM -(TERR_BASE + 5)
#define TXGBE_ERR_MAC_TYPE -(TERR_BASE + 6)
#define TXGBE_ERR_UNKNOWN_PHY -(TERR_BASE + 7)
#define TXGBE_ERR_LINK_SETUP -(TERR_BASE + 8)
#define TXGBE_ERR_ADAPTER_STOPPED -(TERR_BASE + 9)
#define TXGBE_ERR_INVALID_MAC_ADDR -(TERR_BASE + 10)
#define TXGBE_ERR_DEVICE_NOT_SUPPORTED -(TERR_BASE + 11)
#define TXGBE_ERR_MASTER_REQUESTS_PENDING -(TERR_BASE + 12)
#define TXGBE_ERR_INVALID_LINK_SETTINGS -(TERR_BASE + 13)
#define TXGBE_ERR_AUTONEG_NOT_COMPLETE -(TERR_BASE + 14)
#define TXGBE_ERR_RESET_FAILED -(TERR_BASE + 15)
#define TXGBE_ERR_SWFW_SYNC -(TERR_BASE + 16)
#define TXGBE_ERR_PHY_ADDR_INVALID -(TERR_BASE + 17)
#define TXGBE_ERR_I2C -(TERR_BASE + 18)
#define TXGBE_ERR_SFP_NOT_SUPPORTED -(TERR_BASE + 19)
#define TXGBE_ERR_SFP_NOT_PRESENT -(TERR_BASE + 20)
#define TXGBE_ERR_SFP_NO_INIT_SEQ_PRESENT -(TERR_BASE + 21)
#define TXGBE_ERR_NO_SAN_ADDR_PTR -(TERR_BASE + 22)
#define TXGBE_ERR_FDIR_REINIT_FAILED -(TERR_BASE + 23)
#define TXGBE_ERR_EEPROM_VERSION -(TERR_BASE + 24)
#define TXGBE_ERR_NO_SPACE -(TERR_BASE + 25)
#define TXGBE_ERR_OVERTEMP -(TERR_BASE + 26)
#define TXGBE_ERR_FC_NOT_NEGOTIATED -(TERR_BASE + 27)
#define TXGBE_ERR_FC_NOT_SUPPORTED -(TERR_BASE + 28)
#define TXGBE_ERR_SFP_SETUP_NOT_COMPLETE -(TERR_BASE + 30)
#define TXGBE_ERR_PBA_SECTION -(TERR_BASE + 31)
#define TXGBE_ERR_INVALID_ARGUMENT -(TERR_BASE + 32)
#define TXGBE_ERR_HOST_INTERFACE_COMMAND -(TERR_BASE + 33)
#define TXGBE_ERR_OUT_OF_MEM -(TERR_BASE + 34)
#define TXGBE_ERR_FEATURE_NOT_SUPPORTED -(TERR_BASE + 36)
#define TXGBE_ERR_EEPROM_PROTECTED_REGION -(TERR_BASE + 37)
#define TXGBE_ERR_FDIR_CMD_INCOMPLETE -(TERR_BASE + 38)
#define TXGBE_ERR_FW_RESP_INVALID -(TERR_BASE + 39)
#define TXGBE_ERR_TOKEN_RETRY -(TERR_BASE + 40)
#define TXGBE_ERR_FLASH_LOADING_FAILED -(TERR_BASE + 41)
#define TXGBE_ERR_NOSUPP -(TERR_BASE + 42)
#define TXGBE_ERR_UNDERTEMP -(TERR_BASE + 43)
#define TXGBE_ERR_XPCS_POWER_UP_FAILED -(TERR_BASE + 44)
#define TXGBE_ERR_PHY_INIT_NOT_DONE -(TERR_BASE + 45)
#define TXGBE_ERR_TIMEOUT -(TERR_BASE + 46)
#define TXGBE_ERR_REGISTER -(TERR_BASE + 47)
#define TXGBE_ERR_MNG_ACCESS_FAILED -(TERR_BASE + 49)
#endif /* _TXGBE_STATUS_H_ */
|
//
// This source file is part of appleseed.
// Visit https://appleseedhq.net/ for additional information and resources.
//
// This software is released under the MIT license.
//
// Copyright (c) 2010-2013 Francois Beaune, Jupiter Jazz Limited
// Copyright (c) 2014-2018 Francois Beaune, The appleseedhq Organization
//
// 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.
//
#pragma once
// appleseed.qtcommon headers.
#include "widgets/icapturablewidget.h"
// appleseed.foundation headers.
#include "foundation/image/image.h"
#include "foundation/image/tile.h"
#include "foundation/math/vector.h"
// OpenColorIO headers.
#include <OpenColorIO/OpenColorIO.h>
namespace OCIO = OCIO_NAMESPACE;
// Qt headers.
#include <QImage>
#include <QMutex>
#include <QPainter>
#include <QString>
#include <QWidget>
// Standard headers.
#include <cstddef>
#include <memory>
#include <string>
// Forward declarations.
namespace foundation { class CanvasProperties; }
namespace renderer { class Frame; }
class QDragEnterEvent;
class QDragMoveEvent;
class QDropEvent;
class QPaintEvent;
namespace appleseed {
namespace qtcommon {
//
// A render widget based on QImage.
//
class RenderWidget
: public QWidget
, public qtcommon::ICapturableWidget
{
Q_OBJECT
public:
// Constructor.
RenderWidget(
const size_t width,
const size_t height,
OCIO::ConstConfigRcPtr ocio_config,
QWidget* parent = nullptr);
// Thread-safe.
QImage capture() override;
// Thread-safe.
// Returns true on success, false otherwise.
bool load(const QString& filepath);
// Thread-safe.
void save(const QString& filepath);
// Thread-safe.
void resize(
const size_t width,
const size_t height);
// Thread-safe.
void clear();
// Called before rendering begins.
void start_render();
// Thread-safe.
void multiply(const float multiplier);
// Thread-safe.
void highlight_tile(
const renderer::Frame& frame,
const size_t tile_x,
const size_t tile_y,
const size_t thread_index,
const size_t thread_count);
// Thread-safe.
void blit_tile(
const renderer::Frame& frame,
const size_t tile_x,
const size_t tile_y);
// Thread-safe.
void blit_frame(const renderer::Frame& frame);
// Direct access to internals for high-performance drawing.
QMutex& mutex();
QImage& image();
signals:
void signal_material_dropped(
const foundation::Vector2d& drop_pos,
const QString& material_name);
public slots:
void slot_display_transform_changed(const QString& transform);
private:
mutable QMutex m_mutex;
QImage m_image;
QPainter m_painter;
std::unique_ptr<foundation::Tile> m_float_tile_storage;
std::unique_ptr<foundation::Tile> m_uint8_tile_storage;
std::unique_ptr<foundation::Image> m_image_storage;
OCIO::ConstConfigRcPtr m_ocio_config;
OCIO::ConstProcessorRcPtr m_ocio_processor;
void allocate_working_storage(const foundation::CanvasProperties& frame_props);
void blit_tile_no_lock(
const renderer::Frame& frame,
const size_t tile_x,
const size_t tile_y);
void update_tile_no_lock(
const size_t tile_x,
const size_t tile_y);
void paintEvent(QPaintEvent* event) override;
void dragEnterEvent(QDragEnterEvent* event) override;
void dragMoveEvent(QDragMoveEvent* event) override;
void dropEvent(QDropEvent* event) override;
};
//
// RenderWidget class implementation.
//
inline QMutex& RenderWidget::mutex()
{
return m_mutex;
}
inline QImage& RenderWidget::image()
{
return m_image;
}
} // namespace qtcommon
} // namespace appleseed
|
/*
* Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.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, see <http://www.gnu.org/licenses/>.
*/
#ifndef TRINITY_MOVEMENTGENERATOR_H
#define TRINITY_MOVEMENTGENERATOR_H
#include "Define.h"
#include "ObjectRegistry.h"
#include "FactoryHolder.h"
#include "Common.h"
#include "MotionMaster.h"
class Unit;
class TC_GAME_API MovementGenerator
{
public:
virtual ~MovementGenerator();
virtual void Initialize(Unit*) = 0;
virtual void Finalize(Unit*) = 0;
virtual void Reset(Unit*) = 0;
virtual bool Update(Unit*, uint32 diff) = 0;
virtual MovementGeneratorType GetMovementGeneratorType() const = 0;
virtual void UnitSpeedChanged() { }
// used by Evade code for select point to evade with expected restart default movement
virtual bool GetResetPosition(Unit*, float& /*x*/, float& /*y*/, float& /*z*/) { return false; }
};
template<class T, class D>
class MovementGeneratorMedium : public MovementGenerator
{
public:
void Initialize(Unit* u) override
{
(static_cast<D*>(this))->DoInitialize(static_cast<T*>(u));
}
void Finalize(Unit* u) override
{
(static_cast<D*>(this))->DoFinalize(static_cast<T*>(u));
}
void Reset(Unit* u) override
{
(static_cast<D*>(this))->DoReset(static_cast<T*>(u));
}
bool Update(Unit* u, uint32 time_diff) override
{
return (static_cast<D*>(this))->DoUpdate(static_cast<T*>(u), time_diff);
}
};
struct SelectableMovement : public FactoryHolder<MovementGenerator, MovementGeneratorType>
{
SelectableMovement(MovementGeneratorType movementGeneratorType) : FactoryHolder<MovementGenerator, MovementGeneratorType>(movementGeneratorType) { }
};
template<class Movement>
struct MovementGeneratorFactory : public SelectableMovement
{
MovementGeneratorFactory(MovementGeneratorType movementGeneratorType) : SelectableMovement(movementGeneratorType) { }
MovementGenerator* Create(void *) const override;
};
typedef FactoryHolder<MovementGenerator, MovementGeneratorType> MovementGeneratorCreator;
typedef FactoryHolder<MovementGenerator, MovementGeneratorType>::FactoryHolderRegistry MovementGeneratorRegistry;
#endif
|
/* Copyright (C) 1997, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>.
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 <math.h>
#include "math_private.h"
#include "mathimpl.h"
#ifndef SUFF
#define SUFF
#endif
#ifndef float_type
#define float_type double
#endif
#define CONCATX(a,b) __CONCAT(a,b)
#define s(name) CONCATX(name,SUFF)
#define m81(func) __m81_u(s(func))
float_type
s(__ieee754_scalb) (float_type x, float_type fn)
{
float_type retval;
unsigned long x_cond = __m81_test (x);
unsigned long fn_cond = __m81_test (fn);
if ((x_cond | fn_cond) & __M81_COND_NAN)
return x * fn;
if (fn_cond & __M81_COND_INF)
{
if (!(fn_cond & __M81_COND_NEG))
return x * fn;
else if (x_cond & __M81_COND_ZERO)
return x;
else
return x / -fn;
}
if (m81(__rint) (fn) != fn)
return (x - x) / (x - x);
__asm ("fscale%.x %1, %0" : "=f" (retval) : "f" (fn), "0" (x));
return retval;
}
|
/* Copyright (c) 2009, Code Aurora Forum. 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 Code Aurora Forum nor
* the names of its contributors may be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* Alternatively, provided that this notice is retained in full, this software
* may be relicensed by the recipient under the terms of the GNU General Public
* License version 2 ("GPL") and only version 2, in which case the provisions of
* the GPL apply INSTEAD OF those given above. If the recipient relicenses the
* software under the GPL, then the identification text in the MODULE_LICENSE
* macro must be changed to reflect "GPLv2" instead of "Dual BSD/GPL". Once a
* recipient changes the license terms to the GPL, subsequent recipients shall
* not relicense under alternate licensing terms, including the BSD or dual
* BSD/GPL terms. In addition, the following license statement immediately
* below and between the words START and END shall also then apply when this
* software is relicensed under the GPL:
*
* START
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 2 and only 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 Street, Fifth Floor, Boston, MA 02110-1301, USA.
* END
* 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 __ASM__ARCH_OEM_RAPI_CLIENT_H
#define __ASM__ARCH_OEM_RAPI_CLIENT_H
/*
* OEM RAPI CLIENT Driver header file
*/
#include <linux/types.h>
#include <mach/msm_rpcrouter.h>
enum {
OEM_RAPI_CLIENT_EVENT_NONE = 0,
/*
* list of oem rapi client events
*/
OEM_RAPI_CLIENT_EVENT_MAX
};
struct oem_rapi_client_streaming_func_cb_arg {
uint32_t event;
void *handle;
uint32_t in_len;
char *input;
uint32_t out_len_valid;
uint32_t output_valid;
uint32_t output_size;
};
struct oem_rapi_client_streaming_func_cb_ret {
uint32_t *out_len;
char *output;
};
struct oem_rapi_client_streaming_func_arg {
uint32_t event;
int (*cb_func)(struct oem_rapi_client_streaming_func_cb_arg *,
struct oem_rapi_client_streaming_func_cb_ret *);
void *handle;
uint32_t in_len;
char *input;
uint32_t out_len_valid;
uint32_t output_valid;
uint32_t output_size;
};
struct oem_rapi_client_streaming_func_ret {
uint32_t *out_len;
char *output;
};
int oem_rapi_client_streaming_function(
struct msm_rpc_client *client,
struct oem_rapi_client_streaming_func_arg *arg,
struct oem_rapi_client_streaming_func_ret *ret);
int oem_rapi_client_close(void);
struct msm_rpc_client *oem_rapi_client_init(void);
#endif
|
/*
* (C) Copyright 2000-2004
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
* (C) Copyright 2003
* Kai-Uwe Bloem, Auerswald GmbH & Co KG, <linux-development@auerswald.de>
*
* 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
*/
/*
* Multi Image extract
*/
#include <common.h>
#include <command.h>
#include <image.h>
#include <asm/byteorder.h>
int
do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
{
ulong addr = load_addr;
ulong dest = 0;
ulong data, len, count;
int verify;
int part = 0;
char pbuf[10];
image_header_t *hdr;
#if defined(CONFIG_FIT)
const char *uname = NULL;
const void* fit_hdr;
int noffset;
const void *fit_data;
size_t fit_len;
#endif
verify = getenv_verify ();
if (argc > 1) {
addr = simple_strtoul(argv[1], NULL, 16);
}
if (argc > 2) {
part = simple_strtoul(argv[2], NULL, 16);
#if defined(CONFIG_FIT)
uname = argv[2];
#endif
}
if (argc > 3) {
dest = simple_strtoul(argv[3], NULL, 16);
}
switch (genimg_get_format ((void *)addr)) {
case IMAGE_FORMAT_LEGACY:
printf("## Copying part %d from legacy image "
"at %08lx ...\n", part, addr);
hdr = (image_header_t *)addr;
if (!image_check_magic (hdr)) {
printf("Bad Magic Number\n");
return 1;
}
if (!image_check_hcrc (hdr)) {
printf("Bad Header Checksum\n");
return 1;
}
#ifdef DEBUG
image_print_contents (hdr);
#endif
if (!image_check_type (hdr, IH_TYPE_MULTI)) {
printf("Wrong Image Type for %s command\n",
cmdtp->name);
return 1;
}
if (image_get_comp (hdr) != IH_COMP_NONE) {
printf("Wrong Compression Type for %s command\n",
cmdtp->name);
return 1;
}
if (verify) {
printf(" Verifying Checksum ... ");
if (!image_check_dcrc (hdr)) {
printf("Bad Data CRC\n");
return 1;
}
printf("OK\n");
}
count = image_multi_count (hdr);
if (part >= count) {
printf("Bad Image Part\n");
return 1;
}
image_multi_getimg (hdr, part, &data, &len);
break;
#if defined(CONFIG_FIT)
case IMAGE_FORMAT_FIT:
if (uname == NULL) {
puts ("No FIT subimage unit name\n");
return 1;
}
printf("## Copying '%s' subimage from FIT image "
"at %08lx ...\n", uname, addr);
fit_hdr = (const void *)addr;
if (!fit_check_format (fit_hdr)) {
puts ("Bad FIT image format\n");
return 1;
}
/* get subimage node offset */
noffset = fit_image_get_node (fit_hdr, uname);
if (noffset < 0) {
printf ("Can't find '%s' FIT subimage\n", uname);
return 1;
}
if (fit_image_check_comp (fit_hdr, noffset, IH_COMP_NONE)) {
printf("Wrong Compression Type for %s command\n",
cmdtp->name);
return 1;
}
/* verify integrity */
if (verify) {
if (!fit_image_check_hashes (fit_hdr, noffset)) {
puts ("Bad Data Hash\n");
return 1;
}
}
/* get subimage data address and length */
if (fit_image_get_data (fit_hdr, noffset, &fit_data, &fit_len)) {
puts ("Could not find script subimage data\n");
return 1;
}
data = (ulong)fit_data;
len = (ulong)fit_len;
break;
#endif
default:
puts ("Invalid image type for imxtract\n");
return 1;
}
if (argc > 3) {
memcpy((char *) dest, (char *) data, len);
}
sprintf(pbuf, "%8lx", data);
setenv("fileaddr", pbuf);
sprintf(pbuf, "%8lx", len);
setenv("filesize", pbuf);
return 0;
}
U_BOOT_CMD(imxtract, 4, 1, do_imgextract,
"imxtract- extract a part of a multi-image\n",
"addr part [dest]\n"
" - extract <part> from legacy image at <addr> and copy to <dest>\n"
#if defined(CONFIG_FIT)
"addr uname [dest]\n"
" - extract <uname> subimage from FIT image at <addr> and copy to <dest>\n"
#endif
);
|
////////////////////////////////////////////////////////////////
// 2000 Microsoft Systems Journal.
// If this program works, it was written by Paul DiLascia.
// If not, I don't know who wrote it.
// This program compiles with Visual C++ 6.0 on Windows 98
//
#define DLLIMPORT __declspec(dllimport)
// IdleUI is a DLL that lets you tell when the user interface has been idle
// for a specified amount of time. The DLL works by installing windows keyboard
// and mouse hooks. The DLL records the tick count whenever input is received.
//
// To use, you must
// - call IdleUIInit when your app starts up
// - call IdleUITerm when your app terminates
// - call IdleUIGetLastInputTime to get the time, and compare this with
// the current GetTickCount();
//
// See TestIdleUI.cpp for an example of how to use IdleUI
//
DLLIMPORT BOOL IdleUIInit();
DLLIMPORT void IdleUITerm();
DLLIMPORT DWORD IdleUIGetLastInputTime();
|
/*-
* Copyright (c) 2003-2009 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``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(S) 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 "test.h"
__FBSDID("$FreeBSD: head/lib/libarchive/test/test_read_disk.c 201247 2009-12-30 05:59:21Z kientzle $");
static void
gname_cleanup(void *d)
{
int *mp = d;
assertEqualInt(*mp, 0x13579);
*mp = 0x2468;
}
static const char *
gname_lookup(void *d, int64_t g)
{
int *mp = d;
assertEqualInt(*mp, 0x13579);
if (g == 1)
return ("FOOGROUP");
return ("NOTFOOGROUP");
}
static void
uname_cleanup(void *d)
{
int *mp = d;
assertEqualInt(*mp, 0x1234);
*mp = 0x2345;
}
static const char *
uname_lookup(void *d, int64_t u)
{
int *mp = d;
assertEqualInt(*mp, 0x1234);
if (u == 1)
return ("FOO");
return ("NOTFOO");
}
#if !defined(__CYGWIN__) && !defined(__HAIKU__)
/* We test GID lookup by looking up the name of group number zero and
* checking it against the following list. If your system uses a
* different conventional name for group number zero, please extend
* this array and send us a patch. As always, please keep this list
* sorted alphabetically.
*/
static const char *zero_groups[] = {
"root", /* Linux */
"wheel" /* BSD */
};
#endif
DEFINE_TEST(test_read_disk)
{
struct archive *a;
int gmagic = 0x13579, umagic = 0x1234;
#if !defined(__CYGWIN__) && !defined(__HAIKU__)
const char *p;
size_t i;
#endif
assert((a = archive_read_disk_new()) != NULL);
/* Default uname/gname lookups always return NULL. */
assert(archive_read_disk_gname(a, 0) == NULL);
assert(archive_read_disk_uname(a, 0) == NULL);
/* Register some weird lookup functions. */
assertEqualInt(ARCHIVE_OK, archive_read_disk_set_gname_lookup(a,
&gmagic, &gname_lookup, &gname_cleanup));
/* Verify that our new function got called. */
assertEqualString(archive_read_disk_gname(a, 0), "NOTFOOGROUP");
assertEqualString(archive_read_disk_gname(a, 1), "FOOGROUP");
/* De-register. */
assertEqualInt(ARCHIVE_OK,
archive_read_disk_set_gname_lookup(a, NULL, NULL, NULL));
/* Ensure our cleanup function got called. */
assertEqualInt(gmagic, 0x2468);
/* Same thing with uname lookup.... */
assertEqualInt(ARCHIVE_OK, archive_read_disk_set_uname_lookup(a,
&umagic, &uname_lookup, &uname_cleanup));
assertEqualString(archive_read_disk_uname(a, 0), "NOTFOO");
assertEqualString(archive_read_disk_uname(a, 1), "FOO");
assertEqualInt(ARCHIVE_OK,
archive_read_disk_set_uname_lookup(a, NULL, NULL, NULL));
assertEqualInt(umagic, 0x2345);
/* Try the standard lookup functions. */
if (archive_read_disk_set_standard_lookup(a) != ARCHIVE_OK) {
skipping("standard uname/gname lookup");
} else {
#if defined(__CYGWIN__) || defined(__HAIKU__)
/* Some platforms don't have predictable names for
* uid=0, so we skip this part of the test. */
skipping("standard uname/gname lookup");
#else
/* XXX Someday, we may need to generalize this the
* same way we generalized the group name check below.
* That's needed only if we encounter a system where
* uid 0 is not "root". XXX */
assertEqualString(archive_read_disk_uname(a, 0), "root");
/* Get the group name for group 0 and see if it makes sense. */
p = archive_read_disk_gname(a, 0);
assert(p != NULL);
if (p != NULL) {
i = 0;
while (i < sizeof(zero_groups)/sizeof(zero_groups[0])) {
if (strcmp(zero_groups[i], p) == 0)
break;
++i;
}
if (i == sizeof(zero_groups)/sizeof(zero_groups[0])) {
/* If you get a failure here, either
* archive_read_disk_gname() isn't working or
* your system uses a different name for group
* number zero. If the latter, please add a
* new entry to the zero_groups[] array above.
*/
failure("group 0 didn't have any of the expected names");
assertEqualString(p, zero_groups[0]);
}
}
#endif
}
/* Deregister again and verify the default lookups again. */
assertEqualInt(ARCHIVE_OK,
archive_read_disk_set_gname_lookup(a, NULL, NULL, NULL));
assertEqualInt(ARCHIVE_OK,
archive_read_disk_set_uname_lookup(a, NULL, NULL, NULL));
assert(archive_read_disk_gname(a, 0) == NULL);
assert(archive_read_disk_uname(a, 0) == NULL);
/* Re-register our custom handlers. */
gmagic = 0x13579;
umagic = 0x1234;
assertEqualInt(ARCHIVE_OK, archive_read_disk_set_gname_lookup(a,
&gmagic, &gname_lookup, &gname_cleanup));
assertEqualInt(ARCHIVE_OK, archive_read_disk_set_uname_lookup(a,
&umagic, &uname_lookup, &uname_cleanup));
/* Destroy the archive. */
assertEqualInt(ARCHIVE_OK, archive_read_free(a));
/* Verify our cleanup functions got called. */
assertEqualInt(gmagic, 0x2468);
assertEqualInt(umagic, 0x2345);
}
|
/*************************************************************************\
* Copyright (C) Michael Kerrisk, 2015. *
* *
* This program is free software. You may use, modify, and redistribute it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation, either version 3 or (at your option) any *
* later version. This program is distributed without any warranty. See *
* the file COPYING.gpl-v3 for details. *
\*************************************************************************/
/* Solution for Exercise 20-2 */
/* ignore_pending_sig.c
This program demonstrates what happens if we mark a pending signal
(i.e., one that has been sent, but is currently blocked) as ignored.
Usage: ignore_pending_sig
Type Control-C (^C) to generate a SIGINT signal after the program prints
its "sleeping" message (see below).
*/
#define _GNU_SOURCE /* Get strsignal() declaration from <string.h> */
#include <string.h>
#include <signal.h>
#include "signal_functions.h" /* Declaration of printSigset() */
#include "tlpi_hdr.h"
static void
handler(int sig)
{
/* UNSAFE: This handler uses non-async-signal-safe functions
(printf(), strsignal(), fflush(); see Section 21.1.2) */
printf("Caught signal %d (%s)\n", sig, strsignal(sig));
fflush(NULL);
}
int
main(int argc, char *argv[])
{
sigset_t pending, blocked;
const int numSecs = 5;
struct sigaction sa;
/* Set up a handler for SIGINT */
printf("Setting up handler for SIGINT\n");
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
sa.sa_handler = handler;
if (sigaction(SIGINT, &sa, NULL) == -1)
errExit("sigaction");
/* Block SIGINT for a while */
sigemptyset(&blocked);
sigaddset(&blocked, SIGINT);
if (sigprocmask(SIG_SETMASK, &blocked, NULL) == -1)
errExit("sigprocmask");
printf("BLOCKING SIGINT for %d seconds\n", numSecs);
sleep(numSecs);
/* Display mask of pending signals */
if (sigpending(&pending) == -1)
errExit("sigpending");
printf("PENDING signals are: \n");
printSigset(stdout, "\t\t", &pending);
/* Now ignore SIGINT */
sleep(2);
printf("Ignoring SIGINT\n");
if (signal(SIGINT, SIG_IGN) == SIG_ERR)
errExit("signal");
/* Redisplay mask of pending signals */
if (sigpending(&pending) == -1)
errExit("sigpending");
if (sigismember(&pending, SIGINT)) {
printf("SIGINT is now pending\n");
} else {
printf("PENDING signals are: \n");
printSigset(stdout, "\t\t", &pending);
}
sleep(2);
/* Reestablish SIGINT handler */
printf("Reestablishing handler for SIGINT\n");
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
sa.sa_handler = handler;
if (sigaction(SIGINT, &sa, NULL) == -1)
errExit("sigaction");
sleep(2);
/* And unblock SIGINT */
printf("UNBLOCKING SIGINT\n");
sigemptyset(&blocked);
if (sigprocmask(SIG_SETMASK, &blocked, NULL) == -1)
errExit("sigprocmask");
exit(EXIT_SUCCESS);
}
|
/* Statistical mean, variance and correlation for circular data. */
/*
Copyright (C) 2009 University of Texas at Austin
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 <float.h>
#include <math.h>
#include <rsf.h>
#include "cplxstat.h"
#define SIGN(a) (a > 0 ? 1 : (a < 0 ? -1 : 0))
static const float eps = 1.e-5;
void circ_mean(float *d, int n, float *v, float *t)
/*< circular mean >*/
{
int i;
float r,c,s;
r = SF_PI/180.0;
c = 0.0;
s = 0.0;
for (i = 0; i < n; i++) {
c += cos(r*d[i]);
s += sin(r*d[i]);
}
c /= n;
s /= n;
/* variance */
*v = 1.0 - (c*c + s*s);
/* mean phase */
*t = atan2(s,c);
return;
}
void circ_corr(float *d1, float *d2, int n, float *corr, float *shift)
/*< circular correlation >*/
{
int i;
float v1,v2,vd,t1,t2,td;
float m1,m2,md,rm,im;
float *d;
circ_mean(d1,n,&v1,&t1);
m1 = sqrt(1.0 - v1);
circ_mean(d2,n,&v2,&t2);
m2 = sqrt(1.0 - v2);
d = sf_floatalloc(n);
for (i = 0; i < n; i++) d[i] = d2[i]-d1[i];
circ_mean(d,n,&vd,&td);
md = sqrt(1.0 - vd);
rm = md*cos(td) - m1*m2*cos(t2 - t1);
im = md*sin(td) - m1*m2*sin(t2 - t1);
/* correlation */
*corr = sqrt((rm*rm + im*im)/(v1*v2 + eps));
/* phase shift */
*shift = atan2(im,rm);
return;
}
|
/**************************************************************************/
/* */
/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
/* software is allowed according to terms specified in the file LICENSE */
/* which comes in the source distribution. */
/* */
/* Check http://www.nomachine.com/licensing.html for applicability. */
/* */
/* NX and NoMachine are trademarks of Medialogic S.p.A. */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
#ifndef PolyPoint_H
#define PolyPoint_H
#include "Message.h"
//
// Set the verbosity level.
//
#define PANIC
#define WARNING
#undef TEST
#undef DEBUG
#undef DUMP
//
// Set default values.
//
#define POLYPOINT_ENABLE_CACHE 1
#define POLYPOINT_ENABLE_DATA 0
#define POLYPOINT_ENABLE_SPLIT 0
#define POLYPOINT_ENABLE_COMPRESS 0
#define POLYPOINT_DATA_LIMIT 3200
#define POLYPOINT_DATA_OFFSET 12
#define POLYPOINT_CACHE_SLOTS 3000
#define POLYPOINT_CACHE_THRESHOLD 3
#define POLYPOINT_CACHE_LOWER_THRESHOLD 1
//
// The message class.
//
class PolyPointMessage : public Message
{
friend class PolyPointStore;
public:
PolyPointMessage()
{
}
~PolyPointMessage()
{
}
//
// Put here the fields which constitute
// the 'identity' part of the message.
//
private:
unsigned char mode;
unsigned int drawable;
unsigned int gcontext;
};
class PolyPointStore : public MessageStore
{
//
// Constructors and destructors.
//
public:
PolyPointStore() : MessageStore()
{
enableCache = POLYPOINT_ENABLE_CACHE;
enableData = POLYPOINT_ENABLE_DATA;
enableSplit = POLYPOINT_ENABLE_SPLIT;
enableCompress = POLYPOINT_ENABLE_COMPRESS;
dataLimit = POLYPOINT_DATA_LIMIT;
dataOffset = POLYPOINT_DATA_OFFSET;
cacheSlots = POLYPOINT_CACHE_SLOTS;
cacheThreshold = POLYPOINT_CACHE_THRESHOLD;
cacheLowerThreshold = POLYPOINT_CACHE_LOWER_THRESHOLD;
messages_ -> resize(cacheSlots);
for (T_messages::iterator i = messages_ -> begin();
i < messages_ -> end(); i++)
{
*i = NULL;
}
temporary_ = NULL;
}
virtual ~PolyPointStore()
{
for (T_messages::iterator i = messages_ -> begin();
i < messages_ -> end(); i++)
{
destroy(*i);
}
destroy(temporary_);
}
virtual const char *name() const
{
return "PolyPoint";
}
virtual unsigned char opcode() const
{
return X_PolyPoint;
}
virtual unsigned int storage() const
{
return sizeof(PolyPointMessage);
}
//
// Message handling methods.
//
public:
virtual Message *create() const
{
return new PolyPointMessage();
}
virtual Message *create(const Message &message) const
{
return new PolyPointMessage((const PolyPointMessage &) message);
}
virtual void destroy(Message *message) const
{
delete (PolyPointMessage *) message;
}
virtual int parseIdentity(Message *message, const unsigned char *buffer,
unsigned int size, int bigEndian) const;
virtual int unparseIdentity(const Message *message, unsigned char *buffer,
unsigned int size, int bigEndian) const;
virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message,
const Message *cachedMessage,
ChannelCache *channelCache) const;
virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message,
ChannelCache *channelCache) const;
virtual void identityChecksum(const Message *message, const unsigned char *buffer,
unsigned int size, int bigEndian) const;
virtual void dumpIdentity(const Message *message) const;
};
#endif /* PolyPoint_H */
|
#ifndef PERSISTED_RULE_INCLUDED
#define PERSISTED_RULE_INCLUDED
/* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
as published by the Free Software Foundation.
This program is also distributed with certain software (including
but not limited to OpenSSL) that is licensed under separate terms,
as designated in a particular file or component or in included license
documentation. The authors of MySQL hereby grant you an additional
permission to link the program and your derivative works with the
separately licensed software that they have included with MySQL.
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, version 2.0, 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,
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
#include "my_config.h"
#include "mysql/service_rules_table.h"
#include "nullable.h"
#include <string>
#include <memory>
namespace rts = rules_table_service;
/**
@file persisted_rule.h
The facilities for easily manipulating nullable values from a
rules_table_service::Cursor.
*/
/// A rule as persisted on disk.
class Persisted_rule
{
public:
/// The rewrite rule's pattern string.
Mysql::Nullable<std::string> pattern;
/// The pattern's current database.
Mysql::Nullable<std::string> pattern_db;
/// The rewrite rule's replacement string.
Mysql::Nullable<std::string> replacement;
/// True if the rule is enabled.
bool is_enabled;
/// The plugin's message, write-only.
Mysql::Nullable<std::string> message;
/// The pattern's digest, write-only.
Mysql::Nullable<std::string> pattern_digest;
/// The normalized pattern, write-only.
Mysql::Nullable<std::string> normalized_pattern;
/**
Constructs a Persisted_rule object that copies all data into the current
heap. The interface is constructed this way due to on some OS'es
(e.g. Windows), every shared library has its own heap.
*/
explicit Persisted_rule(rts::Cursor *c)
{
copy_and_set(&pattern, c, c->pattern_column());
copy_and_set(&pattern_db, c, c->pattern_database_column());
copy_and_set(&replacement, c, c->replacement_column());
const char *is_enabled_c= (c->fetch_string(c->enabled_column()));
if (is_enabled_c != NULL && is_enabled_c[0] == 'Y')
is_enabled= true;
else
is_enabled= false;
rts::free_string(is_enabled_c);
}
/// Convenience function, may be called with a const char*.
void set_message(const std::string &message_arg)
{
message= Mysql::Nullable<std::string>(message_arg);
}
/// Convenience function, may be called with a const char*.
void set_pattern_digest(const std::string &s)
{
pattern_digest= Mysql::Nullable<std::string>(s);
}
/// Convenience function, may be called with a const char*.
void set_normalized_pattern(const std::string &s)
{
normalized_pattern= Mysql::Nullable<std::string>(s);
}
/**
Writes the values in this Persisted_rule to the table at the row pointed
to by the cursor. Values that don't have a corresponding column in the
table will be ignored.
*/
bool write_to(rts::Cursor *c)
{
c->make_writeable();
set_if_present(c, c->message_column(), message);
set_if_present(c, c->pattern_digest_column(), pattern_digest);
set_if_present(c, c->normalized_pattern_column(), normalized_pattern);
return c->write();
}
private:
/**
Reads from a Cursor and writes to a property of type Nullable<string>
after forcing a copy of the string buffer. The function calls a member
function in Cursor that is located in the server's dynamic library.
*/
void copy_and_set(Mysql::Nullable<std::string> *property, rts::Cursor *c,
int colno)
{
const char *value= c->fetch_string(colno);
if (value != NULL)
{
std::string tmp;
tmp.assign(value);
*property= tmp;
}
rts::free_string(value);
}
/// Writes a string value to the cursor's column if it exists.
void set_if_present(rts::Cursor *cursor, rts::Cursor::column_id column,
Mysql::Nullable<std::string> value)
{
if (column == rts::Cursor::ILLEGAL_COLUMN_ID)
return;
if (!value.has_value())
{
cursor->set(column, NULL, 0);
return;
}
const std::string &s= value.value();
cursor->set(column, s.c_str(), s.length());
}
};
#endif // PERSISTED_RULE_INCLUDED
|
#ifndef __RSM_FIND_FUNC_ADDR_H
#define __RSM_FIND_FUNC_ADDR_H
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/kallsyms.h>
#define UNUSED(x) ( (void)(x) )
#define MIN(x, y) ( (x) < (y)? (x) : (y) )
#define MAX(x, y) ( (x) > (y)? (x) : (y) )
/* MAX num of function */
#define SYSCHK_MAX_SYM_UNFOUND (16)
/*define name and address struct */
typedef struct rsm_sym_addr{
char * name;
unsigned long * addr;
}RSM_SYM_ADDR;
/* define function pointer */
typedef void (*DEF_SCHED_SHOW_TASK)(struct task_struct *p);
typedef void (*DEF_PUT_TASK_STRUCT)(struct task_struct *tsk);
extern DEF_SCHED_SHOW_TASK DEF_SCHED_SHOW_TASK_TMP;
extern DEF_PUT_TASK_STRUCT DEF_PUT_TASK_STRUCT_TMP;
/* define samename function */
#define sched_show_task_macro(p) DEF_SCHED_SHOW_TASK_TMP(p)
#define __put_task_struct_macro(tsk) DEF_PUT_TASK_STRUCT_TMP(tsk)
#endif /*__SYSCHK_FIND_FUNC_ADDR_H*/
|
/* Copyright (C) 2010, 2011 emsys Embedded Systems GmbH
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* 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 "disable_init_defines.h"
#include "../f_acm.c"
#include "../f_serial.c"
int personality_acm_bind_config(struct usb_configuration *c, int port_num)
{
return acm_bind_config(c, port_num);
}
void personality_acm_unbind_config(struct usb_configuration *c, int port_num)
{
/* TODO */
}
int personality_ser_bind_config(struct usb_configuration *c, int port_num)
{
return gser_bind_config(c, port_num);
}
void personality_ser_unbind_config(struct usb_configuration *c, int port_num)
{
/* TODO */
}
|
#ifndef _ASM_POWERPC_SPARSEMEM_H
#define _ASM_POWERPC_SPARSEMEM_H 1
#ifdef __KERNEL__
#ifdef CONFIG_SPARSEMEM
/*
* SECTION_SIZE_BITS 2^N: how big each section will be
* MAX_PHYSADDR_BITS 2^N: how much physical address space we have
* MAX_PHYSMEM_BITS 2^N: how much memory we can have in that space
*/
#define SECTION_SIZE_BITS 24
#define MAX_PHYSADDR_BITS 44
#define MAX_PHYSMEM_BITS 44
#ifdef CONFIG_MEMORY_HOTPLUG
extern void create_section_mapping(unsigned long start, unsigned long end);
#ifdef CONFIG_NUMA
extern int hot_add_scn_to_nid(unsigned long scn_addr);
#else
static inline int hot_add_scn_to_nid(unsigned long scn_addr)
{
return 0;
}
#endif /* CONFIG_NUMA */
#endif /* CONFIG_MEMORY_HOTPLUG */
#endif /* CONFIG_SPARSEMEM */
#endif /* __KERNEL__ */
#endif /* _ASM_POWERPC_SPARSEMEM_H */
|
/*
* nxsmsgtestscenario.h
*
* Created on: 26 Apr 2014
* Author: crispy
*/
#ifndef NXSMSGTESTSCENARIO_H_
#define NXSMSGTESTSCENARIO_H_
#include "nxstestscenario.h"
namespace rs_nxs_test {
class NxsMsgTestScenario : public NxsTestScenario {
public:
NxsMsgTestScenario();
virtual ~NxsMsgTestScenario();
typedef std::map<RsGxsGroupId, RsGxsMessageId::std_vector> ExpectedMsgs;
typedef std::map<RsPeerId, ExpectedMsgs> ExpectedMap;
bool checkTestPassed();
bool checkDeepTestPassed();
void cleanTestScenario();
protected:
RsGeneralDataService* createDataStore(const RsPeerId& peerId, uint16_t servType);
virtual const ExpectedMap& getExpectedMap() = 0;
private:
typedef std::map<RsPeerId, RsGeneralDataService*> DataPeerMap;
DataPeerMap mDataPeerMap;
};
} /* namespace rs_nxs_test */
#endif /* NXSMSGTESTSCENARIO_H_ */
|
#include <linux/types.h>
#include <mach/mt_pm_ldo.h>
#include <cust_alsps.h>
//#include <mach/mt6577_pm_ldo.h>
static struct alsps_hw cust_alsps_hw = {
.i2c_num = 3,
.polling_mode_ps =1, /* 0 - hongzhe */
.polling_mode_als =1,
.power_id = MT65XX_POWER_NONE, /*LDO is not used*/
.power_vol = VOL_DEFAULT, /*LDO is not used*/
.i2c_addr = {0x72, 0x48, 0x78, 0x00},
/*Lenovo-sw chenlj2 add 2011-06-03,modify parameter below two lines*/
//.als_level = { 4, 40, 80, 120, 160, 250, 400, 800, 1200, 1600, 2000, 3000, 5000, 10000, 65535},
//.als_value = {10, 20,20, 120, 120, 280, 280, 280, 1600, 1600, 1600, 6000, 6000, 9000, 10240, 10240},
// .als_level = { 5, 10, 25, 50, 100, 150, 200, 400, 1000, 1500, 2000, 3000, 5000, 8000, 10000},
// .als_value = {10, 50, 100, 150, 200, 250, 280, 280, 1600, 1600, 1600, 6000, 6000, 9000, 10240, 10240},
/* MTK: modified to support AAL */
//.als_level = { 6, 9, 17, 38, 56, 74, 116, 342, 778, 1082, 1386, 1914, 3000, 5000, 8000 },
//.als_value = {136, 218, 312, 730, 1065, 1400, 2250, 4286, 5745, 7390, 9034, 11000, 12250, 12250, 12250, 12250},
// .als_level = { 0, 1, 1, 2, 3, 3, 20, 200, 400, 600, 1200, 2000, 2800, 3800, 4096}, /* orig value */
// .als_value = {40, 40, 90, 90, 160, 160, 225, 320, 640, 1280, 1280, 2600, 2600, 2600, 10240, 10240}, /* convert value */
.als_level = { 2, 20, 50, 120, 200, 400, 800, 1000, 1200, 1500, 2000, 3000, 5000, 8000, 10000},
.als_value = {10, 80, 150, 150, 400, 400, 800, 800, 1600, 1600, 1600, 6000, 6000, 9000, 10240, 10240},
#if 1
.ps_threshold_high = 450, /*200*/
.ps_threshold_low = 250, /* 100 */
#else
.ps_threshold_high = 130,
.ps_threshold_low = 110, /* 100 */
#endif
.ps_threshold = 900,
};
struct alsps_hw *get_cust_alsps_hw(void) {
return &cust_alsps_hw;
}
int APDS9900_CMM_PPCOUNT_VALUE =0x02;// 0x02;//0x08;
int APDS9900_CMM_CONTROL_VALUE = 0x24;//0xE4;//0x24; //0x22; //0xE4;
int ZOOM_TIME = 4;
|
/*
* Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.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.
*
* vineetg: March 2009
* -Implemented task_pt_regs( )
*
* Amit Bhor, Sameer Dhavale, Ashwin Chaugule: Codito Technologies 2004
*/
#ifndef __ASM_ARC_PROCESSOR_H
#define __ASM_ARC_PROCESSOR_H
#ifdef __KERNEL__
#ifndef __ASSEMBLY__
#include <asm/arcregs.h> /* for STATUS_E1_MASK et all */
/* Arch specific stuff which needs to be saved per task.
* However these items are not so important so as to earn a place in
* struct thread_info
*/
struct thread_struct {
unsigned long ksp; /* kernel mode stack pointer */
unsigned long callee_reg; /* pointer to callee regs */
unsigned long fault_address; /* dbls as brkpt holder as well */
unsigned long cause_code; /* Exception Cause Code (ECR) */
#ifdef CONFIG_ARC_CURR_IN_REG
unsigned long user_r25;
#endif
#ifdef CONFIG_ARC_FPU_SAVE_RESTORE
struct arc_fpu fpu;
#endif
};
#define INIT_THREAD { \
.ksp = sizeof(init_stack) + (unsigned long) init_stack, \
}
/* Forward declaration, a strange C thing */
struct task_struct;
/*
* Return saved PC of a blocked thread.
*/
unsigned long thread_saved_pc(struct task_struct *t);
#define task_pt_regs(p) \
((struct pt_regs *)(THREAD_SIZE - 4 + (void *)task_stack_page(p)) - 1)
/* Free all resources held by a thread. */
#define release_thread(thread) do { } while (0)
/* Prepare to copy thread state - unlazy all lazy status */
#define prepare_to_copy(tsk) do { } while (0)
/*
* A lot of busy-wait loops in SMP are based off of non-volatile data otherwise
* get optimised away by gcc
*/
#ifdef CONFIG_SMP
#define cpu_relax() __asm__ __volatile__ ("" : : : "memory")
#else
#define cpu_relax() do { } while (0)
#endif
#define cpu_relax_lowlatency() cpu_relax()
#define copy_segments(tsk, mm) do { } while (0)
#define release_segments(mm) do { } while (0)
#define KSTK_EIP(tsk) (task_pt_regs(tsk)->ret)
/*
* Where abouts of Task's sp, fp, blink when it was last seen in kernel mode.
* These can't be derived from pt_regs as that would give correp user-mode val
*/
#define KSTK_ESP(tsk) (tsk->thread.ksp)
#define KSTK_BLINK(tsk) (*((unsigned int *)((KSTK_ESP(tsk)) + (13+1+1)*4)))
#define KSTK_FP(tsk) (*((unsigned int *)((KSTK_ESP(tsk)) + (13+1)*4)))
/*
* Do necessary setup to start up a newly executed thread.
*
* E1,E2 so that Interrupts are enabled in user mode
* L set, so Loop inhibited to begin with
* lp_start and lp_end seeded with bogus non-zero values so to easily catch
* the ARC700 sr to lp_start hardware bug
*/
#define start_thread(_regs, _pc, _usp) \
do { \
set_fs(USER_DS); /* reads from user space */ \
(_regs)->ret = (_pc); \
/* Interrupts enabled in User Mode */ \
(_regs)->status32 = STATUS_U_MASK | STATUS_L_MASK \
| STATUS_E1_MASK | STATUS_E2_MASK; \
(_regs)->sp = (_usp); \
/* bogus seed values for debugging */ \
(_regs)->lp_start = 0x10; \
(_regs)->lp_end = 0x80; \
} while (0)
extern unsigned int get_wchan(struct task_struct *p);
/*
* Default implementation of macro that returns current
* instruction pointer ("program counter").
* Should the PC register be read instead ? This macro does not seem to
* be used in many places so this wont be all that bad.
*/
#define current_text_addr() ({ __label__ _l; _l: &&_l; })
#endif /* !__ASSEMBLY__ */
/* Kernels Virtual memory area.
* Unlike other architectures(MIPS, sh, cris ) ARC 700 does not have a
* "kernel translated" region (like KSEG2 in MIPS). So we use a upper part
* of the translated bottom 2GB for kernel virtual memory and protect
* these pages from user accesses by disabling Ru, Eu and Wu.
*/
#define VMALLOC_SIZE (0x10000000) /* 256M */
#define VMALLOC_START (PAGE_OFFSET - VMALLOC_SIZE)
#define VMALLOC_END (PAGE_OFFSET)
/* Most of the architectures seem to be keeping some kind of padding between
* userspace TASK_SIZE and PAGE_OFFSET. i.e TASK_SIZE != PAGE_OFFSET.
*/
#define USER_KERNEL_GUTTER 0x10000000
/* User address space:
* On ARC700, CPU allows the entire lower half of 32 bit address space to be
* translated. Thus potentially 2G (0:0x7FFF_FFFF) could be User vaddr space.
* However we steal 256M for kernel addr (0x7000_0000:0x7FFF_FFFF) and another
* 256M (0x6000_0000:0x6FFF_FFFF) is gutter between user/kernel spaces
* Thus total User vaddr space is (0:0x5FFF_FFFF)
*/
#define TASK_SIZE (PAGE_OFFSET - VMALLOC_SIZE - USER_KERNEL_GUTTER)
#define STACK_TOP TASK_SIZE
#define STACK_TOP_MAX STACK_TOP
/* This decides where the kernel will search for a free chunk of vm
* space during mmap's.
*/
#define TASK_UNMAPPED_BASE (TASK_SIZE / 3)
#endif /* __KERNEL__ */
#endif /* __ASM_ARC_PROCESSOR_H */
|
/*
* Copyright (C) 2012 Team XBMC
* http://www.xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
#pragma once
#include "utils/StdString.h"
#include "utils/Job.h"
class CBaseTexture;
/*!
\ingroup textures
\brief Simple class for passing texture detail around
*/
class CTextureDetails
{
public:
CTextureDetails()
{
id = -1;
width = height = 0;
updateable = false;
};
bool operator==(const CTextureDetails &right) const
{
return (id == right.id &&
file == right.file &&
width == right.width );
};
int id;
std::string file;
std::string hash;
unsigned int width;
unsigned int height;
bool updateable;
};
/*!
\ingroup textures
\brief Job class for caching textures
Handles loading and caching of textures.
*/
class CTextureCacheJob : public CJob
{
public:
CTextureCacheJob(const CStdString &url, const CStdString &oldHash = "");
virtual ~CTextureCacheJob();
virtual const char* GetType() const { return "cacheimage"; };
virtual bool operator==(const CJob *job) const;
virtual bool DoWork();
/*! \brief retrieve a hash for the given image
Combines the size, ctime and mtime of the image file into a "unique" hash
\param url location of the image
\return a hash string for this image
*/
bool CacheTexture(CBaseTexture **texture = NULL);
CStdString m_url;
CStdString m_oldHash;
CTextureDetails m_details;
private:
/*! \brief retrieve a hash for the given image
Combines the size, ctime and mtime of the image file into a "unique" hash
\param url location of the image
\return a hash string for this image
*/
static CStdString GetImageHash(const CStdString &url);
/*! \brief Check whether a given URL represents an image that can be updated
We currently don't check http:// and https:// URLs for updates, under the assumption that
a image URL is much more likely to be static and the actual image at the URL is unlikely
to change, so no point checking all the time.
\param url the url to check
\return true if the image given by the URL should be checked for updates, false otehrwise
*/
bool UpdateableURL(const CStdString &url) const;
/*! \brief Decode an image URL to the underlying image, width, height and orientation
\param url wrapped URL of the image
\param width width derived from URL
\param height height derived from URL
\param flipped whether the image is flipped horizontally
\return URL of the underlying image file.
*/
static CStdString DecodeImageURL(const CStdString &url, unsigned int &width, unsigned int &height, bool &flipped);
/*! \brief Load an image at a given target size and orientation.
Doesn't necessarily load the image at the desired size - the loader *may* decide to load it slightly larger
or smaller than the desired size for speed reasons.
\param image the URL of the image file.
\param width the desired maximum width.
\param height the desired maximum height.
\param flipped whether the image should be flipped horizontally.
\return a pointer to a CBaseTexture object, NULL if failed.
*/
static CBaseTexture *LoadImage(const CStdString &image, unsigned int width, unsigned int height, bool flipped);
CStdString m_cachePath;
};
/* \brief Job class for creating .dds versions of textures
*/
class CTextureDDSJob : public CJob
{
public:
CTextureDDSJob(const CStdString &original);
virtual const char* GetType() const { return "ddscompress"; };
virtual bool operator==(const CJob *job) const;
virtual bool DoWork();
CStdString m_original;
};
/* \brief Job class for storing the use count of textures
*/
class CTextureUseCountJob : public CJob
{
public:
CTextureUseCountJob(const std::vector<CTextureDetails> &textures);
virtual const char* GetType() const { return "usecount"; };
virtual bool operator==(const CJob *job) const;
virtual bool DoWork();
private:
std::vector<CTextureDetails> m_textures;
};
|
/* ulogd_filter_HWHDR.c
*
* ulogd interpreter plugin for HWMAC
*
* (C) 2008 by Eric Leblond <eric@inl.fr>
* (C) 2008 by Pablo Neira Ayuso <pablo@netfilter.org>
*
* Based on ulogd_filter_IFINDEX.c Harald Welte <laforge@gnumonks.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <arpa/inet.h>
#include <linux/if_arp.h>
#include <linux/if_ether.h>
#include <ulogd/ulogd.h>
#define HWADDR_LENGTH 128
enum input_keys {
KEY_RAW_TYPE,
KEY_OOB_PROTOCOL,
KEY_RAW_MAC,
KEY_RAW_MACLEN,
KEY_RAW_MAC_SADDR,
KEY_RAW_MAC_ADDRLEN,
};
enum output_keys {
KEY_MAC_TYPE,
KEY_MAC_PROTOCOL,
KEY_MAC_SADDR,
START_KEY = KEY_MAC_SADDR,
KEY_MAC_DADDR,
KEY_MAC_ADDR,
MAX_KEY = KEY_MAC_ADDR,
};
static struct ulogd_key mac2str_inp[] = {
[KEY_RAW_TYPE] = {
.type = ULOGD_RET_UINT16,
.flags = ULOGD_RETF_NONE|ULOGD_KEYF_OPTIONAL,
.name = "raw.type",
},
[KEY_OOB_PROTOCOL] = {
.type = ULOGD_RET_UINT16,
.flags = ULOGD_RETF_NONE,
.name = "oob.protocol",
},
[KEY_RAW_MAC] = {
.type = ULOGD_RET_RAW,
.flags = ULOGD_RETF_NONE|ULOGD_KEYF_OPTIONAL,
.name = "raw.mac",
},
[KEY_RAW_MACLEN] = {
.type = ULOGD_RET_UINT16,
.flags = ULOGD_RETF_NONE|ULOGD_KEYF_OPTIONAL,
.name = "raw.mac_len",
},
[KEY_RAW_MAC_SADDR] = {
.type = ULOGD_RET_RAW,
.flags = ULOGD_RETF_NONE|ULOGD_KEYF_OPTIONAL,
.name = "raw.mac.saddr",
},
[KEY_RAW_MAC_ADDRLEN] = {
.type = ULOGD_RET_UINT16,
.flags = ULOGD_RETF_NONE|ULOGD_KEYF_OPTIONAL,
.name = "raw.mac.addrlen",
},
};
static struct ulogd_key mac2str_keys[] = {
[KEY_MAC_TYPE] = {
.type = ULOGD_RET_UINT16,
.flags = ULOGD_RETF_NONE,
.name = "raw.type",
},
[KEY_MAC_PROTOCOL] = {
.type = ULOGD_RET_UINT16,
.flags = ULOGD_RETF_NONE,
.name = "oob.protocol",
},
[KEY_MAC_SADDR] = {
.type = ULOGD_RET_STRING,
.name = "mac.saddr.str",
},
[KEY_MAC_DADDR] = {
.type = ULOGD_RET_STRING,
.name = "mac.daddr.str",
},
[KEY_MAC_ADDR] = {
.type = ULOGD_RET_STRING,
.name = "mac.str",
},
};
static char hwmac_str[MAX_KEY - START_KEY][HWADDR_LENGTH];
static int parse_mac2str(struct ulogd_key *ret, unsigned char *mac,
int okey, int len)
{
char *buf_cur;
int i;
if (len * 3 + 1 > HWADDR_LENGTH)
return ULOGD_IRET_ERR;
if (len == 0)
hwmac_str[okey - START_KEY][0] = 0;
buf_cur = hwmac_str[okey - START_KEY];
for (i = 0; i < len; i++)
buf_cur += sprintf(buf_cur, "%02x%c", mac[i],
i == len - 1 ? 0 : ':');
okey_set_ptr(&ret[okey], hwmac_str[okey - START_KEY]);
return ULOGD_IRET_OK;
}
static void *hwhdr_get_saddr(struct ulogd_key *inp)
{
return ikey_get_ptr(&inp[KEY_RAW_MAC]) + ETH_ALEN;
}
static void *hwhdr_get_daddr(struct ulogd_key *inp)
{
return ikey_get_ptr(&inp[KEY_RAW_MAC]);
}
static u_int16_t hwhdr_get_len(struct ulogd_key *inp)
{
void *len = ikey_get_ptr(&inp[KEY_RAW_MAC]) + 2 * ETH_ALEN;
return ntohs(*(u_int16_t *) len);
}
static int parse_ethernet(struct ulogd_key *ret, struct ulogd_key *inp)
{
int fret;
if (!pp_is_valid(inp, KEY_RAW_MAC_SADDR)) {
fret = parse_mac2str(ret, hwhdr_get_saddr(inp),
KEY_MAC_SADDR, ETH_ALEN);
if (fret != ULOGD_IRET_OK)
return fret;
}
fret = parse_mac2str(ret, hwhdr_get_daddr(inp),
KEY_MAC_DADDR, ETH_ALEN);
if (fret != ULOGD_IRET_OK)
return fret;
okey_set_u16(&ret[KEY_MAC_PROTOCOL], hwhdr_get_len(inp));
return ULOGD_IRET_OK;
}
static int interp_mac2str(struct ulogd_pluginstance *pi)
{
struct ulogd_key *ret = pi->output.keys;
struct ulogd_key *inp = pi->input.keys;
u_int16_t type = 0;
if (pp_is_valid(inp, KEY_OOB_PROTOCOL))
okey_set_u16(&ret[KEY_MAC_PROTOCOL],
ikey_get_u16(&inp[KEY_OOB_PROTOCOL]));
if (pp_is_valid(inp, KEY_RAW_MAC_SADDR)) {
int fret;
if (! pp_is_valid(inp, KEY_RAW_MAC_ADDRLEN))
return ULOGD_IRET_ERR;
fret = parse_mac2str(ret,
ikey_get_ptr(&inp[KEY_RAW_MAC_SADDR]),
KEY_MAC_SADDR,
ikey_get_u16(&inp[KEY_RAW_MAC_ADDRLEN]));
if (fret != ULOGD_IRET_OK)
return fret;
/* set MAC type to unknown */
okey_set_u16(&ret[KEY_MAC_TYPE], ARPHRD_VOID);
}
if (pp_is_valid(inp, KEY_RAW_MAC)) {
if (! pp_is_valid(inp, KEY_RAW_MACLEN))
return ULOGD_IRET_ERR;
if (pp_is_valid(inp, KEY_RAW_TYPE)) {
/* NFLOG with Linux >= 2.6.27 case */
type = ikey_get_u16(&inp[KEY_RAW_TYPE]);
} else {
/* ULOG case, treat ethernet encapsulation */
if (ikey_get_u16(&inp[KEY_RAW_MACLEN]) == ETH_HLEN)
type = ARPHRD_ETHER;
else
type = ARPHRD_VOID;
}
okey_set_u16(&ret[KEY_MAC_TYPE], type);
}
switch (type) {
case ARPHRD_ETHER:
parse_ethernet(ret, inp);
default:
if (!pp_is_valid(inp, KEY_RAW_MAC))
return ULOGD_IRET_OK;
/* convert raw header to string */
return parse_mac2str(ret,
ikey_get_ptr(&inp[KEY_RAW_MAC]),
KEY_MAC_ADDR,
ikey_get_u16(&inp[KEY_RAW_MACLEN]));
}
return ULOGD_IRET_OK;
}
static struct ulogd_plugin mac2str_pluging = {
.name = "HWHDR",
.input = {
.keys = mac2str_inp,
.num_keys = ARRAY_SIZE(mac2str_inp),
.type = ULOGD_DTYPE_PACKET,
},
.output = {
.keys = mac2str_keys,
.num_keys = ARRAY_SIZE(mac2str_keys),
.type = ULOGD_DTYPE_PACKET,
},
.interp = &interp_mac2str,
.version = VERSION,
};
void __attribute__ ((constructor)) init(void);
void init(void)
{
ulogd_register_plugin(&mac2str_pluging);
}
|
/*
* memconsole-of.c
*
* Open Firmware / device tree specific parts of the memory based BIOS console.
*
* Copyright 2014 Google Inc.
*/
#include <linux/kernel.h>
#include <linux/of_address.h>
#include <linux/platform_device.h>
#include "memconsole.h"
#include "coreboot_table.h"
#define CB_TAG_CBMEM_CONSOLE 0x17
static int memconsole_of_probe(struct platform_device *pdev)
{
int ret;
struct lb_cbmem_ref entry;
ret = coreboot_table_find(CB_TAG_CBMEM_CONSOLE, &entry, sizeof(entry));
if (ret)
return ret;
ret = memconsole_coreboot_init(entry.cbmem_addr);
if (ret)
return ret;
return memconsole_sysfs_init();
}
static int memconsole_of_remove(struct platform_device *pdev)
{
memconsole_exit();
return 0;
}
static struct platform_driver memconsole_driver = {
.probe = memconsole_of_probe,
.remove = memconsole_of_remove,
.driver = {
.name = "memconsole",
},
};
static int __init platform_memconsole_init(void)
{
struct platform_device *pdev;
pdev = platform_device_register_simple("memconsole", -1, NULL, 0);
if (pdev == NULL)
return -ENODEV;
platform_driver_register(&memconsole_driver);
return 0;
}
module_init(platform_memconsole_init);
|
#ifndef HEADER_CURL_TOOL_HUGEHELP_H
#define HEADER_CURL_TOOL_HUGEHELP_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
void hugehelp(void);
#endif /* HEADER_CURL_TOOL_HUGEHELP_H */
|
/* Test for ftw function searching in root directory.
Copyright (C) 2001-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 2001.
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 <ftw.h>
#include <mcheck.h>
#include <stdio.h>
#include <string.h>
int result;
int cnt;
int sawroot;
static int
callback (const char *fname, const struct stat *st, int flag)
{
if (++cnt >= 10)
return 1;
printf ("%d: \"%s\" -> ", cnt, fname);
if (strcmp (fname, "/") == 0 && sawroot)
{
puts ("root directory reported twice");
result = 1;
}
else if (fname[0] != '/')
{
puts ("missing '/' as first character");
result = 1;
}
else if (fname[1] == '/')
{
puts ("double '/' at beginning");
result = 1;
}
else
{
puts ("OK");
sawroot |= strcmp (fname, "/") == 0;
}
return 0;
}
int
main (void)
{
mtrace ();
ftw ("/", callback, 10);
if (! sawroot)
{
puts ("root directory wasn't reported");
result = 1;
}
return result;
}
|
/**********************************************************************
*<
FILE: gencamera.h
DESCRIPTION: Defines General-Purpose cameras
CREATED BY: Tom Hudson
HISTORY: created 5 December 1995
*> Copyright (c) 1995, All Rights Reserved.
**********************************************************************/
#ifndef __GENCAM__H__
#define __GENCAM__H__
// Camera types
#define FREE_CAMERA 0
#define TARGETED_CAMERA 1
#define PARALLEL_CAMERA 2
#define NUM_CAM_TYPES 2
class GenCamera: public CameraObject {
public:
virtual GenCamera *NewCamera(int type)=0;
virtual void SetConeState(int s)=0;
virtual int GetConeState()=0;
virtual void SetHorzLineState(int s)=0;
virtual int GetHorzLineState()=0;
virtual void Enable(int enab)=0;
virtual BOOL SetFOVControl(Control *c)=0;
virtual void SetFOVType(int ft)=0;
virtual int GetFOVType()=0;
virtual Control *GetFOVControl()=0;
virtual int Type()=0;
virtual void SetType(int tp)=0;
virtual void SetDOFEnable(TimeValue t, BOOL onOff) {}
virtual BOOL GetDOFEnable(TimeValue t, Interval& valid = Interval(0,0)) { return 0; }
virtual void SetDOFFStop(TimeValue t, float fs) {}
virtual float GetDOFFStop(TimeValue t, Interval& valid = Interval(0,0)) { return 1.0f; }
};
#endif // __GENCAM__H__
|
/* c55plus - LGPL - Copyright 2013 - th0rpe */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "utils.h"
static char hex_str[] = "01234567890abcdef";
st8 *strcat_dup(st8 *s1, st8 *s2, st32 n_free)
{
st8 *res;
ut32 len_s1, len_s2;
if(s1 != NULL)
len_s1 = strlen(s1);
else
len_s1 = 0;
if(s2 != NULL)
len_s2 = strlen(s2);
else
len_s2 = 0;
res = (char *)malloc(len_s1 + len_s2 + 1);
if(!res)
return NULL;
if(len_s1 > 0)
memcpy(res, s1, len_s1);
if(len_s2 > 0)
memcpy(res + len_s1, s2, len_s2);
res[len_s1 + len_s2] = '\0';
if(n_free == 1) {
if(s1 != NULL)
free(s1);
} else if(n_free == 2) {
if(s2 != NULL)
free(s2);
} else if(n_free == 3) {
if(s1 != NULL)
free(s1);
if(s2 != NULL)
free(s2);
}
return res;
}
st8 *get_hex_str(ut32 hex_num)
{
st8 aux[3];
aux[2] = '\0';
aux[1] = hex_str[hex_num & 0xF];
aux[0] = hex_str[(hex_num >> 4) & 0xF];
return strdup(aux);
}
|
/*
* Copyright (C) 2018 Gunar Schorcht
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*
* FreeRTOS to RIOT-OS adaption module for source code compatibility
*/
#ifndef DOXYGEN
#define ENABLE_DEBUG (0)
#include "debug.h"
#include <string.h>
#include "esp_common.h"
#include "log.h"
#include "freertos/FreeRTOS.h"
uint32_t xPortGetTickRateHz(void) {
return MSEC_PER_SEC / portTICK_PERIOD_MS;
}
BaseType_t xPortInIsrContext(void)
{
/* is working on single core in that way */
return irq_is_in();
}
#endif /* DOXYGEN */
|
/* QuesoGLC
* A free implementation of the OpenGL Character Renderer (GLC)
* Copyright (c) 2002, 2004-2008, Bertrand Coconnier
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* $Id$ */
/** \file
* header of the object __GLCglyph which caches all the data needed for a given
* glyph : display list, texture, bounding box, advance, index in the font
* file, etc.
*/
#ifndef __glc_oglyph_h
#define __glc_oglyph_h
typedef struct __GLCglyphRec __GLCglyph;
typedef struct __GLCatlasElementRec __GLCatlasElement;
typedef struct __GLCgeomBatchRec __GLCgeomBatch;
struct __GLCglyphRec {
FT_ListNodeRec node;
GLCulong index;
GLCulong codepoint;
/* GL objects management */
__GLCatlasElement* textureObject;
GLuint glObject[4];
GLint nContour;
GLint* contours;
GLint nGeomBatch;
__GLCgeomBatch* geomBatches;
/* Measurement infos */
GLfloat boundingBox[4];
GLfloat advance[2];
GLboolean advanceCached;
GLboolean boundingBoxCached;
GLboolean isSpacingChar;
};
__GLCglyph* __glcGlyphCreate(const GLCulong inIndex, const GLCulong inCode);
void __glcGlyphDestroy(__GLCglyph* This, __GLCcontext* inContext);
void __glcGlyphDestroyTexture(__GLCglyph* This, const __GLCcontext* inContext);
void __glcGlyphDestroyGLObjects(__GLCglyph* This, __GLCcontext* inContext);
int __glcGlyphGetDisplayListCount(const __GLCglyph* This);
GLuint __glcGlyphGetDisplayList(const __GLCglyph* This, const int inCount);
int __glcGlyphGetBufferObjectCount(const __GLCglyph* This);
GLuint __glcGlyphGetBufferObject(const __GLCglyph* This, const int inCount);
#endif
|
/* QuesoGLC
* A free implementation of the OpenGL Character Renderer (GLC)
* Copyright (c) 2002, 2004-2009, Bertrand Coconnier
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* $Id$ */
/** \file
* header of the object __GLCfont which manage the fonts
*/
#ifndef __glc_ofont_h
#define __glc_ofont_h
#include "ofacedesc.h"
/* It seems that Visual C++ does not recognize the inline keyword !?! */
#ifdef _MSC_VER
#define inline
#endif
struct __GLCfontRec {
GLint id;
__GLCfaceDescriptor* faceDesc;
GLint parentMasterID;
__GLCcharMap* charMap;
GLfloat maxMetric[6];
GLboolean maxMetricCached;
};
__GLCfont* __glcFontCreate(GLint id, __GLCmaster* inMaster,
__GLCcontext* inContext, GLint inCode);
void __glcFontDestroy(__GLCfont *This, __GLCcontext* inContext);
__GLCglyph* __glcFontGetGlyph(const __GLCfont *This, const GLint inCode,
const __GLCcontext* inContext);
GLfloat* __glcFontGetBoundingBox(const __GLCfont *This, const GLint inCode,
GLfloat* outVec, const __GLCcontext* inContext,
const GLfloat inScaleX,
const GLfloat inScaleY);
GLfloat* __glcFontGetAdvance(const __GLCfont *This, const GLint inCode,
GLfloat* outVec, const __GLCcontext* inContext,
const GLfloat inScaleX, const GLfloat inScaleY);
GLfloat* __glcFontGetKerning(const __GLCfont* This, const GLint inCode,
const GLint inPrevCode, GLfloat* outVec,
const __GLCcontext* inContext,
const GLfloat inScaleX, const GLfloat inScaleY);
GLboolean __glcFontPrepareGlyph(const __GLCfont* This,
const __GLCcontext* inContext,
const GLfloat inScaleX, const GLfloat inScaleY,
const GLCulong inGlyphIndex);
GLfloat* __glcFontGetMaxMetric(__GLCfont* This, GLfloat* outVec,
const __GLCcontext* inContext,
const GLfloat inScaleX, const GLfloat inScaleY);
/* Inline functions definitions */
#ifndef GLC_FT_CACHE
/* Open the font file */
static inline void* __glcFontOpen(__GLCfont* This, __GLCcontext* inContext)
{
return __glcFaceDescOpen(This->faceDesc, inContext);
}
/* Close the font file */
static inline void __glcFontClose(__GLCfont* This)
{
__glcFaceDescClose(This->faceDesc);
}
#endif
/* Get the size of the bitmap in which the glyph will be rendered */
static inline GLboolean __glcFontGetBitmapSize(const __GLCfont* This,
GLint* outWidth,
GLint* outHeight,
const GLfloat inScaleX,
const GLfloat inScaleY,
const int inFactor,
GLint* outPixBoundingBox,
const __GLCcontext* inContext)
{
return __glcFaceDescGetBitmapSize(This->faceDesc, outWidth, outHeight,
inScaleX, inScaleY, outPixBoundingBox,
inFactor, inContext);
}
/* Decompose the outline of a glyph */
static inline GLboolean __glcFontOutlineDecompose(const __GLCfont* This,
__GLCrendererData* inData,
const __GLCcontext* inContext)
{
return __glcFaceDescOutlineDecompose(This->faceDesc, inData, inContext);
}
/* Render the glyph in a bitmap */
static inline GLboolean __glcFontGetBitmap(const __GLCfont* This,
const GLint inWidth,
const GLint inHeight,
const void* inBuffer,
const __GLCcontext* inContext)
{
return __glcFaceDescGetBitmap(This->faceDesc, inWidth, inHeight, inBuffer,
inContext);
}
/* Chek if the outline of the glyph is empty (which means it is a spacing
* character).
*/
static inline GLboolean __glcFontOutlineEmpty(const __GLCfont* This)
{
return __glcFaceDescOutlineEmpty(This->faceDesc);
}
static inline GLboolean __glcFontHasChar(const __GLCfont* This,
const GLint inCode)
{
return __glcCharMapHasChar(This->charMap, inCode);
}
#endif /* __glc_ofont_h */
|
/*
* Connection for GPIB-serial manufactured by Prologix.biz
* Copyright (C) 2012 Petr Kubanek, Institute of Physics <kubanek@fzu.cz>
*
* 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.
*/
#ifndef __RTS2_CONN_GPIB_PROLOGIX__
#define __RTS2_CONN_GPIB_PROLOGIX__
#include "connection/conngpib.h"
#include "block.h"
#include "connection/serial.h"
namespace rts2core
{
/**
* Prologix GPIB-USB convertor.
*
* Manual at http://prologix.biz/getfile?attachment_id=2
*
* @author Petr Kubanek <kubanek@fzu.cz>
*/
class ConnGpibPrologix:public ConnGpib, rts2core::ConnSerial
{
public:
ConnGpibPrologix (rts2core::Block *_master, const char *_device, int _pad);
virtual ~ ConnGpibPrologix (void);
virtual void setDebug (bool _debug = true) { rts2core::ConnSerial::setDebug (_debug); }
virtual void initGpib ();
virtual void gpibWriteBuffer (const char *cmd, int _len);
virtual void gpibRead (void *cmd, int &blen);
virtual void gpibWriteRead (const char *cmd, char *reply, int blen);
virtual void gpibWaitSRQ ();
virtual void devClear ();
virtual float gettmo () { return timeout; };
virtual void settmo (float _sec);
/**
* Sets EOT flag - whenever end characters are send.
*/
void setEot (int _eot)
{
eot = _eot;
}
private:
void readUSBGpib (char *reply, int blen);
int pad;
int eot;
int eos;
float timeout;
uint16_t len;
};
};
#endif /* !__RTS2_CONN_GPIB_PROLOGIX__ */
|
/*
* Copyright 2013 MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <stdio.h>
#include <stdarg.h>
#include "bson-compat.h"
#include "bson-config.h"
#include "bson-error.h"
#include "bson-memory.h"
#include "bson-string.h"
#include "bson-types.h"
/*
*--------------------------------------------------------------------------
*
* bson_set_error --
*
* Initializes @error using the parameters specified.
*
* @domain is an application specific error domain which should
* describe which module initiated the error. Think of this as the
* exception type.
*
* @code is the @domain specific error code.
*
* @format is used to generate the format string. It uses vsnprintf()
* internally so the format should match what you would use there.
*
* Parameters:
* @error: A #bson_error_t.
* @domain: The error domain.
* @code: The error code.
* @format: A printf style format string.
*
* Returns:
* None.
*
* Side effects:
* @error is initialized.
*
*--------------------------------------------------------------------------
*/
void
bson_set_error (bson_error_t *error, /* OUT */
uint32_t domain, /* IN */
uint32_t code, /* IN */
const char *format, /* IN */
...) /* IN */
{
va_list args;
if (error) {
error->domain = domain;
error->code = code;
va_start (args, format);
bson_vsnprintf (error->message, sizeof error->message, format, args);
va_end (args);
error->message[sizeof error->message - 1] = '\0';
}
}
/*
*--------------------------------------------------------------------------
*
* bson_strerror_r --
*
* This is a reentrant safe macro for strerror.
*
* The resulting string is stored in @buf and @buf is returned.
*
* Returns:
* A pointer to a static string or @buf.
*
* Side effects:
* None.
*
*--------------------------------------------------------------------------
*/
char *
bson_strerror_r (int err_code, /* IN */
char *buf, /* IN */
size_t buflen) /* IN */
{
static const char *unknown_msg = "Unknown error";
char *ret = NULL;
#if defined(__GNUC__) && defined(_GNU_SOURCE)
ret = strerror_r (err_code, buf, buflen);
#elif defined(_WIN32)
if (strerror_s (buf, buflen, err_code) != 0) {
ret = buf;
}
#else /* XSI strerror_r */
if (strerror_r (err_code, buf, buflen) != 0) {
ret = buf;
}
#endif
if (!ret) {
memcpy (buf, unknown_msg, MIN (buflen, strlen (unknown_msg)));
buf [buflen - 1] = '\0';
ret = buf;
}
return buf;
}
|
//
// CBLDatabase+Replication.h
// CouchbaseLite
//
// Created by Jens Alfke on 1/18/12.
// Copyright (c) 2012-2013 Couchbase, Inc. All rights reserved.
//
#import "CBL_Revision.h"
@class CBL_Replicator;
@interface CBLDatabase (Replication)
@property (readonly) NSArray* activeReplicators;
- (CBL_Replicator*) activeReplicatorLike: (CBL_Replicator*)repl;
- (void) addActiveReplicator: (CBL_Replicator*)repl;
- (BOOL) findMissingRevisions: (CBL_RevisionList*)revs;
@end
|
//
// NSDate+ActionValue.h
// CoreSalesforce
//
// Created by Michael Nachbaur on 12/8/14.
// Copyright (c) 2014 Salesforce.com. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "CSFActionValue.h"
@interface NSDate (ActionValue) <CSFActionValue>
@end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.