text stringlengths 4 6.14k |
|---|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE121_Stack_Based_Buffer_Overflow__CWE135_61a.c
Label Definition File: CWE121_Stack_Based_Buffer_Overflow__CWE135.label.xml
Template File: sources-sinks-61a.tmpl.c
*/
/*
* @description
* CWE: 121 Stack Based Buffer Overflow
* BadSource: Void pointer to a wchar_t array
* GoodSource: Void pointer to a char array
* Sinks:
* GoodSink: Allocate memory using wcslen() and copy data
* BadSink : Allocate memory using strlen() and copy data
* Flow Variant: 61 Data flow: data returned from one function to another in different source files
*
* */
#include "std_testcase.h"
#include <wchar.h>
#define WIDE_STRING L"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
#define CHAR_STRING "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
#ifndef OMITBAD
/* bad function declaration */
void * CWE121_Stack_Based_Buffer_Overflow__CWE135_61b_badSource(void * data);
void CWE121_Stack_Based_Buffer_Overflow__CWE135_61_bad()
{
void * data;
data = NULL;
data = CWE121_Stack_Based_Buffer_Overflow__CWE135_61b_badSource(data);
{
/* POTENTIAL FLAW: treating pointer as a char* when it may point to a wide string */
size_t dataLen = strlen((char *)data);
void * dest = (void *)ALLOCA((dataLen+1) * sizeof(wchar_t));
(void)wcscpy(dest, data);
printLine((char *)dest);
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void * CWE121_Stack_Based_Buffer_Overflow__CWE135_61b_goodG2BSource(void * data);
static void goodG2B()
{
void * data;
data = NULL;
data = CWE121_Stack_Based_Buffer_Overflow__CWE135_61b_goodG2BSource(data);
{
/* POTENTIAL FLAW: treating pointer as a char* when it may point to a wide string */
size_t dataLen = strlen((char *)data);
void * dest = (void *)ALLOCA((dataLen+1) * 1);
(void)strcpy(dest, data);
printLine((char *)dest);
}
}
/* goodB2G uses the BadSource with the GoodSink */
void * CWE121_Stack_Based_Buffer_Overflow__CWE135_61b_goodB2GSource(void * data);
static void goodB2G()
{
void * data;
data = NULL;
data = CWE121_Stack_Based_Buffer_Overflow__CWE135_61b_goodB2GSource(data);
{
/* FIX: treating pointer like a wchar_t* */
size_t dataLen = wcslen((wchar_t *)data);
void * dest = (void *)ALLOCA((dataLen+1) * sizeof(wchar_t));
(void)wcscpy(dest, data);
printWLine((wchar_t *)dest);
}
}
void CWE121_Stack_Based_Buffer_Overflow__CWE135_61_good()
{
goodG2B();
goodB2G();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
its own for testing or for building a binary to use in testing binary
analysis tools. It is not used when compiling all the testcases as one
application, which is how source code analysis tools are tested. */
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE121_Stack_Based_Buffer_Overflow__CWE135_61_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE121_Stack_Based_Buffer_Overflow__CWE135_61_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#pragma once
#include "flutter/fml/macros.h"
#include "impeller/aiks/picture.h"
#include "impeller/playground/playground.h"
namespace impeller {
class AiksPlayground : public Playground {
public:
AiksPlayground();
~AiksPlayground();
bool OpenPlaygroundHere(const Picture& picture);
private:
FML_DISALLOW_COPY_AND_ASSIGN(AiksPlayground);
};
} // namespace impeller
|
#pragma once
#include "LModel.h"
class LTeapot : public LModel
{
public:
LTeapot();
virtual ~LTeapot();
virtual HRESULT Display(IL3DEngine* p3DEngine, IDirect3DDevice9* p3DDevice, float fDeltaTime);
public:
HRESULT Create(IL3DEngine* p3DEngine, IDirect3DDevice9* p3DDevice);
private:
float m_fAngleY;
}; |
/*
Simple DirectMedia Layer
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/**
* \file begin_code.h
*
* This file sets things up for C dynamic library function definitions,
* static inlined functions, and structures aligned at 4-byte alignment.
* If you don't like ugly C preprocessor code, don't look at this file. :)
*/
/* This shouldn't be nested -- included it around code only. */
#ifdef _begin_code_h
#error Nested inclusion of begin_code.h
#endif
#define _begin_code_h
/* Some compilers use a special export keyword */
#ifndef DECLSPEC
# if defined(__BEOS__) || defined(__HAIKU__)
# if defined(__GNUC__)
# define DECLSPEC __declspec(dllexport)
# else
# define DECLSPEC __declspec(export)
# endif
# elif defined(__WIN32__)
# ifdef __BORLANDC__
# ifdef BUILD_SDL
# define DECLSPEC
# else
# define DECLSPEC __declspec(dllimport)
# endif
# else
# define DECLSPEC __declspec(dllexport)
# endif
# else
# if defined(__GNUC__) && __GNUC__ >= 4
# define DECLSPEC __attribute__ ((visibility("default")))
# else
# define DECLSPEC
# endif
# endif
#endif
/* By default SDL uses the C calling convention */
#ifndef SDLCALL
#if defined(__WIN32__) && !defined(__GNUC__)
#define SDLCALL __cdecl
#else
#define SDLCALL
#endif
#endif /* SDLCALL */
/* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */
#ifdef __SYMBIAN32__
#undef DECLSPEC
#define DECLSPEC
#endif /* __SYMBIAN32__ */
/* Force structure packing at 4 byte alignment.
This is necessary if the header is included in code which has structure
packing set to an alternate value, say for loading structures from disk.
The packing is reset to the previous value in close_code.h
*/
#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
#ifdef _MSC_VER
#pragma warning(disable: 4103)
#endif
#ifdef __BORLANDC__
#pragma nopackwarning
#endif
#ifdef _M_X64
/* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */
#pragma pack(push,8)
#else
#pragma pack(push,4)
#endif
#endif /* Compiler needs structure packing set */
/* Set up compiler-specific options for inlining functions */
#ifndef SDL_INLINE_OKAY
#ifdef __GNUC__
#define SDL_INLINE_OKAY
#else
/* Add any special compiler-specific cases here */
#if defined(_MSC_VER) || defined(__BORLANDC__) || \
defined(__DMC__) || defined(__SC__) || \
defined(__WATCOMC__) || defined(__LCC__) || \
defined(__DECC)
#ifndef __inline__
#define __inline__ __inline
#endif
#define SDL_INLINE_OKAY
#else
#if !defined(__MRC__) && !defined(_SGI_SOURCE)
#ifndef __inline__
#define __inline__ inline
#endif
#define SDL_INLINE_OKAY
#endif /* Not a funky compiler */
#endif /* Visual C++ */
#endif /* GNU C */
#endif /* SDL_INLINE_OKAY */
/* If inlining isn't supported, remove "__inline__", turning static
inlined functions into static functions (resulting in code bloat
in all files which include the offending header files)
*/
#ifndef SDL_INLINE_OKAY
#define __inline__
#endif
#if defined(_MSC_VER)
#define SDL_FORCE_INLINE __forceinline
#elif defined(__GNUC__) || defined(__clang__)
#define SDL_FORCE_INLINE __attribute__((always_inline)) static inline
#else
#define SDL_FORCE_INLINE static __inline__
#endif
/* Apparently this is needed by several Windows compilers */
#if !defined(__MACH__)
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif /* NULL */
#endif /* ! Mac OS X - breaks precompiled headers */
|
/******************************************************************************
This source file is part of the tomviz project.
Copyright Kitware, Inc.
This source code is released under the New BSD License, (the "License").
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 tomvizModuleVolume_h
#define tomvizModuleVolume_h
#include "Module.h"
#include <vtkNew.h>
#include <vtkWeakPointer.h>
#include <QPointer>
class vtkSMProxy;
class vtkSMSourceProxy;
class vtkPVRenderView;
class vtkGPUVolumeRayCastMapper;
class vtkVolumeProperty;
class vtkVolume;
namespace tomviz {
class ModuleVolumeWidget;
class ModuleVolume : public Module
{
Q_OBJECT
public:
ModuleVolume(QObject* parent = nullptr);
virtual ~ModuleVolume();
QString label() const override { return "Volume"; }
QIcon icon() const override;
bool initialize(DataSource* dataSource, vtkSMViewProxy* view) override;
bool finalize() override;
bool setVisibility(bool val) override;
bool visibility() const override;
QJsonObject serialize() const override;
bool deserialize(const QJsonObject& json) override;
bool isColorMapNeeded() const override { return true; }
void addToPanel(QWidget* panel) override;
void updatePanel();
void dataSourceMoved(double newX, double newY, double newZ) override;
bool isProxyPartOfModule(vtkSMProxy* proxy) override;
bool supportsGradientOpacity() override { return true; }
QString exportDataTypeString() override { return "Volume"; }
vtkSmartPointer<vtkDataObject> getDataToExport() override;
protected:
void updateColorMap() override;
std::string getStringForProxy(vtkSMProxy* proxy) override;
vtkSMProxy* getProxyForString(const std::string& str) override;
private:
Q_DISABLE_COPY(ModuleVolume)
vtkWeakPointer<vtkPVRenderView> m_view;
vtkNew<vtkVolume> m_volume;
vtkNew<vtkGPUVolumeRayCastMapper> m_volumeMapper;
vtkNew<vtkVolumeProperty> m_volumeProperty;
QPointer<ModuleVolumeWidget> m_controllers;
private slots:
/**
* Actuator methods for m_volumeMapper. These slots should be connected to
* the appropriate UI signals.
*/
void setLighting(const bool val);
void setBlendingMode(const int mode);
void onInterpolationChanged(const int type);
void setJittering(const bool val);
void onAmbientChanged(const double value);
void onDiffuseChanged(const double value);
void onSpecularChanged(const double value);
void onSpecularPowerChanged(const double value);
void onTransferModeChanged(const int mode);
};
} // namespace tomviz
#endif
|
/*
* CamIO - The Cambridge Input/Output API
* Copyright (c) 2015, All rights reserved.
* See LICENSE.txt for full details.
*
* Created: Jun 6, 2015
* File name: transport_opts_vec.c
* Description:
* Vector description for transport options
*/
#include "transport_params_vec.h"
#include "../../deps/chaste/data_structs/vector/vector_typed_define_template.h"
define_ch_vector(CAMIO_TRANSPORT_PARAMS_VEC,camio_transport_param_t)
//Don't bother to define this yet.
define_ch_vector_compare(CAMIO_TRANSPORT_PARAMS_VEC,camio_transport_param_t)
{
return strcmp(lhs->param_name, rhs->param_name);
}
//These applications of the macro expand out the actual option adder functions
define_add_param(int64_t, CAMIO_TRANSPORT_PARAMS_TYPE_INT64)
define_add_param(uint64_t, CAMIO_TRANSPORT_PARAMS_TYPE_UINT64)
define_add_param(double, CAMIO_TRANSPORT_PARAMS_TYPE_DOUBLE)
//Strings are treated a little bit differently
declare_add_param_opt(ch_cstr,CAMIO_TRANSPORT_PARAMS_TYPE_LSTRING)
{
camio_transport_param_t opt = {0};
opt.opt_mode = CAMIO_TRANSPORT_PARAMS_MODE_OPTIONAL;
opt.param_name = param_name;
opt.param_struct_offset = param_struct_offset;
opt.type = CAMIO_TRANSPORT_PARAMS_TYPE_LSTRING;
len_string_t tmp = {
.str = {0},
.str_max = LSTRING_MAX,
.str_len = strlen(default_val),
};
strncpy(tmp.str,default_val, tmp.str_max);
opt.default_val.len_string_t_val = tmp;
opts->push_back(opts, opt);
}
define_add_param_req(ch_cstr,CAMIO_TRANSPORT_PARAMS_TYPE_LSTRING)
|
/*
* Copyright (c) 2011,2015 Apple Inc. All rights reserved.
*
* corecrypto Internal Use License Agreement
*
* IMPORTANT: This Apple corecrypto software is supplied to you by Apple Inc. ("Apple")
* in consideration of your agreement to the following terms, and your download or use
* of this Apple software constitutes acceptance of these terms. If you do not agree
* with these terms, please do not download or use this Apple software.
*
* 1. As used in this Agreement, the term "Apple Software" collectively means and
* includes all of the Apple corecrypto materials provided by Apple here, including
* but not limited to the Apple corecrypto software, frameworks, libraries, documentation
* and other Apple-created materials. In consideration of your agreement to abide by the
* following terms, conditioned upon your compliance with these terms and subject to
* these terms, Apple grants you, for a period of ninety (90) days from the date you
* download the Apple Software, a limited, non-exclusive, non-sublicensable license
* under Apple’s copyrights in the Apple Software to make a reasonable number of copies
* of, compile, and run the Apple Software internally within your organization only on
* devices and computers you own or control, for the sole purpose of verifying the
* security characteristics and correct functioning of the Apple Software; provided
* that you must retain this notice and the following text and disclaimers in all
* copies of the Apple Software that you make. You may not, directly or indirectly,
* redistribute the Apple Software or any portions thereof. The Apple Software is only
* licensed and intended for use as expressly stated above and may not be used for other
* purposes or in other contexts without Apple's prior written permission. Except as
* expressly stated in this notice, no other rights or licenses, express or implied, are
* granted by Apple herein.
*
* 2. The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO
* WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES
* OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING
* THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS,
* SYSTEMS, OR SERVICES. APPLE DOES NOT WARRANT THAT THE APPLE SOFTWARE WILL MEET YOUR
* REQUIREMENTS, THAT THE OPERATION OF THE APPLE SOFTWARE WILL BE UNINTERRUPTED OR
* ERROR-FREE, THAT DEFECTS IN THE APPLE SOFTWARE WILL BE CORRECTED, OR THAT THE APPLE
* SOFTWARE WILL BE COMPATIBLE WITH FUTURE APPLE PRODUCTS, SOFTWARE OR SERVICES. NO ORAL
* OR WRITTEN INFORMATION OR ADVICE GIVEN BY APPLE OR AN APPLE AUTHORIZED REPRESENTATIVE
* WILL CREATE A WARRANTY.
*
* 3. IN NO EVENT SHALL APPLE BE LIABLE FOR ANY DIRECT, SPECIAL, INDIRECT, INCIDENTAL
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING
* IN ANY WAY OUT OF THE USE, REPRODUCTION, COMPILATION OR OPERATION OF THE APPLE
* SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING
* NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* 4. This Agreement is effective until terminated. Your rights under this Agreement will
* terminate automatically without notice from Apple if you fail to comply with any term(s)
* of this Agreement. Upon termination, you agree to cease all use of the Apple Software
* and destroy all copies, full or partial, of the Apple Software. This Agreement will be
* governed and construed in accordance with the laws of the State of California, without
* regard to its choice of law rules.
*
* You may report security issues about Apple products to product-security@apple.com,
* as described here: https://www.apple.com/support/security/. Non-security bugs and
* enhancement requests can be made via https://bugreport.apple.com as described
* here: https://developer.apple.com/bug-reporting/
*
* EA1350
* 10/5/15
*/
#include <corecrypto/ccaes.h>
#include <corecrypto/ccmode_factory.h>
CCMODE_CFB_FACTORY(aes, cfb8, encrypt)
|
#pragma once
#include <vector>
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>
#include "balle.h"
class Menu
{
private:
sf::Sprite m_sprAP, m_sprTitre, m_sprJouer, m_sprRetour, m_sprCredit, m_sprQuitter,
m_spr1J, m_spr2J, m_spr3J, m_spr4J, m_sprSurvie, m_sprMulti;
sf::Font m_font;
sf::String m_txtNbJoueurs, m_txtCredit1, m_txtCredit2 ;
std::vector<Balle> m_balle;
std::vector <sf::Sprite> m_sprBalle;
int m_hauteur, m_largeur;
int m_sourisX, m_sourisY;
int m_nbJoueurs, m_nbVies;
bool m_survival;
sf::Clock m_clock;
int m_numMenu;
/* 0 : menu principal
1 : menu jouer
2 : menu credit
3 : menu type de jeu
*/
sf::Music m_musiqueMenu;
bool m_iaPresente;
public:
Menu(sf::RenderWindow &app);
bool evenement(sf::RenderWindow &app);
void preparerSprites(sf::RenderWindow &app);
void effacerEcran(sf::RenderWindow &app);
void dessinerSprites(sf::RenderWindow &app, int niveauFondu=255);
void afficherSprites(sf::RenderWindow &app);
bool sourisSurSprites(const sf::Sprite &spr);
void debuterPartie(sf::RenderWindow &app);
int getNbJoueurs();
int getNbVies();
bool getIA();
void bougerBalles();
bool getSurvival();
};
|
/********************************************************************************
** Form generated from reading UI file 'mainwindow.ui'
**
** Created: Tue Sep 21 18:32:00 2010
** by: Qt User Interface Compiler version 4.6.3
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef UI_MAINWINDOW_H
#define UI_MAINWINDOW_H
#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QHeaderView>
#include <QtGui/QLabel>
#include <QtGui/QMainWindow>
#include <QtGui/QMenu>
#include <QtGui/QMenuBar>
#include <QtGui/QPushButton>
#include <QtGui/QSlider>
#include <QtGui/QStatusBar>
#include <QtGui/QWidget>
QT_BEGIN_NAMESPACE
class Ui_MainWindow
{
public:
QAction *actionOpen_Image;
QAction *actionChoose_Color;
QAction *actionProcess;
QAction *actionQuit;
QWidget *centralWidget;
QPushButton *pushButton_openImage;
QPushButton *pushButton_color;
QPushButton *pushButton_process;
QLabel *label;
QSlider *verticalSlider_Threshold;
QLabel *label_2;
QMenuBar *menuBar;
QMenu *menuFile;
QStatusBar *statusBar;
void setupUi(QMainWindow *MainWindow)
{
if (MainWindow->objectName().isEmpty())
MainWindow->setObjectName(QString::fromUtf8("MainWindow"));
MainWindow->resize(600, 394);
actionOpen_Image = new QAction(MainWindow);
actionOpen_Image->setObjectName(QString::fromUtf8("actionOpen_Image"));
actionChoose_Color = new QAction(MainWindow);
actionChoose_Color->setObjectName(QString::fromUtf8("actionChoose_Color"));
actionProcess = new QAction(MainWindow);
actionProcess->setObjectName(QString::fromUtf8("actionProcess"));
actionQuit = new QAction(MainWindow);
actionQuit->setObjectName(QString::fromUtf8("actionQuit"));
centralWidget = new QWidget(MainWindow);
centralWidget->setObjectName(QString::fromUtf8("centralWidget"));
pushButton_openImage = new QPushButton(centralWidget);
pushButton_openImage->setObjectName(QString::fromUtf8("pushButton_openImage"));
pushButton_openImage->setGeometry(QRect(10, 10, 81, 23));
pushButton_color = new QPushButton(centralWidget);
pushButton_color->setObjectName(QString::fromUtf8("pushButton_color"));
pushButton_color->setGeometry(QRect(10, 40, 81, 23));
pushButton_process = new QPushButton(centralWidget);
pushButton_process->setObjectName(QString::fromUtf8("pushButton_process"));
pushButton_process->setGeometry(QRect(10, 320, 81, 23));
label = new QLabel(centralWidget);
label->setObjectName(QString::fromUtf8("label"));
label->setGeometry(QRect(100, 10, 491, 331));
label->setFrameShape(QFrame::Box);
verticalSlider_Threshold = new QSlider(centralWidget);
verticalSlider_Threshold->setObjectName(QString::fromUtf8("verticalSlider_Threshold"));
verticalSlider_Threshold->setGeometry(QRect(40, 80, 20, 151));
verticalSlider_Threshold->setMaximum(442);
verticalSlider_Threshold->setOrientation(Qt::Vertical);
label_2 = new QLabel(centralWidget);
label_2->setObjectName(QString::fromUtf8("label_2"));
label_2->setGeometry(QRect(10, 240, 81, 71));
label_2->setWordWrap(true);
MainWindow->setCentralWidget(centralWidget);
menuBar = new QMenuBar(MainWindow);
menuBar->setObjectName(QString::fromUtf8("menuBar"));
menuBar->setGeometry(QRect(0, 0, 600, 23));
menuFile = new QMenu(menuBar);
menuFile->setObjectName(QString::fromUtf8("menuFile"));
MainWindow->setMenuBar(menuBar);
statusBar = new QStatusBar(MainWindow);
statusBar->setObjectName(QString::fromUtf8("statusBar"));
MainWindow->setStatusBar(statusBar);
menuBar->addAction(menuFile->menuAction());
menuFile->addAction(actionOpen_Image);
menuFile->addAction(actionChoose_Color);
menuFile->addAction(actionProcess);
menuFile->addSeparator();
menuFile->addAction(actionQuit);
retranslateUi(MainWindow);
QObject::connect(actionQuit, SIGNAL(triggered()), MainWindow, SLOT(close()));
QMetaObject::connectSlotsByName(MainWindow);
} // setupUi
void retranslateUi(QMainWindow *MainWindow)
{
MainWindow->setWindowTitle(QApplication::translate("MainWindow", "Color Detector (CIE Lab)", 0, QApplication::UnicodeUTF8));
actionOpen_Image->setText(QApplication::translate("MainWindow", "Open Image", 0, QApplication::UnicodeUTF8));
actionChoose_Color->setText(QApplication::translate("MainWindow", "Choose Color", 0, QApplication::UnicodeUTF8));
actionProcess->setText(QApplication::translate("MainWindow", "Process", 0, QApplication::UnicodeUTF8));
actionQuit->setText(QApplication::translate("MainWindow", "Quit", 0, QApplication::UnicodeUTF8));
pushButton_openImage->setText(QApplication::translate("MainWindow", "Open Image", 0, QApplication::UnicodeUTF8));
pushButton_color->setText(QApplication::translate("MainWindow", "Select Color", 0, QApplication::UnicodeUTF8));
pushButton_process->setText(QApplication::translate("MainWindow", "Process", 0, QApplication::UnicodeUTF8));
label->setText(QApplication::translate("MainWindow", "Image", 0, QApplication::UnicodeUTF8));
label_2->setText(QApplication::translate("MainWindow", "Color Distance Threshold: 0", 0, QApplication::UnicodeUTF8));
menuFile->setTitle(QApplication::translate("MainWindow", "File", 0, QApplication::UnicodeUTF8));
} // retranslateUi
};
namespace Ui {
class MainWindow: public Ui_MainWindow {};
} // namespace Ui
QT_END_NAMESPACE
#endif // UI_MAINWINDOW_H
|
/*
* 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:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_FILESYSTEM_FILE_WRITER_H_
#define THIRD_PARTY_BLINK_RENDERER_MODULES_FILESYSTEM_FILE_WRITER_H_
#include "third_party/blink/renderer/bindings/core/v8/active_script_wrappable.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/execution_context/execution_context_lifecycle_observer.h"
#include "third_party/blink/renderer/core/probe/async_task_id.h"
#include "third_party/blink/renderer/modules/event_target_modules.h"
#include "third_party/blink/renderer/modules/filesystem/file_writer_base.h"
#include "third_party/blink/renderer/platform/heap/handle.h"
#include "third_party/blink/renderer/platform/heap/prefinalizer.h"
namespace blink {
class Blob;
class DOMException;
class ExceptionState;
class ExecutionContext;
enum class FileErrorCode;
class FileWriter final : public EventTargetWithInlineData,
public FileWriterBase,
public ActiveScriptWrappable<FileWriter>,
public ExecutionContextLifecycleObserver {
DEFINE_WRAPPERTYPEINFO();
USING_PRE_FINALIZER(FileWriter, Dispose);
public:
explicit FileWriter(ExecutionContext*);
~FileWriter() override;
enum ReadyState { kInit = 0, kWriting = 1, kDone = 2 };
void write(Blob*, ExceptionState&);
void seek(int64_t position, ExceptionState&);
void truncate(int64_t length, ExceptionState&);
void abort(ExceptionState&);
ReadyState getReadyState() const { return ready_state_; }
DOMException* error() const { return error_.Get(); }
// FileWriterBase
void DidWriteImpl(int64_t bytes, bool complete) override;
void DidTruncateImpl() override;
void DidFailImpl(base::File::Error error) override;
void DoTruncate(const KURL& path, int64_t offset) override;
void DoWrite(const KURL& path,
const String& blob_id,
int64_t offset) override;
void DoCancel() override;
// ExecutionContextLifecycleObserver
void ContextDestroyed() override;
// ScriptWrappable
bool HasPendingActivity() const final;
// EventTarget
const AtomicString& InterfaceName() const override;
ExecutionContext* GetExecutionContext() const override {
return ExecutionContextLifecycleObserver::GetExecutionContext();
}
DEFINE_ATTRIBUTE_EVENT_LISTENER(writestart, kWritestart)
DEFINE_ATTRIBUTE_EVENT_LISTENER(progress, kProgress)
DEFINE_ATTRIBUTE_EVENT_LISTENER(write, kWrite)
DEFINE_ATTRIBUTE_EVENT_LISTENER(abort, kAbort)
DEFINE_ATTRIBUTE_EVENT_LISTENER(error, kError)
DEFINE_ATTRIBUTE_EVENT_LISTENER(writeend, kWriteend)
void Trace(Visitor*) const override;
private:
enum Operation {
kOperationNone,
kOperationWrite,
kOperationTruncate,
kOperationAbort
};
void CompleteAbort();
void DoOperation(Operation);
void SignalCompletion(base::File::Error error_code);
void FireEvent(const AtomicString& type);
void SetError(FileErrorCode, ExceptionState&);
void Dispose();
Member<DOMException> error_;
ReadyState ready_state_;
Operation operation_in_progress_;
Operation queued_operation_;
uint64_t bytes_written_;
uint64_t bytes_to_write_;
uint64_t truncate_length_;
uint64_t num_aborts_;
uint8_t recursion_depth_;
base::TimeTicks last_progress_notification_time_;
Member<Blob> blob_being_written_;
int request_id_;
probe::AsyncTaskId async_task_id_;
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_FILESYSTEM_FILE_WRITER_H_
|
// Copyright (c) 2009,2010,2012 GeometryFactory Sarl (France)
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// 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.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Laurent RINEAU
#ifndef POLYHEDRON_DEMO_IO_PLUGIN_INTERFACE_H
#define POLYHEDRON_DEMO_IO_PLUGIN_INTERFACE_H
#include <QFileInfo>
#include <QStringList>
namespace CGAL{
namespace Three {
class Scene_item;
/*!
* \file Polyhedron_demo_io_plugin_interface.h
* This class provides a base for creating a new IO plugin.
*/
class Polyhedron_demo_io_plugin_interface
{
public:
//!Returns the name of the plugin
virtual QString name() const = 0;
virtual ~Polyhedron_demo_io_plugin_interface() {}
/*! The filters for the names of the files that can be used
* by the plugin.
* Example : to filter OFF files : return "OFF files (*.off)"
*/
virtual QString nameFilters() const = 0;
virtual QString saveNameFilters() const {return nameFilters();}
virtual QString loadNameFilters() const {return nameFilters();}
//! Specifies if the io_plugin is able to load an item or not.
virtual bool canLoad() const = 0;
//! Loads an item from a file.
virtual Scene_item* load(QFileInfo fileinfo) = 0;
//!Specifies if the io_plugin can save the item or not.
virtual bool canSave(const Scene_item*) = 0;
//!Saves the item in the file corresponding to the path
//!contained in fileinfo. Returns false if error.
virtual bool save(const Scene_item*, QFileInfo fileinfo) = 0;
};
}
}
Q_DECLARE_INTERFACE(CGAL::Three::Polyhedron_demo_io_plugin_interface,
"com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.0")
#endif // POLYHEDRON_DEMO_IO_PLUGIN_INTERFACE_H
|
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_INDEXEDDB_IDB_OBSERVER_CHANGES_H_
#define THIRD_PARTY_BLINK_RENDERER_MODULES_INDEXEDDB_IDB_OBSERVER_CHANGES_H_
#include "third_party/blink/renderer/bindings/core/v8/script_value.h"
#include "third_party/blink/renderer/modules/indexeddb/idb_database.h"
#include "third_party/blink/renderer/modules/indexeddb/idb_observation.h"
#include "third_party/blink/renderer/modules/indexeddb/idb_transaction.h"
#include "third_party/blink/renderer/platform/bindings/script_wrappable.h"
#include "third_party/blink/renderer/platform/heap/handle.h"
namespace blink {
class ScriptState;
class IDBObserverChanges final : public ScriptWrappable {
DEFINE_WRAPPERTYPEINFO();
public:
IDBObserverChanges(IDBDatabase*,
IDBTransaction*,
const Vector<Persistent<IDBObservation>>& observations,
const Vector<int32_t>& observation_indices);
void Trace(Visitor*) override;
// Implement IDL
IDBTransaction* transaction() const { return transaction_.Get(); }
IDBDatabase* database() const { return database_.Get(); }
ScriptValue records(ScriptState*);
private:
void ExtractChanges(const Vector<Persistent<IDBObservation>>& observations,
const Vector<int32_t>& observation_indices);
Member<IDBDatabase> database_;
Member<IDBTransaction> transaction_;
// Map object_store_id to IDBObservation list.
HeapHashMap<int64_t, HeapVector<Member<IDBObservation>>> records_;
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_INDEXEDDB_IDB_OBSERVER_CHANGES_H_
|
/*
BLIS
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2014, The University of Texas
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of The University of Texas nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
void bli_dotxf_ref( obj_t* alpha,
obj_t* a,
obj_t* x,
obj_t* beta,
obj_t* y );
*/
#undef GENTPROT3U12
#define GENTPROT3U12( ctype_a, ctype_x, ctype_y, ctype_ax, cha, chx, chy, chax, varname ) \
\
void PASTEMAC3(cha,chx,chy,varname) \
( \
conj_t conjat, \
conj_t conjx, \
dim_t m, \
dim_t b_n, \
ctype_ax* restrict alpha, \
ctype_a* restrict a, inc_t inca, inc_t lda, \
ctype_x* restrict x, inc_t incx, \
ctype_y* restrict beta, \
ctype_y* restrict y, inc_t incy \
);
INSERT_GENTPROT3U12_BASIC( dotxf_ref )
#ifdef BLIS_ENABLE_MIXED_DOMAIN_SUPPORT
INSERT_GENTPROT3U12_MIX_D( dotxf_ref )
#endif
#ifdef BLIS_ENABLE_MIXED_PRECISION_SUPPORT
INSERT_GENTPROT3U12_MIX_P( dotxf_ref )
#endif
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE126_Buffer_Overread__malloc_char_memmove_67a.c
Label Definition File: CWE126_Buffer_Overread__malloc.label.xml
Template File: sources-sink-67a.tmpl.c
*/
/*
* @description
* CWE: 126 Buffer Over-read
* BadSource: Use a small buffer
* GoodSource: Use a large buffer
* Sinks: memmove
* BadSink : Copy data to string using memmove
* Flow Variant: 67 Data flow: data passed in a struct from one function to another in different source files
*
* */
#include "std_testcase.h"
#include <wchar.h>
typedef struct _CWE126_Buffer_Overread__malloc_char_memmove_67_structType
{
char * structFirst;
} CWE126_Buffer_Overread__malloc_char_memmove_67_structType;
#ifndef OMITBAD
/* bad function declaration */
void CWE126_Buffer_Overread__malloc_char_memmove_67b_badSink(CWE126_Buffer_Overread__malloc_char_memmove_67_structType myStruct);
void CWE126_Buffer_Overread__malloc_char_memmove_67_bad()
{
char * data;
CWE126_Buffer_Overread__malloc_char_memmove_67_structType myStruct;
data = NULL;
/* FLAW: Use a small buffer */
data = (char *)malloc(50*sizeof(char));
if (data == NULL) {exit(-1);}
memset(data, 'A', 50-1); /* fill with 'A's */
data[50-1] = '\0'; /* null terminate */
myStruct.structFirst = data;
CWE126_Buffer_Overread__malloc_char_memmove_67b_badSink(myStruct);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void CWE126_Buffer_Overread__malloc_char_memmove_67b_goodG2BSink(CWE126_Buffer_Overread__malloc_char_memmove_67_structType myStruct);
static void goodG2B()
{
char * data;
CWE126_Buffer_Overread__malloc_char_memmove_67_structType myStruct;
data = NULL;
/* FIX: Use a large buffer */
data = (char *)malloc(100*sizeof(char));
if (data == NULL) {exit(-1);}
memset(data, 'A', 100-1); /* fill with 'A's */
data[100-1] = '\0'; /* null terminate */
myStruct.structFirst = data;
CWE126_Buffer_Overread__malloc_char_memmove_67b_goodG2BSink(myStruct);
}
void CWE126_Buffer_Overread__malloc_char_memmove_67_good()
{
goodG2B();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
* its own for testing or for building a binary to use in testing binary
* analysis tools. It is not used when compiling all the testcases as one
* application, which is how source code analysis tools are tested.
*/
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE126_Buffer_Overread__malloc_char_memmove_67_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE126_Buffer_Overread__malloc_char_memmove_67_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
#ifndef _IPLUGAPP_APP_MAIN_H_
#define _IPLUGAPP_APP_MAIN_H_
#include "IPlugOSDetect.h"
/*
Standalone osx/win app wrapper for iPlug, using SWELL
Oli Larkin 2012
Notes:
App settings are stored in a .ini file. The location is as follows:
Windows7: C:\Users\USERNAME\AppData\Local\ATKChorus\settings.ini
Windows XP/Vista: C:\Documents and Settings\USERNAME\Local Settings\Application Data\ATKChorus\settings.ini
OSX: /Users/USERNAME/Library/Application\ Support/ATKChorus/settings.ini
*/
#ifdef OS_WIN
#include <windows.h>
#include <commctrl.h>
#define DEFAULT_INPUT_DEV "Default Device"
#define DEFAULT_OUTPUT_DEV "Default Device"
#define DAC_DS 0
#define DAC_ASIO 1
#elif defined OS_OSX
#include "swell.h"
#define SLEEP( milliseconds ) usleep( (unsigned long) (milliseconds * 1000.0) )
#define DEFAULT_INPUT_DEV "Built-in Input"
#define DEFAULT_OUTPUT_DEV "Built-in Output"
#define DAC_COREAUDIO 0
// #define DAC_JACK 1
#endif
#include "wdltypes.h"
#include "RtAudio.h"
#include "RtMidi.h"
#include <string>
#include <vector>
#include "../ATKChorus.h" // change this to match your iplug plugin .h file
typedef unsigned short UInt16;
struct AppState
{
// on osx core audio 0 or jack 1
// on windows DS 0 or ASIO 1
UInt16 mAudioDriverType;
// strings
char mAudioInDev[100];
char mAudioOutDev[100];
char mAudioSR[100];
char mAudioIOVS[100];
char mAudioSigVS[100];
UInt16 mAudioInChanL;
UInt16 mAudioInChanR;
UInt16 mAudioOutChanL;
UInt16 mAudioOutChanR;
UInt16 mAudioInIsMono;
// strings containing the names of the midi devices
char mMidiInDev[100];
char mMidiOutDev[100];
UInt16 mMidiInChan;
UInt16 mMidiOutChan;
AppState():
mAudioDriverType(0), // DS / CoreAudio by default
mAudioInChanL(1),
mAudioInChanR(2),
mAudioOutChanL(1),
mAudioOutChanR(2),
mMidiInChan(0),
mMidiOutChan(0)
{
strcpy(mAudioInDev, DEFAULT_INPUT_DEV);
strcpy(mAudioOutDev, DEFAULT_OUTPUT_DEV);
strcpy(mAudioSR, "44100");
strcpy(mAudioIOVS, "512");
strcpy(mAudioSigVS, "32");
strcpy(mMidiInDev, "off");
strcpy(mMidiOutDev, "off");
}
};
extern WDL_DLGRET MainDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
extern WDL_DLGRET PreferencesDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
extern HINSTANCE gHINST;
extern HWND gHWND;
extern UINT gScrollMessage;
extern IPlug* gPluginInstance; // The iplug plugin instance
extern std::string GetAudioDeviceName(int idx);
extern int GetAudioDeviceID(char* deviceNameToTest);
extern void ProbeAudioIO();
extern bool InitialiseAudio(unsigned int inId,
unsigned int outId,
unsigned int sr,
unsigned int iovs,
unsigned int chnls,
unsigned int inChanL,
unsigned int outChanL
);
extern bool AudioSettingsInStateAreEqual(AppState* os, AppState* ns);
extern bool MIDISettingsInStateAreEqual(AppState* os, AppState* ns);
extern bool TryToChangeAudioDriverType();
extern bool TryToChangeAudio();
extern bool ChooseMidiInput(const char* pPortName);
extern bool ChooseMidiOutput(const char* pPortName);
extern bool AttachGUI();
extern RtAudio* gDAC;
extern RtMidiIn *gMidiIn;
extern RtMidiOut *gMidiOut;
extern AppState *gState;
extern AppState *gTempState; // The state is copied here when the pref dialog is opened, and restored if cancel is pressed
extern AppState *gActiveState; // When the audio driver is started the current state is copied here so that if OK is pressed after APPLY nothing is changed
extern unsigned int gSigVS;
extern unsigned int gBufIndex; // index for signal vector, loops from 0 to gSigVS
extern char *gINIPath; // path of ini file
extern void UpdateINI();
extern std::vector<unsigned int> gAudioInputDevs;
extern std::vector<unsigned int> gAudioOutputDevs;
extern std::vector<std::string> gMIDIInputDevNames;
extern std::vector<std::string> gMIDIOutputDevNames;
#endif //_IPLUGAPP_APP_MAIN_H_
|
#ifndef QUAT_H
#define QUAT_H
#include <iostream>
#include <cassert>
#include <cmath>
#include "cvec.h"
#include "matrix4.h"
// Forward declarations used in the definition of Quat;
class Quat;
double dot(const Quat& q, const Quat& p);
double norm2(const Quat& q);
Quat inv(const Quat& q);
Quat normalize(const Quat& q);
Matrix4 quatToMatrix(const Quat& q);
class Quat {
Cvec4 q_; // layout is: q_[0]==w, q_[1]==x, q_[2]==y, q_[3]==z
public:
double operator [] (const int i) const {
return q_[i];
}
double& operator [] (const int i) {
return q_[i];
}
double operator () (const int i) const {
return q_[i];
}
double& operator () (const int i) {
return q_[i];
}
Quat() : q_(1,0,0,0) {}
Quat(const double w, const Cvec3& v) : q_(w, v[0], v[1], v[2]) {}
Quat(const double w, const double x, const double y, const double z) : q_(w, x,y,z) {}
Quat& operator += (const Quat& a) {
q_ += a.q_;
return *this;
}
Quat& operator -= (const Quat& a) {
q_ -= a.q_;
return *this;
}
Quat& operator *= (const double a) {
q_ *= a;
return *this;
}
Quat& operator /= (const double a) {
q_ /= a;
return *this;
}
Quat operator + (const Quat& a) const {
return Quat(*this) += a;
}
Quat operator - (const Quat& a) const {
return Quat(*this) -= a;
}
Quat operator * (const double a) const {
return Quat(*this) *= a;
}
Quat operator / (const double a) const {
return Quat(*this) /= a;
}
Quat operator * (const Quat& a) const {
const Cvec3 u(q_[1], q_[2], q_[3]), v(a.q_[1], a.q_[2], a.q_[3]);
return Quat(q_[0]*a.q_[0] - dot(u, v), (v*q_[0] + u*a.q_[0]) + cross(u, v));
}
Cvec4 operator * (const Cvec4& a) const {
const Quat r = *this * (Quat(0, a[0], a[1], a[2]) * inv(*this));
return Cvec4(r[1], r[2], r[3], a[3]);
}
static Quat makeXRotation(const double ang) {
Quat r;
const double h = 0.5 * ang * CS175_PI/180;
r.q_[1] = std::sin(h);
r.q_[0] = std::cos(h);
return r;
}
static Quat makeYRotation(const double ang) {
Quat r;
const double h = 0.5 * ang * CS175_PI/180;
r.q_[2] = std::sin(h);
r.q_[0] = std::cos(h);
return r;
}
static Quat makeZRotation(const double ang) {
Quat r;
const double h = 0.5 * ang * CS175_PI/180;
r.q_[3] = std::sin(h);
r.q_[0] = std::cos(h);
return r;
}
};
inline double dot(const Quat& q, const Quat& p) {
double s = 0.0;
for (int i = 0; i < 4; ++i) {
s += q(i) * p(i);
}
return s;
}
inline double norm2(const Quat& q) {
return dot(q, q);
}
inline Quat inv(const Quat& q) {
const double n = norm2(q);
assert(n > CS175_EPS2);
return Quat(q(0), -q(1), -q(2), -q(3)) * (1.0/n);
}
inline Quat normalize(const Quat& q) {
return q / std::sqrt(norm2(q));
}
inline Matrix4 quatToMatrix(const Quat& q) {
Matrix4 r;
const double n = norm2(q);
if (n < CS175_EPS2)
return Matrix4(0);
const double two_over_n = 2/n;
r(0, 0) -= (q(2)*q(2) + q(3)*q(3)) * two_over_n;
r(0, 1) += (q(1)*q(2) - q(0)*q(3)) * two_over_n;
r(0, 2) += (q(1)*q(3) + q(2)*q(0)) * two_over_n;
r(1, 0) += (q(1)*q(2) + q(0)*q(3)) * two_over_n;
r(1, 1) -= (q(1)*q(1) + q(3)*q(3)) * two_over_n;
r(1, 2) += (q(2)*q(3) - q(1)*q(0)) * two_over_n;
r(2, 0) += (q(1)*q(3) - q(2)*q(0)) * two_over_n;
r(2, 1) += (q(2)*q(3) + q(1)*q(0)) * two_over_n;
r(2, 2) -= (q(1)*q(1) + q(2)*q(2)) * two_over_n;
assert(isAffine(r));
return r;
}
#endif |
#ifndef __COMMAND_H__
#define __COMMAND_H__
#include <stdint.h>
#include <stdbool.h>
bool command_sram_enable();
bool command_sram_disable();
uint8_t command_read_one();
bool command_write_one(uint8_t byte);
bool command_read_256(uint8_t *buff);
bool command_write_256(uint8_t *buff);
bool command_flash_one(uint8_t byte);
bool command_flash_256(uint8_t *buff);
bool command_set_addr(uint16_t addr);
bool command_set_addr_low(uint8_t addr);
bool command_set_addr_high(uint8_t addr);
bool command_set_bank(uint8_t bank);
bool command_check_valid();
bool command_erase_chip();
bool command_set_lock_led(bool on);
bool command_identify();
bool command_echo();
#endif
|
# include <stdio.h>
# include <string.h>
# include "c_iraf.h"
# include "hstio.h"
# include "stis.h"
# include "hstcalerr.h"
# include "stisdef.h"
/* This routine writes history records for a reference image, including
the name of the file and the pedigree and descrip values.
*/
int ImgHistory (RefImage *ref, Hdr *phdr) {
/* arguments:
RefImage *ref i: info about reference image
Hdr *phdr io: header to receive history records
*/
char history[STIS_LINE];
strcpy (history, " reference image ");
strcat (history, ref->name);
addHistoryKw (phdr, history);
if (hstio_err())
return (HEADER_PROBLEM);
if (ref->pedigree[0] != '\0') {
strcpy (history, " ");
strcat (history, ref->pedigree);
addHistoryKw (phdr, history);
if (hstio_err())
return (HEADER_PROBLEM);
}
if (ref->descrip[0] != '\0') {
strcpy (history, " ");
strcat (history, ref->descrip);
addHistoryKw (phdr, history);
if (hstio_err())
return (HEADER_PROBLEM);
}
return (0);
}
|
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINKS_OBSERVER_H_
#define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINKS_OBSERVER_H_
#include <vector>
#include "base/macros.h"
#include "chrome/common/media_router/media_sink.h"
#include "chrome/common/media_router/media_source.h"
#include "url/origin.h"
namespace media_router {
class MediaRouter;
// Base class for observing when the collection of sinks compatible with
// a MediaSource has been updated.
// A MediaSinksObserver implementation can be registered to MediaRouter to
// receive results. It can then interpret / process the results accordingly.
// More documentation can be found at
// docs.google.com/document/d/1RDXdzi2y7lRuL08HAe-qlSJG2DMz2iH3gBzMs0IRR78
class MediaSinksObserver {
public:
// Constructs an observer from |origin| that will observe for sinks compatible
// with |source|.
MediaSinksObserver(MediaRouter* router,
const MediaSource& source,
const url::Origin& origin);
// Constructs an observer for all sinks known to |router|.
// NOTE: Not all Media Route Providers support sink queries with an empty
// source, so the returned sink list may be incomplete.
// TODO(crbug.com/929937): Fix this.
explicit MediaSinksObserver(MediaRouter* router);
virtual ~MediaSinksObserver();
// Registers with MediaRouter to start observing. Must be called before the
// observer will start receiving updates. Returns |true| if the observer is
// initialized. This method is no-op if the observer is already initialized.
bool Init();
// This function is invoked when the list of sinks compatible with |source_|
// has been updated, unless |source_| is nullopt, in which case it is invoked
// with all sinks. The result also contains the list of valid origins.
// If |origins| is empty or contains |origin_|, then |OnSinksReceived(sinks)|
// will be invoked with |sinks|. Otherwise, it will be invoked with an empty
// list.
// Marked virtual for tests.
virtual void OnSinksUpdated(const std::vector<MediaSink>& sinks,
const std::vector<url::Origin>& origins);
const base::Optional<const MediaSource>& source() const { return source_; }
protected:
// This function is invoked from |OnSinksUpdated(sinks, origins)|.
// Implementations may not perform operations that modify the Media Router's
// observer list. In particular, invoking this observer's destructor within
// OnSinksReceived will result in undefined behavior.
virtual void OnSinksReceived(const std::vector<MediaSink>& sinks) = 0;
private:
const base::Optional<const MediaSource> source_;
const url::Origin origin_;
MediaRouter* const router_;
bool initialized_;
#if DCHECK_IS_ON()
bool in_on_sinks_updated_ = false;
#endif
DISALLOW_COPY_AND_ASSIGN(MediaSinksObserver);
};
} // namespace media_router
#endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SINKS_OBSERVER_H_
|
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MOJO_PUBLIC_CPP_BINDINGS_TESTS_RECT_CHROMIUM_H_
#define MOJO_PUBLIC_CPP_BINDINGS_TESTS_RECT_CHROMIUM_H_
#include <functional>
#include "base/logging.h"
namespace mojo {
namespace test {
// An implementation of a hypothetical Rect type specifically for consumers in
// in Chromium.
class RectChromium {
public:
RectChromium() {}
RectChromium(const RectChromium& other)
: x_(other.x_),
y_(other.y_),
width_(other.width_),
height_(other.height_) {}
RectChromium(int x, int y, int width, int height) :
x_(x), y_(y), width_(width), height_(height) {
DCHECK_GE(width_, 0);
DCHECK_GE(height_, 0);
}
~RectChromium() {}
RectChromium& operator=(const RectChromium& other) {
x_ = other.x_;
y_ = other.y_;
width_ = other.width_;
height_ = other.height_;
return *this;
}
int x() const { return x_; }
void set_x(int x) { x_ = x; }
int y() const { return y_; }
void set_y(int y) { y_ = y; }
int width() const { return width_; }
void set_width(int width) {
DCHECK_GE(width, 0);
width_ = width;
}
int height() const { return height_; }
void set_height(int height) {
DCHECK_GE(height, 0);
height_ = height;
}
int GetArea() const { return width_ * height_; }
auto TieForCmp() const { return std::tie(x_, y_, width_, height_); }
bool operator==(const RectChromium& other) const {
return TieForCmp() == other.TieForCmp();
}
bool operator!=(const RectChromium& other) const { return !(*this == other); }
bool operator<(const RectChromium& other) const {
return TieForCmp() < other.TieForCmp();
}
private:
int x_ = 0;
int y_ = 0;
int width_ = 0;
int height_ = 0;
};
} // namespace test
} // namespace mojo
namespace std {
template <>
struct hash<mojo::test::RectChromium> {
size_t operator()(const mojo::test::RectChromium& value) {
// Terrible hash function:
return (std::hash<int>()(value.x()) ^ std::hash<int>()(value.y()) ^
std::hash<int>()(value.width()) ^ std::hash<int>()(value.height()));
}
};
} // namespace std
#endif // MOJO_PUBLIC_CPP_BINDINGS_TESTS_RECT_CHROMIUM_H_
|
//
// ACMessageModel.h
// AllychatSDK
//
// Created by Andrew Kopanev on 12/8/15.
// Copyright © 2015 Magneta. All rights reserved.
//
#import "ACBaseModel.h"
#import "ACUserModel.h"
typedef NS_ENUM(NSUInteger, ACMessageStatus) {
ACMessageStatusSending,
ACMessageStatusSent,
ACMessageStatusFailed,
};
/*
"last_message": {
"created_at_millis": 1449264664171,
"client_id": null,
"read": true,
"file": null,
"is_hidden": false,
"event": null,
"room": "56620618d48f54223cd0760b",
"sender": {
"alias": null,
"avatar_url": "https://allychatcdn.blob.core.windows.net/alfaallychatru-dev/040ba2f2-76e1-4db5-a7b7-6e359c33ca04.jpg",
"id": "55af76764d02f45f4450e5d5",
"name": "\u041b\u0438\u043b\u0438\u044f"
},
"created_at": 1449264664.171076,
"message": "\u041f\u0440\u0438\u0432\u0435\u0442! \u0417\u0434\u0435\u0441\u044c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u0434\u0430\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441 \u0438 \u0431\u044b\u0441\u0442\u0440\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u043d\u0435\u0433\u043e.",
"id": "56620618d48f54223cd0760d",
"issue": "56620618d48f54223cd0760c"
},
*/
@interface ACMessageModel : ACBaseModel <NSCoding>
@property (nonatomic, readonly) NSString *messageId;
@property (nonatomic, readonly) NSString *roomId;
@property (nonatomic, readonly) NSDate *createdAt;
@property (nonatomic, readonly) ACUserModel *senderModel;
@property (nonatomic, assign, readonly) BOOL isRead;
@property (nonatomic, assign, readonly) BOOL isMine;
@property (nonatomic, readonly) ACMessageStatus status;
@end
|
/* get chars from keyboard and put them to rs232 */
#include <sys/types.h>
#include <stdio.h>
#include <fcntl.h>
#include <signal.h>
#include "const.h"
#define EOT '\004' /* ^D */
char err_buf[BUFSIZ];
char **envptr;
#ifdef __STDC__
void cleanup(int foo)
#else
int cleanup()
#endif
{
fprintf(stderr, "writer stopped\n");
fflush(stderr);
exit(0);
}
/* passed the escape char, reader pid as args */
main(argc, argv, envp)
int argc;
char **argv;
char **envp;
{
char ch;
char esc = *argv[1]; /* no errchk */
int r_pid = atoi(argv[2]);
char was_newline = TRUE;
envptr = envp;
signal(SIGINT, SIG_IGN);
signal(SIGQUIT, SIG_IGN);
signal(SIGTERM, cleanup);
setbuf(stderr, err_buf);
fprintf(stderr, "writer started\n");
fflush(stderr);
while (TRUE) {
read(0, &ch, 1);
ch &= (char)0177;
if (was_newline) {
if (ch == esc) {
read(0, &ch, 1);
ch &= (char)0177;
switch (ch) {
case EOT:
case '.':
cleanup(1); /* go home! */
case '!':
/* tell read_tty to cool off */
kill(r_pid, SIGALRM);
do_shell();
/* wake him up again */
kill(r_pid, SIGALRM);
break;
default:
if(ch != esc)
{
fprintf(stderr, "invalid command--use\
\"~~\" to start a line with \"~\"\n");
fflush(stderr);
}
}
}
}
if (ch == '\r')
was_newline = TRUE;
else
was_newline = FALSE;
write(1, &ch, 1);
}
}
|
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_COMPONENT_UPDATER_TIMER_UPDATE_SCHEDULER_H_
#define COMPONENTS_COMPONENT_UPDATER_TIMER_UPDATE_SCHEDULER_H_
#include "base/callback.h"
#include "base/macros.h"
#include "components/component_updater/timer.h"
#include "components/component_updater/update_scheduler.h"
namespace component_updater {
// Scheduler that uses base::Timer to schedule updates.
class TimerUpdateScheduler : public UpdateScheduler {
public:
TimerUpdateScheduler();
~TimerUpdateScheduler() override;
// UpdateScheduler:
void Schedule(const base::TimeDelta& initial_delay,
const base::TimeDelta& delay,
const UserTask& user_task,
const OnStopTaskCallback& on_stop) override;
void Stop() override;
private:
Timer timer_;
base::RepeatingClosure user_task_;
DISALLOW_COPY_AND_ASSIGN(TimerUpdateScheduler);
};
} // namespace component_updater
#endif // COMPONENTS_COMPONENT_UPDATER_TIMER_UPDATE_SCHEDULER_H_
|
#include <iostream>
#include <fstream>
#include <vector>
#include <CGAL/boost/graph/helpers.h>
#include <CGAL/boost/graph/graph_traits_Surface_mesh.h>
#include <CGAL/Side_of_triangle_mesh.h>
#include <CGAL/Timer.h>
#include <boost/foreach.hpp>
// this can produce false negatives
// mesh should be pure triangle
template<typename PolygonMesh, typename Point>
void generate_near_boundary(const PolygonMesh& mesh,
std::vector<Point>& points,
std::vector<bool>& on_boundary)
{
assert(CGAL::is_triangle_mesh(mesh));
typedef typename CGAL::Kernel_traits<Point>::type K;
typedef typename boost::graph_traits<PolygonMesh>::face_descriptor face_descriptor;
typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
typedef typename boost::graph_traits<PolygonMesh>::edge_descriptor edge_descriptor;
typedef typename boost::graph_traits<PolygonMesh>::halfedge_descriptor halfedge_descriptor;
typedef typename boost::graph_traits<PolygonMesh>::face_descriptor face_descriptor;
typedef typename boost::property_map<PolygonMesh, boost::vertex_point_t>::const_type Ppmap;
std::size_t exp_size = num_vertices(mesh) + num_faces(mesh) + num_edges(mesh);
points.reserve(exp_size);
on_boundary.reserve(exp_size);
Ppmap ppmap = get(boost::vertex_point, mesh);
// put vertices
vertex_descriptor vd;
BOOST_FOREACH(vertex_descriptor vb, vertices(mesh)) {
points.push_back(ppmap[vb]);
on_boundary.push_back(true);
}
// sample middle of edges
BOOST_FOREACH(edge_descriptor eb, edges(mesh)) {
halfedge_descriptor hd = halfedge(eb, mesh);
const Point& p0 = ppmap[target(hd, mesh)];
const Point& p1 = ppmap[target(opposite(hd, mesh), mesh)];
const Point& m = CGAL::ORIGIN + (((p0 + (p1 - CGAL::ORIGIN)) - CGAL::ORIGIN) / 2.0);
bool has_on = false;
has_on |= CGAL::Triangle_3<K>(ppmap[target(hd, mesh)],
ppmap[target(next(hd, mesh), mesh)],
ppmap[target(prev(hd, mesh), mesh)]).has_on(m);
has_on |= CGAL::Triangle_3<K>(ppmap[target(opposite(hd, mesh), mesh)],
ppmap[target(next(opposite(hd, mesh), mesh), mesh)],
ppmap[target(prev(opposite(hd, mesh), mesh), mesh)]).has_on(m);
points.push_back(m);
on_boundary.push_back(has_on);
}
// sample middle of facets
BOOST_FOREACH(face_descriptor fb, faces(mesh)) {
const Point& p0 = ppmap[target(halfedge(fb, mesh), mesh)];
const Point& p1 = ppmap[target(next(halfedge(fb, mesh), mesh), mesh)];
const Point& p2 = ppmap[target(prev(halfedge(fb, mesh), mesh), mesh)];
const Point& m = CGAL::centroid(p0, p1, p2);
bool has_on = CGAL::Triangle_3<K>(p0, p1, p2).has_on(m);
points.push_back(m);
on_boundary.push_back(has_on);
}
}
template<typename PolygonMesh>
CGAL::Bbox_3 bbox(const PolygonMesh& mesh);
template<class Point, class OutputIterator, typename PolygonMesh>
void random_points(const PolygonMesh& mesh,
int n,
OutputIterator out)
{
CGAL::Bbox_3 bb = bbox(mesh);
CGAL::Random rg(1340818006); // seed some value for make it easy to debug
double grid_dx = bb.xmax() - bb.xmin();
double grid_dy = bb.ymax() - bb.ymin();
double grid_dz = bb.zmax() - bb.zmin();
for (int i = 0; i < n; i++){
*out++ = Point(bb.xmin() + rg.get_double()* grid_dx,
bb.ymin() + rg.get_double()* grid_dy,
bb.zmin() + rg.get_double()* grid_dz);
}
}
template<typename PolygonMesh, typename Point>
void test(
const PolygonMesh& mesh,
const std::vector<Point>& points,
const std::vector<bool>& on_boundary = std::vector<bool>())
{
typedef typename CGAL::Kernel_traits<Point>::type K;
std::cerr << "|V| = " << num_vertices(mesh) << std::endl;
CGAL::Timer timer;
timer.start();
CGAL::Side_of_triangle_mesh<PolygonMesh, K> inside(mesh);
std::cerr << " Preprocessing took " << timer.time() << " sec." << std::endl;
timer.reset();
int nb_inside = 0;
int nb_boundary = 0;
for (std::size_t i = 0; i < points.size(); ++i) {
CGAL::Bounded_side res = inside(points[i]);
if (!on_boundary.empty()) {
assert(on_boundary[i] == (res == CGAL::ON_BOUNDARY));
}
if (res == CGAL::ON_BOUNDED_SIDE) { ++nb_inside; }
if (res == CGAL::ON_BOUNDARY) { ++nb_boundary; }
}
timer.stop();
std::cerr << "Total query size: " << points.size() << std::endl;
std::cerr << " " << nb_inside << " points inside " << std::endl;
std::cerr << " " << nb_boundary << " points boundary " << std::endl;
std::cerr << " " << points.size() - nb_inside - nb_boundary << " points outside " << std::endl;
std::cerr << " Queries took " << timer.time() << " sec." << std::endl;
}
template<typename PolygonMesh>
CGAL::Bbox_3 bbox(const PolygonMesh& mesh)
{
typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
typename boost::property_map<PolygonMesh, boost::vertex_point_t>::const_type
ppmap = get(boost::vertex_point, mesh);
CGAL::Bbox_3 bbox(ppmap[*vertices(mesh).first].bbox());
BOOST_FOREACH(vertex_descriptor vb, vertices(mesh))
{
bbox = bbox + ppmap[vb].bbox();
}
return bbox;
}
template<typename Point>
void to_file(const char* file_name, const std::vector<Point>& points)
{
std::ofstream out(file_name);
std::copy(points.begin(), points.end(), std::ostream_iterator<Point>(out, "\n"));
out.close();
}
template<typename Point>
void from_file(const char* file_name, std::vector<Point>& points)
{
std::ifstream in(file_name);
std::copy(std::istream_iterator<Point>(in),
std::istream_iterator<Point>(),
std::back_inserter(points));
in.close();
}
|
/*******************************************************
* Copyright (c) 2014, ArrayFire
* All rights reserved.
*
* This file is distributed under 3-clause BSD license.
* The complete license agreement can be obtained at:
* http://arrayfire.com/licenses/BSD-3-Clause
********************************************************/
#ifndef IMAGEIO_HELPER_H
#define IMAGEIO_HELPER_H
#include <FreeImage.h>
#include <af/array.h>
#include <af/index.h>
#include <af/dim4.hpp>
#include <common/err_common.hpp>
class FI_Manager
{
public:
FI_Manager()
{
#ifdef FREEIMAGE_LIB
FreeImage_Initialise();
#endif
}
~FI_Manager()
{
#ifdef FREEIMAGE_LIB
FreeImage_DeInitialise();
#endif
}
};
static void FI_Init()
{
static FI_Manager manager = FI_Manager();
}
class FI_BitmapResource
{
public:
explicit FI_BitmapResource(FIBITMAP * p) :
pBitmap(p)
{
}
~FI_BitmapResource()
{
FreeImage_Unload(pBitmap);
}
private:
FIBITMAP * pBitmap;
};
typedef enum {
AFFI_GRAY = 1,
AFFI_RGB = 3,
AFFI_RGBA = 4
} FI_CHANNELS;
// Error handler for FreeImage library.
// In case this handler is invoked, it throws an af exception.
static void FreeImageErrorHandler(FREE_IMAGE_FORMAT oFif, const char* zMessage)
{
printf("FreeImage Error Handler: %s\n", zMessage);
}
// Split a MxNx3 image into 3 separate channel matrices.
// Produce 3 channels if needed
static af_err channel_split(const af_array rgb, const af::dim4 &dims,
af_array *outr, af_array *outg, af_array *outb, af_array *outa)
{
try {
af_seq idx[4][3] = {{af_span, af_span, {0, 0, 1}},
{af_span, af_span, {1, 1, 1}},
{af_span, af_span, {2, 2, 1}},
{af_span, af_span, {3, 3, 1}}
};
if (dims[2] == 4) {
AF_CHECK(af_index(outr, rgb, dims.ndims(), idx[0]));
AF_CHECK(af_index(outg, rgb, dims.ndims(), idx[1]));
AF_CHECK(af_index(outb, rgb, dims.ndims(), idx[2]));
AF_CHECK(af_index(outa, rgb, dims.ndims(), idx[3]));
} else if (dims[2] == 3) {
AF_CHECK(af_index(outr, rgb, dims.ndims(), idx[0]));
AF_CHECK(af_index(outg, rgb, dims.ndims(), idx[1]));
AF_CHECK(af_index(outb, rgb, dims.ndims(), idx[2]));
} else {
AF_CHECK(af_index(outr, rgb, dims.ndims(), idx[0]));
}
} CATCHALL;
return AF_SUCCESS;
}
#endif
|
/******************************************************************
*
* uEcho for C
*
* Copyright (C) Satoshi Konno 2015
*
* This is licensed under BSD-style license, see file COPYING.
*
******************************************************************/
#include <uecho/message.h>
#include <uecho/profile.h>
/****************************************
* uecho_message_search_new
****************************************/
uEchoMessage* uecho_message_search_new(void)
{
uEchoMessage* msg;
uEchoProperty* prop;
msg = uecho_message_new();
if (!msg)
return NULL;
uecho_message_setesv(msg, uEchoEsvReadRequest);
uecho_message_setsourceobjectcode(msg, uEchoNodeProfileObject);
uecho_message_setdestinationobjectcode(msg, uEchoNodeProfileObject);
prop = uecho_property_new();
uecho_property_setcode(prop, uEchoNodeProfileClassSelfNodeInstanceListS);
uecho_property_setdata(prop, NULL, 0);
uecho_message_addproperty(msg, prop);
return msg;
}
/****************************************
* uecho_message_issearchrequest
****************************************/
bool uecho_message_issearchrequest(uEchoMessage* msg)
{
uEchoProperty* prop;
if (uecho_message_getesv(msg) != uEchoEsvReadRequest)
return false;
if (uecho_message_getopc(msg) != 1)
return false;
prop = uecho_message_getproperty(msg, 0);
if (uecho_property_getcode(prop) != uEchoNodeProfileClassSelfNodeInstanceListS)
return false;
return true;
}
/****************************************
* uecho_message_issearchresponse
****************************************/
bool uecho_message_issearchresponse(uEchoMessage* msg)
{
uEchoProperty* prop;
uEchoEsv esv;
esv = uecho_message_getesv(msg);
if ((esv != uEchoEsvReadResponse) && (esv != uEchoEsvNotification) && (esv != uEchoEsvNotificationResponse))
return false;
if (uecho_message_getopc(msg) != 1)
return false;
prop = uecho_message_getproperty(msg, 0);
if (uecho_property_getcode(prop) != uEchoNodeProfileClassSelfNodeInstanceListS)
return false;
return true;
}
|
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UPDATES_TEST_MOCK_UPDATE_NOTIFICATION_SERVICE_BRIDGE_H_
#define CHROME_BROWSER_UPDATES_TEST_MOCK_UPDATE_NOTIFICATION_SERVICE_BRIDGE_H_
#include "chrome/browser/updates/update_notification_service_bridge.h"
#include "base/optional.h"
#include "base/time/time.h"
#include "testing/gmock/include/gmock/gmock.h"
namespace updates {
namespace test {
class MockUpdateNotificationServiceBridge
: public UpdateNotificationServiceBridge {
public:
MockUpdateNotificationServiceBridge();
~MockUpdateNotificationServiceBridge();
MOCK_METHOD1(UpdateLastShownTimeStamp, void(base::Time timestamp));
MOCK_METHOD0(GetLastShownTimeStamp, base::Optional<base::Time>());
MOCK_METHOD1(UpdateThrottleInterval, void(base::TimeDelta interval));
MOCK_METHOD0(GetThrottleInterval, base::Optional<base::TimeDelta>());
MOCK_METHOD1(UpdateNegativeActionCount, void(int count));
MOCK_METHOD0(GetNegativeActionCount, int());
MOCK_METHOD1(LaunchChromeActivity, void(int state));
private:
DISALLOW_COPY_AND_ASSIGN(MockUpdateNotificationServiceBridge);
};
} // namespace test
} // namespace updates
#endif // CHROME_BROWSER_UPDATES_TEST_MOCK_UPDATE_NOTIFICATION_SERVICE_BRIDGE_H_
|
// Basic datatypes, structs and data-assessing functions.
# include <stdbool.h>
# include <assert.h>
# ifndef BASICS
# define BASICS
// Data type used for indizes of the time series. Must be capable of representing roughly twice the length of the time series.
typedef unsigned int IndexType;
// Cast to longer data type than index type (needed sometimes to avoid integer overflows)
static inline unsigned long L(IndexType i)
{
return ((unsigned long) i);
}
// Data type for values of the time series. Can be any numerical type that supports comparison, even integer.
typedef double ValueType;
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wunused-variable"
static char ValueType_formatting_string[] = "%lf";
# pragma GCC diagnostic pop
typedef struct TimeSeries
{
ValueType * data;
IndexType length;
} TimeSeries;
static inline IndexType length (TimeSeries const T)
{
return T.length;
}
static inline ValueType get_ts_value(TimeSeries const T, IndexType const i)
{
assert(i<T.length);
return T.data[i];
}
static inline void set_ts_value (TimeSeries const T, IndexType const index, ValueType const value)
{
T.data[index] = value;
}
TimeSeries timeseries_alloc (IndexType const n);
TimeSeries timeseries_from_stdin ();
void timeseries_free (TimeSeries const T);
// If you just want to apply the test and did redefine any types, you can stop here.
// =================================================================================
TimeSeries ts_crop();
static inline char diff_sign (TimeSeries const T, IndexType const i, IndexType const j)
{
ValueType const a = get_ts_value(T,i);
ValueType const b = get_ts_value(T,j);
return (a>b)-(a<b);
}
static inline bool diff_signs_differ (TimeSeries const T, IndexType const i, IndexType const j, IndexType const k)
{
return diff_sign(T,i,j) != diff_sign(T,i,k);
}
// These functions do nothing and are only required due to analogy reasons to the Python counterpart.
static inline void initialise(){}
static inline void finalise(){}
# endif
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef BASE_MEMORY_SCOPED_VECTOR_H_
#define BASE_MEMORY_SCOPED_VECTOR_H_
#pragma once
#include <vector>
#include "base/basictypes.h"
#include "base/move.h"
#include "base/stl_util.h"
// ScopedVector wraps a vector deleting the elements from its
// destructor.
template <class T>
class ScopedVector {
MOVE_ONLY_TYPE_FOR_CPP_03(ScopedVector, RValue)
public:
typedef typename std::vector<T*>::iterator iterator;
typedef typename std::vector<T*>::const_iterator const_iterator;
typedef typename std::vector<T*>::reverse_iterator reverse_iterator;
typedef typename std::vector<T*>::const_reverse_iterator
const_reverse_iterator;
typedef typename std::vector<T*>::reference reference;
typedef typename std::vector<T*>::const_reference const_reference;
ScopedVector() {}
~ScopedVector() { reset(); }
ScopedVector(RValue& other) { swap(other); }
ScopedVector& operator=(RValue& rhs) {
swap(rhs);
return *this;
}
std::vector<T*>* operator->() { return &v; }
const std::vector<T*>* operator->() const { return &v; }
T*& operator[](size_t i) { return v[i]; }
const T* operator[](size_t i) const { return v[i]; }
bool empty() const { return v.empty(); }
size_t size() const { return v.size(); }
reverse_iterator rbegin() { return v.rbegin(); }
const_reverse_iterator rbegin() const { return v.rbegin(); }
reverse_iterator rend() { return v.rend(); }
const_reverse_iterator rend() const { return v.rend(); }
iterator begin() { return v.begin(); }
const_iterator begin() const { return v.begin(); }
iterator end() { return v.end(); }
const_iterator end() const { return v.end(); }
void push_back(T* elem) { v.push_back(elem); }
std::vector<T*>& get() { return v; }
const std::vector<T*>& get() const { return v; }
void swap(ScopedVector<T>& other) { v.swap(other.v); }
void release(std::vector<T*>* out) {
out->swap(v);
v.clear();
}
void reset() { STLDeleteElements(&v); }
void reserve(size_t capacity) { v.reserve(capacity); }
void resize(size_t new_size) { v.resize(new_size); }
// Lets the ScopedVector take ownership of |x|.
iterator insert(iterator position, T* x) {
return v.insert(position, x);
}
// Lets the ScopedVector take ownership of elements in [first,last).
template<typename InputIterator>
void insert(iterator position, InputIterator first, InputIterator last) {
v.insert(position, first, last);
}
iterator erase(iterator position) {
delete *position;
return v.erase(position);
}
iterator erase(iterator first, iterator last) {
STLDeleteContainerPointers(first, last);
return v.erase(first, last);
}
// Like |erase()|, but doesn't delete the element at |position|.
iterator weak_erase(iterator position) {
return v.erase(position);
}
// Like |erase()|, but doesn't delete the elements in [first, last).
iterator weak_erase(iterator first, iterator last) {
return v.erase(first, last);
}
private:
std::vector<T*> v;
};
#endif // BASE_MEMORY_SCOPED_VECTOR_H_
|
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_COMPONENT_UPDATER_SSL_ERROR_ASSISTANT_COMPONENT_INSTALLER_H_
#define CHROME_BROWSER_COMPONENT_UPDATER_SSL_ERROR_ASSISTANT_COMPONENT_INSTALLER_H_
#include <memory>
#include <string>
#include <vector>
#include "base/macros.h"
#include "base/values.h"
#include "components/component_updater/component_installer.h"
namespace base {
class FilePath;
} // namespace base
namespace component_updater {
class SSLErrorAssistantComponentInstallerPolicy
: public ComponentInstallerPolicy {
public:
SSLErrorAssistantComponentInstallerPolicy() = default;
SSLErrorAssistantComponentInstallerPolicy(
const SSLErrorAssistantComponentInstallerPolicy&) = delete;
SSLErrorAssistantComponentInstallerPolicy& operator=(
const SSLErrorAssistantComponentInstallerPolicy&) = delete;
~SSLErrorAssistantComponentInstallerPolicy() override = default;
private:
// ComponentInstallerPolicy methods:
bool SupportsGroupPolicyEnabledComponentUpdates() const override;
bool RequiresNetworkEncryption() const override;
update_client::CrxInstaller::Result OnCustomInstall(
const base::Value& manifest,
const base::FilePath& install_dir) override;
void OnCustomUninstall() override;
bool VerifyInstallation(const base::Value& manifest,
const base::FilePath& install_dir) const override;
void ComponentReady(const base::Version& version,
const base::FilePath& install_dir,
base::Value manifest) override;
base::FilePath GetRelativeInstallDir() const override;
void GetHash(std::vector<uint8_t>* hash) const override;
std::string GetName() const override;
update_client::InstallerAttributes GetInstallerAttributes() const override;
static base::FilePath GetInstalledPath(const base::FilePath& base);
};
void RegisterSSLErrorAssistantComponent(ComponentUpdateService* cus);
} // namespace component_updater
#endif // CHROME_BROWSER_COMPONENT_UPDATER_SSL_ERROR_ASSISTANT_COMPONENT_INSTALLER_H_
|
/*
* (C) 2010 Michael J. Beer
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or with‐
* out modification, are permitted provided that the following con‐
* ditions 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 copy‐
* right notice, this list of conditions and the following dis‐
* claimer in the documentation and/or other materials provided with
* the distribution.
*
* 3. Neither the name of the copyright holder 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 CONTRIBU‐
* TORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DI‐
* RECT, 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 IN‐
* TERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLI‐
* GENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __INTERNALS_H__
#define __INTERNALS_H__
#include "safety.h"
#endif
|
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file connectionManager.h
* @author jns
* @date 2000-02-07
*/
#ifndef CONNECTIONMANAGER_H
#define CONNECTIONMANAGER_H
#include "pandabase.h"
#include "netDatagram.h"
#include "connection.h"
#include "pointerTo.h"
#include "pset.h"
#include "pvector.h"
#include "lightMutex.h"
class NetAddress;
class ConnectionReader;
class ConnectionWriter;
/**
* The primary interface to the low-level networking layer in this package. A
* ConnectionManager is used to establish and destroy TCP and UDP connections.
* Communication on these connections, once established, is handled via
* ConnectionReader, ConnectionWriter, and ConnectionListener.
*
* You may use this class directly if you don't care about tracking which
* connections have been unexpectedly closed; otherwise, you should use
* QueuedConnectionManager to get reports about these events (or derive your
* own class to handle these events properly).
*/
class EXPCL_PANDA_NET ConnectionManager {
PUBLISHED:
ConnectionManager();
virtual ~ConnectionManager();
PT(Connection) open_UDP_connection(int port = 0);
PT(Connection) open_UDP_connection(const string &hostname, int port, bool for_broadcast = false);
BLOCKING PT(Connection) open_TCP_server_rendezvous(int port, int backlog);
BLOCKING PT(Connection) open_TCP_server_rendezvous(const string &hostname,
int port, int backlog);
BLOCKING PT(Connection) open_TCP_server_rendezvous(const NetAddress &address,
int backlog);
BLOCKING PT(Connection) open_TCP_client_connection(const NetAddress &address,
int timeout_ms);
BLOCKING PT(Connection) open_TCP_client_connection(const string &hostname, int port,
int timeout_ms);
bool close_connection(const PT(Connection) &connection);
BLOCKING bool wait_for_readers(double timeout);
static string get_host_name();
class EXPCL_PANDA_NET Interface {
PUBLISHED:
const string &get_name() const { return _name; }
const string &get_mac_address() const { return _mac_address; }
bool has_ip() const { return (_flags & F_has_ip) != 0; }
const NetAddress &get_ip() const { return _ip; }
bool has_netmask() const { return (_flags & F_has_netmask) != 0; }
const NetAddress &get_netmask() const { return _netmask; }
bool has_broadcast() const { return (_flags & F_has_broadcast) != 0; }
const NetAddress &get_broadcast() const { return _broadcast; }
bool has_p2p() const { return (_flags & F_has_p2p) != 0; }
const NetAddress &get_p2p() const { return _p2p; }
void output(ostream &out) const;
public:
Interface() { _flags = 0; }
void set_name(const string &name) { _name = name; }
void set_mac_address(const string &mac_address) { _mac_address = mac_address; }
void set_ip(const NetAddress &ip) { _ip = ip; _flags |= F_has_ip; }
void set_netmask(const NetAddress &ip) { _netmask = ip; _flags |= F_has_netmask; }
void set_broadcast(const NetAddress &ip) { _broadcast = ip; _flags |= F_has_broadcast; }
void set_p2p(const NetAddress &ip) { _p2p = ip; _flags |= F_has_p2p; }
private:
string _name;
string _mac_address;
NetAddress _ip;
NetAddress _netmask;
NetAddress _broadcast;
NetAddress _p2p;
int _flags;
enum Flags {
F_has_ip = 0x001,
F_has_netmask = 0x002,
F_has_broadcast = 0x004,
F_has_p2p = 0x008,
};
};
void scan_interfaces();
int get_num_interfaces();
const Interface &get_interface(int n);
MAKE_SEQ(get_interfaces, get_num_interfaces, get_interface);
protected:
void new_connection(const PT(Connection) &connection);
virtual void flush_read_connection(Connection *connection);
virtual void connection_reset(const PT(Connection) &connection,
bool okflag);
void add_reader(ConnectionReader *reader);
void remove_reader(ConnectionReader *reader);
void add_writer(ConnectionWriter *writer);
void remove_writer(ConnectionWriter *writer);
string format_mac_address(const unsigned char *data, int data_size);
typedef phash_set< PT(Connection) > Connections;
typedef phash_set<ConnectionReader *, pointer_hash> Readers;
typedef phash_set<ConnectionWriter *, pointer_hash> Writers;
Connections _connections;
Readers _readers;
Writers _writers;
LightMutex _set_mutex;
typedef pvector<Interface> Interfaces;
Interfaces _interfaces;
bool _interfaces_scanned;
private:
friend class ConnectionReader;
friend class ConnectionWriter;
friend class ConnectionListener;
friend class Connection;
};
INLINE ostream &operator << (ostream &out, const ConnectionManager::Interface &iface) {
iface.output(out);
return out;
}
#endif
|
//
// Section.h
// snowcrash
//
// Created by Zdenek Nemec on 11/1/13.
// Copyright (c) 2013 Apiary Inc. All rights reserved.
//
#ifndef SNOWCRASH_SECTION_H
#define SNOWCRASH_SECTION_H
#include <string>
namespace snowcrash {
/**
* API Blueprint Sections Types.
*/
enum SectionType {
UndefinedSectionType, /// < Undefined section
BlueprintSectionType, /// < Blueprint overview
ResourceGroupSectionType, /// < Resource group
ResourceSectionType, /// < Resource
ActionSectionType, /// < Action
RequestSectionType, /// < Request
RequestBodySectionType, /// < Request & Payload body combined (abbrev)
ResponseSectionType, /// < Response
ResponseBodySectionType, /// < Response & Body combined (abbrev)
ModelSectionType, /// < Model
ModelBodySectionType, /// < Model & Body combined (abbrev)
BodySectionType, /// < Payload Body
DanglingBodySectionType, /// < Dangling Body (unrecognised section considered to be Body)
SchemaSectionType, /// < Payload Schema
DanglingSchemaSectionType, /// < Dangling Schema (unrecognised section considered to be Schema)
HeadersSectionType, /// < Headers
ForeignSectionType, /// < Foreign, unexpected section
ParametersSectionType, /// < Parameters
ParameterSectionType, /// < One Parameter definition
ValuesSectionType, /// < Value enumeration
ValueSectionType /// < One Value
};
/** \return Human readable name for given %SectionType */
extern std::string SectionName(const SectionType& section);
}
#endif
|
/*
* Generated by class-dump 3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2012 by Steve Nygard.
*/
#import "NSObject.h"
#import "IDEKeyDrivenNavigableItemRepresentedObject.h"
@class DVTDocumentLocation, DVTFileDataType, IDEFileReference, NSImage, NSString;
@interface IDEBuildRunPhaseBlueprintWrapper : NSObject <IDEKeyDrivenNavigableItemRepresentedObject>
{
id <IDEBlueprint> _blueprint;
}
- (void).cxx_destruct;
@property(readonly) id <IDEBlueprint> blueprint; // @synthesize blueprint=_blueprint;
- (id)initWithBlueprint:(id)arg1;
@property(readonly) NSImage *navigableItem_image;
@property(readonly) NSString *navigableItem_name;
// Remaining properties
@property(readonly, copy) NSString *debugDescription;
@property(readonly, copy) NSString *description;
@property(readonly) unsigned long long hash;
@property(readonly) DVTDocumentLocation *navigableItem_contentDocumentLocation;
@property(readonly) DVTFileDataType *navigableItem_documentType;
@property(readonly) IDEFileReference *navigableItem_fileReference;
@property(readonly) NSString *navigableItem_groupIdentifier;
@property(readonly) BOOL navigableItem_isLeaf;
@property(readonly) BOOL navigableItem_isMajorGroup;
@property(readonly) NSString *navigableItem_toolTip;
@property(readonly) Class superclass;
@end
|
/*------------------------------------------------------------------------
* (The MIT License)
*
* Copyright (c) 2008-2011 Rhomobile, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* http://rhomobile.com
*------------------------------------------------------------------------*/
#ifndef _RHOFATALERROR_H_
#define _RHOFATALERROR_H_
#include "RhoPort.h"
#if defined(OS_SYMBIAN)
#include <e32std.h>
#endif
namespace rho{
namespace common{
class CRhoFatalError{
public:
static void processFatalError(){
#ifdef RHO_DEBUG
#if defined (OS_WINDOWS)
//__debugbreak();
DebugBreak();
#elif defined (OS_WINCE)
//NKDbgPrintfW ?
DebugBreak();
#elif defined(OS_SYMBIAN)
User::Invariant();
// exit(-1);
#elif defined(OS_MACOSX)
// __assert_rtn(__func__, __FILE__, __LINE__,"RhoFatalError");
#else
exit(-1);
#endif
#else //!RHO_DEBUG
exit(-1);
#endif //!RHO_DEBUG
}
};
}
}
#endif //_RHOFATALERROR_H_
|
//
// FLNetworkStream_Internal.h
// FishLampCocoa
//
// Created by Mike Fullerton on 4/12/13.
// Copyright (c) 2013 GreenTongue Software LLC, Mike Fullerton.
// The FishLamp Framework is released under the MIT License: http://fishlamp.com/license
//
#import "FLNetworkStream.h"
@interface FLNetworkStream ()
@property (readwrite, assign) BOOL wasTerminated;
- (void) touchTimeoutTimestamp;
// required overrides
- (void) openStream;
- (void) closeStream;
// all of these are called on the async queue.
// optional overrides
- (void) willOpen;
- (void) didOpen;
- (void) didClose;
- (NSError*) streamError;
// stream events. All of these do nothing by default. They are called on the
// async queue.
- (void) encounteredOpen;
- (void) encounteredCanAcceptBytes;
- (void) encounteredBytesAvailable;
- (void) encounteredError:(NSError*) error;
- (void) encounteredEnd;
@end
|
/*
* This source file is part of EasyPaint.
*
* Copyright (c) 2012 EasyPaint <https://github.com/Gr1N/EasyPaint>
*
* 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 SPRAYINSTRUMENT_H
#define SPRAYINSTRUMENT_H
#include "abstractinstrument.h"
#include <QtCore/QObject>
/**
* @brief Spray instrument class.
*
*/
class SprayInstrument : public AbstractInstrument
{
Q_OBJECT
public:
explicit SprayInstrument(QObject *parent = 0);
void mousePressEvent(QMouseEvent *event, ImageArea &imageArea);
void mouseMoveEvent(QMouseEvent *event, ImageArea &imageArea);
void mouseReleaseEvent(QMouseEvent *event, ImageArea &imageArea);
protected:
void paint(ImageArea &imageArea, bool isSecondaryColor = false, bool additionalFlag = false);
};
#endif // SPRAYINSTRUMENT_H
|
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "piece/list.h"
#include "piece/writer.h"
#include "piece/writer/image.h"
#include "piece/writer/text.h"
#include "piece/util.h"
static piece_list *piece_writers;
void piece_writer_init(void)
{
piece_writers = piece_allocate(sizeof(piece_list));
piece_list_new(piece_writers, NULL);
piece_image_writer_init();
piece_text_writer_init();
}
void piece_writer_free(void)
{
piece_list_free(piece_writers);
}
void piece_writer_register(piece_writer *details)
{
piece_list_append(piece_writers, details);
}
void piece_writer_iter(piece_list_iterator iterator)
{
piece_list_foreach(piece_writers, iterator);
}
piece_writer *piece_writer_for_type(const char *typename)
{
piece_list_node *node = piece_writers->head;
while (node != NULL) {
if (!strcmp(((piece_writer *) node->data)->name, typename)) {
return (piece_writer *) node->data;
}
node = node->next;
}
return NULL;
}
|
/* Copyright (c) The Grit Game Engine authors 2016
*
* 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 IDEREAD_H
#define IDEREAD_H
#include <string>
#include <vector>
#include <istream>
#define OBJ_FLAG_WET 1<<0 // 1 0x1 (771 objects)
#define OBJ_FLAG_NIGHT 1<<1 // 2 0x2 (29 objects)
#define OBJ_FLAG_ALPHA1 1<<2 // 4 0x4 (2202 objects)
#define OBJ_FLAG_ALPHA2 1<<3 // 8 0x8 (4 objects)
#define OBJ_FLAG_DAY 1<<4 // 16 0x10 (0 objects)
#define OBJ_FLAG_INTERIOR 1<<5 // 32 0x20 (29 objects) door?
#define OBJ_FLAG_NO_SHADOW 1<<6 // 64 0x40 (244 objects)
#define OBJ_FLAG_NO_COL 1<<7 // 128 0x80 (4999 objects)
#define OBJ_FLAG_NO_DRAW_DIST 1<<8 // 256 0x100 (0 objects)
#define OBJ_FLAG_BREAK_GLASS 1<<9 // 512 0x200 (2 objects)
#define OBJ_FLAG_BREAK_GLASS_CRACK 1<<10 // 1024 0x400 (8 objects)
#define OBJ_FLAG_GARAGE_DOOR 1<<11 // 2048 0x800 (56 objects)
#define OBJ_FLAG_2CLUMP 1<<12 // 4096 0x1000 (69 objects)
#define OBJ_FLAG_SWAYS 1<<13 // 8192 0x2000 (102 objects)
#define OBJ_FLAG_OTHER_VEG 1<<14 // 16384 0x4000 (10 objects)
#define OBJ_FLAG_POLE_SHADOW 1<<15 // 32768 0x8000 (70 objects)
#define OBJ_FLAG_EXPLOSIVE 1<<16 // 65536 0x10000 (9 objects)
#define OBJ_FLAG_UNK1 1<<17 // 131072 0x20000 (9 objects)
#define OBJ_FLAG_UNK2 1<<18 // 262144 0x40000 (1 objects)
#define OBJ_FLAG_UNK3 1<<19 // 524288 0x80000 (0 objects)
#define OBJ_FLAG_GRAFITTI 1<<20 // 1048576 0x100000 (9 objects)
#define OBJ_FLAG_DRAW_BACKFACE 1<<21 // 2097152 0x200000 (1501 objects)
#define OBJ_FLAG_UNK4 1<<22 // 4194304 0x400000 (6 objects)
class Obj {
public:
unsigned long id;
std::string dff;
std::string txd;
float draw_distance;
unsigned long flags;
bool is_car; // not from ide file
};
typedef std::vector<Obj> Objs;
class TObj : public Obj {
public:
unsigned char hour_on;
unsigned char hour_off;
};
typedef std::vector<TObj> TObjs;
class Anim : public Obj {
public:
std::string ifp_file;
};
typedef std::vector<Anim> Anims;
class TXDP {
public:
std::string txd1;
std::string txd2;
};
typedef std::vector<TXDP> TXDPs;
class Ped {
public:
unsigned long id;
std::string dff;
std::string txd;
std::string stat_type;
std::string type;
std::string anim_group;
unsigned long can_drive; // peds.ide has the values
bool buys_drugs; // just 0 or 1
std::string anim_file;
unsigned long radio1; // peds.ide has the values
unsigned long radio2; // peds.ide has the values
std::string unk1;
std::string unk2;
std::string unk3;
};
typedef std::vector<Ped> Peds;
class Vehicle {
public:
unsigned long id;
std::string dff;
std::string txd;
//bike bmx boat car heli mtruck plane quad trailer train
std::string type;
std::string handling_id;
std::string game_name; // for gxt apparently
// BF_injection biked bikeh bikes bikev bmx bus choppa coach dozer KART
// mtb nevada null quad rustler shamal tank truck van vortex wayfarer
std::string anims;
// bicycle big executive ignore leisureboat moped motorbike normal
// poorfamily richfamily taxi worker workerboat
std::string class_;
unsigned int freq;
unsigned int flags; // 0 1 or 7
// 0 1012 1f10 1f341210 2ff0 3012 30123345 3210 3f01 3f10 3f341210 4fff
unsigned int comp_rules;
// boats do not have the following:
int unk1; // on bikes, 16 or 23, otherwise -1
float front_wheel_size;
float rear_wheel_size;
int unk2; // if present -1, 0, 1, 2 (on non-cars always -1)
};
typedef std::vector<Vehicle> Vehicles;
class Weap {
public:
unsigned long id;
std::string dff;
std::string txd;
std::string type;
unsigned int unk_one;
unsigned int unk_num;
unsigned int unk_zero;
};
typedef std::vector<Weap> Weaps;
struct ide {
Objs objs;
TObjs tobjs;
TXDPs txdps;
Anims anims;
Weaps weaps;
Vehicles vehicles;
Peds peds;
};
void read_ide(const std::string &filename, std::istream &f, struct ide *ide);
#endif
// vim: shiftwidth=8:tabstop=8:expandtab
|
/*
* Licensed under the MIT License (MIT)
*
* Copyright (c) 2013 AudioScience Inc.
*
* 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.
*/
/**
* jack_output_descriptor_imp.h
*
* JACK OUTPUT descriptor implementation class
*/
#pragma once
#include "descriptor_base_imp.h"
#include "jack_output_descriptor.h"
#include "jack_output_descriptor_response_imp.h"
namespace avdecc_lib
{
class jack_output_descriptor_imp : public jack_output_descriptor, public virtual descriptor_base_imp
{
public:
jack_output_descriptor_imp(end_station_imp * end_station_obj, const uint8_t * frame, ssize_t pos, size_t frame_len);
virtual ~jack_output_descriptor_imp();
jack_output_descriptor_response_imp * resp;
jack_output_descriptor_response * STDCALL get_jack_output_response();
private:
///
/// Store the jack flags componenets of the JACK INPUT descriptor object in a vector.
///
void jack_flags_init();
};
}
|
//
// ZFApiSoapUpdateGroup.h
//
// DO NOT MODIFY!! Modifications will be overwritten.
// Generated by: Mike Fullerton @ 6/3/13 10:43 AM with PackMule (3.0.1.100)
//
// Project: Zenfolio Web API
// Schema: ZenfolioWebApi
//
// Copyright 2013 (c) GreenTongue Software LLC, Mike Fullerton
// The FishLamp Framework is released under the MIT License: http://fishlamp.com/license
//
#import "FLModelObject.h"
#import "FLHttpRequestDescriptor.h"
@class ZFUpdateGroupResponse;
@class ZFUpdateGroup;
@interface ZFApiSoapUpdateGroup : FLModelObject<FLHttpRequestDescriptor> {
@private
ZFUpdateGroup* _input;
ZFUpdateGroupResponse* _output;
}
@property (readwrite, strong, nonatomic) ZFUpdateGroup* input;
@property (readonly, strong, nonatomic) NSString* location;
@property (readonly, strong, nonatomic) NSString* operationName;
@property (readwrite, strong, nonatomic) ZFUpdateGroupResponse* output;
@property (readonly, strong, nonatomic) NSString* soapAction;
@property (readonly, strong, nonatomic) NSString* targetNamespace;
+ (ZFApiSoapUpdateGroup*) apiSoapUpdateGroup;
@end
|
/*
Copyright (c) 2010-2013
Lars-Dominik Braun <lars@6xq.net>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#pragma once
/* bit-mask */
typedef enum {
BAR_DC_UNDEFINED = 0,
BAR_DC_GLOBAL = 1, /* top-level action */
BAR_DC_STATION = 2, /* station selected */
BAR_DC_SONG = 4, /* song selected */
} BarUiDispatchContext_t;
#include "settings.h"
#include "main.h"
typedef void (*BarKeyShortcutFunc_t) (BarApp_t *, PianoStation_t *,
PianoSong_t *, BarUiDispatchContext_t);
typedef struct {
char defaultKey;
BarUiDispatchContext_t context;
BarKeyShortcutFunc_t function;
const char * const helpText;
const char * const configKey;
} BarUiDispatchAction_t;
#include "ui_act.h"
/* see settings.h */
static const BarUiDispatchAction_t dispatchActions[BAR_KS_COUNT] = {
{'?', BAR_DC_UNDEFINED, BarUiActHelp, NULL, "act_help"},
{'+', BAR_DC_SONG, BarUiActLoveSong, "love song",
"act_songlove"},
{'-', BAR_DC_SONG, BarUiActBanSong, "ban song", "act_songban"},
{'a', BAR_DC_STATION, BarUiActAddMusic, "add music to station",
"act_stationaddmusic"},
{'c', BAR_DC_GLOBAL, BarUiActCreateStation, "create new station",
"act_stationcreate"},
{'d', BAR_DC_STATION, BarUiActDeleteStation, "delete station",
"act_stationdelete"},
{'e', BAR_DC_SONG, BarUiActExplain, "explain why this song is played",
"act_songexplain"},
{'g', BAR_DC_GLOBAL, BarUiActStationFromGenre, "add genre station",
"act_stationaddbygenre"},
{'h', BAR_DC_GLOBAL, BarUiActHistory, "song history", "act_history"},
{'i', BAR_DC_GLOBAL | BAR_DC_STATION | BAR_DC_SONG, BarUiActSongInfo,
"print information about song/station", "act_songinfo"},
{'j', BAR_DC_GLOBAL, BarUiActAddSharedStation, "add shared station",
"act_addshared"},
{'n', BAR_DC_GLOBAL | BAR_DC_STATION, BarUiActSkipSong, "next song",
"act_songnext"},
{'p', BAR_DC_GLOBAL | BAR_DC_STATION, BarUiActTogglePause, "pause/resume playback",
"act_songpausetoggle"},
{'q', BAR_DC_GLOBAL, BarUiActQuit, "quit", "act_quit"},
{'r', BAR_DC_STATION, BarUiActRenameStation, "rename station",
"act_stationrename"},
{'s', BAR_DC_GLOBAL, BarUiActSelectStation, "change station",
"act_stationchange"},
{'t', BAR_DC_SONG, BarUiActTempBanSong, "tired (ban song for 1 month)",
"act_songtired"},
{'u', BAR_DC_GLOBAL | BAR_DC_STATION, BarUiActPrintUpcoming,
"upcoming songs", "act_upcoming"},
{'x', BAR_DC_STATION, BarUiActSelectQuickMix, "select quickmix stations",
"act_stationselectquickmix"},
{'$', BAR_DC_SONG, BarUiActDebug, NULL, "act_debug"},
{'b', BAR_DC_SONG, BarUiActBookmark, "bookmark song/artist",
"act_bookmark"},
{'(', BAR_DC_GLOBAL, BarUiActVolDown, "decrease volume",
"act_voldown"},
{')', BAR_DC_GLOBAL, BarUiActVolUp, "increase volume",
"act_volup"},
{'=', BAR_DC_STATION, BarUiActManageStation, "manage station seeds/feedback/mode",
"act_managestation"},
{' ', BAR_DC_GLOBAL | BAR_DC_STATION, BarUiActTogglePause, NULL,
"act_songpausetoggle2"},
{'v', BAR_DC_SONG, BarUiActCreateStationFromSong,
"create new station from song or artist", "act_stationcreatefromsong"},
{'P', BAR_DC_GLOBAL | BAR_DC_STATION, BarUiActPlay, "resume playback",
"act_songplay"},
{'S', BAR_DC_GLOBAL | BAR_DC_STATION, BarUiActPause, "pause playback",
"act_songpause"},
{'^', BAR_DC_GLOBAL, BarUiActVolReset, "reset volume",
"act_volreset"},
{'!', BAR_DC_GLOBAL, BarUiActSettings, "change settings",
"act_settings"},
};
#include <piano.h>
#include <stdbool.h>
#include <stdio.h>
BarKeyShortcutId_t BarUiDispatch (BarApp_t *, const char, PianoStation_t *, PianoSong_t *,
const bool, BarUiDispatchContext_t);
|
//
// Copyright (c) .NET Foundation and Contributors
// Portions Copyright (c) Microsoft Corporation. All rights reserved.
// See LICENSE file in the project root for full license information.
//
#ifndef TARGET_HAL_TIME_H
#define TARGET_HAL_TIME_H
#define HAL_Time_CurrentSysTicks HAL_Time_CurrentSysTicks
uint64_t HAL_Time_CurrentSysTicks();
///// <summary>
///// Converts 64bit time value to SystemTime structure. 64bit time is assumed as an offset from 1/1/1601:00:00:00.000
/// in 100ns.
///// </summary>
///// <returns>True if conversion is successful.</returns>
// bool Time_ToSystemTime(TIME time, SYSTEMTIME* systemTime);
//
///// <summary>
///// Converts SystemTime structure to 64bit time, which is assumed as an offset from 1/1/1601:00:00:00.000 in 100ns.
///// </summary>
///// <returns>Time value.</returns>
// TIME Time_FromSystemTime(const SYSTEMTIME* systemTime);
//
///// <summary>
///// Retrieves time since device was booted.
///// </summary>
///// <returns>Time in 100ns.</returns>
// signed __int64 HAL_Time_GetMachineTime();
//
///// <summary>
///// Offset from GMT.
///// </summary>
///// <returns>In minutes, for example Pacific Time would be GMT-8 = -480.</returns>
// signed int Time_GetTimeZoneOffset();
//
///// <summary>
///// UTC time according to this system.
///// </summary>
///// <returns>Returns current UTC time in 100ns elapsed since 1/1/1601:00:00:00.000 UTC.</returns>
// signed __int64 Time_GetUtcTime();
//
///// <summary>
///// Local time according to the Time subsystem.
///// </summary>
///// <returns>Local time in 100ns elapsed since 1/1/1601:00:00:00.000 local time.</returns>
// signed __int64 Time_GetLocalTime();
//
///// <summary>
///// Retrieves number of days since the beginning of the year given a month and a year. Calculates for leap years.
///// </summary>
///// <returns>S_OK if successful.</returns>
// HRESULT Time_AccDaysInMonth(signed int year, signed int month, signed int* days);
//
///// <summary>
///// Retrieves number of days given a month and a year. Calculates for leap years.
///// </summary>
///// <returns>S_OK if successful.</returns>
// HRESULT Time_DaysInMonth(signed int year, signed int month, signed int* days);
//
///// APIs to convert between types
// bool Time_TimeSpanToStringEx( const signed __int64& ticks, char*& buf, size_t& len );
// const char* Time_TimeSpanToString( const signed __int64& ticks );
// bool Time_DateTimeToStringEx( const signed __int64& time, char*& buf, size_t& len );
// const char* Time_DateTimeToString( const signed __int64& time);
// const char* Time_CurrentDateTimeToString();
#endif //TARGET_HAL_TIME_H
|
#ifndef _LINUX_SLAB_H
#define _LINUX_SLAB_H
#include <linux/gfp.h>
#include <linux/slab_def.h>
#endif
|
/*!
\copyright (c) RDO-Team, 2003-2013
\file status_bar.h
\authors Захаров Павел
\authors Урусов Андрей (rdo@rk9.bmstu.ru)
\date 09.04.2003
\brief
\indent 4T
*/
#ifndef _RDO_STUDIO_STATUS_BAR_H_
#define _RDO_STUDIO_STATUS_BAR_H_
// ----------------------------------------------------------------------- INCLUDES
#include "utils/src/common/warning_disable.h"
#include <QProgressBar>
#include <QMainWindow>
#include <QLabel>
#include <boost/mpl/integral_c.hpp>
#include "utils/src/common/warning_enable.h"
// ----------------------------------------------------------------------- SYNOPSIS
#include "utils/src/smart_ptr/intrusive_ptr/intrusive_ptr.h"
// --------------------------------------------------------------------------------
PREDECLARE_POINTER(StatusBar);
class StatusBar: public rdo::counter_reference
{
DECLARE_FACTORY(StatusBar)
public:
enum Type
{
SB_COORD,
SB_MODIFY,
SB_OVERWRITE,
SB_MODEL_TIME,
SB_MODEL_RUNTYPE,
SB_MODEL_SPEED,
SB_MODEL_SHOWRATE
};
template <Type N>
void update(const QString& message)
{
update(StatusBarType<N>(), message);
}
void beginProgress(int lower, int upper);
void stepProgress();
void endProgress();
private:
StatusBar(QMainWindow* pParent);
virtual ~StatusBar();
QMainWindow* m_pParent;
QLabel* m_pSBCoord;
QLabel* m_pSBModify;
QLabel* m_pSBOverwrite;
QLabel* m_pSBModelTime;
QLabel* m_pSBModelRuntype;
QLabel* m_pSBModelSpeed;
QLabel* m_pSBModelShowRate;
QProgressBar* m_pProgressBar;
QWidget* m_pProgressBarFakeWidget;
template <Type N>
struct StatusBarType: boost::mpl::integral_c<Type, N>
{};
template <Type N>
void update(StatusBarType<N> statusBar, const QString& message)
{
QLabel* pLabel = getLabel(statusBar);
ASSERT(pLabel);
pLabel->setText(message);
}
template <Type N>
QLabel* getLabel(StatusBarType<N>);
};
#endif // _RDO_STUDIO_STATUS_BAR_H_
|
//
// DTProgressView.h
// Shapes
//
// Created by Denys Telezhkin on 17.07.14.
// Copyright (c) 2014 MLSDev. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "DTShapeView.h"
#if __has_feature(nullability) // Xcode 6.3+
#pragma clang assume_nonnull begin
#else
#define nullable
#define __nullable
#endif
/**
`DTProgressView` is a `DTShapeView` subclass, that allow animating progress views of any shape. `DTProgressView` uses `DTShapeView` path as track. Stroke start and stroke end properties provide ability to change progress state of a view.
By default, progress view fills entire view frame, animating progress from left to right.
*/
@interface DTProgressView : DTShapeView
/**
`DTProgressView` progress. Value range from 0 to 1, 0 by default.
*/
@property (nonatomic, assign, readonly) IBInspectable float progress;
/**
Duration of an animated progress change.
Default is 0.3s.
*/
@property (nonatomic, assign) NSTimeInterval animationDuration UI_APPEARANCE_SELECTOR;
/**
Animation function to use, when animating progress change.
*/
@property (nonatomic, strong, nullable) CAValueFunction * animationFunction;
/**
Set progress value. This method is an alias for setStrokeEnd:animated:.
@param progress The new progress value.
@param animated Specify YES to animate the change or NO if you do not want the change to be animated.
*/
- (void)setProgress:(float)progress animated:(BOOL)animated;
/**
Set stroke start value.
@param progress The new progress value.
@param animated Specify YES to animate the change or NO if you do not want the change to be animated.
*/
- (void)setStrokeStart:(float)start animated:(BOOL)animated;
/**
Set strokeEnd value. This method is an alias for setProgress:animated:.
@param progress The new strokeEnd value.
@param animated Specify YES to animate the change or NO if you do not want the change to be animated.
*/
- (void)setStrokeEnd:(float)end animated:(BOOL)animated;
@end
#if __has_feature(nullability)
#pragma clang assume_nonnull end
#endif
|
/////////////////////////////////////////////////////////////////////////////////
// Copyright (c) Electronic Arts Inc. All rights reserved.
/////////////////////////////////////////////////////////////////////////////////
#ifndef EASTL_ATOMIC_INTERNAL_ARCH_X86_THREAD_FENCE_H
#define EASTL_ATOMIC_INTERNAL_ARCH_X86_THREAD_FENCE_H
#if defined(EA_PRAGMA_ONCE_SUPPORTED)
#pragma once
#endif
/////////////////////////////////////////////////////////////////////////////////
//
// void EASTL_ARCH_ATOMIC_THREAD_FENCE_*()
//
#if defined(EA_COMPILER_MSVC)
#define EASTL_ARCH_ATOMIC_THREAD_FENCE_RELAXED()
#define EASTL_ARCH_ATOMIC_THREAD_FENCE_ACQUIRE() \
EASTL_ATOMIC_COMPILER_BARRIER()
#define EASTL_ARCH_ATOMIC_THREAD_FENCE_RELEASE() \
EASTL_ATOMIC_COMPILER_BARRIER()
#define EASTL_ARCH_ATOMIC_THREAD_FENCE_ACQ_REL() \
EASTL_ATOMIC_COMPILER_BARRIER()
#endif
#if defined(EA_COMPILER_MSVC) || defined(EA_COMPILER_CLANG) || defined(EA_COMPILER_GNUC)
#define EASTL_ARCH_ATOMIC_THREAD_FENCE_SEQ_CST() \
EASTL_ATOMIC_CPU_MB()
#endif
#endif /* EASTL_ATOMIC_INTERNAL_ARCH_X86_THREAD_FENCE_H */
|
//
// ViewController.h
// QBTitleView
//
// Created by questbeat on 2012/12/27.
// Copyright (c) 2012年 Katsuma Tanaka. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "QBTitleView.h"
@interface ViewController : UIViewController <QBTitleViewDelegate, UITextFieldDelegate>
@property (nonatomic, retain) IBOutlet UITextField *textField;
@property (nonatomic, retain) QBTitleView *titleView;
- (IBAction)switchProfileImage:(id)sender;
@end
|
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2016 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef IOP_IOPCONSENSUS_H
#define IOP_IOPCONSENSUS_H
#include <stdint.h>
#if defined(BUILD_IOP_INTERNAL) && defined(HAVE_CONFIG_H)
#include "config/iop-config.h"
#if defined(_WIN32)
#if defined(DLL_EXPORT)
#if defined(HAVE_FUNC_ATTRIBUTE_DLLEXPORT)
#define EXPORT_SYMBOL __declspec(dllexport)
#else
#define EXPORT_SYMBOL
#endif
#endif
#elif defined(HAVE_FUNC_ATTRIBUTE_VISIBILITY)
#define EXPORT_SYMBOL __attribute__ ((visibility ("default")))
#endif
#elif defined(MSC_VER) && !defined(STATIC_LIBIOPCONSENSUS)
#define EXPORT_SYMBOL __declspec(dllimport)
#endif
#ifndef EXPORT_SYMBOL
#define EXPORT_SYMBOL
#endif
#ifdef __cplusplus
extern "C" {
#endif
#define IOPCONSENSUS_API_VER 1
typedef enum iopconsensus_error_t
{
iopconsensus_ERR_OK = 0,
iopconsensus_ERR_TX_INDEX,
iopconsensus_ERR_TX_SIZE_MISMATCH,
iopconsensus_ERR_TX_DESERIALIZE,
iopconsensus_ERR_AMOUNT_REQUIRED,
iopconsensus_ERR_INVALID_FLAGS,
} iopconsensus_error;
/** Script verification flags */
enum
{
iopconsensus_SCRIPT_FLAGS_VERIFY_NONE = 0,
iopconsensus_SCRIPT_FLAGS_VERIFY_P2SH = (1U << 0), // evaluate P2SH (BIP16) subscripts
iopconsensus_SCRIPT_FLAGS_VERIFY_DERSIG = (1U << 2), // enforce strict DER (BIP66) compliance
iopconsensus_SCRIPT_FLAGS_VERIFY_NULLDUMMY = (1U << 4), // enforce NULLDUMMY (BIP147)
iopconsensus_SCRIPT_FLAGS_VERIFY_CHECKLOCKTIMEVERIFY = (1U << 9), // enable CHECKLOCKTIMEVERIFY (BIP65)
iopconsensus_SCRIPT_FLAGS_VERIFY_CHECKSEQUENCEVERIFY = (1U << 10), // enable CHECKSEQUENCEVERIFY (BIP112)
iopconsensus_SCRIPT_FLAGS_VERIFY_WITNESS = (1U << 11), // enable WITNESS (BIP141)
iopconsensus_SCRIPT_FLAGS_VERIFY_ALL = iopconsensus_SCRIPT_FLAGS_VERIFY_P2SH | iopconsensus_SCRIPT_FLAGS_VERIFY_DERSIG |
iopconsensus_SCRIPT_FLAGS_VERIFY_NULLDUMMY | iopconsensus_SCRIPT_FLAGS_VERIFY_CHECKLOCKTIMEVERIFY |
iopconsensus_SCRIPT_FLAGS_VERIFY_CHECKSEQUENCEVERIFY | iopconsensus_SCRIPT_FLAGS_VERIFY_WITNESS
};
/// Returns 1 if the input nIn of the serialized transaction pointed to by
/// txTo correctly spends the scriptPubKey pointed to by scriptPubKey under
/// the additional constraints specified by flags.
/// If not nullptr, err will contain an error/success code for the operation
EXPORT_SYMBOL int iopconsensus_verify_script(const unsigned char *scriptPubKey, unsigned int scriptPubKeyLen,
const unsigned char *txTo , unsigned int txToLen,
unsigned int nIn, unsigned int flags, iopconsensus_error* err);
EXPORT_SYMBOL int iopconsensus_verify_script_with_amount(const unsigned char *scriptPubKey, unsigned int scriptPubKeyLen, int64_t amount,
const unsigned char *txTo , unsigned int txToLen,
unsigned int nIn, unsigned int flags, iopconsensus_error* err);
EXPORT_SYMBOL unsigned int iopconsensus_version();
#ifdef __cplusplus
} // extern "C"
#endif
#undef EXPORT_SYMBOL
#endif // IOP_IOPCONSENSUS_H
|
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
#import "PathSegment.h"
@interface ArcSegment : PathSegment
@property CGPoint Point;
@property CGPoint Size;
@property bool IsLargeArc;
@property int SweepDirection;
@property double RotationAngle;
@end
|
// duplicate packet module
#include <stdlib.h>
#include "iup.h"
#include "common.h"
#define NAME "duplicate"
#define COPIES_MIN "2"
#define COPIES_MAX "50"
#define COPIES_COUNT 2
static Ihandle *inboundCheckbox, *outboundCheckbox, *chanceInput, *countInput;
static volatile short dupEnabled = 0,
dupInbound = 1, dupOutbound = 1,
chance = 1000, // [0-10000]
count = COPIES_COUNT; // how many copies to duplicate
static Ihandle* dupSetupUI() {
Ihandle *dupControlsBox = IupHbox(
IupLabel("Count:"),
countInput = IupText(NULL),
inboundCheckbox = IupToggle("Inbound", NULL),
outboundCheckbox = IupToggle("Outbound", NULL),
IupLabel("Chance(%):"),
chanceInput = IupText(NULL),
NULL
);
IupSetAttribute(chanceInput, "VISIBLECOLUMNS", "4");
IupSetAttribute(chanceInput, "VALUE", "10.0");
IupSetCallback(chanceInput, "VALUECHANGED_CB", uiSyncChance);
IupSetAttribute(chanceInput, SYNCED_VALUE, (char*)&chance);
IupSetCallback(inboundCheckbox, "ACTION", (Icallback)uiSyncToggle);
IupSetAttribute(inboundCheckbox, SYNCED_VALUE, (char*)&dupInbound);
IupSetCallback(outboundCheckbox, "ACTION", (Icallback)uiSyncToggle);
IupSetAttribute(outboundCheckbox, SYNCED_VALUE, (char*)&dupOutbound);
// sync count
IupSetAttribute(countInput, "VISIBLECOLUMNS", "3");
IupSetAttribute(countInput, "VALUE", STR(COPIES_COUNT));
IupSetCallback(countInput, "VALUECHANGED_CB", (Icallback)uiSyncInteger);
IupSetAttribute(countInput, SYNCED_VALUE, (char*)&count);
IupSetAttribute(countInput, INTEGER_MAX, COPIES_MAX);
IupSetAttribute(countInput, INTEGER_MIN, COPIES_MIN);
// enable by default to avoid confusing
IupSetAttribute(inboundCheckbox, "VALUE", "ON");
IupSetAttribute(outboundCheckbox, "VALUE", "ON");
if (parameterized) {
setFromParameter(inboundCheckbox, "VALUE", NAME"-inbound");
setFromParameter(outboundCheckbox, "VALUE", NAME"-outbound");
setFromParameter(chanceInput, "VALUE", NAME"-chance");
setFromParameter(countInput, "VALUE", NAME"-count");
}
return dupControlsBox;
}
static void dupStartup() {
LOG("dup enabled");
}
static void dupCloseDown(PacketNode *head, PacketNode *tail) {
UNREFERENCED_PARAMETER(head);
UNREFERENCED_PARAMETER(tail);
LOG("dup disabled");
}
static short dupProcess(PacketNode *head, PacketNode *tail) {
short duped = FALSE;
PacketNode *pac = head->next;
while (pac != tail) {
if (checkDirection(pac->addr.Direction, dupInbound, dupOutbound)
&& calcChance(chance)) {
short copies = count - 1;
LOG("duplicating w/ chance %.1f%%, cloned additionally %d packets", chance/100.0, copies);
while (copies--) {
PacketNode *copy = createNode(pac->packet, pac->packetLen, &(pac->addr));
insertBefore(copy, pac); // must insertBefore or next packet is still pac
}
duped = TRUE;
}
pac = pac->next;
}
return duped;
}
Module dupModule = {
"Duplicate",
NAME,
(short*)&dupEnabled,
dupSetupUI,
dupStartup,
dupCloseDown,
dupProcess,
// runtime fields
0, 0, NULL
}; |
// Copyright (c) 2015-2018 William W. Fisher (at gmail dot com)
// This file is distributed under the MIT License.
#ifndef OFP_MPFLOWSTATSREPLY_H_
#define OFP_MPFLOWSTATSREPLY_H_
#include "ofp/byteorder.h"
#include "ofp/durationsec.h"
#include "ofp/instructionlist.h"
#include "ofp/instructionrange.h"
#include "ofp/match.h"
#include "ofp/matchbuilder.h"
#include "ofp/padding.h"
#include "ofp/tablenumber.h"
namespace ofp {
class Writable;
class MPFlowStatsReply {
public:
enum { MPVariableSizeOffset = 0 };
MPFlowStatsReply() = default;
TableNumber tableId() const { return tableId_; }
DurationSec durationSec() const { return duration_; }
UInt16 priority() const { return priority_; }
UInt16 idleTimeout() const { return idleTimeout_; }
UInt16 hardTimeout() const { return hardTimeout_; }
OFPFlowModFlags flags() const { return flags_; }
UInt64 cookie() const { return cookie_; }
UInt64 packetCount() const { return packetCount_; }
UInt64 byteCount() const { return byteCount_; }
Match match() const;
InstructionRange instructions() const;
bool validateInput(Validation *context) const;
private:
Big16 length_;
TableNumber tableId_;
Padding<1> pad_1;
DurationSec duration_;
Big16 priority_;
Big16 idleTimeout_;
Big16 hardTimeout_;
Big<OFPFlowModFlags> flags_;
Padding<4> pad_2;
Big64 cookie_;
Big64 packetCount_;
Big64 byteCount_;
MatchHeader matchHeader_;
Padding<4> pad_3;
enum : size_t {
UnpaddedSizeWithMatchHeader = 52,
SizeWithoutMatchHeader = 48
};
friend class MPFlowStatsReplyBuilder;
template <class T>
friend struct llvm::yaml::MappingTraits;
};
static_assert(sizeof(MPFlowStatsReply) == 56, "Unexpected size.");
static_assert(IsStandardLayout<MPFlowStatsReply>(),
"Expected standard layout.");
class MPFlowStatsReplyBuilder {
public:
void setTableId(UInt8 tableId) { msg_.tableId_ = tableId; }
void setDuration(DurationSec duration) { msg_.duration_ = duration; }
void setPriority(UInt16 priority) { msg_.priority_ = priority; }
void setIdleTimeout(UInt16 idleTimeout) { msg_.idleTimeout_ = idleTimeout; }
void setHardTimeout(UInt16 hardTimeout) { msg_.hardTimeout_ = hardTimeout; }
void setFlags(OFPFlowModFlags flags) { msg_.flags_ = flags; }
void setCookie(UInt64 cookie) { msg_.cookie_ = cookie; }
void setPacketCount(UInt64 packetCount) { msg_.packetCount_ = packetCount; }
void setByteCount(UInt64 byteCount) { msg_.byteCount_ = byteCount; }
void setMatch(const MatchBuilder &match) { match_ = match; }
void setInstructions(const InstructionList &instructions) {
instructions_ = instructions;
}
void write(Writable *channel);
void reset();
private:
MPFlowStatsReply msg_;
MatchBuilder match_;
InstructionList instructions_;
void writeV1(Writable *channel);
template <class T>
friend struct llvm::yaml::MappingTraits;
};
} // namespace ofp
#endif // OFP_MPFLOWSTATSREPLY_H_
|
/**
* \file
*
* \brief Sleep related functionality implementation.
*
* Copyright (C) 2014 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name of Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* \asf_license_stop
*
*/
#include "hal_sleep.h"
#include <hpl_sleep.h>
/**
* \brief Driver version
*/
#define DRIVER_VERSION 0x00000001u
/**
* \brief Set the sleep mode of the device and put the MCU to sleep
*
* For an overview of which systems are disabled in sleep for the different
* sleep modes, see datasheet.
*
* \param[in] mode Sleep mode to use
*
* \return the status of a sleep request
* \retval -1 The requested sleep mode was invalid or not available
* \retval 0 The operation completed successfully, returned after leaving the
* sleep
*/
int sleep(const uint8_t mode)
{
if (ERR_NONE != _set_sleep_mode(mode))
return ERR_INVALID_ARG;
_go_to_sleep();
return ERR_NONE;
}
/**
* \brief Retrieve the current driver version
*
* \return Current driver version
*/
uint32_t sleep_get_version(void)
{
return DRIVER_VERSION;
}
|
#include "f2c.h"
#include "blaswrap.h"
/* Subroutine */ int sposv_(char *uplo, integer *n, integer *nrhs, real *a,
integer *lda, real *b, integer *ldb, integer *info)
{
/* System generated locals */
integer a_dim1, a_offset, b_dim1, b_offset, i__1;
/* Local variables */
extern logical lsame_(char *, char *);
extern /* Subroutine */ int xerbla_(char *, integer *), spotrf_(
char *, integer *, real *, integer *, integer *), spotrs_(
char *, integer *, integer *, real *, integer *, real *, integer *
, integer *);
/* -- LAPACK driver routine (version 3.1) -- */
/* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
/* November 2006 */
/* .. Scalar Arguments .. */
/* .. */
/* .. Array Arguments .. */
/* .. */
/* Purpose */
/* ======= */
/* SPOSV computes the solution to a real system of linear equations */
/* A * X = B, */
/* where A is an N-by-N symmetric positive definite matrix and X and B */
/* are N-by-NRHS matrices. */
/* The Cholesky decomposition is used to factor A as */
/* A = U**T* U, if UPLO = 'U', or */
/* A = L * L**T, if UPLO = 'L', */
/* where U is an upper triangular matrix and L is a lower triangular */
/* matrix. The factored form of A is then used to solve the system of */
/* equations A * X = B. */
/* Arguments */
/* ========= */
/* UPLO (input) CHARACTER*1 */
/* = 'U': Upper triangle of A is stored; */
/* = 'L': Lower triangle of A is stored. */
/* N (input) INTEGER */
/* The number of linear equations, i.e., the order of the */
/* matrix A. N >= 0. */
/* NRHS (input) INTEGER */
/* The number of right hand sides, i.e., the number of columns */
/* of the matrix B. NRHS >= 0. */
/* A (input/output) REAL array, dimension (LDA,N) */
/* On entry, the symmetric matrix A. If UPLO = 'U', the leading */
/* N-by-N upper triangular part of A contains the upper */
/* triangular part of the matrix A, and the strictly lower */
/* triangular part of A is not referenced. If UPLO = 'L', the */
/* leading N-by-N lower triangular part of A contains the lower */
/* triangular part of the matrix A, and the strictly upper */
/* triangular part of A is not referenced. */
/* On exit, if INFO = 0, the factor U or L from the Cholesky */
/* factorization A = U**T*U or A = L*L**T. */
/* LDA (input) INTEGER */
/* The leading dimension of the array A. LDA >= max(1,N). */
/* B (input/output) REAL array, dimension (LDB,NRHS) */
/* On entry, the N-by-NRHS right hand side matrix B. */
/* On exit, if INFO = 0, the N-by-NRHS solution matrix X. */
/* LDB (input) INTEGER */
/* The leading dimension of the array B. LDB >= max(1,N). */
/* INFO (output) INTEGER */
/* = 0: successful exit */
/* < 0: if INFO = -i, the i-th argument had an illegal value */
/* > 0: if INFO = i, the leading minor of order i of A is not */
/* positive definite, so the factorization could not be */
/* completed, and the solution has not been computed. */
/* ===================================================================== */
/* .. External Functions .. */
/* .. */
/* .. External Subroutines .. */
/* .. */
/* .. Intrinsic Functions .. */
/* .. */
/* .. Executable Statements .. */
/* Test the input parameters. */
/* Parameter adjustments */
a_dim1 = *lda;
a_offset = 1 + a_dim1;
a -= a_offset;
b_dim1 = *ldb;
b_offset = 1 + b_dim1;
b -= b_offset;
/* Function Body */
*info = 0;
if (! lsame_(uplo, "U") && ! lsame_(uplo, "L")) {
*info = -1;
} else if (*n < 0) {
*info = -2;
} else if (*nrhs < 0) {
*info = -3;
} else if (*lda < max(1,*n)) {
*info = -5;
} else if (*ldb < max(1,*n)) {
*info = -7;
}
if (*info != 0) {
i__1 = -(*info);
xerbla_("SPOSV ", &i__1);
return 0;
}
/* Compute the Cholesky factorization A = U'*U or A = L*L'. */
spotrf_(uplo, n, &a[a_offset], lda, info);
if (*info == 0) {
/* Solve the system A*X = B, overwriting B with X. */
spotrs_(uplo, n, nrhs, &a[a_offset], lda, &b[b_offset], ldb, info);
}
return 0;
/* End of SPOSV */
} /* sposv_ */
|
#ifndef _STATISTICS_TEST_DATA_H_
#define _STATISTICS_TEST_DATA_H_
/*--------------------------------------------------------------------------------*/
/* Includes */
/*--------------------------------------------------------------------------------*/
#include "arr_desc.h"
#include "arm_math.h"
/*--------------------------------------------------------------------------------*/
/* Macros and Defines */
/*--------------------------------------------------------------------------------*/
#define STATISTICS_MAX_INPUT_ELEMENTS 32
#define STATISTICS_BIGGEST_INPUT_TYPE float32_t
/*--------------------------------------------------------------------------------*/
/* Declare Variables */
/*--------------------------------------------------------------------------------*/
/* Input/Output Buffers */
ARR_DESC_DECLARE(statistics_output_fut);
ARR_DESC_DECLARE(statistics_output_ref);
extern uint32_t statistics_idx_fut;
extern uint32_t statistics_idx_ref;
extern STATISTICS_BIGGEST_INPUT_TYPE
statistics_output_f32_ref[STATISTICS_MAX_INPUT_ELEMENTS];
extern STATISTICS_BIGGEST_INPUT_TYPE
statistics_output_f32_fut[STATISTICS_MAX_INPUT_ELEMENTS];
/* Block Sizes */
ARR_DESC_DECLARE(statistics_block_sizes);
/* Float Inputs */
ARR_DESC_DECLARE(statistics_zeros);
ARR_DESC_DECLARE(statistics_f_2);
ARR_DESC_DECLARE(statistics_f_15);
ARR_DESC_DECLARE(statistics_f_32);
ARR_DESC_DECLARE(statistics_f_all);
#endif /* _STATISTICS_TEST_DATA_H_ */
|
/* Generated by CIL v. 1.7.0 */
/* print_CIL_Input is false */
struct _IO_FILE;
struct timeval;
extern float strtof(char const *str , char const *endptr ) ;
extern void signal(int sig , void *func ) ;
typedef struct _IO_FILE FILE;
extern int atoi(char const *s ) ;
extern double strtod(char const *str , char const *endptr ) ;
extern int fclose(void *stream ) ;
extern void *fopen(char const *filename , char const *mode ) ;
extern void abort() ;
extern void exit(int status ) ;
extern int raise(int sig ) ;
extern int fprintf(struct _IO_FILE *stream , char const *format , ...) ;
extern int strcmp(char const *a , char const *b ) ;
extern int rand() ;
extern unsigned long strtoul(char const *str , char const *endptr , int base ) ;
void RandomFunc(unsigned long input[1] , unsigned long output[1] ) ;
extern int strncmp(char const *s1 , char const *s2 , unsigned long maxlen ) ;
extern int gettimeofday(struct timeval *tv , void *tz , ...) ;
extern int printf(char const *format , ...) ;
int main(int argc , char *argv[] ) ;
void megaInit(void) ;
extern unsigned long strlen(char const *s ) ;
extern long strtol(char const *str , char const *endptr , int base ) ;
extern unsigned long strnlen(char const *s , unsigned long maxlen ) ;
extern void *memcpy(void *s1 , void const *s2 , unsigned long size ) ;
struct timeval {
long tv_sec ;
long tv_usec ;
};
extern void *malloc(unsigned long size ) ;
extern int scanf(char const *format , ...) ;
void megaInit(void)
{
{
}
}
void RandomFunc(unsigned long input[1] , unsigned long output[1] )
{
unsigned long state[1] ;
unsigned long local1 ;
unsigned short copy11 ;
unsigned short copy12 ;
unsigned int copy13 ;
char copy14 ;
unsigned short copy15 ;
unsigned int copy16 ;
{
state[0UL] = (input[0UL] & 914778474UL) << 7UL;
local1 = 0UL;
while (local1 < 1UL) {
if (state[0UL] > local1) {
if (state[0UL] > local1) {
copy11 = *((unsigned short *)(& state[0UL]) + 3);
*((unsigned short *)(& state[0UL]) + 3) = *((unsigned short *)(& state[0UL]) + 1);
*((unsigned short *)(& state[0UL]) + 1) = copy11;
copy12 = *((unsigned short *)(& state[local1]) + 0);
*((unsigned short *)(& state[local1]) + 0) = *((unsigned short *)(& state[local1]) + 2);
*((unsigned short *)(& state[local1]) + 2) = copy12;
} else {
state[local1] >>= ((state[local1] >> 3UL) & 7UL) | 1UL;
copy13 = *((unsigned int *)(& state[local1]) + 0);
*((unsigned int *)(& state[local1]) + 0) = *((unsigned int *)(& state[local1]) + 1);
*((unsigned int *)(& state[local1]) + 1) = copy13;
}
} else
if (state[0UL] <= local1) {
copy14 = *((char *)(& state[local1]) + 6);
*((char *)(& state[local1]) + 6) = *((char *)(& state[local1]) + 2);
*((char *)(& state[local1]) + 2) = copy14;
copy15 = *((unsigned short *)(& state[local1]) + 1);
*((unsigned short *)(& state[local1]) + 1) = *((unsigned short *)(& state[local1]) + 3);
*((unsigned short *)(& state[local1]) + 3) = copy15;
} else {
copy16 = *((unsigned int *)(& state[local1]) + 1);
*((unsigned int *)(& state[local1]) + 1) = *((unsigned int *)(& state[local1]) + 0);
*((unsigned int *)(& state[local1]) + 0) = copy16;
state[0UL] <<= ((state[0UL] >> 3UL) & 7UL) | 1UL;
}
local1 ++;
}
output[0UL] = state[0UL] | 6654727UL;
}
}
int main(int argc , char *argv[] )
{
unsigned long input[1] ;
unsigned long output[1] ;
int randomFuns_i5 ;
unsigned long randomFuns_value6 ;
int randomFuns_main_i7 ;
{
megaInit();
if (argc != 2) {
printf("Call this program with %i arguments\n", 1);
exit(-1);
} else {
}
randomFuns_i5 = 0;
while (randomFuns_i5 < 1) {
randomFuns_value6 = strtoul(argv[randomFuns_i5 + 1], 0, 10);
input[randomFuns_i5] = randomFuns_value6;
randomFuns_i5 ++;
}
RandomFunc(input, output);
if (output[0] == 4242424242UL) {
printf("You win!\n");
} else {
}
randomFuns_main_i7 = 0;
while (randomFuns_main_i7 < 1) {
printf("%lu\n", output[randomFuns_main_i7]);
randomFuns_main_i7 ++;
}
}
}
|
#import <UIKit/UIKit.h>
FOUNDATION_EXPORT double KaliVersionNumber;
FOUNDATION_EXPORT const unsigned char KaliVersionString[];
|
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#ifndef MPIVIS_H
#define MPIVIS_H
#ifdef _WIN32
#pragma once
#endif
void VVIS_SetupMPI( int argc, char **argv );
void RunMPIBasePortalVis();
void RunMPIPortalFlow();
#endif // MPIVIS_H
|
//
// FZKAPPMacro.h
// FZKTools
//
// Created by czl on 2017/3/21.
// Copyright © 2017年 chinapke. All rights reserved.
//
#ifndef FZKAPPMacro_h
#define FZKAPPMacro_h
//APP名字
#define APP_NAME ([[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"])
//APP版本号
#define APP_VERSION ([[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"])
//APP构建版本号
#define APP_BUILD ([[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"])
//APP budbleId
#define APP_Bundle_identifier ([[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"])
//APP当前语言
#define APP_CurrentLanguage ([[NSLocale preferredLanguages] objectAtIndex:0])
//获取屏幕宽度, 高度, 尺寸
#define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width
#define SCREENH_HEIGHT [UIScreen mainScreen].bounds.size.height
#define SCREEN_SIZE [UIScreen mainScreen].bounds.size
//常用缩写
#define kNotificationCenter [NSNotificationCenter defaultCenter]
#define kNSUserDefaults [NSUserDefaults standardUserDefaults]
/**************************************Log***************************************/
//自定义高效率的NSLog
//#ifdef DEBUG
//#define NSLog(format, ...) do { \
//fprintf(stderr, "<%s : 第%d行> %s\n", \
//[[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String], \
//__LINE__, __func__);\
//(NSLog)((format), ##__VA_ARGS__);\
//} while (0)
//#else
//#define NSLog(...)
//#endif
//debug输出rect,size和point的宏
#define NSLogRect(rect) NSLog(@"%s x:%.4f, y:%.4f, w:%.4f, h:%.4f", #rect, rect.origin.x, rect.origin.y, rect.size.width, rect.size.height)
#define NSLogSize(size) NSLog(@"%s w:%.4f, h:%.4f", #size, size.width, size.height)
#define NSLogPoint(point) NSLog(@"%s x:%.4f, y:%.4f", #point, point.x, point.y)
#define Color_Pink RGBA(255, 85, 95, 1)
#define RGBA(R/*红*/, G/*绿*/, B/*蓝*/, A/*透明*/) \
[UIColor colorWithRed:R/255.f green:G/255.f blue:B/255.f alpha:A]
#define Font(x) [UIFont systemFontOfSize:x]
/**************************************设备***************************************/
//判断是否为iPhone
#define IS_IPhone (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
//判断是否为iPad
#define IS_IPad (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
//判断是否为ipod
#define IS_IPod ([[[UIDevice currentDevice] model] isEqualToString:@"iPod touch"])
// 判断是否为 iPhone 5SE
#define iPhone5SE [[UIScreen mainScreen] bounds].size.width == 320.0f && [[UIScreen mainScreen] bounds].size.height == 568.0f
// 判断是否为iPhone 6/6s
#define iPhone6_6s [[UIScreen mainScreen] bounds].size.width == 375.0f && [[UIScreen mainScreen] bounds].size.height == 667.0f
// 判断是否为iPhone 6Plus/6sPlus
#define iPhone6Plus_6sPlus [[UIScreen mainScreen] bounds].size.width == 414.0f && [[UIScreen mainScreen] bounds].size.height == 736.0f
//获取系统版本
#define IOS_SYSTEM_VERSION [[[UIDevice currentDevice] systemVersion] floatValue]
//判断 iOS 8 或更高的系统版本
#define IOS_VERSION_8_OR_LATER (([[[UIDevice currentDevice] systemVersion] floatValue] >=8.0)? (YES):(NO))
/**************************************沙盒目录文件***************************************/
//获取temp
#define kPathTemp NSTemporaryDirectory()
//获取沙盒 Document
#define kPathDocument [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject]
//获取沙盒 Cache
#define kPathCache [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject]
/**
* 设置 view 圆角和边框
*/
#define FUNC_BorderRadius(View, Radius, Width, Color)\
\
[View.layer setCornerRadius:(Radius)];\
[View.layer setMasksToBounds:YES];\
[View.layer setBorderWidth:(Width)];\
[View.layer setBorderColor:[Color CGColor]]
/**
* 结束上下拉刷新
*/
#define FUNC_EndMJRefresh(tableView) \
if ([tableView.mj_header isRefreshing]) { \
[tableView.mj_header endRefreshing]; \
} \
\
if ([tableView.mj_footer isRefreshing]) { \
[tableView.mj_footer endRefreshing]; \
}
#ifdef __OBJC__
#pragma mark - 单例模式 .h文件内容
#define SingleInterface(name) +(instancetype)share##name;
#pragma mark - 单例模式 .m文件内容
#if __has_feature(objc_arc)
#define SingleImplementation(name) +(instancetype)share##name {return [[self alloc]init];} \
+ (instancetype)allocWithZone:(struct _NSZone *)zone { \
static id instance; \
static dispatch_once_t onceToken; \
dispatch_once(&onceToken, ^{ \
instance = [super allocWithZone:zone]; \
}); \
return instance; \
} \
- (id)copyWithZone:(NSZone *)zone{return self;} \
- (id)mutableCopyWithZone:(NSZone *)zone {return self;}
#else
#define SingleImplementation(name) +(instancetype)share##name {return [[self alloc]init];} \
+ (instancetype)allocWithZone:(struct _NSZone *)zone { \
static id instance; \
static dispatch_once_t onceToken; \
dispatch_once(&onceToken, ^{ \
instance = [super allocWithZone:zone]; \
}); \
return instance; \
} \
- (id)copyWithZone:(NSZone *)zone{return self;} \
- (id)mutableCopyWithZone:(NSZone *)zone {return self;} \
- (instancetype)retain {return self;} \
- (instancetype)autorelease {return self;} \
- (oneway void)release {} \
- (NSUInteger)retainCount {return MAXFLOAT;} \
#endif
#endif
#endif /* FZKAPPMacro_h */
|
/*============================================================================*/
/*
VFLib: https://github.com/vinniefalco/VFLib
Copyright (C) 2008 by Vinnie Falco <vinnie.falco@gmail.com>
This library contains portions of other open source products covered by
separate licenses. Please see the corresponding source files for specific
terms.
VFLib is provided under the terms of The MIT License (MIT):
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 VF_FIFOFREESTOREWITHTLS_VFHEADER
#define VF_FIFOFREESTOREWITHTLS_VFHEADER
#include "vf_GlobalPagedFreeStore.h"
/*============================================================================*/
/**
Lock-free and mostly wait-free FIFO memory allocator.
This allocator is suitable for use with CallQueue and Listeners. It is
expected that over time, deallocations will occur in roughly the same order
as allocations.
@note This implementation uses Thread Local Storage to further improve
performance. However, it requires boost style thread_specific_ptr.
@invariant allocate() and deallocate() are fully concurrent.
@invariant The ABA problem is handled automatically.
@ingroup vf_concurrent
*/
class FifoFreeStoreWithTLS
{
public:
FifoFreeStoreWithTLS ();
~FifoFreeStoreWithTLS ();
void* allocate (const size_t bytes);
static void deallocate (void* const p);
private:
typedef GlobalPagedFreeStore PagedFreeStoreType;
struct Header;
class Page;
inline Page* newPage ();
static inline void deletePage (Page* page);
private:
class PerThreadData;
boost::thread_specific_ptr <PerThreadData> m_tsp;
PagedFreeStoreType::Ptr m_pages;
};
#endif
|
//
// MWKListBaseTests.h
// Wikipedia
//
// Created by Brian Gerstle on 10/14/15.
// Copyright © 2015 Wikimedia Foundation. All rights reserved.
//
@import XCTest;
#import "MWKList+Subclass.h"
NS_ASSUME_NONNULL_BEGIN
/**
* Base class for verifying universal behaviors which should hold for an @c MWKList or subclass.
*/
@interface MWKListTestBase : XCTestCase
/// An array of test objects created in @c setUp.
@property (nonatomic, strong, nullable) NSArray* testObjects;
/**
* @return A unique entry object for use with the receiver's @c listClass.
*/
+ (id)uniqueListEntry;
/**
* The @c MWKList subclass to exercise in the receiver's tests.
*
* @return A class which is @c MWKList or one of its specialized subclasses.
*/
+ (Class)listClass;
/**
* Create a list with the given entries.
*
* Override this method if your @c MWKList subclass has other initializer parameters.
*
* @param entries The entries to pass to @c initWithEntries:
*
* @return A new @c MWKList (or subclass) initialized with the given entries.
*/
- (MWKList*)listWithEntries:(nullable NSArray*)entries;
@end
/**
* Dummy entry class used when testing a generic @c MWKList.
*/
@interface MWKListDummyEntry : NSObject<MWKListObject>
@property (nonatomic, strong) NSString* listIndex;
@end
NS_ASSUME_NONNULL_END
|
/*链栈*/
//http://www.cnblogs.com/w784319947/p/6429634.html
/*链栈的结构和各种基本操作都类似于线性链表
*只是要注意它的插入和删除操作只能在栈顶进行
*为了方便操作,我们将链表的头部作为栈顶
*/
#include<stdio.h>
#include<stdlib.h>
//结构定义
typedef struct node
{
elementType data;
struct node *next;
} LSNode;//链栈节点
typedef struct
{
struct LSNode *top;
int size;
}*PSTACK;//链栈
typedef int elementType;
//基本操作
//注意:配合CreatStack(),应该有DisposeStack(PSTACK)
PSTACK CreatStack()
{
PSTACK p=NULL;
p=(PSTACK)malloc(sizeof(*PSTACK));
if(p==NULL)
{
printf("Cannot malloc for PSTACK\n");
//根据内存分配失败,业务是否还能进行选择
//return NULL;
exit(1);
}
else
{
p->top=NULL;
p->size=0;
return p;
}
}
int IsEmpty(PSTACK s)
{
if(s==NULL)
return 1;
else
return 0;
}
void PopStack(PSTACK s)//出栈
{
if(IsEmpty(s))
{
printf("Stack is Empty\n");
}
else
{
LSNode*p=NULL;
p=s->top->next;
free(s->top);
s->top=p;
s->size--;
}
}
void MakeEmptyStack(PSTACK s)//清空栈
{
while(s->top!=NULL)
{
//PopStack()中有重复判断,不爽大可以重写
PopStack(s);
}
}
void DisposeStack(PSTACK s)//删除栈
{
MakeEmptyStack(s);
free(s);
}
void PushStack(elementType x, PSTACK s)//压栈,入栈
{
LSNode*p=NULL;
p=(LSNode*)malloc(sizeof(LSNode));
if(p==NULL)
{
printf("Cannot malloc for LSNode\n");
//根据内存分配失败,业务是否还能进行选择
//return NULL;
exit(1);
}
p->data=x;
p->next=s->top;
s->top=p;
s->size++;
}
elementType TopStack(PSTACK s)//取栈顶元素
{
if(s->top==NULL)
return NULL;
else
return s->top->data;
}
elementType TopAndPop(PSTACK s)//取栈顶元素,并出栈(栈空时返回NULL)
{
//因为使用此函数前提是已经判断了栈非空,这里不做重复判断
elementType x;
x=TopStack(s);
PopStack(s);
return x;
} |
/*-------------------------------------------------------------------------
*
* palloc.h
* POSTGRES memory allocator definitions.
*
* This file contains the basic memory allocation interface that is
* needed by almost every backend module. It is included directly by
* postgres.h, so the definitions here are automatically available
* everywhere. Keep it lean!
*
* Memory allocation occurs within "contexts". Every chunk obtained from
* palloc()/MemoryContextAlloc() is allocated within a specific context.
* The entire contents of a context can be freed easily and quickly by
* resetting or deleting the context --- this is both faster and less
* prone to memory-leakage bugs than releasing chunks individually.
* We organize contexts into context trees to allow fine-grain control
* over chunk lifetime while preserving the certainty that we will free
* everything that should be freed. See utils/mmgr/README for more info.
*
*
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/utils/palloc.h,v 1.38 2008/01/01 19:45:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef PALLOC_H
#define PALLOC_H
/*
* Type MemoryContextData is declared in nodes/memnodes.h. Most users
* of memory allocation should just treat it as an abstract type, so we
* do not provide the struct contents here.
*/
typedef struct MemoryContextData *MemoryContext;
/*
* CurrentMemoryContext is the default allocation context for palloc().
* We declare it here so that palloc() can be a macro. Avoid accessing it
* directly! Instead, use MemoryContextSwitchTo() to change the setting.
*/
extern PGDLLIMPORT MemoryContext CurrentMemoryContext;
/*
* Fundamental memory-allocation operations (more are in utils/memutils.h)
*/
extern void *MemoryContextAlloc(MemoryContext context, Size size);
extern void *MemoryContextAllocZero(MemoryContext context, Size size);
extern void *MemoryContextAllocZeroAligned(MemoryContext context, Size size);
#define palloc(sz) MemoryContextAlloc(CurrentMemoryContext, (sz))
#define palloc0(sz) MemoryContextAllocZero(CurrentMemoryContext, (sz))
/*
* The result of palloc() is always word-aligned, so we can skip testing
* alignment of the pointer when deciding which MemSet variant to use.
* Note that this variant does not offer any advantage, and should not be
* used, unless its "sz" argument is a compile-time constant; therefore, the
* issue that it evaluates the argument multiple times isn't a problem in
* practice.
*/
#define palloc0fast(sz) \
( MemSetTest(0, sz) ? \
MemoryContextAllocZeroAligned(CurrentMemoryContext, sz) : \
MemoryContextAllocZero(CurrentMemoryContext, sz) )
extern void pfree(void *pointer);
extern void *repalloc(void *pointer, Size size);
/*
* MemoryContextSwitchTo can't be a macro in standard C compilers.
* But we can make it an inline function when using GCC.
*/
#ifdef __GNUC__
static __inline__ MemoryContext
MemoryContextSwitchTo(MemoryContext context)
{
MemoryContext old = CurrentMemoryContext;
CurrentMemoryContext = context;
return old;
}
#else
extern MemoryContext MemoryContextSwitchTo(MemoryContext context);
#endif /* __GNUC__ */
/*
* These are like standard strdup() except the copied string is
* allocated in a context, not with malloc().
*/
extern char *MemoryContextStrdup(MemoryContext context, const char *string);
#define pstrdup(str) MemoryContextStrdup(CurrentMemoryContext, (str))
#if defined(WIN32) || defined(__CYGWIN__)
extern void *pgport_palloc(Size sz);
extern char *pgport_pstrdup(const char *str);
extern void pgport_pfree(void *pointer);
#endif
#endif /* PALLOC_H */
|
/* cosf4 - Computes the cosine of each of the four slots by using a polynomial approximation
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
All rights reserved.
Redistribution and use in source and binary forms,
with or without modification, are permitted provided that the
following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Sony Computer Entertainment Inc nor the names
of its contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ___SIMD_MATH_COSF4_H___
#define ___SIMD_MATH_COSF4_H___
#include <simdmath.h>
#include <spu_intrinsics.h>
#include <simdmath/_sincosf4.h>
static inline vector float
_cosf4 (vector float x)
{
vec_float4 s, c;
_sincosf4(x, &s, &c);
return c;
}
#endif
|
// RUN: %tool "%s" > "%t"
// RUN: %diff %CORRECT "%t"
int main()
{
int i;
int j;
i=0;
j=1;
while(i < 5)
{
i = i + j;
if(1)
{
j=2;
}
else
{
j=1;
}
assert(j==2);
}
return 0;
}
|
/*
* gmisc.c: Misc functions with no place to go (right now)
*
* Author:
* Aaron Bockover (abockover@novell.com)
*
* (C) 2006 Novell, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <config.h>
#include <stdlib.h>
#include <glib.h>
#include <pthread.h>
#ifdef HAVE_PWD_H
#include <pwd.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
const gchar *
g_getenv(const gchar *variable)
{
return getenv(variable);
}
gboolean
g_setenv(const gchar *variable, const gchar *value, gboolean overwrite)
{
return setenv(variable, value, overwrite) == 0;
}
void
g_unsetenv(const gchar *variable)
{
unsetenv(variable);
}
gchar*
g_win32_getlocale(void)
{
return NULL;
}
gboolean
g_path_is_absolute (const char *filename)
{
g_return_val_if_fail (filename != NULL, FALSE);
return (*filename == '/');
}
static pthread_mutex_t pw_lock = PTHREAD_MUTEX_INITIALIZER;
static const gchar *home_dir;
static const gchar *user_name;
static void
get_pw_data (void)
{
#ifdef HAVE_GETPWUID_R
struct passwd pw;
struct passwd *result;
char buf [4096];
#endif
if (user_name != NULL)
return;
pthread_mutex_lock (&pw_lock);
if (user_name != NULL) {
pthread_mutex_unlock (&pw_lock);
return;
}
#ifdef HAVE_GETPWUID_R
if (getpwuid_r (getuid (), &pw, buf, 4096, &result) == 0) {
home_dir = g_strdup (pw.pw_dir);
user_name = g_strdup (pw.pw_name);
}
#endif
if (home_dir == NULL)
home_dir = g_getenv ("HOME");
if (user_name == NULL) {
user_name = g_getenv ("USER");
if (user_name == NULL)
user_name = "somebody";
}
pthread_mutex_unlock (&pw_lock);
}
/* Give preference to /etc/passwd than HOME */
const gchar *
g_get_home_dir (void)
{
get_pw_data ();
return home_dir;
}
const char *
g_get_user_name (void)
{
get_pw_data ();
return user_name;
}
static const char *tmp_dir;
static pthread_mutex_t tmp_lock = PTHREAD_MUTEX_INITIALIZER;
const gchar *
g_get_tmp_dir (void)
{
if (tmp_dir == NULL){
pthread_mutex_lock (&tmp_lock);
if (tmp_dir == NULL){
tmp_dir = g_getenv ("TMPDIR");
if (tmp_dir == NULL){
tmp_dir = g_getenv ("TMP");
if (tmp_dir == NULL){
tmp_dir = g_getenv ("TEMP");
if (tmp_dir == NULL)
tmp_dir = "/tmp";
}
}
}
pthread_mutex_unlock (&tmp_lock);
}
return tmp_dir;
}
|
#ifndef LBMDEM_SETTINGS_H_
#define LBMDEM_SETTINGS_H_
#include <type_traits>
#include <typeinfo>
namespace lbmdem {
//! Define single or double precision
using Real = double;
//! Switch between 64bit and 32bit integers
using Lint = long long;
}
#endif //LBMDEM_SETTINGS_H_
|
/*
This file is part of WME Lite.
http://dead-code.org/redir.php?target=wmelite
Copyright (c) 2011 Jan Nedoma
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 __WmeBObject_H__
#define __WmeBObject_H__
#include "SDL.h"
class CBSprite;
class CBSound;
class CBSurface;
class CBObject : public CBScriptHolder
{
public:
TSpriteBlendMode m_BlendMode;
virtual HRESULT AfterMove();
float m_RelativeRotate;
bool m_RotateValid;
float m_Rotate;
void SetSoundEvent(char* EventName);
bool m_Rotatable;
DWORD m_AlphaColor;
float m_Scale;
float m_ScaleX;
float m_ScaleY;
float m_RelativeScale;
virtual bool IsReady();
virtual bool GetExtendedFlag(char* FlagName);
virtual HRESULT ResetSoundPan();
virtual HRESULT UpdateSounds();
HRESULT UpdateOneSound(CBSound* Sound);
bool m_AutoSoundPanning;
DWORD m_SFXStart;
int m_SFXVolume;
HRESULT SetSFXTime(DWORD Time);
HRESULT SetSFXVolume(int Volume);
HRESULT ResumeSFX();
HRESULT PauseSFX();
HRESULT StopSFX(bool DeleteSound=true);
HRESULT PlaySFX(char* Filename, bool Looping=false, bool PlayNow=true, char* EventName=NULL, DWORD LoopStart=0);
CBSound* m_SFX;
TSFXType m_SFXType;
float m_SFXParam1;
float m_SFXParam2;
float m_SFXParam3;
float m_SFXParam4;
virtual bool HandleMouseWheel(int Delta);
virtual HRESULT HandleMouse(TMouseEvent Event, TMouseButton Button);
virtual bool HandleKeypress(SDL_Event* event);
virtual int GetHeight();
HRESULT SetCursor(char* Filename);
HRESULT SetActiveCursor(char* Filename);
HRESULT Cleanup();
char* GetCaption(int Case=1);
void SetCaption(char* Caption, int Case=1);
bool m_EditorSelected;
bool m_EditorAlwaysRegister;
bool m_EditorOnly;
bool m_Is3D;
DECLARE_PERSISTENT(CBObject, CBScriptHolder);
virtual HRESULT ShowCursor();
CBSprite* m_Cursor;
bool m_SharedCursors;
CBSprite* m_ActiveCursor;
virtual HRESULT SaveAsText(CBDynBuffer* Buffer, int Indent);
virtual HRESULT Listen(CBScriptHolder* param1, DWORD param2);
bool m_Ready;
bool m_Registrable;
bool m_Zoomable;
bool m_Shadowable;
RECT m_Rect;
bool m_RectSet;
int m_ID;
bool m_Movable;
CBObject(CBGame* inGame);
virtual ~CBObject();
char* m_Caption[7];
char* m_SoundEvent;
int m_PosY;
int m_PosX;
bool m_SaveState;
// base
virtual HRESULT Update() { return E_FAIL; };
virtual HRESULT Display() { return E_FAIL; };
virtual HRESULT InvalidateDeviceObjects() { return S_OK; };
virtual HRESULT RestoreDeviceObjects() { return S_OK; };
bool m_NonIntMouseEvents;
public:
// scripting interface
virtual CScValue* ScGetProperty(char* Name);
virtual HRESULT ScSetProperty(char *Name, CScValue *Value);
virtual HRESULT ScCallMethod(CScScript* Script, CScStack *Stack, CScStack *ThisStack, char *Name);
virtual char* ScToString();
};
#endif
|
#if !defined(GIGASECOND_H)
#define GIGASECOND_H
namespace gigasecond {
} // namespace gigasecond
#endif // GIGASECOND_H |
/* IupGetFile: Example in C
Shows a typical file-selection dialog.
*/
#include <stdlib.h>
#include <stdio.h>
#include <iup.h>
int main(int argc, char **argv)
{
char file[256];
IupOpen(&argc, &argv);
IupSetLanguage("ENGLISH");
strcpy(file, "*.txt");
switch(IupGetFile(file))
{
case 1:
IupMessage("New file",file);
break;
case 0 :
IupMessage("File already exists",file);
break;
case -1 :
IupMessage("IupFileDlg","Operation canceled");
return 1;
case -2 :
IupMessage("IupFileDlg","Allocation error");
return 1;
case -3 :
IupMessage("IupFileDlg","Invalid parameter");
return 1;
break;
}
IupClose();
return EXIT_SUCCESS;
} |
/*
* Copyright (c) 2013, ETH Zurich.
* All rights reserved.
*
* This file is distributed under the terms in the attached LICENSE file.
* If you do not find this file, copies can be found by writing to:
* ETH Zurich D-INFK, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group.
*/
#ifndef BULK_TRANSFER_HELPERS_H
#define BULK_TRANSFER_HELPERS_H
#include <bulk_transfer/bulk_transfer.h>
static inline enum bulk_channel_role bulk_role_other(
enum bulk_channel_role role)
{
if (role == BULK_ROLE_MASTER) {
return BULK_ROLE_SLAVE;
} else if (role == BULK_ROLE_SLAVE){
return BULK_ROLE_MASTER;
} else {
/* XXX: What do we do with that? */
return BULK_ROLE_GENERIC;
}
}
static inline enum bulk_channel_direction bulk_direction_other(
enum bulk_channel_direction direction)
{
if (direction == BULK_DIRECTION_TX) {
return BULK_DIRECTION_RX;
} else {
return BULK_DIRECTION_TX;
}
}
// Can we trust auto-assigned values to enums? better make this explicit here
static inline int bulk_trust_value(enum bulk_trust_level t)
{
switch(t) {
case BULK_TRUST_NONE: return 0;
case BULK_TRUST_HALF: return 1;
case BULK_TRUST_FULL: return 2;
default: assert(!"Badness");
// BULK_TRUST_UNINITIALIZED and other surprises
}
return -1;
}
/**
* \brief Compare trust levels.
*
* @return: -1 lhs lower trust than rhs
* 0 trust levels match
* +1 lhs higher trust than rhs
*/
static inline int bulk_trust_compare(enum bulk_trust_level lhs,
enum bulk_trust_level rhs)
{
int l_n = bulk_trust_value(lhs);
int r_n = bulk_trust_value(rhs);
if (l_n < r_n) {
return -1;
}
if (l_n == r_n) {
return 0;
}
return 1;
}
#endif // BULK_TRANSFER_HELPERS_H
|
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "util.h"
int
main(int argc, char *argv[])
{
char *tty;
setprogname(argv[0]);
argc--, argv++;
if (!(tty = ttyname(STDIN_FILENO)))
err(1, "ttyname");
puts(tty);
return (ioshut());
}
|
/*
)
(.)
.|.
| |
_.--| |--._
.-'; ;`-'& ; `&.
\ & ; & &_/
|"""---...---"""|
\ | | | | | | | /
`---.|.|.|.---'
* This file is generated by bake.lang.c for your convenience. Headers of
* dependencies will automatically show up in this file. Include bake_config.h
* in your main project file. Do not edit! */
#ifndef CORTO_C_BAKE_CONFIG_H
#define CORTO_C_BAKE_CONFIG_H
/* Headers of public dependencies */
#include <corto>
#include <bake.util>
/* Headers of private dependencies */
#ifdef CORTO_C_IMPL
/* No dependencies */
#endif
/* Convenience macro for exporting symbols */
#if CORTO_C_IMPL && defined _MSC_VER
#define CORTO_C_EXPORT __declspec(dllexport)
#elif CORTO_C_IMPL
#define CORTO_C_EXPORT __attribute__((__visibility__("default")))
#elif defined _MSC_VER
#define CORTO_C_EXPORT __declspec(dllimport)
#else
#define CORTO_C_EXPORT
#endif
#endif
|
/*******************************************************************************
System Tasks File
File Name:
system_tasks.c
Summary:
This file contains source code necessary to maintain system's polled state
machines.
Description:
This file contains source code necessary to maintain system's polled state
machines. It implements the "SYS_Tasks" function that calls the individual
"Tasks" functions for all polled MPLAB Harmony modules in the system.
Remarks:
This file requires access to the systemObjects global data structure that
contains the object handles to all MPLAB Harmony module objects executing
polled in the system. These handles are passed into the individual module
"Tasks" functions to identify the instance of the module to maintain.
*******************************************************************************/
// DOM-IGNORE-BEGIN
/*******************************************************************************
Copyright (c) 2013-2015 released Microchip Technology Inc. All rights reserved.
Microchip licenses to you the right to use, modify, copy and distribute
Software only when embedded on a Microchip microcontroller or digital signal
controller that is integrated into your product or third party product
(pursuant to the sublicense terms in the accompanying license agreement).
You should refer to the license agreement accompanying this Software for
additional information regarding your rights and obligations.
SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER
CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR
OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR
CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF
SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
*******************************************************************************/
// DOM-IGNORE-END
// *****************************************************************************
// *****************************************************************************
// Section: Included Files
// *****************************************************************************
// *****************************************************************************
#include "system_config.h"
#include "system_definitions.h"
// *****************************************************************************
// *****************************************************************************
// Section: System "Tasks" Routine
// *****************************************************************************
// *****************************************************************************
/*******************************************************************************
Function:
void SYS_Tasks ( void )
Remarks:
See prototype in system/common/sys_module.h.
*/
void SYS_Tasks ( void )
{
/* Maintain system services */
/* SYS_COMMAND layer tasks routine */
SYS_CMD_Tasks();
SYS_CONSOLE_Tasks(sysObj.sysConsole0);
SYS_DEVCON_Tasks(sysObj.sysDevcon);
/* SYS_TMR Device layer tasks routine */
SYS_TMR_Tasks(sysObj.sysTmr);
/* Maintain Device Drivers */
/* Maintain Middleware & Other Libraries */
NET_PRES_Tasks(sysObj.netPres);
/* Maintain the TCP/IP Stack*/
TCPIP_STACK_Task(sysObj.tcpip);
/* USB FS Driver Task Routine */
DRV_USBFS_Tasks(sysObj.drvUSBObject);
/* USB Device layer tasks routine */
USB_DEVICE_Tasks(sysObj.usbDevObject0);
/* Maintain the application's state machine. */
APP_Tasks();
}
/*******************************************************************************
End of File
*/
|
/* include the COIN-wide system specific configure header */
#include "configall_system.h"
/* include the public project specific macros */
#include "config_dco_default.h"
/***************************************************************************/
/* HERE DEFINE THE PROJECT SPECIFIC MACROS */
/* These are only in effect in a setting that doesn't use configure */
/***************************************************************************/
/* Define to the debug sanity check level (0 is no test) */
#define COIN_BLIS_CHECKLEVEL 0
/* Define to the debug verbosity level (0 is no output) */
#define COIN_BLIS_VERBOSITY 0
/* Define to 1 if the ALPS package is used */
#define COIN_HAS_ALPS 1
/* Define to 1 if the BiCePS package is used */
#define COIN_HAS_BCPS 1
/* Define to 1 if the Blis package is used */
#define COIN_HAS_DISCO 1
/* Define to 1 if the CoinUtils package is used */
#define COIN_HAS_COINUTILS 1
/* Define to 1 if the Clp package is used */
#define COIN_HAS_CLP 1
|
#ifndef tokens_h
#define tokens_h
/* tokens.h -- List of labelled tokens and stuff
*
* Generated from: sor.g
*
* Terence Parr, Will Cohen, and Hank Dietz: 1989-2001
* Purdue University Electrical Engineering
* ANTLR Version 1.33MR33
*/
#define zzEOF_TOKEN 1
#define Eof 1
#define RExpr 2
#define Action 27
#define PassAction 28
#define Header 65
#define Tokdef 66
#define BLOCK 67
#define ALT 68
#define LABEL 69
#define OPT 70
#define POS_CLOSURE 71
#define CLOSURE 72
#define WILD 73
#define PRED_OP 74
#define BT 75
#define RULE 76
#define REFVAR 77
#define NonTerm 82
#define Token 83
#define ID 108
#define INT 109
#ifdef __USE_PROTOS
void sordesc(AST**_root);
#else
extern void sordesc();
#endif
#ifdef __USE_PROTOS
void header(AST**_root);
#else
extern void header();
#endif
#ifdef __USE_PROTOS
void tokdef(AST**_root);
#else
extern void tokdef();
#endif
#ifdef __USE_PROTOS
void class_def(AST**_root);
#else
extern void class_def();
#endif
#ifdef __USE_PROTOS
void rule(AST**_root);
#else
extern void rule();
#endif
#ifdef __USE_PROTOS
void block(AST**_root,int no_copy);
#else
extern void block();
#endif
#ifdef __USE_PROTOS
void alt(AST**_root,int no_copy);
#else
extern void alt();
#endif
#ifdef __USE_PROTOS
void element(AST**_root,int no_copy);
#else
extern void element();
#endif
#ifdef __USE_PROTOS
void labeled_element(AST**_root,int no_copy);
#else
extern void labeled_element();
#endif
#ifdef __USE_PROTOS
void token(AST**_root,int no_copy);
#else
extern void token();
#endif
#ifdef __USE_PROTOS
void tree(AST**_root,int no_copy);
#else
extern void tree();
#endif
#ifdef __USE_PROTOS
void enum_file(AST**_root);
#else
extern void enum_file();
#endif
#ifdef __USE_PROTOS
void defines(AST**_root);
#else
extern void defines();
#endif
#ifdef __USE_PROTOS
void enum_def(AST**_root);
#else
extern void enum_def();
#endif
#endif
extern SetWordType zzerr1[];
extern SetWordType zzerr2[];
extern SetWordType setwd1[];
extern SetWordType zzerr3[];
extern SetWordType zzerr4[];
extern SetWordType zzerr5[];
extern SetWordType zzerr6[];
extern SetWordType zzerr7[];
extern SetWordType zzerr8[];
extern SetWordType setwd2[];
extern SetWordType zzerr9[];
extern SetWordType zzerr10[];
extern SetWordType zzerr11[];
extern SetWordType zzerr12[];
extern SetWordType zzerr13[];
extern SetWordType setwd3[];
extern SetWordType zzerr14[];
extern SetWordType zzerr15[];
extern SetWordType zzerr16[];
extern SetWordType zzerr17[];
extern SetWordType zzerr18[];
extern SetWordType zzerr19[];
extern SetWordType zzerr20[];
extern SetWordType zzerr21[];
extern SetWordType zzerr22[];
extern SetWordType setwd4[];
extern SetWordType zzerr23[];
extern SetWordType zzerr24[];
extern SetWordType zzerr25[];
extern SetWordType zzerr26[];
extern SetWordType zzerr27[];
extern SetWordType zzerr28[];
extern SetWordType zzerr29[];
extern SetWordType setwd5[];
extern SetWordType zzerr30[];
extern SetWordType zzerr31[];
extern SetWordType zzerr32[];
extern SetWordType zzerr33[];
extern SetWordType zzerr34[];
extern SetWordType zzerr35[];
extern SetWordType zzerr36[];
extern SetWordType zzerr37[];
extern SetWordType zzerr38[];
extern SetWordType zzerr39[];
extern SetWordType setwd6[];
extern SetWordType zzerr40[];
extern SetWordType zzerr41[];
extern SetWordType zzerr42[];
extern SetWordType zzerr43[];
extern SetWordType setwd7[];
extern SetWordType zzerr44[];
extern SetWordType zzerr45[];
extern SetWordType zzerr46[];
extern SetWordType zzerr47[];
extern SetWordType zzerr48[];
extern SetWordType setwd8[];
|
/*
* Asterisk -- An open source telephony toolkit.
*
* Copyright (C) 1999 - 2005, Digium, Inc.
*
* Mark Spencer <markster@digium.com>
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2. See the LICENSE file
* at the top of the source tree.
*/
/*! \file
*
* \brief codec_ulaw.c - translate between signed linear and ulaw
*
* \ingroup codecs
*/
/*** MODULEINFO
<support_level>core</support_level>
***/
#include "asterisk.h"
ASTERISK_FILE_VERSION(__FILE__, "$Revision: 328247 $")
#include "asterisk/module.h"
#include "asterisk/config.h"
#include "asterisk/translate.h"
#include "asterisk/ulaw.h"
#include "asterisk/utils.h"
#define BUFFER_SAMPLES 8096 /* size for the translation buffers */
/* Sample frame data */
#include "asterisk/slin.h"
#include "ex_ulaw.h"
/*! \brief convert and store samples in outbuf */
static int ulawtolin_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
{
int i = f->samples;
unsigned char *src = f->data.ptr;
int16_t *dst = pvt->outbuf.i16 + pvt->samples;
pvt->samples += i;
pvt->datalen += i * 2; /* 2 bytes/sample */
/* convert and copy in outbuf */
while (i--)
*dst++ = AST_MULAW(*src++);
return 0;
}
/*! \brief convert and store samples in outbuf */
static int lintoulaw_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
{
int i = f->samples;
char *dst = pvt->outbuf.c + pvt->samples;
int16_t *src = f->data.ptr;
pvt->samples += i;
pvt->datalen += i; /* 1 byte/sample */
while (i--)
*dst++ = AST_LIN2MU(*src++);
return 0;
}
/*!
* \brief The complete translator for ulawToLin.
*/
static struct ast_translator ulawtolin = {
.name = "ulawtolin",
.framein = ulawtolin_framein,
.sample = ulaw_sample,
.buffer_samples = BUFFER_SAMPLES,
.buf_size = BUFFER_SAMPLES * 2,
};
static struct ast_translator testlawtolin = {
.name = "testlawtolin",
.framein = ulawtolin_framein,
.sample = ulaw_sample,
.buffer_samples = BUFFER_SAMPLES,
.buf_size = BUFFER_SAMPLES * 2,
};
/*!
* \brief The complete translator for LinToulaw.
*/
static struct ast_translator lintoulaw = {
.name = "lintoulaw",
.framein = lintoulaw_framein,
.sample = slin8_sample,
.buf_size = BUFFER_SAMPLES,
.buffer_samples = BUFFER_SAMPLES,
};
static struct ast_translator lintotestlaw = {
.name = "lintotestlaw",
.framein = lintoulaw_framein,
.sample = slin8_sample,
.buf_size = BUFFER_SAMPLES,
.buffer_samples = BUFFER_SAMPLES,
};
static int reload(void)
{
return AST_MODULE_LOAD_SUCCESS;
}
static int unload_module(void)
{
int res;
res = ast_unregister_translator(&lintoulaw);
res |= ast_unregister_translator(&ulawtolin);
res |= ast_unregister_translator(&testlawtolin);
res |= ast_unregister_translator(&lintotestlaw);
return res;
}
static int load_module(void)
{
int res;
ast_format_set(&lintoulaw.src_format, AST_FORMAT_SLINEAR, 0);
ast_format_set(&lintoulaw.dst_format, AST_FORMAT_ULAW, 0);
ast_format_set(&lintotestlaw.src_format, AST_FORMAT_SLINEAR, 0);
ast_format_set(&lintotestlaw.dst_format, AST_FORMAT_TESTLAW, 0);
ast_format_set(&ulawtolin.src_format, AST_FORMAT_ULAW, 0);
ast_format_set(&ulawtolin.dst_format, AST_FORMAT_SLINEAR, 0);
ast_format_set(&testlawtolin.src_format, AST_FORMAT_TESTLAW, 0);
ast_format_set(&testlawtolin.dst_format, AST_FORMAT_SLINEAR, 0);
res = ast_register_translator(&ulawtolin);
if (!res) {
res = ast_register_translator(&lintoulaw);
res |= ast_register_translator(&lintotestlaw);
res |= ast_register_translator(&testlawtolin);
} else
ast_unregister_translator(&ulawtolin);
if (res)
return AST_MODULE_LOAD_FAILURE;
return AST_MODULE_LOAD_SUCCESS;
}
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "mu-Law Coder/Decoder",
.load = load_module,
.unload = unload_module,
.reload = reload,
);
|
// Grapple H file
void GrapCreateBolt( edict_t *pEntity );
void GrapPrecache();
void GrapSpawn( edict_t *pent );
void GrapTouch ( edict_t *pent, edict_t *pentTouch );
void GrapThink( edict_t *pent );
void GrapRelease( edict_t *pent );
void GrapHang( edict_t *pent );
|
/*
* arch/i386/mach-generic/topology.c - Populate driverfs with topology information
*
* Written by: Matthew Dobson, IBM Corporation
* Original Code: Paul Dorwin, IBM Corporation, Patrick Mochel, OSDL
*
* Copyright (C) 2002, IBM Corp.
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; 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, GOOD TITLE or
* NON INFRINGEMENT. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Send feedback to <colpatch@us.ibm.com>
*/
#include <linux/init.h>
#include <linux/smp.h>
#include <asm/cpu.h>
struct i386_cpu cpu_devices[NR_CPUS];
#ifdef CONFIG_NUMA
#include <linux/mmzone.h>
#include <asm/node.h>
#include <asm/memblk.h>
struct i386_node node_devices[MAX_NUMNODES];
struct i386_memblk memblk_devices[MAX_NR_MEMBLKS];
static int __init topology_init(void)
{
int i;
for (i = 0; i < num_online_nodes(); i++)
arch_register_node(i);
for (i = 0; i < NR_CPUS; i++)
if (cpu_possible(i)) arch_register_cpu(i);
for (i = 0; i < num_online_memblks(); i++)
arch_register_memblk(i);
return 0;
}
#else /* !CONFIG_NUMA */
static int __init topology_init(void)
{
int i;
for (i = 0; i < NR_CPUS; i++)
if (cpu_possible(i)) arch_register_cpu(i);
return 0;
}
#endif /* CONFIG_NUMA */
subsys_initcall(topology_init);
|
/*
File: linux/xattr.h
Extended attributes handling.
Copyright (C) 2001 by Andreas Gruenbacher <a.gruenbacher@computer.org>
Copyright (c) 2001-2002 Silicon Graphics, Inc. All Rights Reserved.
Copyright (c) 2004 Red Hat, Inc., James Morris <jmorris@redhat.com>
*/
#ifndef _LINUX_XATTR_H
#define _LINUX_XATTR_H
#include <linux/slab.h>
#include <linux/types.h>
#include <linux/spinlock.h>
#include <uapi/linux/xattr.h>
struct inode;
struct dentry;
/*
* struct xattr_handler: When @name is set, match attributes with exactly that
* name. When @prefix is set instead, match attributes with that prefix and
* with a non-empty suffix.
*/
struct xattr_handler {
const char *name;
const char *prefix;
int flags; /* fs private flags */
bool (*list)(struct dentry *dentry);
int (*get)(const struct xattr_handler *, struct dentry *dentry,
struct inode *inode, const char *name, void *buffer,
size_t size);
int (*set)(const struct xattr_handler *, struct dentry *dentry,
struct inode *inode, const char *name, const void *buffer,
size_t size, int flags);
};
const char *xattr_full_name(const struct xattr_handler *, const char *);
struct xattr {
const char *name;
void *value;
size_t value_len;
};
ssize_t xattr_getsecurity(struct inode *, const char *, void *, size_t);
ssize_t vfs_getxattr(struct dentry *, const char *, void *, size_t);
ssize_t vfs_listxattr(struct dentry *d, char *list, size_t size);
int __vfs_setxattr_noperm(struct dentry *, const char *, const void *, size_t, int);
int vfs_setxattr(struct dentry *, const char *, const void *, size_t, int);
int __vfs_removexattr_noperm(struct dentry *dentry, const char *name);
int vfs_removexattr(struct dentry *, const char *);
ssize_t generic_getxattr(struct dentry *dentry, struct inode *inode, const char *name, void *buffer, size_t size);
ssize_t generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size);
int generic_setxattr(struct dentry *dentry, struct inode *inode,
const char *name, const void *value, size_t size, int flags);
int generic_removexattr(struct dentry *dentry, const char *name);
ssize_t vfs_getxattr_alloc(struct dentry *dentry, const char *name,
char **xattr_value, size_t size, gfp_t flags);
static inline const char *xattr_prefix(const struct xattr_handler *handler)
{
return handler->prefix ?: handler->name;
}
struct simple_xattrs {
struct list_head head;
spinlock_t lock;
};
struct simple_xattr {
struct list_head list;
char *name;
size_t size;
char value[0];
};
/*
* initialize the simple_xattrs structure
*/
static inline void simple_xattrs_init(struct simple_xattrs *xattrs)
{
INIT_LIST_HEAD(&xattrs->head);
spin_lock_init(&xattrs->lock);
}
/*
* free all the xattrs
*/
static inline void simple_xattrs_free(struct simple_xattrs *xattrs)
{
struct simple_xattr *xattr, *node;
list_for_each_entry_safe(xattr, node, &xattrs->head, list) {
kfree(xattr->name);
kfree(xattr);
}
}
struct simple_xattr *simple_xattr_alloc(const void *value, size_t size);
int simple_xattr_get(struct simple_xattrs *xattrs, const char *name,
void *buffer, size_t size);
int simple_xattr_set(struct simple_xattrs *xattrs, const char *name,
const void *value, size_t size, int flags);
ssize_t simple_xattr_list(struct inode *inode, struct simple_xattrs *xattrs, char *buffer,
size_t size);
void simple_xattr_list_add(struct simple_xattrs *xattrs,
struct simple_xattr *new_xattr);
#endif /* _LINUX_XATTR_H */
|
/****************************************************************************
** $Id: qt/qarray.h 3.3.8 edited Jan 11 14:46 $
**
** Compatibility file - should only be included by legacy code.
** It #includes the file which obsoletes this one.
**
** Copyright (C) 1998-2007 Trolltech ASA. All rights reserved.
** This file is part of the Qt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech ASA of Norway and appearing in the file
** LICENSE.QPL included in the packaging of this file.
**
** Licensees holding valid Qt Professional Edition licenses may use this
** file in accordance with the Qt Professional Edition License Agreement
** provided with the Qt Professional Edition.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about the Professional Edition licensing, or see
** http://www.trolltech.com/qpl/ for QPL licensing information.
**
*****************************************************************************/
#ifndef QARRAY_H
#define QARRAY_H
#ifndef QT_NO_COMPAT
#include "qmemarray.h"
#endif
#endif
|
/*
* Copyright (C) 2008 Red Hat, Inc., Eric Paris <eparis@redhat.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, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <linux/list.h>
#include <linux/mutex.h>
#include <linux/slab.h>
#include <linux/srcu.h>
#include <linux/rculist.h>
#include <linux/wait.h>
#include <linux/fsnotify_backend.h>
#include "fsnotify.h"
#include <linux/atomic.h>
/*
* Final freeing of a group
*/
void fsnotify_final_destroy_group(struct fsnotify_group *group)
{
if (group->ops->free_group_priv)
group->ops->free_group_priv(group);
kfree(group);
}
/*
* Stop queueing new events for this group. Once this function returns
* fsnotify_add_event() will not add any new events to the group's queue.
*/
void fsnotify_group_stop_queueing(struct fsnotify_group *group)
{
mutex_lock(&group->notification_mutex);
group->shutdown = true;
mutex_unlock(&group->notification_mutex);
}
/*
* Trying to get rid of a group. Remove all marks, flush all events and release
* the group reference.
* Note that another thread calling fsnotify_clear_marks_by_group() may still
* hold a ref to the group.
*/
void fsnotify_destroy_group(struct fsnotify_group *group)
{
/*
* Stop queueing new events. The code below is careful enough to not
* require this but fanotify needs to stop queuing events even before
* fsnotify_destroy_group() is called and this makes the other callers
* of fsnotify_destroy_group() to see the same behavior.
*/
fsnotify_group_stop_queueing(group);
/* clear all inode marks for this group */
fsnotify_clear_marks_by_group(group);
synchronize_srcu(&fsnotify_mark_srcu);
/* clear the notification queue of all events */
fsnotify_flush_notify(group);
/*
* Destroy overflow event (we cannot use fsnotify_destroy_event() as
* that deliberately ignores overflow events.
*/
if (group->overflow_event)
group->ops->free_event(group->overflow_event);
fsnotify_put_group(group);
}
/*
* Get reference to a group.
*/
void fsnotify_get_group(struct fsnotify_group *group)
{
atomic_inc(&group->refcnt);
}
/*
* Drop a reference to a group. Free it if it's through.
*/
void fsnotify_put_group(struct fsnotify_group *group)
{
if (atomic_dec_and_test(&group->refcnt))
fsnotify_final_destroy_group(group);
}
/*
* Create a new fsnotify_group and hold a reference for the group returned.
*/
struct fsnotify_group *fsnotify_alloc_group(const struct fsnotify_ops *ops)
{
struct fsnotify_group *group;
group = kzalloc(sizeof(struct fsnotify_group), GFP_KERNEL);
if (!group)
return ERR_PTR(-ENOMEM);
/* set to 0 when there a no external references to this group */
atomic_set(&group->refcnt, 1);
atomic_set(&group->num_marks, 0);
mutex_init(&group->notification_mutex);
INIT_LIST_HEAD(&group->notification_list);
init_waitqueue_head(&group->notification_waitq);
group->max_events = UINT_MAX;
mutex_init(&group->mark_mutex);
INIT_LIST_HEAD(&group->marks_list);
group->ops = ops;
return group;
}
int fsnotify_fasync(int fd, struct file *file, int on)
{
struct fsnotify_group *group = file->private_data;
return fasync_helper(fd, file, on, &group->fsn_fa) >= 0 ? 0 : -EIO;
}
|
/***************************************************************************
* Copyright (C) 2003 by Mario Scalas *
* mario.scalas@libero.it *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef FILETREEVIEWWIDGETIMPL_H
#define FILETREEVIEWWIDGETIMPL_H
#include <qobject.h>
#include <qvaluelist.h>
#include <kfiletreeview.h>
#include <qdom.h>
#include "fileitemfactory.h"
class FileTreeWidget;
namespace filetreeview
{
class FileTreeViewItem;
class FileTreeBranchItem;
class BranchItemFactory;
}
class FileViewPart;
class QHeader;
class KToggleAction;
class QPopupMenu;
/**
* @author Mario Scalas
* A base class for providing additional features to the standard KFileTreeViewItem-based widget we
* use for listing files in project directory.
*/
class FileTreeViewWidgetImpl : public QObject
{
Q_OBJECT
public:
FileTreeViewWidgetImpl( FileTreeWidget *parent, const char *name );
virtual ~FileTreeViewWidgetImpl();
//! return a list containing the filenames of the currently selected items.
KURL::List selectedPathUrls();
// shortcuts
FileTreeWidget *fileTree() const;
QDomDocument &projectDom() const;
QHeader *header() const { return fileTree()->header(); }
void setColumnWidth( int column, int w ) { fileTree()->setColumnWidth( column, w ); }
int contentsWidth() const { return fileTree()->contentsWidth(); }
void triggerUpdate() { fileTree()->triggerUpdate(); }
FileViewPart *part() const { return m_part; }
filetreeview::FileTreeViewItem *currentItem() const { return static_cast<filetreeview::FileTreeViewItem*>( fileTree()->currentItem() ); }
/**
* @return a reference to a new filetreeview::BranchItemFactory object which can be used for filling
* the tree view.
*/
filetreeview::BranchItemFactory *branchItemFactory() const { return m_branchItemFactory; }
/**
* Costraints that must be satisfied to start a reload of the the tree.
* @return
*/
virtual bool canReloadTree() const = 0;
/**
* Here the popup menu is filled: by standard only the "reload tree" (only if the above function
* returns true) and "show project files" options are added
* @param popupMenu the menu to fill
* @param item the QListViewItem which this menu has been requested upon
*/
virtual void fillPopupMenu( QPopupMenu *popupMenu, QListViewItem *item ) const;
/**
* @return true if non project files are to be shown, false otherwise
*/
bool showNonProjectFiles() const;
signals:
/**
* Emitted when the current implementation "recognizes" it cannot work anymore: for example the VCS impl.
* can ask to be relieved from work when the VCS plug-in it uses has been unloaded!
*/
void implementationInvalidated();
private slots:
void slotReloadTree();
void slotToggleShowNonProjectFiles();
protected:
void setBranchItemFactory( filetreeview::BranchItemFactory *aFactory ) { m_branchItemFactory = aFactory; }
QString projectDirectory() const;
private:
QValueList<QListViewItem*> allSelectedItems( QListViewItem * item ) const;
filetreeview::BranchItemFactory *m_branchItemFactory;
FileViewPart *m_part;
bool m_isReloadingTree;
KToggleAction *m_actionToggleShowNonProjectFiles;
};
#endif
|
#include <zebra.h>
#include "if.h"
#include "memory.h"
#include "ldp_cfg.h"
#include "ldp_struct.h"
#include "ldp.h"
#include "ldp_interface.h"
#include "impl_mpls.h"
struct ldp_interface *ldp_interface_new(struct interface *ifp) {
struct ldp_interface *li;
li = XMALLOC(MTYPE_LDP, sizeof(struct ldp_interface));
if (!li) {
return NULL;
}
memset(li, 0, sizeof(struct ldp_interface));
li->ifp = ifp;
ifp->info = li;
li->labelspace = -1;
li->configured = MPLS_BOOL_FALSE;
li->admin_up = MPLS_BOOL_FALSE;
li->create_on_hold = MPLS_BOOL_TRUE;
ldp_entity_set_defaults(&li->entity);
return li;
}
void ldp_interface_free(struct ldp_interface *li) {
XFREE(MTYPE_LDP, li);
}
int ldp_interface_create(struct ldp_interface *li) {
struct ldp *ldp = ldp_get();
if (!ldp) {
li->create_on_hold = MPLS_BOOL_TRUE;
return MPLS_SUCCESS;
}
if (!li->iff.index) {
/* tell LDP about this interface */
li->iff.label_space = li->labelspace;
li->iff.handle = li->ifp;
ldp_cfg_if_set(ldp->h, &li->iff,LDP_CFG_ADD|LDP_IF_CFG_LABEL_SPACE);
ldp_cfg_if_get(ldp->h, &li->iff, 0xFFFFFFFF);
}
if (li->labelspace != li->iff.label_space) {
li->iff.label_space = li->labelspace;
ldp_cfg_if_set(ldp->h, &li->iff, LDP_IF_CFG_LABEL_SPACE);
}
if (li->configured == MPLS_BOOL_FALSE) {
return MPLS_SUCCESS;
}
li->create_on_hold = MPLS_BOOL_FALSE;
li->entity.sub_index = li->iff.index;
li->entity.entity_type = LDP_DIRECT;
li->entity.admin_state = MPLS_ADMIN_DISABLE;
li->entity.transport_address.type = MPLS_FAMILY_NONE;
ldp_cfg_entity_set(ldp->h, &li->entity,
LDP_CFG_ADD | LDP_ENTITY_CFG_SUB_INDEX |
LDP_ENTITY_CFG_ADMIN_STATE | LDP_ENTITY_CFG_TRANS_ADDR);
ldp_cfg_entity_get(ldp->h, &li->entity, 0xFFFFFFFF);
return ldp_interface_admin_state_finish(li);
}
void ldp_interface_delete(struct ldp_interface *li) {
struct ldp *ldp = ldp_get();
li->create_on_hold = MPLS_BOOL_TRUE;
li->entity.admin_state = MPLS_ADMIN_DISABLE;
if (ldp) {
ldp_interface_admin_state_start(li);
if (li->entity.index) {
ldp_cfg_entity_set(ldp->h, &li->entity, LDP_CFG_DEL);
}
if (li->iff.index) {
ldp_cfg_if_set(ldp->h, &li->iff, LDP_CFG_DEL);
}
}
li->entity.index = 0;
li->iff.index = 0;
}
int ldp_interface_startup(struct ldp_interface *li) {
struct ldp *ldp = ldp_get();
MPLS_ASSERT(ldp && li->iff.index);
if (!li->entity.index) {
return MPLS_SUCCESS;
}
li->entity.admin_state = MPLS_ADMIN_ENABLE;
ldp_cfg_entity_set(ldp->h, &li->entity, LDP_ENTITY_CFG_ADMIN_STATE);
return MPLS_SUCCESS;
}
int ldp_interface_shutdown(struct ldp_interface *li) {
struct ldp *ldp = ldp_get();
MPLS_ASSERT(ldp && li->iff.index);
if (!li->entity.index) {
return MPLS_SUCCESS;
}
li->entity.admin_state = MPLS_ADMIN_DISABLE;
ldp_cfg_entity_set(ldp->h, &li->entity, LDP_ENTITY_CFG_ADMIN_STATE);
return MPLS_SUCCESS;
}
int ldp_interface_admin_state_start(struct ldp_interface *li) {
if (li->admin_up == MPLS_BOOL_TRUE && ldp_interface_is_up(li)) {
return ldp_interface_shutdown(li);
}
return MPLS_SUCCESS;
}
int ldp_interface_admin_state_finish(struct ldp_interface *li) {
if (li->admin_up == MPLS_BOOL_TRUE && ldp_interface_is_up(li)) {
return ldp_interface_startup(li);
}
return MPLS_SUCCESS;
}
void ldp_interface_up(struct ldp_interface *li) {
if (li->configured == MPLS_BOOL_TRUE && li->admin_up == MPLS_BOOL_TRUE) {
ldp_interface_startup(li);
}
}
void ldp_interface_down(struct ldp_interface *li) {
if (li->configured == MPLS_BOOL_TRUE && li->admin_up == MPLS_BOOL_TRUE) {
ldp_interface_shutdown(li);
}
}
int ldp_interface_is_up(struct ldp_interface *li) {
return if_is_up(li->ifp);
}
static int ldp_interface_new_hook(struct interface *ifp) {
if (!ldp_interface_new(ifp)) {
return 1;
}
ldp_interface_create(ifp->info);
return 0;
}
static int ldp_interface_delete_hook(struct interface *ifp) {
if (ifp->info) {
ldp_interface_delete(ifp->info);
ldp_interface_free(ifp->info);
}
ifp->info = NULL;
return 0;
}
void ldp_interface_init() {
/* Initialize Zebra interface data structure. */
if_init();
if_add_hook(IF_NEW_HOOK, ldp_interface_new_hook);
if_add_hook(IF_DELETE_HOOK, ldp_interface_delete_hook);
}
|
#ifndef __COSS_H__
#define __COSS_H__
#include "SwapDir.h"
#ifndef COSS_MEMBUF_SZ
#define COSS_MEMBUF_SZ 1048576
#endif
/** \note swap_filen in sio/e are actually disk offsets too! */
/** What we're doing in storeCossAllocate() */
#define COSS_ALLOC_NOTIFY 0
/** What we're doing in storeCossAllocate() */
#define COSS_ALLOC_ALLOCATE 1
/** What we're doing in storeCossAllocate() */
#define COSS_ALLOC_REALLOC 2
class CossSwapDir;
/// \ingroup COSS
class CossMemBuf
{
public:
void describe(int level, int line);
void maybeWrite(CossSwapDir * SD);
void write(CossSwapDir * SD);
dlink_node node;
off_t diskstart; /* in blocks */
off_t diskend; /* in blocks */
CossSwapDir *SD;
int lockcount;
char buffer[COSS_MEMBUF_SZ];
struct _cossmembuf_flags {
unsigned int full:1;
unsigned int writing:1;
} flags;
};
/// \ingroup COSS
struct _cossindex {
/**
\note The dlink_node MUST be the first member of the structure.
* This member is later pointer typecasted to coss_index_node *.
*/
dlink_node node;
};
/**
\ingroup COSS
* Per-storeiostate info
*/
class CossState : public StoreIOState
{
public:
MEMPROXY_CLASS(CossState);
CossState(CossSwapDir *);
~CossState();
char *readbuffer;
char *requestbuf;
size_t requestlen;
size_t requestoffset; /* in blocks */
int64_t reqdiskoffset; /* in blocks */
struct {
unsigned int reading:1;
unsigned int writing:1;
} flags;
CossMemBuf *locked_membuf;
off_t st_size;
void read_(char *buf, size_t size, off_t offset, STRCB * callback, void *callback_data);
void write(char const *buf, size_t size, off_t offset, FREE * free_func);
virtual void close(int);
void doCallback(int errflag);
void lockMemBuf();
CossSwapDir *SD;
};
MEMPROXY_CLASS_INLINE(CossState);
/// \ingroup COSS
typedef struct _cossindex CossIndexNode;
/**
\ingroup COSS
* Whether the coss system has been setup or not
*/
extern int coss_initialised;
/// \ingroup COSS
extern MemAllocator *coss_membuf_pool;
/// \ingroup COSS
extern MemAllocator *coss_index_pool;
#include "DiskIO/ReadRequest.h"
/// \ingroup COSS
class CossRead : public ReadRequest
{
public:
void * operator new (size_t);
void operator delete (void *);
CossRead(ReadRequest const &base, StoreIOState::Pointer anSio) : ReadRequest(base) , sio(anSio) {}
StoreIOState::Pointer sio;
private:
CBDATA_CLASS(CossRead);
};
#include "DiskIO/WriteRequest.h"
/// \ingroup COSS
class CossWrite : public WriteRequest
{
public:
void * operator new (size_t);
void operator delete (void *);
CossWrite(WriteRequest const &base, CossMemBuf *aBuf) : WriteRequest(base) , membuf(aBuf) {}
CossMemBuf *membuf;
private:
CBDATA_CLASS(CossWrite);
};
#endif
|
#include <scitbx/array_family/ref.h>
#include <scitbx/array_family/accessors/mat_grid.h>
namespace scitbx { namespace af {
template <typename ElementType, int Rows, int Cols>
class tiny_mat_ref : public ref<ElementType, mat_grid>
{
public:
tiny_mat_ref(ElementType *storage)
: ref<ElementType, mat_grid>(storage, mat_grid(Rows, Cols))
{}
};
template <typename ElementType, int Rows, int Cols>
class tiny_mat_const_ref : public const_ref<ElementType, mat_grid>
{
public:
tiny_mat_const_ref(ElementType const *storage)
: const_ref<ElementType, mat_grid>(storage, mat_grid(Rows, Cols))
{}
};
}}
|
/* ber.c
*
* Basic Encoding Rules (BER) file reading
*
* $Id: ber.c 46803 2012-12-27 12:19:25Z guy $
*
* 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.
*/
#include "config.h"
#include <errno.h>
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#include "wtap-int.h"
#include "file_wrappers.h"
#include "buffer.h"
#include "ber.h"
#define BER_CLASS_UNI 0
#define BER_CLASS_APP 1
#define BER_CLASS_CON 2
#define BER_UNI_TAG_SEQ 16 /* SEQUENCE, SEQUENCE OF */
#define BER_UNI_TAG_SET 17 /* SET, SET OF */
static void ber_set_pkthdr(struct wtap_pkthdr *phdr, int packet_size)
{
phdr->presence_flags = 0; /* yes, we have no bananas^Wtime stamp */
phdr->caplen = packet_size;
phdr->len = packet_size;
phdr->ts.secs = 0;
phdr->ts.nsecs = 0;
}
static gboolean ber_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
{
gint64 offset;
guint8 *buf;
gint64 file_size;
int packet_size;
*err = 0;
offset = file_tell(wth->fh);
/* there is only ever one packet */
if (offset != 0)
return FALSE;
*data_offset = offset;
if ((file_size = wtap_file_size(wth, err)) == -1)
return FALSE;
if (file_size > WTAP_MAX_PACKET_SIZE) {
/*
* Probably a corrupt capture file; don't blow up trying
* to allocate space for an immensely-large packet.
*/
*err = WTAP_ERR_BAD_FILE;
*err_info = g_strdup_printf("ber: File has %" G_GINT64_MODIFIER "d-byte packet, bigger than maximum of %u",
file_size, WTAP_MAX_PACKET_SIZE);
return FALSE;
}
packet_size = (int)file_size;
buffer_assure_space(wth->frame_buffer, packet_size);
buf = buffer_start_ptr(wth->frame_buffer);
ber_set_pkthdr(&wth->phdr, packet_size);
wtap_file_read_expected_bytes(buf, packet_size, wth->fh, err, err_info);
return TRUE;
}
static gboolean ber_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr _U_,
guint8 *pd, int length, int *err, gchar **err_info)
{
int packet_size = length;
/* there is only one packet */
if(seek_off > 0) {
*err = 0;
return FALSE;
}
if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
return FALSE;
ber_set_pkthdr(phdr, packet_size);
wtap_file_read_expected_bytes(pd, packet_size, wth->random_fh, err, err_info);
return TRUE;
}
int ber_open(wtap *wth, int *err, gchar **err_info)
{
#define BER_BYTES_TO_CHECK 8
guint8 bytes[BER_BYTES_TO_CHECK];
int bytes_read;
guint8 ber_id;
gint8 ber_class;
gint8 ber_tag;
gboolean ber_pc;
guint8 oct, nlb = 0;
int len = 0;
gint64 file_size;
int offset = 0, i;
bytes_read = file_read(&bytes, BER_BYTES_TO_CHECK, wth->fh);
if (bytes_read != BER_BYTES_TO_CHECK) {
*err = file_error(wth->fh, err_info);
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1;
return 0;
}
ber_id = bytes[offset++];
ber_class = (ber_id>>6) & 0x03;
ber_pc = (ber_id>>5) & 0x01;
ber_tag = ber_id & 0x1F;
/* it must be constructed and either a SET or a SEQUENCE */
/* or a CONTEXT less than 32 (arbitrary) */
/* XXX: do we also want to allow APPLICATION */
if(!(ber_pc &&
(((ber_class == BER_CLASS_UNI) && ((ber_tag == BER_UNI_TAG_SET) || (ber_tag == BER_UNI_TAG_SEQ))) ||
((ber_class == BER_CLASS_CON) && (ber_tag < 32)))))
return 0;
/* now check the length */
oct = bytes[offset++];
if(oct != 0x80) {
/* not indefinite length encoded */
if(!(oct & 0x80))
/* length fits into a single byte */
len = oct;
else {
nlb = oct & 0x7F; /* number of length bytes */
if((nlb > 0) && (nlb <= (BER_BYTES_TO_CHECK - 2))) {
/* not indefinite length and we have read enough bytes to compute the length */
i = nlb;
while(i--) {
oct = bytes[offset++];
len = (len<<8) + oct;
}
}
}
len += (2 + nlb); /* add back Tag and Length bytes */
file_size = wtap_file_size(wth, err);
if(len != file_size) {
return 0; /* not ASN.1 */
}
} else {
/* Indefinite length encoded - assume it is BER */
}
/* seek back to the start of the file */
if (file_seek(wth->fh, 0, SEEK_SET, err) == -1)
return -1;
wth->file_type = WTAP_FILE_BER;
wth->file_encap = WTAP_ENCAP_BER;
wth->snapshot_length = 0;
wth->subtype_read = ber_read;
wth->subtype_seek_read = ber_seek_read;
wth->tsprecision = WTAP_FILE_TSPREC_SEC;
return 1;
}
|
// qjackctlConnectionsForm.h
//
/****************************************************************************
Copyright (C) 2003-2014, rncbc aka Rui Nuno Capela. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*****************************************************************************/
#ifndef __qjackctlConnectionsForm_h
#define __qjackctlConnectionsForm_h
#include "ui_qjackctlConnectionsForm.h"
#include "qjackctlJackConnect.h"
#include "qjackctlAlsaConnect.h"
// Forward declarations.
class qjackctlSetup;
//----------------------------------------------------------------------------
// qjackctlConnectionsForm -- UI wrapper form.
class qjackctlConnectionsForm : public QWidget
{
Q_OBJECT
public:
// Constructor.
qjackctlConnectionsForm(QWidget *pParent = 0, Qt::WindowFlags wflags = 0);
// Destructor.
~qjackctlConnectionsForm();
void setup(qjackctlSetup *pSetup);
qjackctlConnectView *audioConnectView() const;
qjackctlConnectView *midiConnectView() const;
qjackctlConnectView *alsaConnectView() const;
bool queryClose();
enum TabPage { AudioTab = 0, MidiTab = 1, AlsaTab = 2 };
void setTabPage(int iTabPage);
int tabPage() const;
QFont connectionsFont() const;
void setConnectionsFont(const QFont& font);
void setConnectionsIconSize(int iIconSize);
bool isAudioConnected() const;
bool isMidiConnected() const;
bool isAlsaConnected() const;
void refreshAudio(bool bEnabled, bool bClear = false);
void refreshMidi(bool bEnabled, bool bClear = false);
void refreshAlsa(bool bEnabled, bool bClear = false);
void stabilizeAudio(bool bEnabled, bool bClear = false);
void stabilizeMidi(bool bEnabled, bool bClear = false);
void stabilizeAlsa(bool bEnabled, bool bClear = false);
void setupAliases(qjackctlSetup *pSetup);
void updateAliases();
bool loadAliases();
bool saveAliases();
public slots:
void audioConnectSelected();
void audioDisconnectSelected();
void audioDisconnectAll();
void audioExpandAll();
void audioRefreshClear();
void audioRefresh();
void audioStabilize();
void midiConnectSelected();
void midiDisconnectSelected();
void midiDisconnectAll();
void midiExpandAll();
void midiRefreshClear();
void midiRefresh();
void midiStabilize();
void alsaConnectSelected();
void alsaDisconnectSelected();
void alsaDisconnectAll();
void alsaExpandAll();
void alsaRefreshClear();
void alsaRefresh();
void alsaStabilize();
protected slots:
void audioDisconnecting(qjackctlPortItem *, qjackctlPortItem *);
void midiDisconnecting(qjackctlPortItem *, qjackctlPortItem *);
void alsaDisconnecting(qjackctlPortItem *, qjackctlPortItem *);
protected:
void showEvent(QShowEvent *);
void hideEvent(QHideEvent *);
void closeEvent(QCloseEvent *);
void keyPressEvent(QKeyEvent *);
private:
// The Qt-designer UI struct...
Ui::qjackctlConnectionsForm m_ui;
// Instance variables.
qjackctlJackConnect *m_pAudioConnect;
qjackctlJackConnect *m_pMidiConnect;
qjackctlAlsaConnect *m_pAlsaConnect;
qjackctlSetup *m_pSetup;
QString m_sPreset;
};
#endif // __qjackctlConnectionsForm_h
// end of qjackctlConnectionsForm.h
|
/* The file is generated automaticly */
#undef CURL_CA_BUNDLE /* unknown */
|
/*
*
*
* Copyright (C) 2005 Mike Isely <isely@pobox.com>
* Copyright (C) 2004 Aurelien Alleaume <slts@free.fr>
*
* 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
*
* 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 __PVRUSB2_WM8775_H
#define __PVRUSB2_WM8775_H
/*
This module connects the pvrusb2 driver to the I2C chip level
driver which performs analog -> digital audio conversion for
external audio inputs. This interface is used internally by the
driver; higher level code should only interact through the
interface provided by pvrusb2-hdw.h.
*/
#include "pvrusb2-hdw-internal.h"
void pvr2_wm8775_subdev_update(struct pvr2_hdw *, struct v4l2_subdev *sd);
#endif /* __PVRUSB2_WM8775_H */
/*
Stuff for Emacs to see, in order to encourage consistent editing style:
*** Local Variables: ***
*** mode: c ***
*** fill-column: 70 ***
*** tab-width: 8 ***
*** c-basic-offset: 8 ***
*** End: ***
*/
|
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _JITCACHE_H
#define _JITCACHE_H
#include <map>
#include <vector>
#include "../Gekko.h"
#include "../PPCAnalyst.h"
// emulate CPU with unlimited instruction cache
// the only way to invalidate a region is the "icbi" instruction
#define JIT_UNLIMITED_ICACHE
#define JIT_ICACHE_SIZE 0x2000000
#define JIT_ICACHE_MASK 0x1ffffff
#define JIT_ICACHEEX_SIZE 0x4000000
#define JIT_ICACHEEX_MASK 0x3ffffff
#define JIT_ICACHE_EXRAM_BIT 0x10000000
#define JIT_ICACHE_VMEM_BIT 0x20000000
// this corresponds to opcode 5 which is invalid in PowerPC
#define JIT_ICACHE_INVALID_BYTE 0x14
#define JIT_ICACHE_INVALID_WORD 0x14141414
// TODO(ector) - optimize this struct for size
struct JitBlock
{
u32 exitAddress[2]; // 0xFFFFFFFF == unknown
u8 *exitPtrs[2]; // to be able to rewrite the exit jump
bool linkStatus[2];
u32 originalAddress;
u32 originalFirstOpcode; //to be able to restore
u32 codeSize;
u32 originalSize;
int runCount; // for profiling.
int blockNum;
#ifdef _WIN32
// we don't really need to save start and stop
// TODO (mb2): ticStart and ticStop -> "local var" mean "in block" ... low priority ;)
u64 ticStart; // for profiling - time.
u64 ticStop; // for profiling - time.
u64 ticCounter; // for profiling - time.
#endif
const u8 *checkedEntry;
const u8 *normalEntry;
bool invalid;
int flags;
bool ContainsAddress(u32 em_address);
};
typedef void (*CompiledCode)();
class JitBlockCache
{
const u8 **blockCodePointers;
JitBlock *blocks;
int num_blocks;
std::multimap<u32, int> links_to;
std::map<std::pair<u32,u32>, u32> block_map; // (end_addr, start_addr) -> number
#ifdef JIT_UNLIMITED_ICACHE
u8 *iCache;
u8 *iCacheEx;
u8 *iCacheVMEM;
#endif
int MAX_NUM_BLOCKS;
bool RangeIntersect(int s1, int e1, int s2, int e2) const;
void LinkBlockExits(int i);
void LinkBlock(int i);
public:
JitBlockCache() :
blockCodePointers(0), blocks(0), num_blocks(0),
#ifdef JIT_UNLIMITED_ICACHE
iCache(0), iCacheEx(0), iCacheVMEM(0),
#endif
MAX_NUM_BLOCKS(0) { }
int AllocateBlock(u32 em_address);
void FinalizeBlock(int block_num, bool block_link, const u8 *code_ptr);
void Clear();
void ClearSafe();
void Init();
void Shutdown();
void Reset();
bool IsFull() const;
// Code Cache
JitBlock *GetBlock(int block_num);
int GetNumBlocks() const;
const u8 **GetCodePointers();
#ifdef JIT_UNLIMITED_ICACHE
u8 *GetICache();
u8 *GetICacheEx();
u8 *GetICacheVMEM();
#endif
// Fast way to get a block. Only works on the first ppc instruction of a block.
int GetBlockNumberFromStartAddress(u32 em_address);
// slower, but can get numbers from within blocks, not just the first instruction.
// WARNING! WILL NOT WORK WITH INLINING ENABLED (not yet a feature but will be soon)
// Returns a list of block numbers - only one block can start at a particular address, but they CAN overlap.
// This one is slow so should only be used for one-shots from the debugger UI, not for anything during runtime.
void GetBlockNumbersFromAddress(u32 em_address, std::vector<int> *block_numbers);
u32 GetOriginalFirstOp(int block_num);
CompiledCode GetCompiledCodeFromBlock(int block_num);
// DOES NOT WORK CORRECTLY WITH INLINING
void InvalidateICache(u32 em_address);
void DestroyBlock(int block_num, bool invalidate);
// Not currently used
//void DestroyBlocksWithFlag(BlockFlag death_flag);
};
#endif
|
/*
* Copyright (c) 2003, 2007-11 Matteo Frigo
* Copyright (c) 2003, 2007-11 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include "api.h"
X(plan) X(plan_dft_r2c_2d)(int nx, int ny, R *in, C *out, unsigned flags)
{
int n[2];
n[0] = nx;
n[1] = ny;
return X(plan_dft_r2c)(2, n, in, out, flags);
}
|
/***************************************************************************
qgsxyzconnection.h
---------------------
begin : August 2016
copyright : (C) 2016 by Martin Dobias
email : wonder dot sk at gmail dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSXYZCONNECTION_H
#define QGSXYZCONNECTION_H
#include <QStringList>
struct QgsXyzConnection
{
QString name;
QString url;
int zMin = -1;
int zMax = -1;
QString encodedUri() const;
};
//! Utility class for handling list of connections to XYZ tile layers
class QgsXyzConnectionUtils
{
public:
//! Returns list of existing connections
static QStringList connectionList();
//! Returns connection details
static QgsXyzConnection connection( const QString &name );
//! Removes a connection from the list
static void deleteConnection( const QString &name );
//! Adds a new connection to the list
static void addConnection( const QgsXyzConnection &conn );
};
#endif // QGSXYZCONNECTION_H
|
/**************************************************************************
*
* \file
*
* \brief Processing of USB device specific enumeration requests.
*
* This file contains the specific request decoding for enumeration process.
*
* Copyright (c) 2009 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name of Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* \asf_license_stop
*
***************************************************************************/
//_____ I N C L U D E S ____________________________________________________
#include "conf_usb.h"
#if USB_HOST_FEATURE == true
#include <stdio.h>
#include "conf_usb.h"
#include "usb_host_enum.h"
#include "usb_host_user.h"
#include "usb_audio.h"
#include "host_audio_task.h"
//_____ M A C R O S ________________________________________________________
//_____ D E F I N I T I O N S ______________________________________________
//_____ P R I V A T E D E C L A R A T I O N S ____________________________
uint8_t state=0;
uint8_t n_interface=0;
//_____ D E C L A R A T I O N S ____________________________________________
//! Initialization
//!
void host_user_check_class_init(void)
{
state=0;
n_interface=0;
}
//! This function is called by the standard USB host_check_class() function when
//! the Host is analyzing the configuration descriptor previously sent by a USB Device.
//! The function will be called for each descriptor found in the configuration descriptor.
//!
bool host_user_check_class(const uint8_t* descriptor)
{
uint32_t num;
const uint8_t* p_bmaControls;
uint8_t n_sample_freq=0;
uint8_t i;
if (!n_interface)
{
free(host_audio_task_data);
host_audio_task_data = NULL;
}
switch (descriptor[OFFSET_FIELD_DESCRIPTOR_TYPE])
{
case INTERFACE_DESCRIPTOR:
if (n_interface < MAX_INTERFACE_SUPPORTED)
n_interface++;
break;
case CS_INTERFACE:
if (!host_audio_task_data)
host_audio_task_data = calloc(1, sizeof(*host_audio_task_data));;
switch (descriptor[OFFSET_FIELD_DESCRIPTOR_SUBTYPE])
{
case HEADER_SUB_TYPE:
// This variable allow to detect AUDIO CONTROL sub class to AUDIO STREAMING
// sub class transition.
state++;
break;
case FEATURE_UNIT_SUB_TYPE:
if( state!=1 )
break;
// Still in AUDIO CONTROL sub class
// Analysis of the Features Units
// Ensure no out-of-limit access in array.
num = (descriptor[0]-7)>MAX_BMA_CONTROLS ? MAX_BMA_CONTROLS : descriptor[0]-7;
host_audio_task_data->g_cs_feature[host_audio_task_data->g_cs_num_features_unit].n_bmaControls = num;
host_audio_task_data->g_cs_feature[host_audio_task_data->g_cs_num_features_unit].unit = descriptor[3];
p_bmaControls = &descriptor[6]; // Point on beginning of bmaControls infos
for( i=0 ; i<num ; i++,p_bmaControls++ )
{
host_audio_task_data->g_cs_feature[host_audio_task_data->g_cs_num_features_unit].bmaControls[i]=p_bmaControls[0];
}
host_audio_task_data->g_cs_num_features_unit++;
case FORMAT_SUB_TYPE:
if( state<2 )
break;
// We are in AUDIO STREAMING sub class
// Analysis of the sampling frequencies
const uint8_t* p_sampling_freq= &descriptor[8];
uint8_t id_interface=Get_interface_number(n_interface-1);
host_audio_task_data->g_n_channels[id_interface] = descriptor[4];
host_audio_task_data->g_n_bits_per_sample[id_interface] = descriptor[6];
n_sample_freq = descriptor[7];
host_audio_task_data->g_sample_freq[id_interface]=0;
for( i=0 ; i<n_sample_freq ; i++, p_sampling_freq+=3 )
{
// Keep the max declared sampling frequency. An other policy would be to keep the
// highest sampling frequency which is compatible with the CPU and PBA frequency
host_audio_task_data->g_sample_freq[id_interface]= max(
host_audio_task_data->g_sample_freq[id_interface]
, p_sampling_freq[0] + (p_sampling_freq[1]<<8) + (p_sampling_freq[2]<<16));
}
break;
}
break;
default:
break;
}
return true;
}
#endif // USB_HOST_FEATURE == true
|
/**
* UGENE - Integrated Bioinformatics Tools.
* Copyright (C) 2008-2017 UniPro <ugene@unipro.ru>
* http://ugene.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#ifndef _GROUPER_SLOT_ACTION_
#define _GROUPER_SLOT_ACTION_
#include <U2Core/global.h>
#include <U2Lang/Datatype.h>
#include <U2Lang/Descriptor.h>
namespace U2 {
class U2LANG_EXPORT ActionTypes {
public:
static const QString MERGE_SEQUENCE;
static const QString SEQUENCE_TO_MSA;
static const QString MERGE_MSA;
static const QString MERGE_STRING;
static const QString MERGE_ANNS;
static bool isValidType(const QString &actionType);
static DataTypePtr getDataTypeByAction(const QString &actionType);
};
class U2LANG_EXPORT ActionParameters {
public:
enum ParameterType {
INTEGER,
BOOLEAN,
STRING
};
static const QString GAP;
static const QString UNIQUE;
static const QString SEPARATOR;
static const QString MSA_NAME;
static const QString SEQ_NAME;
static const QString SEQ_SLOT;
static ParameterType getType(const QString ¶meter);
static bool isValidParameter(const QString &actionType, const QString ¶meter);
};
class U2LANG_EXPORT GrouperSlotAction {
public:
GrouperSlotAction(const QString &type);
GrouperSlotAction(const GrouperSlotAction &other);
QString getType() const;
const QVariantMap &getParameters() const;
bool hasParameter(const QString ¶meterId) const;
QVariant getParameterValue(const QString ¶meterId) const;
void setParameterValue(const QString ¶meterId, const QVariant &value);
private:
QString type;
QVariantMap parameters;
};
class U2LANG_EXPORT GroupOperations {
public:
static Descriptor BY_VALUE();
static Descriptor BY_ID();
static Descriptor BY_NAME();
};
class U2LANG_EXPORT GrouperOutSlot {
public:
GrouperOutSlot(const QString &outSlotId, const QString &inSlotStr);
GrouperOutSlot(const GrouperOutSlot &another);
~GrouperOutSlot();
bool operator==(const GrouperOutSlot &other) const;
GrouperSlotAction *getAction();
GrouperSlotAction *getAction() const;
void setAction(const GrouperSlotAction &action);
QString getOutSlotId() const;
void setOutSlotId(const QString &outSlotId);
QString getInSlotStr() const;
QString getBusMapInSlotId() const;
void setInSlotStr(const QString &slotStr);
void setBusMapInSlotStr(const QString &busMapSlotStr);
static QString readable2busMap(const QString &readableSlotStr);
static QString busMap2readable(const QString &busMapSlotStr);
private:
QString outSlotId;
QString inSlotStr;
GrouperSlotAction *action;
};
} // U2
#endif //_GROUPER_SLOT_ACTION_
|
/***************************************************************************
* mghttpsocket.h
*
* Wed Sep 6 22:19:52 2006
* Copyright 2006 liubin,China
* Email sysnotdown@yahoo.com
****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _MG_HTTP_SOCKET_H
#define _MG_HTTP_SOCKET_H
#include "mgproxysocket.h"
/*
CMgSocket -> CMgProxySocket -> CMgHttpSocket* -> CMgHttpBase -> CMgHttpInfo
| `->CMgHttpAnts
\-> CMgFtpSocket -> CMgFtpBase -> CMgFtpInfo
`->CMgFtpAnts
*/
/*
Error code range define;
*/
//this class try to make http proxy work
//http://www.ietf.org/rfc/rfc2818.txt RFC2818(HTTP Over TLS)
//http://community.roxen.com/developers/idocs/rfc/rfc2246.html RFC2246(The TLS Protocol Version 1.0)
class CMgHttpSocket : public CMgProxySocket
{
public:
CMgHttpSocket();
virtual ~CMgHttpSocket();
bool SetHttpProxy( std::string , int );
virtual bool Connect( const char* server, int port );
protected:
std::string m_HttpProxyServer;
int m_HttpProxyPort;
bool m_bUseHttpProxy;
};
#endif
|
#ifndef __GLOBALS_H__
#define __GLOBALS_H__
/* This unit holds global data to tgdb. It helps keep track of obscure states */
struct globals;
int globals_is_misc_prompt( struct globals *g);
void globals_set_misc_prompt_command( struct globals *g, unsigned short set);
struct globals *globals_initialize ( void );
void globals_shutdown ( struct globals *g );
/* These check to see if the gui is working on getting the source files that
* make up the program being debugged.
*/
void global_set_start_info_sources(struct globals *g);
int global_has_info_sources_started(struct globals *g);
void global_reset_info_sources_started(struct globals *g);
void global_set_start_completion(struct globals *g);
int global_has_completion_started(struct globals *g);
void global_reset_completion_started(struct globals *g);
/* Lists a file */
void global_set_start_list(struct globals *g);
int global_has_list_started(struct globals *g);
void global_list_finished ( struct globals *g );
unsigned short global_list_had_error ( struct globals *g );
void global_set_list_error ( struct globals *g, unsigned short error );
#endif
|
/*
* @(#) FreeSWAN tunable paramaters
*
* Copyright (C) 2001 Richard Guy Briggs <rgb@freeswan.org>
* and Michael Richardson <mcr@freeswan.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 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.
*
* RCSID $Id: ipsec_param.h,v 1.1.1.1 2003/08/18 05:39:37 kaohj Exp $
*
*/
/*
* This file provides a set of #define's which may be tuned by various
* people/configurations. It keeps all compile-time tunables in one place.
*
* This file should be included before all other IPsec kernel-only files.
*
*/
#ifndef _IPSEC_PARAM_H_
#include "ipsec_kversion.h"
#ifdef CONFIG_IPSEC_BIGGATE
#define SADB_HASHMOD 8069
#else
#define SADB_HASHMOD 257
#endif
#ifndef PROC_NO_DUMMY
#define IPSEC_PROC_LAST_ARG , int dummy
#else
#define IPSEC_PROC_LAST_ARG
#endif /* !PROC_NO_DUMMY */
#ifdef NETDEV_23
#define device net_device
#define ipsec_dev_get __dev_get_by_name
#else
#define ipsec_dev_get dev_get
#endif /* NETDEV_23 */
#ifndef PROC_FS_2325
#define IPSEC_PROCFS_DEBUG_NO_STATIC DEBUG_NO_STATIC
#else
#define IPSEC_PROCFS_DEBUG_NO_STATIC
#endif /* PROC_FS_2325 */
#if !defined(LINUX_KERNEL_HAS_SNPRINTF)
/* GNU CPP specific! */
#define snprintf(buf, len, fmt...) sprintf(buf, ##fmt)
#endif
#ifdef SPINLOCK
#ifdef SPINLOCK_23
#include <linux/spinlock.h> /* *lock* */
#else /* SPINLOCK_23 */
#include <asm/spinlock.h> /* *lock* */
#endif /* SPINLOCK_23 */
#endif /* SPINLOCK */
#ifndef KLIPS_FIXES_DES_PARITY
#define KLIPS_FIXES_DES_PARITY 1
#endif
#ifndef KLIPS_DIVULGE_CYPHER_KEY
#define KLIPS_DIVULGE_CYPHER_KEY 0
#endif
/* extra toggles for regression testing */
#ifdef CONFIG_IPSEC_REGRESS
/*
* should pfkey_acquire() become 100% lossy?
*
*/
extern int sysctl_ipsec_regress_pfkey_lossage;
#ifndef KLIPS_PFKEY_ACQUIRE_LOSSAGE
#ifdef CONFIG_IPSEC_PFKEY_ACQUIRE_LOSSAGE
#define KLIPS_PFKEY_ACQUIRE_LOSSAGE 100
#else
/* not by default! */
#define KLIPS_PFKEY_ACQUIRE_LOSSAGE 0
#endif
#endif
#endif
/* IP_FRAGMENT_LINEARIZE is set in freeswan.h if Kernel > 2.4.4 */
#ifndef IP_FRAGMENT_LINEARIZE
#define IP_FRAGMENT_LINEARIZE 0
#endif
#define _IPSEC_PARAM_H_
#endif
/*
* $Log: ipsec_param.h,v $
* Revision 1.1.1.1 2003/08/18 05:39:37 kaohj
* initial import into CVS
*
* Revision 1.6 2002/01/29 02:11:42 mcr
* removal of kversions.h - sources that needed it now use ipsec_param.h.
* updating of IPv6 structures to match latest in6.h version.
* removed dead code from freeswan.h that also duplicated kversions.h
* code.
*
* Revision 1.5 2002/01/28 19:22:01 mcr
* by default, turn off LINEARIZE option
* (let kversions.h turn it on)
*
* Revision 1.4 2002/01/20 20:19:36 mcr
* renamed option to IP_FRAGMENT_LINEARIZE.
*
* Revision 1.3 2002/01/12 02:57:25 mcr
* first regression test causes acquire messages to be lost
* 100% of the time. This is to help testing of pluto.
*
* Revision 1.2 2001/11/26 09:16:14 rgb
* Merge MCR's ipsec_sa, eroute, proc and struct lifetime changes.
*
* Revision 1.1.2.3 2001/10/23 04:40:16 mcr
* added #define for DIVULGING session keys in debug output.
*
* Revision 1.1.2.2 2001/10/22 20:53:25 mcr
* added a define to control forcing of DES parity.
*
* Revision 1.1.2.1 2001/09/25 02:20:19 mcr
* many common kernel configuration questions centralized.
* more things remain that should be moved from freeswan.h.
*
*
* Local variables:
* c-file-style: "linux"
* End:
*
*/
|
/* cryptoki.h include file for PKCS #11. */
/* $Revision: 1.4 $ */
/* License to copy and use this software is granted provided that it is
* identified as "RSA Security Inc. PKCS #11 Cryptographic Token Interface
* (Cryptoki)" in all material mentioning or referencing this software.
* License is also granted to make and use derivative works provided that
* such works are identified as "derived from the RSA Security Inc. PKCS #11
* Cryptographic Token Interface (Cryptoki)" in all material mentioning or
* referencing the derived work.
* RSA Security Inc. makes no representations concerning either the
* merchantability of this software or the suitability of this software for
* any particular purpose. It is provided "as is" without express or implied
* warranty of any kind.
*/
#ifndef ___CRYPTOKI_H_INC___
#define ___CRYPTOKI_H_INC___
#define CK_PTR *
#define CK_DEFINE_FUNCTION(returnType, name) returnType name
#define CK_DECLARE_FUNCTION(returnType, name) returnType name
#define CK_DECLARE_FUNCTION_POINTER(returnType, name) returnType (* name)
#define CK_CALLBACK_FUNCTION(returnType, name) returnType (* name)
#ifndef NULL_PTR
#define NULL_PTR 0
#endif
#include "pkcs11-headers/pkcs11.h"
#endif /* ___CRYPTOKI_H_INC___ */
|
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
*
* This package 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/>.
*/
#pragma once
#include "base/IJob.h"
//! Use a function as a job
/*!
A job class that invokes a function.
*/
class FunctionJob : public IJob {
public:
//! run() invokes \c func(arg)
FunctionJob(void (*func)(void*), void* arg = NULL);
virtual ~FunctionJob();
// IJob overrides
virtual void run();
private:
void (*m_func)(void*);
void* m_arg;
};
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.