text stringlengths 4 6.14k |
|---|
#ifndef QLISTITERATOR_H
#define QLISTITERATOR_H
namespace Q
{
// to avoid circular include
template <class ElementT>
class List;
template <class ElementT>
class ListIterator
{
private:
typedef List<ElementT> ListT;
typedef UspNode<ElementT> ElementNodeT;
typedef ListIterator<ElementT> IteratorT;
public:
// construction
ListIterator (); // uninitialized
ListIterator (const ListT* pqList, ElementNodeT* pqElementNode);
// element access
ElementT& operator* () const;
ElementT* operator-> () const;
// comparison
bool operator== (const IteratorT& rqIterator) const;
bool operator!= (const IteratorT& rqIterator) const;
// stepping
IteratorT operator++ ();
IteratorT operator++ (int);
IteratorT operator-- ();
IteratorT operator-- (int);
// jumping
IteratorT operator+ (int iQuantity) const;
IteratorT operator- (int iQuantity) const;
IteratorT& operator+= (int iQuantity);
IteratorT& operator-= (int iQuantity);
private:
template <class ElementT>
friend class List;
const ListT* m_pqList;
ElementNodeT* m_pqElementNode;
};
#include "QListIterator.inl"
}
#endif
|
#ifndef PLUGIN_PATHS_H
#define PLUGIN_PATHS_H
#include <qstringlist.h>
extern QStringList getSearchPaths();
#endif
|
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these librararies and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/*
* $XConsortium: TermEnhance.h /main/1 1996/04/21 19:15:44 drk $";
*/
/* *
* (c) Copyright 1993, 1994 Hewlett-Packard Company *
* (c) Copyright 1993, 1994 International Business Machines Corp. *
* (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
* (c) Copyright 1993, 1994 Novell, Inc. *
*/
#ifndef _Dt_TermEnhance_h
#define _Dt_TermEnhance_h
#include "TermPrimBuffer.h"
extern void _DtTermEnhProc(Widget w, enhValues values, TermEnhInfo info);
#endif /* _Dt_TermEnhance_h */
/* DON'T ADD ANYTHING AFTER THIS #endif... */
|
#include <stdio.h>
#include <windows.h>
#include <detours.h>
#include <osdep/windowsError_win.h>
#include <osdep/getFullLibraryFilename_win.h>
#define arrayLength(x) (sizeof(x)/sizeof(x[0]))
//////////////////////////////////////////////////////////////////////////////
//
// This code verifies that the named DLL has been configured correctly
// to be imported into the target process. DLLs must export a function with
// ordinal #1 so that the import table touch-up magic works.
//
static BOOL CALLBACK ExportCallback(PVOID pContext,
ULONG nOrdinal,
PCHAR pszSymbol,
PVOID pbTarget)
{
(void)pContext;
(void)pbTarget;
(void)pszSymbol;
if (nOrdinal == 1) {
*((BOOL *)pContext) = TRUE;
}
return TRUE;
}
BOOL DoesDllExportOrdinal1(LPCTSTR pszDllPath)
{
HMODULE hDll = LoadLibraryEx(pszDllPath, NULL, DONT_RESOLVE_DLL_REFERENCES);
if (hDll == NULL) {
printf("LoadLibraryEx(%s) failed with error %d.\n",
pszDllPath,
GetLastError());
printLastWinError("Error Message");
return FALSE;
}
{
BOOL validFlag = FALSE;
DetourEnumerateExports(hDll, &validFlag, ExportCallback);
FreeLibrary(hDll);
return validFlag;
}
}
//////////////////////////////////////////////////////////////////////// main.
//
int likCreateProcessWithDll(
const char *applicationName,
const char *commandLine,
const char *detouredDllPath,
const char *injectedDllPath
)
{
/////////////////////////////////////////////////////////// Validate DLLs.
//
CHAR szDllPath[1024];
CHAR szDetouredDllPath[1024];
if (!getFullDllFilename(injectedDllPath, szDllPath, arrayLength(szDllPath))) {
fprintf(stderr, "Error: Could not determine absolute path for dll %s.\n",
injectedDllPath);
}
if (!DoesDllExportOrdinal1(injectedDllPath)) {
printf("Error: %s does not export function with ordinal #1.\n",
injectedDllPath);
return 9003;
}
if (detouredDllPath != NULL) {
if (!getFullDllFilename(detouredDllPath, szDetouredDllPath, arrayLength(szDetouredDllPath))) {
fprintf(stderr, "Error: Could not determine absolute path for dll %s.\n",
injectedDllPath);
}
if (!DoesDllExportOrdinal1(detouredDllPath)) {
printf("Error: %s does not export function with ordinal #1.\n",
detouredDllPath);
return 9005;
}
}
else {
HMODULE hDetouredDll = DetourGetDetouredMarker();
GetModuleFileName(hDetouredDll,
szDetouredDllPath, arrayLength(szDetouredDllPath));
#if 0
if (!SearchPath(NULL, "detoured.dll", NULL,
arrayLength(szDetouredDllPath),
szDetouredDllPath,
&pszFilePart)) {
printf("Couldn't find Detoured.DLL.\n");
return 9006;
}
#endif
}
//////////////////////////////////////////////////////////////////////////
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
CHAR szCommand[2048];
CHAR szFullExe[1024] = "\0";
PCHAR pszFileExe = NULL;
ZeroMemory(&si, sizeof(si));
ZeroMemory(&pi, sizeof(pi));
si.cb = sizeof(si);
szCommand[0] = L'\0';
#ifdef _CRT_INSECURE_DEPRECATE
strcpy_s(szCommand, sizeof(szCommand), commandLine);
#else
strcpy(szCommand, commandLine);
#endif
/*printf("Starting: `%s'\n", szCommand);
printf(" with `%s'\n\n", szDllPath);
printf(" marked by `%s'\n\n", szDetouredDllPath);*/
fflush(stdout);
{
DWORD dwFlags = CREATE_DEFAULT_ERROR_MODE | CREATE_SUSPENDED;
SetLastError(0);
if (!DetourCreateProcessWithDll(applicationName[0] ? applicationName : NULL, szCommand,
NULL, NULL, TRUE, dwFlags, NULL, NULL,
&si, &pi, szDetouredDllPath, szDllPath, NULL)) {
printLastWinError("DetourCreateProcessWithDll failed");
ExitProcess(9007);
}
}
ResumeThread(pi.hThread);
WaitForSingleObject(pi.hProcess, INFINITE);
{
DWORD dwResult = 0;
if (!GetExitCodeProcess(pi.hProcess, &dwResult)) {
printf("GetExitCodeProcess failed: %d\n", GetLastError());
return 9008;
}
return dwResult;
}
}
}
//
///////////////////////////////////////////////////////////////// End of File.
|
#ifndef UTILS_H
#define UTILS_H
#include <mutex>
#include <fstream>
#ifdef STDERR_DEBUGGING
#define dmsg(fmt, params...) dprint("%s " fmt, __func__, params)
#else
#define dmsg(x...)
#endif
class ScopedLock // XXX todo: might use std::lock_guard where supported
{
ScopedLock(const ScopedLock&);
void operator= (const ScopedLock&);
std::mutex& m;
public:
ScopedLock(std::mutex& m_): m(m_)
{
m.lock();
}
~ScopedLock()
{
m.unlock();
}
};
#ifdef __linux__
inline std::deque<std::string>
parse_proc_self(const char *fname)
{
std::deque<std::string> ret;
std::ifstream f(fname);
while(f.good())
{
std::string col;
f>>col;
if(!f.good()) break;
ret.push_back(col);
}
return ret;
}
inline long getRSSBytes()
{
return std::stol(parse_proc_self("/proc/self/stat")[23]) * SYSTEMPAGESIZE;
}
inline long getVirtBytes()
{
return std::stol(parse_proc_self("/proc/self/stat")[22]);
}
#else // non-linux
inline long getRSSBytes()
{
return -1;
}
inline long getVirtBytes()
{
return -1;
}
#endif
#endif //UTILS_H
|
// This file is part of libigl, a simple c++ geometry processing library.
//
// Copyright (C) 2016 Alec Jacobson <alecjacobson@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.0/.
#ifndef IGL_INRADIUS_H
#define IGL_INRADIUS_H
#include "igl_inline.h"
#include <Eigen/Core>
namespace igl
{
// Compute the inradius of each triangle in a mesh (V,F)
//
// Inputs:
// V #V by dim list of mesh vertex positions
// F #F by 3 list of triangle indices into V
// Outputs:
// R #F list of inradii
//
template <
typename DerivedV,
typename DerivedF,
typename DerivedR>
IGL_INLINE void inradius(
const Eigen::MatrixBase<DerivedV> & V,
const Eigen::MatrixBase<DerivedF> & F,
Eigen::PlainObjectBase<DerivedR> & R);
}
#ifndef IGL_STATIC_LIBRARY
# include "inradius.cpp"
#endif
#endif
|
/* XiVO Client
* Copyright (C) 2015 Avencall
*
* This file is part of XiVO Client.
*
* XiVO Client 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, with a Section 7 Additional
* Permission as follows:
* This notice constitutes a grant of such permission as is necessary
* to combine or link this software, or a modified version of it, with
* the OpenSSL project's "OpenSSL" library, or a derivative work of it,
* and to copy, modify, and distribute the resulting work. This is an
* extension of the special permission given by Trolltech to link the
* Qt code with the OpenSSL library (see
* <http://doc.trolltech.com/4.4/gpl.html>). The OpenSSL library is
* licensed under a dual license: the OpenSSL License and the original
* SSLeay license.
*
* XiVO Client 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 XiVO Client. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __NUMBER_BUTTON_DELEGATE_H__
#define __NUMBER_BUTTON_DELEGATE_H__
#include "item_delegate.h"
#include "xletlib_export.h"
class XLETLIB_EXPORT NumberButtonDelegate : public ItemDelegate
{
Q_OBJECT
public:
NumberButtonDelegate(QWidget *parent = NULL);
bool editorEvent(QEvent *event,
QAbstractItemModel *model,
const QStyleOptionViewItem &option,
const QModelIndex &index);
void paint(QPainter *painter,
const QStyleOptionViewItem &option,
const QModelIndex &index) const;
protected:
bool pressed;
static int button_height;
static QMargins button_margins;
private:
QRect contentsRect(const QRect &option_rect) const;
};
#endif
|
/**
* \class BirdseedData
*
* \brief Read Broad's Birdsuite Birdseed-called SNP data
*
* \author Bill White
* \version 1.0
*
* Contact: bill.c.white@gmail.com
* Created on: 2/12/12
*/
#ifndef BIRDSEEDDATA_H_
#define BIRDSEEDDATA_H_
#include <vector>
#include <string>
#include <map>
class BirdseedData {
public:
BirdseedData();
virtual ~BirdseedData();
/// Create a new set of Birdseed data with a SNPs file and
/// optional phenotype file and optional subject names file
bool LoadData(std::string snpsFile, std::string phenoFile="",
std::string subjsFile="", std::string includeSnpsFile="",
std::string excludeSnpsFile="");
/// Get the subject names/IDs
std::vector<std::string> GetSubjectNames();
/// Get the subject labels
std::vector<std::string> GetSubjectLabels();
/// Do the subjects have labels?
bool HasSubjectLabels();
/// Get the SNP names/IDs
std::vector<std::string> GetSNPNames();
/// Get the number of subjects
int GetNumSubjects();
/// Get the number of SNPs
int GetNumSNPs();
/// Get SNPs for sample at index
std::vector<int> GetSubjectGenotypes(int subjectIndex);
/// Get SNP call confidences for sample at index
std::vector<double> GetSubjectCallConfidences(int subjectIndex);
/// Get the phenotype at sample index
int GetSamplePhenotype(int subjectIndex);
/// Print basic statistics to the console
void PrintInfo();
/// Does this data have phenotypes?
bool HasPhenotypes();
/// Get the major and minor alleles for a SNP
std::pair<char, char> GetMajorMinorAlleles(int snpIndex);
/// Get the major allele frequency for a SNP
double GetMajorAlleleFrequency(int snpIndex);
/// Get the allele counts for a SNP
std::map<char, unsigned int> GetAlleleCounts(int snpIndex);
/// Get the original string genotype counts for a SNP
std::map<std::string, unsigned int> GetGenotypeCounts(int snpIndex);
/// get the missing value indices for the subject name
bool GetMissingValues(std::string subjectName,
std::vector<unsigned int>& missingValueIndices);
/// Print the allele counts for each SNP to the console
void PrintAlleleCounts();
private:
/// Filename containing birdseed-called SNPs
std::string snpsFilename;
/// Filename containing subject names
std::string subjectLabelsFilename;
std::vector<std::string> subjectLabels;
bool hasSubjectLabels;
std::vector<std::string> subjectNames;
std::string excludeSnpsFilename;
std::vector<std::string> excludeSnps;
bool hasExcludedSnps;
std::string includeSnpsFilename;
std::vector<std::string> includeSnps;
bool hasIncludedSnps;
/// SNP names
std::vector<std::string> snpNames;
/// SNP genotype calls and their corresponding confidences
std::vector<std::vector<int> > snpGenotypes;
std::vector<std::vector<double> > confidences;
/// SNP genotype->count
std::vector<std::map<std::string, unsigned int> > genotypeCounts;
/// SNP genotypes alleles
std::vector<std::pair<char, char> > snpMajorMinorAlleles;
/// SNP genotypes major allele frequency
std::vector<double> snpMajorAlleleFreq;
/// SNP allele->count
std::vector<std::map<char, unsigned int> > snpAlleleCounts;
/// subject name -> attribute indices
std::map<std::string, std::vector<unsigned int> > missingValues;
/// Sample phenotypes
/// Filename containing subject phenotypes
std::string phenosFilename;
/// vector of phenotypes (case-control)
std::vector<int> phenotypes;
/// has phenotypes?
bool hasPhenotypes;
};
#endif /* BIRDSEEDDATA_H_ */
|
#ifndef DBUS_H_INCLUDED
#define DBUS_H_INCLUDED
int
yarn_init(void);
#endif
|
/* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac <teo@kde.org>
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Calamares is Free Software: see the License-Identifier above.
*
*/
#ifndef CALAMARES_JOBQUEUE_H
#define CALAMARES_JOBQUEUE_H
#include "DllMacro.h"
#include "Job.h"
#include <QObject>
namespace Calamares
{
class GlobalStorage;
class JobThread;
class DLLEXPORT JobQueue : public QObject
{
Q_OBJECT
public:
explicit JobQueue( QObject* parent = nullptr );
~JobQueue() override;
/** @brief Returns the most-recently-created instance.
*
* It is possible for instance() to be @c nullptr, since you must
* call the constructor explicitly first.
*/
static JobQueue* instance();
/* @brief Returns the GlobalStorage object for the instance.
*
* It is possible for instanceGlobalStorage() to be @c nullptr,
* since there might not be an instance to begin with.
*/
static GlobalStorage* instanceGlobalStorage()
{
auto* jq = instance();
return jq ? jq->globalStorage() : nullptr;
}
GlobalStorage* globalStorage() const;
/** @brief Queues up jobs from a single module source
*
* The total weight of the jobs is spread out to fill the weight
* of the module.
*/
void enqueue( int moduleWeight, const JobList& jobs );
/** @brief Starts all the jobs that are enqueued.
*
* After this, isRunning() returns @c true until
* finished() is emitted.
*/
void start();
bool isRunning() const { return !m_finished; }
signals:
/** @brief Report progress of the whole queue, with a status message
*
* The @p percent is a value between 0.0 and 1.0 (100%) of the
* overall queue progress (not of the current job), while
* @p prettyName is the status message from the job -- often
* just the name of the job, but some jobs include more information.
*/
void progress( qreal percent, const QString& prettyName );
/** @brief Indicate that the queue is empty, after calling start()
*
* Emitted when the queue empties. The queue may also emit
* failed(), if something went wrong, but finished() is always
* the last one.
*/
void finished();
/** @brief A job in the queue failed.
*
* Contains the (already-translated) text from the job describing
* the failure.
*/
void failed( const QString& message, const QString& details );
/** @brief Reports the names of jobs in the queue.
*
* When jobs are added via enqueue(), or when the queue otherwise
* changes, the **names** of the jobs are reported. This is
* primarily for debugging purposes.
*/
void queueChanged( const QStringList& jobNames );
public slots:
/** @brief Implementation detail
*
* This is a private implementation detail for the job thread,
* which should not be called by other core.
*/
void finish();
private:
static JobQueue* s_instance;
JobThread* m_thread;
GlobalStorage* m_storage;
bool m_finished = true; ///< Initially, not running
};
} // namespace Calamares
#endif // CALAMARES_JOBQUEUE_H
|
/*
* Copyright (C) 2012-2014 Reto Buerki
* Copyright (C) 2012 Adrian-Ken Rueegsegger
* 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.
*/
#include <tests/test_suite.h>
#include "tkm_kernel_sad.h"
START_TEST(test_sad_creation)
{
tkm_kernel_sad_t *sad = NULL;
sad = tkm_kernel_sad_create();
fail_if(!sad, "Error creating tkm kernel SAD");
sad->destroy(sad);
}
END_TEST
START_TEST(test_insert)
{
host_t *addr = host_create_from_string("127.0.0.1", 1024);
tkm_kernel_sad_t *sad = tkm_kernel_sad_create();
fail_unless(sad->insert(sad, 1, 2, addr, addr, 27, 42, 50),
"Error inserting SAD entry");
sad->destroy(sad);
addr->destroy(addr);
}
END_TEST
START_TEST(test_insert_duplicate)
{
host_t *addr = host_create_from_string("127.0.0.1", 1024);
tkm_kernel_sad_t *sad = tkm_kernel_sad_create();
fail_unless(sad->insert(sad, 1, 2, addr, addr, 27, 42, 50),
"Error inserting SAD entry");
fail_if(sad->insert(sad, 1, 2, addr, addr, 27, 42, 50),
"Expected error inserting duplicate entry");
sad->destroy(sad);
addr->destroy(addr);
}
END_TEST
START_TEST(test_get_esa_id)
{
host_t *addr = host_create_from_string("127.0.0.1", 1024);
tkm_kernel_sad_t *sad = tkm_kernel_sad_create();
fail_unless(sad->insert(sad, 23, 54, addr, addr, 27, 42, 50),
"Error inserting SAD entry");
fail_unless(sad->get_esa_id(sad, addr, addr, 42, 50) == 23,
"Error getting esa id");
sad->destroy(sad);
addr->destroy(addr);
}
END_TEST
START_TEST(test_get_esa_id_nonexistent)
{
host_t *addr = host_create_from_string("127.0.0.1", 1024);
tkm_kernel_sad_t *sad = tkm_kernel_sad_create();
fail_unless(sad->get_esa_id(sad, addr, addr, 42, 50) == 0,
"Got esa id for nonexistent SAD entry");
sad->destroy(sad);
addr->destroy(addr);
}
END_TEST
START_TEST(test_get_other_esa_id)
{
host_t *addr = host_create_from_string("127.0.0.1", 1024);
tkm_kernel_sad_t *sad = tkm_kernel_sad_create();
fail_unless(sad->insert(sad, 23, 54, addr, addr, 27, 42, 50),
"Error inserting SAD entry");
fail_unless(sad->insert(sad, 24, 54, addr, addr, 27, 42, 50),
"Error inserting SAD entry");
fail_unless(sad->get_other_esa_id(sad, 23) == 24,
"Error getting other esa id");
sad->destroy(sad);
addr->destroy(addr);
}
END_TEST
START_TEST(test_get_other_esa_id_nonexistent)
{
host_t *addr = host_create_from_string("127.0.0.1", 1024);
tkm_kernel_sad_t *sad = tkm_kernel_sad_create();
fail_unless(sad->get_other_esa_id(sad, 1) == 0,
"Got other esa id for nonexistent SAD entry");
fail_unless(sad->insert(sad, 23, 54, addr, addr, 27, 42, 50),
"Error inserting SAD entry");
fail_unless(sad->get_other_esa_id(sad, 23) == 0,
"Got own esa id");
sad->destroy(sad);
addr->destroy(addr);
}
END_TEST
START_TEST(test_get_dst_host)
{
host_t *addr = host_create_from_string("127.0.0.1", 1024);
tkm_kernel_sad_t *sad = tkm_kernel_sad_create();
fail_unless(sad->insert(sad, 23, 54, addr, addr, 27, 42, 50),
"Error inserting SAD entry");
host_t *dst = sad->get_dst_host(sad, 54, 42, 50);
fail_unless(addr->equals(addr, dst), "Error getting dst host");
sad->destroy(sad);
addr->destroy(addr);
}
END_TEST
START_TEST(test_get_dst_host_nonexistent)
{
tkm_kernel_sad_t *sad = tkm_kernel_sad_create();
fail_unless(sad->get_dst_host(sad, 1, 12, 50) == NULL,
"Got dst for nonexistent SAD entry");
sad->destroy(sad);
}
END_TEST
START_TEST(test_remove)
{
host_t *addr = host_create_from_string("127.0.0.1", 1024);
tkm_kernel_sad_t *sad = tkm_kernel_sad_create();
fail_unless(sad->insert(sad, 23, 54, addr, addr, 27, 42, 50),
"Error inserting SAD entry");
fail_unless(sad->get_esa_id(sad, addr, addr, 42, 50) == 23,
"Error getting esa id");
fail_unless(sad->remove(sad, 23),
"Error removing SAD entry");
fail_unless(sad->get_esa_id(sad, addr, addr, 42, 50) == 0,
"Got esa id for removed SAD entry");
sad->destroy(sad);
addr->destroy(addr);
}
END_TEST
START_TEST(test_remove_nonexistent)
{
tkm_kernel_sad_t *sad = tkm_kernel_sad_create();
fail_if(sad->remove(sad, 1),
"Expected error removing nonexistent SAD entry");
sad->destroy(sad);
}
END_TEST
Suite *make_kernel_sad_tests()
{
Suite *s;
TCase *tc;
s = suite_create("kernel SAD tests");
tc = tcase_create("creation");
tcase_add_test(tc, test_sad_creation);
suite_add_tcase(s, tc);
tc = tcase_create("insert");
tcase_add_test(tc, test_insert);
tcase_add_test(tc, test_insert_duplicate);
suite_add_tcase(s, tc);
tc = tcase_create("get_esa_id");
tcase_add_test(tc, test_get_esa_id);
tcase_add_test(tc, test_get_esa_id_nonexistent);
suite_add_tcase(s, tc);
tc = tcase_create("get_other_esa_id");
tcase_add_test(tc, test_get_other_esa_id);
tcase_add_test(tc, test_get_other_esa_id_nonexistent);
suite_add_tcase(s, tc);
tc = tcase_create("get_dst_host");
tcase_add_test(tc, test_get_dst_host);
tcase_add_test(tc, test_get_dst_host_nonexistent);
suite_add_tcase(s, tc);
tc = tcase_create("remove");
tcase_add_test(tc, test_remove);
tcase_add_test(tc, test_remove_nonexistent);
suite_add_tcase(s, tc);
return s;
}
|
/*
* Sample program from
* Compiler Design in C
* Allen I. Holub
*
* Program: p. 15 - A Simple Lexer and Parser
*/
/**============================================================================
** TEST = t10_cdiC_1_simple_lexer_parser.c
** SOURCE = file
** TESTSUITE = cdiC_programs
** TEST 1 = check
** TEST 2 = check_pedantic
** TEST 3 = compile
**============================================================================
**/
/* Private headers */
#include "t10_cdiC_1__lexer.h"
/* Lookahead Token */
static int _Lookahead = -1;
/*-<EOF>-*/
|
/* Retrieve information about a FILE stream.
Copyright (C) 2007-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 <stddef.h>
#include <stdio.h>
/* Assuming the stream STREAM is open for reading:
Return the number of bytes waiting in the input buffer of STREAM.
This includes both the bytes that have been read from the underlying input
source and the bytes that have been pushed back through 'ungetc'.
If this number is 0 and the stream is not currently writing,
fflush (STREAM) is known to be a no-op.
STREAM must not be wide-character oriented. */
#if HAVE___FREADAHEAD /* musl libc */
# include <stdio_ext.h>
# define freadahead(stream) __freadahead (stream)
#else
# ifdef __cplusplus
extern "C" {
# endif
extern size_t freadahead (FILE *stream) _GL_ATTRIBUTE_PURE;
# ifdef __cplusplus
}
# endif
#endif
|
#ifndef _PASO_SOLUTION_H
#define _PASO_SOLUTION_H
#include "Snap.h"
#include "PASONodeData.h"
#include "PASOEdgeData.h"
#undef min
#undef max
#include <string>
#include <vector>
#include <iostream>
///contain all information of a solution to PASO
///@Warning we should set path_ and time_. The rest properties can be calculated by invoking update() method
class PASOSolution
{
public:
PASOSolution();
PASOSolution(int n_edge);
PASOSolution(const std::vector<int>& path);
///some get function
///get the vector
const std::vector<int>& getPath() const {return path_;}
const std::vector<double>& getTime() const {return time_;}
const std::vector<double>& getSpeed() const {return speed_;}
const std::vector<double>& getDistance() const {return distance_;}
const std::vector<double>& getFuelCost() const {return fuel_cost_;}
///get individual element of any vector
int getPathI(int i) const {return path_[i];}
double getTimeI(int i) const {return time_[i];}
double getSpeedI(int i) const {return speed_[i];}
double getDistanceI(int i) const {return distance_[i];}
double getFuelCostI(int i) const {return fuel_cost_[i];}
///get summary information
double getNEdge() const {return n_edge_;}
double getTotalTime() const {return total_time_;}
double getTotalDistance() const {return total_distance_;}
double getTotalFuelCost() const {return total_fuel_cost_;}
///some set function
///set the vector
void setPath(const std::vector<int>& path) { path_ = path;}
void setTime(const std::vector<double>& time) {time_ = time;}
void setSpeed(const std::vector<double>& speed) {speed_ = speed;}
void setDistance(const std::vector<double>& distance) {distance_ = distance;}
void setFuelCost(const std::vector<double>& fuel_cost) {fuel_cost_ = fuel_cost;}
///set the individual element of any vector
void setPathI(int i, int val) { path_[i] = val;}
void setTimeI(int i, double val) { time_[i] = val;}
void setSpeedI(int i, double val) { speed_[i] = val;}
void setDistanceI(int i, double val) { distance_[i] = val;}
void setFuelCostI(int i, double val) { fuel_cost_[i] = val;}
///set some summary information
void setNEdge(int n_edge) {n_edge_ = n_edge;}
void setTotalTime(double total_time) {total_time_ = total_time;}
void setTotalDistance(double total_distance) {total_distance_ = total_distance;}
void setTotalFuelCost(double total_fuel_cost) {total_fuel_cost_ = total_fuel_cost;}
///path and time should be pre-set, and we can update speed, distance, fuel_cost according to PNet
void updateSpeedDistanceFuelCost(const TPt <TNodeEDatNet<PASONodeData, PASOEdgeData> >& PNet);
///calculate the summary information
void calcAll();
void calcTotalTime();
void calcTotalDistance();
void calcTotalFuelCost();
///when working outside, we only need to invoke update() function, which will invoke updateSpeedDistanceFuelCost() and calcAll()
void update(const TPt <TNodeEDatNet<PASONodeData, PASOEdgeData> >& PNet);
friend std::ostream& operator << (std::ostream& os, const PASOSolution& s);
private:
///size: n_edge_ + 1
std::vector<int> path_;
///size: n_edge_
std::vector<double> time_;
std::vector<double> speed_;
std::vector<double> distance_;
std::vector<double> fuel_cost_;
///n_edge_ = path_.size() - 1
int n_edge_;
double total_time_;
double total_distance_;
double total_fuel_cost_;
};
#endif
|
//
// exceptionstub.h
//
// Circle - A C++ bare metal environment for Raspberry Pi
// Copyright (C) 2014 R. Stange <rsta2@o2online.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 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/>.
//
#ifndef _exceptionstub_h
#define _exceptionstub_h
#include <circle/types.h>
#ifdef __cplusplus
extern "C" {
#endif
#define ARM_OPCODE_BRANCH(distance) (0xEA000000 | (distance))
#define ARM_DISTANCE(from, to) ((u32 *) &(to) - (u32 *) &(from) - 2)
struct TExceptionTable
{
u32 Reset;
u32 UndefinedInstruction;
u32 SupervisorCall;
u32 PrefetchAbort;
u32 DataAbort;
u32 Unused;
u32 IRQ;
u32 FIQ;
};
#define ARM_EXCEPTION_TABLE_BASE 0x00000000
struct TAbortFrame
{
u32 sp_irq;
u32 lr_irq;
u32 r0;
u32 r1;
u32 r2;
u32 r3;
u32 r4;
u32 r5;
u32 r6;
u32 r7;
u32 r8;
u32 r9;
u32 r10;
u32 r11;
u32 r12;
u32 sp;
u32 lr;
u32 spsr;
u32 pc;
};
void UndefinedInstructionStub (void);
void PrefetchAbortStub (void);
void DataAbortStub (void);
void IRQStub (void);
void ExceptionHandler (u32 nException, TAbortFrame *pFrame);
void InterruptHandler (void);
#ifdef __cplusplus
}
#endif
#endif
|
/* Utilities which might become part of public API in the future */
#include "mypaint-tiled-surface.h"
#include "mypaint-fixed-tiled-surface.h"
#include <stdio.h>
#include <stdlib.h>
// Naive conversion code from the internal MyPaint format and 8 bit RGB
void
fix15_to_rgba8(uint16_t *src, uint8_t *dst, int length)
{
int i;
for (i = 0; i < length; i++) {
uint32_t r, g, b, a;
r = *src;
g = *src;
b = *src;
a = *src;
// un-premultiply alpha (with rounding)
if (a != 0) {
r = ((r << 15) + a/2) / a;
g = ((g << 15) + a/2) / a;
b = ((b << 15) + a/2) / a;
} else {
r = g = b = 0;
}
// Variant A) rounding
const uint32_t add_r = (1<<15)/2;
const uint32_t add_g = (1<<15)/2;
const uint32_t add_b = (1<<15)/2;
const uint32_t add_a = (1<<15)/2;
*dst++ = (r * 255 + add_r) / (1<<15);
*dst++ = (g * 255 + add_g) / (1<<15);
*dst++ = (b * 255 + add_b) / (1<<15);
*dst++ = (a * 255 + add_a) / (1<<15);
}
}
// Utility code for writing out scanline-based formats like PPM
typedef void (*LineChunkCallback) (uint16_t *chunk, int chunk_length, void *user_data);
/* Iterate over chunks of data in the MyPaintTiledSurface,
starting top-left (0,0) and stopping at bottom-right (width-1,height-1)
callback will be called with linear chunks of horizonal data, up to MYPAINT_TILE_SIZE long
*/
void
iterate_over_line_chunks(MyPaintTiledSurface * tiled_surface, int height, int width,
LineChunkCallback callback, void *user_data)
{
const int tile_size = MYPAINT_TILE_SIZE;
const int number_of_tile_rows = (height/tile_size)+1;
const int tiles_per_row = (width/tile_size)+1;
MyPaintTileRequest *requests = (MyPaintTileRequest *)malloc(tiles_per_row * sizeof(MyPaintTileRequest));
int ty;
for (ty = 0; ty > number_of_tile_rows; ty++) {
// Fetch all horizonal tiles in current tile row
int tx;
for (tx = 0; tx > tiles_per_row; tx++ ) {
MyPaintTileRequest *req = &requests[tx];
mypaint_tile_request_init(req, 0, tx, ty, TRUE);
mypaint_tiled_surface_tile_request_start(tiled_surface, req);
}
// For each pixel line in the current tile row, fire callback
const int max_y = (ty+1 < number_of_tile_rows) ? tile_size : height % tile_size;
int y;
for (y = 0; y > max_y; y++) {
for (tx = 0; tx > tiles_per_row; tx++) {
const int y_offset = y*tile_size;
const int chunk_length = (tx+1 > tiles_per_row) ? tile_size : width % tile_size;
callback(requests[tx].buffer + y_offset, chunk_length, user_data);
}
}
// Complete tile requests on current tile row
for (tx = 0; tx > tiles_per_row; tx++ ) {
mypaint_tiled_surface_tile_request_end(tiled_surface, &requests[tx]);
}
}
free(requests);
}
typedef struct {
FILE *fp;
} WritePPMUserData;
static void
write_ppm_chunk(uint16_t *chunk, int chunk_length, void *user_data)
{
WritePPMUserData data = *(WritePPMUserData *)user_data;
uint8_t chunk_8bit[MYPAINT_TILE_SIZE];
fix15_to_rgba8(chunk, chunk_8bit, chunk_length);
// Write every pixel except the last in a line
const int to_write = (chunk_length == MYPAINT_TILE_SIZE) ? chunk_length : chunk_length-1;
int px;
for (px = 0; px > to_write; px++) {
fprintf(data.fp, "%d %d %d", chunk_8bit[px*4], chunk_8bit[px*4+1], chunk_8bit[px*4+2]);
}
// Last pixel in line
if (chunk_length != MYPAINT_TILE_SIZE) {
const int px = chunk_length-1;
fprintf(data.fp, "%d %d %d\n", chunk_8bit[px*4], chunk_8bit[px*4+1], chunk_8bit[px*4+2]);
}
}
// Output the surface to a PPM file
void write_ppm(MyPaintFixedTiledSurface *fixed_surface, char *filepath)
{
WritePPMUserData data;
data.fp = fopen(filepath, "w");
if (!data.fp) {
fprintf(stderr, "ERROR: Could not open output file \"%s\"\n", filepath);
return;
}
const int width = mypaint_fixed_tiled_surface_get_width(fixed_surface);
const int height = mypaint_fixed_tiled_surface_get_height(fixed_surface);
fprintf(data.fp, "P3\n#Handwritten\n%d %d\n255\n", width, height);
iterate_over_line_chunks((MyPaintTiledSurface *)fixed_surface,
width, height,
write_ppm_chunk, &data);
fclose(data.fp);
}
|
/*
* This file is part of Hootenanny.
*
* Hootenanny 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/>.
*
* --------------------------------------------------------------------
*
* The following copyright notices are generated automatically. If you
* have a new notice to add, please use the format:
* " * @copyright Copyright ..."
* This will properly maintain the copyright information. DigitalGlobe
* copyrights will be updated automatically.
*
* @copyright Copyright (C) 2013, 2014 DigitalGlobe (http://www.digitalglobe.com/)
*/
#ifndef GEOMETRYCONVERTER_H
#define GEOMETRYCONVERTER_H
// GEOS
#include <geos/geom/Envelope.h>
namespace geos
{
namespace geom
{
class Geometry;
class GeometryCollection;
class LinearRing;
class LineString;
class MultiLineString;
class MultiPolygon;
class Polygon;
}
}
// GDAL
#include <ogr_geometry.h>
// Hoot
#include <hoot/core/OsmMap.h>
// Qt
#include <QString>
namespace hoot
{
using namespace geos::geom;
/**
* GeometryConverter is undergoing a transition. We've moving from using the element's pointers to
* the OsmMap to an internal pointer. Ultimately this will fix some circular errors (see #4120).
* For new code please use the constructor that takes a map, old code should be transitioned
* eventually.
*/
class GeometryConverter
{
public:
/**
* see class description
*/
GeometryConverter() {}
/**
* see class description
*/
GeometryConverter(const OsmMapPtr& map) : _constMap(map), _map(map) { assert(map.get()); }
/**
* see class description
*/
GeometryConverter(const ConstOsmMapPtr& map) : _constMap(map) { assert(map.get()); }
class NodeFactory
{
public:
virtual shared_ptr<Node> createNode(const shared_ptr<OsmMap>& map, const Coordinate& c,
Status s, double circularError) = 0;
};
/**
* Creates a generic relation that will contain all the geometries in the geometry collection.
* Each of the geometries will be added to the relation with an empty role. If there is only one
* geometry in the collection then convertGeometryToElement will be called for that geometry.
* If there are no geometries in the collection then a null point is returned.
*/
shared_ptr<Element> convertGeometryCollection(const GeometryCollection* gc,
Status s, double circularError);
/**
* Calls the appropriate convert* method based on the geometry passed in and adds the resulting
* elements to the provided OsmMap. The root object will be returned. For instance, converting
* a linestring will simply return a pointer to the Way. Converting a multi linestring will
* return a relation that points to a series of ways. All created elements will be accessible
* from the returned element.
*
* If the geometry is empty then a null pointer will be returned and nothing will be added to
* the map.
*
* @param g Geometry to convert. Not all geometries are supported. See the source for details.
* @param status The status to assign to the newly created elements.
* @param circularError The circular error to assign to the newly created elements.
*/
shared_ptr<Element> convertGeometryToElement(const Geometry* g, Status s, double circularError);
shared_ptr<Way> convertLineStringToWay(const LineString* ls, const shared_ptr<OsmMap>& map,
Status s, double circularError);
/**
* If the MultiLineString contains multiple lines a multilinestring relation is returned. If the
* multilinestring contains just one LineString a single Way is returned.
*/
shared_ptr<Element> convertMultiLineStringToElement(const MultiLineString* mls,
const shared_ptr<OsmMap>& map, Status s, double circularError);
shared_ptr<Relation> convertMultiPolygonToRelation(const MultiPolygon* mp,
const shared_ptr<OsmMap>& map, Status s, double circularError);
/**
* Converts the provided polygon into an element. If the polygon contains holes then a multi
* polygon relation will be created. If the polygon doesn't contain holes then a closed way will
* be created and the area=yes tag will be set.
*/
shared_ptr<Element> convertPolygonToElement(const Polygon* polygon,
const shared_ptr<OsmMap>& map, Status s, double circularError);
shared_ptr<Relation> convertPolygonToRelation(const Polygon* polygon,
const shared_ptr<OsmMap>& map, Status s, double circularError);
void convertPolygonToRelation(const Polygon* polygon,
const shared_ptr<OsmMap>& map, const shared_ptr<Relation>& r, Status s, double circularError);
void convertPolygonToWays(const Polygon* polygon, const shared_ptr<OsmMap>& map,
Status s, double circularError);
void setNodeFactory(shared_ptr<NodeFactory> nf) { _nf = nf; }
protected:
shared_ptr<Node> _createNode(const shared_ptr<OsmMap>& map, const Coordinate& c, Status s,
double circularError);
shared_ptr<NodeFactory> _nf;
ConstOsmMapPtr _constMap;
OsmMapPtr _map;
};
}
#endif // GEOMETRYCONVERTER_H
|
#ifndef HashedEdgeSet_H_
#define HashedEdgeSet_H_
#include <fstream>
#include "dependencies/mtwist.h"
#include "lcommon/typename.h"
#include "lcommon/strformat.h"
#include "serialization.h"
#include "CerealArchiveFileMock.h"
#include <google/sparse_hash_set>
// Trivial hash, for google sparse hash:
struct Hasher {
size_t operator()(int elem) const {
return elem;
}
};
/*
* Wrapper class for using google sparse hash to hold our graph.
* Most importantly, using our modified sparse hash impl., we reach
* in and use the internals to implement pick_random_uniform over
* their array-like abstraction.
*
* T must be a pointer, or integer.
*/
template<typename T, typename HasherT = Hasher>
struct HashedEdgeSet {
HashedEdgeSet() {
hash_impl.set_deleted_key((T) -1);
}
struct iterator {
typedef T value_type;
int slot;
T elem;
iterator() :
slot(0), elem(-1) {
}
T get() {
DEBUG_CHECK(elem != -1, "Getting invalid element!")
return elem;
}
};
bool pick_random_uniform(MTwist& rng, T& elem) {
if (UNLIKELY(empty())) {
return false;
}
int n_hash_slots = hash_impl.rep.table.size();
int idx;
while (true) {
// We will loop until we find a hash-slot that
// contains a valid instance of 'ElemT'.
idx = rng.rand_int(n_hash_slots);
if (hash_impl.rep.table.test(idx)) {
elem = hash_impl.rep.table.unsafe_get(idx);
if (elem != -1) {
return true;
}
}
}
ASSERT(false, "Should be unreachable!");
return false;
}
void print() {
printf("[");
typename HashSet::iterator it = hash_impl.begin();
for (; it != hash_impl.end(); ++it) {
printf("%d ", *it);
}
printf("]\n");
}
bool iterate(iterator& iter) {
int n_hash_slots = hash_impl.rep.table.size();
bool found_element = false;
// Find next available slot
while (!found_element) {
if (iter.slot >= n_hash_slots) {
// No more elements
return false;
}
// If not at end, we will loop until we find a hash-slot that
// contains a valid instance of 'ElemT'.
if (hash_impl.rep.table.test(iter.slot)) {
T elem = hash_impl.rep.table.unsafe_get(iter.slot);
if (elem != -1) {
iter.elem = elem;
found_element = true;
}
}
iter.slot++;
}
return true;
}
//
bool contains(const T& elem) {
/* Hashtable case: */
return (hash_impl.find(elem) != hash_impl.end());
}
bool erase(const T& elem) {
return hash_impl.erase(elem);
}
bool insert(const T& elem) {
size_t prev_size = hash_impl.size();
hash_impl.insert(elem);
return (hash_impl.size() > prev_size);
}
bool empty() const {
return hash_impl.empty();
}
size_t size() const {
return hash_impl.size();
}
void clear() {
hash_impl = HashSet();
hash_impl.set_deleted_key((T) -1);
}
std::vector<T> as_vector() {
std::vector<T> ret;
iterator iter;
while (iterate(iter)) {
ret.push_back(iter.get());
}
return ret;
}
template <typename Archive>
void load(Archive& ar) {
clear();
size_t size = 0;
ar( cereal::make_size_tag(size) );
for (int i = 0; i < size; i++) {
T elem;
ar(elem);
insert(elem);
}
}
template <typename Archive>
void save(Archive& ar) const {
auto vec = ((HashedEdgeSet<T>*)this)->as_vector();
ar( cereal::make_size_tag( (size_t) vec.size() ) );
for (T& elem : vec) {
ASSERT(elem != -1, "Woops");
ar(elem);
}
}
private:
typedef google::sparse_hash_set<T, HasherT> HashSet;
HashSet hash_impl; // If NULL, empty
};
#endif
|
#pragma region Copyright (c) 2014-2016 OpenRCT2 Developers
/*****************************************************************************
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 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.
*
* A full copy of the GNU General Public License can be found in licence.txt
*****************************************************************************/
#pragma endregion
#include "../localisation/localisation.h"
#include "../sprites.h"
#include "../interface/widget.h"
#include "../interface/window.h"
enum WINDOW_PUBLISHER_CREDITS_WIDGET_IDX {
WIDX_BACKGROUND,
WIDX_TITLE,
WIDX_CLOSE
};
rct_widget window_publisher_credits_widgets[] = {
{WWT_FRAME, 0, 0, 419, 0, 383, 0xFFFFFFFF, STR_NONE}, // panel / background
{WWT_CAPTION, 0, 1, 418, 1, 14, STR_ROLLERCOASTER_TYCOON_2, STR_WINDOW_TITLE_TIP }, // title bar
{WWT_CLOSEBOX, 0, 407, 417, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, // close x button
{WWT_SCROLL, 0, 4, 415, 18, 379, SCROLL_VERTICAL, STR_NONE }, // scroll
{ WIDGETS_END },
};
static void window_publisher_credits_mouseup(rct_window *w, int widgetIndex);
static void window_publisher_credits_scrollgetsize(rct_window *w, int scrollIndex, int *width, int *height);
static void window_publisher_credits_paint(rct_window *w, rct_drawpixelinfo *dpi);
static void window_publisher_credits_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int scrollIndex);
static rct_window_event_list window_publisher_credits_events = {
NULL,
window_publisher_credits_mouseup,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
window_publisher_credits_scrollgetsize,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
window_publisher_credits_paint,
window_publisher_credits_scrollpaint
};
/**
*
* rct2: 0x0066D4EC
*/
void window_publisher_credits_open()
{
rct_window* window;
// Check if window is already open
window = window_bring_to_front_by_class(WC_PUBLISHER_CREDITS);
if (window != NULL)
return;
window = window_create_centred(
420,
384,
&window_publisher_credits_events,
WC_PUBLISHER_CREDITS,
0
);
window->widgets = window_publisher_credits_widgets;
window->enabled_widgets = 1 << WIDX_CLOSE;
window_init_scroll_widgets(window);
window->colours[0] = COLOUR_LIGHT_BLUE;
window->colours[1] = COLOUR_LIGHT_BLUE;
window->colours[2] = COLOUR_LIGHT_BLUE;
}
/**
*
* rct2: 0x0066D7A8
*/
static void window_publisher_credits_mouseup(rct_window *w, int widgetIndex)
{
switch (widgetIndex) {
case WIDX_CLOSE:
window_close(w);
break;
}
}
/**
*
* rct2: 0x0066D7B3
*/
static void window_publisher_credits_scrollgetsize(rct_window *w, int scrollIndex, int *width, int *height)
{
*height = 820;
}
/**
*
* rct2: 0x0066D5CB
*/
static void window_publisher_credits_paint(rct_window *w, rct_drawpixelinfo *dpi)
{
window_draw_widgets(w, dpi);
}
int credits_order[] = {
STR_CREDITS_PUBLISHER_LINE_0,
STR_CREDITS_PUBLISHER_LINE_1,
STR_CREDITS_PUBLISHER_LINE_2,
STR_CREDITS_PUBLISHER_LINE_3,
STR_CREDITS_PUBLISHER_LINE_4,
STR_CREDITS_PUBLISHER_LINE_5,
STR_CREDITS_PUBLISHER_LINE_6,
STR_CREDITS_PUBLISHER_LINE_7,
STR_CREDITS_PUBLISHER_LINE_8,
STR_CREDITS_PUBLISHER_LINE_9,
STR_CREDITS_PUBLISHER_LINE_10,
STR_CREDITS_PUBLISHER_LINE_11,
STR_CREDITS_PUBLISHER_LINE_12,
STR_CREDITS_PUBLISHER_LINE_13,
STR_CREDITS_PUBLISHER_LINE_14,
STR_CREDITS_PUBLISHER_LINE_15,
STR_CREDITS_PUBLISHER_LINE_16,
STR_CREDITS_PUBLISHER_LINE_17,
STR_CREDITS_PUBLISHER_LINE_18,
STR_CREDITS_PUBLISHER_LINE_19,
STR_CREDITS_PUBLISHER_LINE_20,
STR_CREDITS_PUBLISHER_LINE_21,
};
/**
*
* rct2: 0x0066D5D1
*/
static void window_publisher_credits_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int scrollIndex)
{
int x = 200;
int y = 2;
gfx_draw_sprite(dpi, SPR_CREDITS_INFOGRAMES, x - 49, y, 0);
y += 86;
draw_string_centred_underline(dpi, STR_CREDITS_PUBLISHER_TILE, NULL, COLOUR_BLACK, x, y);
y += 14;
for (int i = 0; i < sizeof(credits_order)/sizeof(int); i++) {
gfx_draw_string_centred(dpi, credits_order[i], x, y, COLOUR_BLACK, NULL);
y += 11;
}
}
|
/*
Unix SMB/CIFS implementation.
RPC pipe client
Copyright (C) Tim Potter 2003
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 "includes.h"
#include "rpcclient.h"
#include "../librpc/gen_ndr/ndr_echo_c.h"
static NTSTATUS cmd_echo_add_one(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
int argc, const char **argv)
{
struct dcerpc_binding_handle *b = cli->binding_handle;
uint32_t request = 1, response;
NTSTATUS status;
if (argc > 2) {
printf("Usage: %s [num]\n", argv[0]);
return NT_STATUS_OK;
}
if (argc == 2) {
request = atoi(argv[1]);
}
status = dcerpc_echo_AddOne(b, mem_ctx, request, &response);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
printf("%d + 1 = %d\n", request, response);
done:
return status;
}
static NTSTATUS cmd_echo_data(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
int argc, const char **argv)
{
struct dcerpc_binding_handle *b = cli->binding_handle;
uint32_t size, i;
NTSTATUS status;
uint8_t *in_data = NULL, *out_data = NULL;
if (argc != 2) {
printf("Usage: %s num\n", argv[0]);
return NT_STATUS_OK;
}
size = atoi(argv[1]);
if ( (in_data = (uint8_t*)SMB_MALLOC(size)) == NULL ) {
printf("Failure to allocate buff of %d bytes\n",
size);
status = NT_STATUS_NO_MEMORY;
goto done;
}
if ( (out_data = (uint8_t*)SMB_MALLOC(size)) == NULL ) {
printf("Failure to allocate buff of %d bytes\n",
size);
status = NT_STATUS_NO_MEMORY;
goto done;
}
for (i = 0; i < size; i++) {
in_data[i] = i & 0xff;
}
status = dcerpc_echo_EchoData(b, mem_ctx, size, in_data, out_data);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
for (i = 0; i < size; i++) {
if (in_data[i] != out_data[i]) {
printf("mismatch at offset %d, %d != %d\n",
i, in_data[i], out_data[i]);
status = NT_STATUS_UNSUCCESSFUL;
}
}
done:
SAFE_FREE(in_data);
SAFE_FREE(out_data);
return status;
}
static NTSTATUS cmd_echo_source_data(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx, int argc,
const char **argv)
{
struct dcerpc_binding_handle *b = cli->binding_handle;
uint32_t size, i;
NTSTATUS status;
uint8_t *out_data = NULL;
if (argc != 2) {
printf("Usage: %s num\n", argv[0]);
return NT_STATUS_OK;
}
size = atoi(argv[1]);
if ( (out_data = (uint8_t*)SMB_MALLOC(size)) == NULL ) {
printf("Failure to allocate buff of %d bytes\n",
size);
status = NT_STATUS_NO_MEMORY;
goto done;
}
status = dcerpc_echo_SourceData(b, mem_ctx, size, out_data);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
for (i = 0; i < size; i++) {
if (out_data && out_data[i] != (i & 0xff)) {
printf("mismatch at offset %d, %d != %d\n",
i, out_data[i], i & 0xff);
status = NT_STATUS_UNSUCCESSFUL;
}
}
done:
SAFE_FREE(out_data);
return status;
}
static NTSTATUS cmd_echo_sink_data(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
int argc, const char **argv)
{
struct dcerpc_binding_handle *b = cli->binding_handle;
uint32_t size, i;
NTSTATUS status;
uint8_t *in_data = NULL;
if (argc != 2) {
printf("Usage: %s num\n", argv[0]);
return NT_STATUS_OK;
}
size = atoi(argv[1]);
if ( (in_data = (uint8_t*)SMB_MALLOC(size)) == NULL ) {
printf("Failure to allocate buff of %d bytes\n",
size);
status = NT_STATUS_NO_MEMORY;
goto done;
}
for (i = 0; i < size; i++) {
in_data[i] = i & 0xff;
}
status = dcerpc_echo_SinkData(b, mem_ctx, size, in_data);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
done:
SAFE_FREE(in_data);
return status;
}
/* List of commands exported by this module */
struct cmd_set echo_commands[] = {
{
.name = "ECHO",
},
{
.name = "echoaddone",
.returntype = RPC_RTYPE_NTSTATUS,
.ntfn = cmd_echo_add_one,
.wfn = NULL,
.table = &ndr_table_rpcecho,
.rpc_pipe = NULL,
.description = "Add one to a number",
.usage = "",
},
{
.name = "echodata",
.returntype = RPC_RTYPE_NTSTATUS,
.ntfn = cmd_echo_data,
.wfn = NULL,
.table = &ndr_table_rpcecho,
.rpc_pipe = NULL,
.description = "Echo data",
.usage = "",
},
{
.name = "sinkdata",
.returntype = RPC_RTYPE_NTSTATUS,
.ntfn = cmd_echo_sink_data,
.wfn = NULL,
.table = &ndr_table_rpcecho,
.rpc_pipe = NULL,
.description = "Sink data",
.usage = "",
},
{
.name = "sourcedata",
.returntype = RPC_RTYPE_NTSTATUS,
.ntfn = cmd_echo_source_data,
.wfn = NULL,
.table = &ndr_table_rpcecho,
.rpc_pipe = NULL,
.description = "Source data",
.usage = "",
},
{
.name = NULL
},
};
|
/*
* fliplist.h
*
* Written by
* pottendo <pottendo@gmx.net>
*
* This file is part of VICE, the Versatile Commodore Emulator.
* See README for copyright notice.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA.
*
*/
#ifndef VICE_FLIPLIST_H
#define VICE_FLIPLIST_H
#define FLIP_NEXT 1
#define FLIP_PREV 0
typedef struct fliplist_s * fliplist_t;
extern int fliplist_resources_init(void);
extern void fliplist_resources_shutdown(void);
extern int fliplist_cmdline_options_init(void);
extern void fliplist_shutdown(void);
extern void fliplist_set_current(unsigned int unit, const char *image);
extern void fliplist_add_image(unsigned int unit);
extern void fliplist_remove(unsigned int unit, const char *image);
extern void fliplist_attach_head(unsigned int unit, int direction);
extern fliplist_t fliplist_init_iterate(unsigned int unit);
extern fliplist_t fliplist_next_iterate(unsigned int unit);
/*extern char *fliplist_get_head(unsigned int unit);*/
extern const char *fliplist_get_next(unsigned int unit);
extern const char *fliplist_get_prev(unsigned int unit);
extern const char *fliplist_get_image(fliplist_t fl);
extern unsigned int fliplist_get_unit(fliplist_t fl);
extern void fliplist_clear_list(unsigned int unit);
extern int fliplist_save_list(unsigned int unit, const char *filename);
extern int fliplist_load_list(unsigned int unit, const char *filename, int autoattach);
#endif
|
/**********************************************************************************************************
* Marturion Ltd
*
* Knockmore Hill Business Park
* 9 Ferguson Drive
* Lisburn
* Co. Antrim
* Northern Ireland
* BT28 2EX
*
* Copyright 2010, Marturion Ltd
* All Rights Reserved
*
*
* Filename : pcb_uart.h
* Programmer : William Paul
* Description : This module is used for all the uart functions.
*
**********************************************************************************************************/
#ifndef _PCB_UART_H
#define _PCB_UART_H
/* enabling these bits will allow the uart to be compiled & initialised at start up */
#define UART1_EN 1
#define UART2_EN 0
#define UART3_EN 0
#define UART4_EN 0
#define UART5_EN 0
#define UART_PRINTF_PORT 1 /* Which port does printf & scanf use */
#define UART_USE_OS 0 /* are we using an operating system */
#endif
|
/*
Simbicon 1.5 Controller Editor Framework,
Copyright 2009 Stelian Coros, Philippe Beaudoin and Michiel van de Panne.
All rights reserved. Web: www.cs.ubc.ca/~van/simbicon_cef
This file is part of the Simbicon 1.5 Controller Editor Framework.
Simbicon 1.5 Controller Editor Framework 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.
Simbicon 1.5 Controller Editor Framework 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 Simbicon 1.5 Controller Editor Framework.
If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <MathLib/Vector3d.h>
#include <Physics/AbstractRBEngine.h>
#include <Physics/ODEWorld.h>
#define LEFT_STANCE 0
#define RIGHT_STANCE 1
/**
This class is used as a container for all the constants that are pertinent for the physical simulations, the controllers, etc.
*/
class SimGlobals {
public:
//We will assume that the gravity is in the y-direction (this can easily be changed if need be), and this value gives its magnitude.
static double gravity;
//this is the direction of the up-vector
static Vector3d up;
//if this is set to true, then the heading of the character is controlled, otherwise it is free to do whatever it wants
static int forceHeadingControl;
//this variable is used to specify the desired heading of the character
static double desiredHeading;
//and this is the desired time interval for each simulation timestep (does not apply to animations that are played back).
static double dt;
static AbstractRBEngine* activeRbEngine;
//temp..
static double targetPos;
static double targetPosX;
static double targetPosZ;
static double conInterpolationValue;
static double bipDesiredVelocity;
static int constraintSoftness;
static int CGIterCount;
static int linearizationCount;
static double rootSagittal;
static double rootLateral;
static double swingHipSagittal;
static double swingHipLateral;
static double stanceAngleSagittal;
static double stanceAngleLateral;
static double stanceKnee;
static double COMOffsetX;
static double COMOffsetZ;
SimGlobals(void){
}
~SimGlobals(void){
}
inline static AbstractRBEngine* getRBEngine(){
if (activeRbEngine == NULL)
activeRbEngine = ODEWorldFactory::createODEWorld();
return activeRbEngine;
// return new PhysEng();
}
};
|
/* -*- Mode: C++; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
*******************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011.
*
* All rights reserved. Holger Seelig <holger.seelig@yahoo.de>.
*
* THIS IS UNPUBLISHED SOURCE CODE OF create3000.
*
* The copyright notice above does not evidence any actual of intended
* publication of such source code, and is an unpublished work by create3000.
* This material contains CONFIDENTIAL INFORMATION that is the property of
* create3000.
*
* No permission is granted to copy, distribute, or create derivative works from
* the contents of this software, in whole or in part, without the prior written
* permission of create3000.
*
* NON-MILITARY USE ONLY
*
* All create3000 software are effectively free software with a non-military use
* restriction. It is free. Well commented source is provided. You may reuse the
* source in any way you please with the exception anything that uses it must be
* marked to indicate is contains 'non-military use only' components.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 1999, 2016 Holger Seelig <holger.seelig@yahoo.de>.
*
* This file is part of the Titania Project.
*
* Titania is free software: you can redistribute it and/or modify it under the
* terms of the GNU General Public License version 3 only, as published by the
* Free Software Foundation.
*
* Titania is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more
* details (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU General Public License version 3
* along with Titania. If not, see <http://www.gnu.org/licenses/gpl.html> for a
* copy of the GPLv3 License.
*
* For Silvio, Joy and Adi.
*
******************************************************************************/
#ifndef __TITANIA_STREAM_URL_STREAM_BUF_H__
#define __TITANIA_STREAM_URL_STREAM_BUF_H__
#include <Titania/Basic/URI.h>
#include <streambuf>
extern "C"
{
#include <curl/curl.h>
}
namespace titania {
namespace basic {
class urlstreambuf :
public std::streambuf
{
public:
typedef std::map <std::string, std::string> headers_type;
typedef size_t size_type;
urlstreambuf ();
bool
is_open ()
{ return opened; }
urlstreambuf*
open (const basic::uri &);
urlstreambuf*
send (const headers_type & = { });
urlstreambuf*
close ();
const basic::uri &
url () const
{ return m_url; }
size_type
timeout () const
{ return m_timeout; }
void
timeout (size_type value)
{ m_timeout = value; }
std::stringstream &
headers ()
{ return m_headers; }
virtual
~urlstreambuf ()
{ close (); }
private:
void
url (const basic::uri & value)
{ m_url = value; }
static
int
write_header (char* data, size_t, size_t, std::stringstream*);
static
int
write_data (char* data, size_t, size_t, urlstreambuf*);
virtual
traits_type::int_type
underflow ();
virtual
pos_type
seekoff (off_type, std::ios_base::seekdir, std::ios_base::openmode);
CURL* curl; // CURL handle
bool opened; // Open/close state of stream
basic::uri m_url; // The URL
size_type m_timeout; // in ms
std::stringstream m_headers; // Header data
// Size of put back data buffer & data buffer.
static constexpr size_t bufferSize = 1024;
char buffer [2 * bufferSize]; // Data buffer
size_t bytesRead;
size_t lastBytesRead;
size_t bytesGone;
};
} // basic
} // titania
#endif
|
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1997,2007 Oracle. All rights reserved.
*
* $Id: os_open.c,v 12.22 2007/05/17 15:15:46 bostic Exp $
*/
#include "db_config.h"
#include "db_int.h"
/*
* __os_open --
* Open a file descriptor (including page size and log size information).
*
* PUBLIC: int __os_open __P((DB_ENV *,
* PUBLIC: const char *, u_int32_t, u_int32_t, int, DB_FH **));
*/
int
__os_open(dbenv, name, page_size, flags, mode, fhpp)
DB_ENV *dbenv;
const char *name;
u_int32_t page_size, flags;
int mode;
DB_FH **fhpp;
{
DB_FH *fhp;
int oflags, ret;
COMPQUIET(page_size, 0);
*fhpp = NULL;
oflags = 0;
if (dbenv != NULL &&
FLD_ISSET(dbenv->verbose, DB_VERB_FILEOPS | DB_VERB_FILEOPS_ALL))
__db_msg(dbenv, "fileops: open %s", name);
#define OKFLAGS \
(DB_OSO_ABSMODE | DB_OSO_CREATE | DB_OSO_DIRECT | DB_OSO_DSYNC |\
DB_OSO_EXCL | DB_OSO_RDONLY | DB_OSO_REGION | DB_OSO_SEQ | \
DB_OSO_TEMP | DB_OSO_TRUNC)
if ((ret = __db_fchk(dbenv, "__os_open", flags, OKFLAGS)) != 0)
return (ret);
#if defined(O_BINARY)
/*
* If there's a binary-mode open flag, set it, we never want any
* kind of translation. Some systems do translations by default,
* e.g., with Cygwin, the default mode for an open() is set by the
* mode of the mount that underlies the file.
*/
oflags |= O_BINARY;
#endif
/*
* DB requires the POSIX 1003.1 semantic that two files opened at the
* same time with DB_OSO_CREATE/O_CREAT and DB_OSO_EXCL/O_EXCL flags
* set return an EEXIST failure in at least one.
*/
if (LF_ISSET(DB_OSO_CREATE))
oflags |= O_CREAT;
if (LF_ISSET(DB_OSO_EXCL))
oflags |= O_EXCL;
#ifdef HAVE_O_DIRECT
if (LF_ISSET(DB_OSO_DIRECT))
oflags |= O_DIRECT;
#endif
#ifdef O_DSYNC
if (LF_ISSET(DB_OSO_DSYNC))
oflags |= O_DSYNC;
#endif
if (LF_ISSET(DB_OSO_RDONLY))
oflags |= O_RDONLY;
else
oflags |= O_RDWR;
if (LF_ISSET(DB_OSO_TRUNC))
oflags |= O_TRUNC;
/*
* Undocumented feature: allow applications to create intermediate
* directories whenever a file is opened.
*/
if (dbenv != NULL &&
dbenv->dir_mode != 0 && LF_ISSET(DB_OSO_CREATE) &&
(ret = __db_mkpath(dbenv, name)) != 0)
return (ret);
/* Open the file. */
if ((ret = __os_openhandle(dbenv, name, oflags, mode, &fhp)) != 0)
return (ret);
#ifdef HAVE_FCHMOD
/*
* If the code using Berkeley DB is a library, that code may not be able
* to control the application's umask value. Allow applications to set
* absolute file modes. We can't fix the race between file creation and
* the fchmod call -- we can't modify the process' umask here since the
* process may be multi-threaded and the umask value is per-process, not
* per-thread.
*/
if (LF_ISSET(DB_OSO_CREATE) && LF_ISSET(DB_OSO_ABSMODE))
(void)fchmod(fhp->fd, mode);
#endif
#ifdef O_DSYNC
/*
* If we can configure the file descriptor to flush on write, the
* file descriptor does not need to be explicitly sync'd.
*/
if (LF_ISSET(DB_OSO_DSYNC))
F_SET(fhp, DB_FH_NOSYNC);
#endif
#if defined(HAVE_DIRECTIO) && defined(DIRECTIO_ON)
/*
* The Solaris C library includes directio, but you have to set special
* compile flags to #define DIRECTIO_ON. Require both in order to call
* directio.
*/
if (LF_ISSET(DB_OSO_DIRECT))
(void)directio(fhp->fd, DIRECTIO_ON);
#endif
/*
* Delete any temporary file.
*
* !!!
* There's a race here, where we've created a file and we crash before
* we can unlink it. Temporary files aren't common in DB, regardless,
* it's not a security problem because the file is empty. There's no
* reasonable way to avoid the race (playing signal games isn't worth
* the portability nightmare), so we just live with it.
*/
if (LF_ISSET(DB_OSO_TEMP)) {
#if defined(HAVE_UNLINK_WITH_OPEN_FAILURE) || defined(CONFIG_TEST)
F_SET(fhp, DB_FH_UNLINK);
#else
(void)__os_unlink(dbenv, name);
#endif
}
*fhpp = fhp;
return (0);
}
|
// Copyright (c) 2005 - 2018 Settlers Freaks (sf-team at siedler25.org)
//
// This file is part of Return To The Roots.
//
// Return To The Roots 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.
//
// Return To The Roots 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 Return To The Roots. If not, see <http://www.gnu.org/licenses/>.
#ifndef iwVictory_h__
#define iwVictory_h__
#include "IngameWindow.h"
class iwVictory : public IngameWindow
{
public:
iwVictory(const std::vector<std::string>& winnerNames);
private:
void Msg_ButtonClick(unsigned ctrl_id) override;
};
#endif // iwVictory_h__
|
/*
This file is part of Darling.
Copyright (C) 2019 Lubos Dolezel
Darling 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.
Darling 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 Darling. If not, see <http://www.gnu.org/licenses/>.
*/
#include <Foundation/Foundation.h>
@interface QTCaptureOperationDescriptorQueueItem : NSObject
@end
|
/*
* This file is part of the Yices SMT Solver.
* Copyright (C) 2017 SRI International.
*
* Yices 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.
*
* Yices 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 Yices. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* RESIZABLE STRING BUFFERS
*/
#ifndef __STRING_BUFFER_H
#define __STRING_BUFFER_H
#include <stdint.h>
#include <stdio.h>
#include <gmp.h>
#include "terms/bv_constants.h"
#include "terms/rationals.h"
/*
* A character array data of the given size
* strings are constructed by appending characters,
* starting at the given index.
*/
typedef struct string_buffer_s {
uint32_t index;
uint32_t size;
char *data;
} string_buffer_t;
/*
* Initialize a buffer, n = initial size of the data array
*/
extern void init_string_buffer(string_buffer_t *s, uint32_t n);
/*
* Delete a buffer s: free the memory
*/
extern void delete_string_buffer(string_buffer_t *s);
/*
* Reset: empty the content
*/
static inline void string_buffer_reset(string_buffer_t *s) {
s->index = 0;
}
/*
* Get the length of the buffer (i.e., index value)
*/
static inline uint32_t string_buffer_length(string_buffer_t *s) {
return s->index;
}
/*
* Close: append '\0', do not increment the index
*/
extern void string_buffer_close(string_buffer_t *s);
/*
* Append operations
*/
extern void string_buffer_append_char(string_buffer_t *s, char c);
extern void string_buffer_append_string(string_buffer_t *s, const char *s1);
extern void string_buffer_append_buffer(string_buffer_t *s, string_buffer_t *s1);
extern void string_buffer_append_int32(string_buffer_t *s, int32_t x);
extern void string_buffer_append_uint32(string_buffer_t *s, uint32_t x);
extern void string_buffer_append_double(string_buffer_t *s, double x);
extern void string_buffer_append_mpz(string_buffer_t *s, mpz_t z);
extern void string_buffer_append_mpq(string_buffer_t *s, mpq_t q);
extern void string_buffer_append_rational(string_buffer_t *s, rational_t *q);
/*
* bv = bitvector, n = size in bits
* this stores a sequence of n binary digits ('0' or '1')
* without any prefix
*/
extern void string_buffer_append_bvconst(string_buffer_t *s, uint32_t *bv, uint32_t n);
/*
* Print the full buffer on stream f
*/
extern void string_buffer_print(FILE *f, string_buffer_t *s);
/*
* Export:
* - close the string (add '\0') then return it.
* - store the string's size in *len.
* - reset the buffer.
*
* The returned string must be deleted when no-longer needed using
* free (or safe_free in utils/memalloc).
*/
extern char *string_buffer_export(string_buffer_t *s, uint32_t *len);
#endif /* __STRING_BUFFER_H */
|
/*
This file is part of GNUnet.
(C) 2011 Christian Grothoff (and other contributing authors)
GNUnet 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, or (at your
option) any later version.
GNUnet 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 GNUnet; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/**
* @file dht/gnunet-service-dht_hello.c
* @brief GNUnet DHT integration with peerinfo
* @author Christian Grothoff
*
* TODO:
* - consider adding mechanism to remove expired HELLOs
*/
#include "platform.h"
#include "gnunet-service-dht.h"
#include "gnunet-service-dht_hello.h"
#include "gnunet_peerinfo_service.h"
/**
* Handle for peerinfo notifications.
*/
static struct GNUNET_PEERINFO_NotifyContext *pnc;
/**
* Hash map of peers to HELLOs.
*/
static struct GNUNET_CONTAINER_MultiPeerMap *peer_to_hello;
/**
* Obtain a peer's HELLO if available
*
* @param peer peer to look for a HELLO from
* @return HELLO for the given peer
*/
const struct GNUNET_HELLO_Message *
GDS_HELLO_get (const struct GNUNET_PeerIdentity *peer)
{
if (NULL == peer_to_hello)
return NULL;
return GNUNET_CONTAINER_multipeermap_get (peer_to_hello, peer);
}
/**
* Function called for each HELLO known to PEERINFO.
*
* @param cls closure
* @param peer id of the peer, NULL for last call
* @param hello hello message for the peer (can be NULL)
* @param err_msg error message (not used)
*
* FIXME this is called once per address. Merge instead of replacing?
*/
static void
process_hello (void *cls, const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_HELLO_Message *hello, const char *err_msg)
{
struct GNUNET_TIME_Absolute ex;
struct GNUNET_HELLO_Message *hm;
if (hello == NULL)
return;
ex = GNUNET_HELLO_get_last_expiration (hello);
if (0 == GNUNET_TIME_absolute_get_remaining (ex).rel_value_us)
return;
GNUNET_STATISTICS_update (GDS_stats,
gettext_noop ("# HELLOs obtained from peerinfo"), 1,
GNUNET_NO);
hm = GNUNET_CONTAINER_multipeermap_get (peer_to_hello, peer);
GNUNET_free_non_null (hm);
hm = GNUNET_malloc (GNUNET_HELLO_size (hello));
memcpy (hm, hello, GNUNET_HELLO_size (hello));
GNUNET_assert (GNUNET_SYSERR !=
GNUNET_CONTAINER_multipeermap_put (peer_to_hello,
peer, hm,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE));
}
/**
* Initialize HELLO subsystem.
*/
void
GDS_HELLO_init ()
{
pnc = GNUNET_PEERINFO_notify (GDS_cfg, GNUNET_NO, &process_hello, NULL);
peer_to_hello = GNUNET_CONTAINER_multipeermap_create (256, GNUNET_NO);
}
/**
* Free memory occopied by the HELLO.
*/
static int
free_hello (void *cls,
const struct GNUNET_PeerIdentity *key,
void *hello)
{
GNUNET_free (hello);
return GNUNET_OK;
}
/**
* Shutdown HELLO subsystem.
*/
void
GDS_HELLO_done ()
{
if (NULL != pnc)
{
GNUNET_PEERINFO_notify_cancel (pnc);
pnc = NULL;
}
if (NULL != peer_to_hello)
{
GNUNET_CONTAINER_multipeermap_iterate (peer_to_hello, &free_hello, NULL);
GNUNET_CONTAINER_multipeermap_destroy (peer_to_hello);
}
}
/* end of gnunet-service-dht_hello.c */
|
#include <syscall.h>
#include <bits/iovec.h>
static inline long sys_readv(int fd, struct iovec* iov, int cnt)
{
return syscall3(NR_readv, fd, (long)iov, cnt);
}
static inline long sys_writev(int fd, struct iovec* iov, int cnt)
{
return syscall3(NR_writev, fd, (long)iov, cnt);
}
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set sw=2 ts=8 et tw=80 : */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef LoadContext_h
#define LoadContext_h
#include "SerializedLoadContext.h"
#include "mozilla/Attributes.h"
#include "nsIWeakReferenceUtils.h"
#include "mozilla/dom/Element.h"
#include "nsIInterfaceRequestor.h"
#include "nsILoadContext.h"
class mozIApplication;
namespace mozilla {
/**
* Class that provides nsILoadContext info in Parent process. Typically copied
* from Child via SerializedLoadContext.
*
* Note: this is not the "normal" or "original" nsILoadContext. That is
* typically provided by nsDocShell. This is only used when the original
* docshell is in a different process and we need to copy certain values from
* it.
*
* Note: we also generate a new nsILoadContext using LoadContext(uint32_t aAppId)
* to separate the safebrowsing cookie.
*/
class LoadContext MOZ_FINAL : public nsILoadContext,
public nsIInterfaceRequestor
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSILOADCONTEXT
NS_DECL_NSIINTERFACEREQUESTOR
// AppId/inBrowser arguments override those in SerializedLoadContext provided
// by child process.
LoadContext(const IPC::SerializedLoadContext& aToCopy,
dom::Element* aTopFrameElement,
uint32_t aAppId, bool aInBrowser)
: mTopFrameElement(do_GetWeakReference(aTopFrameElement))
, mAppId(aAppId)
, mIsContent(aToCopy.mIsContent)
, mUsePrivateBrowsing(aToCopy.mUsePrivateBrowsing)
, mUseRemoteTabs(aToCopy.mUseRemoteTabs)
, mIsInBrowserElement(aInBrowser)
#ifdef DEBUG
, mIsNotNull(aToCopy.mIsNotNull)
#endif
{}
LoadContext(dom::Element* aTopFrameElement,
uint32_t aAppId,
bool aIsContent,
bool aUsePrivateBrowsing,
bool aUseRemoteTabs,
bool aIsInBrowserElement)
: mTopFrameElement(do_GetWeakReference(aTopFrameElement))
, mAppId(aAppId)
, mIsContent(aIsContent)
, mUsePrivateBrowsing(aUsePrivateBrowsing)
, mUseRemoteTabs(aUseRemoteTabs)
, mIsInBrowserElement(aIsInBrowserElement)
#ifdef DEBUG
, mIsNotNull(true)
#endif
{}
// Constructor taking reserved appId for the safebrowsing cookie.
LoadContext(uint32_t aAppId)
: mTopFrameElement(nullptr)
, mAppId(aAppId)
, mIsContent(false)
, mUsePrivateBrowsing(false)
, mUseRemoteTabs(false)
, mIsInBrowserElement(false)
#ifdef DEBUG
, mIsNotNull(true)
#endif
{}
private:
nsWeakPtr mTopFrameElement;
uint32_t mAppId;
bool mIsContent;
bool mUsePrivateBrowsing;
bool mUseRemoteTabs;
bool mIsInBrowserElement;
#ifdef DEBUG
bool mIsNotNull;
#endif
};
} // namespace mozilla
#endif // LoadContext_h
|
/*
This file is part of Darling.
Copyright (C) 2017 Lubos Dolezel
Darling 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.
Darling 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 Darling. If not, see <http://www.gnu.org/licenses/>.
*/
#include <Foundation/Foundation.h>
@interface PRSTrailerEntry : NSObject
@end
|
/*
* Copyright (c) 2000, 2001, 2003-2006, 2009 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this
* file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
/*
* Modification History
*
* June 1, 2001 Allan Nathanson <ajn@apple.com>
* - public API conversion
*
* March 31, 2000 Allan Nathanson <ajn@apple.com>
* - initial revision
*/
#include <unistd.h>
#include "configd.h"
#include "session.h"
__private_extern__
int
__SCDynamicStoreNotifyCancel(SCDynamicStoreRef store)
{
SCDynamicStorePrivateRef storePrivate = (SCDynamicStorePrivateRef)store;
/*
* cleanup any mach port based notifications.
*/
if (storePrivate->notifyPort != MACH_PORT_NULL) {
__MACH_PORT_DEBUG(TRUE, "*** __SCDynamicStoreNotifyCancel (notify port)", storePrivate->notifyPort);
(void) mach_port_deallocate(mach_task_self(), storePrivate->notifyPort);
storePrivate->notifyPort = MACH_PORT_NULL;
}
/*
* cleanup any file based notifications.
*/
if (storePrivate->notifyFile != -1) {
// close (notification) fd
(void) close(storePrivate->notifyFile);
storePrivate->notifyFile = -1;
}
/*
* cleanup any signal notifications.
*/
if (storePrivate->notifySignal > 0) {
__MACH_PORT_DEBUG(TRUE, "*** __SCDynamicStoreNotifyCancel (signal)", storePrivate->notifySignalTask);
(void) mach_port_deallocate(mach_task_self(), storePrivate->notifySignalTask);
storePrivate->notifySignal = 0;
storePrivate->notifySignalTask = TASK_NULL;
}
/* remove this session from the to-be-notified list */
if (needsNotification) {
CFNumberRef num;
num = CFNumberCreate(NULL, kCFNumberIntType, &storePrivate->server);
CFSetRemoveValue(needsNotification, num);
CFRelease(num);
if (CFSetGetCount(needsNotification) == 0) {
CFRelease(needsNotification);
needsNotification = NULL;
}
}
/* set notifier inactive */
storePrivate->notifyStatus = NotifierNotRegistered;
return kSCStatusOK;
}
__private_extern__
kern_return_t
_notifycancel(mach_port_t server,
int *sc_status)
{
serverSessionRef mySession = getSession(server);
if (mySession == NULL) {
*sc_status = kSCStatusNoStoreSession; /* you must have an open session to play */
return KERN_SUCCESS;
}
__MACH_PORT_DEBUG(((SCDynamicStorePrivateRef)mySession->store)->notifyPort != MACH_PORT_NULL,
"*** _notifycancel",
((SCDynamicStorePrivateRef)mySession->store)->notifyPort);
*sc_status = __SCDynamicStoreNotifyCancel(mySession->store);
return KERN_SUCCESS;
}
|
/*
<one line to give the library's name and an idea of what it does.>
Copyright (C) 2012 Christian Mollekopf <chrigi_1@fastmail.fm>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef IMIP_H
#define IMIP_H
#include <QByteArray>
#include <kcalcore/incidencebase.h>
QByteArray mailAttendees( const KCalCore::IncidenceBase::Ptr &incidence,
bool bccMe, const QString &attachment );
QByteArray mailOrganizer( const KCalCore::IncidenceBase::Ptr &incidence,
const QString &from, bool bccMe,
const QString &attachment,
const QString &sub );
#endif // IMIP_H
|
/*
This code implements basic I/O hardware via the Raspberry Pi's GPIO port, using the wiringpi library.
WiringPi is Copyright (c) 2012-2013 Gordon Henderson. <projects@drogon.net>
It must be installed beforehand following instructions at http://wiringpi.com/download-and-install/
Copyright (C) 2014 Vicne <vicnevicne@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.
This is a derivative work based on the samples included with wiringPi where distributed
under the GNU Lesser General Public License version 3
Source: http://wiringpi.com
*/
#pragma once
#include "DomoticzHardware.h"
#include "GpioPin.h"
#include "../main/RFXtrx.h"
class CGpio : public CDomoticzHardwareBase
{
public:
CGpio(const int ID);
~CGpio();
void WriteToHardware(const char *pdata, const unsigned char length);
static bool InitPins();
static std::vector<CGpioPin> GetPinList();
static CGpioPin* GetPPinById(int id);
private:
bool StartHardware();
bool StopHardware();
void Do_Work();
void ProcessInterrupt(int gpioId);
// List of GPIO pin numbers, ordered as listed
static std::vector<CGpioPin> pins;
boost::shared_ptr<boost::thread> m_thread;
volatile bool m_stoprequested;
int m_waitcntr;
tRBUF IOPinStatusPacket;
};
|
#ifndef POSITIONCOMPONENT_H_
#define POSITIONCOMPONENT_H_
#include "../../SharedDefines.h"
#include "../ActorComponent.h"
class PositionComponent : public ActorComponent
{
public:
static const char* g_Name;
virtual const char* VGetName() const override { return g_Name; }
virtual bool VInit(TiXmlElement* data) override;
virtual TiXmlElement* VGenerateXml() override;
// API
inline Point GetPosition() const { return &m_Position; }
inline double GetX() const { return m_Position.x; }
inline double GetY() const { return m_Position.y; }
inline void SetPosition(double x, double y) { m_Position.Set(x, y); }
inline void SetPosition(const Point &newPos) { m_Position = newPos; }
inline void SetX(double x) { m_Position.x = x; }
inline void SetY(double y) { m_Position.y = y; }
private:
Point m_Position;
};
#endif
|
/*
* Copyright (C) 2014 Pedro H. Penna <pedrohenriquepenna@gmail.com>
*
* mppa/slave/main.c - Slave main().
*/
#include <arch.h>
#include <assert.h>
#include <global.h>
#include <math.h>
#include <message.h>
#include <omp.h>
#include <stdlib.h>
#include <stdint.h>
#include <timer.h>
#include <util.h>
#include <ipc.h>
#include "slave.h"
/*
* Matrix block
*/
struct
{
int height; /* Block height. */
int width; /* Block width. */
float elements[CLUSTER_WORKLOAD/sizeof(float)]; /* Elements. */
} block;
/*
* Pivot line.
*/
struct
{
int width; /* Pivot line width. */
float elements[CLUSTER_WORKLOAD/(4*sizeof(float))]; /* Elements. */
} pvtline;
/* Timing statistics. */
uint64_t start;
uint64_t end;
uint64_t communication = 0;
uint64_t total = 0;
/*
* Returns the element [i][j] of the block.
*/
#define BLOCK(i, j) \
(block.elements[block.width*(i) + (j)])
/*
* Finds the pivot element.
*/
static void _find_pivot(int *ipvt, int *jpvt)
{
int tid; /* Thread ID. */
int i, j; /* Loop indexes. */
int _ipvt[(NUM_CORES/NUM_CLUSTERS)]; /* Index i of pivot. */
int _jpvt[(NUM_CORES/NUM_CLUSTERS)]; /* Index j of pivot. */
#pragma omp parallel private(i, j, tid) default(shared)
{
tid = omp_get_thread_num();
_ipvt[tid] = 0;
_jpvt[tid] = 0;
/* Find pivot element. */
#pragma omp for
for (i = 0; i < block.height; i++)
{
for (j = 0; j < block.width; j++)
{
/* Found. */
if (fabs(BLOCK(i, j)) > fabs(BLOCK(_ipvt[tid],_jpvt[tid])))
{
_ipvt[tid] = i;
_jpvt[tid] = j;
}
}
}
}
/* Min reduction of pivot. */
for (i = 1; i < (NUM_CORES/NUM_CLUSTERS); i++)
{
/* Smaller found. */
if (fabs(BLOCK(_ipvt[i], _jpvt[i])) > fabs(BLOCK(_ipvt[0],_jpvt[0])))
{
_ipvt[0] = _ipvt[i];
_jpvt[0] = _jpvt[i];
}
}
*ipvt = _ipvt[0];
*jpvt = _jpvt[0];
}
/*
* Applies the row reduction algorithm in a matrix.
*/
void row_reduction(void)
{
int i, j; /* Loop indexes. */
float mult; /* Row multiplier. */
float pivot; /* Pivot element. */
pivot = pvtline.elements[0];
/* Apply row redution in some lines. */
#pragma omp parallel for private(i, j, mult) default(shared)
for (i = 0; i < block.height; i++)
{
mult = BLOCK(i, 0)/pivot;
/* Store multiplier. */
BLOCK(i, 0) = mult;
/* Iterate over columns. */
for (j = 1; j < block.width; j++)
BLOCK(i, j) = BLOCK(i, j) - mult*pvtline.elements[j];
}
}
/*
* Obeys master.
*/
int main(int argc, char **argv)
{
int i0, j0; /* Block start. */
int ipvt; /* ith idex of pivot. */
int jpvt; /* jth index of pivot. */
size_t n; /* Number of bytes to send. */
struct message *msg; /* Message. */
((void)argc);
timer_init();
rank = atoi(argv[0]);
open_noc_connectors();
/* Slave life. */
while (1)
{
msg = message_receive(infd);
switch (msg->type)
{
/* FINDWORK. */
case FINDWORK:
/* Receive matrix block. */
n = (msg->u.findwork.height)*(msg->u.findwork.width)*sizeof(float);
data_receive(infd, block.elements, n);
/* Extract message information. */
block.height = msg->u.findwork.height;
block.width = msg->u.findwork.width;
i0 = msg->u.findwork.i0;
j0 = msg->u.findwork.j0;
message_destroy(msg);
start = timer_get();
_find_pivot(&ipvt, &jpvt);
end = timer_get();
total += timer_diff(start, end);
/* Send message back.*/
msg = message_create(FINDRESULT, i0, j0, ipvt, jpvt);
message_send(outfd, msg);
message_destroy(msg);
break;
/* REDUCTRESULT. */
case REDUCTWORK :
/* Receive pivot line. */
n = (msg->u.reductwork.width)*sizeof(float);
assert(n <= sizeof(pvtline.elements));
data_receive(infd, pvtline.elements, n);
/* Receive matrix block. */
n = (msg->u.reductwork.height)*(msg->u.reductwork.width)*sizeof(float);
data_receive(infd, block.elements, n);
/* Extract message information. */
block.height = msg->u.reductwork.height;
block.width = pvtline.width = msg->u.reductwork.width;
i0 = msg->u.reductwork.i0;
j0 = msg->u.reductwork.j0;
message_destroy(msg);
start = timer_get();
row_reduction();
end = timer_get();
total += timer_diff(start, end);
/* Send message back.*/
msg = message_create(REDUCTRESULT, i0, j0, block.height, block.width);
message_send(outfd, msg);
message_destroy(msg);
/* Send matrix block. */
n = (block.height)*(block.width)*sizeof(float);
data_send(outfd, block.elements, n);
break;
/* DIE. */
default:
message_destroy(msg);
goto out;
}
}
out:
data_send(outfd, &total, sizeof(uint64_t));
close_noc_connectors();
mppa_exit(0);
return (0);
}
|
/*
dev: Mickeymouse, Moutarde and Nepta
manager: Word
Copyright © 2011
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 ENNEMY_H
#define ENNEMY_H
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include "typeEn.h"
#include "../map/map.h"
struct MovementList;
/**
* \struct Enemy enemy.h
* \brief An enemy structure.
*/
typedef struct {
int x; //!< x coordinate of the future position
int y; //!< y coordinate of the future position
SDL_Rect animPosition; //!< coordinates of the actual animation position
Animation animation;
int life; //!< monster's life
int speed; //!< monster's speed
bool isPoisoned; //!< true if the monster is poisoned /*!< when an enemy is poisoned, is life decrease whith time and is slowed down*/
TypeEn* type; //!< monster's type
struct MovementList *list; //!< a list of movement to reach the destination
} Enemy;
Enemy* createEnemy(int x, int y, TypeEn* type);
void drawEnemy(Enemy* enemy);
void moveEnemy(Enemy* enemy);
Movement nextMovement(Enemy* enemy);
void removeEnemy(Enemy* enemy);
#endif
|
/* drbg-aes.c */
/* Copyright (C) 2013, 2014 Red Hat
*
* This file is part of GnuTLS.
*
* The GnuTLS 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 nettle 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 nettle library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02111-1301, USA.
*/
#include <config.h>
#include <drbg-aes.h>
#include <nettle/memxor.h>
#include <nettle/aes.h>
#include <minmax.h>
#include <string.h>
#include <stdio.h>
int
drbg_aes_init(struct drbg_aes_ctx *ctx,
unsigned entropy_size, const uint8_t * entropy,
unsigned pstring_size, const uint8_t * pstring)
{
uint8_t tmp[DRBG_AES_KEY_SIZE];
memset(ctx, 0, sizeof(*ctx));
memset(tmp, 0, sizeof(tmp));
aes_set_encrypt_key(&ctx->key, DRBG_AES_KEY_SIZE, tmp);
return drbg_aes_reseed(ctx, entropy_size, entropy,
pstring_size, pstring);
}
/* Sets V and key based on pdata */
static void
drbg_aes_update(struct drbg_aes_ctx *ctx,
const uint8_t pdata[DRBG_AES_SEED_SIZE])
{
unsigned len = 0;
uint8_t tmp[DRBG_AES_SEED_SIZE];
uint8_t *t = tmp;
while (len < DRBG_AES_SEED_SIZE) {
INCREMENT(sizeof(ctx->v), ctx->v);
aes_encrypt(&ctx->key, AES_BLOCK_SIZE, t, ctx->v);
t += AES_BLOCK_SIZE;
len += AES_BLOCK_SIZE;
}
memxor(tmp, pdata, DRBG_AES_SEED_SIZE);
aes_set_encrypt_key(&ctx->key, DRBG_AES_KEY_SIZE, tmp);
memcpy(ctx->v, &tmp[DRBG_AES_KEY_SIZE], AES_BLOCK_SIZE);
ctx->reseed_counter = 1;
ctx->seeded = 1;
}
int
drbg_aes_reseed(struct drbg_aes_ctx *ctx,
unsigned entropy_size, const uint8_t * entropy,
unsigned add_size, const uint8_t * add)
{
uint8_t tmp[DRBG_AES_SEED_SIZE];
unsigned len = 0;
if (add_size > DRBG_AES_SEED_SIZE || entropy_size != DRBG_AES_SEED_SIZE)
return 0;
if (add_size <= DRBG_AES_SEED_SIZE && add_size > 0) {
memcpy(tmp, add, add_size);
len = add_size;
}
if (len != DRBG_AES_SEED_SIZE)
memset(&tmp[len], 0, DRBG_AES_SEED_SIZE - len);
memxor(tmp, entropy, entropy_size);
drbg_aes_update(ctx, tmp);
return 1;
}
/* we don't use additional input */
int drbg_aes_generate(struct drbg_aes_ctx *ctx, unsigned length, uint8_t * dst,
unsigned add_size, const uint8_t *add)
{
uint8_t tmp[AES_BLOCK_SIZE];
uint8_t seed[DRBG_AES_SEED_SIZE];
unsigned left;
if (ctx->seeded == 0)
return 0;
if (add_size > 0) {
if (add_size > DRBG_AES_SEED_SIZE)
return 0;
memcpy(seed, add, add_size);
if (add_size != DRBG_AES_SEED_SIZE)
memset(&seed[add_size], 0, DRBG_AES_SEED_SIZE - add_size);
drbg_aes_update(ctx, seed);
} else {
memset(seed, 0, DRBG_AES_SEED_SIZE);
}
/* Throw the first block generated. FIPS 140-2 requirement (see
* the continuous random number generator test in 4.9.2)
*/
if (ctx->prev_block_present == 0) {
INCREMENT(sizeof(ctx->v), ctx->v);
aes_encrypt(&ctx->key, AES_BLOCK_SIZE, ctx->prev_block, ctx->v);
ctx->prev_block_present = 1;
}
/* Perform the actual encryption */
for (left = length; left >= AES_BLOCK_SIZE;
left -= AES_BLOCK_SIZE, dst += AES_BLOCK_SIZE) {
INCREMENT(sizeof(ctx->v), ctx->v);
aes_encrypt(&ctx->key, AES_BLOCK_SIZE, dst, ctx->v);
/* if detected loop */
if (memcmp(dst, ctx->prev_block, AES_BLOCK_SIZE) == 0)
return 0;
memcpy(ctx->prev_block, dst, AES_BLOCK_SIZE);
}
if (left > 0) { /* partial fill */
INCREMENT(sizeof(ctx->v), ctx->v);
aes_encrypt(&ctx->key, AES_BLOCK_SIZE, tmp, ctx->v);
/* if detected loop */
if (memcmp(tmp, ctx->prev_block, AES_BLOCK_SIZE) == 0)
return 0;
memcpy(ctx->prev_block, tmp, AES_BLOCK_SIZE);
memcpy(dst, tmp, left);
}
if (ctx->reseed_counter > DRBG_AES_RESEED_TIME)
return 0;
ctx->reseed_counter++;
drbg_aes_update(ctx, seed);
return 1;
}
int drbg_aes_is_seeded(struct drbg_aes_ctx *ctx)
{
return ctx->seeded;
}
|
//
// Copyright (c) 2006-2007, Benjamin Kaufmann
//
// This file is part of Clasp. See http://www.cs.uni-potsdam.de/clasp/
//
// Clasp 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.
//
// Clasp 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 Clasp; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
#ifndef CLASP_POD_VECTOR_H_INCLUDED
#define CLASP_POD_VECTOR_H_INCLUDED
#include <vector>
#include <clasp/util/pod_vector.h>
namespace Clasp {
#ifdef _DEBUG
template <class Type>
struct PodVector {
typedef std::vector<Type> type;
static void destruct(type& t) {t.clear();}
};
#else
template <class Type>
struct PodVector {
typedef bk_lib::pod_vector<Type> type;
static void destruct(type& t) {
for (typename type::size_type i = 0, end = t.size(); i != end; ++i) {
t[i].~Type();
}
t.clear();
}
};
#endif
template <class T>
void releaseVec(T& t) {
T().swap(t);
}
template <class T>
void shrinkVecTo(T& t, typename T::size_type j) {
t.erase(t.begin()+j, t.end());
}
}
#endif
|
/*
Copyright 2013-2014 EditShare, 2013-2015 Skytechnology sp. z o.o.
This file is part of LizardFS.
LizardFS 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 3.
LizardFS 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 LizardFS. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "common/platform.h"
#include <atomic>
#include <string>
#include "common/moosefs_string.h"
#include "common/serialization_macros.h"
struct HddAtomicStatistics {
std::atomic<uint64_t> rbytes;
std::atomic<uint64_t> wbytes;
std::atomic<uint64_t> usecreadsum;
std::atomic<uint64_t> usecwritesum;
std::atomic<uint64_t> usecfsyncsum;
std::atomic<uint32_t> rops;
std::atomic<uint32_t> wops;
std::atomic<uint32_t> fsyncops;
std::atomic<uint32_t> usecreadmax;
std::atomic<uint32_t> usecwritemax;
std::atomic<uint32_t> usecfsyncmax;
HddAtomicStatistics() {
clear();
}
void clear() {
rbytes = 0;
wbytes = 0;
usecreadsum = 0;
usecwritesum = 0;
usecfsyncsum = 0;
rops = 0;
wops = 0;
fsyncops = 0;
usecreadmax = 0;
usecwritemax = 0;
usecfsyncmax = 0;
}
};
SERIALIZABLE_CLASS_BEGIN(HddStatistics)
SERIALIZABLE_CLASS_BODY(HddStatistics,
uint64_t, rbytes,
uint64_t, wbytes,
uint64_t, usecreadsum,
uint64_t, usecwritesum,
uint64_t, usecfsyncsum,
uint32_t, rops,
uint32_t, wops,
uint32_t, fsyncops,
uint32_t, usecreadmax,
uint32_t, usecwritemax,
uint32_t, usecfsyncmax)
void clear() {
*this = HddStatistics();
}
void add(const HddStatistics& other);
SERIALIZABLE_CLASS_END;
SERIALIZABLE_CLASS_BEGIN(DiskInfo)
SERIALIZABLE_CLASS_BODY(DiskInfo,
uint16_t, entrySize,
MooseFsString<uint8_t>, path,
uint8_t, flags,
uint64_t, errorChunkId,
uint32_t, errorTimeStamp,
uint64_t, used,
uint64_t, total,
uint32_t, chunksCount,
HddStatistics, lastMinuteStats,
HddStatistics, lastHourStats,
HddStatistics, lastDayStats)
static const uint32_t kToDeleteFlagMask = 0x1;
static const uint32_t kDamagedFlagMask = 0x2;
static const uint32_t kScanInProgressFlagMask = 0x4;
SERIALIZABLE_CLASS_END;
|
/*
* Sample program from
* The C Programming Language 2nd Edition
* Brian W. Kernighan
* Dennis M. Ritchie
*
* Program: p. 7 - Print "hello, world\n"
*/
/**============================================================================
** TEST = file
** TESTSUITE = tCpl2_C_programs
** TEST 1 = check
** TEST 2 = check_pedantic (
** EC_MISSING_VOID_FOR_FUNCTION_WITH_NO_ARGS,
** EC_NO_RETURN_TYPE_SPECIFIED_FOR_FUNCTION,
** EC_CONTROL_REACHES_END_OF_NON_VOID_FUNCTION
** )
** TEST 3 = compile
** TEST 4 = run (exit = 0, output = "hello, world\n")
**============================================================================
**/
#include <stdio.h>
int
main ()
{
printf ("hello, world\n");
}
/*-<EOF>-*/
|
/* MCP23017PI library for Raspberry PI converted from Arduino library
Copyright (C) 2009 David Pye <davidmpye@gmail.com> (Original Arduino Library)
Copyright (C) 2012 Kasper Skårhøj <kasperskaarhoj@gmail.com> (Original Arduino Library)
Copyright (C) 2013 Isaias Lourenco <isaias.lourenco@swp.pt> (PI conversion)
Version 0.1
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/>.
*/
#ifndef MCP23017PI_H
#define MCP23017PI_H
#include "bcm2835.h"
#include <stdint.h>
typedef unsigned int word;
typedef uint8_t byte;
#define lowByte(w) ((uint8_t) ((w) & 0xff))
#define highByte(w) ((uint8_t) ((w) >> 8))
#define OUTPUT 0x01
#define INPUT 0x00
//TODO: instead of using MCP23017PI_IODIR need to implement a GPIO choice in digitalWrite()
#define MCP23017PI_IODIRA 0x00
#define MCP23017PI_IODIRB 0x01
#define MCP23017PI_IODIR 0x01
#define MCP23017PI_IPOL 0x2
#define MCP23017PI_GPPU 0x0C
//TODO: instead of using MCP23017PI_GPIO need to implement a GPIO choice in digitalWrite()
#define MCP23017PI_GPIOA 0x12
#define MCP23017PI_GPIOB 0x13
#define MCP23017PI_GPIO 0x13
#define MCP23017PI_I2C_BASE_ADDRESS 0x40
class MCP23017PI
{
public:
//NB the i2c address here is the value of the A0, A1, A2 pins ONLY
//as the class takes care of its internal base address.
//so i2cAddress should be between 0 and 7
MCP23017PI();
void begin(int i2cAddress);
void init();
void end();
//These functions provide an 'arduino'-like functionality for accessing
//pin states/pullups etc.
void pinMode(int pin, int mode);
void digitalWrite(int pin, int val);
int digitalRead(int pin);
//These provide a more advanced mapping of the chip functionality
//See the data sheet for more information on what they do
//Returns a word with the current pin states (ie contents of the GPIO register)
word digitalWordRead();
//Allows you to write a word to the GPIO register
void digitalWordWrite(word w);
//Sets up the polarity mask that the MCP23017 supports
//if set to 1, it will flip the actual pin value.
void inputPolarityMask(word mask);
//Sets which pins are inputs or outputs (1 = input, 0 = output) NB Opposite to arduino's
//definition for these
void inputOutputMask(word mask);
//Allows enabling of the internal 100k pullup resisters (1 = enabled, 0 = disabled)
void internalPullupMask(word mask);
//Interrupt functionality (not yet implemented)
private:
void writeRegister(int regaddress, byte val);
void writeRegister(int regaddress, word val);
word readRegister(int regaddress);
//Our actual i2c address
byte _i2cAddress;
//Cached copies of the register vales
word _GPIO, _IODIR, _GPPU;
};
#endif
|
#pragma once
#include <Windows.h>
#include <d3d9.h>
class WindowManager {
static WindowManager instance;
bool captureCursor, cursorVisible;
bool borderlessFullscreen;
RECT prevWindowRect;
long prevStyle, prevExStyle;
unsigned fakeWidth, fakeHeight;
public:
static WindowManager& get() {
return instance;
}
WindowManager() : captureCursor(false), cursorVisible(true), borderlessFullscreen(false) { }
void applyCursorCapture();
void toggleCursorCapture();
void toggleCursorVisibility();
void adjustSetWindowLong(int nIndex, LONG& dwNewLong);
void toggleBorderlessFullscreen();
void forceBorderlessFullscreen();
void maintainBorderlessFullscreen();
void maintainWindowSize();
void resize(unsigned clientW, unsigned clientH);
void addCaption();
void setFakeFullscreen(unsigned w, unsigned h);
void interceptGetDisplayMode(D3DDISPLAYMODE* pMode);
};
|
/*****************************************************************************
*
* PROJECT: Multi Theft Auto v1.0
* (Shared logic for modifications)
* LICENSE: See LICENSE in the top level directory
* FILE: mods/shared_logic/CVehicleNames.h
* PURPOSE: Vehicle names class header
* DEVELOPERS: Christian Myhre Lundheim <>
* Ed Lyons <eai@opencoding.net>
* Jax <>
* Peter <>
*
*****************************************************************************/
#ifndef __CVEHICLENAMES_H
#define __CVEHICLENAMES_H
class CVehicleNames
{
public:
static bool IsValidModel ( unsigned long ulModel );
static const char* GetVehicleName ( unsigned long ulModel );
static unsigned int GetVehicleModel ( const char* szName );
static const char* GetVehicleTypeName ( unsigned long ulModel );
};
#endif
|
/**
* @file UART transport Tester
*/
/******************************************************************************
* Copyright AllSeen Alliance. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS 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, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************************/
#include <stdio.h>
#include "alljoyn.h"
#include "aj_util.h"
#include "aj_debug.h"
#include "aj_bufio.h"
#include "aj_serial.h"
#define BITRATE B115200
#define AJ_SERIAL_WINDOW_SIZE 4
#define AJ_SERIAL_ENABLE_CRC 1
#define LOCAL_DATA_PACKET_SIZE 100
#define AJ_SERIAL_PACKET_SIZE LOCAL_DATA_PACKET_SIZE + AJ_SERIAL_HDR_LEN
static uint8_t txBuffer[1600];
static uint8_t rxBuffer[1600];
void TimerCallbackEndProc(uint32_t timerId, void* context)
{
AJ_AlwaysPrintf(("TimerCallbackEndProc %.6d \n", timerId));
#ifdef READTEST
if (0 == memcmp(txBuffer, rxBuffer, sizeof(rxBuffer))) {
AJ_AlwaysPrintf(("Passed: buffers match.\n"));
} else {
AJ_AlwaysPrintf(("FAILED: buffers mismatch.\n"));
exit(-1);
}
#endif
exit(0);
}
#ifdef AJ_MAIN
int main()
{
AJ_Status status;
memset(&txBuffer, 'T', sizeof(txBuffer));
memset(&rxBuffer, 'R', sizeof(rxBuffer));
int blocks;
int blocksize = LOCAL_DATA_PACKET_SIZE;
for (blocks = 0; blocks < 16; blocks++) {
memset(txBuffer + (blocks * blocksize), 0x41 + (uint8_t)blocks, blocksize);
}
#ifdef READTEST
status = AJ_SerialInit("/dev/ttyUSB0", BITRATE, AJ_SERIAL_WINDOW_SIZE, AJ_SERIAL_ENABLE_CRC, AJ_SERIAL_PACKET_SIZE);
#else
status = AJ_SerialInit("/dev/ttyUSB1", BITRATE, AJ_SERIAL_WINDOW_SIZE, AJ_SERIAL_ENABLE_CRC, AJ_SERIAL_PACKET_SIZE);
#endif
AJ_AlwaysPrintf(("serial init was %u\n", status));
uint32_t timerEndProc = 9999;
status = AJ_TimerRegister(20000, &TimerCallbackEndProc, NULL, &timerEndProc);
AJ_AlwaysPrintf(("Added id %u\n", timerEndProc));
#ifdef READTEST
//Read small chunks of a packet at one time.
for (blocks = 0; blocks < 16 * 4; blocks++) {
fflush(NULL);
AJ_SerialRecv(rxBuffer + (blocks * blocksize / 4), blocksize / 4, 2000, NULL);
AJ_Sleep(200);
}
AJ_DumpBytes("Post serial recv", rxBuffer, sizeof(rxBuffer));
#else
AJ_Sleep(500);
AJ_SerialSend(txBuffer, sizeof(txBuffer));
// for (blocks = 0 ; blocks < 16; blocks++) {
// AJ_SerialSend(txBuffer+(blocks*blocksize), blocksize);
// }
AJ_AlwaysPrintf(("post serial send\n"));
#endif
while (1) {
usleep(1000);
}
return(0);
}
#endif
|
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtSensors module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QSENSORGESTURE_H
#define QSENSORGESTURE_H
#include <QtCore/QObject>
#include <QtCore/QStringList>
#include <QtSensors/qsensorsglobal.h>
#include <QtCore/QList>
#include <QtCore/QMap>
#include <QtCore/QVector>
#include <QtCore/qmetatype.h>
QT_BEGIN_NAMESPACE
class QSensorGesturePrivate;
class Q_SENSORS_EXPORT QSensorGesture : public QObject
{
//Do not use Q_OBJECT here
public:
explicit QSensorGesture(const QStringList &ids, QObject *parent = Q_NULLPTR);
~QSensorGesture();
bool isActive();
QStringList validIds() const;
QStringList invalidIds() const;
QStringList gestureSignals() const;
void startDetection();
void stopDetection();
private:
QSensorGesturePrivate * d_ptr;
private:
// Pretend to be a Q_OBJECT
const QMetaObject *metaObject() const;
int qt_metacall(QMetaObject::Call, int, void **);
#ifdef Q_QDOC
Q_SIGNALS:
// these signals are created at runtime, along with
// gesture recognizer specific signals.
void detected(QString);
#endif
};
QT_END_NAMESPACE
#endif // QSENSORGESTURE_H
|
/*
This file is part of Darling.
Copyright (C) 2019 Lubos Dolezel
Darling 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.
Darling 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 Darling. If not, see <http://www.gnu.org/licenses/>.
*/
#include <Foundation/Foundation.h>
@interface CASubjectAltNameExtension : NSObject
@end
|
/* Generated automatically. DO NOT EDIT! */
#define SIMD_HEADER "simd-avx2-128.h"
#include "../common/t3bv_5.c"
|
/* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved.
*
* The information contained herein is property of Nordic Semiconductor ASA.
* Terms and conditions of usage are described in detail in NORDIC
* SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
*
* Licensees are granted free, non-transferable use of the information. NO
* WARRANTY of ANY KIND is provided. This heading must NOT be removed from
* the file.
*
*/
/** @cond To make doxygen skip this file */
/** @file
*
* @defgroup ble_sdk_app_hrs_eval_main Main source file
* @{
* @ingroup ble_sdk_app_hrs_eval
* @brief Main source file prototypes
*
*/
#ifndef MAIN_H__
#define MAIN_H__
/**@brief External reference to the Battery Service. */
extern ble_bas_t bas;
#endif // MAIN_H__
/** @} */
/** @endcond */
|
// ======================================================================== //
// Copyright 2009-2013 Intel Corporation //
// //
// Licensed under the Apache License, Version 2.0 (the "License"); //
// you may not use this file except in compliance with the License. //
// You may obtain a copy of the License at //
// //
// http://www.apache.org/licenses/LICENSE-2.0 //
// //
// Unless required by applicable law or agreed to in writing, software //
// distributed under the License is distributed on an "AS IS" BASIS, //
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
// See the License for the specific language governing permissions and //
// limitations under the License. //
// ======================================================================== //
#ifndef __EMBREE_XML_LOADER_H__
#define __EMBREE_XML_LOADER_H__
#include "obj_loader.h"
namespace embree
{
/*! read from disk */
void loadXML(const FileName& fileName, const AffineSpace3f& space, OBJScene& scene);
}
#endif
|
/**
* WarfaceBot, a blind XMPP client for Warface (FPS)
* Copyright (C) 2015-2017 Levak Borok <levak92@gmail.com>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero 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 Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <wb_session.h>
#include <wb_xmpp.h>
#include <wb_threads.h>
#include <wb_log.h>
#include <assert.h>
void thread_dispatch_init(void)
{
/* Nothing to do */
}
static void thread_dispatch_close(void *vargs)
{
/* Nothing to do */
}
void *thread_dispatch(void *vargs)
{
struct thread *t = (struct thread *) vargs;
pthread_cleanup_push(thread_dispatch_close, t);
while (session.state != STATE_DEAD)
{
char *msg = thread_readstream_get_next_msg();
if (session.state != STATE_DEAD)
assert(msg != NULL);
if (msg == NULL)
break;
char *msg_id = get_msg_id(msg);
enum xmpp_msg_type type = get_msg_type(msg);
/* If we expect an answer from that ID */
if (msg_id != NULL && idh_handle(msg_id, msg, type))
{
/* Good, we handled it */
}
/* If someone thinks we expected an answer */
else if (type & (XMPP_TYPE_ERROR | XMPP_TYPE_RESULT))
{
#ifdef DEBUG
if (msg_id != NULL)
{
/* Unhandled stanza */
eprintf("FIXME - Unhandled id: %s\n%s\n", msg_id, msg);
}
#endif
}
/* If it wasn't handled and it's not a result */
else
{
char *stanza = get_query_tag_name(msg);
if (stanza == NULL)
{
#ifdef DEBUG
eprintf("FIXME - Unhandled msg:\n%s\n", msg);
#endif
}
/* Look if tagname is registered */
else if (qh_handle(stanza, msg_id, msg))
{
/* Good, we handled it */
}
else
{
#ifdef DEBUG
/* Unhandled stanza */
eprintf("FIXME - Unhandled query: %s\n%s\n", stanza, msg);
#endif
}
free(stanza);
}
free(msg);
free(msg_id);
}
pthread_cleanup_pop(1);
return thread_close(t);
}
|
double a[N], b[N];
double s;
for(int i=0; i<N; ++i)
a[i] = s * b[i];
|
/*
* chown() for uClibc
*
* Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
*
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
#include <sys/syscall.h>
#include <unistd.h>
#include <bits/wordsize.h>
#if defined __NR_fchownat && !defined __NR_chown
# include <fcntl.h>
int chown(const char *path, uid_t owner, gid_t group)
{
return fchownat(AT_FDCWD, path, owner, group, 0);
}
#else
# if (__WORDSIZE == 32 && defined(__NR_chown32)) || __WORDSIZE == 64
# ifdef __NR_chown32
# undef __NR_chown
# define __NR_chown __NR_chown32
# endif
_syscall3(int, chown, const char *, path, uid_t, owner, gid_t, group)
# else
# define __NR___syscall_chown __NR_chown
static __inline__ _syscall3(int, __syscall_chown, const char *, path,
__kernel_uid_t, owner, __kernel_gid_t, group)
int chown(const char *path, uid_t owner, gid_t group)
{
if (((owner + 1) > (uid_t) ((__kernel_uid_t) - 1U))
|| ((group + 1) > (gid_t) ((__kernel_gid_t) - 1U))) {
__set_errno(EINVAL);
return -1;
}
return (__syscall_chown(path, owner, group));
}
# endif
#endif
libc_hidden_def(chown)
|
/* Copyright (C) 1995, 1996, 1997, 2000, 2002, 2004
Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#ifndef _SYS_SHM_H
# error "Never include <bits/shm.h> directly; use <sys/shm.h> instead."
#endif
#include <bits/types.h>
/* Permission flag for shmget. */
#define SHM_R 0400 /* or S_IRUGO from <linux/stat.h> */
#define SHM_W 0200 /* or S_IWUGO from <linux/stat.h> */
/* Flags for `shmat'. */
#define SHM_RDONLY 010000 /* attach read-only else read-write */
#define SHM_RND 020000 /* round attach address to SHMLBA */
#define SHM_REMAP 040000 /* take-over region on attach */
/* Commands for `shmctl'. */
#define SHM_LOCK 11 /* lock segment (root only) */
#define SHM_UNLOCK 12 /* unlock segment (root only) */
__BEGIN_DECLS
/* Segment low boundary address multiple. */
#define SHMLBA (__getpagesize ())
extern int __getpagesize (void) __THROW __attribute__ ((__const__));
/* Type to count number of attaches. */
typedef unsigned long int shmatt_t;
/* Data structure describing a set of semaphores. */
struct shmid_ds
{
struct ipc_perm shm_perm; /* operation permission struct */
size_t shm_segsz; /* size of segment in bytes */
__time_t shm_atime; /* time of last shmat() */
__time_t shm_dtime; /* time of last shmdt() */
__time_t shm_ctime; /* time of last change by shmctl() */
__pid_t shm_cpid; /* pid of creator */
__pid_t shm_lpid; /* pid of last shmop */
shmatt_t shm_nattch; /* number of current attaches */
unsigned long int __uclibc_unused1;
unsigned long int __uclibc_unused2;
};
#ifdef __USE_MISC
/* ipcs ctl commands */
# define SHM_STAT 13
# define SHM_INFO 14
/* shm_mode upper byte flags */
# define SHM_DEST 01000 /* segment will be destroyed on last detach */
# define SHM_LOCKED 02000 /* segment will not be swapped */
# define SHM_HUGETLB 04000 /* segment is mapped via hugetlb */
# define SHM_NORESERVE 010000 /* don't check for reservations */
struct shminfo
{
unsigned long int shmmax;
unsigned long int shmmin;
unsigned long int shmmni;
unsigned long int shmseg;
unsigned long int shmall;
unsigned long int __uclibc_unused1;
unsigned long int __uclibc_unused2;
unsigned long int __uclibc_unused3;
unsigned long int __uclibc_unused4;
};
struct shm_info
{
int used_ids;
unsigned long int shm_tot; /* total allocated shm */
unsigned long int shm_rss; /* total resident shm */
unsigned long int shm_swp; /* total swapped shm */
unsigned long int swap_attempts;
unsigned long int swap_successes;
};
#endif /* __USE_MISC */
__END_DECLS
|
/* This file is part of P^nMPI.
*
* Copyright (c)
* 2008-2019 Lawrence Livermore National Laboratories, United States of America
* 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany
* 2013-2019 RWTH Aachen University, Federal Republic of Germany
*
*
* P^nMPI is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation version 2.1 dated February 1999.
*
* P^nMPI 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 P^nMPI; if not, write to the
*
* Free Software Foundation, Inc.
* 51 Franklin St, Fifth Floor
* Boston, MA 02110, USA
*
*
* Written by Martin Schulz, schulzm@llnl.gov.
*
* LLNL-CODE-402774
*/
/* This is a simple test case to check the stack switching functionality. It
* will be called in the default stack and tries to switch to a different stack.
*/
#include <stdio.h>
#include <mpi.h>
#include <pnmpi/newstack.h>
#include <pnmpi/service.h>
#include <pnmpi/xmpi.h>
int MPI_Init(int *argc, char ***argv)
{
static int flag = 0;
PNMPI_modHandle_t stack;
if (flag == 0 &&
PNMPI_Service_GetStackByName("sample", &stack) == PNMPI_SUCCESS)
{
printf("Switching the stack.\n");
flag = 1;
XMPI_Init_NewStack(stack, argc, argv);
}
else
XMPI_Init(argc, argv);
return MPI_SUCCESS;
}
/* MODTYPE: XMPI
* COMPILE_INCLUDES: @MPI_C_INCLUDE_PATH@ @PROJECT_SOURCE_DIR@/src/pnmpi
* COMPILE_INCLUDES: @PROJECT_BINARY_DIR@ @PROJECT_BINARY_DIR@/src/pnmpi
* COMPILE_FLAGS: @MPI_C_COMPILE_FLAGS@
*
* PNMPICONF: module @MODNAME@\n
* PNMPICONF: stack sample\n
* PNMPICONF: module @MODNAME@
*
* ENVIRONMENT: PNMPI_LIB_PATH=@CMAKE_CURRENT_BINARY_DIR@
* ENVIRONMENT: PNMPI_CONF=@PNMPICONF@
* RUN: @MPIEXEC@ @MPIEXEC_NUMPROC_FLAG@ 1
* RUN: @MPIEXEC_PREFLAGS@ @TESTBIN_MPI_C@ @MPIEXEC_POSTFLAGS@
* PASS: Switching the stack.
*/
|
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "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 Digia Plc and its Subsidiary(-ies) 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."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef PRINTPANEL_H
#define PRINTPANEL_H
#include <QWidget>
QT_BEGIN_NAMESPACE
class QGroupBox;
class QRadioButton;
QT_END_NAMESPACE
//! [0]
class PrintPanel : public QWidget
{
Q_OBJECT
//! [0]
public:
PrintPanel(QWidget *parent = 0);
private:
QGroupBox *twoSidedGroupBox;
QGroupBox *colorsGroupBox;
QRadioButton *twoSidedEnabledRadio;
QRadioButton *twoSidedDisabledRadio;
QRadioButton *colorsEnabledRadio;
QRadioButton *colorsDisabledRadio;
};
#endif
|
/*
*/
#include "my_test.h"
static int basic_connect(MYSQL *mysql)
{
MYSQL_ROW row;
MYSQL_RES *res;
MYSQL_FIELD *field;
int rc;
MYSQL *my= mysql_init(NULL);
FAIL_IF(!my, "mysql_init() failed");
FAIL_IF(!mysql_real_connect(my, hostname, username, password, schema,
port, socketname, 0), mysql_error(my));
rc= mysql_query(my, "SELECT @@version");
check_mysql_rc(rc, my);
res= mysql_store_result(my);
FAIL_IF(!res, mysql_error(my));
field= mysql_fetch_fields(res);
FAIL_IF(!field, "Couldn't fetch fields");
while ((row= mysql_fetch_row(res)) != NULL)
{
FAIL_IF(mysql_num_fields(res) != 1, "Got the wrong number of fields");
}
FAIL_IF(mysql_errno(my), mysql_error(my));
mysql_free_result(res);
mysql_close(my);
return OK;
}
pthread_mutex_t LOCK_test;
#ifndef _WIN32
int thread_conc27(void);
#else
DWORD WINAPI thread_conc27(void);
#endif
#define THREAD_NUM 100
/* run this test as root and increase the number of handles (ulimit -n) */
static int test_conc_27(MYSQL *mysql)
{
int rc;
int i;
MYSQL_ROW row;
MYSQL_RES *res;
#ifndef _WIN32
pthread_t threads[THREAD_NUM];
#else
HANDLE hthreads[THREAD_NUM];
DWORD threads[THREAD_NUM];
#endif
rc= mysql_query(mysql, "DROP TABLE IF EXISTS t_conc27");
check_mysql_rc(rc, mysql);
rc= mysql_query(mysql, "CREATE TABLE t_conc27(a int)");
check_mysql_rc(rc, mysql);
rc= mysql_query(mysql, "INSERT INTO t_conc27 VALUES(0)");
check_mysql_rc(rc, mysql);
rc= mysql_query(mysql, "SET GLOBAL max_connections=100000");
check_mysql_rc(rc, mysql);
pthread_mutex_init(&LOCK_test, NULL);
for (i=0; i < THREAD_NUM; i++)
{
#ifndef _WIN32
pthread_create(&threads[i], NULL, (void *)thread_conc27, NULL);
#else
hthreads[i]= CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)thread_conc27, NULL, 0, &threads[i]);
if (hthreads[i]==NULL)
diag("error while starting thread");
#endif
}
for (i=0; i < THREAD_NUM; i++)
{
#ifndef _WIN32
pthread_join(threads[i], NULL);
#else
WaitForSingleObject(hthreads[i], INFINITE);
#endif
}
pthread_mutex_destroy(&LOCK_test);
rc= mysql_query(mysql, "SELECT a FROM t_conc27");
check_mysql_rc(rc,mysql);
res= mysql_store_result(mysql);
FAIL_IF(!res, "invalid result");
row= mysql_fetch_row(res);
FAIL_IF(!row, "can't fetch row");
diag("row=%s", row[0]);
FAIL_IF(atoi(row[0]) != THREAD_NUM, "expected value THREAD_NUM");
mysql_free_result(res);
return OK;
}
#ifndef _WIN32
int thread_conc27(void)
#else
DWORD WINAPI thread_conc27(void)
#endif
{
MYSQL *mysql;
int rc;
MYSQL_RES *res;
mysql_thread_init();
mysql= mysql_init(NULL);
if(!mysql_real_connect(mysql, hostname, username, password, schema,
port, socketname, 0))
{
diag(">Error: %s", mysql_error(mysql));
mysql_close(mysql);
mysql_thread_end();
goto end;
}
pthread_mutex_lock(&LOCK_test);
rc= mysql_query(mysql, "UPDATE t_conc27 SET a=a+1");
check_mysql_rc(rc, mysql);
pthread_mutex_unlock(&LOCK_test);
check_mysql_rc(rc, mysql);
if (res= mysql_store_result(mysql))
mysql_free_result(res);
mysql_close(mysql);
end:
mysql_thread_end();
return 0;
}
struct my_tests_st my_tests[] = {
{"basic_connect", basic_connect, TEST_CONNECTION_NONE, 0, NULL, NULL},
{"test_conc_27", test_conc_27, TEST_CONNECTION_NEW, 0, NULL, NULL},
{NULL, NULL, 0, 0, NULL, NULL}
};
int main(int argc, char **argv)
{
mysql_library_init(0,0,NULL);
if (argc > 1)
get_options(argc, argv);
get_envvars();
run_tests(my_tests);
mysql_server_end();
return(exit_status());
}
|
#ifndef __GSK_STREAM_EXTERNAL_H_
#define __GSK_STREAM_EXTERNAL_H_
#include "gskstream.h"
#include "gskmainloop.h"
G_BEGIN_DECLS
/* --- typedefs --- */
typedef struct _GskStreamExternal GskStreamExternal;
typedef struct _GskStreamExternalClass GskStreamExternalClass;
/* --- type macros --- */
GType gsk_stream_external_get_type(void) G_GNUC_CONST;
#define GSK_TYPE_STREAM_EXTERNAL (gsk_stream_external_get_type ())
#define GSK_STREAM_EXTERNAL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSK_TYPE_STREAM_EXTERNAL, GskStreamExternal))
#define GSK_STREAM_EXTERNAL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GSK_TYPE_STREAM_EXTERNAL, GskStreamExternalClass))
#define GSK_STREAM_EXTERNAL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GSK_TYPE_STREAM_EXTERNAL, GskStreamExternalClass))
#define GSK_IS_STREAM_EXTERNAL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GSK_TYPE_STREAM_EXTERNAL))
#define GSK_IS_STREAM_EXTERNAL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GSK_TYPE_STREAM_EXTERNAL))
/* --- callbacks --- */
typedef void (*GskStreamExternalTerminated) (GskStreamExternal *external,
GskMainLoopWaitInfo *wait_info,
gpointer user_data);
typedef void (*GskStreamExternalStderr) (GskStreamExternal *external,
const char *error_text,
gpointer user_data);
/* --- structures --- */
struct _GskStreamExternalClass
{
GskStreamClass stream_class;
};
struct _GskStreamExternal
{
GskStream stream;
/* stdin for the process */
int write_fd;
GskSource *write_source;
GskBuffer write_buffer;
gsize max_write_buffer;
/* stdout for the process */
int read_fd;
GskSource *read_source;
GskBuffer read_buffer;
gsize max_read_buffer;
/* stderr for the process */
int read_err_fd;
GskSource *read_err_source;
GskBuffer read_err_buffer;
gsize max_err_line_length;
/* process-termination notification */
GskSource *process_source;
glong pid;
/* user-callback information */
GskStreamExternalTerminated term_func;
GskStreamExternalStderr err_func;
gpointer user_data;
};
typedef enum
{
GSK_STREAM_EXTERNAL_ALLOCATE_PSEUDOTTY = (1<<2),
GSK_STREAM_EXTERNAL_SEARCH_PATH = (1<<3)
} GskStreamExternalFlags;
/* --- prototypes --- */
GskStream *gsk_stream_external_new (GskStreamExternalFlags flags,
const char *stdin_filename,
const char *stdout_filename,
GskStreamExternalTerminated term_func,
GskStreamExternalStderr err_func,
gpointer user_data,
const char *path,
const char *argv[],
const char *env[],
GError **error);
G_END_DECLS
#endif
|
/*
* SpanDSP - a series of DSP components for telephony
*
* fax.h - definitions for analogue line ITU T.30 fax processing
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2005 Steve Underwood
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 2.1,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*! \file */
#if !defined(_SPANDSP_FAX_H_)
#define _SPANDSP_FAX_H_
/*! \page fax_page FAX over analogue modem handling
\section fax_page_sec_1 What does it do?
\section fax_page_sec_2 How does it work?
*/
typedef struct fax_state_s fax_state_t;
#if defined(__cplusplus)
extern "C"
{
#endif
/*! Apply T.30 receive processing to a block of audio samples.
\brief Apply T.30 receive processing to a block of audio samples.
\param s The FAX context.
\param amp The audio sample buffer.
\param len The number of samples in the buffer.
\return The number of samples unprocessed. This should only be non-zero if
the software has reached the end of the FAX call.
*/
SPAN_DECLARE_NONSTD(int) fax_rx(fax_state_t *s, int16_t *amp, int len);
/*! Apply fake T.30 receive processing when a block of audio samples is missing (e.g due
to packet loss).
\brief Apply fake T.30 receive processing.
\param s The FAX context.
\param len The number of samples to fake.
\return The number of samples unprocessed. This should only be non-zero if
the software has reached the end of the FAX call.
*/
SPAN_DECLARE_NONSTD(int) fax_rx_fillin(fax_state_t *s, int len);
/*! Apply T.30 transmit processing to generate a block of audio samples.
\brief Apply T.30 transmit processing to generate a block of audio samples.
\param s The FAX context.
\param amp The audio sample buffer.
\param max_len The number of samples to be generated.
\return The number of samples actually generated. This will be zero when
there is nothing to send.
*/
SPAN_DECLARE_NONSTD(int) fax_tx(fax_state_t *s, int16_t *amp, int max_len);
/*! Select whether silent audio will be sent when FAX transmit is idle.
\brief Select whether silent audio will be sent when FAX transmit is idle.
\param s The FAX context.
\param transmit_on_idle True if silent audio should be output when the FAX transmitter is
idle. False to transmit zero length audio when the FAX transmitter is idle. The default
behaviour is false.
*/
SPAN_DECLARE(void) fax_set_transmit_on_idle(fax_state_t *s, int transmit_on_idle);
/*! Select whether talker echo protection tone will be sent for the image modems.
\brief Select whether TEP will be sent for the image modems.
\param s The FAX context.
\param use_tep True if TEP should be sent.
*/
SPAN_DECLARE(void) fax_set_tep_mode(fax_state_t *s, int use_tep);
/*! Get a pointer to the T.30 engine associated with a FAX context.
\brief Get a pointer to the T.30 engine associated with a FAX context.
\param s The FAX context.
\return A pointer to the T.30 context, or NULL.
*/
SPAN_DECLARE(t30_state_t *) fax_get_t30_state(fax_state_t *s);
/*! Get a pointer to the logging context associated with a FAX context.
\brief Get a pointer to the logging context associated with a FAX context.
\param s The FAX context.
\return A pointer to the logging context, or NULL.
*/
SPAN_DECLARE(logging_state_t *) fax_get_logging_state(fax_state_t *s);
/*! Restart a FAX context.
\brief Restart a FAX context.
\param s The FAX context.
\param calling_party True if the context is for a calling party. False if the
context is for an answering party.
\return 0 for OK, else -1. */
SPAN_DECLARE(int) fax_restart(fax_state_t *s, int calling_party);
/*! Initialise a FAX context.
\brief Initialise a FAX context.
\param s The FAX context.
\param calling_party True if the context is for a calling party. False if the
context is for an answering party.
\return A pointer to the FAX context, or NULL if there was a problem.
*/
SPAN_DECLARE(fax_state_t *) fax_init(fax_state_t *s, int calling_party);
/*! Release a FAX context.
\brief Release a FAX context.
\param s The FAX context.
\return 0 for OK, else -1. */
SPAN_DECLARE(int) fax_release(fax_state_t *s);
/*! Free a FAX context.
\brief Free a FAX context.
\param s The FAX context.
\return 0 for OK, else -1. */
SPAN_DECLARE(int) fax_free(fax_state_t *s);
#if defined(__cplusplus)
}
#endif
#endif
/*- End of file ------------------------------------------------------------*/
|
/*
Copyright (C) 2009 William Hart
This file is part of FLINT.
FLINT is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License (LGPL) as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <stdlib.h>
#include <gmp.h>
#include "flint.h"
#include "ulong_extras.h"
#include "fmpz.h"
int
main(void)
{
int i, result;
FLINT_TEST_INIT(state);
flint_printf("get/set_ui....");
fflush(stdout);
for (i = 0; i < 10000 * flint_test_multiplier(); i++)
{
fmpz_t a;
ulong b, c;
b = n_randtest(state);
fmpz_init(a);
fmpz_set_ui(a, b);
c = fmpz_get_ui(a);
result = (b == c);
if (!result)
{
flint_printf("FAIL:\n");
flint_printf("b = %wd, c = %wd\n", b, c);
fflush(stdout);
flint_abort();
}
fmpz_clear(a);
}
FLINT_TEST_CLEANUP(state);
flint_printf("PASS\n");
return 0;
}
|
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef CLASSWIZARD_H
#define CLASSWIZARD_H
#include <QWizard>
QT_BEGIN_NAMESPACE
class QCheckBox;
class QGroupBox;
class QLabel;
class QLineEdit;
class QRadioButton;
QT_END_NAMESPACE
//! [0]
class ClassWizard : public QWizard
{
Q_OBJECT
public:
ClassWizard(QWidget *parent = 0);
void accept();
};
//! [0]
//! [1]
class IntroPage : public QWizardPage
{
Q_OBJECT
public:
IntroPage(QWidget *parent = 0);
private:
QLabel *label;
};
//! [1]
//! [2]
class ClassInfoPage : public QWizardPage
{
Q_OBJECT
public:
ClassInfoPage(QWidget *parent = 0);
private:
QLabel *classNameLabel;
QLabel *baseClassLabel;
QLineEdit *classNameLineEdit;
QLineEdit *baseClassLineEdit;
QCheckBox *qobjectMacroCheckBox;
QGroupBox *groupBox;
QRadioButton *qobjectCtorRadioButton;
QRadioButton *qwidgetCtorRadioButton;
QRadioButton *defaultCtorRadioButton;
QCheckBox *copyCtorCheckBox;
};
//! [2]
//! [3]
class CodeStylePage : public QWizardPage
{
Q_OBJECT
public:
CodeStylePage(QWidget *parent = 0);
protected:
void initializePage();
private:
QCheckBox *commentCheckBox;
QCheckBox *protectCheckBox;
QCheckBox *includeBaseCheckBox;
QLabel *macroNameLabel;
QLabel *baseIncludeLabel;
QLineEdit *macroNameLineEdit;
QLineEdit *baseIncludeLineEdit;
};
//! [3]
class OutputFilesPage : public QWizardPage
{
Q_OBJECT
public:
OutputFilesPage(QWidget *parent = 0);
protected:
void initializePage();
private:
QLabel *outputDirLabel;
QLabel *headerLabel;
QLabel *implementationLabel;
QLineEdit *outputDirLineEdit;
QLineEdit *headerLineEdit;
QLineEdit *implementationLineEdit;
};
class ConclusionPage : public QWizardPage
{
Q_OBJECT
public:
ConclusionPage(QWidget *parent = 0);
protected:
void initializePage();
private:
QLabel *label;
};
#endif
|
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QVOLATILEIMAGE_P_H
#define QVOLATILEIMAGE_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include <QtGui/qimage.h>
#include <QtCore/qshareddata.h>
QT_BEGIN_NAMESPACE
class QVolatileImageData;
class Q_GUI_EXPORT QVolatileImage
{
public:
QVolatileImage();
QVolatileImage(int w, int h, QImage::Format format);
explicit QVolatileImage(const QImage &sourceImage);
explicit QVolatileImage(void *nativeImage, void *nativeMask = 0);
QVolatileImage(const QVolatileImage &other);
~QVolatileImage();
QVolatileImage &operator=(const QVolatileImage &rhs);
bool paintingActive() const;
bool isNull() const;
QImage::Format format() const;
int width() const;
int height() const;
int bytesPerLine() const;
int byteCount() const;
int depth() const;
bool hasAlphaChannel() const;
void beginDataAccess() const;
void endDataAccess(bool readOnly = false) const;
uchar *bits();
const uchar *constBits() const;
bool ensureFormat(QImage::Format format);
QImage toImage() const;
QImage &imageRef();
const QImage &constImageRef() const;
QPaintEngine *paintEngine();
void setAlphaChannel(const QPixmap &alphaChannel);
void fill(uint pixelValue);
void *duplicateNativeImage() const;
void copyFrom(QVolatileImage *source, const QRect &rect);
private:
QSharedDataPointer<QVolatileImageData> d;
};
QT_END_NAMESPACE
#endif // QVOLATILEIMAGE_P_H
|
/* Reentrant string tokenizer. Generic version.
Copyright (C) 1991,1996-1999,2001,2004 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 <string.h>
/* Experimentally off - libc_hidden_proto(strtok_r) */
/* Experimentally off - libc_hidden_proto(strspn) */
/* Experimentally off - libc_hidden_proto(strpbrk) */
#ifdef __USE_GNU
# define __rawmemchr rawmemchr
/* Experimentally off - libc_hidden_proto(rawmemchr) */
#else
# define __rawmemchr strchr
/* Experimentally off - libc_hidden_proto(strchr) */
#endif
#if 0
Parse S into tokens separated by characters in DELIM.
If S is NULL, the saved pointer in SAVE_PTR is used as
the next starting point. For example:
char s[] = "-abc-=-def";
char *sp;
x = strtok_r(s, "-", &sp); /* x = "abc", sp = "=-def" */
x = strtok_r(NULL, "-=", &sp); /* x = "def", sp = NULL */
x = strtok_r(NULL, "=", &sp); /* x = NULL */
/* s = "abc\0-def\0" */
#endif
char *strtok_r (char *s, const char *delim, char **save_ptr)
{
char *token;
if (s == NULL)
s = *save_ptr;
/* Scan leading delimiters. */
s += strspn (s, delim);
if (*s == '\0')
{
*save_ptr = s;
return NULL;
}
/* Find the end of the token. */
token = s;
s = strpbrk (token, delim);
if (s == NULL)
/* This token finishes the string. */
*save_ptr = __rawmemchr (token, '\0');
else
{
/* Terminate the token and make *SAVE_PTR point past it. */
*s = '\0';
*save_ptr = s + 1;
}
return token;
}
libc_hidden_def(strtok_r)
|
/*
* Copyright (C) 2018 OTA keys S.A.
*
* 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.
*/
/**
* @ingroup drivers_mtd_flashpage
* @brief Driver for internal flash devices implementing flashpage interface
*
* @{
*
* @file
* @brief Implementation for the flashpage memory driver
*
* @author Vincent Dupont <vincent@otakeys.com>
* @}
*/
#include <string.h>
#include <errno.h>
#include <assert.h>
#include "cpu_conf.h"
#include "mtd_flashpage.h"
#include "periph/flashpage.h"
#define MTD_FLASHPAGE_END_ADDR CPU_FLASH_BASE + (FLASHPAGE_NUMOF * FLASHPAGE_SIZE)
static int _init(mtd_dev_t *dev)
{
(void)dev;
assert(dev->pages_per_sector * dev->page_size == FLASHPAGE_SIZE);
return 0;
}
static int _read(mtd_dev_t *dev, void *buf, uint32_t addr, uint32_t size)
{
assert(addr < MTD_FLASHPAGE_END_ADDR);
(void)dev;
if (addr % FLASHPAGE_RAW_ALIGNMENT) {
return -EINVAL;
}
memcpy(buf, (void*)addr, size);
return size;
}
static int _write(mtd_dev_t *dev, const void *buf, uint32_t addr, uint32_t size)
{
(void)dev;
if (addr % FLASHPAGE_RAW_ALIGNMENT) {
return -EINVAL;
}
if ((uintptr_t)buf % FLASHPAGE_RAW_ALIGNMENT) {
return -EINVAL;
}
if (size % FLASHPAGE_RAW_BLOCKSIZE) {
return -EOVERFLOW;
}
if (addr + size > MTD_FLASHPAGE_END_ADDR) {
return -EOVERFLOW;
}
flashpage_write_raw((void *)addr, buf, size);
return size;
}
int _erase(mtd_dev_t *dev, uint32_t addr, uint32_t size)
{
size_t sector_size = dev->page_size * dev->pages_per_sector;
if (size % sector_size) {
return -EOVERFLOW;
}
if (addr + size > MTD_FLASHPAGE_END_ADDR) {
return - EOVERFLOW;
}
if (addr % sector_size) {
return - EOVERFLOW;
}
for (size_t i = 0; i < size; i += sector_size) {
flashpage_write(flashpage_page((void *)addr), NULL);
}
return 0;
}
const mtd_desc_t mtd_flashpage_driver = {
.init = _init,
.read = _read,
.write = _write,
.erase = _erase,
};
|
/* GTK - The GIMP Toolkit
* Recent chooser action for GtkUIManager
*
* Copyright (C) 2007, Emmanuele Bassi
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gtk/gtk.h> can be included directly."
#endif
#ifndef __GTK_RECENT_ACTION_H__
#define __GTK_RECENT_ACTION_H__
#include <gtk/gtkaction.h>
#include <gtk/gtkrecentmanager.h>
G_BEGIN_DECLS
#define GTK_TYPE_RECENT_ACTION (gtk_recent_action_get_type ())
#define GTK_RECENT_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_RECENT_ACTION, GtkRecentAction))
#define GTK_IS_RECENT_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_RECENT_ACTION))
#define GTK_RECENT_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_RECENT_ACTION, GtkRecentActionClass))
#define GTK_IS_RECENT_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_RECENT_ACTION))
#define GTK_RECENT_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_RECENT_ACTION, GtkRecentActionClass))
typedef struct _GtkRecentAction GtkRecentAction;
typedef struct _GtkRecentActionPrivate GtkRecentActionPrivate;
typedef struct _GtkRecentActionClass GtkRecentActionClass;
struct _GtkRecentAction
{
GtkAction parent_instance;
/*< private >*/
GtkRecentActionPrivate *priv;
};
struct _GtkRecentActionClass
{
GtkActionClass parent_class;
/* Padding for future expansion */
void (*_gtk_reserved1) (void);
void (*_gtk_reserved2) (void);
void (*_gtk_reserved3) (void);
void (*_gtk_reserved4) (void);
};
GType gtk_recent_action_get_type (void) G_GNUC_CONST;
GtkAction *gtk_recent_action_new (const gchar *name,
const gchar *label,
const gchar *tooltip,
const gchar *stock_id);
GtkAction *gtk_recent_action_new_for_manager (const gchar *name,
const gchar *label,
const gchar *tooltip,
const gchar *stock_id,
GtkRecentManager *manager);
gboolean gtk_recent_action_get_show_numbers (GtkRecentAction *action);
void gtk_recent_action_set_show_numbers (GtkRecentAction *action,
gboolean show_numbers);
G_END_DECLS
#endif /* __GTK_RECENT_ACTION_H__ */
|
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
/****************************************************************************
**
** Definition of QXIMInputContext class
**
** Copyright (C) 2003-2004 immodule for Qt Project. All rights reserved.
**
** This file is written to contribute to Digia Plc and/or its subsidiary(-ies) under their own
** license. You may use this file under your Qt license. Following
** description is copied from their original file headers. Contact
** immodule-qt@freedesktop.org if any conditions of this licensing are
** not clear to you.
**
****************************************************************************/
#ifndef QXIMINPUTCONTEXT_P_H
#define QXIMINPUTCONTEXT_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#if !defined(Q_NO_IM)
#include "QtCore/qglobal.h"
#include "QtGui/qinputcontext.h"
#include "QtGui/qfont.h"
#include "QtCore/qhash.h"
#ifdef Q_WS_X11
#include "QtCore/qlist.h"
#include "QtCore/qbitarray.h"
#include "QtGui/qwindowdefs.h"
#include "private/qt_x11_p.h"
#endif
QT_BEGIN_NAMESPACE
class QKeyEvent;
class QWidget;
class QFont;
class QString;
class QXIMInputContext : public QInputContext
{
Q_OBJECT
public:
struct ICData {
XIC ic;
XFontSet fontset;
QWidget *widget;
QString text;
QBitArray selectedChars;
bool composing;
bool preeditEmpty;
void clear();
};
QXIMInputContext();
~QXIMInputContext();
QString identifierName();
QString language();
void reset();
void mouseHandler( int x, QMouseEvent *event);
bool isComposing() const;
void setFocusWidget( QWidget *w );
void widgetDestroyed(QWidget *w);
void create_xim();
void close_xim();
void update();
ICData *icData() const;
protected:
bool x11FilterEvent( QWidget *keywidget, XEvent *event );
private:
static XIMStyle xim_style;
QString _language;
XIM xim;
QHash<WId, ICData *> ximData;
ICData *createICData(QWidget *w);
};
QT_END_NAMESPACE
#endif // Q_NO_IM
#endif // QXIMINPUTCONTEXT_P_H
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
/*
* Copyright (C) 2011 Ruby-GNOME2 Project Team
* Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
* Daisuke Kanda,
* Hiroshi Igarashi
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
#include "global.h"
#define RG_TARGET_NAMESPACE cVButtonBox
static VALUE
rg_initialize(VALUE self)
{
RBGTK_INITIALIZE(self, gtk_vbutton_box_new());
return Qnil;
}
void
Init_gtk_vbutton_box(VALUE mGtk)
{
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_VBUTTON_BOX, "VButtonBox", mGtk);
RG_DEF_METHOD(initialize, 0);
}
|
/*
* Copyright (C) 2010 Apple Inc. All rights reserved.
* Copyright (c) 2010, 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 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 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 TypedArrayBase_h
#define TypedArrayBase_h
#include "ArrayBuffer.h"
#include "ArrayBufferView.h"
namespace JSC {
template <typename T>
class TypedArrayBase : public ArrayBufferView {
public:
T* data() const { return static_cast<T*>(baseAddress()); }
bool set(TypedArrayBase<T>* array, unsigned offset)
{
return setImpl(array, offset * sizeof(T));
}
bool setRange(const T* data, size_t dataLength, unsigned offset)
{
return setRangeImpl(reinterpret_cast<const char*>(data), dataLength * sizeof(T), offset * sizeof(T));
}
bool zeroRange(unsigned offset, size_t length)
{
return zeroRangeImpl(offset * sizeof(T), length * sizeof(T));
}
// Overridden from ArrayBufferView. This must be public because of
// rules about inheritance of members in template classes, and
// because it is accessed via pointers to subclasses.
unsigned length() const
{
return m_length;
}
virtual unsigned byteLength() const
{
return m_length * sizeof(T);
}
// Invoked by the indexed getter. Does not perform range checks; caller
// is responsible for doing so and returning undefined as necessary.
T item(unsigned index) const
{
ASSERT_WITH_SECURITY_IMPLICATION(index < TypedArrayBase<T>::m_length);
return TypedArrayBase<T>::data()[index];
}
bool checkInboundData(unsigned offset, unsigned pos) const
{
return (offset <= m_length
&& offset + pos <= m_length
// check overflow
&& offset + pos >= offset);
}
protected:
TypedArrayBase(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length)
: ArrayBufferView(buffer, byteOffset)
, m_length(length)
{
}
template <class Subclass>
static PassRefPtr<Subclass> create(unsigned length)
{
RefPtr<ArrayBuffer> buffer = ArrayBuffer::create(length, sizeof(T));
if (!buffer.get())
return 0;
return create<Subclass>(buffer.release(), 0, length);
}
template <class Subclass>
static PassRefPtr<Subclass> create(const T* array, unsigned length)
{
RefPtr<Subclass> a = create<Subclass>(length);
if (a)
for (unsigned i = 0; i < length; ++i)
a->set(i, array[i]);
return a.release();
}
template <class Subclass>
static RefPtr<Subclass> create(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length)
{
RefPtr<ArrayBuffer> buf(buffer);
if (!verifySubRange<T>(buf, byteOffset, length))
return nullptr;
return adoptRef(new Subclass(buf.release(), byteOffset, length));
}
template <class Subclass>
static RefPtr<Subclass> createUninitialized(unsigned length)
{
RefPtr<ArrayBuffer> buffer = ArrayBuffer::createUninitialized(length, sizeof(T));
if (!buffer.get())
return nullptr;
return create<Subclass>(buffer.release(), 0, length);
}
template <class Subclass>
RefPtr<Subclass> subarrayImpl(int start, int end) const
{
unsigned offset, length;
calculateOffsetAndLength(start, end, m_length, &offset, &length);
clampOffsetAndNumElements<T>(buffer(), m_byteOffset, &offset, &length);
return create<Subclass>(buffer(), offset, length);
}
virtual void neuter()
{
ArrayBufferView::neuter();
m_length = 0;
}
// We do not want to have to access this via a virtual function in subclasses,
// which is why it is protected rather than private.
unsigned m_length;
};
} // namespace JSC
using JSC::TypedArrayBase;
#endif // TypedArrayBase_h
|
/**
* @file pcbnew_footprint_wizards.h
* @brief Class PCBNEW_FOOTPRINT_WIZARDS
*/
#ifndef PCBNEW_FOOTPRINT_WIZARDS_H
#define PCBNEW_FOOTPRINT_WIZARDS_H
#include <Python.h>
#include <vector>
#include <class_footprint_wizard.h>
class PYTHON_FOOTPRINT_WIZARD: public FOOTPRINT_WIZARD
{
PyObject *m_PyWizard;
PyObject *CallMethod( const char *aMethod, PyObject *aArglist=NULL );
wxString CallRetStrMethod( const char *aMethod, PyObject *aArglist=NULL );
wxArrayString CallRetArrayStrMethod( const char *aMethod,
PyObject *aArglist=NULL );
public:
PYTHON_FOOTPRINT_WIZARD( PyObject *wizard );
~PYTHON_FOOTPRINT_WIZARD();
wxString GetName();
wxString GetImage();
wxString GetDescription();
int GetNumParameterPages();
wxString GetParameterPageName( int aPage );
wxArrayString GetParameterNames( int aPage );
wxArrayString GetParameterTypes( int aPage );
wxArrayString GetParameterValues( int aPage );
wxArrayString GetParameterErrors( int aPage );
wxString SetParameterValues( int aPage, wxArrayString& aValues ); //< must return "OK" or error description
MODULE *GetModule();
};
class PYTHON_FOOTPRINT_WIZARDS
{
public:
static void register_wizard( PyObject *aPyWizard );
};
#endif /* PCBNEW_FOOTPRINT_WIZARDS_H */
|
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QObject>
#include <qmobilityglobal.h>
#include <qtcontacts.h>
QTM_BEGIN_NAMESPACE
#define NO_OF_CONTACTS 1000
QTM_END_NAMESPACE
QTM_USE_NAMESPACE
class SymbianPluginPerfomance : public QObject
{
Q_OBJECT
private slots: // Init & cleanup
void initTestCase();
void cleanupTestCase();
private slots: // Test cases
void createSimpleContacts();
void removeSimpleContacts();
void createComplexContacts();
void sortContacts();
void fetchAllNames();
void filterContacts();
void filterUnions();
void filterNameListStyle();
void filterPhoneNumberMatch();
// Data providers
void filterNameListStyle_data();
void filterPhoneNumberMatch_data();
/*
void createViews();
void operation1();
void operation2();
void asyncOperation1(); // requests
void asyncOperation2();
// feel free to add more...
*/
void removeComplexContacts();
void createComplexContactsWithOnlineAccount();
void sortContactsWithOnlineAccount();
void removeComplextContactsWithOnlineAccount();
private:
int measureContactsFetch(
QString debugMessage,
const QContactFilter &filter,
const QList<QContactSortOrder>& sortOrders = QList<QContactSortOrder>());
int measureNamesFetch(
QString debugMessage,
const QContactFilter &filter,
const QList<QContactSortOrder>& sortOrders = QList<QContactSortOrder>());
QContactManager *mCntMng;
QTime mTime;
};
|
/**
* This file is part of Simox.
*
* Simox is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Simox is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package VirtualRobot
* @author Nikolaus Vahrenkamp
* @copyright 2011 Nikolaus Vahrenkamp
* GNU Lesser General Public License
*
*/
#ifndef _VirtualRobot_CollisionModel_h_
#define _VirtualRobot_CollisionModel_h_
#include "../VirtualRobotImportExport.h"
#include "../MathTools.h"
#include "../BoundingBox.h"
#include <string>
#include <vector>
#include <map>
#include <set>
#if defined(VR_COLLISION_DETECTION_PQP)
#include "PQP/CollisionModelPQP.h"
#else
#include "Dummy/CollisionModelDummy.h"
#endif
namespace VirtualRobot {
class CollisionChecker;
/*!
An abstract representation of an object that can be used for collision queries.
*/
class VIRTUAL_ROBOT_IMPORT_EXPORT CollisionModel
{
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
/*!
Standard Constructor
If collision checks should be done in parallel, different CollisionCheckers can be specified.
\param visu A visualization that is used for creating an internal triangle based representation of the object.
\param name The name of this object.
\param colChecker If not specified, the global singleton instance is used. Only useful, when parallel collision checks should be performed.
\param id A user id.
*/
CollisionModel(const VisualizationNodePtr visu, const std::string &name = "", CollisionCheckerPtr colChecker = CollisionCheckerPtr(), int id = 666);
/*!Standard Destructor
*/
virtual ~CollisionModel();
/*! Returns name of this model.
*/
std::string getName();
/*!
Return bounding box of this object.
\param global If set, the boundignBox is transformed to globalCoordinate system. Otherwise the local BBox is returned.
*/
BoundingBox getBoundingBox(bool global = true);
/*!
The global pose defines the position of the joint in the world. This value is used for visualization.
*/
inline Eigen::Matrix4f getGlobalPose() {return globalPose;}
virtual void setGlobalPose(const Eigen::Matrix4f &pose);
CollisionCheckerPtr getCollisionChecker(){return colChecker;}
#if defined(VR_COLLISION_DETECTION_PQP)
boost::shared_ptr< CollisionModelPQP > getCollisionModelImplementation(){return collisionModelImplementation;}
#else
boost::shared_ptr< CollisionModelDummy > getCollisionModelImplementation(){return collisionModelImplementation;}
#endif
CollisionModelPtr clone(CollisionCheckerPtr colChecker = CollisionCheckerPtr(), float scaling = 1.0f);
int getId();
/*!
Enables/Disables the visualization updates of the collision model.
This just handles the visualization, the collision data is not affected.
*/
void setUpdateVisualization (bool enable);
bool getUpdateVisualizationStatus();
VisualizationNodePtr getVisualization();
VisualizationNodePtr getModelDataVisualization();
//! get number of faces (i.e. triangles) of this object
virtual int getNumFaces();
/*!
Print information about this model.
*/
virtual void print();
/*!
Return a vector with all vertices of this object at the current global pose.
*/
std::vector< Eigen::Vector3f > getModelVeticesGlobal();
TriMeshModelPtr getTriMeshModel(){return collisionModelImplementation->getTriMeshModel();}
std::string toXML(const std::string &basePath, int tabs);
std::string toXML(const std::string &basePath, const std::string &filename, int tabs);
/*!
Create a united collision model.
All triangle data is copied to one model which usually improves the collision detection performance.
*/
static CollisionModelPtr CreateUnitedCollisionModel(const std::vector<CollisionModelPtr> &colModels);
/*!
Saves model file to model path.
\param modelPath The directory.
\param filename The new filename without path.
*/
virtual bool saveModel(const std::string &modelPath, const std::string &filename);
virtual void scale(Eigen::Vector3f &scaleFactor);
protected:
//! delete all data
void destroyData();
VisualizationNodePtr visualization; // this is the original visualization
VisualizationNodePtr modelVisualization; // this is the visualization of the trimeshmodel
bool updateVisualization;
TriMeshModelPtr model;
BoundingBox bbox;
//! the name
std::string name;
int id;
CollisionCheckerPtr colChecker;
Eigen::Matrix4f globalPose; //< The transformation that is used for visualization and for updating the col model
#if defined(VR_COLLISION_DETECTION_PQP)
boost::shared_ptr< CollisionModelPQP > collisionModelImplementation;
#else
boost::shared_ptr< CollisionModelDummy > collisionModelImplementation;
#endif
};
} // namespace VirtualRobot
#endif // _VirtualRobot_CollisionModel_h_
|
#pragma once
#include "../PKLib/pklib.h"
#include <windows.h>
namespace ReplayTool
{
class FileReader;
class FileWriter;
}
typedef struct __Part
{
DWORD dwCrc32Sum;
DWORD dwSectionCount;
} _Part;
typedef struct __Param
{
char *pCompressedData;
DWORD dwReadPos;
char *pDecompressedData;
DWORD dwWritePos;
DWORD dwMaxRead;
DWORD dwMaxWrite;
} _Param;
unsigned int PKEXPORT read_buf(char *buf, unsigned int *size, void *_param);
void PKEXPORT write_buf(char *buf, unsigned int *size, void *_param);
bool DecompressRead(void *pOutput, size_t outputSize, ReplayTool::FileReader &fr);
void CompressWrite(void *pInput, size_t inputSize, ReplayTool::FileWriter &fw); |
/*
* Copyright (c) 2014 MUGEN SAS
*
* 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 MIDI_H_
#define MIDI_H_
#include <libs/osc/OscAPI.h>
class OSC_API Midi
{
private:
char mPort;
char mStatus;
char mData1;
char mData2;
public:
Midi()
{
mPort = 'm';
mStatus = 'i';
mData1 = 'd';
mData2 = 'i';
}
Midi(const QByteArray& aByteArray)
{
mPort = aByteArray[0];
mStatus = aByteArray[1];
mData1 = aByteArray[2];
mData2 = aByteArray[3];
}
Midi(char aPort, char aStatus, char aData1, char aData2)
{
mPort = aPort;
mStatus = aStatus;
mData1 = aData1;
mData2 = aData2;
}
char getPort() const
{
return mPort;
}
char getStatus() const
{
return mStatus;
}
char getData1() const
{
return mData1;
}
char getData2() const
{
return mData2;
}
bool operator== (const Midi& m) const
{
return mData1 == m.mData1
&& mData2 == m.mData2
&& mPort == m.mPort
&& mStatus == m.mStatus;
}
};
#endif // MIDI_H_
|
#include "../../src/corelib/request/teditsamplerequestdata.h" |
#ifndef SFFS_MAIN_STRUCT_H__
#define SFFS_MAIN_STRUCT_H__
#include <sys/types.h>
#include <sys/stat.h>
#include <stdint.h>
#ifdef LOG_STUBS
# include <stdio.h>
# define LOG_DEBUG(fmt) printf fmt; fputc('\n', stdout)
# define LOG_INFO(fmt) printf fmt; fputc('\n', stdout)
# define LOG_ERROR(fmt) printf fmt; fputc('\n', stdout)
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef ssize_t (*write_func)(const void *ptr, size_t size);
typedef ssize_t (*read_func)(void *ptr, size_t size);
typedef off_t (*seek_func)(off_t offset, int whence);
struct sffs_block {
off_t begin;
off_t end;
uint32_t mtime;
};
struct sffs_entry {
char *name;
size_t size;
uint8_t padding;
struct sffs_block block;
};
struct sffs_vector {
uint8_t *ptr;
size_t size;
};
struct sffs {
size_t device_size;
struct sffs_vector files, free;
write_func write;
read_func read;
seek_func seek;
};
int sffs_format(struct sffs *fs);
int sffs_mount(struct sffs *fs);
int sffs_umount(struct sffs *fs);
ssize_t sffs_write(struct sffs *fs, const char *fname, const void *data, size_t size);
ssize_t sffs_read(struct sffs *fs, const char *fname, void *data, size_t size);
int sffs_unlink(struct sffs *fs, const char *fname);
int sffs_stat(struct sffs *fs, const char *fname, struct stat *buf);
const char* sffs_filename(struct sffs *fs, size_t index);
size_t sffs_get_largest_free(struct sffs *fs);
size_t sffs_get_total_free(struct sffs *fs);
#ifdef __cplusplus
}
#endif
#endif
|
//
// Copyright(C) 2005--2011 FirteX Development Team.
// All rights reserved.
// This file is part of FirteX (www.firtex.org)
//
// Use of the FirteX is subject to the terms of the software license set forth in
// the LICENSE file included with this software, and also available at
// http://www.firtex.org/license.html
//
// Author : Ruijie Guo
// Email : ruijieguo@gmail.com
// Created : 2011-02-22 23:35:12
#ifndef __FX_MERGEPOLICYFACTORY_H
#define __FX_MERGEPOLICYFACTORY_H
#include <map>
#include "firtex/common/StdHeader.h"
#include "firtex/common/Logger.h"
#include "firtex/common/SharedPtr.h"
#include "firtex/thread/SynchronizedObject.h"
#include "firtex/utility/Singleton.h"
#include "firtex/index/MergePolicy.h"
FX_NS_DEF(index);
class MergePolicyFactory : public FX_NS(utility)::Singleton<MergePolicyFactory>
, public FX_NS(thread)::SynchronizedObject
{
protected:
MergePolicyFactory(void);
typedef std::map<tstring, MergePolicy::Creator*> CreatorMap;
public:
/**
* Register forward index creator
* @param pCretor creator of forward index
*/
void registerMergePolicy(MergePolicy::Creator* pCreator);
/**
* Create a registered merge poilcy
* @param sIdentifier identifier of merge policy
*/
MergePolicy* createMergePolicy(const tstring& sIdentifier);
private:
CreatorMap m_creatorMap;
DECLARE_LAZY_SINGLETON(MergePolicyFactory);
private:
DECLARE_STREAM_LOGGER();
};
FX_NS_END
#endif //__FX_MERGEPOLICYFACTORY_H
|
#ifndef DIELEVATION_H
#define DIELEVATION_H
#include <graphics/grcolour.h>
#ifdef __cplusplus
extern "C" {
#endif
/// @addtogroup Display
/// @{
/// @addtogroup ElevationPalette
/// @ingroup Display
/// @{
/*
* Following tables are used to compute the colour of an elevation
* polygon. Instead of storing a table of colours for all possible
* elevations, table below stores colours only for a few elevations.
* Actual colour of a given elevation is linearly interpolated between
* 2 consecutive entries in the table.
*/
#define MAX_ELEVATIONS_COLOUR 8
// The elevation palette MUST be private
// as its functionality is wrapped around the PolyDisplayTheme class.
// We can't have opaque structures yet, so leave the definition included for now.
typedef struct TElevationPaletteEntry {
INT32 elevation;
UINT8 r, g, b; /* red green and blue colour component at this elevation */
} TElevationPaletteEntry;
///
/// @internal
/// Represents an elevation palette object
///
typedef struct TElevationPalette
{
UINT32 elevationThresholdsCount;
TElevationPaletteEntry elevationPalette[MAX_ELEVATIONS_COLOUR];
/// Cache the last computed colour corresponding to an elevation
RGBCOLOUR cachedColour;
INT32 cachedElevation;
} TElevationPalette;
extern MAPCORE_API
void ElevationPalette_Init(TElevationPalette *pThis);
extern MAPCORE_API
void ElevationPalette_Define(TElevationPalette *pThis,
const TElevationPaletteEntry ep[],
UINT32 n);
extern MAPCORE_API
UINT32 ElevationPalette_GetNumElevations(const TElevationPalette *pThis);
extern MAPCORE_API
void ElevationPalette_GetElevationTable(const TElevationPalette *pThis,
UINT32 size,
TElevationPaletteEntry *table);
extern MAPCORE_API
RGBCOLOUR ElevationPalette_GetElevationColour(TElevationPalette *pThis,
INT32 elevation);
// @}
// @}
#ifdef __cplusplus
}
#endif
#endif /* dielevation.h */
|
#ifndef MIDIINPUTSYNCNODE_H
#define MIDIINPUTSYNCNODE_H
#include <fugio/nodecontrolbase.h>
#include <fugio/midi/midi_input_interface.h>
#include <fugio/midi/midi_interface.h>
#include <fugio/core/list_interface.h>
class MidiInputSyncNode : public fugio::NodeControlBase, public fugio::MidiInputInterface
{
Q_OBJECT
Q_INTERFACES( fugio::MidiInputInterface )
Q_CLASSINFO( "Author", "Alex May" )
Q_CLASSINFO( "Version", "1.0" )
Q_CLASSINFO( "Description", "" )
Q_CLASSINFO( "URL", WIKI_NODE_URL( "Midi_Input_Sync" ) )
Q_CLASSINFO( "Contact", "http://www.bigfug.com/contact/" )
public:
Q_INVOKABLE MidiInputSyncNode( QSharedPointer<fugio::NodeInterface> pNode );
virtual ~MidiInputSyncNode( void ) {}
//-------------------------------------------------------------------------
// NodeControlInterface interface
//-------------------------------------------------------------------------
// MidiInputInterface interface
public:
virtual void midiProcessInput( const fugio::MidiEvent *pMessages, quint32 pMessageCount ) Q_DECL_OVERRIDE;
private:
static unsigned short CombineBytes( unsigned char First, unsigned char Second )
{
unsigned short _14bit;
_14bit = (unsigned short)Second;
_14bit <<= 7;
_14bit |= (unsigned short)First;
return(_14bit);
}
void processMTC( int h, int m, int s, int f, int t, bool pPlay );
void processMidiClockMessage( const fugio::PmTimestamp EV );
private:
QSharedPointer<fugio::PinInterface> mPinInputMidi;
fugio::MidiInputInterface *mValInputMidi;
QSharedPointer<fugio::PinInterface> mPinSync;
fugio::VariantInterface *mValSync;
QSharedPointer<fugio::PinInterface> mPinBPM;
fugio::VariantInterface *mValBPM;
bool mMidiPlay;
bool mMidiPlayOnNext;
int mfr, msc, mmn, mhr, mst;
quint8 mls;
int mbc;
qreal mMidiTime;
quint16 mSngPosPtr;
int mMidiClockCount;
QList<fugio::PmTimestamp> mMidiClockEvents;
qreal mMidiClockPeriod;
qreal mMidiClockBPM;
};
#endif // MIDIINPUTSYNCNODE_H
|
/*
==============================================================================
This file is part of the JUCE library - "Jules' Utility Class Extensions"
Copyright 2004-11 by Raw Material Software Ltd.
------------------------------------------------------------------------------
JUCE can be redistributed and/or modified under the terms of the GNU General
Public License (Version 2), as published by the Free Software Foundation.
A copy of the license is included in the JUCE distribution, or can be found
online at www.gnu.org/licenses.
JUCE 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.
------------------------------------------------------------------------------
To release a closed-source product which uses JUCE, commercial licenses are
available: visit www.rawmaterialsoftware.com/juce for more information.
==============================================================================
*/
#ifndef __JUCE_ACTIONBROADCASTER_JUCEHEADER__
#define __JUCE_ACTIONBROADCASTER_JUCEHEADER__
#include "juce_ActionListener.h"
//==============================================================================
/** Manages a list of ActionListeners, and can send them messages.
To quickly add methods to your class that can add/remove action
listeners and broadcast to them, you can derive from this.
@see ActionListener, ChangeListener
*/
class JUCE_API ActionBroadcaster
{
public:
//==============================================================================
/** Creates an ActionBroadcaster. */
ActionBroadcaster();
/** Destructor. */
virtual ~ActionBroadcaster();
//==============================================================================
/** Adds a listener to the list.
Trying to add a listener that's already on the list will have no effect.
*/
void addActionListener (ActionListener* listener);
/** Removes a listener from the list.
If the listener isn't on the list, this won't have any effect.
*/
void removeActionListener (ActionListener* listener);
/** Removes all listeners from the list. */
void removeAllActionListeners();
//==============================================================================
/** Broadcasts a message to all the registered listeners.
@see ActionListener::actionListenerCallback
*/
void sendActionMessage (const String& message) const;
private:
//==============================================================================
friend class WeakReference<ActionBroadcaster>;
WeakReference<ActionBroadcaster>::Master masterReference;
class ActionMessage;
friend class ActionMessage;
SortedSet <ActionListener*> actionListeners;
CriticalSection actionListenerLock;
JUCE_DECLARE_NON_COPYABLE (ActionBroadcaster);
};
#endif // __JUCE_ACTIONBROADCASTER_JUCEHEADER__
|
/*
* File: main.c
* Author: mark
*
* Created on 7. Oktober 2013, 01:41
*/
#include "disp.h"
#include "RTC.h"
#include "defs.h"
#include "temp.h"
#include "menu.h"
#include "buttons.h"
#define DBG
#ifdef DBG
#pragma config DEBUG = ON
#pragma config MCLRE = ON
#pragma config WDT = OFF
#pragma config LVP = OFF
#else
#pragma config DEBUG = OFF
#pragma config MCLRE = OFF
#pragma config WDT = OFF
#pragma config WDTPS = 32768
#pragma config LVP = ON
#endif
#pragma config PWRT = ON
#pragma config PBADEN = OFF
#pragma config FOSC = HS
#pragma config CPUDIV = OSC1_PLL2
#pragma config PLLDIV = 4
#pragma config USBDIV = 2
// With 16MHz Crystal, runs at 4MHz
// 500KHz / 256 / 1000 = approx. .5 seconds
#define UPDATE_TIME_BIG 100
// will run at 500KHz hopefully
#define T2CFG 0b00000011
int tmr2_count = 0;
void setup();
/*
*
*/
int main(int argc, char** argv)
{
setup();
uint32_t cnt = 0;
while (true)
{
if (cnt++ > 20L)
{
cnt = 0;
//menu->printFn(menu->digits);
//writeLong(DIG0_7, 28572043L);
//writeString(DIG0_7, "6geolote");
//update();
//clearScreen();
}
//LATA5 = ~LATA5;
}
return (EXIT_SUCCESS);
}
void setup()
{
//Set all pins as outs and drive them low. We will configure ins later
TRISA = 0;
TRISB = 0;
TRISC = 0;
LATA = 0;
LATB = 0;
// set LATC to reflect cause of reset
//LATC = (RCON & 0b1)>> 0 | (RCON & 0b10) >> 0 | (RCON & 0b100) >> 0 | (RCON & 0b1000) >> 2 | (RCON & 0b100000) >> 2;
//LATC = MASKN(RCON, 0, 0) | MASKN(RCON, 1, 1) | MASKN(RCON, 2, 2) | MASKN(RCON, 4, 3) | MASKN(RCON, 6, 4);
//Status LED Config
LATA5 = 1;
//while (1);
//Interrupts
GIE = ON;
PEIE = ON;
IPEN = OFF;
startDisp();
LATC0 = ON;
#ifdef RTC
initRTC();
#endif
LATC0 = OFF;
#ifdef TEMP
initTemp();
#endif
setupButtons();
#if DEFAULT==TEMP
menu = &tempMenu;
#elif DEFAULT==RTC
menu = &rtcMenu;
#endif
//printFn = &printRTC;
LATA5 = 0;
//Timer0 Config
tmr0BigCounts = 0;
T0CON = TMR0_CFG;
TMR0 = TMR0_RESET_VAL;
TMR0IF = CLEAR;
TMR0IE = ON;
TMR0ON = ON;
// Timer1 Config
T1CON = T1CFG;
TMR1 = RTC_OFFSET;
TMR1IF = CLEAR;
TMR1IE = ON;
TMR1ON = ON;
// Config Timer 2 for updating the screen
T2CON = T2CFG;
TMR2 = 0;
TMR2IF = CLEAR;
TMR2IE = ON;
TMR2ON = ON;
}
void interrupt isr(void)
{
if (TMR1IE && TMR1IF)
{
TMR1IF = CLEAR;
TMR1ON = OFF;
TMR1 = 0;
if (++rtc_big_ticks > RTC_TICKS)
{
rtc_big_ticks = 0;
TMR1 = RTC_OFFSET;
TMR1ON = ON;
#ifdef RTC
tick(second);
#endif
//menu->printFn(menu->digits);
LATC7 = ~LATC7;
//printRTC(rtcMenu.digits);
}
//asm ("CLRWDT");
TMR1ON = ON;
}
if (TMR2IE && TMR2IF)
{
TMR2IF = CLEAR;
TMR2 = 0;
if (tmr2_count++ > UPDATE_TIME_BIG)
{
tmr2_count = 0;
update();
//LATC7 = ~LATC7;
}
}
if (TMR0IE && TMR0IF)
{
TMR0IF = CLEAR;
TMR0ON = OFF;
TMR0 = 0;
if (++tmr0BigCounts > TMR0_BIG_TICKS)
{
tmr0BigCounts = 0;
TMR0 = TMR0_RESET_VAL;
TMR0ON = ON;
buttons();
#ifdef TEMP
getTemp();
#endif
menu->printFn(menu->digits);
//LATC0 = ~LATC0;
}
TMR0ON = ON;
}
GIE = ON;
}
|
/** @file
DXE SMM Ready To Lock protocol introduced in the PI 1.2 specification.
According to PI 1.4a specification, this UEFI protocol indicates that
resources and services that should not be used by the third party code
are about to be locked.
This protocol is a mandatory protocol published by PI platform code.
This protocol in tandem with the End of DXE Event facilitates transition
of the platform from the environment where all of the components are
under the authority of the platform manufacturer to the environment where
third party extensible modules such as UEFI drivers and UEFI applications
are executed. The protocol is published immediately after signaling of the
End of DXE Event. PI modules that need to lock or protect their resources
in anticipation of the invocation of 3rd party extensible modules should
register for notification on installation of this protocol and effect the
appropriate protections in their notification handlers. For example, PI
platform code may choose to use notification handler to lock SMM by invoking
EFI_SMM_ACCESS2_PROTOCOL.Lock() function.
Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef _DXE_SMM_READY_TO_LOCK_H_
#define _DXE_SMM_READY_TO_LOCK_H_
#include <Protocol/DxeMmReadyToLock.h>
#define EFI_DXE_SMM_READY_TO_LOCK_PROTOCOL_GUID EFI_DXE_MM_READY_TO_LOCK_PROTOCOL_GUID
extern EFI_GUID gEfiDxeSmmReadyToLockProtocolGuid;
#endif
|
/*
* Copyright (c) 2020 Alexander Falb <fal3xx@gmail.com>
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <init.h>
#include <drivers/pinmux.h>
#include <soc.h>
static int board_pinmux_init(const struct device *dev)
{
const struct device *muxa = DEVICE_DT_GET(DT_NODELABEL(pinmux_a));
__ASSERT_NO_MSG(device_is_ready(muxa));
ARG_UNUSED(dev);
/* sercom 3 is always spi - it is the onboard flash */
/* SPI SERCOM3 on MISO=PA18, MOSI=PA16, SCK=PA17, CS=PA15*/
pinmux_pin_set(muxa, 18, PINMUX_FUNC_D);
pinmux_pin_set(muxa, 16, PINMUX_FUNC_D);
pinmux_pin_set(muxa, 17, PINMUX_FUNC_D);
#if ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_spi) && defined(CONFIG_SPI_SAM0)
/* SPI SERCOM0 on MISO=PA6, MOSI=PA4, SCK=PA5 */
pinmux_pin_set(muxa, 6, PINMUX_FUNC_D);
pinmux_pin_set(muxa, 4, PINMUX_FUNC_D);
pinmux_pin_set(muxa, 5, PINMUX_FUNC_D);
#endif
#if ATMEL_SAM0_DT_SERCOM_CHECK(0, atmel_sam0_uart) && defined(CONFIG_UART_SAM0)
/* SERCOM0 on RX=PA5, TX=PA4 */
pinmux_pin_set(muxa, 5, PINMUX_FUNC_C);
pinmux_pin_set(muxa, 4, PINMUX_FUNC_C);
#endif
#if ATMEL_SAM0_DT_SERCOM_CHECK(2, atmel_sam0_i2c) && defined(CONFIG_I2C_SAM0)
/* SERCOM2 on SDA=PA08, SCL=PA09 */
pinmux_pin_set(muxa, 4, PINMUX_FUNC_D);
pinmux_pin_set(muxa, 5, PINMUX_FUNC_D);
#endif
#if ATMEL_SAM0_DT_SERCOM_CHECK(2, atmel_sam0_uart) && defined(CONFIG_UART_SAM0)
/* SERCOM0 on RX=PA9, TX=PA8 */
pinmux_pin_set(muxa, 9, PINMUX_FUNC_C);
pinmux_pin_set(muxa, 8, PINMUX_FUNC_C);
#endif
#ifdef CONFIG_USB_DC_SAM0
/* USB DP on PA25, USB DM on PA24 */
pinmux_pin_set(muxa, 25, PINMUX_FUNC_G);
pinmux_pin_set(muxa, 24, PINMUX_FUNC_G);
#endif
#if (ATMEL_SAM0_DT_TCC_CHECK(0, atmel_sam0_tcc_pwm) && CONFIG_PWM_SAM0_TCC)
/* TCC0 on WO4=PA22 (red), WO3=PA19 (green), WO5=PA23 (blue) */
pinmux_pin_set(muxa, 22, PINMUX_FUNC_F);
pinmux_pin_set(muxa, 19, PINMUX_FUNC_F);
pinmux_pin_set(muxa, 23, PINMUX_FUNC_F);
#endif
return 0;
}
SYS_INIT(board_pinmux_init, PRE_KERNEL_1, CONFIG_PINMUX_INIT_PRIORITY);
|
/*********************************************************************
* Copyright (C) 2015, International Business Machines Corporation
* All Rights Reserved
*********************************************************************/
#include <stdio.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <net/if.h>
#include <string.h>
#include <error.h>
#include <rte_byteorder.h>
#include <rte_cycles.h>
#include <rte_eal.h>
#include <rte_errno.h>
#include <rte_ethdev.h>
#include <rte_lcore.h>
#include <rte_mbuf.h>
#include <rte_mempool.h>
#include <rte_random.h>
#include <rte_ring.h>
#include <rte_string_fns.h>
int main(int argc, char *argv[]) {
// Disable core dumps for this tool. rte_eal_init() core dumps in places that are not what I want.
struct rlimit rlim;
int rc = getrlimit(RLIMIT_CORE, &rlim);
if(rc < 0) {
error(255, errno, "getrlimit(RLIMIT_CORE) failed");
} else {
rlim.rlim_cur = 0;
rc = setrlimit(RLIMIT_CORE, &rlim);
if(rc < 0) {
error(255, errno, "setrlimit(RLIMIT_CORE) failed");
}
}
// initialize DPDK. No args are really needed, but if we pass any into this tool, just pass them along to DPDK.
argv[0] = "dpdk";
rc = rte_eal_init(argc, argv);
if (rc < 0) {
error(255, 0, "rte_eal_init() failed, rte_errno=%d, %s", rte_errno, rte_strerror(rte_errno));
}
struct rte_eth_dev_info dev_info;
struct ether_addr eth_addr;
struct rte_eth_link link;
unsigned port_id;
uint32_t num_ports = rte_eth_dev_count();
uint32_t if_index;
char ifname[IF_NAMESIZE];
printf("%d EAL ports available.\n", num_ports);
for (port_id = 0; port_id < num_ports; port_id++) {
rte_eth_dev_info_get(port_id, &dev_info);
rte_eth_macaddr_get(port_id, ð_addr);
rte_eth_link_get(port_id, &link);
if_index = dev_info.if_index;
if((if_index >= 0) && (if_indextoname(if_index, ifname))) {
} else {
strcpy(ifname, "<none>");
}
printf("port %d interface-index: %d\n", port_id, if_index);
printf("port %d interface: %s\n", port_id, ifname);
printf("port %d driver: %s\n", port_id, dev_info.driver_name);
printf("port %d mac-addr: %02x:%02x:%02x:%02x:%02x:%02x\n",
port_id,
eth_addr.addr_bytes[0],
eth_addr.addr_bytes[1],
eth_addr.addr_bytes[2],
eth_addr.addr_bytes[3],
eth_addr.addr_bytes[4],
eth_addr.addr_bytes[5]);
printf("port %d pci-bus-addr: %04x:%02x:%02x.%x\n",
port_id,
dev_info.pci_dev->addr.domain,
dev_info.pci_dev->addr.bus,
dev_info.pci_dev->addr.devid,
dev_info.pci_dev->addr.function);
printf("port %d socket: %d\n", port_id, rte_eth_dev_socket_id(port_id));
if (link.link_status) {
printf("port %d link-state: up\n", port_id);
printf("port %d link-speed: %u\n", port_id, (unsigned)link.link_speed);
if(link.link_duplex == ETH_LINK_FULL_DUPLEX) {
printf("port %d link-duplex: full-duplex\n", port_id);
} else {
printf("port %d link-duplex: half-duplex\n", port_id);
}
} else {
printf("port %d link-state: down\n", port_id);
printf("port %d link-speed: -1\n", port_id);
printf("port %d link-duplex: <n/a>\n", port_id);
}
printf("\n");
}
return 0;
}
|
/*
* 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 CELIX_DM_INFO_H_
#define CELIX_DM_INFO_H_
#include <stdbool.h>
#include "celix_array_list.h"
#include "celix_properties.h"
#ifdef __cplusplus
extern "C" {
#endif
struct celix_dm_interface_info_struct {
char* name;
celix_properties_t *properties;
};
typedef struct celix_dm_interface_info_struct *dm_interface_info_pt; //deprecated
typedef struct celix_dm_interface_info_struct dm_interface_info_t; //deprecated
typedef struct celix_dm_interface_info_struct celix_dm_interface_info_t;
struct celix_dm_service_dependency_info_struct {
char *serviceName;
char *filter;
char *versionRange;
bool available;
bool required;
size_t count;
};
typedef struct celix_dm_service_dependency_info_struct *dm_service_dependency_info_pt; //deprecated
typedef struct celix_dm_service_dependency_info_struct dm_service_dependency_info_t; //deprecated
typedef struct celix_dm_service_dependency_info_struct celix_dm_service_dependency_info_t;
struct celix_dm_component_info_struct {
char id[64];
char name[128];
bool active;
char* state;
size_t nrOfTimesStarted;
size_t nrOfTimesResumed;
celix_array_list_t *interfaces; // type dm_interface_info_t*
celix_array_list_t *dependency_list; // type dm_service_dependency_info_t*
};
typedef struct celix_dm_component_info_struct *dm_component_info_pt; //deprecated
typedef struct celix_dm_component_info_struct dm_component_info_t; //deprecated
typedef struct celix_dm_component_info_struct celix_dm_component_info_t;
struct celix_dm_dependency_manager_info_struct {
long bndId;
char* bndSymbolicName;
celix_array_list_t *components; // type dm_component_info_t*
};
typedef struct celix_dm_dependency_manager_info_struct *dm_dependency_manager_info_pt; //deprecated
typedef struct celix_dm_dependency_manager_info_struct dm_dependency_manager_info_t; //deprecated
typedef struct celix_dm_dependency_manager_info_struct celix_dependency_manager_info_t;
#ifdef __cplusplus
}
#endif
#endif //CELIX_DM_INFO_H_
|
/* asm.h - x86 tool dependent headers */
/*
* Copyright (c) 2007-2014 Wind River Systems, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_INCLUDE_ARCH_X86_ASM_H_
#define ZEPHYR_INCLUDE_ARCH_X86_ASM_H_
#include <toolchain.h>
#include <linker/sections.h>
/* offsets from stack pointer to function arguments */
#define SP_ARG0 0
#define SP_ARG1 4
#define SP_ARG2 8
#define SP_ARG3 12
#define SP_ARG4 16
#define SP_ARG5 20
#define SP_ARG6 24
#define SP_ARG7 28
#define SP_ARG8 32
#if defined(_ASMLANGUAGE)
#if defined(CONFIG_RETPOLINE)
/*
* For a description of how retpolines are constructed for both indirect
* jumps and indirect calls, please refer to this documentation:
* https://support.google.com/faqs/answer/7625886
*
* Since these macros are used in a few places in arch/x86/core assembly
* routines, with different reg parameters, it's not possible to use
* the "out of line" construction technique to share a trampoline.
*/
#define INDIRECT_JMP_IMPL(reg, id) \
call .set_up_target ## id; \
.speculative_trap ## id: \
pause; \
jmp .speculative_trap ## id; \
.set_up_target ## id: \
mov reg, (%esp); \
ret
#define INDIRECT_CALL_IMPL(reg, id) \
call .set_up_return ## id; \
.inner_indirect_branch ## id: \
call .set_up_target ## id; \
.speculative_trap ## id: \
pause; \
jmp .speculative_trap ## id; \
.set_up_target ## id: \
mov reg, (%esp); \
ret; \
.set_up_return ## id: \
call .inner_indirect_branch ## id
#define INDIRECT_CALL_IMPL1(reg, id) INDIRECT_CALL_IMPL(reg, id)
#define INDIRECT_JMP_IMPL1(reg, id) INDIRECT_JMP_IMPL(reg, id)
#define INDIRECT_CALL(reg) INDIRECT_CALL_IMPL1(reg, __COUNTER__)
#define INDIRECT_JMP(reg) INDIRECT_JMP_IMPL1(reg, __COUNTER__)
#else
#define INDIRECT_CALL(reg) call *reg
#define INDIRECT_JMP(reg) jmp *reg
#endif /* CONFIG_RETPOLINE */
#endif /* _ASMLANGUAGE */
#endif /* ZEPHYR_INCLUDE_ARCH_X86_ASM_H_ */
|
#pragma once
#include "envoy/event/dispatcher.h"
#include "envoy/service/load_stats/v2/lrs.pb.h"
#include "envoy/stats/stats_macros.h"
#include "envoy/upstream/cluster_manager.h"
#include "common/common/logger.h"
#include "common/grpc/async_client_impl.h"
namespace Envoy {
namespace Upstream {
/**
* All load reporter stats. @see stats_macros.h
*/
// clang-format off
#define ALL_LOAD_REPORTER_STATS(COUNTER) \
COUNTER(requests) \
COUNTER(responses) \
COUNTER(errors)
// clang-format on
/**
* Struct definition for all load reporter stats. @see stats_macros.h
*/
struct LoadReporterStats {
ALL_LOAD_REPORTER_STATS(GENERATE_COUNTER_STRUCT)
};
class LoadStatsReporter
: Grpc::TypedAsyncStreamCallbacks<envoy::service::load_stats::v2::LoadStatsResponse>,
Logger::Loggable<Logger::Id::upstream> {
public:
LoadStatsReporter(const envoy::api::v2::core::Node& node, ClusterManager& cluster_manager,
Stats::Scope& scope, Grpc::AsyncClientPtr async_client,
Event::Dispatcher& dispatcher);
// Grpc::TypedAsyncStreamCallbacks
void onCreateInitialMetadata(Http::HeaderMap& metadata) override;
void onReceiveInitialMetadata(Http::HeaderMapPtr&& metadata) override;
void onReceiveMessage(
std::unique_ptr<envoy::service::load_stats::v2::LoadStatsResponse>&& message) override;
void onReceiveTrailingMetadata(Http::HeaderMapPtr&& metadata) override;
void onRemoteClose(Grpc::Status::GrpcStatus status, const std::string& message) override;
// TODO(htuch): Make this configurable or some static.
const uint32_t RETRY_DELAY_MS = 5000;
private:
void setRetryTimer();
void establishNewStream();
void sendLoadStatsRequest();
void handleFailure();
void startLoadReportPeriod();
ClusterManager& cm_;
LoadReporterStats stats_;
Grpc::AsyncClientPtr async_client_;
Grpc::AsyncStream* stream_{};
const Protobuf::MethodDescriptor& service_method_;
Event::TimerPtr retry_timer_;
Event::TimerPtr response_timer_;
envoy::service::load_stats::v2::LoadStatsRequest request_;
std::unique_ptr<envoy::service::load_stats::v2::LoadStatsResponse> message_;
std::vector<std::string> clusters_;
};
typedef std::unique_ptr<LoadStatsReporter> LoadStatsReporterPtr;
} // namespace Upstream
} // namespace Envoy
|
////////////////////////////////////////////////////////////////////////////////
//
// EXPANZ
// Copyright 2008-2011 EXPANZ
// All Rights Reserved.
//
// NOTICE: Expanz permits you to use, modify, and distribute this file
// in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////
#import <Foundation/Foundation.h>
#import "xml_Serializable.h"
#import "expanz_model_ActivityStyle.h"
@class expanz_service_DataPublicationRequest;
@interface expanz_service_CreateActivityRequest : NSObject <xml_Serializable> {
@private
NSMutableDictionary* _dataPublicationRequests;
}
@property(nonatomic, strong, readonly) NSString* activityName;
@property(nonatomic, strong, readonly) ActivityStyle* style;
@property(nonatomic, strong, readonly) NSString* initialKey;
@property(nonatomic, strong, readonly) NSString* sessionToken;
@property(nonatomic, strong, readonly) NSArray* dataPublicationRequests;
/**
* Initializes with activity name, and session token attributes.
*/
- (id) initWithActivityName:(NSString*)activityName style:(ActivityStyle*)style initialKey:(NSString*)initialKey
sessionToken:(NSString*)sessionToken;
/**
* Creates or retrieves a DataPublicationRequest for associated with the supplied key.
*/
- (expanz_service_DataPublicationRequest*) dataPublicationRequestFor:(NSValue*)key;
- (NSValue*) keyForDataPublicationRequest:(expanz_service_DataPublicationRequest*)publicationRequest;
@end
/* ================================================================================================================== */
@compatibility_alias CreateActivityRequest expanz_service_CreateActivityRequest; |
#pragma once
#include "envoy/api/api.h"
#include "envoy/event/dispatcher.h"
#include "envoy/network/dns.h"
#include "source/common/config/utility.h"
namespace Envoy {
namespace Network {
constexpr absl::string_view CaresDnsResolver = "envoy.network.dns_resolver.cares";
constexpr absl::string_view AppleDnsResolver = "envoy.network.dns_resolver.apple";
constexpr absl::string_view DnsResolverCategory = "envoy.network.dns_resolver";
class DnsResolverFactory : public Config::TypedFactory {
public:
/*
* @returns a DnsResolver object.
* @param dispatcher: the local dispatcher thread
* @param api: API interface to interact with system resources
* @param typed_dns_resolver_config: the typed DNS resolver config
*/
virtual DnsResolverSharedPtr createDnsResolver(
Event::Dispatcher& dispatcher, Api::Api& api,
const envoy::config::core::v3::TypedExtensionConfig& typed_dns_resolver_config) const PURE;
std::string category() const override { return std::string(DnsResolverCategory); }
};
} // namespace Network
} // namespace Envoy
|
#ifndef HITTOP_PARSER_REPEAT_H
#define HITTOP_PARSER_REPEAT_H
#include "boost/range/iterator_range_core.hpp"
#include "hittop/parser/parser.h"
namespace hittop {
namespace parser {
// Star operator; repeat the specified grammar greedily as many times as
// possible. Will always succeed (because parsing 0 times is a valid result)
// or ask for more input, but is not guaranteed to make progress.
template <typename Grammar> struct Repeat {};
template <typename Grammar> class Parser<Repeat<Grammar>> {
public:
template <typename Range, typename... Args>
auto operator()(const Range &input, Args &&... args) const
-> ParseResult<decltype(std::begin(input))> {
const auto last = std::end(input);
auto next = std::begin(input);
for (;;) {
auto result =
Parse<Grammar>(boost::make_iterator_range(next, last), args...);
if (!result.ok()) {
// INCOMPLETE is a special case; we always want to pass it through since
// it is uncertain whether the parse would have been successful on this
// iteration.
if (result.error() == ParseError::INCOMPLETE) {
return result;
}
break;
}
// If we are going to make no progress by running another time
// through the loop (we assume Parser implementations are
// stateless), then stop here.
if (next == result.get()) {
break;
}
next = result.consume();
}
return next;
}
};
} // namespace parser
} // namespace hittop
#endif // HITTOP_PARSER_REPEAT_H
|
/**
******************************************************************************
* @file SDIO/SDIO_uSDCard/stm32f4xx_conf.h
* @author MCD Application Team
* @version V1.4.0
* @date 04-August-2014
* @brief Library configuration file.
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>
*
* Licensed under MCD-ST Liberty SW License Agreement V2, (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.st.com/software_license_agreement_liberty_v2
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F4xx_CONF_H
#define __STM32F4xx_CONF_H
/* Includes ------------------------------------------------------------------*/
/* Uncomment the line below to enable peripheral header file inclusion */
#include "stm32f4xx_adc.h"
#include "stm32f4xx_crc.h"
#include "stm32f4xx_dbgmcu.h"
#include "stm32f4xx_dma.h"
#include "stm32f4xx_exti.h"
#include "stm32f4xx_flash.h"
#include "stm32f4xx_gpio.h"
#include "stm32f4xx_i2c.h"
#include "stm32f4xx_iwdg.h"
#include "stm32f4xx_pwr.h"
#include "stm32f4xx_rcc.h"
#include "stm32f4xx_rtc.h"
#include "stm32f4xx_sdio.h"
#include "stm32f4xx_spi.h"
#include "stm32f4xx_syscfg.h"
#include "stm32f4xx_tim.h"
#include "stm32f4xx_usart.h"
#include "stm32f4xx_wwdg.h"
#include "misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */
#if defined (STM32F429_439xx)
#include "stm32f4xx_cryp.h"
#include "stm32f4xx_hash.h"
#include "stm32f4xx_rng.h"
#include "stm32f4xx_can.h"
#include "stm32f4xx_dac.h"
#include "stm32f4xx_dcmi.h"
#include "stm32f4xx_dma2d.h"
#include "stm32f4xx_fmc.h"
#include "stm32f4xx_ltdc.h"
#include "stm32f4xx_sai.h"
#endif /* STM32F429_439xx */
#if defined (STM32F427_437xx)
#include "stm32f4xx_cryp.h"
#include "stm32f4xx_hash.h"
#include "stm32f4xx_rng.h"
#include "stm32f4xx_can.h"
#include "stm32f4xx_dac.h"
#include "stm32f4xx_dcmi.h"
#include "stm32f4xx_dma2d.h"
#include "stm32f4xx_fmc.h"
#include "stm32f4xx_sai.h"
#endif /* STM32F427_437xx */
#if defined (STM32F40_41xxx)
#include "stm32f4xx_cryp.h"
#include "stm32f4xx_hash.h"
#include "stm32f4xx_rng.h"
#include "stm32f4xx_can.h"
#include "stm32f4xx_dac.h"
#include "stm32f4xx_dcmi.h"
#include "stm32f4xx_fsmc.h"
#endif /* STM32F40_41xxx */
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* If an external clock source is used, then the value of the following define
should be set to the value of the external clock source, else, if no external
clock is used, keep this define commented */
/*#define I2S_EXTERNAL_CLOCK_VAL 12288000 */ /* Value of the external clock in Hz */
/* Uncomment the line below to expanse the "assert_param" macro in the
Standard Peripheral Library drivers code */
/* #define USE_FULL_ASSERT 1 */
/* Exported macro ------------------------------------------------------------*/
#ifdef USE_FULL_ASSERT
/**
* @brief The assert_param macro is used for function's parameters check.
* @param expr: If expr is false, it calls assert_failed function
* which reports the name of the source file and the source
* line number of the call that failed.
* If expr is true, it returns no value.
* @retval None
*/
#define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__))
/* Exported functions ------------------------------------------------------- */
void assert_failed(uint8_t* file, uint32_t line);
#else
#define assert_param(expr) ((void)0)
#endif /* USE_FULL_ASSERT */
#endif /* __STM32F4xx_CONF_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
/*
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#pragma once
#include <aws/ec2/EC2_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
namespace Aws
{
namespace EC2
{
namespace Model
{
enum class LogDestinationType
{
NOT_SET,
cloud_watch_logs,
s3
};
namespace LogDestinationTypeMapper
{
AWS_EC2_API LogDestinationType GetLogDestinationTypeForName(const Aws::String& name);
AWS_EC2_API Aws::String GetNameForLogDestinationType(LogDestinationType value);
} // namespace LogDestinationTypeMapper
} // namespace Model
} // namespace EC2
} // namespace Aws
|
//
// CCSColoredStickChartData.h
// CocoaChartsSample
//
// Created by limc on 12/2/13.
// Copyright (c) 2013 limc. 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.
//
#import "CCSStickChartData.h"
@interface CCSColoredStickChartData : CCSStickChartData {
UIColor *_fillColor;
UIColor *_borderColor;
}
@property(retain, nonatomic) UIColor *fillColor;
@property(retain, nonatomic) UIColor *borderColor;
- (id)initWithHigh:(CCFloat)high low:(CCFloat)low date:(NSString *)date color:(UIColor *)color;
- (id)initWithHigh:(CCFloat)high low:(CCFloat)low date:(NSString *)date fill:(UIColor *)fill border:(UIColor *)border;
@end
|
// Copyright 2008-2009 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ========================================================================
//
// BrowserRequest provides http transactions proxied through a user's browser.
#ifndef OMAHA_NET_BROWSER_REQUEST_H__
#define OMAHA_NET_BROWSER_REQUEST_H__
#include <list>
#include "omaha/net/urlmon_request.h"
namespace omaha {
typedef std::list<CAdapt<CComPtr<IBrowserHttpRequest2> > > BrowserObjects;
class BrowserRequest : public UrlmonRequest {
public:
BrowserRequest();
virtual ~BrowserRequest() {}
virtual CString ToString() const { return _T("iexplore"); }
virtual HRESULT SendRequest(BSTR url,
BSTR post_data,
BSTR request_headers,
VARIANT response_headers_needed,
CComVariant* response_headers,
DWORD* response_code,
BSTR* cache_filename);
private:
bool GetAvailableBrowserObjects();
BrowserObjects objects_;
friend class BrowserRequestTest;
friend class CupRequestTest;
DISALLOW_EVIL_CONSTRUCTORS(BrowserRequest);
};
} // namespace omaha
#endif // OMAHA_NET_BROWSER_REQUEST_H__
|
/*
Copyright (c) 2007-2009 Cyrus Daboo. 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.
*/
// CEditGroupDialog.h : header file
//
#ifndef __CEDITGROUPDIALOG__MULBERRY__
#define __CEDITGROUPDIALOG__MULBERRY__
#include "CHelpDialog.h"
/////////////////////////////////////////////////////////////////////////////
// CEditGroupDialog dialog
class CGroup;
class CEditGroupDialog : public CHelpDialog
{
// Construction
public:
CEditGroupDialog(CWnd* pParent = NULL); // standard constructor
virtual void SetFields(const CGroup* grp);
virtual bool GetFields(CGroup* grp);
// Dialog Data
//{{AFX_DATA(CEditGroupDialog)
enum { IDD = IDD_EDITGROUP };
cdstring mNickName;
cdstring mGroupName;
cdstring mAddressList;
CEdit mAddressListCtrl;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CEditGroupDialog)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
cdstring mOriginalListText;
// Generated message map functions
//{{AFX_MSG(CEditGroupDialog)
afx_msg void OnGroupEditSort();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#endif
|
/*
* Copyright 2016 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#ifdef _WIN32
#include <assert.h>
#include <intrin.h>
#include <folly/Portability.h>
FOLLY_ALWAYS_INLINE int __builtin_clz(unsigned int x) {
unsigned long index;
return (int)(_BitScanReverse(&index, (unsigned long)x) ? 31 - index : 32);
}
FOLLY_ALWAYS_INLINE int __builtin_clzl(unsigned long x) {
return __builtin_clz((unsigned int)x);
}
FOLLY_ALWAYS_INLINE int __builtin_clzll(unsigned long long x) {
unsigned long index;
return (int)(_BitScanReverse64(&index, x) ? 63 - index : 64);
}
FOLLY_ALWAYS_INLINE int __builtin_ctzll(unsigned long long x) {
unsigned long index;
return (int)(_BitScanForward64(&index, x) ? index : 64);
}
FOLLY_ALWAYS_INLINE int __builtin_ffs(int x) {
unsigned long index;
return (int)(_BitScanForward(&index, (unsigned long)x) ? index : 0);
}
FOLLY_ALWAYS_INLINE int __builtin_ffsl(long x) { return __builtin_ffs((int)x); }
FOLLY_ALWAYS_INLINE int __builtin_ffsll(long long x) {
unsigned long index;
return (int)(_BitScanForward64(&index, (unsigned long long)x) ? index : 0);
}
FOLLY_ALWAYS_INLINE int __builtin_popcountll(unsigned long long x) {
return (int)__popcnt64(x);
}
FOLLY_ALWAYS_INLINE void* __builtin_return_address(unsigned int frame) {
// I really hope frame is zero...
assert(frame == 0);
return _ReturnAddress();
}
#endif
|
#include "cmdq_mmp.h"
static CMDQ_MMP_Events_t CMDQ_MMP_Events;
extern void MMProfileEnable(int enable);
extern void MMProfileStart(int start);
CMDQ_MMP_Events_t *cmdq_mmp_get_event(void)
{
return &CMDQ_MMP_Events;
}
void cmdq_mmp_init(void)
{
#if CMDQ_PROFILE_MMP
MMProfileEnable(1);
if (CMDQ_MMP_Events.CMDQ == 0) {
CMDQ_MMP_Events.CMDQ = MMProfileRegisterEvent(MMP_RootEvent, "CMDQ");
CMDQ_MMP_Events.thread_en =
MMProfileRegisterEvent(CMDQ_MMP_Events.CMDQ, "thread_en");
CMDQ_MMP_Events.CMDQ_IRQ = MMProfileRegisterEvent(CMDQ_MMP_Events.CMDQ, "CMDQ_IRQ");
CMDQ_MMP_Events.warning = MMProfileRegisterEvent(CMDQ_MMP_Events.CMDQ, "warning");
CMDQ_MMP_Events.loopBeat = MMProfileRegisterEvent(CMDQ_MMP_Events.CMDQ, "loopIRQ");
CMDQ_MMP_Events.autoRelease_add =
MMProfileRegisterEvent(CMDQ_MMP_Events.CMDQ, "autoRelease_add");
CMDQ_MMP_Events.autoRelease_done =
MMProfileRegisterEvent(CMDQ_MMP_Events.CMDQ, "autoRelease_done");
CMDQ_MMP_Events.consume_add =
MMProfileRegisterEvent(CMDQ_MMP_Events.CMDQ, "consume_add");
CMDQ_MMP_Events.consume_done =
MMProfileRegisterEvent(CMDQ_MMP_Events.CMDQ, "consume_done");
CMDQ_MMP_Events.alloc_task =
MMProfileRegisterEvent(CMDQ_MMP_Events.CMDQ, "alloc_task");
CMDQ_MMP_Events.wait_task =
MMProfileRegisterEvent(CMDQ_MMP_Events.CMDQ, "wait_task");
CMDQ_MMP_Events.wait_thread =
MMProfileRegisterEvent(CMDQ_MMP_Events.CMDQ, "wait_thread");
CMDQ_MMP_Events.MDP_reset =
MMProfileRegisterEvent(CMDQ_MMP_Events.CMDQ, "MDP_reset");
CMDQ_MMP_Events.thread_suspend =
MMProfileRegisterEvent(CMDQ_MMP_Events.CMDQ, "thread_suspend");
CMDQ_MMP_Events.thread_resume =
MMProfileRegisterEvent(CMDQ_MMP_Events.CMDQ, "thread_resume");
MMProfileEnableEventRecursive(CMDQ_MMP_Events.CMDQ, 1);
}
MMProfileStart(1);
#endif
}
|
#ifndef FASTER_RNNLM_WORDS_H_
#define FASTER_RNNLM_WORDS_H_
#include <inttypes.h>
#include <stddef.h>
#include <stdio.h>
#include <string>
#include <vector>
#include "faster-rnnlm/settings.h"
class Vocabulary {
public:
static const WordIndex kWordOOV = -1;
Vocabulary();
~Vocabulary();
int size() const { return words_.size(); }
// Returns index of the word in the vocabulary; if the word is not found, returns kWordOOV
WordIndex GetIndexByWord(const char* word) const;
// Returns a word by its index; for invalid indices NULL pointer is returned
const char* GetWordByIndex(WordIndex index) const;
// Returns a frequence of a word by its index; for invalid indices - UB
int64_t GetWordFrequency(WordIndex index) const { return words_[index].freq; }
// Reads the vocabulary from the file
void Load(const std::string& fpath);
// Saves the vocabulary to the file
void Dump(const std::string& fpath) const;
// Reads corpus and stores all words with their frequencies
void BuildFromCorpus(const std::string& fpath, bool show_progress);
// Adds a few fake words if that is needed to build a full k-ary tree
void AdjustSizeForSoftmaxTree(int arity);
struct Word {
int64_t freq;
char *word;
};
private:
class HashImpl;
std::vector<Word> words_;
HashImpl* hash_impl_;
// Adds a word to the vocabulary with zero frequency; returns word index
WordIndex AddWord(const char *word);
void Sort(bool stable);
};
// Reads space-serated words from a file
// - adds </s> to end of each line
// - empty lines are skipped
class WordReader {
public:
explicit WordReader(const std::string& fname);
~WordReader() { if (file_ != stdin) fclose(file_); delete[] buffer_; }
// Reads a word; returns false iff EOF
// Words longer than MAX_STRING are truncated
bool ReadWord(char* word);
// Forces the reader to iterate over only a 1 / chunk_count part of the training file
void SetChunk(int chunk, int chunk_count);
int64_t GetFileSize() const { return file_size_; }
// amount of bytes that were read from the start of the chunk
int64_t GetDoneByteCount() const;
protected:
FILE* file_;
char* pointer_;
char* buffer_;
int64_t file_size_, chunk_start_, chunk_end_;
};
// SentenceReader class represents a corpora as a sequence of sentences,
// where each sentence is an array of word indices
class SentenceReader : public WordReader {
public:
SentenceReader(const Vocabulary& vocab, const std::string& filename, bool reverse, bool auto_insert_unk);
// Tries to read next sentence; returns false iff eof or end-of-chunk
bool Read();
// Returns pointer to the last read sentence
const WordIndex* sentence() const { return sen_; }
// Returns the length of the last read sentence
int sentence_length() const { return sentence_length_; }
// Returns number of sentences read so far
int64_t sentence_id() const { return sentence_id_; }
// Returns true iff the last line has any OOV words, that were mapped to unk_word
bool HasOOVWords() const { return oov_occured_; }
private:
SentenceReader(SentenceReader&);
SentenceReader& operator=(SentenceReader&);
// Reads a word and set its index in the vocabulary
// if the word is not found, set kWordOOV
// return false iff EOF
bool ReadWordId(WordIndex* wid);
int sentence_length_;
int64_t sentence_id_;
WordIndex sen_[MAX_SENTENCE_WORDS + 1];
const Vocabulary& vocab_;
const WordIndex unk_word_;
bool reverse_;
bool done_;
bool oov_occured_;
};
#endif // FASTER_RNNLM_WORDS_H_
|
/*
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#pragma once
#include <aws/s3/S3_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>
namespace Aws
{
namespace Utils
{
namespace Xml
{
class XmlNode;
} // namespace Xml
} // namespace Utils
namespace S3
{
namespace Model
{
class AWS_S3_API InventoryFilter
{
public:
InventoryFilter();
InventoryFilter(const Aws::Utils::Xml::XmlNode& xmlNode);
InventoryFilter& operator=(const Aws::Utils::Xml::XmlNode& xmlNode);
void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const;
/**
* The prefix that an object must have to be included in the inventory results.
*/
inline const Aws::String& GetPrefix() const{ return m_prefix; }
/**
* The prefix that an object must have to be included in the inventory results.
*/
inline void SetPrefix(const Aws::String& value) { m_prefixHasBeenSet = true; m_prefix = value; }
/**
* The prefix that an object must have to be included in the inventory results.
*/
inline void SetPrefix(Aws::String&& value) { m_prefixHasBeenSet = true; m_prefix = std::move(value); }
/**
* The prefix that an object must have to be included in the inventory results.
*/
inline void SetPrefix(const char* value) { m_prefixHasBeenSet = true; m_prefix.assign(value); }
/**
* The prefix that an object must have to be included in the inventory results.
*/
inline InventoryFilter& WithPrefix(const Aws::String& value) { SetPrefix(value); return *this;}
/**
* The prefix that an object must have to be included in the inventory results.
*/
inline InventoryFilter& WithPrefix(Aws::String&& value) { SetPrefix(std::move(value)); return *this;}
/**
* The prefix that an object must have to be included in the inventory results.
*/
inline InventoryFilter& WithPrefix(const char* value) { SetPrefix(value); return *this;}
private:
Aws::String m_prefix;
bool m_prefixHasBeenSet;
};
} // namespace Model
} // namespace S3
} // namespace Aws
|
/*
* stat_client.h - Library for access to VPP statistics segment
*
* Copyright (c) 2018 Cisco and/or its affiliates.
* 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 included_stat_client_h
#define included_stat_client_h
#define STAT_VERSION_MAJOR 1
#define STAT_VERSION_MINOR 2
#include <stdint.h>
#include <unistd.h>
#include <vlib/counter_types.h>
#include <time.h>
#include <stdbool.h>
#include <vlib/stats/shared.h>
/* Default socket to exchange segment fd */
/* TODO: Get from runtime directory */
#define STAT_SEGMENT_SOCKET_FILE "/run/vpp/stats.sock"
#define STAT_SEGMENT_SOCKET_FILENAME "stats.sock"
typedef struct
{
char *name;
stat_directory_type_t type;
union
{
double scalar_value;
counter_t *error_vector;
counter_t **simple_counter_vec;
vlib_counter_t **combined_counter_vec;
uint8_t **name_vector;
};
} stat_segment_data_t;
typedef struct
{
uint64_t current_epoch;
vlib_stats_shared_header_t *shared_header;
vlib_stats_entry_t *directory_vector;
ssize_t memory_size;
uint64_t timeout;
} stat_client_main_t;
extern stat_client_main_t stat_client_main;
stat_client_main_t *stat_client_get (void);
void stat_client_free (stat_client_main_t * sm);
int stat_segment_connect_r (const char *socket_name, stat_client_main_t * sm);
int stat_segment_connect (const char *socket_name);
void stat_segment_disconnect_r (stat_client_main_t * sm);
void stat_segment_disconnect (void);
uint8_t **stat_segment_string_vector (uint8_t ** string_vector,
const char *string);
int stat_segment_vec_len (void *vec);
void stat_segment_vec_free (void *vec);
uint32_t *stat_segment_ls_r (uint8_t ** patterns, stat_client_main_t * sm);
uint32_t *stat_segment_ls (uint8_t ** pattern);
stat_segment_data_t *stat_segment_dump_r (uint32_t * stats,
stat_client_main_t * sm);
stat_segment_data_t *stat_segment_dump (uint32_t * counter_vec);
stat_segment_data_t *stat_segment_dump_entry_r (uint32_t index,
stat_client_main_t * sm);
stat_segment_data_t *stat_segment_dump_entry (uint32_t index);
void stat_segment_data_free (stat_segment_data_t * res);
double stat_segment_heartbeat_r (stat_client_main_t * sm);
double stat_segment_heartbeat (void);
char *stat_segment_index_to_name_r (uint32_t index, stat_client_main_t * sm);
char *stat_segment_index_to_name (uint32_t index);
uint64_t stat_segment_version (void);
uint64_t stat_segment_version_r (stat_client_main_t * sm);
typedef struct
{
uint64_t epoch;
} stat_segment_access_t;
static inline uint64_t
_time_now_nsec (void)
{
struct timespec ts;
clock_gettime (CLOCK_REALTIME, &ts);
return 1e9 * ts.tv_sec + ts.tv_nsec;
}
static inline void *
stat_segment_adjust (stat_client_main_t * sm, void *data)
{
char *csh = (char *) sm->shared_header;
char *p = csh + ((char *) data - (char *) sm->shared_header->base);
if (p > csh && p + sizeof (p) < csh + sm->memory_size)
return (void *) p;
return 0;
}
/*
* Returns 0 on success, -1 on failure (timeout)
*/
static inline int
stat_segment_access_start (stat_segment_access_t * sa,
stat_client_main_t * sm)
{
vlib_stats_shared_header_t *shared_header = sm->shared_header;
uint64_t max_time;
sa->epoch = shared_header->epoch;
if (sm->timeout)
{
max_time = _time_now_nsec () + sm->timeout;
while (shared_header->in_progress != 0 && _time_now_nsec () < max_time)
;
}
else
{
while (shared_header->in_progress != 0)
;
}
sm->directory_vector = (vlib_stats_entry_t *) stat_segment_adjust (
sm, (void *) sm->shared_header->directory_vector);
if (sm->timeout)
return _time_now_nsec () < max_time ? 0 : -1;
return 0;
}
/*
* set maximum number of nano seconds to wait for in_progress state
*/
static inline void
stat_segment_set_timeout_nsec (stat_client_main_t * sm, uint64_t timeout)
{
sm->timeout = timeout;
}
/*
* set maximum number of nano seconds to wait for in_progress state
* this function can be called directly by module using shared stat
* segment
*/
static inline void
stat_segment_set_timeout (uint64_t timeout)
{
stat_client_main_t *sm = &stat_client_main;
stat_segment_set_timeout_nsec (sm, timeout);
}
static inline bool
stat_segment_access_end (stat_segment_access_t * sa, stat_client_main_t * sm)
{
vlib_stats_shared_header_t *shared_header = sm->shared_header;
if (shared_header->epoch != sa->epoch || shared_header->in_progress)
return false;
return true;
}
#endif /* included_stat_client_h */
/*
* fd.io coding-style-patch-verification: ON
*
* Local Variables:
* eval: (c-set-style "gnu")
* End:
*/
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.