text stringlengths 4 6.14k |
|---|
/**
* \file
* <!--
* This file is part of BeRTOS.
*
* Bertos is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* As a special exception, you may use this file as part of a free software
* library without restriction. Specifically, if other files instantiate
* templates or use macros or inline functions from this file, or you compile
* this file and link it with other files to produce an executable, this
* file does not by itself cause the resulting executable to be covered by
* the GNU General Public License. This exception does not however
* invalidate any other reasons why the executable file might be covered by
* the GNU General Public License.
*
* Copyright 2005 Develer S.r.l. (http://www.develer.com/)
* -->
*
* \brief Edit bool widget (interface).
*
* \author Francesco Sacchi <batt@develer.com>
*/
#ifndef DT_EDITBOOL_H
#define DT_EDITBOOL_H
#include <dt/dwidget.h>
#include <dt/dtag.h>
typedef struct DEditBool
{
DWidget widget;
bool *value;
const char *true_string;
const char *false_string;
void (*draw)(struct DEditBool *);
} DEditBool;
void editbool_init(DEditBool *e, dpos_t pos, dpos_t size, dcontext_t *context, bool *val, const char *true_str, const char *false_str);
void editbool_update(DEditBool *e, dtag_t tag, dval_t val);
void editbool_draw(DEditBool *e);
#endif /* DT_EDITBOOL_H */
|
// 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 NET_DNS_DNS_PROTOCOL_H_
#define NET_DNS_DNS_PROTOCOL_H_
#include "base/basictypes.h"
#include "net/base/net_export.h"
namespace net {
namespace dns_protocol {
static const uint16 kDefaultPort = 53;
// DNS packet consists of a header followed by questions and/or answers.
// For the meaning of specific fields, please see RFC 1035 and 2535
// Header format.
// 1 1 1 1 1 1
// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
// | ID |
// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
// |QR| Opcode |AA|TC|RD|RA| Z|AD|CD| RCODE |
// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
// | QDCOUNT |
// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
// | ANCOUNT |
// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
// | NSCOUNT |
// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
// | ARCOUNT |
// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
// Question format.
// 1 1 1 1 1 1
// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
// | |
// / QNAME /
// / /
// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
// | QTYPE |
// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
// | QCLASS |
// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
// Answer format.
// 1 1 1 1 1 1
// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
// | |
// / /
// / NAME /
// | |
// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
// | TYPE |
// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
// | CLASS |
// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
// | TTL |
// | |
// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
// | RDLENGTH |
// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
// / RDATA /
// / /
// +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
#pragma pack(push)
#pragma pack(1)
// On-the-wire header. All uint16 are in network order.
// Used internally in DnsQuery and DnsResponseParser.
struct NET_EXPORT_PRIVATE Header {
uint16 id;
uint16 flags;
uint16 qdcount;
uint16 ancount;
uint16 nscount;
uint16 arcount;
};
#pragma pack(pop)
static const uint8 kLabelMask = 0xc0;
static const uint8 kLabelPointer = 0xc0;
static const uint8 kLabelDirect = 0x0;
static const uint16 kOffsetMask = 0x3fff;
static const int kMaxNameLength = 255;
// RFC 1035, section 4.2.1: Messages carried by UDP are restricted to 512
// bytes (not counting the IP nor UDP headers).
static const int kMaxUDPSize = 512;
// DNS class types.
static const uint16 kClassIN = 1;
// DNS resource record types. See
// http://www.iana.org/assignments/dns-parameters
static const uint16 kTypeA = 1;
static const uint16 kTypeCNAME = 5;
static const uint16 kTypeTXT = 16;
static const uint16 kTypeAAAA = 28;
// DNS rcode values.
static const uint8 kRcodeMask = 0xf;
static const uint8 kRcodeNOERROR = 0;
static const uint8 kRcodeFORMERR = 1;
static const uint8 kRcodeSERVFAIL = 2;
static const uint8 kRcodeNXDOMAIN = 3;
static const uint8 kRcodeNOTIMP = 4;
static const uint8 kRcodeREFUSED = 5;
// DNS flags.
static const uint16 kFlagResponse = 0x8000;
static const uint16 kFlagRA = 0x80;
static const uint16 kFlagRD = 0x100;
static const uint16 kFlagTC = 0x200;
static const uint16 kFlagAA = 0x400;
} // namespace dns_protocol
} // namespace net
#endif // NET_DNS_DNS_PROTOCOL_H_
|
/*
* Copyright 2013 Google, Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkRTConf_DEFINED
#define SkRTConf_DEFINED
#include "../private/SkTDArray.h"
#include "../private/SkTDict.h"
#include "SkString.h"
#include "SkStream.h"
/** \class SkRTConfBase
Non-templated base class for the runtime configs
*/
class SkRTConfBase {
public:
SkRTConfBase(const char *name) : fName(name) {}
virtual ~SkRTConfBase() {}
virtual const char *getName() const { return fName.c_str(); }
virtual bool isDefault() const = 0;
virtual void print(SkWStream *o) const = 0;
virtual bool equals(const SkRTConfBase *conf) const = 0;
protected:
SkString fName;
};
/** \class SkRTConf
A class to provide runtime configurability.
*/
template<typename T> class SkRTConf: public SkRTConfBase {
public:
SkRTConf(const char *name, const T &defaultValue, const char *description);
operator const T&() const { return fValue; }
void print(SkWStream *o) const;
bool equals(const SkRTConfBase *conf) const;
bool isDefault() const { return fDefault == fValue; }
void set(const T& value) { fValue = value; }
protected:
void doPrint(char *s) const;
T fValue;
T fDefault;
SkString fDescription;
};
#ifdef SK_DEVELOPER
#define SK_CONF_DECLARE(confType, varName, confName, defaultValue, description) static SkRTConf<confType> varName(confName, defaultValue, description)
#define SK_CONF_SET(confname, value) \
skRTConfRegistry().set(confname, value, true)
/* SK_CONF_TRY_SET() is like SK_CONF_SET(), but doesn't complain if
confname can't be found. This is useful if the SK_CONF_DECLARE is
inside a source file whose linkage is dependent on the system. */
#define SK_CONF_TRY_SET(confname, value) \
skRTConfRegistry().set(confname, value, false)
#else
#define SK_CONF_DECLARE(confType, varName, confName, defaultValue, description) static confType varName = defaultValue
#define SK_CONF_SET(confname, value) (void) confname, (void) value
#define SK_CONF_TRY_SET(confname, value) (void) confname, (void) value
#endif
/** \class SkRTConfRegistry
A class that maintains a systemwide registry of all runtime configuration
parameters. Mainly used for printing them out and handling multiply-defined
knobs.
*/
class SkRTConfRegistry {
public:
SkRTConfRegistry();
~SkRTConfRegistry();
void printAll(const char *fname = NULL) const;
bool hasNonDefault() const;
void printNonDefault(const char *fname = NULL) const;
const char *configFileLocation() const;
void possiblyDumpFile() const;
void validate() const;
template <typename T> void set(const char *confname,
T value,
bool warnIfNotFound = true);
private:
template<typename T> friend class SkRTConf;
void registerConf(SkRTConfBase *conf);
template <typename T> bool parse(const char *name, T* value);
SkTDArray<SkString *> fConfigFileKeys, fConfigFileValues;
typedef SkTDict< SkTDArray<SkRTConfBase *> * > ConfMap;
ConfMap fConfs;
template <typename T>
friend bool test_rt_conf_parse(SkRTConfRegistry*, const char* name, T* value);
};
// our singleton registry
SkRTConfRegistry &skRTConfRegistry();
template<typename T>
SkRTConf<T>::SkRTConf(const char *name, const T &defaultValue, const char *description)
: SkRTConfBase(name)
, fValue(defaultValue)
, fDefault(defaultValue)
, fDescription(description) {
T value;
if (skRTConfRegistry().parse(fName.c_str(), &value)) {
fValue = value;
}
skRTConfRegistry().registerConf(this);
}
template<typename T>
void SkRTConf<T>::print(SkWStream *o) const {
char outline[200]; // should be ok because we specify a max. width for everything here.
char *outptr;
if (strlen(getName()) >= 30) {
o->writeText(getName());
o->writeText(" ");
outptr = &(outline[0]);
} else {
sprintf(outline, "%-30.30s", getName());
outptr = &(outline[30]);
}
doPrint(outptr);
sprintf(outptr+30, " %.128s", fDescription.c_str());
for (size_t i = strlen(outline); i --> 0 && ' ' == outline[i];) {
outline[i] = '\0';
}
o->writeText(outline);
}
template<typename T>
void SkRTConf<T>::doPrint(char *s) const {
sprintf(s, "%-30.30s", "How do I print myself??");
}
template<> inline void SkRTConf<bool>::doPrint(char *s) const {
char tmp[30];
sprintf(tmp, "%s # [%s]", fValue ? "true" : "false", fDefault ? "true" : "false");
sprintf(s, "%-30.30s", tmp);
}
template<> inline void SkRTConf<int>::doPrint(char *s) const {
char tmp[30];
sprintf(tmp, "%d # [%d]", fValue, fDefault);
sprintf(s, "%-30.30s", tmp);
}
template<> inline void SkRTConf<unsigned int>::doPrint(char *s) const {
char tmp[30];
sprintf(tmp, "%u # [%u]", fValue, fDefault);
sprintf(s, "%-30.30s", tmp);
}
template<> inline void SkRTConf<float>::doPrint(char *s) const {
char tmp[30];
sprintf(tmp, "%6.6f # [%6.6f]", fValue, fDefault);
sprintf(s, "%-30.30s", tmp);
}
template<> inline void SkRTConf<double>::doPrint(char *s) const {
char tmp[30];
sprintf(tmp, "%6.6f # [%6.6f]", fValue, fDefault);
sprintf(s, "%-30.30s", tmp);
}
template<> inline void SkRTConf<const char *>::doPrint(char *s) const {
char tmp[30];
sprintf(tmp, "%s # [%s]", fValue, fDefault);
sprintf(s, "%-30.30s", tmp);
}
template<typename T>
bool SkRTConf<T>::equals(const SkRTConfBase *conf) const {
// static_cast here is okay because there's only one kind of child class.
const SkRTConf<T> *child_pointer = static_cast<const SkRTConf<T> *>(conf);
return child_pointer &&
fName == child_pointer->fName &&
fDescription == child_pointer->fDescription &&
fValue == child_pointer->fValue &&
fDefault == child_pointer->fDefault;
}
#endif
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import <Cocoa/Cocoa.h>
#include <memory>
#import "chrome/browser/ui/cocoa/chrome_event_processing_window.h"
class AppNotificationBridge;
namespace info_bubble {
enum AnimationMask {
kAnimateNone = 0,
kAnimateOrderIn = 1 << 1,
kAnimateOrderOut = 1 << 2,
};
typedef NSUInteger AllowedAnimations;
} // namespace info_bubble
// A rounded window with an arrow used for example when you click on the STAR
// button or that pops up within our first-run UI.
@interface InfoBubbleWindow : ChromeEventProcessingWindow {
@private
// Is self in the process of closing.
BOOL closing_;
// Specifies if window order in and order out animations are allowed. By
// default both types of animations are allowed.
info_bubble::AllowedAnimations allowedAnimations_;
// If NO the window will never become key.
// Default YES.
BOOL infoBubbleCanBecomeKeyWindow_;
// If NO the window will not share key state with its parent. Defaults to YES.
// Can be set both by external callers, but is also changed internally, in
// response to resignKeyWindow and becomeKeyWindow events.
BOOL allowShareParentKeyState_;
// Bridge to proxy Chrome notifications to the window.
std::unique_ptr<AppNotificationBridge> notificationBridge_;
}
@property(nonatomic) info_bubble::AllowedAnimations allowedAnimations;
@property(nonatomic) BOOL infoBubbleCanBecomeKeyWindow;
@property(nonatomic) BOOL allowShareParentKeyState;
// Superclass override.
- (BOOL)canBecomeKeyWindow;
// Returns YES if the window is in the process of closing.
// Can't use "windowWillClose" notification because that will be sent
// after the closing animation has completed.
- (BOOL)isClosing;
@end
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_INVALIDATION_IMPL_UNACKED_INVALIDATION_SET_H_
#define COMPONENTS_INVALIDATION_IMPL_UNACKED_INVALIDATION_SET_H_
#include <stddef.h>
#include <memory>
#include <set>
#include "base/memory/weak_ptr.h"
#include "base/single_thread_task_runner.h"
#include "components/invalidation/public/invalidation.h"
#include "components/invalidation/public/invalidation_export.h"
#include "components/invalidation/public/invalidation_util.h"
namespace base {
class DictionaryValue;
} // namespace base
namespace syncer {
namespace test_util {
class UnackedInvalidationSetEqMatcher;
} // test_util
class SingleObjectInvalidationSet;
class ObjectIdInvalidationMap;
class AckHandle;
class UnackedInvalidationSet;
using UnackedInvalidationsMap =
std::map<invalidation::ObjectId, UnackedInvalidationSet, ObjectIdLessThan>;
// Manages the set of invalidations that are awaiting local acknowledgement for
// a particular ObjectId. This set of invalidations will be persisted across
// restarts, though this class is not directly responsible for that.
class INVALIDATION_EXPORT UnackedInvalidationSet {
public:
static const size_t kMaxBufferedInvalidations;
UnackedInvalidationSet(invalidation::ObjectId id);
UnackedInvalidationSet(const UnackedInvalidationSet& other);
~UnackedInvalidationSet();
// Returns the ObjectID of the invalidations this class is tracking.
const invalidation::ObjectId& object_id() const;
// Adds a new invalidation to the set awaiting acknowledgement.
void Add(const Invalidation& invalidation);
// Adds many new invalidations to the set awaiting acknowledgement.
void AddSet(const SingleObjectInvalidationSet& invalidations);
// Exports the set of invalidations awaiting acknowledgement as an
// ObjectIdInvalidationMap. Each of these invalidations will be associated
// with the given |ack_handler|.
//
// The contents of the UnackedInvalidationSet are not directly modified by
// this procedure, but the AckHandles stored in those exported invalidations
// are likely to end up back here in calls to Acknowledge() or Drop().
void ExportInvalidations(
base::WeakPtr<AckHandler> ack_handler,
scoped_refptr<base::SingleThreadTaskRunner> ack_handler_task_runner,
ObjectIdInvalidationMap* out) const;
// Removes all stored invalidations from this object.
void Clear();
// Indicates that a handler has registered to handle these invalidations.
//
// Registrations with the invalidations server persist across restarts, but
// registrations from InvalidationHandlers to the InvalidationService are not.
// In the time immediately after a restart, it's possible that the server
// will send us invalidations, and we won't have a handler to send them to.
//
// The SetIsRegistered() call indicates that this period has come to an end.
// There is now a handler that can receive these invalidations. Once this
// function has been called, the kMaxBufferedInvalidations limit will be
// ignored. It is assumed that the handler will manage its own buffer size.
void SetHandlerIsRegistered();
// Indicates that the handler has now unregistered itself.
//
// This causes the object to resume enforcement of the
// kMaxBufferedInvalidations limit.
void SetHandlerIsUnregistered();
// Given an AckHandle belonging to one of the contained invalidations, finds
// the invalidation and drops it from the list. It is considered to be
// acknowledged, so there is no need to continue maintaining its state.
void Acknowledge(const AckHandle& handle);
// Given an AckHandle belonging to one of the contained invalidations, finds
// the invalidation, drops it from the list, and adds additional state to
// indicate that this invalidation has been lost without being acted on.
void Drop(const AckHandle& handle);
// Deserializes the given |dict| as an UnackedInvalidationSet and inserts the
// pair into |map| using the ObjectId as the key. Returns false if the
// deserialization fails.
static bool DeserializeSetIntoMap(const base::DictionaryValue& dict,
syncer::UnackedInvalidationsMap* map);
std::unique_ptr<base::DictionaryValue> ToValue() const;
bool ResetFromValue(const base::DictionaryValue& value);
private:
// Allow this test helper to have access to our internals.
friend class test_util::UnackedInvalidationSetEqMatcher;
typedef std::set<Invalidation, InvalidationVersionLessThan> InvalidationsSet;
bool ResetListFromValue(const base::ListValue& value);
// Limits the list size to the given maximum. This function will correctly
// update this class' internal data to indicate if invalidations have been
// dropped.
void Truncate(size_t max_size);
bool registered_;
invalidation::ObjectId object_id_;
InvalidationsSet invalidations_;
};
} // namespace syncer
#endif // COMPONENTS_INVALIDATION_IMPL_UNACKED_INVALIDATION_SET_H_
|
/////////////////////////////////////////////////////////////////////////////
// Name: funcmacro_misc.h
// Purpose: Miscellaneous function and macro group docs
// Author: wxWidgets team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
/**
@defgroup group_funcmacro_misc Miscellaneous
@ingroup group_funcmacro
Group of miscellaneous functions and macros.
Related class group: @ref group_class_misc
*/
|
// Copyright (c) 2015, Baidu.com, Inc. All Rights Reserved
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. See the AUTHORS file for names of contributors.
//
// File names used by DB code
#ifndef STORAGE_LEVELDB_DB_FILENAME_H_
#define STORAGE_LEVELDB_DB_FILENAME_H_
#include <stdint.h>
#include <string>
#include "leveldb/slice.h"
#include "leveldb/status.h"
#include "port/port.h"
#include "util/logging.h"
namespace leveldb {
class Env;
enum FileType {
kUnknown,
kLogFile,
kDBLockFile,
kTableFile,
kDescriptorFile,
kCurrentFile,
kTempFile,
kInfoLogFile // Either the current one, or an old one
};
// Return the name of the log file with the specified number
// in the db named by "dbname". The result will be prefixed with
// "dbname".
extern std::string LogFileName(const std::string& dbname, uint64_t number);
// for qinan
extern std::string LogHexFileName(const std::string& dbname, uint64_t number);
// Return the name of the sstable with the specified number
// in the db named by "dbname". The result will be prefixed with
// "dbname".
extern std::string TableFileName(const std::string& dbname, uint64_t number);
// Return the name of the descriptor file for the db named by
// "dbname" and the specified incarnation number. The result will be
// prefixed with "dbname".
extern std::string DescriptorFileName(const std::string& dbname,
uint64_t number);
// Return the name of the current file. This file contains the name
// of the current manifest file. The result will be prefixed with
// "dbname".
extern std::string CurrentFileName(const std::string& dbname);
// Return the name of the lock file for the db named by
// "dbname". The result will be prefixed with "dbname".
extern std::string LockFileName(const std::string& dbname);
// Return the name of a temporary file owned by the db named "dbname".
// The result will be prefixed with "dbname".
extern std::string TempFileName(const std::string& dbname, uint64_t number);
// Return the name of the info log file for "dbname".
extern std::string InfoLogFileName(const std::string& dbname);
// Return the name of the old info log file for "dbname".
extern std::string OldInfoLogFileName(const std::string& dbname);
// If filename is a leveldb file, store the type of the file in *type.
// The number encoded in the filename is stored in *number. If the
// filename was successfully parsed, returns true. Else return false.
extern bool ParseFileName(const std::string& filename,
uint64_t* number,
FileType* type);
// Make the CURRENT file point to the descriptor file with the
// specified number.
extern Status SetCurrentFile(Env* env, const std::string& dbname,
uint64_t descriptor_number);
const char* FileTypeToString(FileType type);
// build a full path file number from dbname&filenumber, format:
// |--tabletnum(4B)--|--filenum(4B)--|
// tabletnum = 0x80000000|real_tablet_num
extern uint64_t BuildFullFileNumber(const std::string& dbname,
uint64_t number);
// Build file path from lg_num & full file number
// E.g. construct "/table1/tablet000003/0/00000001.sst"
// from (/table1, 0, 0x8000000300000001)
std::string BuildTableFilePath(const std::string& prefix,
uint64_t lg, uint64_t number);
// Parse a db_impl name to prefix, tablet number, lg number...
// db_impl name format maybe:
// /.../tablename/tablet000012/2 (have tablet name, allow split)
// or /.../tablename/2 (have none tablet name, donot allow split)
bool ParseDbName(const std::string& dbname, std::string* prefix,
uint64_t* tablet, uint64_t* lg);
// Parse a full file number to tablet number & file number
bool ParseFullFileNumber(uint64_t full_number, uint64_t* tablet, uint64_t* file);
// Construct a db_impl name from a cur-db_impl name and a tablet number.
// E.g. construct "/table1/tablet000003/0" from (/table1/tablet000001/0, 3)
std::string RealDbName(const std::string& dbname, uint64_t tablet);
// Construct a db_table name from a cur-db_table name and a tablet number.
// E.g. construct "/table1/tablet000003" from (/table1/tablet000001, 3)
std::string GetChildTabletPath(const std::string& parent_path, uint64_t tablet);
// Construct a db_table name from a table name and a tablet number.
// E.g. construct "/table1/tablet000003" from (/table1, 3)
std::string GetTabletPathFromNum(const std::string& tablename, uint64_t tablet);
// Parse tablet number from a db_table name.
// E.g. get 3 from "table1/tablet000003"
uint64_t GetTabletNumFromPath(const std::string& tabletpath);
// Check if this table file is inherited.
bool IsTableFileInherited(uint64_t tablet, uint64_t number);
std::string FileNumberDebugString(uint64_t full_number);
} // namespace leveldb
#endif // STORAGE_LEVELDB_DB_FILENAME_H_
|
/* Area: ffi_call, closure_call
Purpose: Check structure passing with different structure size.
Contains structs as parameter of the struct itself.
Sample taken from Alan Modras patch to src/prep_cif.c.
Limitations: none.
PR: none.
Originator: <andreast@gcc.gnu.org> 20051010 */
/* { dg-do run { xfail mips64*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */
#include "ffitest.h"
typedef struct A {
unsigned long long a;
unsigned char b;
} A;
typedef struct B {
unsigned char y;
struct A x;
unsigned int z;
} B;
typedef struct C {
unsigned long long d;
unsigned char e;
} C;
static B B_fn(struct A b2, struct B b3, struct C b4)
{
struct B result;
result.x.a = b2.a + b3.x.a + b3.z + b4.d;
result.x.b = b2.b + b3.x.b + b3.y + b4.e;
result.y = b2.b + b3.x.b + b4.e;
printf("%d %d %d %d %d %d %d %d: %d %d %d\n", (int)b2.a, b2.b,
(int)b3.x.a, b3.x.b, b3.y, b3.z, (int)b4.d, b4.e,
(int)result.x.a, result.x.b, result.y);
return result;
}
static void
B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
void* userdata __UNUSED__)
{
struct A b0;
struct B b1;
struct C b2;
b0 = *(struct A*)(args[0]);
b1 = *(struct B*)(args[1]);
b2 = *(struct C*)(args[2]);
*(B*)resp = B_fn(b0, b1, b2);
}
int main (void)
{
ffi_cif cif;
#ifndef USING_MMAP
static ffi_closure cl;
#endif
ffi_closure *pcl;
void* args_dbl[4];
ffi_type* cls_struct_fields[3];
ffi_type* cls_struct_fields1[4];
ffi_type* cls_struct_fields2[3];
ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2;
ffi_type* dbl_arg_types[4];
#ifdef USING_MMAP
pcl = allocate_mmap (sizeof(ffi_closure));
#else
pcl = &cl;
#endif
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
cls_struct_type1.size = 0;
cls_struct_type1.alignment = 0;
cls_struct_type1.type = FFI_TYPE_STRUCT;
cls_struct_type1.elements = cls_struct_fields1;
cls_struct_type2.size = 0;
cls_struct_type2.alignment = 0;
cls_struct_type2.type = FFI_TYPE_STRUCT;
cls_struct_type2.elements = cls_struct_fields2;
struct A e_dbl = { 1LL, 7};
struct B f_dbl = { 99, {12LL , 127}, 255};
struct C g_dbl = { 2LL, 9};
struct B res_dbl;
cls_struct_fields[0] = &ffi_type_uint64;
cls_struct_fields[1] = &ffi_type_uchar;
cls_struct_fields[2] = NULL;
cls_struct_fields1[0] = &ffi_type_uchar;
cls_struct_fields1[1] = &cls_struct_type;
cls_struct_fields1[2] = &ffi_type_uint32;
cls_struct_fields1[3] = NULL;
cls_struct_fields2[0] = &ffi_type_uint64;
cls_struct_fields2[1] = &ffi_type_uchar;
cls_struct_fields2[2] = NULL;
dbl_arg_types[0] = &cls_struct_type;
dbl_arg_types[1] = &cls_struct_type1;
dbl_arg_types[2] = &cls_struct_type2;
dbl_arg_types[3] = NULL;
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, &cls_struct_type1,
dbl_arg_types) == FFI_OK);
args_dbl[0] = &e_dbl;
args_dbl[1] = &f_dbl;
args_dbl[2] = &g_dbl;
args_dbl[3] = NULL;
ffi_call(&cif, FFI_FN(B_fn), &res_dbl, args_dbl);
/* { dg-output "1 7 12 127 99 255 2 9: 270 242 143" } */
CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + f_dbl.z + g_dbl.d));
CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e));
CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e));
CHECK(ffi_prep_closure(pcl, &cif, B_gn, NULL) == FFI_OK);
res_dbl = ((B(*)(A, B, C))(pcl))(e_dbl, f_dbl, g_dbl);
/* { dg-output "\n1 7 12 127 99 255 2 9: 270 242 143" } */
CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + f_dbl.z + g_dbl.d));
CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e));
CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e));
exit(0);
}
|
/***************************************************************************
Copyright (c) 2013, The OpenBLAS Project
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 OpenBLAS project 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 OPENBLAS PROJECT 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 "common.h"
/*****************************************************
* 2015-09-07 grisuthedragon
*
******************************************************/
int CNAME(BLASLONG rows, BLASLONG cols, FLOAT alpha_r, FLOAT alpha_i, FLOAT *a, BLASLONG lda)
{
BLASLONG i,j,ia,ib;
FLOAT *aptr,*bptr;
FLOAT t0, t1;
if ( rows <= 0 ) return(0);
if ( cols <= 0 ) return(0);
aptr = a;
lda *= 2;
ib = 0;
for ( i=0; i<rows ; i++ )
{
/* Start on the diagonal */
bptr = &a[ib+i*lda];
ia = 2*i;
/* Diagonal Element */
t0 = bptr[0];
t1 = bptr[1];
bptr[0] = alpha_r * t0 + alpha_i * t1;
bptr[1] = - alpha_r * t1 + alpha_i * t0;
ia += 2;
bptr += lda;
for(j=i+1; j<cols; j++)
{
t0 = bptr[0];
t1 = bptr[1];
bptr[0] = alpha_r * aptr[ia] + alpha_i * aptr[ia+1];
bptr[1] = - alpha_r * aptr[ia+1] + alpha_i * aptr[ia];
aptr[ia] = alpha_r * t0 + alpha_i * t1;
aptr[ia+1] = - alpha_r * t1 + alpha_i * t0;
ia += 2;
bptr += lda;
}
aptr += lda;
ib += 2;
}
return(0);
}
|
// 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 PPAPI_SHARED_IMPL_HOST_RESOURCE_H_
#define PPAPI_SHARED_IMPL_HOST_RESOURCE_H_
#include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_resource.h"
#include "ppapi/shared_impl/ppapi_shared_export.h"
namespace ppapi {
// Represents a PP_Resource sent over the wire. This just wraps a PP_Resource.
// The point is to prevent mistakes where the wrong resource value is sent.
// Resource values are remapped in the plugin so that it can talk to multiple
// hosts. If all values were PP_Resource, it would be easy to forget to do
// this tranformation.
//
// All HostResources respresent IDs valid in the host.
class PPAPI_SHARED_EXPORT HostResource {
public:
HostResource() : instance_(0), host_resource_(0) {
}
bool is_null() const {
return !host_resource_;
}
// Some resources are plugin-side only and don't have a corresponding
// resource in the host. Yet these resources still need an instance to be
// associated with. This function creates a HostResource with the given
// instances and a 0 host resource ID for these cases.
static HostResource MakeInstanceOnly(PP_Instance instance) {
HostResource resource;
resource.SetHostResource(instance, 0);
return resource;
}
// Sets and retrieves the internal PP_Resource which is valid for the host
// (a.k.a. renderer, as opposed to the plugin) process.
//
// DO NOT CALL THESE FUNCTIONS IN THE PLUGIN SIDE OF THE PROXY. The values
// will be invalid. See the class comment above.
void SetHostResource(PP_Instance instance, PP_Resource resource) {
instance_ = instance;
host_resource_ = resource;
}
PP_Resource host_resource() const {
return host_resource_;
}
PP_Instance instance() const { return instance_; }
// This object is used in maps so we need to provide this sorting operator.
bool operator<(const HostResource& other) const {
if (instance_ != other.instance_)
return instance_ < other.instance_;
return host_resource_ < other.host_resource_;
}
private:
PP_Instance instance_;
PP_Resource host_resource_;
};
} // namespace ppapi
#endif // PPAPI_SHARED_IMPL_HOST_RESOURCE_H_
|
/*
* File : init.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2015, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2015-09-30 Bernard the first version
*/
#include <rtthread.h>
#include "init.h"
#ifdef RT_USING_FINSH
#include <finsh.h>
#include <shell.h>
#endif
#ifdef RT_USING_LWIP
#include <lwip/sys.h>
#include <netif/ethernetif.h>
extern void lwip_system_init(void);
#endif
#ifdef RT_USING_DFS
#include <dfs_init.h>
#include <dfs_fs.h>
#ifdef RT_USING_DFS_ELMFAT
#include <dfs_elm.h>
#endif
#if defined(RT_USING_LWIP) && defined(RT_USING_DFS_NFS)
#include <dfs_nfs.h>
#endif
#ifdef RT_USING_DFS_ROMFS
#include <dfs_romfs.h>
#endif
#ifdef RT_USING_DFS_DEVFS
#include <devfs.h>
#endif
#ifdef RT_USING_DFS_UFFS
#include <dfs_uffs.h>
#endif
#ifdef RT_USING_DFS_JFFS2
#include <dfs_jffs2.h>
#endif
#ifdef RT_USING_DFS_YAFFS2
#include <dfs_yaffs2.h>
#endif
#ifdef RT_USING_DFS_ROMFS
#include <dfs_romfs.h>
#endif
#endif
#ifdef RT_USING_NEWLIB
#include <libc.h>
#endif
#ifdef RT_USING_PTHREADS
#include <pthread.h>
#endif
#ifdef RT_USING_MODULE
#include <rtm.h>
#endif
#ifdef RT_USING_RTGUI
#include <rtgui/rtgui_system.h>
#endif
/* components initialization for simulator */
void components_init(void)
{
platform_init();
#ifdef RT_USING_MODULE
rt_system_module_init();
#endif
#ifdef RT_USING_FINSH
/* initialize finsh */
finsh_system_init();
finsh_set_device(RT_CONSOLE_DEVICE_NAME);
#endif
#ifdef RT_USING_LWIP
/* initialize lwip stack */
/* register ethernetif device */
eth_system_device_init();
/* initialize lwip system */
lwip_system_init();
rt_kprintf("TCP/IP initialized!\n");
#endif
#ifdef RT_USING_DFS
/* initialize the device file system */
dfs_init();
#ifdef RT_USING_DFS_ELMFAT
/* initialize the elm chan FatFS file system*/
elm_init();
#endif
#if defined(RT_USING_DFS_NFS) && defined(RT_USING_LWIP)
/* initialize NFSv3 client file system */
nfs_init();
#endif
#ifdef RT_USING_DFS_YAFFS2
dfs_yaffs2_init();
#endif
#ifdef RT_USING_DFS_UFFS
dfs_uffs_init();
#endif
#ifdef RT_USING_DFS_JFFS2
dfs_jffs2_init();
#endif
#ifdef RT_USING_DFS_ROMFS
dfs_romfs_init();
#endif
#ifdef RT_USING_DFS_RAMFS
dfs_ramfs_init();
#endif
#ifdef RT_USING_DFS_DEVFS
devfs_init();
#endif
#endif /* end of RT_USING_DFS */
#ifdef RT_USING_NEWLIB
libc_system_init(RT_CONSOLE_DEVICE_NAME);
#else
/* the pthread system initialization will be initiallized in libc */
#ifdef RT_USING_PTHREADS
pthread_system_init();
#endif
#endif
#ifdef RT_USING_RTGUI
rtgui_system_server_init();
#endif
#ifdef RT_USING_USB_HOST
rt_usb_host_init();
#endif
#ifdef RT_USING_RTGUI
/* start sdl thread to simulate an LCD. SDL may depend on DFS and should be
* called after rt_components_init. */
rt_hw_sdl_start();
#endif /* RT_USING_RTGUI */
}
|
/*
* Paparazzi $Id$
*
* Copyright (C) 2009-2010 The Paparazzi Team
*
* This file is part of paparazzi.
*
* paparazzi 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.
*
* paparazzi 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 paparazzi; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef RADIO_CONTROL_SPEKTRUM_H
#define RADIO_CONTROL_SPEKTRUM_H
/* implemented in arch/xxx/subsystems/radio_control/spektrum_arch.c */
extern void radio_control_spektrum_try_bind(void);
#include "subsystems/radio_control/spektrum_arch.h"
/* implemented in arch/xxx/subsystems/radio_control/spektrum_arch.c */
#define RadioControlEvent(_received_frame_handler) RadioControlEventImp(_received_frame_handler)
#endif /* RADIO_CONTROL_SPEKTRUM_H */
|
/* From MUSL */
#include <math.h>
/* uses LONG_MAX > 2^24, see comments in lrint.c */
long lrintf(float x)
{
return rintf(x);
}
|
#ifdef OS_ABL_SUPPORT
#include <linux/module.h>
#include "rt_config.h"
EXPORT_SYMBOL(RTMP_DRV_OPS_FUNCTION);
#endif /* OS_ABL_SUPPORT */
|
/*=========================================================================
Program: Visualization Toolkit
Module: vtkImageWeightedSum.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm 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 notice for more information.
=========================================================================*/
// .NAME vtkImageWeightedSum - adds any number of images, weighting
// each according to the weight set using this->SetWeights(i,w).
//
// .SECTION Description
// All weights are normalized so they will sum to 1.
// Images must have the same extents. Output is
//
// .SECTION Thanks
// The original author of this class is Lauren O'Donnell (MIT) for Slicer
#ifndef vtkImageWeightedSum_h
#define vtkImageWeightedSum_h
#include "vtkImagingMathModule.h" // For export macro
#include "vtkThreadedImageAlgorithm.h"
class vtkDoubleArray;
class VTKIMAGINGMATH_EXPORT vtkImageWeightedSum : public vtkThreadedImageAlgorithm
{
public:
static vtkImageWeightedSum *New();
vtkTypeMacro(vtkImageWeightedSum,vtkThreadedImageAlgorithm);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// The weights control the contribution of each input to the sum.
// They will be normalized to sum to 1 before filter execution.
virtual void SetWeights(vtkDoubleArray*);
vtkGetObjectMacro(Weights, vtkDoubleArray);
// Description:
// Change a specific weight. Reallocation is done
virtual void SetWeight(vtkIdType id, double weight);
// Description:
// Setting NormalizeByWeight on will divide the
// final result by the total weight of the component functions.
// This process does not otherwise normalize the weighted sum
// By default, NormalizeByWeight is on.
vtkGetMacro(NormalizeByWeight, int);
vtkSetClampMacro(NormalizeByWeight, int, 0, 1);
vtkBooleanMacro(NormalizeByWeight, int);
// Description:
// Compute the total value of all the weight
double CalculateTotalWeight();
protected:
vtkImageWeightedSum();
~vtkImageWeightedSum();
// Array to hold all the weights
vtkDoubleArray *Weights;
// Boolean flag to divide by sum or not
int NormalizeByWeight;
int RequestInformation (vtkInformation * vtkNotUsed(request),
vtkInformationVector** vtkNotUsed( inputVector ),
vtkInformationVector *outputVector);
void ThreadedRequestData (vtkInformation* request,
vtkInformationVector** inputVector,
vtkInformationVector* outputVector,
vtkImageData ***inData, vtkImageData **outData,
int ext[6], int id);
int FillInputPortInformation(int i, vtkInformation* info);
private:
vtkImageWeightedSum(const vtkImageWeightedSum&); // Not implemented.
void operator=(const vtkImageWeightedSum&); // Not implemented.
};
#endif
|
/*
* Copyright (C) 2009 Apple Inc. All rights reserved.
* 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:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef Uint8Array_h
#define Uint8Array_h
#include "wtf/IntegralTypedArrayBase.h"
namespace WTF {
class ArrayBuffer;
class Uint8Array : public IntegralTypedArrayBase<unsigned char> {
public:
static inline PassRefPtr<Uint8Array> create(unsigned length);
static inline PassRefPtr<Uint8Array> create(const unsigned char* array, unsigned length);
static inline PassRefPtr<Uint8Array> create(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length);
using TypedArrayBase<unsigned char>::set;
using IntegralTypedArrayBase<unsigned char>::set;
ViewType type() const override
{
return TypeUint8;
}
protected:
inline Uint8Array(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length);
// Make constructor visible to superclass.
friend class TypedArrayBase<unsigned char>;
};
PassRefPtr<Uint8Array> Uint8Array::create(unsigned length)
{
return TypedArrayBase<unsigned char>::create<Uint8Array>(length);
}
PassRefPtr<Uint8Array> Uint8Array::create(const unsigned char* array, unsigned length)
{
return TypedArrayBase<unsigned char>::create<Uint8Array>(array, length);
}
PassRefPtr<Uint8Array> Uint8Array::create(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length)
{
return TypedArrayBase<unsigned char>::create<Uint8Array>(buffer, byteOffset, length);
}
Uint8Array::Uint8Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length)
: IntegralTypedArrayBase<unsigned char>(buffer, byteOffset, length)
{
}
} // namespace WTF
using WTF::Uint8Array;
#endif // Uint8Array_h
|
// Filename: bulletCapsuleShape.h
// Created by: enn0x (27Jan10)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
#ifndef __BULLET_CAPSULE_SHAPE_H__
#define __BULLET_CAPSULE_SHAPE_H__
#include "pandabase.h"
#include "bullet_includes.h"
#include "bullet_utils.h"
#include "bulletShape.h"
////////////////////////////////////////////////////////////////////
// Class : BulletCapsuleShape
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDABULLET BulletCapsuleShape : public BulletShape {
PUBLISHED:
BulletCapsuleShape(PN_stdfloat radius, PN_stdfloat height, BulletUpAxis up=Z_up);
INLINE BulletCapsuleShape(const BulletCapsuleShape ©);
INLINE void operator = (const BulletCapsuleShape ©);
INLINE ~BulletCapsuleShape();
INLINE PN_stdfloat get_radius() const;
INLINE PN_stdfloat get_half_height() const;
public:
virtual btCollisionShape *ptr() const;
private:
btCapsuleShape *_shape;
////////////////////////////////////////////////////////////////////
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
BulletShape::init_type();
register_type(_type_handle, "BulletCapsuleShape",
BulletShape::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {
init_type();
return get_class_type();
}
private:
static TypeHandle _type_handle;
};
#include "bulletCapsuleShape.I"
#endif // __BULLET_CAPSULE_SHAPE_H__
|
/*
* Copyright (c) 2014 Google, Inc.
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*/
#ifndef TESTS_RAMP_H
#define TESTS_RAMP_H
class Ramp : public Test
{
public:
Ramp()
{
{
b2BodyDef bd;
b2Body* ground = m_world->CreateBody(&bd);
// Construct a ramp out of many polygons to ensure there's no
// issue with particles moving across vertices
float32 x, y;
const float32 xstep = 5.0, ystep = 5.0;
for (y = 30.0; y > 0.0; y -= ystep)
{
b2PolygonShape shape;
const b2Vec2 vertices[3] = {
b2Vec2(-25.0, y),
b2Vec2(-25.0, y-ystep),
b2Vec2(0.0, 15.0)};
shape.Set(vertices, 3);
ground->CreateFixture(&shape, 0.0f);
}
for (x = -25.0; x < 25.0; x += xstep)
{
b2PolygonShape shape;
const b2Vec2 vertices[3] = {
b2Vec2(x, 0.0),
b2Vec2(x+xstep, 0.0),
b2Vec2(0.0, 15.0)};
shape.Set(vertices, 3);
ground->CreateFixture(&shape, 0.0f);
}
}
m_particleSystem->SetRadius(0.25f);
const uint32 particleType = TestMain::GetParticleParameterValue();
if (particleType == b2_waterParticle)
{
m_particleSystem->SetDamping(0.2f);
}
{
b2CircleShape shape;
shape.m_p.Set(-20, 33);
shape.m_radius = 3;
b2ParticleGroupDef pd;
pd.flags = particleType;
pd.shape = &shape;
b2ParticleGroup* const group = m_particleSystem->CreateParticleGroup(pd);
if (pd.flags & b2_colorMixingParticle)
{
ColorParticleGroup(group, 0);
}
}
}
static Test* Create()
{
return new Ramp;
}
};
#endif
|
// LangUtils.h
#ifndef __LANG_UTILS_H
#define __LANG_UTILS_H
#include "../../../Windows/ResourceString.h"
#ifdef LANG
extern UString g_LangID;
struct CIDLangPair
{
UInt32 ControlID;
UInt32 LangID;
};
void ReloadLang();
void LoadLangOneTime();
FString GetLangDirPrefix();
void LangSetDlgItemText(HWND dialog, UInt32 controlID, UInt32 langID);
void LangSetDlgItems(HWND dialog, const UInt32 *ids, unsigned numItems);
void LangSetDlgItems_Colon(HWND dialog, const UInt32 *ids, unsigned numItems);
void LangSetWindowText(HWND window, UInt32 langID);
UString LangString(UInt32 langID);
void AddLangString(UString &s, UInt32 langID);
void LangString(UInt32 langID, UString &dest);
void LangString_OnlyFromLangFile(UInt32 langID, UString &dest);
#else
inline UString LangString(UInt32 langID) { return NWindows::MyLoadString(langID); }
inline void LangString(UInt32 langID, UString &dest) { NWindows::MyLoadString(langID, dest); }
inline void AddLangString(UString &s, UInt32 langID) { s += NWindows::MyLoadString(langID); }
#endif
#endif
|
/*
* Copyright (C) 2009 Martin Willi
* Hochschule fuer Technik Rapperswil
*
* 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. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* 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.
*/
/**
* @defgroup ha_kernel ha_kernel
* @{ @ingroup ha
*/
#ifndef HA_KERNEL_H_
#define HA_KERNEL_H_
typedef struct ha_kernel_t ha_kernel_t;
#include "ha_segments.h"
/**
* HA segment kernel configuration interface.
*/
struct ha_kernel_t {
/**
* Get the segment a host is in.
*
* @param host host to get segment for
* @return segment number
*/
u_int (*get_segment)(ha_kernel_t *this, host_t *host);
/**
* Get the segment a host/SPI is in, as used for CHILD_SA segmentation.
*
* @param host host to get segment for
* @param spi SPI to include in hash
* @return segment number
*/
u_int (*get_segment_spi)(ha_kernel_t *this, host_t *host, u_int32_t spi);
/**
* Get the segment an arbitrary integer is in.
*
* @param n integer to segmentate
*/
u_int (*get_segment_int)(ha_kernel_t *this, int n);
/**
* Activate a segment at kernel level for all cluster addresses.
*
* @param segment segment to activate
*/
void (*activate)(ha_kernel_t *this, u_int segment);
/**
* Deactivate a segment at kernel level for all cluster addresses.
*
* @param segment segment to deactivate
*/
void (*deactivate)(ha_kernel_t *this, u_int segment);
/**
* Destroy a ha_kernel_t.
*/
void (*destroy)(ha_kernel_t *this);
};
/**
* Create a ha_kernel instance.
*
* @param count total number of segments to use
*/
ha_kernel_t *ha_kernel_create(u_int count);
#endif /** HA_KERNEL_ @}*/
|
/*
===========================================================================
Copyright (C) 1999-2005 Id Software, Inc.
This file is part of Quake III Arena source code.
Quake III Arena source code 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.
Quake III Arena source code 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 Quake III Arena source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
/*****************************************************************************
* name: be_ai_gen.c
*
* desc: genetic selection
*
* $Archive: /MissionPack/code/botlib/be_ai_gen.c $
*
*****************************************************************************/
#include "../qcommon/q_shared.h"
#include "l_memory.h"
#include "l_log.h"
#include "l_utils.h"
#include "l_script.h"
#include "l_precomp.h"
#include "l_struct.h"
#include "aasfile.h"
#include "botlib.h"
#include "be_aas.h"
#include "be_aas_funcs.h"
#include "be_interface.h"
#include "be_ai_gen.h"
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
int GeneticSelection(int numranks, float *rankings)
{
float sum;
int i, index;
sum = 0;
for (i = 0; i < numranks; i++)
{
if (rankings[i] < 0) continue;
sum += rankings[i];
} //end for
if (sum > 0)
{
//select a bot where the ones with the highest rankings have
//the highest chance of being selected
//sum *= random();
for (i = 0; i < numranks; i++)
{
if (rankings[i] < 0) continue;
sum -= rankings[i];
if (sum <= 0) return i;
} //end for
} //end if
//select a bot randomly
index = random() * numranks;
for (i = 0; i < numranks; i++)
{
if (rankings[index] >= 0) return index;
index = (index + 1) % numranks;
} //end for
return 0;
} //end of the function GeneticSelection
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
int GeneticParentsAndChildSelection(int numranks, float *ranks, int *parent1, int *parent2, int *child)
{
float rankings[256], max;
int i;
if (numranks > 256)
{
botimport.Print(PRT_WARNING, "GeneticParentsAndChildSelection: too many bots\n");
*parent1 = *parent2 = *child = 0;
return qfalse;
} //end if
for (max = 0, i = 0; i < numranks; i++)
{
if (ranks[i] < 0) continue;
max++;
} //end for
if (max < 3)
{
botimport.Print(PRT_WARNING, "GeneticParentsAndChildSelection: too few valid bots\n");
*parent1 = *parent2 = *child = 0;
return qfalse;
} //end if
Com_Memcpy(rankings, ranks, sizeof(float) * numranks);
//select first parent
*parent1 = GeneticSelection(numranks, rankings);
rankings[*parent1] = -1;
//select second parent
*parent2 = GeneticSelection(numranks, rankings);
rankings[*parent2] = -1;
//reverse the rankings
max = 0;
for (i = 0; i < numranks; i++)
{
if (rankings[i] < 0) continue;
if (rankings[i] > max) max = rankings[i];
} //end for
for (i = 0; i < numranks; i++)
{
if (rankings[i] < 0) continue;
rankings[i] = max - rankings[i];
} //end for
//select child
*child = GeneticSelection(numranks, rankings);
return qtrue;
} //end of the function GeneticParentsAndChildSelection
|
/* Machine independent GDB support for core files on systems using "regsets".
Copyright (C) 1993-2016 Free Software Foundation, Inc.
This file is part of GDB.
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/>. */
/* This file is used by most systems that use ELF for their core
dumps. This includes most systems that have SVR4-ish variant of
/proc. For these systems, the registers are laid out the same way
in core files as in the gregset_t and fpregset_t structures that
are used in the interaction with /proc (Irix 4 is an exception and
therefore doesn't use this file). Quite a few systems without a
SVR4-ish /proc define these structures too, and can make use of
this code too. */
#include "defs.h"
#include "command.h"
#include "gdbcore.h"
#include "inferior.h"
#include "target.h"
#include "regcache.h"
#include <fcntl.h>
#include <time.h>
#ifdef HAVE_SYS_PROCFS_H
#include <sys/procfs.h>
#endif
/* Prototypes for supply_gregset etc. */
#include "gregset.h"
/* Provide registers to GDB from a core file.
CORE_REG_SECT points to an array of bytes, which are the contents
of a `note' from a core file which BFD thinks might contain
register contents. CORE_REG_SIZE is its size.
WHICH says which register set corelow suspects this is:
0 --- the general-purpose register set, in gregset_t format
2 --- the floating-point register set, in fpregset_t format
REG_ADDR is ignored. */
static void
fetch_core_registers (struct regcache *regcache,
char *core_reg_sect,
unsigned core_reg_size,
int which,
CORE_ADDR reg_addr)
{
gdb_gregset_t gregset;
gdb_fpregset_t fpregset;
gdb_gregset_t *gregset_p = &gregset;
gdb_fpregset_t *fpregset_p = &fpregset;
switch (which)
{
case 0:
if (core_reg_size != sizeof (gregset))
warning (_("Wrong size gregset in core file."));
else
{
memcpy (&gregset, core_reg_sect, sizeof (gregset));
supply_gregset (regcache, (const gdb_gregset_t *) gregset_p);
}
break;
case 2:
if (core_reg_size != sizeof (fpregset))
warning (_("Wrong size fpregset in core file."));
else
{
memcpy (&fpregset, core_reg_sect, sizeof (fpregset));
if (gdbarch_fp0_regnum (get_regcache_arch (regcache)) >= 0)
supply_fpregset (regcache,
(const gdb_fpregset_t *) fpregset_p);
}
break;
default:
/* We've covered all the kinds of registers we know about here,
so this must be something we wouldn't know what to do with
anyway. Just ignore it. */
break;
}
}
/* Register that we are able to handle ELF core file formats using
standard procfs "regset" structures. */
static struct core_fns regset_core_fns =
{
bfd_target_elf_flavour, /* core_flavour */
default_check_format, /* check_format */
default_core_sniffer, /* core_sniffer */
fetch_core_registers, /* core_read_registers */
NULL /* next */
};
/* Provide a prototype to silence -Wmissing-prototypes. */
extern void _initialize_core_regset (void);
void
_initialize_core_regset (void)
{
deprecated_add_core_fns (®set_core_fns);
}
|
/*
* write_bb_file.c --- write a list of bad blocks to a FILE *
*
* Copyright (C) 1994, 1995 Theodore Ts'o.
*
* %Begin-Header%
* This file may be redistributed under the terms of the GNU Public
* License.
* %End-Header%
*/
#include <stdio.h>
#include "ext2_fs.h"
#include "ext2fs.h"
errcode_t ext2fs_write_bb_FILE(ext2_badblocks_list bb_list,
unsigned int flags EXT2FS_ATTR((unused)),
FILE *f)
{
badblocks_iterate bb_iter;
blk_t blk;
errcode_t retval;
retval = ext2fs_badblocks_list_iterate_begin(bb_list, &bb_iter);
if (retval)
return retval;
while (ext2fs_badblocks_list_iterate(bb_iter, &blk)) {
fprintf(f, "%u\n", blk);
}
ext2fs_badblocks_list_iterate_end(bb_iter);
return 0;
}
|
/**
* The Forgotten Server - a free and open-source MMORPG server emulator
* Copyright (C) 2014 Mark Samman <mark.samman@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef FS_RSA_H_C4E277DA8E884B578DDBF0566F504E91
#define FS_RSA_H_C4E277DA8E884B578DDBF0566F504E91
#include <gmp.h>
class RSA
{
public:
RSA();
~RSA();
void setKey(const char* p, const char* q);
void decrypt(char* msg);
protected:
std::recursive_mutex lock;
//use only GMP
mpz_t m_n, m_d;
};
#endif
|
#pragma once
/*
* Copyright (C) 2005-2008 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
*
*/
#include "addons/Addon.h"
#include "XBDateTime.h"
#include "utils/ScraperUrl.h"
#include "utils/ScraperParser.h"
#include "video/Episode.h"
class CAlbum;
class CArtist;
class CVideoInfoTag;
namespace MUSIC_GRABBER
{
class CMusicAlbumInfo;
class CMusicArtistInfo;
}
typedef enum
{
CONTENT_MOVIES,
CONTENT_TVSHOWS,
CONTENT_MUSICVIDEOS,
CONTENT_ALBUMS,
CONTENT_ARTISTS,
CONTENT_NONE,
} CONTENT_TYPE;
namespace XFILE
{
class CCurlFile;
}
class CScraperUrl;
namespace ADDON
{
class CScraper;
typedef boost::shared_ptr<CScraper> ScraperPtr;
CStdString TranslateContent(const CONTENT_TYPE &content, bool pretty=false);
CONTENT_TYPE TranslateContent(const CStdString &string);
TYPE ScraperTypeFromContent(const CONTENT_TYPE &content);
// thrown as exception to signal abort or show error dialog
class CScraperError
{
public:
CScraperError() : m_fAborted(true) {}
CScraperError(const CStdString &sTitle, const CStdString &sMessage) :
m_fAborted(false), m_sTitle(sTitle), m_sMessage(sMessage) {}
bool FAborted() const { return m_fAborted; }
const CStdString &Title() const { return m_sTitle; }
const CStdString &Message() const { return m_sMessage; }
private:
bool m_fAborted;
CStdString m_sTitle;
CStdString m_sMessage;
};
class CScraper : public CAddon
{
public:
CScraper(const AddonProps &props) : CAddon(props), m_fLoaded(false) {}
CScraper(const cp_extension_t *ext);
virtual ~CScraper() {}
virtual AddonPtr Clone(const AddonPtr &self) const;
/*! \brief Set the scraper settings for a particular path from an XML string
Loads the default and user settings (if not already loaded) and, if the given XML string is non-empty,
overrides the user settings with the XML.
\param content Content type of the path
\param xml string of XML with the settings. If non-empty this overrides any saved user settings.
\return true if settings are available, false otherwise
\sa GetPathSettings
*/
bool SetPathSettings(CONTENT_TYPE content, const CStdString& xml);
/*! \brief Get the scraper settings for a particular path in the form of an XML string
Loads the default and user settings (if not already loaded) and returns the user settings in the
form or an XML string
\return a string containing the XML settings
\sa SetPathSettings
*/
CStdString GetPathSettings();
/*! \brief Clear any previously cached results for this scraper
Any previously cached files are cleared if they have been cached for longer than the specified
cachepersistence.
*/
void ClearCache();
CONTENT_TYPE Content() const { return m_pathContent; }
const CStdString& Language() const { return m_language; }
bool RequiresSettings() const { return m_requiressettings; }
bool Supports(const CONTENT_TYPE &content) const;
bool IsInUse() const;
// scraper media functions
CScraperUrl NfoUrl(const CStdString &sNfoContent);
std::vector<CScraperUrl> FindMovie(XFILE::CCurlFile &fcurl,
const CStdString &sMovie, bool fFirst);
std::vector<MUSIC_GRABBER::CMusicAlbumInfo> FindAlbum(XFILE::CCurlFile &fcurl,
const CStdString &sAlbum, const CStdString &sArtist = "");
std::vector<MUSIC_GRABBER::CMusicArtistInfo> FindArtist(
XFILE::CCurlFile &fcurl, const CStdString &sArtist);
EPISODELIST GetEpisodeList(XFILE::CCurlFile &fcurl, const CScraperUrl &scurl);
bool GetVideoDetails(XFILE::CCurlFile &fcurl, const CScraperUrl &scurl,
bool fMovie/*else episode*/, CVideoInfoTag &video);
bool GetAlbumDetails(XFILE::CCurlFile &fcurl, const CScraperUrl &scurl,
CAlbum &album);
bool GetArtistDetails(XFILE::CCurlFile &fcurl, const CScraperUrl &scurl,
const CStdString &sSearch, CArtist &artist);
private:
CScraper(const CScraper&, const AddonPtr&);
CStdString SearchStringEncoding() const
{ return m_parser.GetSearchStringEncoding(); }
bool Load();
std::vector<CStdString> Run(const CStdString& function,
const CScraperUrl& url,
XFILE::CCurlFile& http,
const std::vector<CStdString>* extras = NULL);
std::vector<CStdString> RunNoThrow(const CStdString& function,
const CScraperUrl& url,
XFILE::CCurlFile& http,
const std::vector<CStdString>* extras = NULL);
CStdString InternalRun(const CStdString& function,
const CScraperUrl& url,
XFILE::CCurlFile& http,
const std::vector<CStdString>* extras);
bool m_fLoaded;
CStdString m_language;
bool m_requiressettings;
CDateTimeSpan m_persistence;
CONTENT_TYPE m_pathContent;
CScraperParser m_parser;
};
}
|
/**
* @file
*
* @ingroup lpc32xx_boot
*
* @brief Boot support API.
*/
/*
* Copyright (c) 2010
* embedded brains GmbH
* Obere Lagerstr. 30
* D-82178 Puchheim
* Germany
* <rtems@embedded-brains.de>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.org/license/LICENSE.
*/
#ifndef LIBBSP_ARM_LPC32XX_BOOT_H
#define LIBBSP_ARM_LPC32XX_BOOT_H
#include <stdint.h>
#include <bsp/nand-mlc.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
* @defgroup lpc32xx_boot Boot Support
*
* @ingroup arm_lpc32xx
*
* @brief Boot support.
*
* The NXP internal boot program shall be the "stage-0 program".
*
* The boot program within the first page of the first or second block shall be
* "stage-1 program". It will be invoked by the stage-0 program from NXP.
*
* The program loaded by the stage-1 program will be the "stage-2 program" or the
* "boot loader".
*
* The program loaded by the stage-2 program will be the "stage-3 program" or the
* "application".
*
* The stage-1 program image must have a format specified by NXP.
*
* The stage-2 and stage-3 program images may have any format.
*
* @{
*/
#define LPC32XX_BOOT_BLOCK_0 0
#define LPC32XX_BOOT_BLOCK_1 1
#define LPC32XX_BOOT_ICR_SP_3AC_8IF 0xf0
#define LPC32XX_BOOT_ICR_SP_4AC_8IF 0xd2
#define LPC32XX_BOOT_ICR_LP_4AC_8IF 0xb4
#define LPC32XX_BOOT_ICR_LP_5AC_8IF 0x96
typedef union {
struct {
uint8_t d0;
uint8_t reserved_0 [3];
uint8_t d1;
uint8_t reserved_1 [3];
uint8_t d2;
uint8_t reserved_2 [3];
uint8_t d3;
uint8_t reserved_3 [3];
uint8_t d4;
uint8_t reserved_4 [3];
uint8_t d5;
uint8_t reserved_5 [3];
uint8_t d6;
uint8_t reserved_6 [3];
uint8_t d7;
uint8_t reserved_7 [3];
uint8_t d8;
uint8_t reserved_8 [3];
uint8_t d9;
uint8_t reserved_9 [3];
uint8_t d10;
uint8_t reserved_10 [3];
uint8_t d11;
uint8_t reserved_11 [3];
uint8_t d12;
uint8_t reserved_12 [463];
} field;
uint32_t data [MLC_SMALL_DATA_WORD_COUNT];
} lpc32xx_boot_block;
void lpc32xx_setup_boot_block(
lpc32xx_boot_block *boot_block,
uint8_t icr,
uint8_t page_count
);
void lpc32xx_set_boot_block_bad(
lpc32xx_boot_block *boot_block
);
/** @} */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* LIBBSP_ARM_LPC32XX_BOOT_H */
|
/* Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
Written by Bruno Haible <haible@clisp.cons.org>, 2001.
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. */
#ifndef _STDBOOL_H
#define _STDBOOL_H
/* ISO C 99 <stdbool.h> for platforms that lack it. */
/* Usage suggestions:
Programs that use <stdbool.h> should be aware of some limitations
and standards compliance issues.
Standards compliance:
- <stdbool.h> must be #included before 'bool', 'false', 'true'
can be used.
- You cannot assume that sizeof (bool) == 1.
- Programs should not undefine the macros bool, true, and false,
as C99 lists that as an "obsolescent feature".
Limitations of this substitute, when used in a C89 environment:
- <stdbool.h> must be #included before the '_Bool' type can be used.
- You cannot assume that _Bool is a typedef; it might be a macro.
- In C99, casts and automatic conversions to '_Bool' or 'bool' are
performed in such a way that every nonzero value gets converted
to 'true', and zero gets converted to 'false'. This doesn't work
with this substitute. With this substitute, only the values 0 and 1
give the expected result when converted to _Bool' or 'bool'.
Also, it is suggested that programs use 'bool' rather than '_Bool';
this isn't required, but 'bool' is more common. */
/* 7.16. Boolean type and values */
/* BeOS <sys/socket.h> already #defines false 0, true 1. We use the same
definitions below, but temporarily we have to #undef them. */
#ifdef __BEOS__
# include <OS.h> /* defines bool but not _Bool */
# undef false
# undef true
#endif
/* For the sake of symbolic names in gdb, we define true and false as
enum constants, not only as macros.
It is tempting to write
typedef enum { false = 0, true = 1 } _Bool;
so that gdb prints values of type 'bool' symbolically. But if we do
this, values of type '_Bool' may promote to 'int' or 'unsigned int'
(see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int'
(see ISO C 99 6.3.1.1.(2)). So we add a negative value to the
enum; this ensures that '_Bool' promotes to 'int'. */
#if !(defined __cplusplus || defined __BEOS__)
# if !@HAVE__BOOL@
# if defined __SUNPRO_C && (__SUNPRO_C < 0x550 || __STDC__ == 1)
/* Avoid stupid "warning: _Bool is a keyword in ISO C99". */
# define _Bool signed char
enum { false = 0, true = 1 };
# else
typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool;
# endif
# endif
#else
typedef bool _Bool;
#endif
#define bool _Bool
/* The other macros must be usable in preprocessor directives. */
#define false 0
#define true 1
#define __bool_true_false_are_defined 1
#endif /* _STDBOOL_H */
|
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* 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/>.
*
*/
/**
* Ultiboard v2.0 pin assignments
*/
#ifndef __AVR_ATmega2560__
#error "Oops! Make sure you have 'Arduino Mega 2560' selected from the 'Tools -> Boards' menu."
#endif
#define DEFAULT_MACHINE_NAME "Ultimaker"
#define DEFAULT_SOURCE_CODE_URL "https://github.com/Ultimaker/Marlin"
#define BOARD_NAME "Ultimaker 2.x"
#define X_STEP_PIN 25
#define X_DIR_PIN 23
#define X_STOP_PIN 22
#define X_ENABLE_PIN 27
#define Y_STEP_PIN 32
#define Y_DIR_PIN 33
#define Y_STOP_PIN 26
#define Y_ENABLE_PIN 31
#define Z_STEP_PIN 35
#define Z_DIR_PIN 36
#define Z_STOP_PIN 29
#define Z_ENABLE_PIN 34
#define HEATER_BED_PIN 4
#define TEMP_BED_PIN 10
#define HEATER_0_PIN 2
#define TEMP_0_PIN 8
#define HEATER_1_PIN 3
#define TEMP_1_PIN 9
#define E0_STEP_PIN 42
#define E0_DIR_PIN 43
#define E0_ENABLE_PIN 37
#define E1_STEP_PIN 49
#define E1_DIR_PIN 47
#define E1_ENABLE_PIN 48
#define SDSS 53
#define LED_PIN 8
#define FAN_PIN 7
#define SAFETY_TRIGGERED_PIN 28 //PIN to detect the safety circuit has triggered
#define MAIN_VOLTAGE_MEASURE_PIN 14 //Analogue PIN to measure the main voltage, with a 100k - 4k7 resitor divider.
#define MOTOR_CURRENT_PWM_XY_PIN 44
#define MOTOR_CURRENT_PWM_Z_PIN 45
#define MOTOR_CURRENT_PWM_E_PIN 46
//Motor current PWM conversion, PWM value = MotorCurrentSetting * 255 / range
#define MOTOR_CURRENT_PWM_RANGE 2000
#define DEFAULT_PWM_MOTOR_CURRENT {1300, 1300, 1250}
#define BEEPER_PIN 18
#define LCD_PINS_RS 20
#define LCD_PINS_ENABLE 15
#define LCD_PINS_D4 14
#define LCD_PINS_D5 21
#define LCD_PINS_D6 5
#define LCD_PINS_D7 6
//buttons are directly attached
#define BTN_EN1 40
#define BTN_EN2 41
#define BTN_ENC 19
#define SD_DETECT_PIN 39
|
/*
* Copyright (c) 2016 Thomas Pornin <pornin@bolet.org>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include "inner.h"
/* see inner.h */
void
br_i31_encode(void *dst, size_t len, const uint32_t *x)
{
unsigned char *buf;
size_t k, xlen;
uint32_t acc;
int acc_len;
xlen = (x[0] + 31) >> 5;
if (xlen == 0) {
memset(dst, 0, len);
return;
}
buf = (unsigned char *)dst + len;
k = 1;
acc = 0;
acc_len = 0;
while (len != 0) {
uint32_t w;
w = (k <= xlen) ? x[k] : 0;
k ++;
if (acc_len == 0) {
acc = w;
acc_len = 31;
} else {
uint32_t z;
z = acc | (w << acc_len);
acc_len --;
acc = w >> (31 - acc_len);
if (len >= 4) {
buf -= 4;
len -= 4;
br_enc32be(buf, z);
} else {
switch (len) {
case 3:
buf[-3] = (unsigned char)(z >> 16);
/* fall through */
case 2:
buf[-2] = (unsigned char)(z >> 8);
/* fall through */
case 1:
buf[-1] = (unsigned char)z;
break;
}
return;
}
}
}
}
|
///////////////////////////////////////////////////////////////////////////////
// Name: pdfcjkfontdata.h
// Purpose: Definition of CJK font data structures
// Author: Ulrich Telle
// Modified by:
// Created: 2010-03-29
// Copyright: (c) Ulrich Telle
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
/// \file pdfcjkfontdata.h Definition of CJK font data structures
#ifndef _PDF_CJK_FONT_DATA_H_
#define _PDF_CJK_FONT_DATA_H_
/// Structure describing core fonts (For internal use only)
typedef struct _wxPdfCjkFontDesc
{
const wxChar* family; ///< font family
const wxChar* name; ///< font name
const wxChar* encoding; ///< font encoding
const wxChar* ordering; ///< registry ordering
const wxChar* supplement; ///< registry supplement
const wxChar* cmap; ///< font cmap
short* cwArray; ///< array of character widths
const wxChar* bbox; ///< bounding box
int ascent; ///< ascender
int descent; ///< descender
int capHeight; ///< height of capital characters
int flags; ///< font flags
int italicAngle; ///< italic angle
int stemV; ///< stemV value
int missingWidth; ///< width used for missing characters
int xHeight; ///< height of the character X
int underlinePosition; ///< position of the underline decoration
int underlineThickness; ///< thickness of the underline decoration
} wxPdfCjkFontDesc;
#endif
|
/*----------------------------------------------------------------------------
* File: ooaofooa_R_SUB_class.c
*
* Class: Class As Subtype (R_SUB)
* Component: ooaofooa
*
* your copyright statement can go here (from te_copyright.body)
*--------------------------------------------------------------------------*/
#include "sys_sys_types.h"
#include "LOG_bridge.h"
#include "POP_bridge.h"
#include "T_bridge.h"
#include "ooaofooa_classes.h"
/*
* Instance Loader (from string data).
*/
Escher_iHandle_t
ooaofooa_R_SUB_instanceloader( Escher_iHandle_t instance, const c_t * avlstring[] )
{
Escher_iHandle_t return_identifier = 0;
ooaofooa_R_SUB * self = (ooaofooa_R_SUB *) instance;
/* Initialize application analysis class attributes. */
self->Obj_ID = (Escher_iHandle_t) Escher_atoi( avlstring[ 1 ] );
self->Rel_ID = (Escher_iHandle_t) Escher_atoi( avlstring[ 2 ] );
self->OIR_ID = (Escher_iHandle_t) Escher_atoi( avlstring[ 3 ] );
return return_identifier;
}
/*
* Select any where using referential/identifying attribute set.
* If not_empty, relate this instance to the selected instance.
*/
void ooaofooa_R_SUB_batch_relate( Escher_iHandle_t instance )
{
ooaofooa_R_SUB * ooaofooa_R_SUB_instance = (ooaofooa_R_SUB *) instance;
ooaofooa_R_SUBSUP * ooaofooa_R_SUBSUPrelated_instance1 = ooaofooa_R_SUBSUP_AnyWhere1( ooaofooa_R_SUB_instance->Rel_ID );
if ( ooaofooa_R_SUBSUPrelated_instance1 ) {
ooaofooa_R_SUB_R213_Link_relates( ooaofooa_R_SUBSUPrelated_instance1, ooaofooa_R_SUB_instance );
}
{
ooaofooa_R_RGO * ooaofooa_R_RGOrelated_instance1 = ooaofooa_R_RGO_AnyWhere1( ooaofooa_R_SUB_instance->Obj_ID, ooaofooa_R_SUB_instance->Rel_ID, ooaofooa_R_SUB_instance->OIR_ID );
if ( ooaofooa_R_RGOrelated_instance1 ) {
ooaofooa_R_SUB_R205_Link( ooaofooa_R_RGOrelated_instance1, ooaofooa_R_SUB_instance );
}
}
}
/*
* RELATE R_RGO TO R_SUB ACROSS R205
*/
void
ooaofooa_R_SUB_R205_Link( ooaofooa_R_RGO * supertype, ooaofooa_R_SUB * subtype )
{
/* Use TagEmptyHandleDetectionOn() to detect empty handle references. */
subtype->OIR_ID = supertype->OIR_ID;
subtype->Obj_ID = supertype->Obj_ID;
subtype->Rel_ID = supertype->Rel_ID;
/* Optimized linkage for R_SUB->R_RGO[R205] */
subtype->R_RGO_R205 = supertype;
/* Optimized linkage for R_RGO->R_SUB[R205] */
supertype->R205_subtype = subtype;
supertype->R205_object_id = ooaofooa_R_SUB_CLASS_NUMBER;
}
/*
* UNRELATE R_RGO FROM R_SUB ACROSS R205
*/
void
ooaofooa_R_SUB_R205_Unlink( ooaofooa_R_RGO * supertype, ooaofooa_R_SUB * subtype )
{
/* Use TagEmptyHandleDetectionOn() to detect empty handle references. */
subtype->R_RGO_R205 = 0;
supertype->R205_subtype = 0;
supertype->R205_object_id = 0;
}
/*
* RELATE R_SUBSUP TO R_SUB ACROSS R213
*/
void
ooaofooa_R_SUB_R213_Link_relates( ooaofooa_R_SUBSUP * part, ooaofooa_R_SUB * form )
{
/* Use TagEmptyHandleDetectionOn() to detect empty handle references. */
form->Rel_ID = part->Rel_ID;
form->R_SUBSUP_R213_is_related_to_supertype_via = part;
Escher_SetInsertElement( &part->R_SUB_R213_relates, (Escher_ObjectSet_s *) form );
}
/*
* UNRELATE R_SUBSUP FROM R_SUB ACROSS R213
*/
void
ooaofooa_R_SUB_R213_Unlink_relates( ooaofooa_R_SUBSUP * part, ooaofooa_R_SUB * form )
{
/* Use TagEmptyHandleDetectionOn() to detect empty handle references. */
form->R_SUBSUP_R213_is_related_to_supertype_via = 0;
Escher_SetRemoveElement( &part->R_SUB_R213_relates, (Escher_ObjectSet_s *) form );
}
/*
* Dump instances in SQL format.
*/
void
ooaofooa_R_SUB_instancedumper( Escher_iHandle_t instance )
{
ooaofooa_R_SUB * self = (ooaofooa_R_SUB *) instance;
printf( "INSERT INTO R_SUB VALUES ( %ld,%ld,%ld );\n",
((long)self->Obj_ID & ESCHER_IDDUMP_MASK),
((long)self->Rel_ID & ESCHER_IDDUMP_MASK),
((long)self->OIR_ID & ESCHER_IDDUMP_MASK) );
}
/*
* Statically allocate space for the instance population for this class.
* Allocate space for the class instance and its attribute values.
* Depending upon the collection scheme, allocate containoids (collection
* nodes) for gathering instances into free and active extents.
*/
static Escher_SetElement_s ooaofooa_R_SUB_container[ ooaofooa_R_SUB_MAX_EXTENT_SIZE ];
static ooaofooa_R_SUB ooaofooa_R_SUB_instances[ ooaofooa_R_SUB_MAX_EXTENT_SIZE ];
Escher_Extent_t pG_ooaofooa_R_SUB_extent = {
{0,0}, {0,0}, &ooaofooa_R_SUB_container[ 0 ],
(Escher_iHandle_t) &ooaofooa_R_SUB_instances,
sizeof( ooaofooa_R_SUB ), 0, ooaofooa_R_SUB_MAX_EXTENT_SIZE
};
|
// Copyright 2013 The Flutter 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 FLOW_TESTING_MOCK_EMBEDDER_H_
#define FLOW_TESTING_MOCK_EMBEDDER_H_
#include "flutter/flow/embedded_views.h"
namespace flutter {
namespace testing {
class MockViewEmbedder : public ExternalViewEmbedder {
public:
MockViewEmbedder();
~MockViewEmbedder();
// |ExternalViewEmbedder|
SkCanvas* GetRootCanvas() override;
// |ExternalViewEmbedder|
void CancelFrame() override;
// |ExternalViewEmbedder|
void BeginFrame(
SkISize frame_size,
GrDirectContext* context,
double device_pixel_ratio,
fml::RefPtr<fml::RasterThreadMerger> raster_thread_merger) override;
// |ExternalViewEmbedder|
void PrerollCompositeEmbeddedView(
int view_id,
std::unique_ptr<EmbeddedViewParams> params) override;
// |ExternalViewEmbedder|
std::vector<SkCanvas*> GetCurrentCanvases() override;
// |ExternalViewEmbedder|
SkCanvas* CompositeEmbeddedView(int view_id) override;
};
} // namespace testing
} // namespace flutter
#endif // FLOW_TESTING_MOCK_EMBEDDER_H_
|
//
// ASTextKitEntityAttribute.h
// AsyncDisplayKit
//
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.
//
#import <Foundation/Foundation.h>
#import <AsyncDisplayKit/ASBaseDefines.h>
/**
The object that should be embedded with ASTextKitEntityAttributeName. Please note that the entity you provide MUST
implement a proper hash and isEqual function or your application performance will grind to a halt due to
NSMutableAttributedString's usage of a global hash table of all attributes. This means the entity should NOT be a
Foundation Collection (NSArray, NSDictionary, NSSet, etc.) since their hash function is a simple count of the values
in the collection, which causes pathological performance problems deep inside NSAttributedString's implementation.
rdar://19352367
*/
AS_SUBCLASSING_RESTRICTED
@interface ASTextKitEntityAttribute : NSObject
@property (nonatomic, strong, readonly) id<NSObject> entity;
- (instancetype)initWithEntity:(id<NSObject>)entity;
@end
|
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2007 Uwe Hermann <uwe@hermann-uwe.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef SOUTHBRIDGE_AMD_CS5530_CHIP_H
#define SOUTHBRIDGE_AMD_CS5530_CHIP_H
struct southbridge_amd_cs5530_config {
int ide0_enable:1;
int ide1_enable:1;
};
#endif /* SOUTHBRIDGE_AMD_CS5530_CHIP_H */
|
/* $Id$ */
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the names of
* Sam Leffler and Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Sam Leffler and Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#include "tiffiop.h"
#ifdef NEXT_SUPPORT
/*
* TIFF Library.
*
* NeXT 2-bit Grey Scale Compression Algorithm Support
*/
#define SETPIXEL(op, v) { \
switch (npixels++ & 3) { \
case 0: op[0] = (unsigned char) ((v) << 6); break; \
case 1: op[0] |= (v) << 4; break; \
case 2: op[0] |= (v) << 2; break; \
case 3: *op++ |= (v); break; \
} \
}
#define LITERALROW 0x00
#define LITERALSPAN 0x40
#define WHITE ((1<<2)-1)
static int
NeXTDecode(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s)
{
register unsigned char *bp, *op;
register tsize_t cc;
register int n;
tidata_t row;
tsize_t scanline;
(void) s;
/*
* Each scanline is assumed to start off as all
* white (we assume a PhotometricInterpretation
* of ``min-is-black'').
*/
for (op = buf, cc = occ; cc-- > 0;)
*op++ = 0xff;
bp = (unsigned char *)tif->tif_rawcp;
cc = tif->tif_rawcc;
scanline = tif->tif_scanlinesize;
for (row = buf; (long)occ > 0; occ -= scanline, row += scanline) {
n = *bp++, cc--;
switch (n) {
case LITERALROW:
/*
* The entire scanline is given as literal values.
*/
if (cc < scanline)
goto bad;
_TIFFmemcpy(row, bp, scanline);
bp += scanline;
cc -= scanline;
break;
case LITERALSPAN: {
int off;
/*
* The scanline has a literal span
* that begins at some offset.
*/
off = (bp[0] * 256) + bp[1];
n = (bp[2] * 256) + bp[3];
if (cc < 4+n || off+n > scanline)
goto bad;
_TIFFmemcpy(row+off, bp+4, n);
bp += 4+n;
cc -= 4+n;
break;
}
default: {
register int npixels = 0, grey;
unsigned long imagewidth = tif->tif_dir.td_imagewidth;
/*
* The scanline is composed of a sequence
* of constant color ``runs''. We shift
* into ``run mode'' and interpret bytes
* as codes of the form <color><npixels>
* until we've filled the scanline.
*/
op = row;
for (;;) {
grey = (n>>6) & 0x3;
n &= 0x3f;
while (n-- > 0)
SETPIXEL(op, grey);
if (npixels >= (int) imagewidth)
break;
if (cc == 0)
goto bad;
n = *bp++, cc--;
}
break;
}
}
}
tif->tif_rawcp = (tidata_t) bp;
tif->tif_rawcc = cc;
return (1);
bad:
TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "NeXTDecode: Not enough data for scanline %ld",
(long) tif->tif_row);
return (0);
}
int
TIFFInitNeXT(TIFF* tif, int scheme)
{
(void) scheme;
tif->tif_decoderow = NeXTDecode;
tif->tif_decodestrip = NeXTDecode;
tif->tif_decodetile = NeXTDecode;
return (1);
}
#endif /* NEXT_SUPPORT */
/* vim: set ts=8 sts=8 sw=8 noet: */
|
/* Copyright (C) 2007-2011 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program 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
* version 2 along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
/**
* \file
*
* \author Victor Julien <victor@inliniac.net>
*/
#ifndef __DETECT_ENGINE_ALERT_H__
#define __DETECT_ENGINE_ALERT_H__
#include "suricata-common.h"
#include "decode.h"
#include "detect.h"
void PacketAlertFinalize(DetectEngineCtx *, DetectEngineThreadCtx *, Packet *);
int PacketAlertAppend(DetectEngineThreadCtx *, Signature *, Packet *, uint64_t tx_id, uint8_t);
int PacketAlertCheck(Packet *, uint32_t);
int PacketAlertRemove(Packet *, uint16_t);
void PacketAlertTagInit(void);
PacketAlert *PacketAlertGetTag(void);
#endif /* __DETECT_ENGINE_ALERT_H__ */
|
/* Tests of fstat() function.
Copyright (C) 2011-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include <sys/stat.h>
#include "signature.h"
SIGNATURE_CHECK (fstat, int, (int, struct stat *));
#include <errno.h>
#include <unistd.h>
#include "macros.h"
int
main (int argc, char *argv[])
{
/* Test behaviour for invalid file descriptors. */
{
struct stat statbuf;
errno = 0;
ASSERT (fstat (-1, &statbuf) == -1);
ASSERT (errno == EBADF);
}
{
struct stat statbuf;
close (99);
errno = 0;
ASSERT (fstat (99, &statbuf) == -1);
ASSERT (errno == EBADF);
}
return 0;
}
|
//* This file is part of the MOOSE framework
//* https://www.mooseframework.org
//*
//* All rights reserved, see COPYRIGHT for full restrictions
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
//*
//* Licensed under LGPL 2.1, please see LICENSE for details
//* https://www.gnu.org/licenses/lgpl-2.1.html
#pragma once
#include "PorousFlowDiffusivityBase.h"
/// Material designed to provide constant tortuosity and diffusion coefficents
class PorousFlowDiffusivityConst : public PorousFlowDiffusivityBase
{
public:
static InputParameters validParams();
PorousFlowDiffusivityConst(const InputParameters & parameters);
protected:
virtual void computeQpProperties() override;
/// Input tortuosity
const std::vector<Real> _input_tortuosity;
};
|
/* ------------------------------------------------------------------ */
/* Decimal Number Library Demonstration program */
/* ------------------------------------------------------------------ */
/* Copyright (c) IBM Corporation, 2001. All rights reserved. */
/* ----------------------------------------------------------------+- */
/* right margin -->| */
// example4.c -- add two numbers, active error handling
// Arguments are two numbers
#define DECNUMDIGITS 38 // work with up to 38 digits
#include "decNumber.h" // base number library
#include <stdio.h> // for printf
// [snip...
#include <signal.h> // signal handling
#include <setjmp.h> // setjmp/longjmp
jmp_buf preserve; // stack snapshot
void signalHandler(int); // prototype for GCC
void signalHandler(int sig) {
signal(SIGFPE, signalHandler); // re-enable
longjmp(preserve, sig); // branch to preserved point
}
// ...snip]
int main(int argc, char *argv[]) {
decNumber a, b; // working numbers
decContext set; // working context
char string[DECNUMDIGITS+14]; // conversion buffer
int value; // work variable
if (argc<3) { // not enough words
printf("Please supply two numbers to add.\n");
return 1;
}
decContextDefault(&set, DEC_INIT_BASE); // initialize
// [snip...
signal(SIGFPE, signalHandler); // set up signal handler
value=setjmp(preserve); // preserve and test environment
if (value) { // (non-0 after longjmp)
set.status &= DEC_Errors; // keep only errors
printf("Signal trapped [%s].\n", decContextStatusToString(&set));
return 1;
}
// ...snip]
// [change from Example 1, here]
// leave traps enabled
set.digits=DECNUMDIGITS; // set precision
decNumberFromString(&a, argv[1], &set);
decNumberFromString(&b, argv[2], &set);
decNumberAdd(&a, &a, &b, &set); // A=A+B
decNumberToString(&a, string);
printf("%s + %s => %s\n", argv[1], argv[2], string);
return 0;
} // main
|
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MBED_DIGITALOUT_H
#define MBED_DIGITALOUT_H
#include "platform.h"
#include "gpio_api.h"
#include "critical.h"
namespace mbed {
/** A digital output, used for setting the state of a pin
*
* @Note Synchronization level: Interrupt safe
*
* Example:
* @code
* // Toggle a LED
* #include "mbed.h"
*
* DigitalOut led(LED1);
*
* int main() {
* while(1) {
* led = !led;
* wait(0.2);
* }
* }
* @endcode
*/
class DigitalOut {
public:
/** Create a DigitalOut connected to the specified pin
*
* @param pin DigitalOut pin to connect to
*/
DigitalOut(PinName pin) : gpio() {
// No lock needed in the constructor
gpio_init_out(&gpio, pin);
}
/** Create a DigitalOut connected to the specified pin
*
* @param pin DigitalOut pin to connect to
* @param value the initial pin value
*/
DigitalOut(PinName pin, int value) : gpio() {
// No lock needed in the constructor
gpio_init_out_ex(&gpio, pin, value);
}
/** Set the output, specified as 0 or 1 (int)
*
* @param value An integer specifying the pin output value,
* 0 for logical 0, 1 (or any other non-zero value) for logical 1
*/
void write(int value) {
// Thread safe / atomic HAL call
gpio_write(&gpio, value);
}
/** Return the output setting, represented as 0 or 1 (int)
*
* @returns
* an integer representing the output setting of the pin,
* 0 for logical 0, 1 for logical 1
*/
int read() {
// Thread safe / atomic HAL call
return gpio_read(&gpio);
}
/** Return the output setting, represented as 0 or 1 (int)
*
* @returns
* Non zero value if pin is connected to uc GPIO
* 0 if gpio object was initialized with NC
*/
int is_connected() {
// Thread safe / atomic HAL call
return gpio_is_connected(&gpio);
}
/** A shorthand for write()
*/
DigitalOut& operator= (int value) {
// Underlying write is thread safe
write(value);
return *this;
}
DigitalOut& operator= (DigitalOut& rhs) {
core_util_critical_section_enter();
write(rhs.read());
core_util_critical_section_exit();
return *this;
}
/** A shorthand for read()
*/
operator int() {
// Underlying call is thread safe
return read();
}
protected:
gpio_t gpio;
};
} // namespace mbed
#endif
|
#ifndef __DATA_MATRIX_READER_H__
#define __DATA_MATRIX_READER_H__
/*
* DataMatrixReader.h
* zxing
*
* Created by Luiz Silva on 09/02/2010.
* Copyright 2010 ZXing authors All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <zxing/Reader.h>
#include <zxing/DecodeHints.h>
#include <zxing/datamatrix/decoder/Decoder.h>
namespace zxing {
namespace datamatrix {
class DataMatrixReader : public Reader {
private:
Decoder decoder_;
public:
DataMatrixReader();
virtual Ref<Result> decode(Ref<BinaryBitmap> image, DecodeHints hints);
virtual ~DataMatrixReader();
};
}
}
#endif // __DATA_MATRIX_READER_H__
|
//
// PatternFormatterTest.h
//
// $Id: //poco/1.4/Foundation/testsuite/src/PatternFormatterTest.h#1 $
//
// Definition of the PatternFormatterTest class.
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef PatternFormatterTest_INCLUDED
#define PatternFormatterTest_INCLUDED
#include "Poco/Foundation.h"
#include "CppUnit/TestCase.h"
class PatternFormatterTest: public CppUnit::TestCase
{
public:
PatternFormatterTest(const std::string& name);
~PatternFormatterTest();
void testPatternFormatter();
void setUp();
void tearDown();
static CppUnit::Test* suite();
private:
};
#endif // PatternFormatterTest_INCLUDED
|
/*
* This test file is used to verify that the header files associated with
* invoking this function are correct.
*
* COPYRIGHT (c) 1989-2009.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.org/license/LICENSE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <pthread.h>
#ifndef _POSIX_THREADS
#error "rtems is supposed to have pthread_mutexattr_getpshared"
#endif
#ifndef _POSIX_THREAD_PROCESS_SHARED
#error "rtems is supposed to have pthread_mutexattr_setpshared"
#endif
int test( void );
int test( void )
{
pthread_mutexattr_t attribute;
int pshared;
int result;
result = pthread_mutexattr_getpshared( &attribute, &pshared );
return result;
}
|
/**********************************************************************
Copyright (c) 1997,8,9 Immersion Corporation
Permission to use, copy, modify, distribute, and sell this
software and its documentation may be granted without fee;
interested parties are encouraged to request permission from
Immersion Corporation
2158 Paragon Drive
San Jose, CA 95131
408-467-1900
IMMERSION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
IN NO EVENT SHALL IMMERSION BE LIABLE FOR ANY SPECIAL, INDIRECT OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
FILE: FFC.h
PURPOSE: Class Types for the Force Foundation Classes
STARTED: 10/29/97
NOTES/REVISIONS:
3/2/99 jrm (Jeff Mallett): Force-->Feel renaming
**********************************************************************/
#if !defined(AFX_FFC_H__135B88C4_4175_11D1_B049_0020AF30269A__INCLUDED_)
#define AFX_FFC_H__135B88C4_4175_11D1_B049_0020AF30269A__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include "FeelBox.h"
#include "FeelCondition.h"
#include "FeelConstant.h"
#include "FeelDamper.h"
#include "FeelDevice.h"
#include "FeelDXDevice.h"
#include "FeelEffect.h"
#include "FeelEllipse.h"
#include "FeelEnclosure.h"
#include "FeelMouse.h"
#include "FeelFriction.h"
#include "FeelGrid.h"
#include "FeelInertia.h"
#include "FeelPeriodic.h"
#include "FeelProjects.h"
#include "FeelRamp.h"
#include "FeelSpring.h"
#include "FeelTexture.h"
#include "FFCErrors.h"
#endif // !defined(AFX_FFC_H__135B88C4_4175_11D1_B049_0020AF30269A__INCLUDED_)
|
/***************************************************************
* Name: codestat.h
* Purpose: Code::Blocks CodeStat plugin: main functions
* Author: Zlika
* Created: 11/09/2005
* Copyright: (c) Zlika
* License: GPL
**************************************************************/
#ifndef CODESTAT_H
#define CODESTAT_H
#include "cbplugin.h" // the base class we 're inheriting
class cbConfigurationPanel;
class CodeStatExecDlg;
class wxWindow;
/** Main class for the Code Statistics plugin.
* @see CodeStatConfigDlg, CodeStatExecDlg, LanguageDef
*/
class CodeStat : public cbToolPlugin
{
public:
CodeStat();
~CodeStat();
int GetConfigurationGroup() const { return cgEditor; }
cbConfigurationPanel* GetConfigurationPanel(wxWindow* parent);
int Execute();
void OnAttach(); // fires when the plugin is attached to the application
void OnRelease(bool appShutDown); // fires when the plugin is released from the application
private:
CodeStatExecDlg* m_dlg;
};
#endif // CODESTAT_H
|
/***************************************************************************
* Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef Fem_FemMeshShapeObject_H
#define Fem_FemMeshShapeObject_H
#include "FemMeshObject.h"
namespace Fem
{
class AppFemExport FemMeshShapeObject : public FemMeshObject
{
PROPERTY_HEADER(Fem::FemMeshShapeObject);
public:
/// Constructor
FemMeshShapeObject(void);
virtual ~FemMeshShapeObject();
/// returns the type name of the ViewProvider
virtual const char* getViewProviderName(void) const {
return "FemGui::ViewProviderFemMeshShape";
}
virtual App::DocumentObjectExecReturn *execute(void);
//virtual short mustExecute(void) const;
//virtual PyObject *getPyObject(void);
App::PropertyLink Shape;
protected:
/// get called by the container when a property has changed
//virtual void onChanged (const App::Property* prop);
};
} //namespace Fem
#endif // Fem_FemMeshShapeObject_H
|
/*
* Copyright 2013 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef GrSimpleTextureEffect_DEFINED
#define GrSimpleTextureEffect_DEFINED
#include "GrSingleTextureEffect.h"
class GrGLSimpleTextureEffect;
/**
* The output color of this effect is a modulation of the input color and a sample from a texture.
* It allows explicit specification of the filtering and wrap modes (GrTextureParams). It can use
* local coords, positions, or a custom vertex attribute as input texture coords. The input coords
* can have a matrix applied in the VS in both the local and position cases but not with a custom
* attribute coords at this time. It will add a varying to input interpolate texture coords to the
* FS.
*/
class GrSimpleTextureEffect : public GrSingleTextureEffect {
public:
/* unfiltered, clamp mode */
static GrFragmentProcessor* Create(GrTexture* tex,
const SkMatrix& matrix,
GrCoordSet coordSet = kLocal_GrCoordSet) {
return SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, GrTextureParams::kNone_FilterMode,
coordSet));
}
/* clamp mode */
static GrFragmentProcessor* Create(GrTexture* tex,
const SkMatrix& matrix,
GrTextureParams::FilterMode filterMode,
GrCoordSet coordSet = kLocal_GrCoordSet) {
return SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, filterMode, coordSet));
}
static GrFragmentProcessor* Create(GrTexture* tex,
const SkMatrix& matrix,
const GrTextureParams& p,
GrCoordSet coordSet = kLocal_GrCoordSet) {
return SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, p, coordSet));
}
virtual ~GrSimpleTextureEffect() {}
static const char* Name() { return "Texture"; }
virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE;
typedef GrGLSimpleTextureEffect GLProcessor;
virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERRIDE;
private:
GrSimpleTextureEffect(GrTexture* texture,
const SkMatrix& matrix,
GrTextureParams::FilterMode filterMode,
GrCoordSet coordSet)
: GrSingleTextureEffect(texture, matrix, filterMode, coordSet) {
}
GrSimpleTextureEffect(GrTexture* texture,
const SkMatrix& matrix,
const GrTextureParams& params,
GrCoordSet coordSet)
: GrSingleTextureEffect(texture, matrix, params, coordSet) {
}
virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE {
const GrSimpleTextureEffect& ste = other.cast<GrSimpleTextureEffect>();
return this->hasSameTextureParamsMatrixAndSourceCoords(ste);
}
GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
typedef GrSingleTextureEffect INHERITED;
};
#endif
|
/* { dg-do compile } */
/* { dg-mips-options "-march=vr4130 -mgp64 -mfix-vr4130" } */
long long foo (void) { long long r; asm ("# foo" : "=l" (r)); return r; }
/* { dg-final { scan-assembler "\tdmacc\t" } } */
|
/****************************************************************************
Copyright (c) 2014-2015 Chukong Technologies
****************************************************************************/
#ifndef _CC_SDKBOX_H_
#define _CC_SDKBOX_H_
#define SDKBOX_VERSION_STR "sdkbox V1.5.0.3"
namespace sdkbox {
void init( const char* application_token, const char* application_key );
void init( const char* application_token, const char* application_key, bool debug );
void setProjectType(const char* project_type);
void sessionStart();
void sessionEnd();
}
#endif//_CC_SDKBOX_H_
|
/* htsfile.c -- file identifier and minimal viewer.
Copyright (C) 2014-2015 Genome Research Ltd.
Author: John Marshall <jm18@sanger.ac.uk>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE. */
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>
#include <unistd.h>
#include "htslib/hfile.h"
#include "htslib/hts.h"
#include "htslib/sam.h"
#include "htslib/vcf.h"
enum { identify, view_headers, view_all } mode = identify;
int show_headers = 1;
static htsFile *dup_stdout(const char *mode)
{
int fd = dup(STDOUT_FILENO);
hFILE *hfp = (fd >= 0)? hdopen(fd, mode) : NULL;
return hfp? hts_hopen(hfp, "-", mode) : NULL;
}
static int view_sam(hFILE *hfp, const char *filename)
{
samFile *in = hts_hopen(hfp, filename, "r");
if (in == NULL) return 0;
samFile *out = dup_stdout("w");
bam_hdr_t *hdr = sam_hdr_read(in);
if (show_headers) sam_hdr_write(out, hdr);
if (mode == view_all) {
bam1_t *b = bam_init1();
while (sam_read1(in, hdr, b) >= 0)
sam_write1(out, hdr, b);
bam_destroy1(b);
}
bam_hdr_destroy(hdr);
hts_close(out);
hts_close(in);
return 1;
}
static int view_vcf(hFILE *hfp, const char *filename)
{
vcfFile *in = hts_hopen(hfp, filename, "r");
if (in == NULL) return 0;
vcfFile *out = dup_stdout("w");
bcf_hdr_t *hdr = bcf_hdr_read(in);
if (show_headers) bcf_hdr_write(out, hdr);
if (mode == view_all) {
bcf1_t *rec = bcf_init();
while (bcf_read(in, hdr, rec) >= 0)
bcf_write(out, hdr, rec);
bcf_destroy(rec);
}
bcf_hdr_destroy(hdr);
hts_close(out);
hts_close(in);
return 1;
}
static void usage(FILE *fp, int status)
{
fprintf(fp,
"Usage: htsfile [-chH] FILE...\n"
"Options:\n"
" -c, --view Write textual form of FILEs to standard output\n"
" -h, --header-only Display only headers in view mode, not records\n"
" -H, --no-header Suppress header display in view mode\n");
exit(status);
}
int main(int argc, char **argv)
{
static const struct option options[] = {
{ "header-only", no_argument, NULL, 'h' },
{ "no-header", no_argument, NULL, 'H' },
{ "view", no_argument, NULL, 'c' },
{ "help", no_argument, NULL, '?' },
{ "version", no_argument, NULL, 1 },
{ NULL, 0, NULL, 0 }
};
int status = EXIT_SUCCESS;
int c, i;
while ((c = getopt_long(argc, argv, "chH?", options, NULL)) >= 0)
switch (c) {
case 'c': mode = view_all; break;
case 'h': mode = view_headers; show_headers = 1; break;
case 'H': show_headers = 0; break;
case 1:
printf(
"htsfile (htslib) %s\n"
"Copyright (C) 2015 Genome Research Ltd.\n",
hts_version());
exit(EXIT_SUCCESS);
break;
case '?': usage(stdout, EXIT_SUCCESS); break;
default: usage(stderr, EXIT_FAILURE); break;
}
if (optind == argc) usage(stderr, EXIT_FAILURE);
for (i = optind; i < argc; i++) {
htsFormat fmt;
hFILE *fp = hopen(argv[i], "r");
if (fp == NULL) {
fprintf(stderr, "htsfile: can't open \"%s\": %s\n", argv[i], strerror(errno));
status = EXIT_FAILURE;
continue;
}
if (hts_detect_format(fp, &fmt) < 0) {
fprintf(stderr, "htsfile: detecting \"%s\" format failed: %s\n", argv[i], strerror(errno));
hclose_abruptly(fp);
status = EXIT_FAILURE;
continue;
}
if (mode == identify) {
char *description = hts_format_description(&fmt);
printf("%s:\t%s\n", argv[i], description);
free(description);
}
else
switch (fmt.category) {
case sequence_data: if (view_sam(fp, argv[i])) fp = NULL; break;
case variant_data: if (view_vcf(fp, argv[i])) fp = NULL; break;
default:
fprintf(stderr, "htsfile: can't view %s: unknown format\n", argv[i]);
status = EXIT_FAILURE;
break;
}
if (fp && hclose(fp) < 0) {
fprintf(stderr, "htsfile: closing %s failed\n", argv[i]);
status = EXIT_FAILURE;
}
}
return status;
}
|
/*
* mms_ts.h - Platform data for Melfas MMS-series touch driver
*
* Copyright (C) 2011 Google Inc.
* Author: Dima Zavin <dima@android.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.
*
*/
#ifndef _LINUX_MMS_TOUCH_H
#define _LINUX_MMS_TOUCH_H
#define MELFAS_TS_NAME "melfas-ts"
#define TOUCHKEY 1
struct melfas_tsi_platform_data {
int gpio_int;
int gpio_sda;
int gpio_scl;
int (*power) (bool on);
int (*is_vdd_on) (void);
int max_x;
int max_y;
const char *fw_name;
bool touchkey;
const u8 *touchkey_keycode;
void (*input_event) (void *data);
void (*register_cb) (void *);
#if TOUCHKEY
int (*keyled) (bool on);
#endif
u8 panel;
};
extern struct class *sec_class;
void tsp_charger_infom(bool en);
#endif /* _LINUX_MMS_TOUCH_H */
|
/* Query filename corresponding to an open FD. Linux version.
Copyright (C) 2001-2014 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <_itoa.h>
static inline const char *
fd_to_filename (int fd)
{
char *ret = malloc (30);
if (ret != NULL)
{
struct stat64 st;
*_fitoa_word (fd, __stpcpy (ret, "/proc/self/fd/"), 10, 0) = '\0';
/* We must make sure the file exists. */
if (__lxstat64 (_STAT_VER, ret, &st) < 0)
{
/* /proc is not mounted or something else happened. Don't
return the file name. */
free (ret);
ret = NULL;
}
}
return ret;
}
|
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
*
* gimpbrushselect_pdb.c
*
* 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 3 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, see
* <http://www.gnu.org/licenses/>.
*/
/* NOTE: This file is auto-generated by pdbgen.pl */
#include "config.h"
#include "gimp.h"
/**
* SECTION: gimpbrushselect
* @title: gimpbrushselect
* @short_description: Functions providing a brush selection dialog.
*
* Functions providing a brush selection dialog.
**/
/**
* gimp_brushes_popup:
* @brush_callback: The callback PDB proc to call when brush selection is made.
* @popup_title: Title of the brush selection dialog.
* @initial_brush: The name of the brush to set as the first selected.
* @opacity: The initial opacity of the brush.
* @spacing: The initial spacing of the brush (if < 0 then use brush default spacing).
* @paint_mode: The initial paint mode.
*
* Invokes the Gimp brush selection.
*
* This procedure opens the brush selection dialog.
*
* Returns: TRUE on success.
**/
gboolean
gimp_brushes_popup (const gchar *brush_callback,
const gchar *popup_title,
const gchar *initial_brush,
gdouble opacity,
gint spacing,
GimpLayerModeEffects paint_mode)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-brushes-popup",
&nreturn_vals,
GIMP_PDB_STRING, brush_callback,
GIMP_PDB_STRING, popup_title,
GIMP_PDB_STRING, initial_brush,
GIMP_PDB_FLOAT, opacity,
GIMP_PDB_INT32, spacing,
GIMP_PDB_INT32, paint_mode,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_brushes_close_popup:
* @brush_callback: The name of the callback registered for this pop-up.
*
* Close the brush selection dialog.
*
* This procedure closes an opened brush selection dialog.
*
* Returns: TRUE on success.
**/
gboolean
gimp_brushes_close_popup (const gchar *brush_callback)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-brushes-close-popup",
&nreturn_vals,
GIMP_PDB_STRING, brush_callback,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
/**
* gimp_brushes_set_popup:
* @brush_callback: The name of the callback registered for this pop-up.
* @brush_name: The name of the brush to set as selected.
* @opacity: The initial opacity of the brush.
* @spacing: The initial spacing of the brush (if < 0 then use brush default spacing).
* @paint_mode: The initial paint mode.
*
* Sets the current brush in a brush selection dialog.
*
* Sets the current brush in a brush selection dialog.
*
* Returns: TRUE on success.
**/
gboolean
gimp_brushes_set_popup (const gchar *brush_callback,
const gchar *brush_name,
gdouble opacity,
gint spacing,
GimpLayerModeEffects paint_mode)
{
GimpParam *return_vals;
gint nreturn_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-brushes-set-popup",
&nreturn_vals,
GIMP_PDB_STRING, brush_callback,
GIMP_PDB_STRING, brush_name,
GIMP_PDB_FLOAT, opacity,
GIMP_PDB_INT32, spacing,
GIMP_PDB_INT32, paint_mode,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
return success;
}
|
/****************************************************************************
* configs/pcblogic-pic32mx/include/board.h
* include/arch/board/board.h
*
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX 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 __CONFIGS_PCBLOGIC_PIC32MX_INCLUDE_BOARD_H
#define __CONFIGS_PCBLOGIC_PIC32MX_INCLUDE_BOARD_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
/****************************************************************************
* Pre-Processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
/* Clocking *****************************************************************/
/* Crystal frequencies */
#define BOARD_POSC_FREQ 8000000 /* Primary OSC XTAL frequency (8MHz) */
#define BOARD_SOSC_FREQ 32768 /* Secondary OSC XTAL frequency (32.768KHz) */
/* Oscillator modes */
#define BOARD_FNOSC_POSCPLL 1 /* Use primary oscillator w/PLL */
#define BOARD_POSC_HSMODE 1 /* High-speed crystal (HS) mode */
/* PLL configuration and resulting CPU clock.
* CPU_CLOCK = ((POSC_FREQ / IDIV) * MULT) / ODIV
*/
#define BOARD_PLL_INPUT BOARD_POSC_FREQ
#define BOARD_PLL_IDIV 2 /* PLL input divider */
#define BOARD_PLL_MULT 20 /* PLL multiplier */
#define BOARD_PLL_ODIV 1 /* PLL output divider */
#define BOARD_CPU_CLOCK 80000000 /* CPU clock (80MHz = 8MHz * 20 / 2) */
/* USB PLL configuration.
* USB_CLOCK = ((POSC_XTAL / IDIV) * 24) / 2
*/
#define BOARD_UPLL_IDIV 2 /* USB PLL divider (revisit) */
#define BOARD_USB_CLOCK 48000000 /* USB clock (8MHz / 2) * 24 / 2) */
/* Peripheral clock is divided down from CPU clock.
* PBCLOCK = CPU_CLOCK / PBDIV
*/
#define BOARD_PBDIV 2 /* Peripheral clock divisor (PBDIV) */
#define BOARD_PBCLOCK 40000000 /* Peripheral clock (PBCLK = 80MHz/2) */
/* Watchdog pre-scaler (re-visit) */
#define BOARD_WD_ENABLE 0 /* Watchdog is disabled */
#define BOARD_WD_PRESCALER 8 /* Watchdog pre-scaler */
/* LED definitions **********************************************************/
#define LED_STARTED 0
#define LED_HEAPALLOCATE 1
#define LED_IRQSENABLED 2
#define LED_STACKCREATED 3
#define LED_INIRQ 4
#define LED_SIGNAL 5
#define LED_ASSERTION 6
#define LED_PANIC 7
/****************************************************************************
* Public Types
****************************************************************************/
#ifndef __ASSEMBLY__
/****************************************************************************
* Inline Functions
****************************************************************************/
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#ifdef __cplusplus
#define EXTERN extern "C"
extern "C" {
#else
#define EXTERN extern
#endif
#undef EXTERN
#ifdef __cplusplus
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* __CONFIGS_PCBLOGIC_PIC32MX_INCLUDE_BOARD_H */
|
/*
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
/*!\defgroup vp8 VP8
* \ingroup codecs
* VP8 is vpx's newest video compression algorithm that uses motion
* compensated prediction, Discrete Cosine Transform (DCT) coding of the
* prediction error signal and context dependent entropy coding techniques
* based on arithmetic principles. It features:
* - YUV 4:2:0 image format
* - Macro-block based coding (16x16 luma plus two 8x8 chroma)
* - 1/4 (1/8) pixel accuracy motion compensated prediction
* - 4x4 DCT transform
* - 128 level linear quantizer
* - In loop deblocking filter
* - Context-based entropy coding
*
* @{
*/
/*!\file
* \brief Provides controls common to both the VP8 encoder and decoder.
*/
#ifndef VP8_H
#define VP8_H
#include "vpx/vpx_codec_impl_top.h"
/*!\brief Control functions
*
* The set of macros define the control functions of VP8 interface
*/
enum vp8_com_control_id
{
VP8_SET_REFERENCE = 1, /**< pass in an external frame into decoder to be used as reference frame */
VP8_COPY_REFERENCE = 2, /**< get a copy of reference frame from the decoder */
VP8_SET_POSTPROC = 3, /**< set the decoder's post processing settings */
VP8_SET_DBG_COLOR_REF_FRAME = 4, /**< set the reference frames to color for each macroblock */
VP8_SET_DBG_COLOR_MB_MODES = 5, /**< set which macro block modes to color */
VP8_SET_DBG_COLOR_B_MODES = 6, /**< set which blocks modes to color */
VP8_SET_DBG_DISPLAY_MV = 7, /**< set which motion vector modes to draw */
VP8_COMMON_CTRL_ID_MAX,
VP8_DECODER_CTRL_ID_START = 256,
};
/*!\brief post process flags
*
* The set of macros define VP8 decoder post processing flags
*/
enum vp8_postproc_level
{
VP8_NOFILTERING = 0,
VP8_DEBLOCK = 1<<0,
VP8_DEMACROBLOCK = 1<<1,
VP8_ADDNOISE = 1<<2,
VP8_DEBUG_TXT_FRAME_INFO = 1<<3, /**< print frame information */
VP8_DEBUG_TXT_MBLK_MODES = 1<<4, /**< print macro block modes over each macro block */
VP8_DEBUG_TXT_DC_DIFF = 1<<5, /**< print dc diff for each macro block */
VP8_DEBUG_TXT_RATE_INFO = 1<<6, /**< print video rate info (encoder only) */
};
/*!\brief post process flags
*
* This define a structure that describe the post processing settings. For
* the best objective measure (using the PSNR metric) set post_proc_flag
* to VP8_DEBLOCK and deblocking_level to 1.
*/
typedef struct vp8_postproc_cfg
{
int post_proc_flag; /**< the types of post processing to be done, should be combination of "vp8_postproc_level" */
int deblocking_level; /**< the strength of deblocking, valid range [0, 16] */
int noise_level; /**< the strength of additive noise, valid range [0, 16] */
} vp8_postproc_cfg_t;
/*!\brief reference frame type
*
* The set of macros define the type of VP8 reference frames
*/
typedef enum vpx_ref_frame_type
{
VP8_LAST_FRAME = 1,
VP8_GOLD_FRAME = 2,
VP8_ALTR_FRAME = 4
} vpx_ref_frame_type_t;
/*!\brief reference frame data struct
*
* define the data struct to access vp8 reference frames
*/
typedef struct vpx_ref_frame
{
vpx_ref_frame_type_t frame_type; /**< which reference frame */
vpx_image_t img; /**< reference frame data in image format */
} vpx_ref_frame_t;
/*!\brief vp8 decoder control function parameter type
*
* defines the data type for each of VP8 decoder control function requires
*/
VPX_CTRL_USE_TYPE(VP8_SET_REFERENCE, vpx_ref_frame_t *)
VPX_CTRL_USE_TYPE(VP8_COPY_REFERENCE, vpx_ref_frame_t *)
VPX_CTRL_USE_TYPE(VP8_SET_POSTPROC, vp8_postproc_cfg_t *)
VPX_CTRL_USE_TYPE(VP8_SET_DBG_COLOR_REF_FRAME, int)
VPX_CTRL_USE_TYPE(VP8_SET_DBG_COLOR_MB_MODES, int)
VPX_CTRL_USE_TYPE(VP8_SET_DBG_COLOR_B_MODES, int)
VPX_CTRL_USE_TYPE(VP8_SET_DBG_DISPLAY_MV, int)
/*! @} - end defgroup vp8 */
#if !defined(VPX_CODEC_DISABLE_COMPAT) || !VPX_CODEC_DISABLE_COMPAT
/* The following definitions are provided for backward compatibility with
* the VP8 1.0.x SDK. USE IN PRODUCTION CODE IS NOT RECOMMENDED.
*/
DECLSPEC_DEPRECATED extern vpx_codec_iface_t vpx_codec_vp8_algo DEPRECATED;
#endif
#include "vpx/vpx_codec_impl_bottom.h"
#endif
|
/*
*
* University of Luxembourg
* Laboratory of Algorithmics, Cryptology and Security (LACS)
*
* FELICS - Fair Evaluation of Lightweight Cryptographic Systems
*
* Copyright (C) 2015 University of Luxembourg
*
* Written in 2015 by Yann Le Corre <yann.lecorre@uni.lu>
*
* This file is part of FELICS.
*
* FELICS 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.
*
* FELICS 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 DATA_TYPES_H
#define DATA_TYPES_H
#include "cipher.h"
/*
*
* Implementation data types
*
*/
#if defined(PC) /* PC */
/* Architecture = PC ; Scenario = 0 (cipher operation) */
#if defined(SCENARIO) && (SCENARIO_0 == SCENARIO)
#endif
/* Architecture = PC ; Scenario = 1 */
#if defined(SCENARIO) && (SCENARIO_1 == SCENARIO)
#endif
/* Architecture = PC ; Scenario = 2 */
#if defined(SCENARIO) && (SCENARIO_2 == SCENARIO)
#endif
#endif /* PC */
#if defined(AVR) /* AVR */
/* Architecture = AVR ; Scenario = 0 (cipher operation) */
#if defined(SCENARIO) && (SCENARIO_0 == SCENARIO)
#endif
/* Architecture = AVR ; Scenario = 1 */
#if defined(SCENARIO) && (SCENARIO_1 == SCENARIO)
#endif
/* Architecture = AVR ; Scenario = 2 */
#if defined(SCENARIO) && (SCENARIO_2 == SCENARIO)
#endif
#endif /* AVR */
#if defined(MSP) /* MSP */
/* Architecture = MSP ; Scenario = 0 (cipher operation) */
#if defined(SCENARIO) && (SCENARIO_0 == SCENARIO)
#endif
/* Architecture = MSP ; Scenario = 1 */
#if defined(SCENARIO) && (SCENARIO_1 == SCENARIO)
#endif
/* Architecture = MSP ; Scenario = 2 */
#if defined(SCENARIO) && (SCENARIO_2 == SCENARIO)
#endif
#endif /* MSP */
#if defined(ARM) /* ARM */
/* Architecture = ARM ; Scenario = 0 (cipher operation) */
#if defined(SCENARIO) && (SCENARIO_0 == SCENARIO)
#endif
/* Architecture = ARM ; Scenario = 1 */
#if defined(SCENARIO) && (SCENARIO_1 == SCENARIO)
#endif
/* Architecture = ARM ; Scenario = 2 */
#if defined(SCENARIO) && (SCENARIO_2 == SCENARIO)
#endif
#endif /* ARM */
#endif /* DATA_TYPES_H */
|
#include <stdio.h>
void secondone();
void pair_stuff();
void pair_p_stuff();
void vcl_stuff();
#ifdef CMAKE_PAREN
void testOdd();
#endif
int main()
{
printf("Hello from subdirectory\n");
secondone();
#ifdef CMAKE_PAREN
testOdd();
#endif
pair_stuff();
pair_p_stuff();
vcl_stuff();
return 0;
}
|
/*
* arch/ppc/platforms/chrp_time.c
*
* Copyright (C) 1991, 1992, 1995 Linus Torvalds
*
* Adapted for PowerPC (PReP) by Gary Thomas
* Modified by Cort Dougan (cort@cs.nmt.edu).
* Copied and modified from arch/i386/kernel/time.c
*
*/
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/param.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/interrupt.h>
#include <linux/time.h>
#include <linux/timex.h>
#include <linux/kernel_stat.h>
#include <linux/mc146818rtc.h>
#include <linux/init.h>
#include <asm/segment.h>
#include <asm/io.h>
#include <asm/processor.h>
#include <asm/nvram.h>
#include <asm/prom.h>
#include <asm/sections.h>
#include <asm/time.h>
extern spinlock_t rtc_lock;
static int nvram_as1 = NVRAM_AS1;
static int nvram_as0 = NVRAM_AS0;
static int nvram_data = NVRAM_DATA;
long __init chrp_time_init(void)
{
struct device_node *rtcs;
int base;
rtcs = find_compatible_devices("rtc", "pnpPNP,b00");
if (rtcs == NULL || rtcs->addrs == NULL)
return 0;
base = rtcs->addrs[0].address;
nvram_as1 = 0;
nvram_as0 = base;
nvram_data = base + 1;
return 0;
}
int __chrp chrp_cmos_clock_read(int addr)
{
if (nvram_as1 != 0)
outb(addr>>8, nvram_as1);
outb(addr, nvram_as0);
return (inb(nvram_data));
}
void __chrp chrp_cmos_clock_write(unsigned long val, int addr)
{
if (nvram_as1 != 0)
outb(addr>>8, nvram_as1);
outb(addr, nvram_as0);
outb(val, nvram_data);
return;
}
/*
* Set the hardware clock. -- Cort
*/
int __chrp chrp_set_rtc_time(unsigned long nowtime)
{
unsigned char save_control, save_freq_select;
struct rtc_time tm;
spin_lock(&rtc_lock);
to_tm(nowtime, &tm);
save_control = chrp_cmos_clock_read(RTC_CONTROL); /* tell the clock it's being set */
chrp_cmos_clock_write((save_control|RTC_SET), RTC_CONTROL);
save_freq_select = chrp_cmos_clock_read(RTC_FREQ_SELECT); /* stop and reset prescaler */
chrp_cmos_clock_write((save_freq_select|RTC_DIV_RESET2), RTC_FREQ_SELECT);
tm.tm_year -= 1900;
if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
BIN_TO_BCD(tm.tm_sec);
BIN_TO_BCD(tm.tm_min);
BIN_TO_BCD(tm.tm_hour);
BIN_TO_BCD(tm.tm_mon);
BIN_TO_BCD(tm.tm_mday);
BIN_TO_BCD(tm.tm_year);
}
chrp_cmos_clock_write(tm.tm_sec,RTC_SECONDS);
chrp_cmos_clock_write(tm.tm_min,RTC_MINUTES);
chrp_cmos_clock_write(tm.tm_hour,RTC_HOURS);
chrp_cmos_clock_write(tm.tm_mon,RTC_MONTH);
chrp_cmos_clock_write(tm.tm_mday,RTC_DAY_OF_MONTH);
chrp_cmos_clock_write(tm.tm_year,RTC_YEAR);
/* The following flags have to be released exactly in this order,
* otherwise the DS12887 (popular MC146818A clone with integrated
* battery and quartz) will not reset the oscillator and will not
* update precisely 500 ms later. You won't find this mentioned in
* the Dallas Semiconductor data sheets, but who believes data
* sheets anyway ... -- Markus Kuhn
*/
chrp_cmos_clock_write(save_control, RTC_CONTROL);
chrp_cmos_clock_write(save_freq_select, RTC_FREQ_SELECT);
if ( (time_state == TIME_ERROR) || (time_state == TIME_BAD) )
time_state = TIME_OK;
spin_unlock(&rtc_lock);
return 0;
}
unsigned long __chrp chrp_get_rtc_time(void)
{
unsigned int year, mon, day, hour, min, sec;
int uip, i;
/* The Linux interpretation of the CMOS clock register contents:
* When the Update-In-Progress (UIP) flag goes from 1 to 0, the
* RTC registers show the second which has precisely just started.
* Let's hope other operating systems interpret the RTC the same way.
*/
/* Since the UIP flag is set for about 2.2 ms and the clock
* is typically written with a precision of 1 jiffy, trying
* to obtain a precision better than a few milliseconds is
* an illusion. Only consistency is interesting, this also
* allows to use the routine for /dev/rtc without a potential
* 1 second kernel busy loop triggered by any reader of /dev/rtc.
*/
for ( i = 0; i<1000000; i++) {
uip = chrp_cmos_clock_read(RTC_FREQ_SELECT);
sec = chrp_cmos_clock_read(RTC_SECONDS);
min = chrp_cmos_clock_read(RTC_MINUTES);
hour = chrp_cmos_clock_read(RTC_HOURS);
day = chrp_cmos_clock_read(RTC_DAY_OF_MONTH);
mon = chrp_cmos_clock_read(RTC_MONTH);
year = chrp_cmos_clock_read(RTC_YEAR);
uip |= chrp_cmos_clock_read(RTC_FREQ_SELECT);
if ((uip & RTC_UIP)==0) break;
}
if (!(chrp_cmos_clock_read(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD)
{
BCD_TO_BIN(sec);
BCD_TO_BIN(min);
BCD_TO_BIN(hour);
BCD_TO_BIN(day);
BCD_TO_BIN(mon);
BCD_TO_BIN(year);
}
if ((year += 1900) < 1970)
year += 100;
return mktime(year, mon, day, hour, min, sec);
}
void __init chrp_calibrate_decr(void)
{
struct device_node *cpu;
unsigned int freq, *fp;
if (via_calibrate_decr())
return;
/*
* The cpu node should have a timebase-frequency property
* to tell us the rate at which the decrementer counts.
*/
freq = 16666000; /* hardcoded default */
cpu = find_type_devices("cpu");
if (cpu != 0) {
fp = (unsigned int *)
get_property(cpu, "timebase-frequency", NULL);
if (fp != 0)
freq = *fp;
}
printk("time_init: decrementer frequency = %u.%.6u MHz\n",
freq/1000000, freq%1000000);
tb_ticks_per_jiffy = freq / HZ;
tb_to_us = mulhwu_scale_factor(freq, 1000000);
}
|
// 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 MOJO_BINDINGS_JS_WAITING_CALLBACK_H_
#define MOJO_BINDINGS_JS_WAITING_CALLBACK_H_
#include "gin/handle.h"
#include "gin/runner.h"
#include "gin/wrappable.h"
#include "mojo/public/c/environment/async_waiter.h"
#include "mojo/public/cpp/system/core.h"
namespace mojo {
namespace js {
class WaitingCallback : public gin::Wrappable<WaitingCallback> {
public:
static gin::WrapperInfo kWrapperInfo;
// Creates a new WaitingCallback.
static gin::Handle<WaitingCallback> Create(
v8::Isolate* isolate,
v8::Handle<v8::Function> callback,
mojo::Handle handle,
MojoHandleSignals signals);
// Cancels the callback. Does nothing if a callback is not pending. This is
// implicitly invoked from the destructor but can be explicitly invoked as
// necessary.
void Cancel();
private:
WaitingCallback(v8::Isolate* isolate, v8::Handle<v8::Function> callback);
virtual ~WaitingCallback();
// Callback from MojoAsyncWaiter. |closure| is the WaitingCallback.
static void CallOnHandleReady(void* closure, MojoResult result);
// Invoked from CallOnHandleReady() (CallOnHandleReady() must be static).
void OnHandleReady(MojoResult result);
base::WeakPtr<gin::Runner> runner_;
MojoAsyncWaitID wait_id_;
DISALLOW_COPY_AND_ASSIGN(WaitingCallback);
};
} // namespace js
} // namespace mojo
#endif // MOJO_BINDINGS_JS_WAITING_CALLBACK_H_
|
/**
******************************************************************************
* @file usbd_msc_core.h
* @author MCD Application Team
* @version V1.0.0
* @date 22-July-2011
* @brief header for the usbd_msc_core.c file
******************************************************************************
* @attention
*
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
* TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*
* <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2>
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef _USB_MSC_CORE_H_
#define _USB_MSC_CORE_H_
#include "usbd_ioreq.h"
/** @addtogroup USBD_MSC_BOT
* @{
*/
/** @defgroup USBD_MSC
* @brief This file is the Header file for USBD_msc.c
* @{
*/
/** @defgroup USBD_BOT_Exported_Defines
* @{
*/
#define BOT_GET_MAX_LUN 0xFE
#define BOT_RESET 0xFF
#define USB_MSC_CONFIG_DESC_SIZ 32
#define MSC_EPIN_SIZE *(uint16_t *)(((USB_OTG_CORE_HANDLE *)pdev)->dev.pConfig_descriptor + 22)
#define MSC_EPOUT_SIZE *(uint16_t *)(((USB_OTG_CORE_HANDLE *)pdev)->dev.pConfig_descriptor + 29)
/**
* @}
*/
/** @defgroup USB_CORE_Exported_Types
* @{
*/
extern USBD_Class_cb_TypeDef USBD_MSC_cb;
/**
* @}
*/
/**
* @}
*/
#endif // _USB_MSC_CORE_H_
/**
* @}
*/
/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
|
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// 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 _T3D_PHYSICS_PHYSICSPLAYER_H_
#define _T3D_PHYSICS_PHYSICSPLAYER_H_
#ifndef _T3D_PHYSICS_PHYSICSOBJECT_H_
#include "T3D/physics/physicsObject.h"
#endif
#ifndef _MMATH_H_
#include "math/mMath.h"
#endif
class CollisionList;
//struct ObjectRenderInst;
//class BaseMatInstance;
//class Player;
//class SceneState;
class SceneObject;
///
class PhysicsPlayer : public PhysicsObject
{
public:
PhysicsPlayer() {}
virtual ~PhysicsPlayer() {};
///
virtual void init( const char *type,
const Point3F &size,
F32 runSurfaceCos,
F32 stepHeight,
SceneObject *obj,
PhysicsWorld *world ) = 0;
virtual void findContact( SceneObject **contactObject,
VectorF *contactNormal,
Vector<SceneObject*> *outOverlapObjects ) const = 0;
virtual Point3F move( const VectorF &displacement, CollisionList &outCol ) = 0;
virtual bool testSpacials( const Point3F &nPos, const Point3F &nSize ) const = 0;
virtual void setSpacials( const Point3F &nPos, const Point3F &nSize ) = 0;
virtual void enableCollision() = 0;
virtual void disableCollision() = 0;
};
#endif // _T3D_PHYSICS_PHYSICSPLAYER_H_ |
/*
* hsi_driver_if.h
*
* Header for the HSI driver low level interface.
*
* Copyright (C) 2007-2008 Nokia Corporation. All rights reserved.
* Copyright (C) 2009 Texas Instruments, Inc.
*
* Author: Carlos Chinea <carlos.chinea@nokia.com>
* Author: Sebastien JAN <s-jan@ti.com>
*
* This package 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 PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef __HSI_DRIVER_IF_H__
#define __HSI_DRIVER_IF_H__
#include <linux/platform_device.h>
#include <linux/device.h>
#include <linux/clk.h>
#include <linux/notifier.h>
/* The number of ports handled by the driver (MAX:2). Reducing this value
* optimizes the driver memory footprint.
*/
#define HSI_MAX_PORTS 1
/* bit-field definition for allowed controller IDs and channels */
#define ANY_HSI_CONTROLLER -1
/* HSR special divisor values set to control the auto-divisor Rx mode */
#define HSI_HSR_DIVISOR_AUTO 0x1000 /* Activate auto Rx */
#define HSI_SSR_DIVISOR_USE_TIMEOUT 0x1001 /* De-activate auto-Rx (SSI) */
enum {
HSI_EVENT_BREAK_DETECTED = 0,
HSI_EVENT_ERROR,
HSI_EVENT_PRE_SPEED_CHANGE,
HSI_EVENT_POST_SPEED_CHANGE,
HSI_EVENT_CAWAKE_UP,
HSI_EVENT_CAWAKE_DOWN,
HSI_EVENT_HSR_DATAAVAILABLE,
};
enum {
HSI_IOCTL_ACWAKE_DOWN = 0, /* Unset HST ACWAKE line for channel */
HSI_IOCTL_ACWAKE_UP, /* Set HSI wakeup line (acwake) for channel */
HSI_IOCTL_SEND_BREAK, /* Send a HW BREAK frame in FRAME mode */
HSI_IOCTL_GET_ACWAKE, /* Get HST CAWAKE line status */
HSI_IOCTL_FLUSH_RX, /* Force the HSR to idle state */
HSI_IOCTL_FLUSH_TX, /* Force the HST to idle state */
HSI_IOCTL_GET_CAWAKE, /* Get CAWAKE (HSR) line status */
HSI_IOCTL_SET_RX, /* Set HSR configuration */
HSI_IOCTL_GET_RX, /* Get HSR configuration */
HSI_IOCTL_SET_TX, /* Set HST configuration */
HSI_IOCTL_GET_TX, /* Get HST configuration */
HSI_IOCTL_SW_RESET, /* Force a HSI SW RESET */
HSI_IOCTL_GET_FIFO_OCCUPANCY, /* Get amount of words in RX FIFO */
};
/* Forward references */
struct hsi_device;
struct hsi_channel;
/* DPS */
struct hst_ctx {
u32 mode;
u32 flow;
u32 frame_size;
u32 divisor;
u32 arb_mode;
u32 channels;
};
struct hsr_ctx {
u32 mode;
u32 flow;
u32 frame_size;
u32 divisor;
u32 counters;
u32 channels;
};
struct port_ctx {
u32 sys_mpu_enable[2];
struct hst_ctx hst;
struct hsr_ctx hsr;
};
/**
* struct ctrl_ctx - hsi controller regs context
* @sysconfig: keeps HSI_SYSCONFIG reg state
* @gdd_gcr: keeps DMA_GCR reg state
* @dll: keeps HSR_DLL state
* @pctx: array of port context
*/
struct ctrl_ctx {
u32 sysconfig;
u32 gdd_gcr;
u32 dll;
struct port_ctx *pctx;
};
/* END DPS */
/**
* struct hsi_device - HSI device object (Virtual)
* @n_ctrl: associated HSI controller platform id number
* @n_p: port number
* @n_ch: channel number
* @ch: channel descriptor
* @device: associated device
*/
struct hsi_device {
int n_ctrl;
unsigned int n_p;
unsigned int n_ch;
struct hsi_channel *ch;
struct device device;
};
#define to_hsi_device(dev) container_of(dev, struct hsi_device, device)
/**
* struct hsi_device_driver - HSI driver instance container
* @ctrl_mask: bit-field indicating the supported HSI device ids
* @ch_mask: bit-field indicating enabled channels for this port
* @probe: probe callback (driver registering)
* @remove: remove callback (driver un-registering)
* @suspend: suspend callback
* @resume: resume callback
* @driver: associated device_driver object
*/
struct hsi_device_driver {
unsigned long ctrl_mask;
unsigned long ch_mask[HSI_MAX_PORTS];
int (*probe) (struct hsi_device *dev);
int (*remove) (struct hsi_device *dev);
int (*suspend) (struct hsi_device *dev, pm_message_t mesg);
int (*resume) (struct hsi_device *dev);
struct device_driver driver;
};
#define to_hsi_device_driver(drv) container_of(drv, \
struct hsi_device_driver, \
driver)
int hsi_register_driver(struct hsi_device_driver *driver);
void hsi_unregister_driver(struct hsi_device_driver *driver);
int hsi_open(struct hsi_device *dev);
int hsi_write(struct hsi_device *dev, u32 *addr, unsigned int size);
int hsi_write_cancel(struct hsi_device *dev);
int hsi_read(struct hsi_device *dev, u32 *addr, unsigned int size);
int hsi_read_cancel(struct hsi_device *dev);
int hsi_poll(struct hsi_device *dev);
int hsi_unpoll(struct hsi_device *dev);
int hsi_ioctl(struct hsi_device *dev, unsigned int command, void *arg);
void hsi_close(struct hsi_device *dev);
void hsi_set_read_cb(struct hsi_device *dev,
void (*read_cb) (struct hsi_device *dev,
unsigned int size));
void hsi_set_write_cb(struct hsi_device *dev,
void (*write_cb) (struct hsi_device *dev,
unsigned int size));
void hsi_set_port_event_cb(struct hsi_device *dev,
void (*port_event_cb) (struct hsi_device *dev,
unsigned int event,
void *arg));
#endif /* __HSI_DRIVER_IF_H__ */
|
/*
* board.c
*
* Common board functions for AM33XX based boards
*
* Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.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.
*/
#include <common.h>
#include <asm/arch/cpu.h>
#include <asm/arch/hardware.h>
#include <asm/arch/omap.h>
#include <asm/arch/ddr_defs.h>
#include <asm/arch/clock.h>
#include <asm/arch/mmc_host_def.h>
#include <asm/arch/common_def.h>
#include <asm/io.h>
#include <asm/omap_common.h>
DECLARE_GLOBAL_DATA_PTR;
struct wd_timer *wdtimer = (struct wd_timer *)WDT_BASE;
struct gptimer *timer_base = (struct gptimer *)CONFIG_SYS_TIMERBASE;
struct uart_sys *uart_base = (struct uart_sys *)DEFAULT_UART_BASE;
/* UART Defines */
#ifdef CONFIG_SPL_BUILD
#define UART_RESET (0x1 << 1)
#define UART_CLK_RUNNING_MASK 0x1
#define UART_SMART_IDLE_EN (0x1 << 0x3)
#endif
/*
* early system init of muxing and clocks.
*/
void s_init(void)
{
/* WDT1 is already running when the bootloader gets control
* Disable it to avoid "random" resets
*/
writel(0xAAAA, &wdtimer->wdtwspr);
while (readl(&wdtimer->wdtwwps) != 0x0)
;
writel(0x5555, &wdtimer->wdtwspr);
while (readl(&wdtimer->wdtwwps) != 0x0)
;
#ifdef CONFIG_SPL_BUILD
/* Setup the PLLs and the clocks for the peripherals */
pll_init();
/* UART softreset */
u32 regVal;
enable_uart0_pin_mux();
regVal = readl(&uart_base->uartsyscfg);
regVal |= UART_RESET;
writel(regVal, &uart_base->uartsyscfg);
while ((readl(&uart_base->uartsyssts) &
UART_CLK_RUNNING_MASK) != UART_CLK_RUNNING_MASK)
;
/* Disable smart idle */
regVal = readl(&uart_base->uartsyscfg);
regVal |= UART_SMART_IDLE_EN;
writel(regVal, &uart_base->uartsyscfg);
/* Initialize the Timer */
init_timer();
preloader_console_init();
config_ddr();
#endif
/* Enable MMC0 */
enable_mmc0_pin_mux();
}
/* Initialize timer */
void init_timer(void)
{
/* Reset the Timer */
writel(0x2, (&timer_base->tscir));
/* Wait until the reset is done */
while (readl(&timer_base->tiocp_cfg) & 1)
;
/* Start the Timer */
writel(0x1, (&timer_base->tclr));
}
#if defined(CONFIG_OMAP_HSMMC) && !defined(CONFIG_SPL_BUILD)
int board_mmc_init(bd_t *bis)
{
return omap_mmc_init(0);
}
#endif
void setup_clocks_for_console(void)
{
/* Not yet implemented */
return;
}
|
/*
* ipstats data access header
*
* $Id$
*/
#ifndef NETSNMP_ACCESS_IPSTATS_H
#define NETSNMP_ACCESS_IPSTATS_H
# ifdef __cplusplus
extern "C" {
#endif
#define IPSYSTEMSTATSTABLE_HCINRECEIVES 1
#define IPSYSTEMSTATSTABLE_HCINOCTETS 2
#define IPSYSTEMSTATSTABLE_INHDRERRORS 3
#define IPSYSTEMSTATSTABLE_HCINNOROUTES 4
#define IPSYSTEMSTATSTABLE_INADDRERRORS 5
#define IPSYSTEMSTATSTABLE_INUNKNOWNPROTOS 6
#define IPSYSTEMSTATSTABLE_INTRUNCATEDPKTS 7
#define IPSYSTEMSTATSTABLE_HCINFORWDATAGRAMS 8
#define IPSYSTEMSTATSTABLE_REASMREQDS 9
#define IPSYSTEMSTATSTABLE_REASMOKS 10
#define IPSYSTEMSTATSTABLE_REASMFAILS 11
#define IPSYSTEMSTATSTABLE_INDISCARDS 12
#define IPSYSTEMSTATSTABLE_HCINDELIVERS 13
#define IPSYSTEMSTATSTABLE_HCOUTREQUESTS 14
#define IPSYSTEMSTATSTABLE_HCOUTNOROUTES 15
#define IPSYSTEMSTATSTABLE_HCOUTFORWDATAGRAMS 16
#define IPSYSTEMSTATSTABLE_HCOUTDISCARDS 17
#define IPSYSTEMSTATSTABLE_HCOUTFRAGREQDS 18
#define IPSYSTEMSTATSTABLE_HCOUTFRAGOKS 19
#define IPSYSTEMSTATSTABLE_HCOUTFRAGFAILS 20
#define IPSYSTEMSTATSTABLE_HCOUTFRAGCREATES 21
#define IPSYSTEMSTATSTABLE_HCOUTTRANSMITS 22
#define IPSYSTEMSTATSTABLE_HCOUTOCTETS 23
#define IPSYSTEMSTATSTABLE_HCINMCASTPKTS 24
#define IPSYSTEMSTATSTABLE_HCINMCASTOCTETS 25
#define IPSYSTEMSTATSTABLE_HCOUTMCASTPKTS 26
#define IPSYSTEMSTATSTABLE_HCOUTMCASTOCTETS 27
#define IPSYSTEMSTATSTABLE_HCINBCASTPKTS 28
#define IPSYSTEMSTATSTABLE_HCOUTBCASTPKTS 29
#define IPSYSTEMSTATSTABLE_DISCONTINUITYTIME 30
#define IPSYSTEMSTATSTABLE_REFRESHRATE 31
#define IPSYSTEMSTATSTABLE_LAST IPSYSTEMSTATSTABLE_REFRESHRATE
/**---------------------------------------------------------------------*/
/*
* structure definitions
*/
/*
* netsnmp_ipstats_entry
*/
typedef struct netsnmp_ipstats_s {
/* Columns of ipStatsTable. Some of them are HC for computation of the
* other columns, when underlying OS does not provide them.
* Always fill at least 32 bits, the table is periodically polled -> 32 bit
* overflow shall be detected and 64 bit value should be computed automatically. */
U64 HCInReceives;
U64 HCInOctets;
u_long InHdrErrors;
U64 HCInNoRoutes;
u_long InAddrErrors;
u_long InUnknownProtos;
u_long InTruncatedPkts;
/* optional, can be computed from HCInNoRoutes and HCOutForwDatagrams */
U64 HCInForwDatagrams;
u_long ReasmReqds;
u_long ReasmOKs;
u_long ReasmFails;
u_long InDiscards;
U64 HCInDelivers;
U64 HCOutRequests;
U64 HCOutNoRoutes;
U64 HCOutForwDatagrams;
U64 HCOutDiscards;
/* optional, can be computed from HCOutFragOKs + HCOutFragFails*/
U64 HCOutFragReqds;
U64 HCOutFragOKs;
U64 HCOutFragFails;
U64 HCOutFragCreates;
/* optional, can be computed from
* HCOutRequests +HCOutForwDatagrams + HCOutFragCreates
* - HCOutFragReqds - HCOutNoRoutes - HCOutDiscards */
U64 HCOutTransmits;
U64 HCOutOctets;
U64 HCInMcastPkts;
U64 HCInMcastOctets;
U64 HCOutMcastPkts;
U64 HCOutMcastOctets;
U64 HCInBcastPkts;
U64 HCOutBcastPkts;
/* Array of available columns.*/
int columnAvail[IPSYSTEMSTATSTABLE_LAST+1];
} netsnmp_ipstats;
# ifdef __cplusplus
}
#endif
#endif /* NETSNMP_ACCESS_IPSTATS_H */
|
#ifndef __SPARC_IPC_H__
#define __SPARC_IPC_H__
/*
* These are used to wrap system calls on the sparc.
*
* See arch/sparc/kernel/sys_sparc.c for ugly details..
*/
struct ipc_kludge {
struct msgbuf __user *msgp;
long msgtyp;
};
#define SEMOP 1
#define SEMGET 2
#define SEMCTL 3
#define SEMTIMEDOP 4
#define MSGSND 11
#define MSGRCV 12
#define MSGGET 13
#define MSGCTL 14
#define SHMAT 21
#define SHMDT 22
#define SHMGET 23
#define SHMCTL 24
/* Used by the DIPC package, try and avoid reusing it */
#define DIPC 25
#define IPCCALL(version,op) ((version)<<16 | (op))
#endif
|
/*
* Copyright (C) 2015 Martine Lenders <mlenders@inf.fu-berlin.de>
*
* 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.
*/
/**
* @defgroup net_ng_ethernet_hdr Ethernet header
* @ingroup net_ng_ethernet
* @brief Ethernet header
* @{
*
* @file
* @brief Ethernet header definitions
*
* @author Martine Lenders <mlenders@inf.fu-berlin.de>
*/
#ifndef NG_ETHERNET_HDR_H_
#define NG_ETHERNET_HDR_H_
#include <inttypes.h>
#include "byteorder.h"
#ifdef __cplusplus
extern "C" {
#endif
#define NG_ETHERNET_ADDR_LEN (6) /**< Length of an Ethernet address */
/**
* @brief Ethernet header
*/
typedef struct __attribute__((packed)) {
uint8_t dst[NG_ETHERNET_ADDR_LEN]; /**< destination address */
uint8_t src[NG_ETHERNET_ADDR_LEN]; /**< source address */
network_uint16_t type; /**< ether type (see @ref net_ng_ethertype) */
} ng_ethernet_hdr_t;
#ifdef __cplusplus
}
#endif
#endif /* NG_ETHERNET_HDR_H_ */
/**
* @}
*/
|
// Copyright 2012 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_ARM_FRAMES_ARM_H_
#define V8_ARM_FRAMES_ARM_H_
namespace v8 {
namespace internal {
// The ARM ABI does not specify the usage of register r9, which may be reserved
// as the static base or thread register on some platforms, in which case we
// leave it alone. Adjust the value of kR9Available accordingly:
const int kR9Available = 1; // 1 if available to us, 0 if reserved
// Register list in load/store instructions
// Note that the bit values must match those used in actual instruction encoding
const int kNumRegs = 16;
// Caller-saved/arguments registers
const RegList kJSCallerSaved =
1 << 0 | // r0 a1
1 << 1 | // r1 a2
1 << 2 | // r2 a3
1 << 3; // r3 a4
const int kNumJSCallerSaved = 4;
// Return the code of the n-th caller-saved register available to JavaScript
// e.g. JSCallerSavedReg(0) returns r0.code() == 0
int JSCallerSavedCode(int n);
// Callee-saved registers preserved when switching from C to JavaScript
const RegList kCalleeSaved =
1 << 4 | // r4 v1
1 << 5 | // r5 v2
1 << 6 | // r6 v3
1 << 7 | // r7 v4 (cp in JavaScript code)
1 << 8 | // r8 v5 (pp in JavaScript code)
kR9Available << 9 | // r9 v6
1 << 10 | // r10 v7
1 << 11; // r11 v8 (fp in JavaScript code)
// When calling into C++ (only for C++ calls that can't cause a GC).
// The call code will take care of lr, fp, etc.
const RegList kCallerSaved =
1 << 0 | // r0
1 << 1 | // r1
1 << 2 | // r2
1 << 3 | // r3
1 << 9; // r9
const int kNumCalleeSaved = 7 + kR9Available;
// Double registers d8 to d15 are callee-saved.
const int kNumDoubleCalleeSaved = 8;
// Number of registers for which space is reserved in safepoints. Must be a
// multiple of 8.
// TODO(regis): Only 8 registers may actually be sufficient. Revisit.
const int kNumSafepointRegisters = 16;
// The embedded constant pool pointer (r8/pp) is not included in the safepoint
// since it is not tagged. This register is preserved in the stack frame where
// its value will be updated if GC code movement occurs. Including it in the
// safepoint (where it will not be relocated) would cause a stale value to be
// restored.
const RegList kConstantPointerRegMask =
FLAG_enable_embedded_constant_pool ? (1 << 8) : 0;
const int kNumConstantPoolPointerReg =
FLAG_enable_embedded_constant_pool ? 1 : 0;
// Define the list of registers actually saved at safepoints.
// Note that the number of saved registers may be smaller than the reserved
// space, i.e. kNumSafepointSavedRegisters <= kNumSafepointRegisters.
const RegList kSafepointSavedRegisters =
kJSCallerSaved | (kCalleeSaved & ~kConstantPointerRegMask);
const int kNumSafepointSavedRegisters =
kNumJSCallerSaved + kNumCalleeSaved - kNumConstantPoolPointerReg;
// ----------------------------------------------------
class EntryFrameConstants : public AllStatic {
public:
static const int kCallerFPOffset =
-(StandardFrameConstants::kFixedFrameSizeFromFp + kPointerSize);
};
class ExitFrameConstants : public TypedFrameConstants {
public:
static const int kSPOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
static const int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
DEFINE_TYPED_FRAME_SIZES(2);
// The caller fields are below the frame pointer on the stack.
static const int kCallerFPOffset = 0 * kPointerSize;
// The calling JS function is below FP.
static const int kCallerPCOffset = 1 * kPointerSize;
// FP-relative displacement of the caller's SP. It points just
// below the saved PC.
static const int kCallerSPDisplacement = 2 * kPointerSize;
};
class JavaScriptFrameConstants : public AllStatic {
public:
// FP-relative.
static const int kLocal0Offset = StandardFrameConstants::kExpressionsOffset;
static const int kLastParameterOffset = +2 * kPointerSize;
static const int kFunctionOffset = StandardFrameConstants::kFunctionOffset;
// Caller SP-relative.
static const int kParam0Offset = -2 * kPointerSize;
static const int kReceiverOffset = -1 * kPointerSize;
};
} // namespace internal
} // namespace v8
#endif // V8_ARM_FRAMES_ARM_H_
|
/**
* @file Notification_Queue.h
*
* $Id: Notification_Queue.h 95425 2012-01-09 11:09:43Z johnnyw $
*
* @author Carlos O'Ryan <coryan@atdesk.com>
*/
#ifndef ACE_NOTIFICATION_QUEUE_H
#define ACE_NOTIFICATION_QUEUE_H
#include /**/ "ace/pre.h"
#include "ace/Copy_Disabled.h"
#include "ace/Event_Handler.h"
#include "ace/Intrusive_List.h"
#include "ace/Intrusive_List_Node.h"
#include "ace/Unbounded_Queue.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
/**
* @class ACE_Notification_Queue_Node
*
* @brief Helper class
*/
class ACE_Export ACE_Notification_Queue_Node
: public ACE_Intrusive_List_Node<ACE_Notification_Queue_Node>
{
public:
/**
* @brief Constructor
*/
ACE_Notification_Queue_Node();
/**
* @brief Modifier change the contained buffer
*/
void set(ACE_Notification_Buffer const & rhs);
/**
* @brief Accessor, fetch the contained buffer
*/
ACE_Notification_Buffer const & get() const;
/**
* @brief Checks if the event handler matches the purge condition
*/
bool matches_for_purging(ACE_Event_Handler * eh) const;
/**
* @brief Return true if clearing the mask would leave no
* notifications to deliver.
*/
bool mask_disables_all_notifications(ACE_Reactor_Mask mask);
/**
* @brief Clear the notifications specified by @c mask
*/
void clear_mask(ACE_Reactor_Mask mask);
private:
ACE_Notification_Buffer contents_;
};
/**
* @class ACE_Notification_Queue
*
* @brief Implements a user-space queue to send Reactor notifications.
*
* The ACE_Reactor uses a pipe to send wake up the thread running the
* event loop from other threads. This pipe can be limited in size
* under some operating systems. For some applications, this limit
* presents a problem. A user-space notification queue is used to
* overcome those limitations. The queue tries to use as few
* resources on the pipe as possible, while keeping all the data in
* user space.
*
* This code was refactored from Select_Reactor_Base.
*/
class ACE_Export ACE_Notification_Queue : private ACE_Copy_Disabled
{
public:
ACE_Notification_Queue();
~ACE_Notification_Queue();
/**
* @brief Pre-allocate resources in the queue
*/
int open();
/**
* @brief Release all resources in the queue
*/
void reset();
/**
* @brief Remove all elements in the queue matching @c eh and @c mask
*
* I suggest reading the documentation in ACE_Reactor to find a more
* detailed description. This is just a helper function.
*/
int purge_pending_notifications(ACE_Event_Handler * eh,
ACE_Reactor_Mask mask);
/**
* @brief Add a new notification to the queue
*
* @return -1 on failure, 1 if a new message should be sent through
* the pipe and 0 otherwise.
*/
int push_new_notification(ACE_Notification_Buffer const & buffer);
/**
* @brief Extract the next notification from the queue
*
* @return -1 on failure, 1 if a message was popped, 0 otherwise
*/
int pop_next_notification(
ACE_Notification_Buffer & current,
bool & more_messages_queued,
ACE_Notification_Buffer & next);
private:
/**
* @brief Allocate more memory for the queue
*/
int allocate_more_buffers();
private:
/// Keeps track of allocated arrays of type
/// ACE_Notification_Buffer. The idea is to amortize allocation
/// costs by allocating multiple ACE_Notification_Buffer objects at
/// a time.
ACE_Unbounded_Queue <ACE_Notification_Queue_Node*> alloc_queue_;
typedef ACE_Intrusive_List<ACE_Notification_Queue_Node> Buffer_List;
/// Keeps track of all pending notifications.
Buffer_List notify_queue_;
/// Keeps track of all free buffers.
Buffer_List free_queue_;
/// Synchronization for handling of queues.
ACE_SYNCH_MUTEX notify_queue_lock_;
};
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
#include "ace/Notification_Queue.inl"
#endif /* __ACE_INLINE__ */
#include /**/ "ace/post.h"
#endif /* ACE_NOTIFICATION_QUEUE_H */
|
#include <rtems/system.h>
/*
#include <rtems/score/isr.h>
*/
/*
* User exception handlers
*/
proc_ptr M68040FPSPUserExceptionHandlers[9];
/*
* Intercept requests to install an exception handler.
* FPSP exceptions get special treatment.
*/
static int
FPSP_install_raw_handler (uint32_t vector, proc_ptr new_handler, proc_ptr *old_handler)
{
int fpspVector;
switch (vector) {
default: return 0; /* Non-FPSP vector */
case 11: fpspVector = 0; break; /* F-line */
case 48: fpspVector = 1; break; /* BSUN */
case 49: fpspVector = 2; break; /* INEXACT */
case 50: fpspVector = 3; break; /* DIVIDE-BY-ZERO */
case 51: fpspVector = 4; break; /* UNDERFLOW */
case 52: fpspVector = 5; break; /* OPERAND ERROR */
case 53: fpspVector = 6; break; /* OVERFLOW */
case 54: fpspVector = 7; break; /* SIGNALLING NAN */
case 55: fpspVector = 8; break; /* UNIMPLEMENTED DATA TYPE */
}
*old_handler = M68040FPSPUserExceptionHandlers[fpspVector];
M68040FPSPUserExceptionHandlers[fpspVector] = new_handler;
return 1;
}
/*
* Exception handlers provided by FPSP package.
*/
extern void _fpspEntry_fline(void);
extern void _fpspEntry_bsun(void);
extern void _fpspEntry_inex(void);
extern void _fpspEntry_dz(void);
extern void _fpspEntry_unfl(void);
extern void _fpspEntry_ovfl(void);
extern void _fpspEntry_operr(void);
extern void _fpspEntry_snan(void);
extern void _fpspEntry_unsupp(void);
/*
* Attach floating point exception vectors to M68040FPSP entry points
*
* NOTE: Uses M68K rather than M68040 in the name so all CPUs having
* an FPSP can share the same code in RTEMS proper.
*/
void
M68KFPSPInstallExceptionHandlers (void)
{
static struct {
int vector_number;
void (*handler)(void);
} fpspHandlers[] = {
{ 11, _fpspEntry_fline },
{ 48, _fpspEntry_bsun },
{ 49, _fpspEntry_inex },
{ 50, _fpspEntry_dz },
{ 51, _fpspEntry_unfl },
{ 52, _fpspEntry_operr },
{ 53, _fpspEntry_ovfl },
{ 54, _fpspEntry_snan },
{ 55, _fpspEntry_unsupp },
};
int i;
proc_ptr oldHandler;
for (i = 0 ; i < sizeof fpspHandlers / sizeof fpspHandlers[0] ; i++) {
_CPU_ISR_install_raw_handler(fpspHandlers[i].vector_number, fpspHandlers[i].handler, &oldHandler);
M68040FPSPUserExceptionHandlers[i] = oldHandler;
}
_FPSP_install_raw_handler = FPSP_install_raw_handler;
}
|
/*
* Copyright (C) 2008-2016 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_CELL_H
#define TRINITY_CELL_H
#include <cmath>
#include "TypeContainer.h"
#include "TypeContainerVisitor.h"
#include "GridDefines.h"
class Map;
class WorldObject;
struct CellArea
{
CellArea() { }
CellArea(CellCoord low, CellCoord high) : low_bound(low), high_bound(high) { }
bool operator!() const { return low_bound == high_bound; }
void ResizeBorders(CellCoord& begin_cell, CellCoord& end_cell) const
{
begin_cell = low_bound;
end_cell = high_bound;
}
CellCoord low_bound;
CellCoord high_bound;
};
struct Cell
{
Cell() { data.All = 0; }
Cell(Cell const& cell) { data.All = cell.data.All; }
explicit Cell(CellCoord const& p);
explicit Cell(float x, float y);
void Compute(uint32 &x, uint32 &y) const
{
x = data.Part.grid_x * MAX_NUMBER_OF_CELLS + data.Part.cell_x;
y = data.Part.grid_y * MAX_NUMBER_OF_CELLS + data.Part.cell_y;
}
bool DiffCell(const Cell &cell) const
{
return(data.Part.cell_x != cell.data.Part.cell_x ||
data.Part.cell_y != cell.data.Part.cell_y);
}
bool DiffGrid(const Cell &cell) const
{
return(data.Part.grid_x != cell.data.Part.grid_x ||
data.Part.grid_y != cell.data.Part.grid_y);
}
uint32 CellX() const { return data.Part.cell_x; }
uint32 CellY() const { return data.Part.cell_y; }
uint32 GridX() const { return data.Part.grid_x; }
uint32 GridY() const { return data.Part.grid_y; }
bool NoCreate() const { return data.Part.nocreate; }
void SetNoCreate() { data.Part.nocreate = 1; }
CellCoord GetCellCoord() const
{
return CellCoord(
data.Part.grid_x * MAX_NUMBER_OF_CELLS+data.Part.cell_x,
data.Part.grid_y * MAX_NUMBER_OF_CELLS+data.Part.cell_y);
}
Cell& operator=(Cell const& cell)
{
this->data.All = cell.data.All;
return *this;
}
bool operator == (Cell const& cell) const { return (data.All == cell.data.All); }
bool operator != (Cell const& cell) const { return !operator == (cell); }
union
{
struct
{
unsigned grid_x : 6;
unsigned grid_y : 6;
unsigned cell_x : 6;
unsigned cell_y : 6;
unsigned nocreate : 1;
unsigned reserved : 7;
} Part;
uint32 All;
} data;
template<class T, class CONTAINER> void Visit(CellCoord const&, TypeContainerVisitor<T, CONTAINER>& visitor, Map &, WorldObject const&, float) const;
template<class T, class CONTAINER> void Visit(CellCoord const&, TypeContainerVisitor<T, CONTAINER>& visitor, Map &, float, float, float) const;
static CellArea CalculateCellArea(float x, float y, float radius);
private:
template<class T, class CONTAINER> void VisitCircle(TypeContainerVisitor<T, CONTAINER> &, Map &, CellCoord const&, CellCoord const&) const;
};
#endif
|
/*
* This file is part of wxSmith plugin for Code::Blocks Studio
* Copyright (C) 2006-2007 Bartlomiej Swiecki
*
* wxSmith 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.
*
* wxSmith 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 wxSmith. If not, see <http://www.gnu.org/licenses/>.
*
* $Revision$
* $Id$
* $HeadURL$
*/
#ifndef WXSBUTTON_H
#define WXSBUTTON_H
#include "../wxswidget.h"
/** \brief Class for wxButton widget */
class wxsButton: public wxsWidget
{
public:
wxsButton(wxsItemResData* Data);
private:
virtual void OnBuildCreatingCode();
virtual wxObject* OnBuildPreview(wxWindow* Parent,long Flags);
virtual void OnEnumWidgetProperties(long Flags);
wxString Label;
bool IsDefault;
};
#endif
|
/*
* Copyright (C) 2015 Martine Lenders <mlenders@inf.fu-berlin.de>
*
* 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.
*/
/**
* @defgroup net_ethernet Ethernet
* @ingroup net
* @brief Provides Ethernet header and helper functions
* @{
*
* @file
* @brief Definitions for Ethernet
*
* @author Martine Lenders <mlenders@inf.fu-berlin.de>
*/
#ifndef NET_ETHERNET_H
#define NET_ETHERNET_H
#include <stdint.h>
#include "net/ethernet/hdr.h"
#include "net/eui64.h"
#ifdef __cplusplus
extern "C" {
#endif
#define ETHERNET_DATA_LEN (1500) /**< maximum number of bytes in payload */
#define ETHERNET_FCS_LEN (4) /**< number of bytes in the FCS
* (frame check sequence) */
/**
* @brief maximum number of bytes in an ethernet frame (without FCS)
*/
#define ETHERNET_FRAME_LEN (ETHERNET_DATA_LEN + sizeof(ethernet_hdr_t))
#define ETHERNET_MIN_LEN (64) /**< minimum number of bytes in an
* ethernet frame (with FCF) */
/**
* @brief maximum number of bytes in an ethernet frame (with FCF)
*/
#define ETHERNET_MAX_LEN (ETHERNET_FRAME_LEN + ETHERNET_FCS_LEN)
#ifdef __cplusplus
}
#endif
#endif /* NET_ETHERNET_H */
/**
* @}
*/
|
/*
* drivers/video/tegra/dc/clock.c
*
* Copyright (C) 2010 Google, Inc.
*
* Copyright (c) 2010-2012, NVIDIA CORPORATION, All rights reserved.
*
* 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 <linux/err.h>
#include <linux/types.h>
#include <linux/clk.h>
#include <linux/clk/tegra.h>
#include <mach/dc.h>
#include "dc_reg.h"
#include "dc_priv.h"
unsigned long tegra_dc_pclk_round_rate(struct tegra_dc *dc, int pclk)
{
unsigned long rate;
unsigned long div;
rate = tegra_dc_clk_get_rate(dc);
div = DIV_ROUND_CLOSEST(rate * 2, pclk);
if (div < 2)
return 0;
return rate * 2 / div;
}
unsigned long tegra_dc_pclk_predict_rate(struct clk *parent, int pclk)
{
unsigned long rate;
unsigned long div;
rate = clk_get_rate(parent);
div = DIV_ROUND_CLOSEST(rate * 2, pclk);
if (div < 2)
return 0;
return rate * 2 / div;
}
void tegra_dc_setup_clk(struct tegra_dc *dc, struct clk *clk)
{
int pclk;
if (dc->out_ops->setup_clk)
pclk = dc->out_ops->setup_clk(dc, clk);
else
pclk = 0;
WARN_ONCE(!pclk, "pclk is 0\n");
tegra_dvfs_set_rate(clk, pclk);
}
|
#include "../../../src/testlib/qtesttable_p.h"
|
// 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 IOS_THIRD_PARTY_BLINK_SRC_HTML_CHARACTER_PROVIDER_H_
#define IOS_THIRD_PARTY_BLINK_SRC_HTML_CHARACTER_PROVIDER_H_
#include "ios/third_party/blink/src/html_tokenizer_adapter.h"
namespace WebCore {
const LChar kEndOfFileMarker = 0;
// CharacterProvider provides input characters to WebCore::HTMLTokenizer.
// It replaces WebCore::SegmentedString (which sits ontop of WTF::String).
class CharacterProvider {
WTF_MAKE_NONCOPYABLE(CharacterProvider);
public:
CharacterProvider()
: _totalBytes(0)
, _remainingBytes(0)
, _singleBytePtr(nullptr)
, _doubleBytePtr(nullptr)
, _littleEndian(false)
{
}
void setContents(const LChar* str, size_t numberOfBytes)
{
_totalBytes = numberOfBytes;
_remainingBytes = numberOfBytes;
_singleBytePtr = str;
_doubleBytePtr = nullptr;
_littleEndian = false;
}
void setContents(const UChar* str, size_t numberOfBytes)
{
_totalBytes = numberOfBytes;
_remainingBytes = numberOfBytes;
_singleBytePtr = nullptr;
_doubleBytePtr = str;
_littleEndian = false;
}
void clear()
{
_totalBytes = 0;
_remainingBytes = 0;
_singleBytePtr = nullptr;
_doubleBytePtr = nullptr;
_littleEndian = false;
}
bool startsWith(const LChar* str,
size_t byteCount,
bool caseInsensitive = false) const
{
if (!str || byteCount > _remainingBytes)
return false;
for (size_t index = 0; index < byteCount; ++index) {
UChar lhs = characterAtIndex(index);
UChar rhs = str[index];
if (caseInsensitive) {
if (isASCIIUpper(lhs))
lhs = toLowerCase(lhs);
if (isASCIIUpper(rhs))
rhs = toLowerCase(rhs);
}
if (lhs != rhs)
return false;
}
return true;
}
inline UChar currentCharacter() const
{
return characterAtIndex(0);
}
inline UChar nextCharacter()
{
advanceBytePointer();
return characterAtIndex(0);
}
inline void next()
{
advanceBytePointer();
}
inline bool isEmpty() const
{
return !_remainingBytes;
}
inline size_t remainingBytes() const
{
return _remainingBytes;
}
inline size_t bytesProvided() const
{
return _totalBytes - _remainingBytes;
}
inline void setLittleEndian()
{
_littleEndian = true;
}
private:
void advanceBytePointer()
{
--_remainingBytes;
if (!_remainingBytes)
return;
if (_singleBytePtr)
++_singleBytePtr;
else {
DCHECK(_doubleBytePtr);
++_doubleBytePtr;
}
}
UChar characterAtIndex(size_t index) const
{
if (!_remainingBytes) {
// There is a quirk in the blink implementation wherein the empty state
// is not set on the source until next() has been called when
// _remainingBytes is zero. In this case, return kEndOfFileMarker.
return kEndOfFileMarker;
}
ASSERT(_singleBytePtr || _doubleBytePtr);
UChar character = kEndOfFileMarker;
if (_singleBytePtr)
character = _singleBytePtr[index];
else
character = _doubleBytePtr[index];
if (_littleEndian)
character = ByteSwap(character);
return character;
}
private:
size_t _totalBytes;
size_t _remainingBytes;
const LChar* _singleBytePtr;
const UChar* _doubleBytePtr;
bool _littleEndian;
};
}
#endif // IOS_THIRD_PARTY_BLINK_SRC_HTML_CHARACTER_PROVIDER_H_
|
//===-- llvm/System/AIXDataTypesFix.h - Fix datatype defs ------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file overrides default system-defined types and limits which cannot be
// done in DataTypes.h.in because it is processed by autoheader first, which
// comments out any #undef statement
//
//===----------------------------------------------------------------------===//
// No include guards desired!
#ifndef SUPPORT_DATATYPES_H
#error "AIXDataTypesFix.h must only be included via DataTypes.h!"
#endif
// GCC is strict about defining large constants: they must have LL modifier.
// These will be defined properly at the end of DataTypes.h
#undef INT64_MAX
#undef INT64_MIN
|
// 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.
// This is the transformation and adjustment for all executables.
// The executable type is determined by ParseDetectedExecutable function.
#ifndef COURGETTE_WIN32_X86_GENERATOR_H_
#define COURGETTE_WIN32_X86_GENERATOR_H_
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "courgette/assembly_program.h"
#include "courgette/ensemble.h"
namespace courgette {
class PatchGeneratorX86_32 : public TransformationPatchGenerator {
public:
PatchGeneratorX86_32(Element* old_element,
Element* new_element,
PatcherX86_32* patcher,
ExecutableType kind)
: TransformationPatchGenerator(old_element, new_element, patcher),
kind_(kind) {
}
virtual ExecutableType Kind() { return kind_; }
Status WriteInitialParameters(SinkStream* parameter_stream) {
if (!parameter_stream->WriteSizeVarint32(
old_element_->offset_in_ensemble()) ||
!parameter_stream->WriteSizeVarint32(old_element_->region().length())) {
return C_STREAM_ERROR;
}
return C_OK;
// TODO(sra): Initialize |patcher_| with these parameters.
}
Status PredictTransformParameters(SinkStreamSet* prediction) {
return TransformationPatchGenerator::PredictTransformParameters(prediction);
}
Status CorrectedTransformParameters(SinkStreamSet* parameters) {
// No code needed to write an 'empty' parameter set.
return C_OK;
}
// The format of a transformed_element is a serialized EncodedProgram. We
// first disassemble the original old and new Elements into AssemblyPrograms.
// Then we adjust the new AssemblyProgram to make it as much like the old one
// as possible, before converting the AssemblyPrograms to EncodedPrograms and
// serializing them.
Status Transform(SourceStreamSet* corrected_parameters,
SinkStreamSet* old_transformed_element,
SinkStreamSet* new_transformed_element) {
// Don't expect any corrected parameters.
if (!corrected_parameters->Empty())
return C_GENERAL_ERROR;
// Generate old version of program using |corrected_parameters|.
// TODO(sra): refactor to use same code from patcher_.
AssemblyProgram* old_program = NULL;
Status old_parse_status =
ParseDetectedExecutable(old_element_->region().start(),
old_element_->region().length(),
&old_program);
if (old_parse_status != C_OK) {
LOG(ERROR) << "Cannot parse an executable " << old_element_->Name();
return old_parse_status;
}
AssemblyProgram* new_program = NULL;
Status new_parse_status =
ParseDetectedExecutable(new_element_->region().start(),
new_element_->region().length(),
&new_program);
if (new_parse_status != C_OK) {
DeleteAssemblyProgram(old_program);
LOG(ERROR) << "Cannot parse an executable " << new_element_->Name();
return new_parse_status;
}
// Trim labels below a certain threshold
Status trim_old_status = TrimLabels(old_program);
if (trim_old_status != C_OK) {
DeleteAssemblyProgram(old_program);
return trim_old_status;
}
Status trim_new_status = TrimLabels(new_program);
if (trim_new_status != C_OK) {
DeleteAssemblyProgram(new_program);
return trim_new_status;
}
EncodedProgram* old_encoded = NULL;
Status old_encode_status = Encode(old_program, &old_encoded);
if (old_encode_status != C_OK) {
DeleteAssemblyProgram(old_program);
return old_encode_status;
}
Status old_write_status =
WriteEncodedProgram(old_encoded, old_transformed_element);
DeleteEncodedProgram(old_encoded);
if (old_write_status != C_OK) {
DeleteAssemblyProgram(old_program);
return old_write_status;
}
Status adjust_status = Adjust(*old_program, new_program);
DeleteAssemblyProgram(old_program);
if (adjust_status != C_OK) {
DeleteAssemblyProgram(new_program);
return adjust_status;
}
EncodedProgram* new_encoded = NULL;
Status new_encode_status = Encode(new_program, &new_encoded);
DeleteAssemblyProgram(new_program);
if (new_encode_status != C_OK)
return new_encode_status;
Status new_write_status =
WriteEncodedProgram(new_encoded, new_transformed_element);
DeleteEncodedProgram(new_encoded);
if (new_write_status != C_OK)
return new_write_status;
return C_OK;
}
Status Reform(SourceStreamSet* transformed_element,
SinkStream* reformed_element) {
return TransformationPatchGenerator::Reform(transformed_element,
reformed_element);
}
private:
virtual ~PatchGeneratorX86_32() { }
ExecutableType kind_;
DISALLOW_COPY_AND_ASSIGN(PatchGeneratorX86_32);
};
} // namespace courgette
#endif // COURGETTE_WIN32_X86_GENERATOR_H_
|
/* Copyright (c) 2000, 2010, 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 as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#ifndef _mysys_err_h
#define _mysys_err_h
#ifdef __cplusplus
extern "C" {
#endif
#define GLOBERRS (EE_ERROR_LAST - EE_ERROR_FIRST + 1) /* Nr of global errors */
#define EE(X) (globerrs[(X) - EE_ERROR_FIRST])
extern const char *globerrs[]; /* my_error_messages is here */
/* Error message numbers in global map */
/*
Do not add error numbers before EE_ERROR_FIRST.
If necessary to add lower numbers, change EE_ERROR_FIRST accordingly.
We start with error 1 to not confuse peoples with 'error 0'
*/
#define EE_ERROR_FIRST 1 /*Copy first error nr.*/
#define EE_CANTCREATEFILE 1
#define EE_READ 2
#define EE_WRITE 3
#define EE_BADCLOSE 4
#define EE_OUTOFMEMORY 5
#define EE_DELETE 6
#define EE_LINK 7
#define EE_EOFERR 9
#define EE_CANTLOCK 10
#define EE_CANTUNLOCK 11
#define EE_DIR 12
#define EE_STAT 13
#define EE_CANT_CHSIZE 14
#define EE_CANT_OPEN_STREAM 15
#define EE_GETWD 16
#define EE_SETWD 17
#define EE_LINK_WARNING 18
#define EE_OPEN_WARNING 19
#define EE_DISK_FULL 20
#define EE_CANT_MKDIR 21
#define EE_UNKNOWN_CHARSET 22
#define EE_OUT_OF_FILERESOURCES 23
#define EE_CANT_READLINK 24
#define EE_CANT_SYMLINK 25
#define EE_REALPATH 26
#define EE_SYNC 27
#define EE_UNKNOWN_COLLATION 28
#define EE_FILENOTFOUND 29
#define EE_FILE_NOT_CLOSED 30
#define EE_CHANGE_OWNERSHIP 31
#define EE_CHANGE_PERMISSIONS 32
#define EE_CANT_SEEK 33
#define EE_SOCKET 34
#define EE_CONNECT 35
#define EE_TOOLONGFILENAME 36
#define EE_ERROR_LAST 36 /* Copy last error nr */
/* Add error numbers before EE_ERROR_LAST and change it accordingly. */
/* exit codes for all MySQL programs */
#define EXIT_UNSPECIFIED_ERROR 1
#define EXIT_UNKNOWN_OPTION 2
#define EXIT_AMBIGUOUS_OPTION 3
#define EXIT_NO_ARGUMENT_ALLOWED 4
#define EXIT_ARGUMENT_REQUIRED 5
#define EXIT_VAR_PREFIX_NOT_UNIQUE 6
#define EXIT_UNKNOWN_VARIABLE 7
#define EXIT_OUT_OF_MEMORY 8
#define EXIT_UNKNOWN_SUFFIX 9
#define EXIT_NO_PTR_TO_VARIABLE 10
#define EXIT_CANNOT_CONNECT_TO_SERVICE 11
#define EXIT_OPTION_DISABLED 12
#define EXIT_ARGUMENT_INVALID 13
#ifdef __cplusplus
}
#endif
#endif
|
/***************************************************************************
qgsalignmentcombobox.h
---------------------
begin : June 2019
copyright : (C) 2019 by Nyall Dawson
email : nyall dot dawson at gmail dot 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. *
* *
***************************************************************************/
#ifndef QGSALIGNMENTCOMBOBOX_H
#define QGSALIGNMENTCOMBOBOX_H
#include <QComboBox>
#include "qgis_gui.h"
#include "qgis_sip.h"
/**
* \ingroup gui
* \class QgsAlignmentComboBox
* A combo box which allows choice of alignment settings (e.g. left, right, ...).
*
* Currently only horizontal alignments are supported. Available alignment choices
* can be manually specified by calling setAvailableAlignments(), which is useful
* when only a subset of Qt's alignment options should be exposed.
*
* \since QGIS 3.10
*/
class GUI_EXPORT QgsAlignmentComboBox : public QComboBox
{
Q_OBJECT
public:
/**
* Constructor for QgsAlignmentComboBox, with the specified parent widget.
*/
QgsAlignmentComboBox( QWidget *parent SIP_TRANSFERTHIS = nullptr );
/**
* Sets the available alignment choices shown in the combo box.
*/
void setAvailableAlignments( Qt::Alignment alignments );
/**
* Returns the current alignment choice.
*
* \see setCurrentAlignment()
*/
Qt::Alignment currentAlignment() const;
/**
* Sets the current \a alignment choice.
*
* \see currentAlignment()
*/
void setCurrentAlignment( Qt::Alignment alignment );
/**
* Sets the \a text and \a icon to use for a particular \a alignment option,
* replacing the default text or icon.
*
* If \a text or \a icon is not specified, they will not be changed from the default.
*
* \note This must be called after first filtering the available alignment options via setAvailableAlignments().
*/
void customizeAlignmentDisplay( Qt::Alignment alignment, const QString &text = QString(), const QIcon &icon = QIcon() );
signals:
/**
* Emitted when the alignment is changed.
*/
void changed();
private:
void populate();
Qt::Alignment mAlignments = Qt::AlignLeft | Qt::AlignHCenter | Qt::AlignRight;
bool mBlockChanged = false;
};
#endif //QGSALIGNMENTCOMBOBOX_H
|
/*
* Sky Nexus Register Driver
*
* Copyright (C) 2002 Brian Waite
*
* This driver allows reading the Nexus register
* It exports the /proc/sky_chassis_id and also
* /proc/sky_slot_id pseudo-file for status information.
*
* 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.
*
*/
#include <linux/version.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/proc_fs.h>
#include <linux/hdpu_features.h>
#include <linux/pci.h>
#include <linux/device.h>
static int hdpu_nexus_probe(struct device *ddev);
static int hdpu_nexus_remove(struct device *ddev);
static struct proc_dir_entry *hdpu_slot_id;
static struct proc_dir_entry *hdpu_chassis_id;
static int slot_id = -1;
static int chassis_id = -1;
static struct device_driver hdpu_nexus_driver = {
.name = HDPU_NEXUS_NAME,
.bus = &platform_bus_type,
.probe = hdpu_nexus_probe,
.remove = hdpu_nexus_remove,
};
int hdpu_slot_id_read(char *buffer, char **buffer_location, off_t offset,
int buffer_length, int *zero, void *ptr)
{
if (offset > 0)
return 0;
return sprintf(buffer, "%d\n", slot_id);
}
int hdpu_chassis_id_read(char *buffer, char **buffer_location, off_t offset,
int buffer_length, int *zero, void *ptr)
{
if (offset > 0)
return 0;
return sprintf(buffer, "%d\n", chassis_id);
}
static int hdpu_nexus_probe(struct device *ddev)
{
struct platform_device *pdev = to_platform_device(ddev);
struct resource *res;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
int *nexus_id_addr;
nexus_id_addr =
ioremap(res->start, (unsigned long)(res->end - res->start));
if (nexus_id_addr) {
slot_id = (*nexus_id_addr >> 8) & 0x1f;
chassis_id = *nexus_id_addr & 0xff;
iounmap(nexus_id_addr);
} else
printk("Could not map slot id\n");
hdpu_slot_id = create_proc_entry("sky_slot_id", 0666, &proc_root);
hdpu_slot_id->read_proc = hdpu_slot_id_read;
hdpu_slot_id->nlink = 1;
hdpu_chassis_id = create_proc_entry("sky_chassis_id", 0666, &proc_root);
hdpu_chassis_id->read_proc = hdpu_chassis_id_read;
hdpu_chassis_id->nlink = 1;
return 0;
}
static int hdpu_nexus_remove(struct device *ddev)
{
slot_id = -1;
chassis_id = -1;
remove_proc_entry("sky_slot_id", &proc_root);
remove_proc_entry("sky_chassis_id", &proc_root);
hdpu_slot_id = 0;
hdpu_chassis_id = 0;
return 0;
}
static int __init nexus_init(void)
{
int rc;
rc = driver_register(&hdpu_nexus_driver);
return rc;
}
static void __exit nexus_exit(void)
{
driver_unregister(&hdpu_nexus_driver);
}
module_init(nexus_init);
module_exit(nexus_exit);
MODULE_AUTHOR("Brian Waite");
MODULE_LICENSE("GPL");
|
/**
* Copyright 1993-2013 NVIDIA Corporation. All rights reserved.
*
* Please refer to the NVIDIA end user license agreement (EULA) associated
* with this source code for terms and conditions that govern your use of
* this software. Any use, reproduction, disclosure, or distribution of
* this software and related documentation outside the terms of the EULA
* is strictly prohibited.
*
*/
#ifndef __cuda_drvapi_dynlink_cuda_gl_h__
#define __cuda_drvapi_dynlink_cuda_gl_h__
#ifdef CUDA_INIT_OPENGL
#if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
# define WINDOWS_LEAN_AND_MEAN
# define NOMINMAX
# include <windows.h>
#endif
// includes, system
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
// includes, GL
#include <GL/glew.h>
#if defined (__APPLE__) || defined(MACOSX)
#include <GLUT/glut.h>
#else
#include <GL/freeglut.h>
#endif
/************************************
**
** OpenGL Graphics/Interop
**
***********************************/
// OpenGL/CUDA interop (CUDA 2.0+)
typedef CUresult CUDAAPI tcuGLCtxCreate(CUcontext *pCtx, unsigned int Flags, CUdevice device);
typedef CUresult CUDAAPI tcuGraphicsGLRegisterBuffer(CUgraphicsResource *pCudaResource, GLuint buffer, unsigned int Flags);
typedef CUresult CUDAAPI tcuGraphicsGLRegisterImage(CUgraphicsResource *pCudaResource, GLuint image, GLenum target, unsigned int Flags);
#if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
#include <GL/wglext.h>
// WIN32
typedef CUresult CUDAAPI tcuWGLGetDevice(CUdevice *pDevice, HGPUNV hGpu);
#endif
#endif // CUDA_INIT_OPENGL
#endif // __cuda_drvapi_dynlink_cuda_gl_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 AXUTIL_THREAD_UNIX_H
#define AXUTIL_THREAD_UNIX_H
#include <axutil_thread.h>
#include <pthread.h>
#define SHELL_PATH "/bin/sh"
typedef pthread_t axis2_os_thread_t; /* Native thread */
struct axutil_thread_t
{
pthread_t *td;
void *data;
axutil_thread_start_t func;
axis2_bool_t try_exit;
};
struct axutil_threadattr_t
{
pthread_attr_t attr;
};
struct axutil_threadkey_t
{
pthread_key_t key;
};
struct axutil_thread_once_t
{
pthread_once_t once;
};
/*************************Thread locking functions*****************************/
struct axutil_thread_mutex_t
{
axutil_allocator_t *allocator;
pthread_mutex_t mutex;
};
#endif /* AXIS2_THREAD_UNIX_H */
|
/*
*
* Copyright 2017, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef GRPC_CORE_LIB_SECURITY_TRANSPORT_LB_TARGETS_INFO_H
#define GRPC_CORE_LIB_SECURITY_TRANSPORT_LB_TARGETS_INFO_H
#include "src/core/lib/slice/slice_hash_table.h"
/** Return a channel argument containing \a targets_info. */
grpc_arg grpc_lb_targets_info_create_channel_arg(
grpc_slice_hash_table *targets_info);
/** Return the instance of targets info in \a args or NULL */
grpc_slice_hash_table *grpc_lb_targets_info_find_in_args(
const grpc_channel_args *args);
#endif /* GRPC_CORE_LIB_SECURITY_TRANSPORT_LB_TARGETS_INFO_H */
|
//
// BarContainerViewController.h
// XLPagerTabStrip ( https://github.com/xmartlabs/XLPagerTabStrip )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "XLBarPagerTabStripViewController.h"
#import "XLPagerTabStripViewController.h"
@interface BarExampleViewController : XLBarPagerTabStripViewController
@end
|
#ifndef _DT_BINDINGS_STM32_PINFUNC_H
#define _DT_BINDINGS_STM32_PINFUNC_H
/* define PIN modes */
#define GPIO 0x0
#define AF0 0x1
#define AF1 0x2
#define AF2 0x3
#define AF3 0x4
#define AF4 0x5
#define AF5 0x6
#define AF6 0x7
#define AF7 0x8
#define AF8 0x9
#define AF9 0xa
#define AF10 0xb
#define AF11 0xc
#define AF12 0xd
#define AF13 0xe
#define AF14 0xf
#define AF15 0x10
#define ANALOG 0x11
/* define Pins number*/
#define PIN_NO(port, line) (((port) - 'A') * 0x10 + (line))
#define STM32_PINMUX(port, line, mode) (((PIN_NO(port, line)) << 8) | (mode))
#endif /* _DT_BINDINGS_STM32_PINFUNC_H */
|
/*****************************************************************************\
* Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
* Copyright (C) 2007 The Regents of the University of California.
* Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
* Written by Brian Behlendorf <behlendorf1@llnl.gov>.
* UCRL-CODE-235197
*
* This file is part of the SPL, Solaris Porting Layer.
* For details, see <http://zfsonlinux.org/>.
*
* The SPL 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.
*
* The SPL 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 the SPL. If not, see <http://www.gnu.org/licenses/>.
\*****************************************************************************/
#ifndef _SPL_SYSTEMINFO_H
#define _SPL_SYSTEMINFO_H
#define HW_HOSTID_LEN 11 /* minimum buffer size needed */
/* to hold a decimal or hex */
/* hostid string */
/* Supplemental definitions for Linux. */
#define HW_HOSTID_PATH "/etc/hostid" /* binary configuration file */
#define HW_HOSTID_MASK 0xFFFFFFFF /* significant hostid bits */
#endif /* SPL_SYSTEMINFO_H */
|
/*
* This file is part of FFmpeg.
*
* FFmpeg 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.
*
* FFmpeg 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 FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file
* common internal api header.
*/
#ifndef AVCODEC_INTERNAL_H
#define AVCODEC_INTERNAL_H
#include <stdint.h>
#include "avcodec.h"
/**
* Determines whether pix_fmt is a hardware accelerated format.
*/
int ff_is_hwaccel_pix_fmt(enum PixelFormat pix_fmt);
/**
* Returns the hardware accelerated codec for codec codec_id and
* pixel format pix_fmt.
*
* @param codec_id the codec to match
* @param pix_fmt the pixel format to match
* @return the hardware accelerated codec, or NULL if none was found.
*/
AVHWAccel *ff_find_hwaccel(enum CodecID codec_id, enum PixelFormat pix_fmt);
/**
* Return the index into tab at which {a,b} match elements {[0],[1]} of tab.
* If there is no such matching pair then size is returned.
*/
int ff_match_2uint16(const uint16_t (*tab)[2], int size, int a, int b);
#endif /* AVCODEC_INTERNAL_H */
|
/**
* @file
* X.509 module documentation file.
*
* Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This file is part of mbed TLS (https://tls.mbed.org)
*/
/**
* @addtogroup x509_module X.509 module
*
* The X.509 module provides X.509 support which includes:
* - X.509 certificate (CRT) reading (see \c x509parse_crt() and
* \c x509parse_crtfile()).
* - X.509 certificate revocation list (CRL) reading (see \c x509parse_crl()
* and\c x509parse_crlfile()).
* - X.509 (RSA and ECC) private key reading (see \c x509parse_key() and
* \c x509parse_keyfile()).
* - X.509 certificate signature verification (see \c x509parse_verify())
* - X.509 certificate writing and certificate request writing (see
* \c mbedtls_x509write_crt_der() and \c mbedtls_x509write_csr_der()).
*
* This module can be used to build a certificate authority (CA) chain and
* verify its signature. It is also used to generate Certificate Signing
* Requests and X509 certificates just as a CA would do.
*/
|
/* Copyright (C) 1995,1996,1997,1998,1999,2002,2003
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, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
#include <ieee754.h>
#include <float.h>
#include <math.h>
#include <stdlib.h>
/* Convert a `long double' in IEEE854 quad-precision format to a
multi-precision integer representing the significand scaled up by its
number of bits (113 for long double) and an integral power of two
(MPN frexpl). */
mp_size_t
__mpn_extract_long_double (mp_ptr res_ptr, mp_size_t size,
int *expt, int *is_neg,
long double value)
{
union ieee854_long_double u;
u.d = value;
*is_neg = u.ieee.negative;
*expt = (int) u.ieee.exponent - IEEE854_LONG_DOUBLE_BIAS;
#if BITS_PER_MP_LIMB == 32
res_ptr[0] = u.ieee.mantissa3; /* Low-order 32 bits of fraction. */
res_ptr[1] = u.ieee.mantissa2;
res_ptr[2] = u.ieee.mantissa1;
res_ptr[3] = u.ieee.mantissa0; /* High-order 32 bits. */
#define N 4
#elif BITS_PER_MP_LIMB == 64
/* Hopefully the compiler will combine the two bitfield extracts
and this composition into just the original quadword extract. */
res_ptr[0] = ((mp_limb_t) u.ieee.mantissa2 << 32) | u.ieee.mantissa3;
res_ptr[1] = ((mp_limb_t) u.ieee.mantissa0 << 32) | u.ieee.mantissa1;
#define N 2
#else
#error "mp_limb size " BITS_PER_MP_LIMB "not accounted for"
#endif
/* The format does not fill the last limb. There are some zeros. */
#define NUM_LEADING_ZEROS (BITS_PER_MP_LIMB \
- (LDBL_MANT_DIG - ((N - 1) * BITS_PER_MP_LIMB)))
if (u.ieee.exponent == 0)
{
/* A biased exponent of zero is a special case.
Either it is a zero or it is a denormal number. */
if (res_ptr[0] == 0 && res_ptr[1] == 0
&& res_ptr[N - 2] == 0 && res_ptr[N - 1] == 0) /* Assumes N<=4. */
/* It's zero. */
*expt = 0;
else
{
/* It is a denormal number, meaning it has no implicit leading
one bit, and its exponent is in fact the format minimum. */
int cnt;
#if N == 2
if (res_ptr[N - 1] != 0)
{
count_leading_zeros (cnt, res_ptr[N - 1]);
cnt -= NUM_LEADING_ZEROS;
res_ptr[N - 1] = res_ptr[N - 1] << cnt
| (res_ptr[0] >> (BITS_PER_MP_LIMB - cnt));
res_ptr[0] <<= cnt;
*expt = LDBL_MIN_EXP - 1 - cnt;
}
else
{
count_leading_zeros (cnt, res_ptr[0]);
if (cnt >= NUM_LEADING_ZEROS)
{
res_ptr[N - 1] = res_ptr[0] << (cnt - NUM_LEADING_ZEROS);
res_ptr[0] = 0;
}
else
{
res_ptr[N - 1] = res_ptr[0] >> (NUM_LEADING_ZEROS - cnt);
res_ptr[0] <<= BITS_PER_MP_LIMB - (NUM_LEADING_ZEROS - cnt);
}
*expt = LDBL_MIN_EXP - 1
- (BITS_PER_MP_LIMB - NUM_LEADING_ZEROS) - cnt;
}
#else
int j, k, l;
for (j = N - 1; j > 0; j--)
if (res_ptr[j] != 0)
break;
count_leading_zeros (cnt, res_ptr[j]);
cnt -= NUM_LEADING_ZEROS;
l = N - 1 - j;
if (cnt < 0)
{
cnt += BITS_PER_MP_LIMB;
l--;
}
if (!cnt)
for (k = N - 1; k >= l; k--)
res_ptr[k] = res_ptr[k-l];
else
{
for (k = N - 1; k > l; k--)
res_ptr[k] = res_ptr[k-l] << cnt
| res_ptr[k-l-1] >> (BITS_PER_MP_LIMB - cnt);
res_ptr[k--] = res_ptr[0] << cnt;
}
for (; k >= 0; k--)
res_ptr[k] = 0;
*expt = LDBL_MIN_EXP - 1 - l * BITS_PER_MP_LIMB - cnt;
#endif
}
}
else
/* Add the implicit leading one bit for a normalized number. */
res_ptr[N - 1] |= (mp_limb_t) 1 << (LDBL_MANT_DIG - 1
- ((N - 1) * BITS_PER_MP_LIMB));
return N;
}
|
/* Copyright (C) 1996, 1997, 2001, 2006 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.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
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 <sys/stat.h>
/* This definition is only used if inlining fails for this function; see
the last page of <sys/stat.h>. The real work is done by the `x'
function which is passed a version number argument. We arrange in the
makefile that when not inlined this function is always statically
linked; that way a dynamically-linked executable always encodes the
version number corresponding to the data structures it uses, so the `x'
functions in the shared library can adapt without needing to recompile
all callers. */
#undef lstat
#undef __lstat
int
attribute_hidden
__lstat (const char *file, struct stat *buf)
{
return __lxstat (_STAT_VER, file, buf);
}
weak_hidden_alias (__lstat, lstat)
|
/* Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
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 <string.h>
#include <sys/time.h>
#include <time.h>
#include <unistd.h>
#include <utmp.h>
void
logwtmp (const char *line, const char *name, const char *host)
{
struct utmp ut;
/* Set information in new entry. */
memset (&ut, 0, sizeof (ut));
#if _HAVE_UT_PID - 0
ut.ut_pid = getpid ();
#endif
#if _HAVE_UT_TYPE - 0
ut.ut_type = name[0] ? USER_PROCESS : DEAD_PROCESS;
#endif
strncpy (ut.ut_line, line, sizeof ut.ut_line);
strncpy (ut.ut_name, name, sizeof ut.ut_name);
#if _HAVE_UT_HOST - 0
strncpy (ut.ut_host, host, sizeof ut.ut_host);
#endif
#if _HAVE_UT_TV - 0
struct timeval tv;
__gettimeofday (&tv, NULL);
ut.ut_tv.tv_sec = tv.tv_sec;
ut.ut_tv.tv_usec = tv.tv_usec;
#else
ut.ut_time = time (NULL);
#endif
updwtmp (_PATH_WTMP, &ut);
}
|
/*
* Copyright (c) International Business Machines Corp., 2006
*
* 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.
*
* Author: Artem B. Bityutskiy
*
* The stuff which is common for many tests.
*/
#ifndef __COMMON_H__
#define __COMMON_H__
#include <string.h>
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
#define UBI_VOLUME_PATTERN "/dev/ubi%d_%d"
#define MIN_AVAIL_EBS 5
#define PAGE_SIZE 4096
#define min(a, b) ((a) < (b) ? (a) : (b))
/* Normal messages */
#define normsg(fmt, ...) do { \
printf(TESTNAME ": " fmt "\n", ##__VA_ARGS__); \
} while(0)
#define errmsg(fmt, ...) ({ \
__errmsg(TESTNAME, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__); \
-1; \
})
#define failed(name) ({ \
__failed(TESTNAME, __FUNCTION__, __LINE__, name); \
-1; \
})
#define initial_check(argc, argv) \
__initial_check(TESTNAME, argc, argv)
#define check_volume(vol_id, req) \
__check_volume(libubi, &dev_info, TESTNAME, __FUNCTION__, \
__LINE__, vol_id, req)
#define check_vol_patt(node, byte) \
__check_vol_patt(libubi, TESTNAME, __FUNCTION__, __LINE__, node, byte)
#define update_vol_patt(node, bytes, byte) \
__update_vol_patt(libubi, TESTNAME, __FUNCTION__, __LINE__, \
node, bytes, byte)
#define check_failed(ret, error, func, fmt, ...) ({ \
int __ret; \
\
if (!ret) { \
errmsg("%s() returned success but should have failed", func); \
errmsg(fmt, ##__VA_ARGS__); \
__ret = -1; \
} \
if (errno != (error)) { \
errmsg("%s failed with error %d (%s), expected %d (%s)", \
func, errno, strerror(errno), error, strerror(error)); \
errmsg(fmt, ##__VA_ARGS__); \
__ret = -1; \
} \
__ret = 0; \
})
/* Alignments to test, @s is eraseblock size */
#define ALIGNMENTS(s) \
{3, 5, 27, 666, 512, 1024, 2048, (s)/2-3, (s)/2-2, (s)/2-1, (s)/2+1, \
(s)/2+2, (s)/2+3, (s)/3-3, (s)/3-2, (s)/3-1, (s)/3+1, (s)/3+2, \
(s)/3+3, (s)/4-3, (s)/4-2, (s)/4-1, (s)/4+1, (s)/4+2, (s)/4+3, \
(s)/5-3, (s)/5-2, (s)/5-1, (s)/5+1, (s)/5+2, (s)/5+3, (s)-17, (s)-9, \
(s)-8, (s)-6, (s)-4, (s)-1, (s)};
extern int seed_random_generator(void);
extern void __errmsg(const char *test, const char *func, int line,
const char *fmt, ...);
extern void __failed(const char *test, const char *func, int line,
const char *failed);
extern int __initial_check(const char *test, int argc, char * const argv[]);
extern int __check_volume(libubi_t libubi, struct ubi_dev_info *dev_info,
const char *test, const char *func, int line,
int vol_id, const struct ubi_mkvol_request *req);
extern int __check_vol_patt(libubi_t libubi, const char *test, const char *func,
int line, const char *node, uint8_t byte);
extern int __update_vol_patt(libubi_t libubi, const char *test, const char *func,
int line, const char *node, long long bytes,
uint8_t byte);
#ifdef __cplusplus
}
#endif
#endif /* !__COMMON_H__ */
|
/* radare - LGPL - Copyright 2012-2015 - pancake, condret */
// copypasta from asm_gb.c
#include <r_types.h>
#include <r_util.h>
#include <r_asm.h>
#include <r_lib.h>
#include "../arch/6502/6502dis.c"
static int disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len) {
int dlen = _6502Disass (op, buf, len);
if(dlen<0) dlen=0;
op->size = dlen;
return dlen;
}
RAsmPlugin r_asm_plugin_6502 = {
.name = "6502",
.desc = "6502/NES/C64/T-1000 CPU",
.arch = "6502",
.bits = 8|16,
.init = NULL,
.fini = NULL,
.license = "LGPL3",
.disassemble = &disassemble,
.modify = NULL,
.assemble = NULL,
};
#ifndef CORELIB
struct r_lib_struct_t radare_plugin = {
.type = R_LIB_TYPE_ASM,
.data = &r_asm_plugin_6502,
.version = R2_VERSION
};
#endif
|
/*
* uxsel.c
*
* This module is a sort of all-purpose interchange for file
* descriptors. At one end it talks to uxnet.c and pty.c and
* anything else which might have one or more fds that need
* select()-type things doing to them during an extended program
* run; at the other end it talks to pterm.c or uxplink.c or
* anything else which might have its own means of actually doing
* those select()-type things.
*/
#include <assert.h>
#include "putty.h"
#include "tree234.h"
struct fd {
int fd;
int rwx; /* 4=except 2=write 1=read */
uxsel_callback_fn callback;
int id; /* for uxsel_input_remove */
};
static tree234 *fds;
static int uxsel_fd_cmp(void *av, void *bv)
{
struct fd *a = (struct fd *)av;
struct fd *b = (struct fd *)bv;
if (a->fd < b->fd)
return -1;
if (a->fd > b->fd)
return +1;
return 0;
}
static int uxsel_fd_findcmp(void *av, void *bv)
{
int *a = (int *)av;
struct fd *b = (struct fd *)bv;
if (*a < b->fd)
return -1;
if (*a > b->fd)
return +1;
return 0;
}
void uxsel_init(void)
{
fds = newtree234(uxsel_fd_cmp);
}
/*
* Here is the interface to fd-supplying modules. They supply an
* fd, a set of read/write/execute states, and a callback function
* for when the fd satisfies one of those states. Repeated calls to
* uxsel_set on the same fd are perfectly legal and serve to change
* the rwx state (typically you only want to select an fd for
* writing when you actually have pending data you want to write to
* it!).
*/
void uxsel_set(int fd, int rwx, uxsel_callback_fn callback)
{
struct fd *newfd;
uxsel_del(fd);
if (rwx) {
newfd = snew(struct fd);
newfd->fd = fd;
newfd->rwx = rwx;
newfd->callback = callback;
newfd->id = uxsel_input_add(fd, rwx);
add234(fds, newfd);
}
}
void uxsel_del(int fd)
{
struct fd *oldfd = find234(fds, &fd, uxsel_fd_findcmp);
if (oldfd) {
uxsel_input_remove(oldfd->id);
del234(fds, oldfd);
sfree(oldfd);
}
}
/*
* And here is the interface to select-functionality-supplying
* modules.
*/
int next_fd(int *state, int *rwx)
{
struct fd *fd;
fd = index234(fds, (*state)++);
if (fd) {
*rwx = fd->rwx;
return fd->fd;
} else
return -1;
}
int first_fd(int *state, int *rwx)
{
*state = 0;
return next_fd(state, rwx);
}
int select_result(int fd, int event)
{
struct fd *fdstruct = find234(fds, &fd, uxsel_fd_findcmp);
/*
* Apparently this can sometimes be NULL. Can't see how, but I
* assume it means I need to ignore the event since it's on an
* fd I've stopped being interested in. Sigh.
*/
if (fdstruct)
return fdstruct->callback(fd, event);
else
return 1;
}
|
/*
LUFA Library
Copyright (C) Dean Camera, 2011.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \file
*
* User Datagram Protocol (UDP) packet handling routines. This protocol handles high throughput, low
* reliability packets which are typically used to encapsulate streaming data.
*/
#define INCLUDE_FROM_UDP_C
#include "UDP.h"
/** Processes a UDP packet inside an Ethernet frame, and writes the appropriate response
* to the output Ethernet frame if a sub-protocol handler has created a response packet.
*
* \param[in] IPHeaderInStart Pointer to the start of the incoming packet's IP header
* \param[in] UDPHeaderInStart Pointer to the start of the incoming packet's UDP header
* \param[out] UDPHeaderOutStart Pointer to the start of the outgoing packet's UDP header
*
* \return The number of bytes written to the out Ethernet frame if any, NO_RESPONSE otherwise
*/
int16_t UDP_ProcessUDPPacket(void* IPHeaderInStart,
void* UDPHeaderInStart,
void* UDPHeaderOutStart)
{
UDP_Header_t* UDPHeaderIN = (UDP_Header_t*)UDPHeaderInStart;
UDP_Header_t* UDPHeaderOUT = (UDP_Header_t*)UDPHeaderOutStart;
int16_t RetSize = NO_RESPONSE;
DecodeUDPHeader(UDPHeaderInStart);
switch (SwapEndian_16(UDPHeaderIN->DestinationPort))
{
case UDP_PORT_DHCP_REQUEST:
RetSize = DHCP_ProcessDHCPPacket(IPHeaderInStart,
&((uint8_t*)UDPHeaderInStart)[sizeof(UDP_Header_t)],
&((uint8_t*)UDPHeaderOutStart)[sizeof(UDP_Header_t)]);
break;
}
/* Check to see if the protocol processing routine has filled out a response */
if (RetSize > 0)
{
/* Fill out the response UDP packet header */
UDPHeaderOUT->SourcePort = UDPHeaderIN->DestinationPort;
UDPHeaderOUT->DestinationPort = UDPHeaderIN->SourcePort;
UDPHeaderOUT->Checksum = 0;
UDPHeaderOUT->Length = SwapEndian_16(sizeof(UDP_Header_t) + RetSize);
/* Return the size of the response so far */
return (sizeof(UDP_Header_t) + RetSize);
}
return NO_RESPONSE;
}
|
//===-- X86AsmPrinter.h - X86 implementation of AsmPrinter ------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIB_TARGET_X86_X86ASMPRINTER_H
#define LLVM_LIB_TARGET_X86_X86ASMPRINTER_H
#include "X86Subtarget.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/FaultMaps.h"
#include "llvm/CodeGen/StackMaps.h"
#include "llvm/MC/MCCodeEmitter.h"
#include "llvm/Target/TargetMachine.h"
// Implemented in X86MCInstLower.cpp
namespace {
class X86MCInstLower;
}
namespace llvm {
class MCStreamer;
class MCSymbol;
class LLVM_LIBRARY_VISIBILITY X86AsmPrinter : public AsmPrinter {
const X86Subtarget *Subtarget;
StackMaps SM;
FaultMaps FM;
std::unique_ptr<MCCodeEmitter> CodeEmitter;
bool EmitFPOData = false;
bool NeedsRetpoline = false;
// This utility class tracks the length of a stackmap instruction's 'shadow'.
// It is used by the X86AsmPrinter to ensure that the stackmap shadow
// invariants (i.e. no other stackmaps, patchpoints, or control flow within
// the shadow) are met, while outputting a minimal number of NOPs for padding.
//
// To minimise the number of NOPs used, the shadow tracker counts the number
// of instruction bytes output since the last stackmap. Only if there are too
// few instruction bytes to cover the shadow are NOPs used for padding.
class StackMapShadowTracker {
public:
void startFunction(MachineFunction &MF) {
this->MF = &MF;
}
void count(MCInst &Inst, const MCSubtargetInfo &STI,
MCCodeEmitter *CodeEmitter);
// Called to signal the start of a shadow of RequiredSize bytes.
void reset(unsigned RequiredSize) {
RequiredShadowSize = RequiredSize;
CurrentShadowSize = 0;
InShadow = true;
}
// Called before every stackmap/patchpoint, and at the end of basic blocks,
// to emit any necessary padding-NOPs.
void emitShadowPadding(MCStreamer &OutStreamer, const MCSubtargetInfo &STI);
private:
const MachineFunction *MF;
bool InShadow = false;
// RequiredShadowSize holds the length of the shadow specified in the most
// recently encountered STACKMAP instruction.
// CurrentShadowSize counts the number of bytes encoded since the most
// recently encountered STACKMAP, stopping when that number is greater than
// or equal to RequiredShadowSize.
unsigned RequiredShadowSize = 0, CurrentShadowSize = 0;
};
StackMapShadowTracker SMShadowTracker;
// All instructions emitted by the X86AsmPrinter should use this helper
// method.
//
// This helper function invokes the SMShadowTracker on each instruction before
// outputting it to the OutStream. This allows the shadow tracker to minimise
// the number of NOPs used for stackmap padding.
void EmitAndCountInstruction(MCInst &Inst);
void LowerSTACKMAP(const MachineInstr &MI);
void LowerPATCHPOINT(const MachineInstr &MI, X86MCInstLower &MCIL);
void LowerSTATEPOINT(const MachineInstr &MI, X86MCInstLower &MCIL);
void LowerFAULTING_OP(const MachineInstr &MI, X86MCInstLower &MCIL);
void LowerPATCHABLE_OP(const MachineInstr &MI, X86MCInstLower &MCIL);
void LowerTlsAddr(X86MCInstLower &MCInstLowering, const MachineInstr &MI);
// XRay-specific lowering for X86.
void LowerPATCHABLE_FUNCTION_ENTER(const MachineInstr &MI,
X86MCInstLower &MCIL);
void LowerPATCHABLE_RET(const MachineInstr &MI, X86MCInstLower &MCIL);
void LowerPATCHABLE_TAIL_CALL(const MachineInstr &MI, X86MCInstLower &MCIL);
void LowerPATCHABLE_EVENT_CALL(const MachineInstr &MI, X86MCInstLower &MCIL);
void LowerPATCHABLE_TYPED_EVENT_CALL(const MachineInstr &MI,
X86MCInstLower &MCIL);
void LowerFENTRY_CALL(const MachineInstr &MI, X86MCInstLower &MCIL);
// Choose between emitting .seh_ directives and .cv_fpo_ directives.
void EmitSEHInstruction(const MachineInstr *MI);
void PrintSymbolOperand(const MachineOperand &MO, raw_ostream &O) override;
void PrintOperand(const MachineInstr *MI, unsigned OpNo, raw_ostream &O);
void PrintModifiedOperand(const MachineInstr *MI, unsigned OpNo,
raw_ostream &O, const char *Modifier);
void PrintPCRelImm(const MachineInstr *MI, unsigned OpNo, raw_ostream &O);
void PrintLeaMemReference(const MachineInstr *MI, unsigned OpNo,
raw_ostream &O, const char *Modifier);
void PrintMemReference(const MachineInstr *MI, unsigned OpNo, raw_ostream &O,
const char *Modifier);
void PrintIntelMemReference(const MachineInstr *MI, unsigned OpNo,
raw_ostream &O);
public:
X86AsmPrinter(TargetMachine &TM, std::unique_ptr<MCStreamer> Streamer);
StringRef getPassName() const override {
return "X86 Assembly Printer";
}
const X86Subtarget &getSubtarget() const { return *Subtarget; }
void EmitStartOfAsmFile(Module &M) override;
void EmitEndOfAsmFile(Module &M) override;
void EmitInstruction(const MachineInstr *MI) override;
void EmitBasicBlockEnd(const MachineBasicBlock &MBB) override {
AsmPrinter::EmitBasicBlockEnd(MBB);
SMShadowTracker.emitShadowPadding(*OutStreamer, getSubtargetInfo());
}
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
const char *ExtraCode, raw_ostream &OS) override;
bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
const char *ExtraCode, raw_ostream &OS) override;
bool doInitialization(Module &M) override {
SMShadowTracker.reset(0);
SM.reset();
FM.reset();
return AsmPrinter::doInitialization(M);
}
bool runOnMachineFunction(MachineFunction &F) override;
void EmitFunctionBodyStart() override;
void EmitFunctionBodyEnd() override;
};
} // end namespace llvm
#endif
|
/*
******************************************************************************
* Copyright (C) 1997-2008, International Business Machines
* Corporation and others. All Rights Reserved.
******************************************************************************
* file name: nfrlist.h
* encoding: US-ASCII
* tab size: 8 (not used)
* indentation:4
*
* Modification history
* Date Name Comments
* 10/11/2001 Doug Ported from ICU4J
*/
#ifndef NFRLIST_H
#define NFRLIST_H
#include "unicode/rbnf.h"
#if U_HAVE_RBNF
#include "unicode/uobject.h"
#include "nfrule.h"
#include "cmemory.h"
U_NAMESPACE_BEGIN
// unsafe class for internal use only. assume memory allocations succeed, indexes are valid.
// should be a template, but we can't use them
class NFRuleList : public UMemory {
protected:
NFRule** fStuff;
uint32_t fCount;
uint32_t fCapacity;
public:
NFRuleList(uint32_t capacity = 10)
: fStuff(capacity ? (NFRule**)uprv_malloc(capacity * sizeof(NFRule*)) : NULL)
, fCount(0)
, fCapacity(capacity) {};
~NFRuleList() {
if (fStuff) {
for(uint32_t i = 0; i < fCount; ++i) {
delete fStuff[i];
}
uprv_free(fStuff);
}
}
NFRule* operator[](uint32_t index) const { return fStuff != NULL ? fStuff[index] : NULL; }
NFRule* remove(uint32_t index) {
if (fStuff == NULL) {
return NULL;
}
NFRule* result = fStuff[index];
fCount -= 1;
for (uint32_t i = index; i < fCount; ++i) { // assumes small arrays
fStuff[i] = fStuff[i+1];
}
return result;
}
void add(NFRule* thing) {
if (fCount == fCapacity) {
fCapacity += 10;
fStuff = (NFRule**)uprv_realloc(fStuff, fCapacity * sizeof(NFRule*)); // assume success
}
if (fStuff != NULL) {
fStuff[fCount++] = thing;
} else {
fCapacity = 0;
fCount = 0;
}
}
uint32_t size() const { return fCount; }
NFRule* last() const { return (fCount > 0 && fStuff != NULL) ? fStuff[fCount-1] : NULL; }
NFRule** release() {
add(NULL); // ensure null termination
NFRule** result = fStuff;
fStuff = NULL;
fCount = 0;
fCapacity = 0;
return result;
}
private:
NFRuleList(const NFRuleList &other); // forbid copying of this class
NFRuleList &operator=(const NFRuleList &other); // forbid copying of this class
};
U_NAMESPACE_END
/* U_HAVE_RBNF */
#endif
// NFRLIST_H
#endif
|
/** \addtogroup hal */
/** @{*/
/* mbed Microcontroller Library
* Copyright (c) 2017 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MBED_ITM_API_H
#define MBED_ITM_API_H
#if DEVICE_ITM
#include <stdint.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup itm_hal Instrumented Trace Macrocell HAL API
* @{
*/
enum {
ITM_PORT_SWO = 0
};
/**
* @brief Target specific initialization function.
* This function is responsible for initializing and configuring
* the debug clock for the ITM and setting up the SWO pin for
* debug output.
*
* The only Cortex-M register that should be modified is the clock
* prescaler in TPI->ACPR.
*
* The generic mbed_itm_init initialization function will setup:
*
* ITM->LAR
* ITM->TPR
* ITM->TCR
* ITM->TER
* TPI->SPPR
* TPI->FFCR
* DWT->CTRL
*
* for SWO output on stimulus port 0.
*/
void itm_init(void);
/**
* @brief Initialization function for both generic registers and target specific clock and pin.
*/
void mbed_itm_init(void);
/**
* @brief Send data over ITM stimulus port.
*
* @param[in] port The stimulus port to send data over.
* @param[in] data The 32-bit data to send.
*
* The data is written as a single 32-bit write to the port.
*
* @return value of data sent.
*/
uint32_t mbed_itm_send(uint32_t port, uint32_t data);
/**
* @brief Send a block of data over ITM stimulus port.
*
* @param[in] port The stimulus port to send data over.
* @param[in] data The block of data to send.
* @param[in] len The number of bytes of data to send.
*
* The data is written using multiple appropriately-sized port accesses for
* efficient transfer.
*/
void mbed_itm_send_block(uint32_t port, const void *data, size_t len);
/**@}*/
#ifdef __cplusplus
}
#endif
#endif
#endif /* MBED_ITM_API_H */
/**@}*/
|
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* include/asm-arm/unified.h - Unified Assembler Syntax helper macros
*
* Copyright (C) 2008 ARM Limited
*/
#ifndef __ASM_UNIFIED_H
#define __ASM_UNIFIED_H
#if defined(__ASSEMBLY__)
.syntax unified
#else
__asm__(".syntax unified");
#endif
#ifdef CONFIG_CPU_V7M
#define AR_CLASS(x...)
#define M_CLASS(x...) x
#else
#define AR_CLASS(x...) x
#define M_CLASS(x...)
#endif
#ifdef CONFIG_THUMB2_KERNEL
#if __GNUC__ < 4
#error Thumb-2 kernel requires gcc >= 4
#endif
/* The CPSR bit describing the instruction set (Thumb) */
#define PSR_ISETSTATE PSR_T_BIT
#define ARM(x...)
#define THUMB(x...) x
#ifdef __ASSEMBLY__
#define W(instr) instr.w
#else
#define WASM(instr) #instr ".w"
#endif
#else /* !CONFIG_THUMB2_KERNEL */
/* The CPSR bit describing the instruction set (ARM) */
#define PSR_ISETSTATE 0
#define ARM(x...) x
#define THUMB(x...)
#ifdef __ASSEMBLY__
#define W(instr) instr
#else
#define WASM(instr) #instr
#endif
#endif /* CONFIG_THUMB2_KERNEL */
#endif /* !__ASM_UNIFIED_H */
|
#ifndef _isp_main_transfer_h_
#define _isp_main_transfer_h_
#define _hrt_dummy_use_blob_isp_main()\
{ char *blob = _hrt_blob_isp_main.data; blob = blob; }
#define _hrt_transfer_embedded_isp_main(code_func, data_func, bss_func, view_table_func, icache_master_func, args...) \
{\
code_func(icache, 0x0, (0), 0x78680, ## args); icache_master_func(icache, 0, 0, ## args);\
data_func(isp2600_base_dmem, 0x0, (0+ 493184), 0x61C, ## args);\
bss_func(isp2600_base_dmem, 0x620, 0x73C, ## args);\
\
}
#define _hrt_size_of_isp_main ( 0+ 493184+ 1564 )
#define _hrt_text_is_p2
#define _hrt_section_size_isp_main_icache 0x78680
/* properties of section .icache: */
#define _hrt_icache_instructions_of_isp_main 0x00001E1A
#define _hrt_icache_instruction_size_of_isp_main 0x00000040
#define _hrt_icache_instruction_aligned_size_of_isp_main 0x00000040
#define _hrt_icache_target_of_isp_main 0x00200000
#define _hrt_icache_source_of_isp_main (0)
#define _hrt_icache_size_of_isp_main 0x00078680
/* properties of section .data.base_dmem: */
#define _hrt_data_target_of_isp_main 0x00000000
#define _hrt_data_source_of_isp_main (0+ 493184)
#define _hrt_data_size_of_isp_main 0x0000061C
/* properties of section .bss.base_dmem: */
#define _hrt_bss_target_of_isp_main 0x00000620
#define _hrt_bss_size_of_isp_main 0x0000073C
#define _hrt_text_instructions_of_isp_main 0x00000000
#define _hrt_text_instruction_size_of_isp_main 0x00000000
#define _hrt_text_instruction_aligned_size_of_isp_main 0x00000000
#define _hrt_text_target_of_isp_main 0x00000000
#define _hrt_text_source_of_isp_main 0x00000000
#define _hrt_text_size_of_isp_main 0x00000000
#endif /* _isp_main_transfer_h_ */
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.