text
stringlengths 4
6.14k
|
|---|
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Karoliina T. Salminen <karoliina.t.salminen@nokia.com>
**
** This file is part of duicontrolpanel.
**
**
** This program is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#ifndef DCPAPPLETLOADER_APPLET_H__
#define DCPAPPLETLOADER_APPLET_H__
#include <QObject>
#include <QVector>
#include <MAction>
#include <QtDebug>
#include "dcpappletif.h"
#include "dcpwidget.h"
class DcpAppletPluginApplet : public QObject, public DcpAppletIf {
Q_OBJECT
Q_INTERFACES(DcpAppletIf)
public:
DcpAppletPluginApplet() : m_Initialized(false) {
}
virtual void init() {
m_Initialized = true;
}
virtual DcpWidget *constructWidget(int widgetId)
{
DcpWidget * widget = new DcpWidget();
widget->setWidgetId(widgetId);
return widget;
};
virtual QString title() const { return 0; };
virtual QVector<MAction *> viewMenuItems() {
QVector<MAction*> empty;
return empty;
}
virtual DcpBrief* constructBrief(int) { return 0; };
bool initialized() {
return m_Initialized;
}
private:
bool m_Initialized;
};
#endif
|
/*
* Copyright (C) Igor Sysoev
* Copyright (C) Nginx, Inc.
*/
#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_event.h>
ssize_t
ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *chain, off_t limit)
{
u_char *prev;
ssize_t n, size;
ngx_err_t err;
ngx_array_t vec;
ngx_event_t *rev;
struct iovec *iov, iovs[NGX_IOVS_PREALLOCATE];
rev = c->read;
#if (NGX_HAVE_KQUEUE)
if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) {
ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0,
"readv: eof:%d, avail:%d, err:%d",
rev->pending_eof, rev->available, rev->kq_errno);
if (rev->available == 0) {
if (rev->pending_eof) {
rev->ready = 0;
rev->eof = 1;
ngx_log_error(NGX_LOG_INFO, c->log, rev->kq_errno,
"kevent() reported about an closed connection");
if (rev->kq_errno) {
rev->error = 1;
ngx_set_socket_errno(rev->kq_errno);
return NGX_ERROR;
}
return 0;
} else {
return NGX_AGAIN;
}
}
}
#endif
#if (NGX_HAVE_EPOLLRDHUP)
if (ngx_event_flags & NGX_USE_EPOLL_EVENT) {
ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0,
"readv: eof:%d, avail:%d",
rev->pending_eof, rev->available);
if (rev->available == 0 && !rev->pending_eof) {
return NGX_AGAIN;
}
}
#endif
prev = NULL;
iov = NULL;
size = 0;
vec.elts = iovs;
vec.nelts = 0;
vec.size = sizeof(struct iovec);
vec.nalloc = NGX_IOVS_PREALLOCATE;
vec.pool = c->pool;
/* coalesce the neighbouring bufs */
while (chain) {
n = chain->buf->end - chain->buf->last;
if (limit) {
if (size >= limit) {
break;
}
if (size + n > limit) {
n = (ssize_t) (limit - size);
}
}
if (prev == chain->buf->last) {
iov->iov_len += n;
} else {
if (vec.nelts == vec.nalloc) {
break;
}
iov = ngx_array_push(&vec);
if (iov == NULL) {
return NGX_ERROR;
}
iov->iov_base = (void *) chain->buf->last;
iov->iov_len = n;
}
size += n;
prev = chain->buf->end;
chain = chain->next;
}
ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0,
"readv: %ui, last:%uz", vec.nelts, iov->iov_len);
do {
n = readv(c->fd, (struct iovec *) vec.elts, vec.nelts);
if (n == 0) {
rev->ready = 0;
rev->eof = 1;
#if (NGX_HAVE_KQUEUE)
/*
* on FreeBSD readv() may return 0 on closed socket
* even if kqueue reported about available data
*/
if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) {
rev->available = 0;
}
#endif
return 0;
}
if (n > 0) {
#if (NGX_HAVE_KQUEUE)
if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) {
rev->available -= n;
/*
* rev->available may be negative here because some additional
* bytes may be received between kevent() and readv()
*/
if (rev->available <= 0) {
if (!rev->pending_eof) {
rev->ready = 0;
}
rev->available = 0;
}
return n;
}
#endif
#if (NGX_HAVE_FIONREAD)
if (rev->available >= 0) {
rev->available -= n;
/*
* negative rev->available means some additional bytes
* were received between kernel notification and readv(),
* and therefore ev->ready can be safely reset even for
* edge-triggered event methods
*/
if (rev->available < 0) {
rev->available = 0;
rev->ready = 0;
}
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0,
"readv: avail:%d", rev->available);
} else if (n == size) {
if (ngx_socket_nread(c->fd, &rev->available) == -1) {
n = ngx_connection_error(c, ngx_socket_errno,
ngx_socket_nread_n " failed");
break;
}
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0,
"readv: avail:%d", rev->available);
}
#endif
#if (NGX_HAVE_EPOLLRDHUP)
if ((ngx_event_flags & NGX_USE_EPOLL_EVENT)
&& ngx_use_epoll_rdhup)
{
if (n < size) {
if (!rev->pending_eof) {
rev->ready = 0;
}
rev->available = 0;
}
return n;
}
#endif
if (n < size && !(ngx_event_flags & NGX_USE_GREEDY_EVENT)) {
rev->ready = 0;
}
return n;
}
err = ngx_socket_errno;
if (err == NGX_EAGAIN || err == NGX_EINTR) {
ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, err,
"readv() not ready");
n = NGX_AGAIN;
} else {
n = ngx_connection_error(c, err, "readv() failed");
break;
}
} while (err == NGX_EINTR);
rev->ready = 0;
if (n == NGX_ERROR) {
c->read->error = 1;
}
return n;
}
|
/*
* Motif
*
* Copyright (c) 1987-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these librararies and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/*
* HISTORY
*/
/* $XConsortium: TextWcs1.h /main/8 1995/07/13 19:38:06 drk $ */
/*
* (c) Copyright 1987, 1988, 1989 HEWLETT-PACKARD COMPANY */
#ifndef MOTIF1_1
static char starting_string[] = "This is the starting string";
#define NITEMS 7
#define GetSelectionWcs 1
#define InsertWcs 2
#define GetStringWcs 3
#define SetStringWcs 4
#define ReplaceWcs 5
#define FindStringWcs 6
#define GetSubstringWcs 7
/* Global Variables */
char *Istrings[NITEMS] = {
"XmTextGetSelectionWcs()",
"XmTextInsertWcs()",
"XmTextGetStringWcs()",
"XmTextSetStringWcs()",
"XmTextReplaceWcs()",
"XmTextFindStringWcs()",
"XmTextGetSubstringWcs()"
};
Widget Scale1, Scale2, Scale3;
Widget List1;
Widget Text1, StatText;
Widget Label1, Label2, Label3, Label4, Label5, Label6;
Widget Form;
Widget ToggleB, ToggleB2;
Widget ApplyB, ClearB;
static int function;
static int count = 0;
static int scale1_val = 0;
static int scale2_val = 0;
static int scale3_val = 0;
static int position = 0;
static Boolean torf = True;
static XmTextDirection forb = XmTEXT_FORWARD;
/* Private Functions */
static void SSelCB_List1(Widget w, XtPointer client_data,
XtPointer call_data);
static void ApplyCB(Widget w, XtPointer client_data,
XtPointer call_data);
static void ClearCB(Widget w, XtPointer client_data,
XtPointer call_data);
static void Scale1CB(Widget w, XtPointer client_data,
XtPointer call_data);
static void Scale2CB(Widget w, XtPointer client_data,
XtPointer call_data);
static void Scale3CB(Widget w, XtPointer client_data,
XtPointer call_data);
static void TorFCB(Widget w, XtPointer client_data,
XtPointer call_data);
static void ForBCB(Widget w, XtPointer client_data,
XtPointer call_data);
#endif /* MOTIF1_1 */
|
/*
* Motif
*
* Copyright (c) 1987-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these librararies and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/*
* HISTORY
*/
#ifdef REV_INFO
#ifndef lint
static char rcsid[] = "$XConsortium: ErrorDia1.c /main/8 1995/07/13 18:56:51 drk $"
#endif
#endif
/*
* (c) Copyright 1987, 1988, 1989 HEWLETT-PACKARD COMPANY */
#include <signal.h>
#include <X11/StringDefs.h>
#include <testlib.h>
static Widget message1, message2;
void
DestroyCall(w, client, call)
Widget w;
XtPointer client, call;
{
printf("Destroyed MessageBox\n");
}
void
MapFunction (w,d1,d2)
Widget w;
XtPointer d1;
XtPointer d2;
{
static int test = 0;
switch (test) {
case 0: XtManageChild (message1);
test++;
break;
case 1: XtManageChild (message2);
test = 0;
break;
}
}
void
UnmapFunction (w,d1,d2)
Widget w;
XtPointer d1;
XtPointer d2;
{
XtUnmanageChild (w);
printf ("Enter Message 1 \n");
}
void
UnmapFunction2 (w,d1,d2)
Widget w;
XtPointer d1;
XtPointer d2;
{
XtUnmanageChild (w);
printf ("Cancel Message 2 \n");
}
void
UnmapFunction3 (w,d1,d2)
Widget w;
XtPointer d1;
XtPointer d2;
{
XtUnmanageChild (w);
printf ("Enter Message 2 \n");
}
void main (argc, argv)
int argc;
char **argv;
{
Widget w2;
/* initialize toolkit */
CommonTestInit(argc, argv);
w2 = XmCreatePushButton (Shell1, "mapbutton", NULL, 0);
XtManageChild (w2);
message1 = XmCreateErrorDialog(w2, "message1", NULL, 0);
XtAddCallback (w2, XmNactivateCallback, MapFunction, NULL);
XtAddCallback (message1, XmNdestroyCallback, DestroyCall, NULL);
XtAddCallback (message1, XmNokCallback, UnmapFunction, NULL);
message2 = XmCreateErrorDialog(w2, "message2", NULL, 0);
XtAddCallback (message2, XmNokCallback, UnmapFunction3, NULL);
XtAddCallback (message2, XmNcancelCallback, UnmapFunction2, NULL);
XtRealizeWidget(Shell1);
CommonPause();
XtDestroyWidget(message1);
CommonPause();
/* begin test for PIR 3698 */
message1 = XmCreateErrorDialog(w2, NULL, NULL, 0);
XtManageChild (message1);
CommonPause();
/* end test for PIR 3698 */
XtAppMainLoop(app_context);
}
|
#import <UIKit/UIKit.h>
@interface MITDiningHomeViewController : UIViewController
@end
|
/**************************************************************************
**
** Copyright (c) 2014 Dmitry Savchenko
** Copyright (c) 2014 Vasiliy Sorokin
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef CONSTANTS_H
#define CONSTANTS_H
#include <QtGlobal>
namespace Todo {
namespace Constants {
// Default todo item background colors
const char COLOR_TODO_BG[] = "#ccffcc";
const char COLOR_WARNING_BG[] = "#ffffcc";
const char COLOR_FIXME_BG[] = "#ffcccc";
const char COLOR_BUG_BG[] = "#ffcccc";
const char COLOR_NOTE_BG[] = "#e0ebff";
// Todo item icons
// http://en.wikipedia.org/wiki/File:Information_icon_with_gradient_background.svg,
// public domain, tuned a bit
const char ICON_INFO[] = ":/todoplugin/images/info.png";
// Dummy, needs to be changed
const char ICON_TODO[] = ":/todoplugin/images/todo.png";
const char ICON_WARNING[] = ":/projectexplorer/images/compile_warning.png";
const char ICON_ERROR[] = ":/projectexplorer/images/compile_error.png";
// Settings entries
const char SETTINGS_GROUP[] = "TodoPlugin";
const char SCANNING_SCOPE[] = "ScanningScope";
const char ITEMS_DISPLAY_PLACE[] = "ItemsDisplayPlace";
const char KEYWORDS_LIST[] = "Keywords";
const char OUTPUT_PANE_TEXT_WIDTH[] = "OutputPaneTextColumnWidth";
const char OUTPUT_PANE_FILE_WIDTH[] = "OutputPaneFileColumnWidth";
// TODO Output TreeWidget columns
enum OutputColumnIndex {
OUTPUT_COLUMN_TEXT,
OUTPUT_COLUMN_FILE,
OUTPUT_COLUMN_LINE,
OUTPUT_COLUMN_LAST
};
const char OUTPUT_COLUMN_TEXT_TITLE[] = QT_TRANSLATE_NOOP("Todo::Internal::TodoItemsModel", "Description");
const char OUTPUT_COLUMN_FILE_TITLE[] = QT_TRANSLATE_NOOP("Todo::Internal::TodoItemsModel", "File");
const char OUTPUT_COLUMN_LINE_TITLE[] = QT_TRANSLATE_NOOP("Todo::Internal::TodoItemsModel", "Line");
const int OUTPUT_TOOLBAR_SPACER_WIDTH = 25;
const int OUTPUT_PANE_UPDATE_INTERVAL = 2000;
const char OUTPUT_PANE_TITLE[] = QT_TRANSLATE_NOOP("Todo::Internal::TodoOutputPane", "To-Do Entries");
} // namespace Constants
} // namespace Todo
#endif // CONSTANTS_H
|
#ifndef __SP_OBJECT_REPR_H__
#define __SP_OBJECT_REPR_H__
/*
* Object type dictionary and build frontend
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
*
* Copyright (C) 1999-2003 Lauris Kaplinski
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include "forward.h"
namespace Inkscape {
namespace XML {
class Node;
}
}
SPObject *sp_object_repr_build_tree (SPDocument *document, Inkscape::XML::Node *repr);
GType sp_repr_type_lookup (Inkscape::XML::Node *repr);
void sp_object_type_register(gchar const *name, GType type);
#endif
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
|
/*
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2019, assimp team
All rights reserved.
Redistribution and use of this software 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 assimp team, nor the names of its
contributors may be used to endorse or promote products
derived from this software without specific prior
written permission of the assimp team.
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.
----------------------------------------------------------------------
*/
/** @file C4DImporter.h
* @brief Declaration of the Cinema4D (*.c4d) importer class.
*/
#ifndef INCLUDED_AI_CINEMA_4D_LOADER_H
#define INCLUDED_AI_CINEMA_4D_LOADER_H
#include <assimp/BaseImporter.h>
#include <assimp/LogAux.h>
#include <map>
// Forward declarations
struct aiNode;
struct aiMesh;
struct aiMaterial;
struct aiImporterDesc;
namespace melange {
class BaseObject; // c4d_file.h
class PolygonObject;
class BaseMaterial;
class BaseShader;
}
namespace Assimp {
// TinyFormatter.h
namespace Formatter {
template <typename T,typename TR, typename A> class basic_formatter;
typedef class basic_formatter< char, std::char_traits<char>, std::allocator<char> > format;
}
// -------------------------------------------------------------------------------------------
/** Importer class to load Cinema4D files using the Melange library to be obtained from
* www.plugincafe.com
*
* Note that Melange is not free software. */
// -------------------------------------------------------------------------------------------
class C4DImporter : public BaseImporter, public LogFunctions<C4DImporter> {
public:
C4DImporter();
~C4DImporter();
bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
bool checkSig) const;
protected:
// --------------------
const aiImporterDesc* GetInfo () const;
// --------------------
void SetupProperties(const Importer* pImp);
// --------------------
void InternReadFile( const std::string& pFile, aiScene* pScene,
IOSystem* pIOHandler);
private:
void ReadMaterials(melange::BaseMaterial* mat);
void RecurseHierarchy(melange::BaseObject* object, aiNode* parent);
aiMesh* ReadMesh(melange::BaseObject* object);
unsigned int ResolveMaterial(melange::PolygonObject* obj);
bool ReadShader(aiMaterial* out, melange::BaseShader* shader);
std::vector<aiMesh*> meshes;
std::vector<aiMaterial*> materials;
typedef std::map<melange::BaseMaterial*, unsigned int> MaterialMap;
MaterialMap material_mapping;
}; // !class C4DImporter
} // end of namespace Assimp
#endif // INCLUDED_AI_CINEMA_4D_LOADER_H
|
/* Bluetooth: Mesh Generic OnOff, Generic Level, Lighting & Vendor Models
*
* Copyright (c) 2018 Vikrant More
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "common.h"
#include "ble_mesh.h"
#include "device_composition.h"
#include "state_binding.h"
#include "storage.h"
static void unsolicitedly_publish_states_work_handler(struct k_work *work)
{
gen_onoff_publish(&root_models[2]);
gen_level_publish(&root_models[4]);
light_lightness_publish(&root_models[11]);
light_lightness_linear_publish(&root_models[11]);
light_ctl_publish(&root_models[14]);
gen_level_publish(&s0_models[0]);
light_ctl_temp_publish(&s0_models[2]);
}
K_WORK_DEFINE(unsolicitedly_publish_states_work,
unsolicitedly_publish_states_work_handler);
static void unsolicitedly_publish_states_timer_handler(struct k_timer *dummy)
{
k_work_submit(&unsolicitedly_publish_states_work);
}
K_TIMER_DEFINE(unsolicitedly_publish_states_timer,
unsolicitedly_publish_states_timer_handler, NULL);
static void save_lightness_temp_last_values_timer_handler(struct k_timer *dummy)
{
save_on_flash(LIGHTNESS_TEMP_LAST_STATE);
}
K_TIMER_DEFINE(save_lightness_temp_last_values_timer,
save_lightness_temp_last_values_timer_handler, NULL);
static void no_transition_work_handler(struct k_work *work)
{
bool readjust_light_state;
readjust_light_state = false;
if (!bt_mesh_is_provisioned()) {
return;
}
if (target_lightness != lightness) {
lightness = target_lightness;
readjust_lightness();
readjust_light_state = true;
}
if (target_temperature != temperature) {
temperature = target_temperature;
readjust_temperature();
readjust_light_state = true;
}
if (readjust_light_state) {
update_led_gpio();
}
k_timer_start(&unsolicitedly_publish_states_timer, K_MSEC(5000), 0);
/* If Lightness & Temperature values remains stable for
* 10 Seconds then & then only get stored on SoC flash.
*/
if (gen_power_onoff_srv_user_data.onpowerup == STATE_RESTORE) {
k_timer_start(&save_lightness_temp_last_values_timer,
K_MSEC(10000), 0);
}
}
K_WORK_DEFINE(no_transition_work, no_transition_work_handler);
|
#include "f2c.h"
#include "fio.h"
#include "fmt.h"
#include "lio.h"
ftnint L_len;
#ifdef KR_headers
t_putc(c)
#else
t_putc(int c)
#endif
{
f__recpos++;
putc(c, f__cf);
return(0);
}
static VOID
#ifdef KR_headers
lwrt_I(n) long n;
#else
lwrt_I(long n)
#endif
{
char buf[LINTW], *p;
#ifdef USE_STRLEN
(void) sprintf(buf, " %ld", n);
if (f__recpos + strlen(buf) >= L_len)
#else
if (f__recpos + sprintf(buf, " %ld", n) >= L_len)
#endif
(*f__donewrec)();
for (p = buf; *p; PUT(*p++));
}
static VOID
#ifdef KR_headers
lwrt_L(n, len) ftnint n;
ftnlen len;
#else
lwrt_L(ftnint n, ftnlen len)
#endif
{
if (f__recpos + LLOGW >= L_len)
(*f__donewrec)();
wrt_L((Uint *)&n, LLOGW, len);
}
static VOID
#ifdef KR_headers
lwrt_A(p, len) char *p;
ftnlen len;
#else
lwrt_A(char *p, ftnlen len)
#endif
{
int i;
if (f__recpos + len >= L_len)
(*f__donewrec)();
if (!f__recpos)
{
PUT(' ');
++f__recpos;
}
for (i = 0; i < len; i++) PUT(*p++);
}
static int
#ifdef KR_headers
l_g(buf, n) char *buf;
double n;
#else
l_g(char *buf, double n)
#endif
{
#ifdef Old_list_output
doublereal absn;
char *fmt;
absn = n;
if (absn < 0)
absn = -absn;
fmt = LLOW <= absn && absn < LHIGH ? LFFMT : LEFMT;
#ifdef USE_STRLEN
sprintf(buf, fmt, n);
return strlen(buf);
#else
return sprintf(buf, fmt, n);
#endif
#else
register char *b, c, c1;
b = buf;
*b++ = ' ';
if (n < 0)
{
*b++ = '-';
n = -n;
}
else
*b++ = ' ';
if (n == 0)
{
*b++ = '0';
*b++ = '.';
*b = 0;
goto f__ret;
}
sprintf(b, LGFMT, n);
if (*b == '0')
{
while (b[0] = b[1])
b++;
}
/* Fortran 77 insists on having a decimal point... */
else for (;; b++)
switch (*b)
{
case 0:
*b++ = '.';
*b = 0;
goto f__ret;
case '.':
while (*++b);
goto f__ret;
case 'E':
for (c1 = '.', c = 'E'; *b = c1;
c1 = c, c = *++b);
goto f__ret;
}
f__ret:
return b - buf;
#endif
}
static VOID
#ifdef KR_headers
l_put(s) register char *s;
#else
l_put(register char *s)
#endif
{
#ifdef KR_headers
register int c, (*pn)() = f__putn;
#else
register int c, (*pn)(int) = f__putn;
#endif
while (c = *s++)
(*pn)(c);
}
static VOID
#ifdef KR_headers
lwrt_F(n) double n;
#else
lwrt_F(double n)
#endif
{
char buf[LEFBL];
if (f__recpos + l_g(buf, n) >= L_len)
(*f__donewrec)();
l_put(buf);
}
static VOID
#ifdef KR_headers
lwrt_C(a, b) double a, b;
#else
lwrt_C(double a, double b)
#endif
{
char *ba, *bb, bufa[LEFBL], bufb[LEFBL];
int al, bl;
al = l_g(bufa, a);
for (ba = bufa; *ba == ' '; ba++)
--al;
bl = l_g(bufb, b) + 1; /* intentionally high by 1 */
for (bb = bufb; *bb == ' '; bb++)
--bl;
if (f__recpos + al + bl + 3 >= L_len && f__recpos)
(*f__donewrec)();
PUT(' ');
PUT('(');
l_put(ba);
PUT(',');
if (f__recpos + bl >= L_len)
{
(*f__donewrec)();
PUT(' ');
}
l_put(bb);
PUT(')');
}
#ifdef KR_headers
l_write(number, ptr, len, type) ftnint *number, type;
char *ptr;
ftnlen len;
#else
l_write(ftnint *number, char *ptr, ftnlen len, ftnint type)
#endif
{
#define Ptr ((flex *)ptr)
int i;
long x;
double y, z;
real *xx;
doublereal *yy;
for (i = 0; i < *number; i++)
{
switch ((int)type)
{
default:
f__fatal(204, "unknown type in lio");
case TYINT1:
x = Ptr->flchar;
goto xint;
case TYSHORT:
x = Ptr->flshort;
goto xint;
#ifdef TYQUAD
case TYQUAD:
x = Ptr->fllongint;
goto xint;
#endif
case TYLONG:
x = Ptr->flint;
xint:
lwrt_I(x);
break;
case TYREAL:
y = Ptr->flreal;
goto xfloat;
case TYDREAL:
y = Ptr->fldouble;
xfloat:
lwrt_F(y);
break;
case TYCOMPLEX:
xx = &Ptr->flreal;
y = *xx++;
z = *xx;
goto xcomplex;
case TYDCOMPLEX:
yy = &Ptr->fldouble;
y = *yy++;
z = *yy;
xcomplex:
lwrt_C(y, z);
break;
case TYLOGICAL1:
x = Ptr->flchar;
goto xlog;
case TYLOGICAL2:
x = Ptr->flshort;
goto xlog;
case TYLOGICAL:
x = Ptr->flint;
xlog:
lwrt_L(Ptr->flint, len);
break;
case TYCHAR:
lwrt_A(ptr, len);
break;
}
ptr += len;
}
return(0);
}
|
#include <time.h>
static const nanotime_t nanoseconds_in_second = 1000000000LL;
nanotime_t get_nanotime(void) {
struct timespec time_var;
/* Possible other values we could have used are CLOCK_MONOTONIC,
* which is takes longer to retrieve and CLOCK_PROCESS_CPUTIME_ID
* which, if I understand it correctly, would require the R
* process to be bound to one core.
*/
clock_gettime(CLOCK_MONOTONIC, &time_var);
nanotime_t sec = time_var.tv_sec;
nanotime_t nsec = time_var.tv_nsec;
/* Combine both values to one nanoseconds value */
return (nanoseconds_in_second * sec) + nsec;
}
|
/*
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MTDUTILS_H_
#define MTDUTILS_H_
#include <sys/types.h> // for size_t, etc.
typedef struct MtdPartition MtdPartition;
int mtd_scan_partitions(void);
const MtdPartition *mtd_find_partition_by_name(const char *name);
/* mount_point is like "/system"
* filesystem is like "yaffs2"
*/
int mtd_mount_partition(const MtdPartition *partition, const char *mount_point,
const char *filesystem, int read_only);
/* get the partition and the minimum erase/write block size. NULL is ok.
*/
int mtd_partition_info(const MtdPartition *partition,
size_t *total_size, size_t *erase_size, size_t *write_size);
/* read or write raw data from a partition, starting at the beginning.
* skips bad blocks as best we can.
*/
typedef struct MtdReadContext MtdReadContext;
typedef struct MtdWriteContext MtdWriteContext;
MtdReadContext *mtd_read_partition(const MtdPartition *);
ssize_t mtd_read_data(MtdReadContext *, char *data, size_t data_len);
void mtd_read_close(MtdReadContext *);
void mtd_read_skip_to(const MtdReadContext *, size_t offset);
MtdWriteContext *mtd_write_partition(const MtdPartition *);
ssize_t mtd_write_data(MtdWriteContext *, const char *data, size_t data_len);
off_t mtd_erase_blocks(MtdWriteContext *, int blocks); /* 0 ok, -1 for all */
off_t mtd_find_write_start(MtdWriteContext *ctx, off_t pos);
int mtd_write_close(MtdWriteContext *);
#endif // MTDUTILS_H_
|
#pragma once
#include "Screen.h"
class InGamePlayScreen : public Screen {
public:
virtual ~InGamePlayScreen();
virtual void _init(int, int);
virtual void onFocusGained();
virtual void tick(int, int);
virtual void applyInput(float);
virtual void preRenderUpdate(RenderGraphContext&);
virtual void render(ScreenContext&);
virtual void postRender(UIScreenContext&);
virtual bool renderGameBehind() const;
virtual bool isModal() const;
virtual bool isShowingMenu() const;
virtual bool shouldStealMouse() const;
virtual bool isPlayScreen() const;
virtual bool renderOnlyWhenTopMost() const;
virtual std::string getScreenName() const;
virtual std::string getScreenNameW() const;
virtual void* getSendEvents();
virtual void handleDirection(DirectionId, float, float);
virtual void _renderLevelPrep(ScreenContext&, LevelRenderer&, Entity&);
virtual void _renderLevel(ScreenContext&);
virtual void _preLevelRender(ScreenContext&);
virtual void _postLevelRenderer(ScreenContext&);
virtual bool _shouldRenderFirstPersonObjects(LevelRenderer&) const;
virtual void _renderedFramedItems(ScreenContext&, LevelRenderer&, Entity&)
virtual void _updateFreeformPickDirection(float, Vec3&, Vec3&);
virtual void _saveMatrices();
virtual void _renderFirstPerson3DObjects(LevelRenderer&, float);
virtual void _renderTransparentFirstPerson3DObjects(LevelRenderer&, float);
virtual void _renderItemInHand(Player&, bool, float);
virtual bool _shouldClipLiquids() const;
virtual void* _getThirdPersonSettings();
virtual bool _isHoloViewer() const;
virtual void _prepareCuller(FrustumData&, FrustumData&);
virtual void _localPlayerTurned(float);
virtual void* _getPickRange();
virtual bool _shouldPushHUD();
virtual void _setHoloMode();
virtual void _updateInGameCursor();
InGamePlayScreen(MinecraftGame&, ClientInstance&);
}
|
/*
* ZMap Copyright 2013 Regents of the University of Michigan
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <assert.h>
#include "../../lib/includes.h"
#include "../../lib/xalloc.h"
#include <sys/time.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <netinet/udp.h>
#include <netinet/ip_icmp.h>
#include <arpa/inet.h>
#include <json.h>
#include "../../lib/logger.h"
#include "output_modules.h"
#include "../probe_modules/probe_modules.h"
static FILE *file = NULL;
int json_output_file_init(struct state_conf *conf, UNUSED char **fields,
UNUSED int fieldlens)
{
assert(conf);
if (!conf->output_filename) {
file = stdout;
} else if (!strcmp(conf->output_filename, "-")) {
file = stdout;
} else {
if (!(file = fopen(conf->output_filename, "w"))) {
log_fatal("output-json", "could not open JSON output file %s",
conf->output_filename);
}
}
check_and_log_file_error(file, "json");
return EXIT_SUCCESS;
}
static void json_output_file_store_data(json_object *obj, const char* name,
const u_char *packet, size_t buflen)
{
char *buf = xmalloc((buflen*2)+1);
for (int i=0; i < (int) buflen; i++) {
snprintf(buf + (i*2), 3, "%.2x", packet[i]);
}
buf[buflen*2] = 0;
json_object_object_add(obj, name, json_object_new_string(buf));
free(buf);
}
int json_output_file_ip(fieldset_t *fs)
{
if (!file) {
return EXIT_SUCCESS;
}
json_object *obj = json_object_new_object();
for (int i=0; i < fs->len; i++) {
field_t *f = &(fs->fields[i]);
if (f->type == FS_STRING) {
json_object_object_add(obj, f->name,
json_object_new_string((char *) f->value.ptr));
} else if (f->type == FS_UINT64) {
json_object_object_add(obj, f->name,
json_object_new_int((int) f->value.num));
} else if (f->type == FS_BINARY) {
json_output_file_store_data(obj, f->name,
(const u_char*) f->value.ptr, f->len);
} else if (f->type == FS_NULL) {
// do nothing
} else {
log_fatal("json", "received unknown output type");
}
}
fprintf(file, "%s\n", json_object_to_json_string(obj));
fflush(file);
check_and_log_file_error(file, "json");
json_object_put(obj);
return EXIT_SUCCESS;
}
int json_output_file_close(UNUSED struct state_conf* c,
UNUSED struct state_send* s, UNUSED struct state_recv* r)
{
if (file) {
fflush(file);
fclose(file);
}
return EXIT_SUCCESS;
}
output_module_t module_json_file = {
.name = "json",
.init = &json_output_file_init,
.filter_duplicates = 0, // framework should not filter out duplicates
.filter_unsuccessful = 0, // framework should not filter out unsuccessful
.start = NULL,
.update = NULL,
.update_interval = 0,
.close = &json_output_file_close,
.process_ip = &json_output_file_ip,
.helptext = "Outputs one or more output fileds as a json valid file. By default, the \n"
"probe module does not filter out duplicates or limit to successful fields, \n"
"but rather includes all received packets. Fields can be controlled by \n"
"setting --output-fields. Filtering out failures and duplicate pakcets can \n"
"be achieved by setting an --output-filter."
};
|
/*
* Copyright 2015 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef KYTHE_CXX_COMMON_KYTHE_URI_H_
#define KYTHE_CXX_COMMON_KYTHE_URI_H_
#include <string>
#include "kythe/cxx/common/vname_ordering.h"
#include "kythe/proto/storage.pb.h"
#include "llvm/ADT/StringRef.h"
namespace kythe {
/// \brief A Kythe URI.
///
/// URIs are not in 1:1 correspondence with VNames--particularly because
/// the `corpus` component is considered to be a path that can be lexically
/// canonicalized. For example, the corpus "a/b/../c" is equivalent to the
/// corpus "a/c".
class URI {
public:
URI() {}
/// \brief Builds a URI from a `VName`, canonicalizing its `corpus`.
explicit URI(const kythe::proto::VName &from_vname);
bool operator==(const URI &o) const { return VNameEquals(vname_, o.vname_); }
bool operator!=(const URI &o) const { return !VNameEquals(vname_, o.vname_); }
/// \brief Constructs a URI from an encoded string.
/// \param uri The string to construct from.
/// \return (true, URI) on success; (false, empty URI) on failure.
static std::pair<bool, URI> FromString(const std::string &uri) {
URI result;
bool is_ok = result.ParseString(uri);
return std::make_pair(is_ok, result);
}
/// \brief Encodes this URI as a string.
///
/// \return This URI, appropriately escaped.
std::string ToString() const;
/// \return This URI as a VName.
const kythe::proto::VName &v_name() { return vname_; }
private:
/// \brief Attempts to overwrite vname_ using the provided URI string.
/// \param uri The URI to parse.
/// \return true on success
bool ParseString(llvm::StringRef uri);
/// The VName this URI represents.
kythe::proto::VName vname_;
};
} // namespace kythe
#endif
|
/*
* Copyright (C) 2008 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <unwind.h>
#include <sys/types.h>
// =============================================================================
// stack trace functions
// =============================================================================
typedef struct
{
size_t count;
intptr_t* addrs;
} stack_crawl_state_t;
/* depends how the system includes define this */
#ifdef HAVE_UNWIND_CONTEXT_STRUCT
typedef struct _Unwind_Context __unwind_context;
#else
typedef _Unwind_Context __unwind_context;
#endif
static _Unwind_Reason_Code trace_function(__unwind_context *context, void *arg)
{
stack_crawl_state_t* state = (stack_crawl_state_t*)arg;
if (state->count) {
intptr_t ip = (intptr_t)_Unwind_GetIP(context);
if (ip) {
state->addrs[0] = ip;
state->addrs++;
state->count--;
return _URC_NO_REASON;
}
}
/*
* If we run out of space to record the address or 0 has been seen, stop
* unwinding the stack.
*/
return _URC_END_OF_STACK;
}
int heaptracker_stacktrace(intptr_t* addrs, size_t max_entries)
{
stack_crawl_state_t state;
state.count = max_entries;
state.addrs = (intptr_t*)addrs;
_Unwind_Backtrace(trace_function, (void*)&state);
return max_entries - state.count;
}
|
/*=========================================================================
*
* Copyright Insight Software Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#ifndef __itkChainCodePath_h
#define __itkChainCodePath_h
#include "itkPath.h"
#include "itkOffset.h"
#include "itkObjectFactory.h"
#include <vector>
namespace itk
{
/** \class ChainCodePath
* \brief Represent a path as a sequence of connected image index offsets
*
* This class is intended to represent sequences of connected indices in an
* image. It does so by storing the offset of each index from its immediately
* preceding, connected, index. The only image index stored directly is that
* of the first index. ChainCodePath maps a 1D integer input (step number) to
* an ND integer output (either an offset or an image index, depending on
* whether Evaluate or EvaluateToIndex is called).
*
* \sa ChainCodePath2D
* \sa ParametricPath
* \sa Path
* \sa Index
* \sa Offset
*
* \ingroup PathObjects
* \ingroup ITKPath
*/
template< unsigned int VDimension >
class ITK_EXPORT ChainCodePath:public
Path< unsigned int, Offset< VDimension >, VDimension >
{
public:
/** Dimension underlying input image. */
itkStaticConstMacro(Dimension, unsigned int, VDimension);
/** Standard class typedefs. */
typedef ChainCodePath< VDimension > Self;
typedef Path< unsigned int, Offset< VDimension >, VDimension > Superclass;
typedef SmartPointer< Self > Pointer;
typedef SmartPointer< const Self > ConstPointer;
/** Run-time type information (and related methods). */
itkTypeMacro(ChainCodePath, Path);
/** OutputType typedef support. */
typedef typename Superclass::OutputType OutputType;
typedef typename Superclass::InputType InputType;
/** The output type of this function is an Index */
typedef OutputType OffsetType;
typedef Index< VDimension > IndexType;
typedef std::vector< OffsetType > ChainCodeType;
typedef typename ChainCodeType::size_type ChainCodeSizeType;
// Functions inherited from Path
/** Evaluate the chaincode for the offset at the specified path-position. */
virtual OutputType Evaluate(const InputType & input) const
{
return m_Chain[input];
}
/** Like Evaluate(), but returns the index at the specified path-position. */
virtual IndexType EvaluateToIndex(const InputType & input) const;
/** Increment the input variable passed by reference and then return the
* offset stored at the new path-position. If the chaincode is unable to be
* incremented, input is not changed and an offset of zero is returned, which
* may be used to check for the end of the chain code. */
virtual OffsetType IncrementInput(InputType & input) const;
/** Where does the path end (what is the last valid input value)? */
virtual inline InputType EndOfInput() const
{
return NumberOfSteps(); // 0 is before the first step, 1 is after it
}
/** New() method for dynamic construction */
itkNewMacro(Self);
/** Set/Get the index associated with the initial position of the path */
itkSetMacro(Start, IndexType);
itkGetConstReferenceMacro(Start, IndexType);
/** Insert a new step into the chaincode at a specified position */
virtual inline void InsertStep(InputType position, OffsetType step)
{
m_Chain.insert(m_Chain.begin() + position, step);
this->Modified();
}
/** Change the direction of a step in the chaincode */
virtual inline void ChangeStep(InputType position, OffsetType step)
{
m_Chain[position] = step;
this->Modified();
}
/** Remove all steps from the chain code */
virtual inline void Clear()
{
m_Chain.clear();
this->Modified();
}
/** How many steps in the chaincode? */
virtual inline ChainCodeSizeType NumberOfSteps() const
{
return m_Chain.size();
}
/** Needed for Pipelining */
virtual void Initialize(void)
{
m_Start = this->GetZeroIndex();
this->Clear();
}
protected:
ChainCodePath();
~ChainCodePath() {}
void PrintSelf(std::ostream & os, Indent indent) const;
private:
ChainCodePath(const Self &); //purposely not implemented
void operator=(const Self &); //purposely not implemented
IndexType m_Start; // origin image index for the path
ChainCodeType m_Chain; // the chain code (vector of offsets)
};
} // end namespace itk
#ifndef ITK_MANUAL_INSTANTIATION
#include "itkChainCodePath.hxx"
#endif
#endif
|
/**
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef EXTENSIONS_COAP_NANOFI_COAP_FUNCTIONS_H_
#define EXTENSIONS_COAP_NANOFI_COAP_FUNCTIONS_H_
#ifdef __cplusplus
extern "C" {
#endif
typedef unsigned char method_t;
#include "coap2/coap.h"
#include "coap2/uri.h"
#include "coap2/address.h"
#include <stdio.h>
#include <string.h>
#ifdef WIN32
#include <winsock2.h>
#else
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#endif
#include "coap_message.h"
typedef struct {
void (*data_received)(void *receiver_context, struct coap_context_t *ctx, CoapMessage *const);
void (*received_error)(void *receiver_context, struct coap_context_t *ctx, unsigned int code);
} callback_pointers;
// defines the context specific data for the data receiver
static void *receiver;
static callback_pointers global_ptrs;
/**
* Initialize the API access. Not thread safe.
*/
void init_coap_api(void *rcvr, callback_pointers *ptrs);
/**
* Creates a CoAP session. Provide it double pointer to the context and session to instantiate those structs.
* @param ctx coap context
* @param session coap session
* @param node device node name
* @param dst_addr destination address
* @return 0 if success -1 otherwise.
*/
int create_session(coap_context_t **ctx, coap_session_t **session, const char *node, const char *port, coap_address_t *dst_addr);
/**
* Creates an endpoint context
* @param ctx pointer to a context
* @param node device node name
* @param port device port
*/
int create_endpoint_context(coap_context_t **ctx, const char *node, const char *port);
/**
* Creates a request object with an already allocated context and session. The option list is sent in as an arry ptr.
* @param ctx coap context
* @param session coap session
* @param optlist option list array
* @param code coap request code
* @param ptr ptr to the coap payload
* @returns pointer to a newly formed PDU ( protocol data unit )
*/
struct coap_pdu_t *create_request(struct coap_context_t *ctx, struct coap_session_t *session, coap_optlist_t **optlist, unsigned char code, coap_str_const_t *ptr);
/**
* Function can be used to receive coap events
* @param ctx context that performed event
* @param event coap event launched
* @param session session that performed event.
* @return 0 as a success ( events in this library aren't noteworthy to PDU )
*/
int coap_event(struct coap_context_t *ctx, coap_event_t event, struct coap_session_t *session);
/**
* Function can be used when a noack is received from the library
* @param ctx context that performed event
* @param session session that performed event.
* @parma sent pdu that was sent
* @param reason reason PDU was not acked
* @param event coap event launched
* @param id id of ack
*/
void no_acknowledgement(struct coap_context_t *ctx, coap_session_t *session, coap_pdu_t *sent, coap_nack_reason_t reason, const coap_tid_t id);
/**
* Responser handler is the function launched when data is received
* @param ctx context
* @param session coap session
* @param sent PDU that was sent
* @param received PDU that was received
* @param id id of ack
*/
void response_handler(struct coap_context_t *ctx, struct coap_session_t *session, coap_pdu_t *sent, coap_pdu_t *received, const coap_tid_t id);
/**
* Resolves the destination address of the server and places that into dst
* @param server server to connect to
* @param dst destination pointer
* @return 0 if sucess -1 otherwise
*/
int resolve_address(const struct coap_str_const_t *server, struct sockaddr *destination);
#ifdef __cplusplus
}
#endif
#endif /* EXTENSIONS_COAP_NANOFI_COAP_FUNCTIONS_H_ */
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/alexaforbusiness/AlexaForBusiness_EXPORTS.h>
#include <aws/alexaforbusiness/AlexaForBusinessRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>
namespace Aws
{
namespace AlexaForBusiness
{
namespace Model
{
/**
*/
class AWS_ALEXAFORBUSINESS_API RejectSkillRequest : public AlexaForBusinessRequest
{
public:
RejectSkillRequest();
// Service request name is the Operation name which will send this request out,
// each operation should has unique request name, so that we can get operation's name from this request.
// Note: this is not true for response, multiple operations may have the same response name,
// so we can not get operation's name from response.
inline virtual const char* GetServiceRequestName() const override { return "RejectSkill"; }
Aws::String SerializePayload() const override;
Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override;
/**
* <p>The unique identifier of the skill.</p>
*/
inline const Aws::String& GetSkillId() const{ return m_skillId; }
/**
* <p>The unique identifier of the skill.</p>
*/
inline bool SkillIdHasBeenSet() const { return m_skillIdHasBeenSet; }
/**
* <p>The unique identifier of the skill.</p>
*/
inline void SetSkillId(const Aws::String& value) { m_skillIdHasBeenSet = true; m_skillId = value; }
/**
* <p>The unique identifier of the skill.</p>
*/
inline void SetSkillId(Aws::String&& value) { m_skillIdHasBeenSet = true; m_skillId = std::move(value); }
/**
* <p>The unique identifier of the skill.</p>
*/
inline void SetSkillId(const char* value) { m_skillIdHasBeenSet = true; m_skillId.assign(value); }
/**
* <p>The unique identifier of the skill.</p>
*/
inline RejectSkillRequest& WithSkillId(const Aws::String& value) { SetSkillId(value); return *this;}
/**
* <p>The unique identifier of the skill.</p>
*/
inline RejectSkillRequest& WithSkillId(Aws::String&& value) { SetSkillId(std::move(value)); return *this;}
/**
* <p>The unique identifier of the skill.</p>
*/
inline RejectSkillRequest& WithSkillId(const char* value) { SetSkillId(value); return *this;}
private:
Aws::String m_skillId;
bool m_skillIdHasBeenSet;
};
} // namespace Model
} // namespace AlexaForBusiness
} // namespace Aws
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/rekognition/Rekognition_EXPORTS.h>
#include <aws/rekognition/RekognitionRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>
namespace Aws
{
namespace Rekognition
{
namespace Model
{
/**
*/
class AWS_REKOGNITION_API DeleteStreamProcessorRequest : public RekognitionRequest
{
public:
DeleteStreamProcessorRequest();
// Service request name is the Operation name which will send this request out,
// each operation should has unique request name, so that we can get operation's name from this request.
// Note: this is not true for response, multiple operations may have the same response name,
// so we can not get operation's name from response.
inline virtual const char* GetServiceRequestName() const override { return "DeleteStreamProcessor"; }
Aws::String SerializePayload() const override;
Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override;
/**
* <p>The name of the stream processor you want to delete.</p>
*/
inline const Aws::String& GetName() const{ return m_name; }
/**
* <p>The name of the stream processor you want to delete.</p>
*/
inline bool NameHasBeenSet() const { return m_nameHasBeenSet; }
/**
* <p>The name of the stream processor you want to delete.</p>
*/
inline void SetName(const Aws::String& value) { m_nameHasBeenSet = true; m_name = value; }
/**
* <p>The name of the stream processor you want to delete.</p>
*/
inline void SetName(Aws::String&& value) { m_nameHasBeenSet = true; m_name = std::move(value); }
/**
* <p>The name of the stream processor you want to delete.</p>
*/
inline void SetName(const char* value) { m_nameHasBeenSet = true; m_name.assign(value); }
/**
* <p>The name of the stream processor you want to delete.</p>
*/
inline DeleteStreamProcessorRequest& WithName(const Aws::String& value) { SetName(value); return *this;}
/**
* <p>The name of the stream processor you want to delete.</p>
*/
inline DeleteStreamProcessorRequest& WithName(Aws::String&& value) { SetName(std::move(value)); return *this;}
/**
* <p>The name of the stream processor you want to delete.</p>
*/
inline DeleteStreamProcessorRequest& WithName(const char* value) { SetName(value); return *this;}
private:
Aws::String m_name;
bool m_nameHasBeenSet;
};
} // namespace Model
} // namespace Rekognition
} // namespace Aws
|
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2012-09-30 Bernard first version.
* 2021-08-18 chenyingchun add comments
*/
#include <rthw.h>
#include <rtthread.h>
#include <rtdevice.h>
#define RT_COMPLETED 1
#define RT_UNCOMPLETED 0
/**
* @brief This function will initialize a completion object.
*
* @param completion is a pointer to a completion object.
*/
void rt_completion_init(struct rt_completion *completion)
{
rt_base_t level;
RT_ASSERT(completion != RT_NULL);
level = rt_hw_interrupt_disable();
completion->flag = RT_UNCOMPLETED;
rt_list_init(&completion->suspended_list);
rt_hw_interrupt_enable(level);
}
RTM_EXPORT(rt_completion_init);
/**
* @brief This function will wait for a completion, if the completion is unavailable, the thread shall wait for
* the completion up to a specified time.
*
* @param completion is a pointer to a completion object.
*
* @param timeout is a timeout period (unit: OS ticks). If the completion is unavailable, the thread will wait for
* the completion done up to the amount of time specified by the argument.
* NOTE: Generally, we use the macro RT_WAITING_FOREVER to set this parameter, which means that when the
* completion is unavailable, the thread will be waitting forever.
*
* @return Return the operation status. ONLY when the return value is RT_EOK, the operation is successful.
* If the return value is any other values, it means that the completion wait failed.
*
* @warning This function can ONLY be called in the thread context. It MUST NOT be called in interrupt context.
*/
rt_err_t rt_completion_wait(struct rt_completion *completion,
rt_int32_t timeout)
{
rt_err_t result;
rt_base_t level;
rt_thread_t thread;
RT_ASSERT(completion != RT_NULL);
result = RT_EOK;
thread = rt_thread_self();
level = rt_hw_interrupt_disable();
if (completion->flag != RT_COMPLETED)
{
/* only one thread can suspend on complete */
RT_ASSERT(rt_list_isempty(&(completion->suspended_list)));
if (timeout == 0)
{
result = -RT_ETIMEOUT;
goto __exit;
}
else
{
/* reset thread error number */
thread->error = RT_EOK;
/* suspend thread */
rt_thread_suspend(thread);
/* add to suspended list */
rt_list_insert_before(&(completion->suspended_list),
&(thread->tlist));
/* current context checking */
RT_DEBUG_NOT_IN_INTERRUPT;
/* start timer */
if (timeout > 0)
{
/* reset the timeout of thread timer and start it */
rt_timer_control(&(thread->thread_timer),
RT_TIMER_CTRL_SET_TIME,
&timeout);
rt_timer_start(&(thread->thread_timer));
}
/* enable interrupt */
rt_hw_interrupt_enable(level);
/* do schedule */
rt_schedule();
/* thread is waked up */
result = thread->error;
level = rt_hw_interrupt_disable();
}
}
/* clean completed flag */
completion->flag = RT_UNCOMPLETED;
__exit:
rt_hw_interrupt_enable(level);
return result;
}
RTM_EXPORT(rt_completion_wait);
/**
* @brief This function indicates a completion has done.
*
* @param completion is a pointer to a completion object.
*/
void rt_completion_done(struct rt_completion *completion)
{
rt_base_t level;
RT_ASSERT(completion != RT_NULL);
if (completion->flag == RT_COMPLETED)
return;
level = rt_hw_interrupt_disable();
completion->flag = RT_COMPLETED;
if (!rt_list_isempty(&(completion->suspended_list)))
{
/* there is one thread in suspended list */
struct rt_thread *thread;
/* get thread entry */
thread = rt_list_entry(completion->suspended_list.next,
struct rt_thread,
tlist);
/* resume it */
rt_thread_resume(thread);
rt_hw_interrupt_enable(level);
/* perform a schedule */
rt_schedule();
}
else
{
rt_hw_interrupt_enable(level);
}
}
RTM_EXPORT(rt_completion_done);
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/codestar-notifications/CodeStarNotifications_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSMap.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>
namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;
namespace Utils
{
namespace Json
{
class JsonValue;
} // namespace Json
} // namespace Utils
namespace CodeStarNotifications
{
namespace Model
{
class AWS_CODESTARNOTIFICATIONS_API TagResourceResult
{
public:
TagResourceResult();
TagResourceResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
TagResourceResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
/**
* <p>The list of tags associated with the resource.</p>
*/
inline const Aws::Map<Aws::String, Aws::String>& GetTags() const{ return m_tags; }
/**
* <p>The list of tags associated with the resource.</p>
*/
inline void SetTags(const Aws::Map<Aws::String, Aws::String>& value) { m_tags = value; }
/**
* <p>The list of tags associated with the resource.</p>
*/
inline void SetTags(Aws::Map<Aws::String, Aws::String>&& value) { m_tags = std::move(value); }
/**
* <p>The list of tags associated with the resource.</p>
*/
inline TagResourceResult& WithTags(const Aws::Map<Aws::String, Aws::String>& value) { SetTags(value); return *this;}
/**
* <p>The list of tags associated with the resource.</p>
*/
inline TagResourceResult& WithTags(Aws::Map<Aws::String, Aws::String>&& value) { SetTags(std::move(value)); return *this;}
/**
* <p>The list of tags associated with the resource.</p>
*/
inline TagResourceResult& AddTags(const Aws::String& key, const Aws::String& value) { m_tags.emplace(key, value); return *this; }
/**
* <p>The list of tags associated with the resource.</p>
*/
inline TagResourceResult& AddTags(Aws::String&& key, const Aws::String& value) { m_tags.emplace(std::move(key), value); return *this; }
/**
* <p>The list of tags associated with the resource.</p>
*/
inline TagResourceResult& AddTags(const Aws::String& key, Aws::String&& value) { m_tags.emplace(key, std::move(value)); return *this; }
/**
* <p>The list of tags associated with the resource.</p>
*/
inline TagResourceResult& AddTags(Aws::String&& key, Aws::String&& value) { m_tags.emplace(std::move(key), std::move(value)); return *this; }
/**
* <p>The list of tags associated with the resource.</p>
*/
inline TagResourceResult& AddTags(const char* key, Aws::String&& value) { m_tags.emplace(key, std::move(value)); return *this; }
/**
* <p>The list of tags associated with the resource.</p>
*/
inline TagResourceResult& AddTags(Aws::String&& key, const char* value) { m_tags.emplace(std::move(key), value); return *this; }
/**
* <p>The list of tags associated with the resource.</p>
*/
inline TagResourceResult& AddTags(const char* key, const char* value) { m_tags.emplace(key, value); return *this; }
private:
Aws::Map<Aws::String, Aws::String> m_tags;
};
} // namespace Model
} // namespace CodeStarNotifications
} // namespace Aws
|
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_BROWSER_LOADER_ASYNC_REVALIDATION_DRIVER_H_
#define CONTENT_BROWSER_LOADER_ASYNC_REVALIDATION_DRIVER_H_
#include <memory>
#include <string>
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/timer/timer.h"
#include "content/common/content_export.h"
#include "content/public/browser/resource_controller.h"
#include "content/public/browser/resource_throttle.h"
#include "net/base/io_buffer.h"
#include "net/url_request/url_request.h"
namespace net {
class HttpCache;
}
namespace content {
// This class is responsible for driving the URLRequest for an async
// revalidation. It is passed an instance of ResourceThrottle created by
// content::ResourceScheduler to perform throttling on the request.
class CONTENT_EXPORT AsyncRevalidationDriver : public net::URLRequest::Delegate,
public ResourceController {
public:
// |completion_callback| is guaranteed to be called on completion,
// regardless of success or failure.
AsyncRevalidationDriver(std::unique_ptr<net::URLRequest> request,
std::unique_ptr<ResourceThrottle> throttle,
const base::Closure& completion_callback);
~AsyncRevalidationDriver() override;
void StartRequest();
private:
// This enum is logged as histogram "Net.AsyncRevalidation.Result". Only add
// new entries at the end and update histograms.xml to match.
enum AsyncRevalidationResult {
RESULT_LOADED,
RESULT_REVALIDATED,
RESULT_NET_ERROR,
RESULT_READ_ERROR,
RESULT_GOT_REDIRECT,
RESULT_AUTH_FAILED,
RESULT_RESPONSE_TIMEOUT,
RESULT_BODY_TIMEOUT,
RESULT_MAX
};
// net::URLRequest::Delegate implementation:
void OnReceivedRedirect(net::URLRequest* request,
const net::RedirectInfo& redirect_info,
bool* defer) override;
void OnAuthRequired(net::URLRequest* request,
net::AuthChallengeInfo* info) override;
void OnResponseStarted(net::URLRequest* request) override;
void OnReadCompleted(net::URLRequest* request, int bytes_read) override;
// ResourceController implementation:
void Resume() override;
// For simplicity, this class assumes that ResourceScheduler never cancels
// requests, and so these three methods are never called.
void Cancel() override;
void CancelAndIgnore() override;
void CancelWithError(int error_code) override;
// Internal methods.
void StartRequestInternal();
void CancelRequestInternal(int error, AsyncRevalidationResult result);
void StartReading(bool is_continuation);
void ReadMore(int* bytes_read);
// Logs the result histogram, then calls and clears |completion_callback_|.
void ResponseCompleted(AsyncRevalidationResult result);
void OnTimeout(AsyncRevalidationResult result);
void RecordDefer();
bool is_deferred_ = false;
scoped_refptr<net::IOBuffer> read_buffer_;
base::OneShotTimer timer_;
std::unique_ptr<net::URLRequest> request_;
std::unique_ptr<ResourceThrottle> throttle_;
base::Closure completion_callback_;
base::WeakPtrFactory<AsyncRevalidationDriver> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(AsyncRevalidationDriver);
};
} // namespace content
#endif // CONTENT_BROWSER_LOADER_ASYNC_REVALIDATION_DRIVER_H_
|
/* crypto/conf/test.c */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
* by Eric Young (eay@cryptsoft.com).
* The implementation was written so as to conform with Netscapes SSL.
*
* This library is free for commercial and non-commercial use as long as
* the following conditions are aheared to. The following conditions
* apply to all code found in this distribution, be it the RC4, RSA,
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
* included with this distribution is covered by the same copyright terms
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
*
* Copyright remains Eric Young's, and as such any Copyright notices in
* the code are not to be removed.
* If this package is used in a product, Eric Young should be given attribution
* as the author of the parts of the library used.
* This can be in the form of a textual message at program startup or
* in documentation (online or textual) provided with the package.
*
* 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 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. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* "This product includes cryptographic software written by
* Eric Young (eay@cryptsoft.com)"
* The word 'cryptographic' can be left out if the rouines from the library
* being used are not cryptographic related :-).
* 4. If you include any Windows specific code (or a derivative thereof) from
* the apps directory (application code) you must include an acknowledgement:
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
*
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* The licence and distribution terms for any publically available version or
* derivative of this code cannot be changed. i.e. this code cannot simply be
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/
#include <stdio.h>
#include <stdlib.h>
#include <openssl/conf.h>
#include <openssl/err.h>
main()
{
LHASH *conf;
long eline;
char *s,*s2;
#ifdef USE_WIN32
CONF_set_default_method(CONF_WIN32);
#endif
conf=CONF_load(NULL,"ssleay.cnf",&eline);
if (conf == NULL)
{
ERR_load_crypto_strings();
printf("unable to load configuration, line %ld\n",eline);
ERR_print_errors_fp(stderr);
exit(1);
}
lh_stats(conf,stdout);
lh_node_stats(conf,stdout);
lh_node_usage_stats(conf,stdout);
s=CONF_get_string(conf,NULL,"init2");
printf("init2=%s\n",(s == NULL)?"NULL":s);
s=CONF_get_string(conf,NULL,"cipher1");
printf("cipher1=%s\n",(s == NULL)?"NULL":s);
s=CONF_get_string(conf,"s_client","cipher1");
printf("s_client:cipher1=%s\n",(s == NULL)?"NULL":s);
printf("---------------------------- DUMP ------------------------\n");
CONF_dump_fp(conf, stdout);
exit(0);
}
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_COMMON_WALLPAPER_WALLPAPER_CONTROLLER_H_
#define ASH_COMMON_WALLPAPER_WALLPAPER_CONTROLLER_H_
#include <memory>
#include "ash/ash_export.h"
#include "ash/common/shell_observer.h"
#include "ash/common/wm_display_observer.h"
#include "ash/public/interfaces/wallpaper.mojom.h"
#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
#include "base/observer_list.h"
#include "base/timer/timer.h"
#include "components/wallpaper/wallpaper_layout.h"
#include "mojo/public/cpp/bindings/binding_set.h"
#include "ui/gfx/image/image_skia.h"
namespace base {
class TaskRunner;
}
namespace wallpaper {
class WallpaperResizer;
}
namespace ash {
class WallpaperControllerObserver;
// Controls the desktop background wallpaper.
class ASH_EXPORT WallpaperController
: public NON_EXPORTED_BASE(mojom::WallpaperController),
public WmDisplayObserver,
public ShellObserver {
public:
enum WallpaperMode { WALLPAPER_NONE, WALLPAPER_IMAGE };
explicit WallpaperController(
const scoped_refptr<base::TaskRunner>& task_runner);
~WallpaperController() override;
// Binds the mojom::WallpaperController interface request to this object.
void BindRequest(mojom::WallpaperControllerRequest request);
// Add/Remove observers.
void AddObserver(WallpaperControllerObserver* observer);
void RemoveObserver(WallpaperControllerObserver* observer);
// Provides current image on the wallpaper, or empty gfx::ImageSkia if there
// is no image, e.g. wallpaper is none.
gfx::ImageSkia GetWallpaper() const;
wallpaper::WallpaperLayout GetWallpaperLayout() const;
// Sets wallpaper. This is mostly called by WallpaperManager to set
// the default or user selected custom wallpaper.
// Returns true if new image was actually set. And false when duplicate set
// request detected.
bool SetWallpaperImage(const gfx::ImageSkia& image,
wallpaper::WallpaperLayout layout);
// Creates an empty wallpaper. Some tests require a wallpaper widget is ready
// when running. However, the wallpaper widgets are now created
// asynchronously. If loading a real wallpaper, there are cases that these
// tests crash because the required widget is not ready. This function
// synchronously creates an empty widget for those tests to prevent
// crashes. An example test is SystemGestureEventFilterTest.ThreeFingerSwipe.
void CreateEmptyWallpaper();
// Move all wallpaper widgets to the locked container.
// Returns true if the wallpaper moved.
bool MoveToLockedContainer();
// Move all wallpaper widgets to unlocked container.
// Returns true if the wallpaper moved.
bool MoveToUnlockedContainer();
// WmDisplayObserver:
void OnDisplayConfigurationChanged() override;
// ShellObserver:
void OnRootWindowAdded(WmWindow* root_window) override;
// Returns the maximum size of all displays combined in native
// resolutions. Note that this isn't the bounds of the display who
// has maximum resolutions. Instead, this returns the size of the
// maximum width of all displays, and the maximum height of all displays.
static gfx::Size GetMaxDisplaySizeInNative();
// Returns true if the specified wallpaper is already stored
// in |current_wallpaper_|.
// If |compare_layouts| is false, layout is ignored.
bool WallpaperIsAlreadyLoaded(const gfx::ImageSkia& image,
bool compare_layouts,
wallpaper::WallpaperLayout layout) const;
void set_wallpaper_reload_delay_for_test(int value) {
wallpaper_reload_delay_ = value;
}
// Opens the set wallpaper page in the browser.
void OpenSetWallpaperPage();
// mojom::WallpaperController overrides:
void SetWallpaper(const SkBitmap& wallpaper,
wallpaper::WallpaperLayout layout) override;
private:
// Creates a WallpaperWidgetController for |root_window|.
void InstallDesktopController(WmWindow* root_window);
// Creates a WallpaperWidgetController for all root windows.
void InstallDesktopControllerForAllWindows();
// Moves the wallpaper to the specified container across all root windows.
// Returns true if a wallpaper moved.
bool ReparentWallpaper(int container);
// Returns the wallpaper container id for unlocked and locked states.
int GetWallpaperContainerId(bool locked);
// Reload the wallpaper. |clear_cache| specifies whether to clear the
// wallpaper cahce or not.
void UpdateWallpaper(bool clear_cache);
bool locked_;
WallpaperMode wallpaper_mode_;
// Bindings for the WallpaperController interface.
mojo::BindingSet<mojom::WallpaperController> bindings_;
base::ObserverList<WallpaperControllerObserver> observers_;
std::unique_ptr<wallpaper::WallpaperResizer> current_wallpaper_;
gfx::Size current_max_display_size_;
base::OneShotTimer timer_;
int wallpaper_reload_delay_;
scoped_refptr<base::TaskRunner> task_runner_;
DISALLOW_COPY_AND_ASSIGN(WallpaperController);
};
} // namespace ash
#endif // ASH_COMMON_WALLPAPER_WALLPAPER_CONTROLLER_H_
|
#include "Cello.h"
int main(int argc, char** argv) {
println("Cello World!");
return 1;
}
|
/////////////////////////////////////////////////////////////////////////////
// Name: wx/univ/bmpbuttn.h
// Purpose: wxBitmapButton class for wxUniversal
// Author: Vadim Zeitlin
// Modified by:
// Created: 25.08.00
// Copyright: (c) Vadim Zeitlin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_UNIV_BMPBUTTN_H_
#define _WX_UNIV_BMPBUTTN_H_
class WXDLLIMPEXP_CORE wxBitmapButton : public wxBitmapButtonBase
{
public:
wxBitmapButton() { }
wxBitmapButton(wxWindow *parent,
wxWindowID id,
const wxBitmap& bitmap,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr)
{
Create(parent, id, bitmap, pos, size, style, validator, name);
}
bool Create(wxWindow *parent,
wxWindowID id,
const wxBitmap& bitmap,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr);
virtual void SetMargins(int x, int y) wxOVERRIDE
{
SetBitmapMargins(x, y);
wxBitmapButtonBase::SetMargins(x, y);
}
virtual bool Enable(bool enable = true) wxOVERRIDE;
virtual bool SetCurrent(bool doit = true) wxOVERRIDE;
virtual void Press() wxOVERRIDE;
virtual void Release() wxOVERRIDE;
protected:
void OnSetFocus(wxFocusEvent& event);
void OnKillFocus(wxFocusEvent& event);
// called when one of the bitmap is changed by user
virtual void OnSetBitmap() wxOVERRIDE;
// set bitmap to the given one if it's ok or to the normal bitmap and
// return true if the bitmap really changed
bool ChangeBitmap(const wxBitmap& bmp);
private:
wxDECLARE_EVENT_TABLE();
wxDECLARE_DYNAMIC_CLASS(wxBitmapButton);
};
#endif // _WX_UNIV_BMPBUTTN_H_
|
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKVtkGLMapperWrapper_H_HEADER
#define MITKVtkGLMapperWrapper_H_HEADER
#include <MitkLegacyGLExports.h>
#include "mitkVtkMapper.h"
#include "mitkBaseRenderer.h"
#include "mitkLocalStorageHandler.h"
#include <vtkSmartPointer.h>
#include "mitkGLMapper.h"
class vtkGLMapperProp;
namespace mitk {
/**
* @brief Vtk-based 2D mapper for PointSet
*/
class MITKLEGACYGL_EXPORT VtkGLMapperWrapper : public VtkMapper
{
public:
mitkClassMacro(VtkGLMapperWrapper, VtkMapper);
mitkNewMacro1Param(Self,GLMapper::Pointer)
itkCloneMacro(Self)
/** \brief returns the a prop assembly */
virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer) override;
virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer) override;
/** \brief Internal class holding the mapper, actor, etc. for each of the 3 2D render windows */
class LocalStorage : public mitk::Mapper::BaseLocalStorage
{
public:
/* constructor */
LocalStorage();
/* destructor */
~LocalStorage();
vtkSmartPointer<vtkGLMapperProp> m_GLMapperProp;
};
virtual void ApplyColorAndOpacityProperties(mitk::BaseRenderer* renderer, vtkActor * actor) override;
void MitkRender(mitk::BaseRenderer* renderer, mitk::VtkPropRenderer::RenderType type) override;
virtual void Update(BaseRenderer *renderer) override;
virtual void SetDataNode(DataNode* node) override;
virtual DataNode* GetDataNode() const override;
/** \brief The LocalStorageHandler holds all (three) LocalStorages for the three 2D render windows. */
mitk::LocalStorageHandler<LocalStorage> m_LSH;
protected:
GLMapper::Pointer m_MitkGLMapper;
/* constructor */
VtkGLMapperWrapper(GLMapper::Pointer mitkGLMapper);
/* destructor */
virtual ~VtkGLMapperWrapper();
void Enable2DOpenGL(mitk::BaseRenderer *renderer);
void Disable2DOpenGL();
};
} // namespace mitk
#endif /* MITKVtkGLMapperWrapper_H_HEADER_INCLUDED_C1902626 */
|
/*
* Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef InputMethodController_h
#define InputMethodController_h
#include "core/CoreExport.h"
#include "core/dom/Range.h"
#include "core/editing/CompositionUnderline.h"
#include "core/editing/EphemeralRange.h"
#include "core/editing/PlainTextRange.h"
#include "platform/heap/Handle.h"
#include "wtf/Vector.h"
namespace blink {
class Editor;
class LocalFrame;
class Range;
class Text;
class CORE_EXPORT InputMethodController final : public GarbageCollected<InputMethodController> {
WTF_MAKE_NONCOPYABLE(InputMethodController);
public:
enum ConfirmCompositionBehavior {
DoNotKeepSelection,
KeepSelection,
};
static InputMethodController* create(LocalFrame&);
DECLARE_TRACE();
// international text input composition
bool hasComposition() const;
void setComposition(const String&, const Vector<CompositionUnderline>&, int selectionStart, int selectionEnd);
void setCompositionFromExistingText(const Vector<CompositionUnderline>&, unsigned compositionStart, unsigned compositionEnd);
// Inserts the text that is being composed as a regular text and returns true
// if composition exists.
bool confirmComposition();
// Inserts the given text string in the place of the existing composition
// and returns true.
bool confirmComposition(const String& text, ConfirmCompositionBehavior confirmBehavior = KeepSelection);
// Inserts the text that is being composed or specified non-empty text and
// returns true.
bool confirmCompositionOrInsertText(const String& text, ConfirmCompositionBehavior);
// Deletes the existing composition text.
void cancelComposition();
void cancelCompositionIfSelectionIsInvalid();
EphemeralRange compositionEphemeralRange() const;
Range* compositionRange() const;
void clear();
void documentDetached();
PlainTextRange getSelectionOffsets() const;
// Returns true if setting selection to specified offsets, otherwise false.
bool setEditableSelectionOffsets(const PlainTextRange&);
void extendSelectionAndDelete(int before, int after);
private:
class SelectionOffsetsScope {
WTF_MAKE_NONCOPYABLE(SelectionOffsetsScope);
STACK_ALLOCATED();
public:
explicit SelectionOffsetsScope(InputMethodController*);
~SelectionOffsetsScope();
private:
Member<InputMethodController> m_inputMethodController;
const PlainTextRange m_offsets;
};
friend class SelectionOffsetsScope;
Member<LocalFrame> m_frame;
Member<Range> m_compositionRange;
bool m_isDirty;
bool m_hasComposition;
explicit InputMethodController(LocalFrame&);
Editor& editor() const;
LocalFrame& frame() const
{
DCHECK(m_frame);
return *m_frame;
}
String composingText() const;
bool insertTextForConfirmedComposition(const String& text);
void selectComposition() const;
bool setSelectionOffsets(const PlainTextRange&);
};
} // namespace blink
#endif // InputMethodController_h
|
// Copyright (c) 2015, Galaxy Authors. All Rights Reserved
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Author: yuanyi03@baidu.com
#ifndef ASM_ATOMIC_H_
#define ASM_ATOMIC_H_
#if !defined(__i386__) && !defined(__x86_64__)
#error "Arch not supprot!"
#endif
#include <stdint.h>
namespace common {
template <typename T>
inline void atomic_inc(volatile T* n)
{
asm volatile ("lock; incl %0;":"+m"(*n)::"cc");
}
template <typename T>
inline void atomic_dec(volatile T* n)
{
asm volatile ("lock; decl %0;":"+m"(*n)::"cc");
}
template <typename T>
inline T atomic_add_ret_old(volatile T* n, T v)
{
asm volatile ("lock; xaddl %1, %0;":"+m"(*n),"+r"(v)::"cc");
return v;
}
template <typename T>
inline T atomic_inc_ret_old(volatile T* n)
{
T r = 1;
asm volatile ("lock; xaddl %1, %0;":"+m"(*n), "+r"(r)::"cc");
return r;
}
template <typename T>
inline T atomic_dec_ret_old(volatile T* n)
{
T r = (T)-1;
asm volatile ("lock; xaddl %1, %0;":"+m"(*n), "+r"(r)::"cc");
return r;
}
template <typename T>
inline T atomic_add_ret_old64(volatile T* n, T v)
{
asm volatile ("lock; xaddq %1, %0;":"+m"(*n),"+r"(v)::"cc");
return v;
}
template <typename T>
inline T atomic_inc_ret_old64(volatile T* n)
{
T r = 1;
asm volatile ("lock; xaddq %1, %0;":"+m"(*n), "+r"(r)::"cc");
return r;
}
template <typename T>
inline T atomic_dec_ret_old64(volatile T* n)
{
T r = (T)-1;
asm volatile ("lock; xaddq %1, %0;":"+m"(*n), "+r"(r)::"cc");
return r;
}
template <typename T>
inline void atomic_add(volatile T* n, T v)
{
asm volatile ("lock; addl %1, %0;":"+m"(*n):"r"(v):"cc");
}
template <typename T>
inline void atomic_sub(volatile T* n, T v)
{
asm volatile ("lock; subl %1, %0;":"+m"(*n):"r"(v):"cc");
}
template <typename T, typename C, typename D>
inline T atomic_cmpxchg(volatile T* n, C cmp, D dest)
{
asm volatile ("lock; cmpxchgl %1, %0":"+m"(*n), "+r"(dest), "+a"(cmp)::"cc");
return cmp;
}
// return old value
template <typename T>
inline T atomic_swap(volatile T* lockword, T value)
{
asm volatile ("lock; xchg %0, %1;" : "+r"(value), "+m"(*lockword));
return value;
}
template <typename T, typename E, typename C>
inline T atomic_comp_swap(volatile T* lockword, E exchange, C comperand)
{
return atomic_cmpxchg(lockword, comperand, exchange);
}
} // ending namespace common
#endif /* ASM_ATOMIC_H_ */
|
/**
* @file rtDefault.c
* @provides rtDefault
*
* $Id: rtDefault.c 2118 2009-11-05 05:22:51Z mschul $
*/
/* Embedded Xinu, Copyright (C) 2009. All rights reserved. */
#include <stddef.h>
#include <network.h>
#include <route.h>
#include <stdlib.h>
/**
* Set the default route.
* @param gate gateway for default route
* @param nif network interface for default route
* @return OK if added/updated successfully, otherwise SYSERR
*/
syscall rtDefault(struct netaddr *gate, struct netif *nif)
{
struct rtEntry *rtptr;
int i;
struct netaddr mask;
/* Error check pointers */
if ((NULL == gate) || (NULL == nif) || (gate->len > NET_MAX_ALEN))
{
RT_TRACE("Invalid args");
return SYSERR;
}
/* Setup mask for default route */
mask.type = gate->type;
mask.len = gate->len;
bzero(mask.addr, mask.len);
/* Check if a default route already exists */
rtptr = NULL;
for (i = 0; i < RT_NENTRY; i++)
{
if ((RT_USED == rttab[i].state)
&& (netaddrequal(&rttab[i].mask, &mask)))
{
RT_TRACE("Default route exists, entry %d", i);
return OK;
}
}
/* Allocate an entry in the route table */
rtptr = rtAlloc();
if ((SYSERR == (int)rtptr) || (NULL == rtptr))
{
RT_TRACE("Failed to allocate route entry");
return SYSERR;
}
/* Populate the entry */
netaddrcpy(&rtptr->dst, &mask);
netaddrcpy(&rtptr->gateway, gate);
netaddrcpy(&rtptr->mask, &mask);
rtptr->nif = nif;
/* Calculate mask length */
rtptr->masklen = 0;
rtptr->state = RT_USED;
RT_TRACE("Populated default route");
return OK;
}
|
/*
Copyright (C) 2014, The University of Texas at Austin
This file is part of libflame and is available under the 3-Clause
BSD license, which can be found in the LICENSE file at the top-level
directory, or at http://opensource.org/licenses/BSD-3-Clause
*/
#include "FLAME.h"
#define N_VARIANTS 6
#define FLA_ALG_REFERENCE 0
#define FLA_ALG_UNBLOCKED 1
#define FLA_ALG_BLOCKED 2
#define FLA_ALG_OPTIMIZED 3
void time_Herk_lh(
int variant, int type, int n_repeats, int n, int nb_alg,
FLA_Obj A, FLA_Obj B, FLA_Obj C, FLA_Obj C_ref,
double *dtime, double *diff, double *gflops );
int main(int argc, char *argv[])
{
int
m_input, k_input,
m, k,
p_first, p_last, p_inc,
p,
nb_alg,
n_repeats,
variant,
i, j,
datatype,
n_variants = N_VARIANTS;
char *colors = "brkgmcbrkg";
char *ticks = "o+*xso+*xs";
char m_dim_desc[14];
char k_dim_desc[14];
char m_dim_tag[10];
char k_dim_tag[10];
double max_gflops=3.6;
double
dtime,
gflops,
diff,
d_n;
FLA_Obj
A, B, C, C_ref;
/* Initialize FLAME */
FLA_Init( );
fprintf( stdout, "%c number of repeats:", '%' );
scanf( "%d", &n_repeats );
fprintf( stdout, "%c %d\n", '%', n_repeats );
fprintf( stdout, "%c Enter blocking size:", '%' );
scanf( "%d", &nb_alg );
fprintf( stdout, "%c %d\n", '%', nb_alg );
fprintf( stdout, "%c enter problem size first, last, inc:", '%' );
scanf( "%d%d%d", &p_first, &p_last, &p_inc );
fprintf( stdout, "%c %d %d %d\n", '%', p_first, p_last, p_inc );
fprintf( stdout, "%c enter m k (-1 means bind to problem size): ", '%' );
scanf( "%d%d", &m_input, &k_input );
fprintf( stdout, "%c %d %d\n", '%', m_input, k_input );
/* Delete all existing data structures */
fprintf( stdout, "\nclear all;\n\n" );
if ( m_input > 0 ) {
sprintf( m_dim_desc, "m = %d", m_input );
sprintf( m_dim_tag, "m%dc", m_input);
}
else if( m_input < -1 ) {
sprintf( m_dim_desc, "m = p/%d", -m_input );
sprintf( m_dim_tag, "m%dp", -m_input );
}
else if( m_input == -1 ) {
sprintf( m_dim_desc, "m = p" );
sprintf( m_dim_tag, "m%dp", 1 );
}
if ( k_input > 0 ) {
sprintf( k_dim_desc, "k = %d", k_input );
sprintf( k_dim_tag, "k%dc", k_input);
}
else if( k_input < -1 ) {
sprintf( k_dim_desc, "k = p/%d", -k_input );
sprintf( k_dim_tag, "k%dp", -k_input );
}
else if( k_input == -1 ) {
sprintf( k_dim_desc, "k = p" );
sprintf( k_dim_tag, "k%dp", 1 );
}
for ( p = p_first, i = 1; p <= p_last; p += p_inc, i += 1 )
{
m = m_input;
k = k_input;
if( m < 0 ) m = p / abs(m_input);
if( k < 0 ) k = p / abs(k_input);
//datatype = FLA_COMPLEX;
datatype = FLA_DOUBLE_COMPLEX;
/* Allocate space for the matrices */
FLA_Obj_create( datatype, k, m, &A );
FLA_Obj_create( datatype, m, m, &C );
FLA_Obj_create( datatype, m, m, &C_ref );
/* Generate random matrices A, C */
FLA_Random_matrix( A );
FLA_Random_herm_matrix( FLA_LOWER_TRIANGULAR, C );
FLA_Copy_external( C, C_ref );
/* Time the reference implementation */
time_Herk_lh( 0, FLA_ALG_REFERENCE, n_repeats, p, nb_alg,
A, B, C, C_ref, &dtime, &diff, &gflops );
fprintf( stdout, "data_REF( %d, 1:2 ) = [ %d %6.3lf ]; \n", i, p, gflops );
fflush( stdout );
for ( variant = 1; variant <= n_variants; variant++ ){
fprintf( stdout, "data_var%d( %d, 1:7 ) = [ %d ", variant, i, p );
fflush( stdout );
time_Herk_lh( variant, FLA_ALG_UNBLOCKED, n_repeats, p, nb_alg,
A, B, C, C_ref, &dtime, &diff, &gflops );
fprintf( stdout, "%6.3lf %6.2le ", gflops, diff );
fflush( stdout );
time_Herk_lh( variant, FLA_ALG_BLOCKED, n_repeats, p, nb_alg,
A, B, C, C_ref, &dtime, &diff, &gflops );
fprintf( stdout, "%6.3lf %6.2le ", gflops, diff );
fflush( stdout );
//time_Herk_lh( variant, FLA_ALG_OPTIMIZED, n_repeats, p, nb_alg,
// A, B, C, C_ref, &dtime, &diff, &gflops );
//fprintf( stdout, "%6.3lf %6.2le ", gflops, diff );
//fflush( stdout );
fprintf( stdout, " ]; \n" );
fflush( stdout );
}
fprintf( stdout, "\n" );
FLA_Obj_free( &A );
FLA_Obj_free( &C );
FLA_Obj_free( &C_ref );
}
/*
fprintf( stdout, "figure;\n" );
fprintf( stdout, "plot( data_REF( :,1 ), data_REF( :, 2 ), '-' ); \n" );
fprintf( stdout, "hold on;\n" );
for ( i = 1; i <= n_variants; i++ ){
fprintf( stdout, "plot( data_var%d( :,1 ), data_var%d( :, 2 ), '%c:%c' ); \n",
i, i, colors[ i-1 ], ticks[ i-1 ] );
fprintf( stdout, "plot( data_var%d( :,1 ), data_var%d( :, 4 ), '%c-.%c' ); \n",
i, i, colors[ i-1 ], ticks[ i-1 ] );
//fprintf( stdout, "plot( data_var%d( :,1 ), data_var%d( :, 6 ), '%c--%c' ); \n",
// i, i, colors[ i-1 ], ticks[ i-1 ] );
}
fprintf( stdout, "legend( ... \n" );
fprintf( stdout, "'Reference', ... \n" );
for ( i = 1; i < n_variants; i++ ) {
//fprintf( stdout, "'unb\\_var%d', 'blk\\_var%d', 'opt\\_var%d' ... \n", i, i, i );
fprintf( stdout, "'unb\\_var%d', 'blk\\_var%d', ... \n", i, i );
}
i = n_variants;
//fprintf( stdout, "'unb\\_var%d', 'blk\\_var%d', 'opt\\_var%d', 2 ); \n", i, i, i );
fprintf( stdout, "'unb\\_var%d', 'blk\\_var%d' ); \n", i, i );
fprintf( stdout, "xlabel( 'problem size p' );\n" );
fprintf( stdout, "ylabel( 'GFLOPS/sec.' );\n" );
fprintf( stdout, "axis( [ 0 %d 0 %.2f ] ); \n", p_last, max_gflops );
fprintf( stdout, "title( 'FLAME herk\\_lc performance (%s, %s)' );\n",
m_dim_desc, k_dim_desc );
fprintf( stdout, "print -depsc herk_lc_%s_%s.eps\n", m_dim_tag, k_dim_tag );
fprintf( stdout, "hold off;\n");
fflush( stdout );
*/
FLA_Finalize( );
}
|
#ifndef __DDB_HUFFMAN__
#define __DDB_HUFFMAN__
#include <stdint.h>
#define DDB_CODEBOOK_SIZE 65536
#define DDB_HUFF_CODE(x) ((x) & 65535)
#define DDB_HUFF_BITS(x) (((x) & (65535 << 16)) >> 16)
struct ddb_codebook{
uint32_t symbol;
uint32_t bits;
} __attribute__((packed));
struct ddb_map *ddb_create_codemap(const struct ddb_map *keys);
int ddb_save_codemap(
struct ddb_map *codemap,
struct ddb_codebook book[DDB_CODEBOOK_SIZE]);
int ddb_compress(
const struct ddb_map *codemap,
const char *src,
uint32_t src_len,
uint32_t *size,
char **buf,
uint64_t *buf_len);
int ddb_decompress(
const struct ddb_codebook book[DDB_CODEBOOK_SIZE],
const char *src,
uint32_t src_len,
uint32_t *size,
char **buf,
uint64_t *buf_len);
#endif /* __DDB_HUFFMAN__ */
|
/*
* Copyright (c) 2013 - present Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
// Splitting EOCPerson into categories
#import <Foundation/NSString.h>
#import <Foundation/NSObject.h>
@interface EOCPerson : NSObject
@property (nonatomic, copy, readonly) NSString *firstName;
@property (nonatomic, copy, readonly) NSString *lastName;
@property (nonatomic, strong, readonly) NSArray *friends;
- (id)initWithFirstName:(NSString*)firstName
andLastName:(NSString*)lastName;
@end
@interface EOCPerson (Friendship)
- (void)addFriend:(EOCPerson*)person;
- (void)removeFriend:(EOCPerson*)person;
- (BOOL)isFriendsWith:(EOCPerson*)person;
@end
@interface EOCPerson (Work)
- (void)performDaysWork;
- (void)takeVacationFromWork;
@end
@interface EOCPerson (Play)
- (void)goToTheCinema;
- (void)goToSportsGame;
@end
|
// Filename: LMarkerSetVariable.h
// Created on 12 May 2011 by Boyce Griffith
//
// Copyright (c) 2002-2014, Boyce Griffith
// 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 University of North Carolina 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.
#ifndef included_LMarkerSetVariable
#define included_LMarkerSetVariable
/////////////////////////////// INCLUDES /////////////////////////////////////
#include "ibtk/LMarker.h"
#include "ibtk/LSetVariable.h"
/////////////////////////////// TYPEDEFS /////////////////////////////////////
namespace IBTK
{
typedef LSetVariable<LMarker> LMarkerSetVariable;
} // namespace IBTK
//////////////////////////////////////////////////////////////////////////////
#endif //#ifndef included_LMarkerSetVariable
|
// Copyright (c) 2012 The Board of Trustees of The University of Alabama
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// 3. Neither the name of the University nor the names of the 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.
#import <Foundation/Foundation.h>
#import "LeapObjectiveC.h"
#import "MotionGestureRecognizer.h"
@interface MotionPanGestureRecognizer : MotionGestureRecognizer {
}
@property (nonatomic, retain) LeapVector *centerpoint;
-(id)initWithTarget:(id)target selector:(SEL)sel;
-(void)resetValues;
@end
|
/* "$Id: $"
*
* Author: Jean-Marc Lienher ( http://oksid.ch )
* Copyright 2000-2003 by O'ksi'D.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems on the following page:
*
* http://www.fltk.org/str.php
*/
/*
* generate the "if(){} else if ..." structure of ucs2fontmap()
*/
#include <wchar.h>
#include <stdio.h>
char buffer[1000000];
int main(int argc, char **argv) {
char buf[80];
int len;
char *encode[256];
int encode_number = 0;
unsigned int i = 0;
unsigned char *ptr;
unsigned char *lst = "";
size_t nb;
int nbb = 0;
len = fread(buffer, 1, 1000000, stdin);
puts(" ");
puts(" /*************** conv_gen.c ************/");
buffer[len] = '\0';
ptr = buffer;
printf("const int ucs2fontmap"
"(char *s, unsigned int ucs, int enc)\n");
printf("{\n");
printf(" switch(enc) {\n");
printf(" case 0:\n");
printf(" s[0] = (char) ((ucs & 0xFF00) >> 8);\n");
printf(" s[1] = (char) (ucs & 0xFF);\n");
printf(" return 0;");
while (len > 0) {
unsigned char *p = ptr;
unsigned char *f, *t;
while (*p != ']') {
i++;
p++;
}
*(p - 1) = '\0';
*(p - 6) = '\0';
f = p - 5;
while (*p != '+') { i++; p++;}
p++;
t = p;
*(p + 4) = '\0';
if (strcmp(lst, ptr)) {
encode_number++;
encode[encode_number] = ptr;
printf("\n break;");
printf("\n case %d:\n", encode_number);
printf(" ");
} else {
printf(" else ");
}
lst = ptr;
printf("if (ucs <= 0x%s) {\n", t);
printf(" if (ucs >= 0x%s) {\n", f);
if (*(f - 3) == '2') {
printf(" int i = (ucs - 0x%s) * 2;\n", f);
printf(" s[0] = %s_%s[i++];\n", ptr, f, f);
printf(" s[1] = %s_%s[i];\n", ptr, f, f);
printf(" if (s[0] || s[1]) return %d;\n", encode_number);
} else {
printf(" s[0] = 0;\n");
printf(" s[1] = %s_%s[ucs - 0x%s];\n", ptr, f, f);
printf(" if (s[1]) return %d;\n", encode_number);
}
printf(" }\n");
printf(" }");
while (*ptr != '\n') {
ptr++;
len--;
}
ptr++;
len--;
}
printf("\n break;\n");
printf("\n default:\n");
printf(" break;\n");
printf(" };\n");
printf(" return -1;\n");
printf("};\n\n");
printf("const int encoding_number(const char *enc)\n{\n");
printf(" if (!enc || !strcmp(enc, \"iso10646-1\")) {\n");
printf(" return 0;\n");
i = 1;
while (i <= encode_number) {
int l;
char *ptr;
l = strlen(encode[i]) - 3;
ptr = encode[i] + l;
*(ptr) = '\0';
ptr--;
while (ptr != encode[i]) {
if (*ptr == '_') {
*ptr = '-';
ptr--;
break;
}
ptr--;
}
while (ptr != encode[i]) {
if (*ptr == '_') {
*ptr = '.';
}
ptr--;
}
printf(" } else if (!strcmp(enc, \"%s\")", encode[i] +11);
if (!strcmp(encode[i] + 11, "big5-0")) {
printf(" || !strcmp(enc, \"big5.eten-0\")");
} else if (!strcmp(encode[i] + 11, "dingbats")) {
printf(" || !strcmp(enc, \"zapfdingbats\")");
printf(" || !strcmp(enc, \"zapf dingbats\")");
printf(" || !strcmp(enc, \"itc zapf dingbats\")");
} else if (!strcmp(encode[i] + 11, "jisx0208.1983-0")) {
printf(" || !strcmp(enc, \"jisx0208.1990-0\")");
}
printf(") {\n");
printf(" return %d;\n", i);
i++;
}
printf(" };\n");
printf(" return -1;\n");
printf("};\n\n");
printf("/*\n");
printf("const char *encoding_name(int num)\n{\n");
printf(" switch (num) {\n");
i = 1;
while (i <= encode_number) {
printf(" case %d:\n", i);
printf(" return \"%s\";\n", encode[i] + 11);
i++;
}
printf(" };\n");
printf(" return \"iso10646-1\";\n");
printf("};\n\n");
printf("*/\n");
return 0;
}
/*
* End of "$Id$".
*/
|
// 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 COMPONENTS_MEDIA_ROUTER_COMMON_PREF_NAMES_H_
#define COMPONENTS_MEDIA_ROUTER_COMMON_PREF_NAMES_H_
namespace media_router {
namespace prefs {
extern const char kMediaRouterCloudServicesPrefSet[];
extern const char kMediaRouterEnableCloudServices[];
extern const char kMediaRouterMediaRemotingEnabled[];
extern const char kMediaRouterTabMirroringSources[];
} // namespace prefs
} // namespace media_router
#endif // COMPONENTS_MEDIA_ROUTER_COMMON_PREF_NAMES_H_
|
#ifndef AliAnalysisTaskSpectraMC_H
#define AliAnalysisTaskSpectraMC_H
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice */
/* $Id$ */
// ROOT includes
#include <TList.h>
#include <TH1.h>
#include <TH2.h>
#include <TH3.h>
#include <TAxis.h>
#include <TProfile.h>
#include <TTreeStream.h>
#include <TRandom.h>
#include <TObject.h>
// AliRoot includes
#include <AliAnalysisTaskSE.h>
#include <AliESDEvent.h>
#include <AliAODEvent.h>
#include <AliAnalysisFilter.h>
#include <AliVHeader.h>
#include <AliAODMCParticle.h>
#include <AliESDtrackCuts.h>
#include <AliPIDResponse.h>
#include "AliTPCPIDResponse.h"
#include <AliEventCuts.h>
#include "AliVTrack.h"
#include "TVirtualMCApplication.h"
#include "TVirtualMC.h"
#include "AliMCEventHandler.h"
#include "AliMCEvent.h"
#include "AliMCParticle.h"
#include "AliStack.h"
#include "TParticle.h"
#include "AliGenEventHeader.h"
using namespace std;
class AliAnalysisTaskSpectraMC : public AliAnalysisTaskSE
{
public:
AliAnalysisTaskSpectraMC();
AliAnalysisTaskSpectraMC(const char *name);
virtual ~AliAnalysisTaskSpectraMC();
virtual void UserCreateOutputObjects();
virtual void UserExec(Option_t *option);
Bool_t GetAnalysisMC() { return fAnalysisMC; }
Double_t GetEtaCut() { return fEtaCut; }
virtual void SetAnalysisType(const char* analysisType) {fAnalysisType = analysisType;}
virtual void SetAnalysisMC(bool isMC) {fAnalysisMC = isMC;}
virtual void SetMCClosure(bool isMCclos) {fIsMCclosure = isMCclos;}
virtual void SetNcl(const Int_t ncl){fNcl = ncl;}
virtual void SetEtaCut(Double_t etaCut){fEtaCut = etaCut;}
virtual void SetTrackCutsType(bool isTPCOnlyTrkCuts) { fSetTPConlyTrkCuts = isTPCOnlyTrkCuts; }
virtual void SetHybridTracks(bool isSelectHybrid) { fSelectHybridTracks = isSelectHybrid; }
AliESDtrack* SetHybridTrackCuts(AliESDtrack *track, const bool fill1, const bool fill2, const bool fill3);
private:
AliESDtrack* GetLeadingTrack();
void GetLeadingObject(Bool_t isMC);
void GetMultiplicityDistributions();
void GetDetectorResponse();
void GetMCCorrections();
void GetMultiplicityDistributionsPhi();
void GetMCCorrectionsPhi();
virtual Double_t DeltaPhi(Double_t phi, Double_t lphi,
Double_t rangeMin = -TMath::Pi()/2, Double_t rangeMax = 3*TMath::Pi()/2 );
short GetPidCode(Int_t pdgCode) const;
bool selectVertex2015pp(AliESDEvent* esd, Bool_t checkSPDres, Bool_t requireSPDandTrk, Bool_t checkProximity);
bool IsGoodSPDvertexRes(const AliESDVertex* spdVertex = NULL);
bool IsGoodZvertexPos(AliESDEvent *esd);
bool PhiCut(const double& pt, double phi, const double& q, const float& mag, TF1* phiCutLow, TF1* phiCutHigh);
float GetMaxDCApTDep( TF1 *fcut, double pt);
virtual void SetTrackCuts(AliAnalysisFilter* fTrackFilter);
double EtaCalibration(const int ¢rality, const double &Eta);
double EtaCalibrationEl(const int ¢rality, const double &Eta);
bool TOFPID(AliESDtrack* track);
static const Double_t fgkClight; // Speed of light (cm/ps)
AliESDEvent* fESD; //! ESD object
AliEventCuts fEventCuts;
AliMCEvent* fMC; //! MC object
AliStack* fMCStack; //! MC ESD stack
TClonesArray* fMCArray; //! MC array for AOD
AliPIDResponse* fPIDResponse; //! Pointer to PIDResponse
AliESDtrackCuts* fGeometricalCut; // Track Filter, set 2010 with golden cuts
AliAnalysisFilter* fTrackFilter;
AliESDtrackCuts* fHybridTrackCuts1; // Track cuts for tracks without SPD hit
AliESDtrackCuts* fHybridTrackCuts2; // Track cuts for tracks witout SPD hit or ITS refit
AliAnalysisUtils* utils;
TString fAnalysisType; // "ESD" or "AOD"
bool fAnalysisMC; // Real(kFALSE) or MC(kTRUE) flag
bool fIsMCclosure; // Real(kFALSE) or MC(kTRUE) flag
TRandom* fRandom; //! random number generator
//
// Cuts and options
//
int fNcl;
double fEtaCut; // Eta cut used to select particles
const Double_t fDeDxMIPMin;
const Double_t fDeDxMIPMax;
const Double_t fdEdxHigh;
const Double_t fdEdxLow;
bool fSetTPConlyTrkCuts;
bool fSelectHybridTracks;
const double fLeadPtCutMin;
const double fLeadPtCutMax;
double fGenLeadPhi;
double fGenLeadPt;
double fGenLeadEta;
double fRecLeadEta;
int fGenLeadIn;
double fRecLeadPhi;
double fRecLeadPt;
int fRecLeadIn;
const double fPtMin;
//
// Output objects
//
TList* fListOfObjects; //! Output list of objects
TH1F* fEvents; //! No of accepted events
// Tracking & Matching efficiencies
TH1F* hPtGenIn[5];
TH1F* hPtRecIn[5];
TH1F* hPtGenPosIn[4];
TH1F* hPtRecPosIn[4];
TH1F* hPtGenNegIn[4];
TH1F* hPtRecNegIn[4];
TH1F* hPtRecInTOF[4];
TH1F* hPtRecPosInTOF[4];
TH1F* hPtRecNegInTOF[4];
TH1F* hPtrTPCRecIn[4];
// To Unfold
TH2F* hNchVsPtDataTPC[4][5];
// For closure
TH2F* hNchGenVsPtRec[4][5];
TH2F* hNchGenVsPtGenPID[4][5];
TH1F* hPtRec;
TH1F* hPtRecPion;
TH1F* hPtRecProton;
TH1F* hPtPri;
TH1F* hPtSec;
TH1F* hInvMassPhi;
TH2F* fPtLVsNchRec;
TH1F* hDeltaPtLeading;
TH2F* hPtRecEtaRecLeading;
TH2F* hEtaGenEtaRecLeading;
TH2F* hPhiEtaRecLeading;
TH1F* hPhiLeading;
TH1F* hPhiGen[4];
TH1F* hPhiRec[4];
TH1F* hMultTSGen;
TH1F* hMultTSRec;
TH1F* hTrigger;
// Response matrices
TH2F* hNchResponse;
TH2F* hPhiTotal;
TH1F* hPhiResPhi;
TH2F* hPhiStandard;
TH2F* hPhiHybrid1;
TH2F* hPhiHybrid2;
TF1* fEtaCalibration;
TF1* fEtaCalibrationEl;
TF1* fcutDCAxy;
TF1* fcutLow;
TF1* fcutHigh;
AliAnalysisTaskSpectraMC(const AliAnalysisTaskSpectraMC&); // not implemented
AliAnalysisTaskSpectraMC& operator=(const AliAnalysisTaskSpectraMC&); // not implemented
ClassDef(AliAnalysisTaskSpectraMC, 1); //Analysis task for high pt analysis
};
#endif
|
/*
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ4_PAYLOAD_SPLITTER_H_
#define WEBRTC_MODULES_AUDIO_CODING_NETEQ4_PAYLOAD_SPLITTER_H_
#include "webrtc/modules/audio_coding/neteq4/packet.h"
#include "webrtc/system_wrappers/interface/constructor_magic.h"
namespace webrtc {
// Forward declarations.
class DecoderDatabase;
// This class handles splitting of payloads into smaller parts.
// The class does not have any member variables, and the methods could have
// been made static. The reason for not making them static is testability.
// With this design, the splitting functionality can be mocked during testing
// of the NetEqImpl class.
class PayloadSplitter {
public:
enum SplitterReturnCodes {
kOK = 0,
kNoSplit = 1,
kTooLargePayload = -1,
kFrameSplitError = -2,
kUnknownPayloadType = -3,
kRedLengthMismatch = -4,
kFecSplitError = -5,
};
PayloadSplitter() {}
virtual ~PayloadSplitter() {}
// Splits each packet in |packet_list| into its separate RED payloads. Each
// RED payload is packetized into a Packet. The original elements in
// |packet_list| are properly deleted, and replaced by the new packets.
// Note that all packets in |packet_list| must be RED payloads, i.e., have
// RED headers according to RFC 2198 at the very beginning of the payload.
// Returns kOK or an error.
virtual int SplitRed(PacketList* packet_list);
// Iterates through |packet_list| and, duplicate each audio payload that has
// FEC as new packet for redundant decoding. The decoder database is needed to
// get information about which payload type each packet contains.
virtual int SplitFec(PacketList* packet_list,
DecoderDatabase* decoder_database);
// Checks all packets in |packet_list|. Packets that are DTMF events or
// comfort noise payloads are kept. Except that, only one single payload type
// is accepted. Any packet with another payload type is discarded.
virtual int CheckRedPayloads(PacketList* packet_list,
const DecoderDatabase& decoder_database);
// Iterates through |packet_list| and, if possible, splits each audio payload
// into suitable size chunks. The result is written back to |packet_list| as
// new packets. The decoder database is needed to get information about which
// payload type each packet contains.
virtual int SplitAudio(PacketList* packet_list,
const DecoderDatabase& decoder_database);
private:
// Splits the payload in |packet|. The payload is assumed to be from a
// sample-based codec.
virtual void SplitBySamples(const Packet* packet,
int bytes_per_ms,
int timestamps_per_ms,
PacketList* new_packets);
// Splits the payload in |packet|. The payload will be split into chunks of
// size |bytes_per_frame|, corresponding to a |timestamps_per_frame|
// RTP timestamps.
virtual int SplitByFrames(const Packet* packet,
int bytes_per_frame,
int timestamps_per_frame,
PacketList* new_packets);
DISALLOW_COPY_AND_ASSIGN(PayloadSplitter);
};
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ4_PAYLOAD_SPLITTER_H_
|
// This file was generated based on 'C:\ProgramData\Uno\Packages\UnoCore\0.20.1\Source\Uno\Reflection\$.uno'.
// WARNING: Changes might be lost if you edit this file directly.
#pragma once
#include <Uno.Object.h>
namespace g{
namespace Uno{
namespace Reflection{
// public abstract interface IField :7
// {
uInterfaceType* IField_typeof();
struct IField
{
void(*fp_GetValue)(uObject*, uObject*, uObject**);
void(*fp_SetValue)(uObject*, uObject*, uObject*);
static uObject* GetValue(const uInterface& __this, uObject* obj) { uObject* __retval; return __this.VTable<IField>()->fp_GetValue(__this, obj, &__retval), __retval; }
static void SetValue(const uInterface& __this, uObject* obj, uObject* value) { __this.VTable<IField>()->fp_SetValue(__this, obj, value); }
};
// }
}}} // ::g::Uno::Reflection
|
#define _get_output_format __dummy__get_output_format
#define _set_output_format __dummy__set_output_format
#include <windows.h>
#include <msvcrt.h>
#undef _get_output_format
#undef _set_output_format
static unsigned int last_value = 0;
typedef unsigned int (*f_get_output_format)(void);
typedef unsigned int (*f_set_output_format)(unsigned int);
static unsigned int init_set_output_format(unsigned int);
f_set_output_format __MINGW_IMP_SYMBOL(_set_output_format) = init_set_output_format;
unsigned int _set_output_format(unsigned int format);
unsigned int _set_output_format(unsigned int format)
{
return __MINGW_IMP_SYMBOL(_set_output_format)(format);
}
static unsigned int fake_set_output_format(unsigned int value)
{
return InterlockedExchange((LONG*)&last_value, value);
}
static unsigned int init_set_output_format(unsigned int format)
{
f_set_output_format sof;
sof = (f_set_output_format) GetProcAddress (__mingw_get_msvcrt_handle(), "_set_output_format");
if(!sof)
sof = fake_set_output_format;
return (__MINGW_IMP_SYMBOL(_set_output_format) = sof)(format);
}
static unsigned int init_get_output_format(void);
f_get_output_format __MINGW_IMP_SYMBOL(_get_output_format) = init_get_output_format;
unsigned int _get_output_format(void);
unsigned int _get_output_format(void)
{
return __MINGW_IMP_SYMBOL(_get_output_format)();
}
static unsigned int fake_get_output_format(void)
{
return last_value;
}
static unsigned int init_get_output_format(void)
{
f_get_output_format gof;
gof = (f_get_output_format) GetProcAddress (__mingw_get_msvcrt_handle(), "_get_output_format");
if(!gof)
gof = fake_get_output_format;
return (__MINGW_IMP_SYMBOL(_get_output_format) = gof)();
}
|
// This file was generated based on 'C:\ProgramData\Uno\Packages\Android\0.20.2\Android\android\graphics\$.uno'.
// WARNING: Changes might be lost if you edit this file directly.
#pragma once
#include <Android.android.os.Parcelable.h>
#include <Android.Base.Wrappers.IJWrapper.h>
#include <Android.java.lang.Object.h>
#include <jni.h>
#include <Uno.IDisposable.h>
namespace g{namespace Android{namespace android{namespace graphics{struct RectF;}}}}
namespace g{namespace Android{namespace android{namespace os{struct Parcel;}}}}
namespace g{namespace Android{namespace java{namespace lang{struct String;}}}}
namespace g{
namespace Android{
namespace android{
namespace graphics{
// public sealed extern class RectF :10868
// {
struct RectF_type : ::g::Android::java::lang::Object_type
{
::g::Android::android::os::Parcelable interface2;
};
RectF_type* RectF_typeof();
void RectF___Init2_fn();
void RectF__describeContents_fn(RectF* __this, int* __retval);
void RectF__describeContents_IMPL_7235_fn(bool* arg0_, jobject* arg1_, int* __retval);
void RectF__equals1_fn(RectF* __this, ::g::Android::java::lang::Object* arg0, bool* __retval);
void RectF__equals_IMPL_7205_fn(bool* arg0_, jobject* arg1_, uObject* arg2_, bool* __retval);
void RectF__hashCode1_fn(RectF* __this, int* __retval);
void RectF__hashCode_IMPL_7206_fn(bool* arg0_, jobject* arg1_, int* __retval);
void RectF__toString_fn(RectF* __this, ::g::Android::java::lang::String** __retval);
void RectF__toString_IMPL_7207_fn(bool* arg0_, jobject* arg1_, uObject** __retval);
void RectF__writeToParcel_fn(RectF* __this, ::g::Android::android::os::Parcel* arg0, int* arg1);
void RectF__writeToParcel_IMPL_7236_fn(bool* arg0_, jobject* arg1_, uObject* arg2_, int* arg3_);
struct RectF : ::g::Android::java::lang::Object
{
static jclass _javaClass2_;
static jclass& _javaClass2() { return _javaClass2_; }
static jmethodID describeContents_7235_ID_;
static jmethodID& describeContents_7235_ID() { return describeContents_7235_ID_; }
static jmethodID equals_7205_ID_;
static jmethodID& equals_7205_ID() { return equals_7205_ID_; }
static jmethodID hashCode_7206_ID_;
static jmethodID& hashCode_7206_ID() { return hashCode_7206_ID_; }
static jmethodID toString_7207_ID_;
static jmethodID& toString_7207_ID() { return toString_7207_ID_; }
static jmethodID writeToParcel_7236_ID_;
static jmethodID& writeToParcel_7236_ID() { return writeToParcel_7236_ID_; }
int describeContents();
void writeToParcel(::g::Android::android::os::Parcel* arg0, int arg1);
static void _Init2();
static int describeContents_IMPL_7235(bool arg0_, jobject arg1_);
static bool equals_IMPL_7205(bool arg0_, jobject arg1_, uObject* arg2_);
static int hashCode_IMPL_7206(bool arg0_, jobject arg1_);
static uObject* toString_IMPL_7207(bool arg0_, jobject arg1_);
static void writeToParcel_IMPL_7236(bool arg0_, jobject arg1_, uObject* arg2_, int arg3_);
};
// }
}}}} // ::g::Android::android::graphics
|
// Copyright (c) Microsoft Corporation
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#pragma once
#include "xsapi/tournaments.h"
#include "TournamentState_WinRT.h"
#include "TeamState_WinRT.h"
#include "TeamSummary_WinRT.h"
NAMESPACE_MICROSOFT_XBOX_SERVICES_TOURNAMENTS_BEGIN
/// <summary>
/// Represents tournament details.
/// </summary>
public ref class Tournament sealed
{
public:
/// <summary>
/// The ID of the tournament. It is an opaque string specified by the tournament organizer.
/// </summary>
DEFINE_PROP_GET_STR_OBJ(Id, id);
/// <summary>
/// The organizer of this tournament.
/// </summary>
DEFINE_PROP_GET_STR_OBJ(OrganizerId, organizer_id);
/// <summary>
/// A string representing the friendly name of the organizer
/// </summary>
DEFINE_PROP_GET_STR_OBJ(OrganizerName, organizer_name);
/// <summary>
/// A friendly name for the tournament, intended for display.
/// </summary>
DEFINE_PROP_GET_STR_OBJ(Name, name);
/// <summary>
/// An additional, longer description of the tournament, intended for display.
/// </summary>
DEFINE_PROP_GET_STR_OBJ(Description, description);
/// <summary>
/// A string representing the friendly name of the game mode
/// </summary>
DEFINE_PROP_GET_STR_OBJ(GameMode, game_mode);
/// <summary>
/// A string representing the style of the tournament, such as "Single Elimination" or "Round Robin"
/// </summary>
DEFINE_PROP_GET_STR_OBJ(TournamentStyle, tournament_style);
/// <summary>
/// True when registration is open.
/// </summary>
DEFINE_PROP_GET_OBJ(IsRegistrationOpen, is_registration_open, bool);
/// <summary>
/// True when check-in is open.
/// </summary>
DEFINE_PROP_GET_OBJ(IsCheckinOpen, is_checkin_open, bool);
/// <summary>
/// True when play is open.
/// </summary>
DEFINE_PROP_GET_OBJ(IsPlayingOpen, is_playing_open, bool);
/// <summary>
/// True if the tournament has a prize. False otherwise.
/// </summary>
DEFINE_PROP_GET_OBJ(HasPrize, has_prize, bool);
/// <summary>
/// A flag indicating whether the tournament is currently paused.
/// </summary>
DEFINE_PROP_GET_OBJ(IsPaused, is_paused, bool);
/// <summary>
/// The min number of players required in a team.
/// </summary>
DEFINE_PROP_GET_OBJ(MinTeamSize, min_team_size, uint32);
/// <summary>
/// The max number of players that can play on a team.
/// </summary>
DEFINE_PROP_GET_OBJ(MaxTeamSize, max_team_size, uint32);
/// <summary>
/// The number of teams registered for the tournament, not including waitlisted teams.
/// </summary>
DEFINE_PROP_GET_OBJ(TeamsRegisteredCount, teams_registered_count, uint32);
/// <summary>
/// This is the minimum number of registered teams. This does not include waitlisted teams.
/// </summary>
DEFINE_PROP_GET_OBJ(MinTeamsRegistered, min_teams_registered, uint32);
/// <summary>
/// This is the maximum number of registered teams. This does not include waitlisted teams.
/// </summary>
DEFINE_PROP_GET_OBJ(MaxTeamsRegistered, max_teams_registered, uint32);
/// <summary>
/// The current state of the tournament. Tournaments are Active by default.
/// Organizers can set the tournament to Canceled or Completed by explicitly updating the tournament.
/// </summary>
DEFINE_PROP_GET_ENUM_OBJ(TournamentState, tournament_state, Microsoft::Xbox::Services::Tournaments::TournamentState);
/// <summary>
/// The start time of registration. Must be before checkinStart.
/// </summary>
DEFINE_PROP_GET_DATETIME_OBJ(RegistrationStartTime, registration_start_time);
/// <summary>
/// The end time of registration. Must be before checkinStart.
/// </summary>
DEFINE_PROP_GET_DATETIME_OBJ(RegistrationEndTime, registration_end_time);
/// <summary>
/// The start time of checkin. Must be before playingStart.
/// </summary>
DEFINE_PROP_GET_DATETIME_OBJ(CheckinStartTime, checkin_start_time);
/// <summary>
/// The end time of checkin. Must be before playingStart.
/// </summary>
DEFINE_PROP_GET_DATETIME_OBJ(CheckinEndTime, checkin_end_time);
/// <summary>
/// The time the tournament begins.
/// </summary>
DEFINE_PROP_GET_DATETIME_OBJ(PlayingStartTime, playing_start_time);
/// <summary>
/// The time the tournament ends.
/// </summary>
DEFINE_PROP_GET_DATETIME_OBJ(PlayingEndTime, playing_end_time);
/// <summary>
/// The datetime that this tournament has reached either the Canceled or Completed state.
/// This is set automatically when a tournament is updated to be Canceled or Complete.
/// </summary>
DEFINE_PROP_GET_DATETIME_OBJ(EndTime, end_time);
/// <summary>
/// Represents a summary of team details for the user participating in the tournament.
/// Only applies for those tournaments where the user has already registered.
/// </summary>
property Microsoft::Xbox::Services::Tournaments::TeamSummary^ TeamSummary
{
Microsoft::Xbox::Services::Tournaments::TeamSummary^ get();
}
internal:
Tournament(
_In_ xbox::services::tournaments::tournament cppObj
);
const xbox::services::tournaments::tournament& GetCppObj() const;
private:
xbox::services::tournaments::tournament m_cppObj;
Microsoft::Xbox::Services::Tournaments::TeamSummary^ m_teamSummary;
};
NAMESPACE_MICROSOFT_XBOX_SERVICES_TOURNAMENTS_END
|
/* Fig. 8.26: fig08_26.c
Using strrchr */
#include <stdio.h>
#include <string.h>
int main( void )
{
/* initialize char pointer */
const char *string1 = "A zoo has many animals including zebras";
int c = 'z'; /* character to search for */
printf( "%s\n%s'%c'%s\"%s\"\n",
"The remainder of string1 beginning with the",
"last occurrence of character ", c,
" is: ", strrchr( string1, c ) );
return 0; /* indicates successful termination */
} /* end main */
/**************************************************************************
* (C) Copyright 1992-2010 by Deitel & Associates, Inc. and *
* Pearson Education, Inc. All Rights Reserved. *
* *
* DISCLAIMER: The authors and publisher of this book have used their *
* best efforts in preparing the book. These efforts include the *
* development, research, and testing of the theories and programs *
* to determine their effectiveness. The authors and publisher make *
* no warranty of any kind, expressed or implied, with regard to these *
* programs or to the documentation contained in these books. The authors *
* and publisher shall not be liable in any event for incidental or *
* consequential damages in connection with, or arising out of, the *
* furnishing, performance, or use of these programs. *
*************************************************************************/
|
// -*- C++ -*-
/**
* \file docstream.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Georg Baum
*
* Full author contact details are available in file CREDITS.
*/
#ifndef LYX_DOCSTREAM_H
#define LYX_DOCSTREAM_H
#include "TexRow.h"
#include "support/docstring.h"
#if defined(_MSC_VER) && (_MSC_VER >= 1600)
// Ugly workaround for MSVC10 STL bug:
// std::numpunct has a hardcoded dllimport in definition, but we wanna it with 32 bit
// so we can't import it and must define it but then the compiler complains.
#include "support/numpunct_lyx_char_type.h"
#endif
#include <fstream>
#include <sstream>
namespace lyx {
class iconv_codecvt_facet_exception : public std::exception {
public:
virtual ~iconv_codecvt_facet_exception() throw() {}
virtual const char * what() const throw();
};
/// Base class for UCS4 input streams
typedef std::basic_istream<char_type> idocstream;
/** Base class for UCS4 output streams.
If you want to output a single UCS4 character, use \code
os.put(c);
\endcode, not \code
os << c;
\endcode . The latter will not output the character, but the code point
as number if USE_WCHAR_T is not defined. This is because we can't overload
operator<< (our character type is not always a real type but sometimes a
typedef). Narrow characters of type char can be output as usual.
*/
typedef std::basic_ostream<char_type> odocstream;
/// File stream for reading UTF8-encoded files with automatic conversion to
/// UCS4.
class ifdocstream : public std::basic_ifstream<char_type> {
typedef std::basic_ifstream<char_type> base;
public:
ifdocstream();
explicit ifdocstream(const char* s,
std::ios_base::openmode mode = std::ios_base::in,
std::string const & encoding = "UTF-8");
~ifdocstream() {}
};
/// File stream for writing files in 8bit encoding \p encoding with automatic
/// conversion from UCS4.
class ofdocstream : public std::basic_ofstream<char_type> {
typedef std::basic_ofstream<char_type> base;
public:
ofdocstream();
explicit ofdocstream(const char* s,
std::ios_base::openmode mode = std::ios_base::out|std::ios_base::trunc,
std::string const & encoding = "UTF-8");
~ofdocstream() {}
///
void reset(std::string const & encoding);
};
/// UCS4 input stringstream
typedef std::basic_istringstream<char_type> idocstringstream;
/// UCS4 output manipulator
typedef odocstream & (*odocstream_manip)(odocstream &);
/** Wrapper class for odocstream.
This class is used to automatically count the lines of the exported latex
code and also to ensure that no blank lines may be inadvertently output.
To this end, use the special variables "breakln" and "safebreakln" as if
they were iomanip's to ensure that the next output will start at the
beginning of a line. Using "breakln", a '\n' char will be output if needed,
while using "safebreakln", "%\n" will be output if needed.
The class also records the last output character.
*/
class otexstream {
public:
///
otexstream(odocstream & os, TexRow & texrow)
: os_(os), texrow_(texrow),
canbreakline_(false), protectspace_(false), lastchar_(0) {}
///
odocstream & os() { return os_; }
///
TexRow & texrow() { return texrow_; }
///
void put(char_type const & c);
///
void canBreakLine(bool breakline) { canbreakline_ = breakline; }
///
bool canBreakLine() const { return canbreakline_; }
///
void protectSpace(bool protectspace) { protectspace_ = protectspace; }
///
bool protectSpace() const { return protectspace_; }
///
void lastChar(char_type const & c) { lastchar_ = c; }
///
char_type lastChar() const { return lastchar_; }
private:
///
odocstream & os_;
///
TexRow & texrow_;
///
bool canbreakline_;
///
bool protectspace_;
///
char_type lastchar_;
};
/// Helper structs for breaking a line
struct BreakLine {
char n;
};
struct SafeBreakLine {
char n;
};
extern BreakLine breakln;
extern SafeBreakLine safebreakln;
///
otexstream & operator<<(otexstream &, BreakLine);
///
otexstream & operator<<(otexstream &, SafeBreakLine);
///
otexstream & operator<<(otexstream &, odocstream_manip);
///
otexstream & operator<<(otexstream &, docstring const &);
///
otexstream & operator<<(otexstream &, std::string const &);
///
otexstream & operator<<(otexstream &, char const *);
///
otexstream & operator<<(otexstream &, char);
///
template <typename Type>
otexstream & operator<<(otexstream & ots, Type value);
/// Helper struct for changing stream encoding
struct SetEnc {
SetEnc(std::string const & e) : encoding(e) {}
std::string encoding;
};
/// Helper function for changing stream encoding
SetEnc setEncoding(std::string const & encoding);
/** Change the encoding of \p os to \p e.encoding.
\p e.encoding must be a valid iconv name of an 8bit encoding.
This does nothing if the stream is not a file stream, since only
file streams do have an associated 8bit encoding.
Usage: \code
os << setEncoding("ISO-8859-1");
\endcode
*/
odocstream & operator<<(odocstream & os, SetEnc e);
idocstream & operator<<(idocstream & os, SetEnc e);
}
#endif
|
/*
* arch/arm/include/asm/smp.h
*
* Copyright (C) 2004-2005 ARM Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef __ASM_ARM_SMP_H
#define __ASM_ARM_SMP_H
#include <linux/threads.h>
#include <linux/cpumask.h>
#include <linux/thread_info.h>
#ifndef CONFIG_SMP
# error "<asm/smp.h> included in non-SMP build"
#endif
#define raw_smp_processor_id() (current_thread_info()->cpu)
struct seq_file;
/*
* generate IPI list text
*/
extern void show_ipi_list(struct seq_file *, int);
/*
* Called from assembly code, this handles an IPI.
*/
asmlinkage void do_IPI(int ipinr, struct pt_regs *regs);
/*
* Called from C code, this handles an IPI.
*/
void handle_IPI(int ipinr, struct pt_regs *regs);
/*
* Setup the set of possible CPUs (via set_cpu_possible)
*/
extern void smp_init_cpus(void);
/*
* Provide a function to raise an IPI cross call on CPUs in callmap.
*/
extern void set_smp_cross_call(void (*)(const struct cpumask *, unsigned int));
/*
* Called from platform specific assembly code, this is the
* secondary CPU entry point.
*/
asmlinkage void secondary_start_kernel(void);
/*
* Initial data for bringing up a secondary CPU.
*/
struct secondary_data {
union {
unsigned long mpu_rgn_szr;
unsigned long pgdir;
};
unsigned long swapper_pg_dir;
void *stack;
};
extern struct secondary_data secondary_data;
extern volatile int pen_release;
extern void secondary_startup(void);
extern int __cpu_disable(void);
extern void __cpu_die(unsigned int cpu);
extern void cpu_die(void);
extern void arch_send_call_function_single_ipi(int cpu);
extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
extern void arch_send_wakeup_ipi_mask(const struct cpumask *mask);
extern int register_ipi_completion(struct completion *completion, int cpu);
extern void smp_send_all_cpu_backtrace(bool);
struct smp_operations {
#ifdef CONFIG_SMP
/*
* Setup the set of possible CPUs (via set_cpu_possible)
*/
void (*smp_init_cpus)(void);
/*
* Initialize cpu_possible map, and enable coherency
*/
void (*smp_prepare_cpus)(unsigned int max_cpus);
/*
* Perform platform specific initialisation of the specified CPU.
*/
void (*smp_secondary_init)(unsigned int cpu);
/*
* Boot a secondary CPU, and assign it the specified idle task.
* This also gives us the initial stack to use for this CPU.
*/
int (*smp_boot_secondary)(unsigned int cpu, struct task_struct *idle);
#ifdef CONFIG_HOTPLUG_CPU
int (*cpu_kill)(unsigned int cpu);
void (*cpu_die)(unsigned int cpu);
int (*cpu_disable)(unsigned int cpu);
#endif
#endif
};
struct of_cpu_method {
const char *method;
struct smp_operations *ops;
};
#define CPU_METHOD_OF_DECLARE(name, _method, _ops) \
static const struct of_cpu_method __cpu_method_of_table_##name \
__used __section(__cpu_method_of_table) \
= { .method = _method, .ops = _ops }
/*
* set platform specific SMP operations
*/
extern void smp_set_ops(struct smp_operations *);
#endif /* ifndef __ASM_ARM_SMP_H */
|
/**
* Copyright (C) 2013-2020 MulticoreWare, Inc
*
* Authors: Bhavna Hariharan <bhavna@multicorewareinc.com>
* Kavitha Sampath <kavitha@multicorewareinc.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
*
* This program is also available under a commercial proprietary license.
* For more information, contact us at license @ x265.com.
**/
#ifndef JSON_H
#define JSON_H
#include <string>
#include <iostream>
#include "json11/json11.h"
using std::string;
using namespace json11;
typedef Json::object JsonObject;
typedef Json::array JsonArray;
class JsonHelper
{
public:
static JsonObject readJson(string path);
static JsonArray readJsonArray(const string &path);
static string dump(JsonArray json);
static string dump(JsonObject json, int extraTab = 0);
static bool writeJson(JsonObject json , string path);
static bool writeJson(JsonArray json, string path);
static JsonObject add(string key, string value, JsonObject &json);
private:
static void printTabs(string &out, int tabCounter);
JsonObject mJson;
static bool validatePathExtension(string &path);
};
#endif // JSON_H
|
/* Copyright (C) 2011-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
#include <string.h>
#include <stdint.h>
void *
__rawmemchr (const void *s, int c)
{
/* Get an aligned pointer. */
const uintptr_t s_int = (uintptr_t) s;
const uint32_t *p = (const uint32_t *) (s_int & -4);
/* Create four copies of the byte for which we are looking. */
const uint32_t goal = 0x01010101 * (uint8_t) c;
/* Read the first word, but munge it so that bytes before the array
will not match goal. Note that this shift count expression works
because we know shift counts are taken mod 32. */
const uint32_t before_mask = (1 << (s_int << 3)) - 1;
uint32_t v = (*p | before_mask) ^ (goal & before_mask);
uint32_t bits;
while ((bits = __insn_seqb (v, goal)) == 0)
v = *++p;
return ((char *) p) + (__insn_ctz (bits) >> 3);
}
libc_hidden_def (__rawmemchr)
weak_alias (__rawmemchr, rawmemchr)
|
/* This testcase is part of GDB, the GNU debugger.
Copyright 2009-2020 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Test reverse debugging of shared libraries.
N.B. Do not call system routines here, we don't want to have to deal with
whether or not there is debug info present for them. */
#include "shr.h"
int main ()
{
char* cptr = "String 1";
int b[2] = {5,8};
/* Call these functions once before we start testing so that they get
resolved by the dynamic loader. If the system has debug info for
the dynamic loader installed, reverse-stepping for the first call
will otherwise stop in the dynamic loader, which is not what we want. */
shr1 ("");
shr2 (0);
b[0] = shr2(12); /* begin part two */
b[1] = shr2(17); /* middle part two */
b[0] = 6; b[1] = 9; /* generic statement, end part two */
shr1 ("message 1\n"); /* shr1 one */
shr1 ("message 2\n"); /* shr1 two */
shr1 ("message 3\n"); /* shr1 three */
return 0; /* end part one */
} /* end of main */
|
/*
*
* This source code is part of
*
* G R O M A C S
*
* GROningen MAchine for Chemical Simulations
*
* VERSION 3.2.0
* Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team,
* check out http://www.gromacs.org for more information.
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* If you want to redistribute modifications, please consider that
* scientific software is very special. Version control is crucial -
* bugs must be traceable. We will be happy to consider code for
* inclusion in the official distribution, but derived work must not
* be called official GROMACS. Details are found in the README & COPYING
* files - if they are missing, get the official version at www.gromacs.org.
*
* To help us fund GROMACS development, we humbly ask that you cite
* the papers on the package - you can find them in the top README file.
*
* For more info, check our website at http://www.gromacs.org
*
* And Hey:
* Gromacs Runs On Most of All Computer Systems
*/
#ifndef _atomprop_h
#define _atomprop_h
#ifdef __cplusplus
extern "C" {
#endif
#include "index.h"
/* Abstract type for the atom property database */
typedef struct gmx_atomprop *gmx_atomprop_t;
enum { epropMass, epropVDW, epropDGsol, epropElectroneg, epropElement,
epropNR };
gmx_atomprop_t gmx_atomprop_init(void);
/* Initializes and returns the atom properties struct */
void gmx_atomprop_destroy(gmx_atomprop_t aps);
/* Get rid of memory after use */
char *gmx_atomprop_element(gmx_atomprop_t aps,int atomnumber);
int gmx_atomprop_atomnumber(gmx_atomprop_t aps,const char *element);
gmx_bool gmx_atomprop_query(gmx_atomprop_t aps,
int eprop,const char *resnm,const char *atomnm,
real *value);
/* Extract a value from the database. Returns TRUE on succes,
* FALSE otherwise. In the latter case, value is a deafult value.
* The first time this function is called for this property
* the database will be read.
*/
#ifdef __cplusplus
}
#endif
#endif
|
/*
IMMS: Intelligent Multimedia Management System
Copyright (C) 2001-2009 Michael Grigoriev
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 __SQLITE___H
#define __SQLITE___H
#include "immsconf.h"
#include <string>
#include <iostream>
#include <map>
#include <stdint.h>
using std::string;
using std::cerr;
using std::endl;
class SQLExec {};
extern SQLExec execute;
class SQLDatabaseConnection
{
public:
SQLDatabaseConnection(const string &filename);
SQLDatabaseConnection() {};
~SQLDatabaseConnection();
static uint64_t last_rowid();
void open(const string &filename);
void close();
static string error();
};
class AttachedDatabase
{
public:
AttachedDatabase(const string &filename, const string &alias);
AttachedDatabase() : dbname("") {};
~AttachedDatabase();
void attach(const string &filename, const string &alias);
void detach();
private:
string dbname;
};
class AutoTransaction
{
public:
AutoTransaction(bool exclusive = false);
~AutoTransaction();
void commit();
private:
bool commited;
};
class SQLException : public std::exception
{
public:
SQLException(const string &source = "Error",
const string &error = SQLDatabaseConnection::error())
: msg(source + ": " + error) {};
SQLException(const string &file, int line, const string &error);
const string &what() { return msg; }
~SQLException() throw () {};
private:
string msg;
};
typedef struct sqlite3_stmt sqlite3_stmt;
class SQLQueryManager
{
public:
SQLQueryManager() : block_errors(false) {}
sqlite3_stmt *get(const string &query);
~SQLQueryManager();
static SQLQueryManager *self();
static void kill();
private:
typedef std::map<string, sqlite3_stmt *> StmtMap;
StmtMap statements;
friend class RuntimeErrorBlocker;
bool block_errors;
static SQLQueryManager *instance;
};
class RuntimeErrorBlocker
{
public:
RuntimeErrorBlocker() : active(!SQLQueryManager::self()->block_errors)
{ SQLQueryManager::self()->block_errors = true; }
~RuntimeErrorBlocker()
{ if (active) SQLQueryManager::self()->block_errors = false; }
private:
bool active;
};
class SQLQuery
{
public:
SQLQuery(const string &query);
~SQLQuery();
void reset();
bool next();
bool is_null();
bool not_null() { return !is_null(); }
void execute() { while (next()); }
SQLQuery &operator()(int bindto) { curbind = bindto; return *this; }
SQLQuery &operator<<(int i);
SQLQuery &operator<<(double i);
SQLQuery &operator<<(float i) { return *this << double(i); }
SQLQuery &operator<<(long i);
SQLQuery &operator<<(const string &s);
SQLQuery &operator<<(const SQLExec &execute);
SQLQuery &bind(const void *data, size_t n);
SQLQuery &operator>>(int &i);
SQLQuery &operator>>(long &i);
SQLQuery &operator>>(double &i);
SQLQuery &operator>>(float &i);
SQLQuery &operator>>(string &s);
SQLQuery &load(void *data, size_t &n);
SQLQuery &load(void *data, unsigned long long n) {
size_t real_size = n;
return load(data, real_size);
};
private:
int curbind;
sqlite3_stmt *stmt;
};
typedef SQLQuery Q;
#define WARNIFFAILED() \
catch (SQLException &e) { \
cerr << string(80, '*') << endl; \
cerr << __FILE__ << ":" << __func__ << ": " << e.what() << endl; \
cerr << string(80, '*') << endl; \
} do {} while (0)
#define IGNOREFAILURE() \
catch (SQLException &e) { \
} do {} while (0)
#define SQLStandardException() \
SQLException(__FILE__, __LINE__, SQLDatabaseConnection::error())
#endif
|
#ifndef FLOATPROPERTYEDITOR_H_
#define FLOATPROPERTYEDITOR_H_
#include "PropertyEditor.h"
#include <gtk/gtkwidget.h>
namespace ui {
/**
* Property editor for a ranged floating point value. A slider widget is used
* to adjust the value between the upper and lower limit in the range. The
* range information is passed in via the options string.
*/
class FloatPropertyEditor: public PropertyEditor
{
// Slider widget
GtkWidget* _scale;
// Entity to edit
Entity* _entity;
// Name of key
std::string _key;
private:
/* GTK CALLBACKS */
static void _onApply (GtkWidget*, FloatPropertyEditor*);
public:
/**
* Default constructor for creation in the map.
*/
FloatPropertyEditor ()
{
}
/**
* Construct with Entity, key name and options.
*/
FloatPropertyEditor (Entity*, const std::string&, const std::string&);
/**
* Virtual PropertyEditor clone method.
*/
PropertyEditorPtr createNew (Entity* entity, const std::string& name, const std::string& options)
{
return PropertyEditorPtr(new FloatPropertyEditor(entity, name, options));
}
};
}
#endif /*FLOATPROPERTYEDITOR_H_*/
|
//
// Copyright (C) 2013 OpenSim Ltd.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program; if not, see <http://www.gnu.org/licenses/>.
//
#ifndef __INET_IDIGITALANALOGCONVERTER_H
#define __INET_IDIGITALANALOGCONVERTER_H
#include "inet/physicallayer/contract/bitlevel/ISignalSampleModel.h"
#include "inet/physicallayer/contract/bitlevel/ISignalAnalogModel.h"
namespace inet {
namespace physicallayer {
class INET_API IDigitalAnalogConverter : public IPrintableObject
{
public:
virtual const ITransmissionAnalogModel *convertDigitalToAnalog(const ITransmissionSampleModel *sampleModel) const = 0;
};
} // namespace physicallayer
} // namespace inet
#endif // ifndef __INET_IDIGITALANALOGCONVERTER_H
|
/*
* Copyright (C) 2012 Google AB. All rights reserved.
* Copyright (C) 2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* 3. 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.
*/
#pragma once
#if ENABLE(WEB_RTC)
#include "RTCIceConnectionState.h"
#include "RTCIceGatheringState.h"
#include "RTCSignalingState.h"
#include <wtf/RefPtr.h>
namespace WebCore {
class MediaStreamPrivate;
class RTCDataChannelHandler;
class RTCIceCandidateDescriptor;
class RTCPeerConnectionHandlerClient {
public:
virtual ~RTCPeerConnectionHandlerClient() = default;
virtual void negotiationNeeded() = 0;
virtual void didGenerateIceCandidate(RefPtr<RTCIceCandidateDescriptor>&&) = 0;
virtual void didChangeSignalingState(RTCSignalingState) = 0;
virtual void didChangeIceGatheringState(RTCIceGatheringState) = 0;
virtual void didChangeIceConnectionState(RTCIceConnectionState) = 0;
virtual void didAddRemoteStream(RefPtr<MediaStreamPrivate>&&) = 0;
virtual void didRemoveRemoteStream(MediaStreamPrivate*) = 0;
virtual void didAddRemoteDataChannel(std::unique_ptr<RTCDataChannelHandler>) = 0;
};
} // namespace WebCore
#endif // ENABLE(WEB_RTC)
|
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2010-01-25 Bernard first version
* 2012-05-31 aozima Merge all of the C source code into cpuport.c
* 2012-08-17 aozima fixed bug: store r8 - r11.
* 2012-12-23 aozima stack addr align to 8byte.
*/
#include <rtthread.h>
struct exception_stack_frame
{
rt_uint32_t r0;
rt_uint32_t r1;
rt_uint32_t r2;
rt_uint32_t r3;
rt_uint32_t r12;
rt_uint32_t lr;
rt_uint32_t pc;
rt_uint32_t psr;
};
struct stack_frame
{
/* r4 ~ r7 low register */
rt_uint32_t r4;
rt_uint32_t r5;
rt_uint32_t r6;
rt_uint32_t r7;
/* r8 ~ r11 high register */
rt_uint32_t r8;
rt_uint32_t r9;
rt_uint32_t r10;
rt_uint32_t r11;
struct exception_stack_frame exception_stack_frame;
};
/* flag in interrupt handling */
rt_uint32_t rt_interrupt_from_thread, rt_interrupt_to_thread;
rt_uint32_t rt_thread_switch_interrupt_flag;
/**
* This function will initialize thread stack
*
* @param tentry the entry of thread
* @param parameter the parameter of entry
* @param stack_addr the beginning stack address
* @param texit the function will be called when thread exit
*
* @return stack address
*/
rt_uint8_t *rt_hw_stack_init(void *tentry,
void *parameter,
rt_uint8_t *stack_addr,
void *texit)
{
struct stack_frame *stack_frame;
rt_uint8_t *stk;
unsigned long i;
stk = stack_addr + sizeof(rt_uint32_t);
stk = (rt_uint8_t *)RT_ALIGN_DOWN((rt_uint32_t)stk, 8);
stk -= sizeof(struct stack_frame);
stack_frame = (struct stack_frame *)stk;
/* init all register */
for (i = 0; i < sizeof(struct stack_frame) / sizeof(rt_uint32_t); i ++)
{
((rt_uint32_t *)stack_frame)[i] = 0xdeadbeef;
}
stack_frame->exception_stack_frame.r0 = (unsigned long)parameter; /* r0 : argument */
stack_frame->exception_stack_frame.r1 = 0; /* r1 */
stack_frame->exception_stack_frame.r2 = 0; /* r2 */
stack_frame->exception_stack_frame.r3 = 0; /* r3 */
stack_frame->exception_stack_frame.r12 = 0; /* r12 */
stack_frame->exception_stack_frame.lr = (unsigned long)texit; /* lr */
stack_frame->exception_stack_frame.pc = (unsigned long)tentry; /* entry point, pc */
stack_frame->exception_stack_frame.psr = 0x01000000L; /* PSR */
/* return task's current stack address */
return stk;
}
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
extern long list_thread(void);
#endif
extern rt_thread_t rt_current_thread;
/**
* fault exception handling
*/
void rt_hw_hard_fault_exception(struct exception_stack_frame *contex)
{
rt_kprintf("psr: 0x%08x\n", contex->psr);
rt_kprintf(" pc: 0x%08x\n", contex->pc);
rt_kprintf(" lr: 0x%08x\n", contex->lr);
rt_kprintf("r12: 0x%08x\n", contex->r12);
rt_kprintf("r03: 0x%08x\n", contex->r3);
rt_kprintf("r02: 0x%08x\n", contex->r2);
rt_kprintf("r01: 0x%08x\n", contex->r1);
rt_kprintf("r00: 0x%08x\n", contex->r0);
rt_kprintf("hard fault on thread: %s\n", rt_current_thread->name);
#if defined(RT_USING_FINSH) && defined(MSH_USING_BUILT_IN_COMMANDS)
list_thread();
#endif
while (1);
}
#define SCB_CFSR (*(volatile const unsigned *)0xE000ED28) /* Configurable Fault Status Register */
#define SCB_HFSR (*(volatile const unsigned *)0xE000ED2C) /* HardFault Status Register */
#define SCB_MMAR (*(volatile const unsigned *)0xE000ED34) /* MemManage Fault Address register */
#define SCB_BFAR (*(volatile const unsigned *)0xE000ED38) /* Bus Fault Address Register */
#define SCB_AIRCR (*(volatile unsigned long *)0xE000ED0C) /* Reset control Address Register */
#define SCB_RESET_VALUE 0x05FA0004 /* Reset value, write to SCB_AIRCR can reset cpu */
#define SCB_CFSR_MFSR (*(volatile const unsigned char*)0xE000ED28) /* Memory-management Fault Status Register */
#define SCB_CFSR_BFSR (*(volatile const unsigned char*)0xE000ED29) /* Bus Fault Status Register */
#define SCB_CFSR_UFSR (*(volatile const unsigned short*)0xE000ED2A) /* Usage Fault Status Register */
/**
* reset CPU
*/
RT_WEAK void rt_hw_cpu_reset(void)
{
SCB_AIRCR = SCB_RESET_VALUE;//((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |SCB_AIRCR_SYSRESETREQ_Msk);
}
|
/* Copyright (C) 2010-2018 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (retro_common.h).
* ---------------------------------------------------------------------------------------
*
* 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 _LIBRETRO_COMMON_RETRO_COMMON_H
#define _LIBRETRO_COMMON_RETRO_COMMON_H
/*
This file is designed to normalize the libretro-common compiling environment.
It is not to be used in public API headers, as they should be designed as leanly as possible.
Nonetheless.. in the meantime, if you do something like use ssize_t, which is not fully portable,
in a public API, you may need this.
*/
/* conditional compilation is handled inside here */
#include <compat/msvc.h>
#endif
|
/*
This file is part of the KDE project
* Copyright (C) 2012 C. Boemann <cbo@boemann.dk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.*/
#ifndef RESIZETABLECOMMAND_H
#define RESIZETABLECOMMAND_H
#include <kundo2qstack.h>
#include <QList>
class QTextDocument;
class QTextTable;
class KoTableColumnStyle;
class KoTableRowStyle;
class ResizeTableCommand : public KUndo2Command
{
public:
ResizeTableCommand(QTextTable *t, bool horizontal, int band, qreal size, KUndo2Command *parent = 0);
virtual ~ResizeTableCommand();
virtual void undo();
virtual void redo();
private:
bool m_first;
int m_tablePosition;
QTextDocument *m_document;
bool m_horizontal;
int m_band;
qreal m_size;
KoTableColumnStyle *m_oldColumnStyle;
KoTableColumnStyle *m_newColumnStyle;
KoTableRowStyle *m_oldRowStyle;
KoTableRowStyle *m_newRowStyle;
};
#endif // RESIZETABLECOMMAND_H
|
/* Copyright (c) 2002-2012 Croteam Ltd.
This program is free software; you can redistribute it and/or modify
it under the terms of version 2 of the GNU General Public License as published by
the Free Software Foundation
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
// Animation names
#define REFLECTION_ANIM_DEFAULT_ANIMATION 0
// Color names
// Patch names
// Names of collision boxes
#define REFLECTION_COLLISION_BOX_PART_NAME 0
// Attaching position names
// Sound names
|
/* Copyright (C) 2009-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#include <errno.h>
#include <libintl.h>
#include <signal.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <not-cancel.h>
#define MF(l) MF1 (l)
#define MF1(l) str_##l
#define C(s1, s2) C1 (s1, s2)
#define C1(s1, s2) s1##s2
#define NOW SIGILL
#include "psiginfo-define.h"
#define NOW SIGFPE
#include "psiginfo-define.h"
#define NOW SIGSEGV
#include "psiginfo-define.h"
#define NOW SIGBUS
#include "psiginfo-define.h"
#define NOW SIGTRAP
#include "psiginfo-define.h"
#define NOW SIGCLD
#include "psiginfo-define.h"
#define NOW SIGPOLL
#include "psiginfo-define.h"
/* Print out on stderr a line consisting of the test in S, a colon, a space,
a message describing the meaning of the signal number PINFO and a newline.
If S is NULL or "", the colon and space are omitted. */
void
psiginfo (const siginfo_t *pinfo, const char *s)
{
char buf[512];
FILE *fp = __fmemopen (buf, sizeof (buf), "w");
if (fp == NULL)
{
const char *colon;
if (s == NULL || *s == '\0')
s = colon = "";
else
colon = ": ";
__fxprintf (NULL, "%s%ssignal %d\n", s, colon, pinfo->si_signo);
return;
}
if (s != NULL && *s != '\0')
fprintf (fp, "%s: ", s);
const char *desc;
if (pinfo->si_signo >= 0 && pinfo->si_signo < NSIG
&& ((desc = _sys_siglist[pinfo->si_signo]) != NULL
#ifdef SIGRTMIN
|| (pinfo->si_signo >= SIGRTMIN && pinfo->si_signo < SIGRTMAX)
#endif
))
{
#ifdef SIGRTMIN
if (desc == NULL)
{
if (pinfo->si_signo - SIGRTMIN < SIGRTMAX - pinfo->si_signo)
{
if (pinfo->si_signo == SIGRTMIN)
fprintf (fp, "SIGRTMIN (");
else
fprintf (fp, "SIGRTMIN+%d (", pinfo->si_signo - SIGRTMIN);
}
else
{
if (pinfo->si_signo == SIGRTMAX)
fprintf (fp, "SIGRTMAX (");
else
fprintf (fp, "SIGRTMAX-%d (", SIGRTMAX - pinfo->si_signo);
}
}
else
#endif
fprintf (fp, "%s (", _(desc));
const char *base = NULL;
const uint8_t *offarr = NULL;
size_t offarr_len = 0;
switch (pinfo->si_signo)
{
#define H(sig) \
case sig: \
base = C(codestrs_, sig).str; \
offarr = C (codes_, sig); \
offarr_len = sizeof (C (codes_, sig)) / sizeof (C (codes_, sig)[0]);\
break
H (SIGILL);
H (SIGFPE);
H (SIGSEGV);
H (SIGBUS);
H (SIGTRAP);
H (SIGCHLD);
H (SIGPOLL);
}
const char *str = NULL;
if (offarr != NULL
&& pinfo->si_code >= 1 && pinfo->si_code <= offarr_len)
str = base + offarr[pinfo->si_code - 1];
else
switch (pinfo->si_code)
{
case SI_USER:
str = N_("Signal sent by kill()");
break;
case SI_QUEUE:
str = N_("Signal sent by sigqueue()");
break;
case SI_TIMER:
str = N_("Signal generated by the expiration of a timer");
break;
case SI_ASYNCIO:
str = N_("\
Signal generated by the completion of an asynchronous I/O request");
break;
case SI_MESGQ:
str = N_("\
Signal generated by the arrival of a message on an empty message queue");
break;
#ifdef SI_TKILL
case SI_TKILL:
str = N_("Signal sent by tkill()");
break;
#endif
#ifdef SI_ASYNCNL
case SI_ASYNCNL:
str = N_("\
Signal generated by the completion of an asynchronous name lookup request");
break;
#endif
#ifdef SI_SIGIO
case SI_SIGIO:
str = N_("\
Signal generated by the completion of an I/O request");
break;
#endif
#ifdef SI_KERNEL
case SI_KERNEL:
str = N_("Signal sent by the kernel");
break;
#endif
}
if (str != NULL)
fprintf (fp, "%s ", _(str));
else
fprintf (fp, "%d ", pinfo->si_code);
if (pinfo->si_signo == SIGILL || pinfo->si_signo == SIGFPE
|| pinfo->si_signo == SIGSEGV || pinfo->si_signo == SIGBUS)
fprintf (fp, "[%p])\n", pinfo->si_addr);
else if (pinfo->si_signo == SIGCHLD)
fprintf (fp, "%ld %d %ld)\n",
(long int) pinfo->si_pid, pinfo->si_status,
(long int) pinfo->si_uid);
else if (pinfo->si_signo == SIGPOLL)
fprintf (fp, "%ld)\n", (long int) pinfo->si_band);
else
fprintf (fp, "%ld %ld)\n",
(long int) pinfo->si_pid, (long int) pinfo->si_uid);
}
else
fprintf (fp, _("Unknown signal %d\n"), pinfo->si_signo);
fclose (fp);
write_not_cancel (STDERR_FILENO, buf, strlen (buf));
}
|
/* lxstat using old-style Unix stat system call.
Copyright (C) 2004-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
#define __lxstat64 __lxstat64_disable
#include <errno.h>
#include <stddef.h>
#include <sys/stat.h>
#include <kernel_stat.h>
#include <sysdep.h>
#include <sys/syscall.h>
#include <xstatconv.h>
#undef __lxstat64
/* Get information about the file NAME in BUF. */
int
__lxstat (int vers, const char *name, struct stat *buf)
{
INTERNAL_SYSCALL_DECL (err);
int result;
struct kernel_stat kbuf;
if (vers == _STAT_VER_KERNEL64)
{
result = INTERNAL_SYSCALL (lstat64, err, 2, name, buf);
if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
return result;
__set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
return -1;
}
result = INTERNAL_SYSCALL (lstat, err, 2, name, &kbuf);
if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
return __xstat_conv (vers, &kbuf, buf);
__set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
return -1;
}
hidden_def (__lxstat)
weak_alias (__lxstat, _lxstat);
strong_alias (__lxstat, __lxstat64);
hidden_ver (__lxstat, __lxstat64)
|
/**
* Signal.h
* Author: Daniel Karrels dan@karrels.com
* Copyright (C) 2003 Daniel Karrels <dan@karrels.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.
*
* $Id: Signal.h,v 1.5 2003/12/17 18:21:36 dan_karrels Exp $
*/
#ifndef __SIGNAL_H
#define __SIGNAL_H "$Id: Signal.h,v 1.5 2003/12/17 18:21:36 dan_karrels Exp $"
#include <pthread.h>
namespace gnuworld
{
/**
* A class used to safely handle asynchronous (non-realtime) signals.
* It uses a nonblocking pipe (rather than other solutions, see
* my thesis) to solve the multiple consumer, single nonblocking
* producer p/c problem.
*/
class Signal
{
protected:
/**
* This variable is true if there exists an uncoverable error.
*/
static bool signalError ;
/**
* The FD for the read side of the pipe.
*/
static int readFD ;
/**
* The FD for the write side of the pipe.
*/
static int writeFD ;
/**
* A mutex to guard access to the Singleton.
*/
static pthread_mutex_t singletonMutex ;
/**
* The Singleton instance.
*/
static Signal* theInstance ;
/**
* This mutex guards from multiple threads performing a get()
*/
static pthread_mutex_t pipeMutex ;
public:
/**
* Release resources associated with this class.
*/
virtual ~Signal() ;
/**
* Retrieve the Singleton instance of this class, creating
* it if necessary.
* Once an instance is created, all signals currently
* supported by this class will be remapped to this subsystem.
*/
static Signal* getInstance() ;
/**
* Add a signal to the signal queue.
* This method is meant to be called *only* from the
* asynchronous signal handler.
*/
static void AddSignal( int whichSig ) ;
/**
* The semantics of the return statement are a little backwards here:
* - true indicates that the caller should check the value of
* theSignal for either a new signal or an error state (-1)
* - false indicates that no error and no signal are ready
*/
static bool getSignal( int& theSignal ) ;
/**
* This method will return true if there is a non-recoverable
* error in the signal handler subsystem.
*/
static bool isError() ;
private:
/**
* Private constructor, make this class a Singleton.
*/
Signal() ;
protected:
/**
* Convenience method to close the pipes when a critical
* error occurs. In this case, signalError will remain
* set, and both pipes are invalid, no signal delivery
* will occur.
*/
static void closePipes() ;
/**
* Opens both pipes, and configures in nonblocking mode.
*/
static bool openPipes() ;
} ;
} // namespace gnuworld
#endif // __SIGNAL_H
|
// -*- C++ -*-
/**
* \file MetricsInfo.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author André Pönitz
* \author Stefan Schimanski
*
* Full author contact details are available in file CREDITS.
*/
#ifndef METRICSINFO_H
#define METRICSINFO_H
#include "Changes.h"
#include "ColorCode.h"
#include "FontInfo.h"
#include "support/strfwd.h"
#include <string>
class BufferView;
namespace lyx {
namespace frontend { class Painter; }
class Inset;
class MacroContext;
/// Standard Sizes (mode styles)
enum Styles {
///
LM_ST_DISPLAY = 0,
///
LM_ST_TEXT,
///
LM_ST_SCRIPT,
///
LM_ST_SCRIPTSCRIPT
};
//
// This is the part common to MetricsInfo and PainterInfo
//
class MetricsBase {
public:
///
MetricsBase();
///
MetricsBase(BufferView * bv, FontInfo const & font, int textwidth);
/// the current view
BufferView * bv;
/// current font
FontInfo font;
/// current math style (display/text/script/..)
Styles style;
/// name of current font - mathed specific
std::string fontname;
/// This is the width available in pixels
int textwidth;
};
//
// This contains a MetricsBase and information that's only relevant during
// the first phase of the two-phase draw
//
class MetricsInfo {
public:
///
MetricsInfo();
///
MetricsInfo(BufferView * bv, FontInfo const & font, int textwidth, MacroContext const & mc);
///
MetricsBase base;
/// The context to resolve macros
MacroContext const & macrocontext;
};
//
// This contains a MetricsBase and information that's only relevant during
// the second phase of the two-phase draw
//
class PainterInfo {
public:
///
PainterInfo(BufferView * bv, frontend::Painter & pain);
///
void draw(int x, int y, char_type c);
///
void draw(int x, int y, docstring const & str);
/// Determines the background color for the specified inset based on the
/// selection state, the background color inherited from the parent inset
/// and the inset's own background color.
/// \param sel whether to take the selection state into account
ColorCode backgroundColor(Inset const * inset, bool sel = true) const;
/// Determines the text color based on the intended color, the
/// change tracking state and the selection state.
/// \param color what the color should be by default
Color textColor(Color const & color) const;
///
MetricsBase base;
///
frontend::Painter & pain;
/// Whether the text at this point is right-to-left (for InsetNewline)
bool ltr_pos;
/// The change the parent is part of (change tracking)
Change change_;
/// Whether the parent is selected as a whole
bool selected;
///
bool full_repaint;
/// Current background color
ColorCode background_color;
};
class TextMetricsInfo {};
/// Generic base for temporarily changing things.
/// The original state gets restored when the Changer is destructed.
template <class Struct, class Temp = Struct>
class Changer {
public:
///
Changer(Struct & orig) : orig_(orig) {}
protected:
///
Struct & orig_;
///
Temp save_;
};
// temporarily change some aspect of a font
class FontChanger : public Changer<FontInfo> {
public:
///
FontChanger(FontInfo & orig, docstring const & font);
FontChanger(MetricsBase & mb, char const * const font);
///
~FontChanger();
};
// temporarily change a full font
class FontSetChanger : public Changer<MetricsBase> {
public:
///
FontSetChanger(MetricsBase & mb, docstring const & font,
bool really_change_font = true);
FontSetChanger(MetricsBase & mb, char const * const font,
bool really_change_font = true);
///
~FontSetChanger();
private:
///
bool change_;
};
// temporarily change the style
class StyleChanger : public Changer<MetricsBase> {
public:
///
StyleChanger(MetricsBase & mb, Styles style);
///
~StyleChanger();
};
// temporarily change the style to script style
class ScriptChanger : public StyleChanger {
public:
///
ScriptChanger(MetricsBase & mb);
};
// temporarily change the style suitable for use in fractions
class FracChanger : public StyleChanger {
public:
///
FracChanger(MetricsBase & mb);
};
// temporarily change the style suitable for use in tabulars and arrays
class ArrayChanger : public StyleChanger {
public:
///
ArrayChanger(MetricsBase & mb);
};
// temporarily change the shape of a font
class ShapeChanger : public Changer<FontInfo, FontShape> {
public:
///
ShapeChanger(FontInfo & font, FontShape shape);
///
~ShapeChanger();
};
// temporarily change the available text width
class WidthChanger : public Changer<MetricsBase>
{
public:
///
WidthChanger(MetricsBase & mb, int width);
///
~WidthChanger();
};
// temporarily change the used color
class ColorChanger : public Changer<FontInfo, ColorCode> {
public:
///
ColorChanger(FontInfo & font, ColorCode color,
bool really_change_color = true);
///
~ColorChanger();
private:
///
bool change_;
};
} // namespace lyx
#endif
|
/**********************************************************************
** This program is part of 'MOOSE', the
** Messaging Object Oriented Simulation Environment.
** Copyright (C) 2003-2010 Upinder S. Bhalla. and NCBS
** It is made available under the terms of the
** GNU Lesser General Public License version 2.1
** See the file COPYING.LIB for the full notice.
**********************************************************************/
/**
* Binds MsgId to FuncIds.
*/
class MsgFuncBinding
{
public:
MsgFuncBinding()
: mid(), fid( 0 )
{;}
MsgFuncBinding( ObjId m, FuncId f )
: mid( m ), fid( f )
{;}
bool operator==( const MsgFuncBinding& other ) const {
return ( mid == other.mid && fid == other.fid );
}
ObjId mid;
FuncId fid;
private:
};
|
/*
* DTV tuner linux driver
*
* Usage: DTV tuner driver by i2c for linux
*
*
* This software program is licensed subject to the GNU General Public License
* (GPL).Version 2,June 1991, available at http://www.fsf.org/copyleft/gpl.html
*
*/
#include "dtvd_tuner_com.h"
void _dtvd_tuner_memset
(
void* dest,
unsigned int val,
unsigned int count
)
{
if( dest == D_DTVD_TUNER_NULL )
{
return;
}
memset( dest, (signed int)val, (size_t)count );
return;
}
void _dtvd_tuner_memcpy
(
void* dest,
const void* src,
unsigned int count
)
{
if( dest == D_DTVD_TUNER_NULL )
{
DTVD_TUNER_SYSERR_RANK_A( D_DTVD_TUNER_SYSERR_DRV_PARAM,
DTVD_TUNER_COM_STD,
0, 0, 0, 0, 0, 0 );
return;
}
if( src == D_DTVD_TUNER_NULL )
{
DTVD_TUNER_SYSERR_RANK_A( D_DTVD_TUNER_SYSERR_DRV_PARAM,
DTVD_TUNER_COM_STD,
0, 0, 0, 0, 0, 0 );
return;
}
memcpy( dest, src, (size_t)count );
return;
}
void _dtvd_tuner_memmove
(
void* dest,
const void* src,
unsigned int count
)
{
if( dest == D_DTVD_TUNER_NULL )
{
DTVD_TUNER_SYSERR_RANK_A( D_DTVD_TUNER_SYSERR_DRV_PARAM,
DTVD_TUNER_COM_STD,
0, 0, 0, 0, 0, 0 );
return;
}
if( src == D_DTVD_TUNER_NULL )
{
DTVD_TUNER_SYSERR_RANK_A( D_DTVD_TUNER_SYSERR_DRV_PARAM,
DTVD_TUNER_COM_STD,
0, 0, 0, 0, 0, 0 );
return;
}
memmove( dest, src, (size_t)count );
return;
}
#ifndef _D_DTVD_TUNER_NO_BUFFOVER_CHECK
void dtvd_tuner_memset
(
void* dest,
unsigned int val,
unsigned int count,
unsigned int destsize
)
{
if( dest == D_DTVD_TUNER_NULL )
{
return;
}
if( count > destsize )
{
}
else
{
_dtvd_tuner_memset( dest, val, count );
}
return;
}
#endif
#ifndef _D_DTVD_TUNER_NO_BUFFOVER_CHECK
void dtvd_tuner_memcpy
(
void* dest,
const void* src,
unsigned int count,
unsigned int destsize
)
{
if( (dest == D_DTVD_TUNER_NULL) || (src == D_DTVD_TUNER_NULL) )
{
DTVD_TUNER_SYSERR_RANK_A( D_DTVD_TUNER_SYSERR_DRV_PARAM,
DTVD_TUNER_COM_STD,
0, 0, 0, 0, 0, 0 );
return;
}
if( count > destsize )
{
DTVD_TUNER_SYSERR_RANK_A( D_DTVD_TUNER_SYSERR_DRV_PARAM,
DTVD_TUNER_COM_STD,
count, destsize, 0, 0, 0, 0 );
}
else
{
_dtvd_tuner_memcpy( dest, src, count );
}
return;
}
#endif
#ifndef _D_DTVD_TUNER_NO_BUFFOVER_CHECK
void dtvd_tuner_memmove
(
void* dest,
const void* src,
unsigned int count,
unsigned int destsize
)
{
if( (dest == D_DTVD_TUNER_NULL) || (src == D_DTVD_TUNER_NULL) )
{
DTVD_TUNER_SYSERR_RANK_A( D_DTVD_TUNER_SYSERR_DRV_PARAM,
DTVD_TUNER_COM_STD,
0, 0, 0, 0, 0, 0 );
return;
}
if( count > destsize )
{
DTVD_TUNER_SYSERR_RANK_A( D_DTVD_TUNER_SYSERR_DRV_PARAM,
DTVD_TUNER_COM_STD,
count, destsize, 0, 0, 0, 0 );
}
else
{
if( count > 0 )
{
_dtvd_tuner_memmove( dest, src, count );
}
}
return;
}
#endif
|
/* This testcase is part of GDB, the GNU debugger.
Copyright 2009-2020 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Do not use threads as we need to exploit a bug in LWP code masked by the
threads code otherwise.
INFERIOR_PTID must point to exited LWP. Here we use the initial LWP as it
is automatically INFERIOR_PTID for GDB.
Finally we need to call target_resume (RESUME_ALL, ...) which we invoke by
NEW_THREAD_EVENT (called from the new LWP as initial LWP is exited now). */
#define _GNU_SOURCE
#include <sched.h>
#include <assert.h>
#include <unistd.h>
#include <stdlib.h>
#include <features.h>
#ifdef __UCLIBC__
#if !(defined(__UCLIBC_HAS_MMU__) || defined(__ARCH_HAS_MMU__))
#define HAS_NOMMU
#endif
#endif
#define STACK_SIZE 0x1000
static int
fn_return (void *unused)
{
return 0; /* at-fn_return */
}
static int
fn (void *unused)
{
int i;
unsigned char *stack;
int new_pid;
i = sleep (1);
assert (i == 0);
stack = malloc (STACK_SIZE);
assert (stack != NULL);
new_pid = clone (fn_return, stack + STACK_SIZE, CLONE_FILES
#if defined(__UCLIBC__) && defined(HAS_NOMMU)
| CLONE_VM
#endif /* defined(__UCLIBC__) && defined(HAS_NOMMU) */
, NULL, NULL, NULL, NULL);
assert (new_pid > 0);
return 0;
}
int
main (int argc, char **argv)
{
unsigned char *stack;
int new_pid;
stack = malloc (STACK_SIZE);
assert (stack != NULL);
new_pid = clone (fn, stack + STACK_SIZE, CLONE_FILES
#if defined(__UCLIBC__) && defined(HAS_NOMMU)
| CLONE_VM
#endif /* defined(__UCLIBC__) && defined(HAS_NOMMU) */
, NULL, NULL, NULL, NULL);
assert (new_pid > 0);
return 0;
}
|
#include <kernel.h>
#include <kdata.h>
#include <printf.h>
#include <stdbool.h>
#include <tty.h>
#include <devtty.h>
#include <z180.h>
#include <n8vem.h>
static uint8_t tbuf1[TTYSIZ];
static uint8_t tbuf2[TTYSIZ];
#ifdef CONFIG_PROPIO2
static uint8_t tbufp[TTYSIZ];
#endif
struct s_queue ttyinq[NUM_DEV_TTY+1] = { /* ttyinq[0] is never used */
{ NULL, NULL, NULL, 0, 0, 0 },
{ tbuf1, tbuf1, tbuf1, TTYSIZ, 0, TTYSIZ/2 },
{ tbuf2, tbuf2, tbuf2, TTYSIZ, 0, TTYSIZ/2 },
#ifdef CONFIG_PROPIO2
{ tbufp, tbufp, tbufp, TTYSIZ, 0, TTYSIZ/2 },
#endif
};
/* TODO: stty support for the Z180 ports */
tcflag_t termios_mask[NUM_DEV_TTY + 1] = {
0,
_CSYS,
_CSYS,
#ifdef CONFIG_PROPIO2
_CSYS
#endif
};
void tty_setup(uint_fast8_t minor, uint_fast8_t flags)
{
minor;
}
/* For the moment */
int tty_carrier(uint_fast8_t minor)
{
minor;
return 1;
}
void tty_pollirq_asci0(void)
{
while(ASCI_STAT0 & 0x80)
tty_inproc(1, ASCI_RDR0);
}
void tty_pollirq_asci1(void)
{
while(ASCI_STAT1 & 0x80)
tty_inproc(2, ASCI_RDR1);
}
#ifdef CONFIG_PROPIO2
void tty_poll_propio2(void)
{
while(PROPIO2_STAT & 0x20)
tty_inproc(3, PROPIO2_TERM);
}
#endif
void tty_putc(uint_fast8_t minor, uint_fast8_t c)
{
switch(minor){
case 1:
while(!(ASCI_STAT0 & 2));
ASCI_TDR0 = c;
break;
case 2:
while(!(ASCI_STAT1 & 2));
ASCI_TDR1 = c;
break;
#ifdef CONFIG_PROPIO2
case 3:
while(!(PROPIO2_STAT & 0x10));
PROPIO2_TERM = c;
break;
#endif
}
}
void tty_sleeping(uint_fast8_t minor)
{
minor;
}
void tty_data_consumed(uint_fast8_t minor)
{
}
ttyready_t tty_writeready(uint_fast8_t minor)
{
minor;
return TTY_READY_NOW;
}
/* kernel writes to system console -- never sleep! */
void kputchar(uint_fast8_t c)
{
tty_putc(TTYDEV & 0xFF, c);
if(c == '\n')
tty_putc(TTYDEV & 0xFF, '\r');
}
|
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by SampleApp.rc
//
#define IDS_APP_TITLE 103
#define IDR_MAINFRAME 128
#define IDD_SAMPLEAPP_DIALOG 102
#define IDD_ABOUTBOX 103
#define IDM_ABOUT 104
#define IDM_EXIT 105
#define IDI_SAMPLEAPP 107
#define IDI_SMALL 108
#define IDC_SAMPLEAPP 109
#define IDC_MYICON 2
#ifndef IDC_STATIC
#define IDC_STATIC -1
#endif
#define IDM_OPENJCONF 32771
#define IDM_STARTPROCESS 32772
#define IDM_STOPPROCESS 32773
#define IDM_PAUSE 32774
#define IDM_RESUME 32775
// Vµ¢IuWFNgÌÌùèl
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC 130
#define _APS_NEXT_RESOURCE_VALUE 129
#define _APS_NEXT_COMMAND_VALUE 32776
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 110
#endif
#endif
|
/*****************************************************************************
*
* 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
*
* $Id: http.h 271 2005-08-09 08:31:35Z picard $
*
* The Core Pocket Media Player
* Copyright (c) 2004-2005 Gabor Kovacs
*
****************************************************************************/
#ifndef __HTTP_H
#define __HTTP_H
#define HTTP_ID FOURCC('H','T','T','P')
#define MMS_ID FOURCC('M','M','S','_')
void HTTP_Init();
void HTTP_Done();
#endif
|
/* port/ti/ti_ccm.c
*
* Copyright (C) 2006-2017 wolfSSL Inc.
*
* This file is part of wolfSSL.
*
* wolfSSL 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.
*
* wolfSSL 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-1335, USA
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <wolfssl/wolfcrypt/settings.h>
#if defined(WOLFSSL_TI_CRYPT) || defined(WOLFSSL_TI_HASH)
#include "wolfssl/wolfcrypt/port/ti/ti-ccm.h"
#include <stdbool.h>
#include <stdint.h>
#ifndef TI_DUMMY_BUILD
#include "driverlib/sysctl.h"
#include "driverlib/rom_map.h"
#include "driverlib/rom.h"
#ifndef SINGLE_THREADED
#include <wolfssl/wolfcrypt/wc_port.h>
static wolfSSL_Mutex TI_CCM_Mutex;
#endif
#endif /* TI_DUMMY_BUILD */
#define TIMEOUT 500000
#define WAIT(stat) { volatile int i; for(i=0; i<TIMEOUT; i++)if(stat)break; if(i==TIMEOUT)return(false); }
static bool ccm_init = false;
int wolfSSL_TI_CCMInit(void)
{
if (ccm_init)
return true;
ccm_init = true;
#ifndef TI_DUMMY_BUILD
SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
SYSCTL_OSC_MAIN |
SYSCTL_USE_PLL |
SYSCTL_CFG_VCO_480), 120000000);
if (!ROM_SysCtlPeripheralPresent(SYSCTL_PERIPH_CCM0))
return false;
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_CCM0);
WAIT(ROM_SysCtlPeripheralReady(SYSCTL_PERIPH_CCM0));
ROM_SysCtlPeripheralReset(SYSCTL_PERIPH_CCM0);
WAIT(ROM_SysCtlPeripheralReady(SYSCTL_PERIPH_CCM0));
#ifndef SINGLE_THREADED
if (wc_InitMutex(&TI_CCM_Mutex))
return false;
#endif
#endif /* !TI_DUMMY_BUILD */
return true;
}
#ifndef SINGLE_THREADED
void wolfSSL_TI_lockCCM(void)
{
#ifndef TI_DUMMY_BUILD
wc_LockMutex(&TI_CCM_Mutex);
#endif
}
void wolfSSL_TI_unlockCCM(void){
#ifndef TI_DUMMY_BUILD
wc_UnLockMutex(&TI_CCM_Mutex);
#endif
}
#endif /* !SINGLE_THREADED */
#endif /* WOLFSSL_TI_CRYPT || WOLFSSL_TI_HASH */
|
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/netdevice.h>
#include <linux/netlink.h>
#include <net/net_namespace.h>
#include <linux/if_arp.h>
#include <net/rtnetlink.h>
struct pcpu_lstats {
u64 packets;
u64 bytes;
struct u64_stats_sync syncp;
};
static netdev_tx_t nlmon_xmit(struct sk_buff *skb, struct net_device *dev)
{
int len = skb->len;
struct pcpu_lstats *stats = this_cpu_ptr(dev->lstats);
u64_stats_update_begin(&stats->syncp);
stats->bytes += len;
stats->packets++;
u64_stats_update_end(&stats->syncp);
dev_kfree_skb(skb);
return NETDEV_TX_OK;
}
static int nlmon_is_valid_mtu(int new_mtu)
{
/* Note that in netlink we do not really have an upper limit. On
* default, we use NLMSG_GOODSIZE. Here at least we should make
* sure that it's at least the header size.
*/
return new_mtu >= (int) sizeof(struct nlmsghdr);
}
static int nlmon_change_mtu(struct net_device *dev, int new_mtu)
{
if (!nlmon_is_valid_mtu(new_mtu))
return -EINVAL;
dev->mtu = new_mtu;
return 0;
}
static int nlmon_dev_init(struct net_device *dev)
{
dev->lstats = netdev_alloc_pcpu_stats(struct pcpu_lstats);
return dev->lstats == NULL ? -ENOMEM : 0;
}
static void nlmon_dev_uninit(struct net_device *dev)
{
free_percpu(dev->lstats);
}
struct nlmon {
struct netlink_tap nt;
};
static int nlmon_open(struct net_device *dev)
{
struct nlmon *nlmon = netdev_priv(dev);
nlmon->nt.dev = dev;
nlmon->nt.module = THIS_MODULE;
return netlink_add_tap(&nlmon->nt);
}
static int nlmon_close(struct net_device *dev)
{
struct nlmon *nlmon = netdev_priv(dev);
return netlink_remove_tap(&nlmon->nt);
}
static struct rtnl_link_stats64 *
nlmon_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
{
int i;
u64 bytes = 0, packets = 0;
for_each_possible_cpu(i) {
const struct pcpu_lstats *nl_stats;
u64 tbytes, tpackets;
unsigned int start;
nl_stats = per_cpu_ptr(dev->lstats, i);
do {
start = u64_stats_fetch_begin_irq(&nl_stats->syncp);
tbytes = nl_stats->bytes;
tpackets = nl_stats->packets;
} while (u64_stats_fetch_retry_irq(&nl_stats->syncp, start));
packets += tpackets;
bytes += tbytes;
}
stats->rx_packets = packets;
stats->tx_packets = 0;
stats->rx_bytes = bytes;
stats->tx_bytes = 0;
return stats;
}
static u32 always_on(struct net_device *dev)
{
return 1;
}
static const struct ethtool_ops nlmon_ethtool_ops = {
.get_link = always_on,
};
static const struct net_device_ops nlmon_ops = {
.ndo_init = nlmon_dev_init,
.ndo_uninit = nlmon_dev_uninit,
.ndo_open = nlmon_open,
.ndo_stop = nlmon_close,
.ndo_start_xmit = nlmon_xmit,
.ndo_get_stats64 = nlmon_get_stats64,
.ndo_change_mtu = nlmon_change_mtu,
};
static void nlmon_setup(struct net_device *dev)
{
dev->type = ARPHRD_NETLINK;
dev->tx_queue_len = 0;
dev->netdev_ops = &nlmon_ops;
dev->ethtool_ops = &nlmon_ethtool_ops;
dev->destructor = free_netdev;
dev->features = NETIF_F_SG | NETIF_F_FRAGLIST |
NETIF_F_HIGHDMA | NETIF_F_LLTX;
dev->flags = IFF_NOARP;
/* That's rather a softlimit here, which, of course,
* can be altered. Not a real MTU, but what is to be
* expected in most cases.
*/
dev->mtu = NLMSG_GOODSIZE;
}
static int nlmon_validate(struct nlattr *tb[], struct nlattr *data[])
{
if (tb[IFLA_ADDRESS])
return -EINVAL;
return 0;
}
static struct rtnl_link_ops nlmon_link_ops = {
.kind = "nlmon",
.priv_size = sizeof(struct nlmon),
.setup = nlmon_setup,
.validate = nlmon_validate,
};
static __init int nlmon_register(void)
{
return rtnl_link_register(&nlmon_link_ops);
}
static __exit void nlmon_unregister(void)
{
rtnl_link_unregister(&nlmon_link_ops);
}
module_init(nlmon_register);
module_exit(nlmon_unregister);
MODULE_LICENSE("GPL v2");
MODULE_AUTHOR("Daniel Borkmann <dborkman@redhat.com>");
MODULE_AUTHOR("Mathieu Geli <geli@enseirb.fr>");
MODULE_DESCRIPTION("Netlink monitoring device");
MODULE_ALIAS_RTNL_LINK("nlmon");
|
/*-------------------------------------------------------------------------|
| _________ |
| \_ ___ \_______ ____ ____ __ __ ______ |
| / \ \/\_ __ \/ \ / \| | \/ ___/ |
| \ \____| | \( ( ) ) | \ | /\___ \ |
| \______ /|__| \____/|___| /____//____ > |
| \/ \/ \/ |
|--------------------------------------------------------------------------|
| Copyright (C) <2014> <Cronus - Emulator> |
| |
| Copyright Portions to eAthena, jAthena and Hercules Project |
| |
| This program is free software: you can redistribute it and/or modify |
| it under the terms of the GNU General Public License as published by |
| the Free Software Foundation, either version 3 of the License, or |
| (at your option) any later version. |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of the GNU General Public License |
| along with this program. If not, see <http://www.gnu.org/licenses/>. |
| |
|----- Descrição: ---------------------------------------------------------|
| |
|--------------------------------------------------------------------------|
| |
|----- ToDo: --------------------------------------------------------------|
| |
|-------------------------------------------------------------------------*/
#ifndef COMMON_MD5CALC_H
#define COMMON_MD5CALC_H
void MD5_String(const char * string, char * output);
void MD5_Binary(const char * string, unsigned char * output);
void MD5_Salt(unsigned int len, char * output);
#endif /* COMMON_MD5CALC_H */
|
//---------------------------------------------------------------------------
#ifndef Unit7H
#define Unit7H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
//---------------------------------------------------------------------------
class TfrMove : public TFrame
{
__published: // IDE-managed Components
TLabel *Label1;
TEdit *Edit1;
TButton *Button1;
TButton *Button2;
private: // User declarations
public: // User declarations
__fastcall TfrMove(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TfrMove *frMove;
//---------------------------------------------------------------------------
#endif
|
/*
Copyright 2011 David Malcolm <dmalcolm@redhat.com>
Copyright 2011 Red Hat, Inc.
This is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see
<http://www.gnu.org/licenses/>.
*/
#include <Python.h>
/*
Test of compiling a function that's been incorrectly marked as stealing
a reference, when it does not.
*/
#if defined(WITH_CPYCHECKER_STEALS_REFERENCE_TO_ARG_ATTRIBUTE)
#define CPYCHECKER_STEALS_REFERENCE_TO_ARG(n) \
__attribute__((cpychecker_steals_reference_to_arg(n)))
#else
#define CPYCHECKER_STEALS_REFERENCE_TO_ARG(n)
#error (This should have been defined)
#endif
extern PyObject *test(PyObject *foo, PyObject *bar)
CPYCHECKER_STEALS_REFERENCE_TO_ARG(1)
CPYCHECKER_STEALS_REFERENCE_TO_ARG(2);
PyObject *
test(PyObject *foo, PyObject *bar)
{
/*
This code doesn't steals references to its arguments; the marking is
incorrect, and this should be flagged by the checker.
*/
Py_RETURN_NONE;
}
/*
PEP-7
Local variables:
c-basic-offset: 4
indent-tabs-mode: nil
End:
*/
|
/*
* Copyright (C) 2011 Nicolas Bonnefon and other contributors
*
* This file is part of glogg.
*
* glogg is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* glogg 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 glogg. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PERSISTENTINFO_H
#define PERSISTENTINFO_H
#include <memory>
#include <QSettings>
#include <QHash>
class Persistable;
// Singleton class managing the saving of persistent data to permanent storage
// Clients must implement Persistable and register with this object, they can
// then be saved/loaded.
class PersistentInfo {
public:
// Initialise the storage backend for the Persistable, migrating the settings
// if needed. Must be called before any other function.
void migrateAndInit();
// Register a Persistable
void registerPersistable( std::shared_ptr<Persistable> object,
const QString& name );
// Get a Persistable (or NULL if it doesn't exist)
std::shared_ptr<Persistable> getPersistable( const QString& name );
// Save a persistable to its permanent storage
void save( const QString& name );
// Retrieve a persistable from permanent storage
void retrieve( const QString& name );
private:
// Can't be constructed or copied (singleton)
PersistentInfo();
PersistentInfo( const PersistentInfo& );
~PersistentInfo();
// Has migrateAndInit() been called?
bool initialised_;
// List of persistables
QHash<QString, std::shared_ptr<Persistable>> objectList_;
// Qt setting object
QSettings* settings_;
// allow this function to create one instance
friend PersistentInfo& GetPersistentInfo();
};
PersistentInfo& GetPersistentInfo();
// Global function used to get a reference to an object
// from the PersistentInfo store
template<typename T>
std::shared_ptr<T> Persistent( const char* name )
{
std::shared_ptr<Persistable> p =
GetPersistentInfo().getPersistable( QString( name ) );
return std::dynamic_pointer_cast<T>(p);
}
template<typename T>
std::shared_ptr<T> PersistentCopy( const char* name )
{
std::shared_ptr<Persistable> p =
GetPersistentInfo().getPersistable( QString( name ) );
return std::make_shared<T>( *( std::dynamic_pointer_cast<T>(p) ) );
}
#endif
|
/***************************************************************
* Name: ThreadSearchConfPanel
* Purpose: This class implements the configuration panel used
* in modal dialog called on "Options" button click
* and by C::B on "Environment" settings window.
* Author: Jerome ANTOINE
* Created: 2007-10-08
* Copyright: Jerome ANTOINE
* License: GPL
**************************************************************/
#ifndef THREAD_SEARCH_CONF_PANEL_H
#define THREAD_SEARCH_CONF_PANEL_H
// begin wxGlade: ::dependencies
// end wxGlade
// begin wxGlade: ::extracode
// end wxGlade
#include <wx/string.h>
#include "configurationpanel.h"
class wxWindow;
class wxRadioBox;
class wxCheckBox;
class wxStaticBox;
class wxCommandEvent;
class ThreadSearch;
class SearchInPanel;
class DirectoryParamsPanel;
class ThreadSearchConfPanel: public cbConfigurationPanel {
public:
// begin wxGlade: ThreadSearchConfPanel::ids
// end wxGlade
/** Constructor. */
ThreadSearchConfPanel(ThreadSearch& threadSearchPlugin, wxWindow* parent = NULL, wxWindowID id = -1);
/** Returns the title displayed in the left column of the "Settings/Environment" dialog. */
wxString GetTitle() const {return _("Thread search");}
/** Returns string used to build active/inactive images path in the left column
* of the "Settings/Environment" dialog.
*/
wxString GetBitmapBaseName() const {return wxT("ThreadSearch");}
/** Called automatically when user clicks on OK
*/
void OnApply();
/** Called automatically when user clicks on Cancel
*/
void OnCancel() {}
private:
// begin wxGlade: ThreadSearchConfPanel::methods
void set_properties();
void do_layout();
// end wxGlade
ThreadSearch& m_ThreadSearchPlugin; // Reference on the ThreadSearch plugin we configure
protected:
// begin wxGlade: ThreadSearchConfPanel::attributes
wxStaticBox* SizerThreadSearchLayout_staticbox;
wxStaticBox* SizerListControlOptions_staticbox;
wxStaticBox* SizerThreadSearchLayoutGlobal_staticbox;
wxStaticBox* SizerThreadSearchOptions_staticbox;
wxStaticBox* SizerSearchIn_staticbox;
SearchInPanel* m_pPnlSearchIn;
DirectoryParamsPanel* m_pPnlDirParams;
wxCheckBox* m_pChkWholeWord;
wxCheckBox* m_pChkStartWord;
wxCheckBox* m_pChkMatchCase;
wxCheckBox* m_pChkRegExp;
wxCheckBox* m_pChkThreadSearchEnable;
wxCheckBox* m_pChkUseDefaultOptionsForThreadSearch;
wxCheckBox* m_pChkShowMissingFilesError;
wxCheckBox* m_pChkShowCantOpenFileError;
wxCheckBox* m_pChkDeletePreviousResults;
wxCheckBox* m_pChkShowThreadSearchToolBar;
wxCheckBox* m_pChkShowThreadSearchWidgets;
wxCheckBox* m_pChkShowCodePreview;
wxCheckBox* m_pChkDisplayLogHeaders;
wxCheckBox* m_pChkDrawLogLines;
wxRadioBox* m_pRadPanelManagement;
wxRadioBox* m_pRadLoggerType;
wxRadioBox* m_pRadSplitterWndMode;
wxRadioBox* m_pRadSortBy;
// end wxGlade
DECLARE_EVENT_TABLE();
public:
/** The m_pChkThreadSearchEnable checkbox is used to enable/disable 'Find occurrences'
* contextual menu integration.
* This method disables the m_pChkUseDefaultOptionsForThreadSearch checkbox if
* 'Find occurrences' is not present in the contextual menu.
*/
void OnThreadSearchEnable(wxCommandEvent &event); // wxGlade: <event_handler>
void OnChkShowThreadSearchToolBarClick(wxCommandEvent &event); // wxGlade: <event_handler>
void OnChkCodePreview(wxCommandEvent &event); // wxGlade: <event_handler>
void OnChkShowThreadSearchWidgetsClick(wxCommandEvent &event); // wxGlade: <event_handler>
void OnChkShowMissingFilesErrorClick(wxCommandEvent &event); // wxGlade: <event_handler>
void OnChkShowCantOpenFileErrorClick(wxCommandEvent &event); // wxGlade: <event_handler>
}; // wxGlade: end class
#endif // THREAD_SEARCH_CONF_PANEL_H
|
/*
* Copyright 2010-2012 Fabric Engine Inc. All rights reserved.
*/
#ifndef _FABRIC_IO_MANAGER_H
#define _FABRIC_IO_MANAGER_H
#include <Fabric/Base/RC/Object.h>
#include <Fabric/Base/RC/ConstHandle.h>
#include <Fabric/Base/JSON/Decoder.h>
#include <map>
#include <vector>
namespace Fabric
{
namespace Util
{
class JSONGenerator;
class JSONArrayGenerator;
};
namespace JSON
{
class ArrayEncoder;
class Encoder;
};
namespace IO
{
class ResourceManager;
class FileHandleManager;
typedef void (*ScheduleAsyncCallbackFunc)( void* scheduleUserData, void (*callbackFunc)(void *), void *callbackFuncUserData );
class Manager : public RC::Object
{
public:
REPORT_RC_LEAKS
RC::Handle<ResourceManager> getResourceManager() const;
RC::Handle<FileHandleManager> getFileHandleManager() const;
virtual void jsonRoute( std::vector<JSON::Entity> const &dst, size_t dstOffset, JSON::Entity const &cmd, JSON::Entity const &arg, JSON::ArrayEncoder &resultArrayEncoder );
virtual void jsonExec( JSON::Entity const &cmd, JSON::Entity const &arg, JSON::ArrayEncoder &resultArrayEncoder );
protected:
Manager( RC::Handle<FileHandleManager> fileHandleManager, ScheduleAsyncCallbackFunc scheduleFunc, void *scheduleFuncUserData );
virtual std::string queryUserFilePath(
bool existingFile,
std::string const &title,
std::string const &defaultFilename,
std::string const &extension
) const = 0;
private:
void jsonQueryUserFile( JSON::Entity const &arg, bool *existingFile, const char *defaultExtension, std::string& fullPath, bool& writeAccess, bool queryFolder ) const;
void jsonExecGetFileInfo( JSON::Entity const &arg, JSON::ArrayEncoder &resultArrayEncoder ) const;
void jsonExecQueryUserFileAndFolder( JSON::Entity const &arg, JSON::ArrayEncoder &resultArrayEncoder ) const;
void jsonExecQueryUserFile( JSON::Entity const &arg, JSON::ArrayEncoder &resultArrayEncoder ) const;
void jsonExecCreateFileHandleFromRelativePath( JSON::Entity const &arg, JSON::ArrayEncoder &resultArrayEncoder ) const;
void jsonExecCreateFolderHandleFromRelativePath( JSON::Entity const &arg, JSON::ArrayEncoder &resultArrayEncoder ) const;
void jsonExecPutTextFileContent( JSON::Entity const &arg, JSON::ArrayEncoder &resultArrayEncoder ) const;
void jsonExecGetTextFileContent( JSON::Entity const &arg, JSON::ArrayEncoder &resultArrayEncoder ) const;
RC::Handle<ResourceManager> m_resourceManager;
RC::Handle<FileHandleManager> m_fileHandleManager;
};
};
};
#endif //_FABRIC_IO_MANAGER_H
|
/****************************************************************/
/* MOOSE - Multiphysics Object Oriented Simulation Environment */
/* */
/* All contents are licensed under LGPL V2.1 */
/* See LICENSE for full restrictions */
/****************************************************************/
#ifndef EQUALGRADIENTLAGRANGEINTERFACE_H
#define EQUALGRADIENTLAGRANGEINTERFACE_H
#include "InterfaceKernel.h"
class EqualGradientLagrangeInterface;
template<>
InputParameters validParams<EqualGradientLagrangeInterface>();
/**
* InterfaceKernel to enforce a Lagrange-Multiplier based componentwise
* continuity of a variable gradient.
*/
class EqualGradientLagrangeInterface : public InterfaceKernel
{
public:
EqualGradientLagrangeInterface(const InputParameters & parameters);
protected:
virtual Real computeQpResidual(Moose::DGResidualType type) override;
virtual Real computeQpJacobian(Moose::DGJacobianType type) override;
virtual Real computeQpOffDiagJacobian(Moose::DGJacobianType type, unsigned int jvar) override;
const unsigned int _component;
/// Lagrange multiplier
const VariableValue & _lambda;
const unsigned int _lambda_jvar;
};
#endif // EQUALGRADIENTLAGRANGEINTERFACE_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:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS 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 APPLE OR ITS 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 IDBFactoryBackendInterface_h
#define IDBFactoryBackendInterface_h
#include <wtf/PassRefPtr.h>
#include <wtf/Threading.h>
#include <wtf/text/WTFString.h>
#if ENABLE(INDEXED_DATABASE)
namespace WebCore {
class IDBCallbacks;
class IDBDatabase;
class IDBDatabaseCallbacks;
class SecurityOrigin;
class ScriptExecutionContext;
typedef int ExceptionCode;
// This class is shared by IDBFactory (async) and IDBFactorySync (sync).
// This is implemented by IDBFactoryBackendImpl and optionally others (in order to proxy
// calls across process barriers). All calls to these classes should be non-blocking and
// trigger work on a background thread if necessary.
class IDBFactoryBackendInterface : public ThreadSafeRefCounted<IDBFactoryBackendInterface> {
public:
static PassRefPtr<IDBFactoryBackendInterface> create();
virtual ~IDBFactoryBackendInterface() { }
virtual void getDatabaseNames(PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, ScriptExecutionContext*, const String& dataDir) = 0;
virtual void open(const String& name, int64_t version, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBDatabaseCallbacks>, PassRefPtr<SecurityOrigin>, ScriptExecutionContext*, const String& dataDir) = 0;
virtual void deleteDatabase(const String& name, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, ScriptExecutionContext*, const String& dataDir) = 0;
};
} // namespace WebCore
#endif
#endif // IDBFactoryBackendInterface_h
|
#include "gsl_math.h"
#include "gsl_cblas.h"
#include "gsl_cblas__cblas.h"
void
cblas_sgemv (const enum CBLAS_ORDER order, const enum CBLAS_TRANSPOSE TransA,
const int M, const int N, const float alpha, const float *A,
const int lda, const float *X, const int incX, const float beta,
float *Y, const int incY)
{
#define BASE float
#include "gsl_cblas__source_gemv_r.h"
#undef BASE
}
|
/* This is free and unencumbered software released into the public domain. */
#ifndef _ERRNO_H
#define _ERRNO_H
/**
* @file
*
* <errno.h> - Errors.
*
* @see http://libc11.org/errno/
*/
#ifdef __cplusplus
extern "C" {
#endif
#define EDOM 1
#define EILSEQ 2
#define ERANGE 3
extern int errno;
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* _ERRNO_H */
|
void __yotta_dummy_lib_symbol_mbed_hal_nordic(){}
|
/*
* Author: Landon Fuller <landonf@plausible.coop>
*
* Copyright (c) 2012-2013 Plausible Labs Cooperative, Inc.
* 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.
*/
/*
* For external library integrators:
*
* Set this value to any valid C symbol prefix. This will automatically
* prepend the given prefix to all external symbols in the library.
*
* This may be used to avoid symbol conflicts between multiple libraries
* that may both incorporate PLCrashReporter.
*/
// #define PLCRASHREPORTER_PREFIX AcmeCo
#define PLCRASHREPORTER_PREFIX Apigee
#ifdef PLCRASHREPORTER_PREFIX
// We need two extra layers of indirection to make CPP substitute
// the PLCRASHREPORTER_PREFIX define.
#define PLNS_impl2(prefix, symbol) prefix ## symbol
#define PLNS_impl(prefix, symbol) PLNS_impl2(prefix, symbol)
#define PLNS(symbol) PLNS_impl(PLCRASHREPORTER_PREFIX, symbol)
#define PLCrashMachExceptionServer PLNS(PLCrashMachExceptionServer)
#define PLCrashReport PLNS(PLCrashReport)
#define PLCrashReportApplicationInfo PLNS(PLCrashReportApplicationInfo)
#define PLCrashReportBinaryImageInfo PLNS(PLCrashReportBinaryImageInfo)
#define PLCrashReportExceptionInfo PLNS(PLCrashReportExceptionInfo)
#define PLCrashReportMachineInfo PLNS(PLCrashReportMachineInfo)
#define PLCrashReportProcessInfo PLNS(PLCrashReportProcessInfo)
#define PLCrashReportProcessorInfo PLNS(PLCrashReportProcessorInfo)
#define PLCrashReportRegisterInfo PLNS(PLCrashReportRegisterInfo)
#define PLCrashReportSignalInfo PLNS(PLCrashReportSignalInfo)
#define PLCrashReportStackFrameInfo PLNS(PLCrashReportStackFrameInfo)
#define PLCrashReportSymbolInfo PLNS(PLCrashReportSymbolInfo)
#define PLCrashReportSystemInfo PLNS(PLCrashReportSystemInfo)
#define PLCrashReportTextFormatter PLNS(PLCrashReportTextFormatter)
#define PLCrashReportThreadInfo PLNS(PLCrashReportThreadInfo)
#define PLCrashReporter PLNS(PLCrashReporter)
#define PLCrashSignalHandler PLNS(PLCrashSignalHandler)
#define PLCrashReportHostArchitecture PLNS(PLCrashReportHostArchitecture)
#define PLCrashReportHostOperatingSystem PLNS(PLCrashReportHostOperatingSystem)
#define PLCrashReporterErrorDomain PLNS(PLCrashReporterErrorDomain)
#define PLCrashReporterException PLNS(PLCrashReporterException)
#define PLCrashHostInfo PLNS(PLCrashHostInfo)
#define PLCrashMachExceptionPort PLNS(PLCrashMachExceptionPort)
#define PLCrashMachExceptionPortSet PLNS(PLCrashMachExceptionPortSet)
#define PLCrashProcessInfo PLNS(PLCrashProcessInfo)
#define PLCrashReporterConfig PLNS(PLCrashReporterConfig)
#define PLCrashUncaughtExceptionHandler PLNS(PLCrashUncaughtExceptionHandler)
#define PLCrashMachExceptionForward PLNS(PLCrashMachExceptionForward)
#define PLCrashSignalHandlerForward PLNS(PLCrashSignalHandlerForward)
#define plcrash_signal_handler PLNS(plcrash_signal_handler)
#endif
|
/*
* Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef MODULES_AUDIO_CODING_NETEQ_DECISION_LOGIC_NORMAL_H_
#define MODULES_AUDIO_CODING_NETEQ_DECISION_LOGIC_NORMAL_H_
#include "modules/audio_coding/neteq/decision_logic.h"
#include "rtc_base/constructormagic.h"
#include "typedefs.h" // NOLINT(build/include)
namespace webrtc {
// Implementation of the DecisionLogic class for playout modes kPlayoutOn and
// kPlayoutStreaming.
class DecisionLogicNormal : public DecisionLogic {
public:
// Constructor.
DecisionLogicNormal(int fs_hz,
size_t output_size_samples,
NetEqPlayoutMode playout_mode,
DecoderDatabase* decoder_database,
const PacketBuffer& packet_buffer,
DelayManager* delay_manager,
BufferLevelFilter* buffer_level_filter,
const TickTimer* tick_timer)
: DecisionLogic(fs_hz,
output_size_samples,
playout_mode,
decoder_database,
packet_buffer,
delay_manager,
buffer_level_filter,
tick_timer) {}
protected:
static const int kReinitAfterExpands = 100;
static const int kMaxWaitForPacket = 10;
Operations GetDecisionSpecialized(const SyncBuffer& sync_buffer,
const Expand& expand,
size_t decoder_frame_length,
const Packet* next_packet,
Modes prev_mode,
bool play_dtmf,
bool* reset_decoder,
size_t generated_noise_samples) override;
// Returns the operation to do given that the expected packet is not
// available, but a packet further into the future is at hand.
virtual Operations FuturePacketAvailable(
const SyncBuffer& sync_buffer,
const Expand& expand,
size_t decoder_frame_length,
Modes prev_mode,
uint32_t target_timestamp,
uint32_t available_timestamp,
bool play_dtmf,
size_t generated_noise_samples);
// Returns the operation to do given that the expected packet is available.
virtual Operations ExpectedPacketAvailable(Modes prev_mode, bool play_dtmf);
// Returns the operation given that no packets are available (except maybe
// a DTMF event, flagged by setting |play_dtmf| true).
virtual Operations NoPacket(bool play_dtmf);
private:
// Returns the operation given that the next available packet is a comfort
// noise payload (RFC 3389 only, not codec-internal).
Operations CngOperation(Modes prev_mode,
uint32_t target_timestamp,
uint32_t available_timestamp,
size_t generated_noise_samples);
// Checks if enough time has elapsed since the last successful timescale
// operation was done (i.e., accelerate or preemptive expand).
bool TimescaleAllowed() const {
return !timescale_countdown_ || timescale_countdown_->Finished();
}
// Checks if the current (filtered) buffer level is under the target level.
bool UnderTargetLevel() const;
// Checks if |timestamp_leap| is so long into the future that a reset due
// to exceeding kReinitAfterExpands will be done.
bool ReinitAfterExpands(uint32_t timestamp_leap) const;
// Checks if we still have not done enough expands to cover the distance from
// the last decoded packet to the next available packet, the distance beeing
// conveyed in |timestamp_leap|.
bool PacketTooEarly(uint32_t timestamp_leap) const;
// Checks if num_consecutive_expands_ >= kMaxWaitForPacket.
bool MaxWaitForPacket() const;
RTC_DISALLOW_COPY_AND_ASSIGN(DecisionLogicNormal);
};
} // namespace webrtc
#endif // MODULES_AUDIO_CODING_NETEQ_DECISION_LOGIC_NORMAL_H_
|
/* pcfutil.h
FreeType font driver for pcf fonts
Copyright 2000, 2001, 2004 by
Francesco Zappa Nardelli
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 __PCFUTIL_H__
#define __PCFUTIL_H__
#include <ft2build.h>
#include FT_CONFIG_CONFIG_H
FT_BEGIN_HEADER
FT_LOCAL( void )
BitOrderInvert( unsigned char* buf,
int nbytes );
FT_LOCAL( void )
TwoByteSwap( unsigned char* buf,
int nbytes );
FT_LOCAL( void )
FourByteSwap( unsigned char* buf,
int nbytes );
FT_END_HEADER
#endif /* __PCFUTIL_H__ */
/* END */
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* Monkey HTTP Server
* ==================
* Copyright 2001-2017 Eduardo Silva <eduardo@monkey.io>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* dir_html.c */
#ifndef MK_DIRHTML_H
#define MK_DIRHTML_H
#include <dirent.h>
#include <limits.h>
#define MK_DIRHTML_URL "/_mktheme"
#define MK_DIRHTML_DEFAULT_MIME "Content-Type: text/html\r\n"
/* For every directory requested, don't send more than
* this limit of entries.
*/
#define MK_DIRHTML_BUFFER_LIMIT 30
#define MK_DIRHTML_BUFFER_GROW 5
#define MK_HEADER_CHUNKED "Transfer-Encoding: Chunked\r\n\r\n"
#define MK_DIRHTML_FMOD_LEN 24
/* Theme files */
#define MK_DIRHTML_FILE_HEADER "header.theme"
#define MK_DIRHTML_FILE_ENTRY "entry.theme"
#define MK_DIRHTML_FILE_FOOTER "footer.theme"
#define MK_DIRHTML_TAG_INIT "%_"
#define MK_DIRHTML_TAG_END "_%"
#define MK_DIRHTML_SIZE_DIR "-"
/* Stream state */
#define MK_DIRHTML_STATE_HTTP_HEADER 0
#define MK_DIRHTML_STATE_TPL_HEADER 1
#define MK_DIRHTML_STATE_BODY 2
#define MK_DIRHTML_STATE_FOOTER 3
char *_tags_global[] = { "%_html_title_%",
"%_theme_path_%",
NULL
};
char *_tags_entry[] = { "%_target_title_%",
"%_target_url_%",
"%_target_name_%",
"%_target_time_%",
"%_target_size_%",
NULL
};
struct plugin_api *mk_api;
struct mk_f_list
{
char ft_modif[MK_DIRHTML_FMOD_LEN];
struct file_info info;
char name[NAME_MAX + 1]; /* The name can be up to NAME_MAX long; include NULL. */
char size[16];
unsigned char type;
struct mk_list _head;
};
/* Main configuration of dirhtml module */
struct dirhtml_config
{
char *theme;
char *theme_path;
};
/* Represent a request context */
struct mk_dirhtml_request
{
/* State */
int state;
int chunked;
/* Target directory */
DIR *dir;
/* Table of Content */
unsigned int toc_idx;
unsigned long toc_len;
struct mk_f_list **toc;
struct mk_list *file_list;
/* Stream handler */
struct mk_stream *stream;
/* Reference IOV stuff */
struct mk_iov *iov_header;
struct mk_iov *iov_entry;
struct mk_iov *iov_footer;
/* Session data */
struct mk_http_session *cs;
struct mk_http_request *sr;
};
extern const mk_ptr_t mk_dirhtml_default_mime;
extern const mk_ptr_t mk_iov_dash;
/* Global config */
struct dirhtml_config *dirhtml_conf;
/* Used to keep splitted content of every template */
struct dirhtml_template
{
char *buf;
int tag_id;
int len;
struct dirhtml_template *next;
char **tags; /* array of theme tags: [%_xaa__%, %_xyz_%] */
};
/* Templates for header, entries and footer */
struct dirhtml_template *mk_dirhtml_tpl_header;
struct dirhtml_template *mk_dirhtml_tpl_entry;
struct dirhtml_template *mk_dirhtml_tpl_footer;
struct dirhtml_value
{
int tag_id;
mk_ptr_t sep; /* separator code after value */
/* string data */
int len;
char *value;
/* next node */
struct mk_list _head;
char **tags; /* array of tags which values correspond */
};
struct dirhtml_value *mk_dirhtml_value_global;
/* Configuration struct */
struct mk_config *conf;
char *check_string(char *str);
char *read_header_footer_file(char *file_path);
int mk_dirhtml_conf();
char *mk_dirhtml_load_file(char *filename);
struct dirhtml_template *mk_dirhtml_template_create(char *content);
struct dirhtml_template
*mk_dirhtml_template_list_add(struct dirhtml_template **header,
char *buf, int len, char **tpl, int tag);
int mk_dirhtml_read_config(char *path);
int mk_dirhtml_theme_load();
int mk_dirhtml_theme_debug(struct dirhtml_template **st_tpl);
struct dirhtml_value *mk_dirhtml_tag_assign(struct mk_list *list,
int tag_id, mk_ptr_t sep,
char *value, char **tags);
struct f_list *get_dir_content(struct mk_http_request *sr, char *path);
#endif
|
/*=========================================================================
Library: CTK
Copyright (c) Kitware Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0.txt
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=========================================================================*/
#ifndef __ctkScriptingPythonWidgetsPlugins_h
#define __ctkScriptingPythonWidgetsPlugins_h
// Qt includes
#include <QtGlobal>
#ifndef HAVE_QT5
#include <QDesignerCustomWidgetCollectionInterface>
#else
#include <QtUiPlugin/QDesignerCustomWidgetCollectionInterface>
#endif
// CTK includes
#include "ctkScriptingPythonWidgetsPluginsExport.h"
#include "ctkPythonConsolePlugin.h"
/// \class Group the plugins in one library
class CTK_SCRIPTING_PYTHON_WIDGETS_PLUGINS_EXPORT ctkScriptingPythonWidgetsPlugins
: public QObject
, public QDesignerCustomWidgetCollectionInterface
{
Q_OBJECT
#ifdef HAVE_QT5
Q_PLUGIN_METADATA(IID "org.commontk.Python")
#endif
Q_INTERFACES(QDesignerCustomWidgetCollectionInterface);
public:
QList<QDesignerCustomWidgetInterface*> customWidgets() const
{
QList<QDesignerCustomWidgetInterface *> plugins;
plugins << new ctkPythonConsolePlugin;
return plugins;
}
};
#endif
|
/*
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#pragma once
#include <aws/devicefarm/DeviceFarm_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
namespace Aws
{
namespace DeviceFarm
{
namespace Model
{
enum class OfferingType
{
NOT_SET,
RECURRING
};
namespace OfferingTypeMapper
{
AWS_DEVICEFARM_API OfferingType GetOfferingTypeForName(const Aws::String& name);
AWS_DEVICEFARM_API Aws::String GetNameForOfferingType(OfferingType value);
} // namespace OfferingTypeMapper
} // namespace Model
} // namespace DeviceFarm
} // namespace Aws
|
//
// New Relic for Mobile -- iOS edition
//
// See:
// https://docs.newrelic.com/docs/mobile-apps for information
// https://docs.newrelic.com/docs/releases/ios for release notes
//
// Copyright (c) 2013 New Relic. All rights reserved.
// See https://docs.newrelic.com/docs/licenses/ios-agent-licenses for license details
//
#import <Foundation/Foundation.h>
#import "NRConstants.h"
@interface NRCustomMetrics : NSObject
/* Here's the Style:
* Metric format: /Custom/{$category}/{$name}[{$valueUnit}|{$countUnit}]
*/
//set the metric name and it's category
+ (void) recordMetricWithName:(NSString *)name
category:(NSString *)category;
//add a value to be recorded
+ (void) recordMetricWithName:(NSString *)name
category:(NSString *)category
value:(NSNumber *)value;
// adds a unit for the value
/*
* while there are a few pre-defined units please feel free to add your own by
* typecasting an NSString.
*
* The unit names may be mixed case and may consist strictly of alphabetical
* characters as well as the _, % and / symbols.Case is preserved.
* Recommendation: Use uncapitalized words, spelled out in full.
* For example, use second not Sec.
*/
+ (void) recordMetricWithName:(NSString *)name
category:(NSString *)category
value:(NSNumber *)value
valueUnits:(NRMetricUnit*)valueUnits;
//adds count units default is just "sample"
// The count is the number of times the particular metric is recorded
// so the countUnits could be considered the units of the metric itself.
+ (void) recordMetricWithName:(NSString *)name
category:(NSString *)category
value:(NSNumber *)value
valueUnits:(NRMetricUnit *)valueUnits
countUnits:(NRMetricUnit *)countUnits;
@end
|
// Scintilla source code edit control
// Encoding: UTF-8
/** @file CaseConvert.h
** Performs Unicode case conversions.
** Does not handle locale-sensitive case conversion.
**/
// Copyright 2013 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef CASECONVERT_H
#define CASECONVERT_H
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
enum CaseConversion {
CaseConversionFold,
CaseConversionUpper,
CaseConversionLower
};
class ICaseConverter {
public:
virtual ~ICaseConverter() = default;
virtual size_t CaseConvertString(char *converted, size_t sizeConverted, const char *mixed, size_t lenMixed) = 0;
};
ICaseConverter *ConverterFor(enum CaseConversion conversion);
// Returns a UTF-8 string. Empty when no conversion
const char *CaseConvert(int character, enum CaseConversion conversion);
// When performing CaseConvertString, the converted value may be up to 3 times longer than the input.
// Ligatures are often decomposed into multiple characters and long cases include:
// ΐ "\xce\x90" folds to ΐ "\xce\xb9\xcc\x88\xcc\x81"
const int maxExpansionCaseConversion=3;
// Converts a mixed case string using a particular conversion.
// Result may be a different length to input and the length is the return value.
// If there is not enough space then 0 is returned.
size_t CaseConvertString(char *converted, size_t sizeConverted, const char *mixed, size_t lenMixed, enum CaseConversion conversion);
// Converts a mixed case string using a particular conversion.
std::string CaseConvertString(const std::string &s, enum CaseConversion conversion);
#ifdef SCI_NAMESPACE
}
#endif
#endif
|
/*
* Copyright (c) 2003-2015 Rony Shapiro <ronys@users.sourceforge.net>.
* All rights reserved. Use of the code is allowed under the
* Artistic License 2.0 terms, as specified in the LICENSE file
* distributed with this code, or available from
* http://www.opensource.org/licenses/artistic-license-2.0.php
*/
#pragma once
// RUEList.h
//-----------------------------------------------------------------------------
#include <deque>
#include <vector>
#include "../../core/ItemData.h"
#include "../../core/StringX.h"
#include "../../core/PWScore.h"
#include "../../os/UUID.h"
//-----------------------------------------------------------------------------
/*
* CRUEList is a class that contains the recently used entries
*/
struct RUEntryData {
StringX string;
int image;
CItemData *pci;
};
// identifies menu owner-draw data as mine
const LONG RUEMENUITEMID = MAKELONG(MAKEWORD('R', 'U'),MAKEWORD('E', 'M'));
// private struct: one of these for each owner-draw menu item
struct CRUEItemData {
long magicNum; // magic number identifying me
int nImage; // index of button image in image list
CRUEItemData() { magicNum = RUEMENUITEMID; }
BOOL IsRUEID() const { return magicNum == RUEMENUITEMID; }
};
typedef std::deque<pws_os::CUUID> RUEList;
typedef RUEList::iterator RUEListIter;
typedef RUEList::const_iterator RUEListConstIter;
class CRUEList
{
public:
// Construction/Destruction/operators
CRUEList(PWScore& core);
~CRUEList() {}
CRUEList& operator=(const CRUEList& second);
// Data retrieval
size_t GetCount() const {return m_RUEList.size();}
size_t GetMax() const {return m_maxentries;}
bool GetAllMenuItemStrings(std::vector<RUEntryData> &) const;
bool GetPWEntry(size_t, CItemData &); // NOT const!
void GetRUEList(UUIDList &RUElist) const;
// Data setting
void SetMax(size_t);
void ClearEntries() {m_RUEList.clear();}
bool AddRUEntry(const pws_os::CUUID &);
bool DeleteRUEntry(size_t);
bool DeleteRUEntry(const pws_os::CUUID &);
void SetRUEList(const UUIDList &RUElist);
private:
PWScore &m_core; // Dboxmain's m_core (which = app.m_core!)
size_t m_maxentries;
RUEList m_RUEList; // Recently Used Entry History List
};
//-----------------------------------------------------------------------------
// Local variables:
// mode: c++
// End:
|
/*
* Copyright 2014, NICTA
*
* This software may be distributed and modified according to the terms of
* the BSD 2-Clause license. Note that NO WARRANTY is provided.
* See "LICENSE_BSD2.txt" for details.
*
* @TAG(NICTA_BSD)
*/
#include <stdint.h>
#include <stdio.h>
#include <platsupport/io.h>
#define INTCTL0 0x12100000
#define INTCTL1 0x12100800
#define INTCTL2 0x12101000
#define INTCTL3 0x12101800
#define INTCTL4 0x12102000
#define INTCTL5 0x12102800
#define INTCTL6 0x12103000
#define INTCTL7 0x12103800
struct intctl {
#define INTSELECT_IRQ 0x0
#define INTSELECT_FIQ 0x1
uint32_t select[2]; /* +0x000 */
uint32_t res0[2];
#define INTENABLE_ENABLE 0x1
#define INTENABLE_DISABLE 0x0
uint32_t enable[2]; /* +0x010 */
uint32_t res1[2];
uint32_t enable_clear[2]; /* +0x020 */
uint32_t res2[2];
uint32_t enable_set[2]; /* +0x030 */
uint32_t res3[2];
#define INTTYPE_EDGE 0x1
#define INTTYPE_LEVEL 0x0
uint32_t type[2]; /* +0x040 */
uint32_t res4[2];
#define INTPOL_NEG 0x1
#define INTPOL_POS 0x0
uint32_t polariy[2]; /* +0x050 */
uint32_t res5[2];
uint32_t no_pend_val; /* +0x060 */
#define INTMASTER_IRQEN (0x1 << 0)
#define INTMASTER_FIQEN (0x1 << 1)
uint32_t master_enable; /* +0x064 */
#define INTVIC_VECTOR_MODE 0x1
uint32_t vic_config; /* +0x068 */
#define INTSECURE 0x1
uint32_t security; /* +0x06C */
uint32_t res6[4];
uint32_t irq_status[2]; /* +0x080 */
uint32_t res7[2];
uint32_t fiq_status[2]; /* +0x090 */
uint32_t res8[2];
uint32_t raw_status[2]; /* +0x0A0 */
uint32_t res9[2];
uint32_t raw_clear[2]; /* +0x0B0 */
uint32_t res10[2];
uint32_t raw_soft_int[2]; /* +0x0C0 */
uint32_t res11[2];
uint32_t vec_rd; /* +0x0D0 */
uint32_t pend_rd; /* +0x0D4 */
uint32_t vec_wr; /* +0x0D8 */
uint32_t res12;
uint32_t in_service; /* +0x0E0 */
uint32_t in_stack; /* +0x0E4 */
uint32_t test_bus_sel; /* +0x0E8 */
uint32_t ctl_config; /* +0x0EC */
uint32_t res13[4];
uint32_t res14[64];
uint32_t priority[64]; /* +0x200 */
uint32_t res15[64];
uint32_t vec_addr[64]; /* +0x400 */
uint32_t res16[64];
};
typedef volatile struct intctl intctl_t;
#define PPSS_INTC 0x12080000
#define PPSSINTC_IRQ_OFFSET 0x000
#define PPSSINTC_FIQ_OFFSET 0x100
struct ppss_intc {
uint32_t stat; /* +0x00 */
uint32_t rawstat; /* +0x04 */
uint32_t seten; /* +0x08 */
uint32_t clren; /* +0x0C */
uint32_t soft; /* +0x10 */
};
typedef volatile struct ppss_intc ppss_intc_t;
intctl_t* intctl[8];
ppss_intc_t* fiq;
ppss_intc_t* irq;
void
test_intc(ps_io_ops_t* o)
{
void* vaddr[4];
if (intctl[0] == NULL) {
/* intc */
vaddr[0] = ps_io_map(&o->io_mapper, INTCTL0, 0x1000, 0, PS_MEM_NORMAL);
vaddr[1] = ps_io_map(&o->io_mapper, INTCTL2, 0x1000, 0, PS_MEM_NORMAL);
vaddr[2] = ps_io_map(&o->io_mapper, INTCTL3, 0x1000, 0, PS_MEM_NORMAL);
vaddr[3] = ps_io_map(&o->io_mapper, INTCTL4, 0x1000, 0, PS_MEM_NORMAL);
assert(vaddr[0]);
assert(vaddr[1]);
assert(vaddr[2]);
assert(vaddr[3]);
intctl[0] = (intctl_t*)((uintptr_t)vaddr[0] + 0x000);
intctl[1] = (intctl_t*)((uintptr_t)vaddr[0] + 0x800);
intctl[2] = (intctl_t*)((uintptr_t)vaddr[1] + 0x000);
intctl[3] = (intctl_t*)((uintptr_t)vaddr[1] + 0x800);
intctl[4] = (intctl_t*)((uintptr_t)vaddr[2] + 0x000);
intctl[5] = (intctl_t*)((uintptr_t)vaddr[2] + 0x800);
intctl[6] = (intctl_t*)((uintptr_t)vaddr[3] + 0x000);
intctl[7] = (intctl_t*)((uintptr_t)vaddr[3] + 0x800);
/* ppss intc */
vaddr[0] = ps_io_map(&o->io_mapper, PPSS_INTC, 0x1000, 0, PS_MEM_NORMAL);
irq = (ppss_intc_t*)((uintptr_t)vaddr[0] + PPSSINTC_IRQ_OFFSET);
fiq = (ppss_intc_t*)((uintptr_t)vaddr[0] + PPSSINTC_FIQ_OFFSET);
printf("irq: 0x%x 0x%x 0x%x 0x%x 0x%x\n", irq->stat, irq->rawstat, irq->seten, irq->clren, irq->soft);
printf("fiq: 0x%x 0x%x 0x%x 0x%x 0x%x\n", fiq->stat, fiq->rawstat, fiq->seten, fiq->clren, fiq->soft);
irq->soft = 1;
irq->seten = 0xffff;
printf("irq: 0x%x 0x%x 0x%x 0x%x 0x%x\n", irq->stat, irq->rawstat, irq->seten, irq->clren, irq->soft);
}
};
|
#ifndef ALIANALYSISTASKFILTERFRIEND_H
#define ALIANALYSISTASKFILTERFRIEND_H
/* Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice */
/// \class AliAnalysisTaskFilterFriend
/// \brief Class AliAnalysisTaskFilterFriend
#include "AliAnalysisTaskFilter.h"
class AliAnalysisTaskFilterFriend : public AliAnalysisTaskFilter
{
public:
AliAnalysisTaskFilterFriend();
AliAnalysisTaskFilterFriend(const char *name);
virtual ~AliAnalysisTaskFilterFriend();
// Implementation of interface methods
virtual void UserCreateOutputObjects();
virtual Bool_t UserSelectESDfriendForCurrentEvent();
virtual void Init();
virtual void LocalInit() {Init();}
virtual void UserExec(Option_t *option);
virtual void Terminate(Option_t *option);
private:
AliAnalysisTaskFilterFriend(const AliAnalysisTaskFilterFriend &);
AliAnalysisTaskFilterFriend& operator=(const AliAnalysisTaskFilterFriend&);
AliESDEvent *fESDInput; ///< ESD input object
AliESDfriend *fESDfriendInput; ///< ESD input friend object
ClassDef(AliAnalysisTaskFilterFriend,1);
};
#endif
|
#ifndef ALIANALYSISTASKADDOBJECT_H
#define ALIANALYSISTASKADDOBJECT_H
/* Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice */
/// \class AliAnalysisTaskAddObject
/// \brief Class AliAnalysisTaskAddObject
///
/// Test Task to add an object to the new ESDfriends file
class TH1D;
#include "AliAnalysisTask.h"
class AliESDInputHandler;
class AliESDEvent;
class AliESDfriend;
class AliAnalysisTaskAddObject : public AliAnalysisTask
{
public:
AliAnalysisTaskAddObject();
AliAnalysisTaskAddObject(const char *name);
virtual ~AliAnalysisTaskAddObject();
// Implementation of interface methods
virtual void CreateOutputObjects();
virtual void Exec(Option_t *option);
virtual void Terminate(Option_t *option);
virtual void ConnectInputData(Option_t *option = "");
private:
AliAnalysisTaskAddObject(const AliAnalysisTaskAddObject &);
AliAnalysisTaskAddObject& operator=(const AliAnalysisTaskAddObject&);
AliESDEvent *fESDInput; ///< ESD input object
AliESDfriend *fESDfriendInput; ///< ESD input friend object
AliESDInputHandler *fESDhandler; ///< Pointer to ESD input handler
TH1D* fh; ///< histogram
ClassDef(AliAnalysisTaskAddObject,1); // AliAnalysisTask to create an extra object
};
#endif
|
/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
#ifndef MEMCACHED_VBUCKET_H
#define MEMCACHED_VBUCKET_H 1
#ifdef __cplusplus
extern "C"
{
#endif
typedef enum {
vbucket_state_active = 1, /**< Actively servicing a vbucket. */
vbucket_state_replica, /**< Servicing a vbucket as a replica only. */
vbucket_state_pending, /**< Pending active. */
vbucket_state_dead /**< Not in use, pending deletion. */
} vbucket_state_t;
#define is_valid_vbucket_state_t(state) \
(state == vbucket_state_active || \
state == vbucket_state_replica || \
state == vbucket_state_pending || \
state == vbucket_state_dead)
typedef struct {
uint64_t uuid;
uint64_t seqno;
} vbucket_failover_t;
#ifdef __cplusplus
}
#endif
#endif
|
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITKEXTWORKBENCHWINDOWADVISOR_H_
#define QMITKEXTWORKBENCHWINDOWADVISOR_H_
#include <berryWorkbenchWindowAdvisor.h>
#include <berryIPartListener.h>
#include <berryIEditorPart.h>
#include <berryIWorkbenchPage.h>
#include <berryWorkbenchAdvisor.h>
#include <berryWorkbenchWindowAdvisor.h>
#include <org_mitk_gui_qt_ext_Export.h>
#include <QList>
class QAction;
class QMenu;
class MITK_QT_COMMON_EXT_EXPORT QmitkExtWorkbenchWindowAdvisor : public QObject, public berry::WorkbenchWindowAdvisor
{
Q_OBJECT
public:
QmitkExtWorkbenchWindowAdvisor(berry::WorkbenchAdvisor* wbAdvisor,
berry::IWorkbenchWindowConfigurer::Pointer configurer);
~QmitkExtWorkbenchWindowAdvisor();
berry::SmartPointer<berry::ActionBarAdvisor> CreateActionBarAdvisor(
berry::SmartPointer<berry::IActionBarConfigurer> configurer) override;
QWidget* CreateEmptyWindowContents(QWidget* parent) override;
void PostWindowCreate() override;
void PreWindowOpen() override;
void PostWindowOpen() override;
void PostWindowClose() override;
void ShowViewToolbar(bool show);
void ShowPerspectiveToolbar(bool show);
void ShowVersionInfo(bool show);
void ShowMitkVersionInfo(bool show);
void ShowViewMenuItem(bool show);
void ShowNewWindowMenuItem(bool show);
void ShowClosePerspectiveMenuItem(bool show);
bool GetShowClosePerspectiveMenuItem();
void ShowMemoryIndicator(bool show);
bool GetShowMemoryIndicator();
//TODO should be removed when product support is here
void SetProductName(const QString& product);
void SetWindowIcon(const QString& wndIcon);
void SetPerspectiveExcludeList(const QList<QString> &v);
QList<QString> GetPerspectiveExcludeList();
void SetViewExcludeList(const QList<QString> &v);
QList<QString> GetViewExcludeList();
protected slots:
virtual void onIntro();
virtual void onHelp();
virtual void onHelpOpenHelpPerspective();
virtual void onAbout();
private:
/**
* Hooks the listeners needed on the window
*
* @param configurer
*/
void HookTitleUpdateListeners(berry::IWorkbenchWindowConfigurer::Pointer configurer);
QString ComputeTitle();
void RecomputeTitle();
QString GetQSettingsFile() const;
/**
* Updates the window title. Format will be: [pageInput -]
* [currentPerspective -] [editorInput -] [workspaceLocation -] productName
* @param editorHidden TODO
*/
void UpdateTitle(bool editorHidden);
void PropertyChange(const berry::Object::Pointer& /*source*/, int propId);
static QString QT_SETTINGS_FILENAME;
QScopedPointer<berry::IPartListener> titlePartListener;
QScopedPointer<berry::IPerspectiveListener> titlePerspectiveListener;
QScopedPointer<berry::IPerspectiveListener> menuPerspectiveListener;
QScopedPointer<berry::IPartListener> imageNavigatorPartListener;
QScopedPointer<berry::IPartListener> viewNavigatorPartListener;
QScopedPointer<berry::IPropertyChangeListener> editorPropertyListener;
friend struct berry::PropertyChangeIntAdapter<QmitkExtWorkbenchWindowAdvisor>;
friend class PartListenerForTitle;
friend class PerspectiveListenerForTitle;
friend class PerspectiveListenerForMenu;
friend class PartListenerForImageNavigator;
friend class PartListenerForViewNavigator;
berry::IEditorPart::WeakPtr lastActiveEditor;
berry::IPerspectiveDescriptor::WeakPtr lastPerspective;
berry::IWorkbenchPage::WeakPtr lastActivePage;
QString lastEditorTitle;
berry::IAdaptable* lastInput;
berry::WorkbenchAdvisor* wbAdvisor;
bool showViewToolbar;
bool showPerspectiveToolbar;
bool showVersionInfo;
bool showMitkVersionInfo;
bool showViewMenuItem;
bool showNewWindowMenuItem;
bool showClosePerspectiveMenuItem;
bool viewNavigatorFound;
bool showMemoryIndicator;
QString productName;
QString windowIcon;
// enables DnD on the editor area
QScopedPointer<berry::IDropTargetListener> dropTargetListener;
// stringlist for excluding perspectives from the perspective menu entry (e.g. Welcome Perspective)
QList<QString> perspectiveExcludeList;
// stringlist for excluding views from the menu entry
QList<QString> viewExcludeList;
// maps perspective ids to QAction objects
QHash<QString, QAction*> mapPerspIdToAction;
// actions which will be enabled/disabled depending on the application state
QList<QAction*> viewActions;
QAction* fileSaveProjectAction;
QAction* closeProjectAction;
QAction* undoAction;
QAction* redoAction;
QAction* imageNavigatorAction;
QAction* viewNavigatorAction;
QAction* resetPerspAction;
QAction* closePerspAction;
QAction* openDicomEditorAction;
};
#endif /*QMITKEXTWORKBENCHWINDOWADVISOR_H_*/
|
/*
* Copyright (C) 2017 ZTE Ltd.
*
* Author: Baoyou Xie <baoyou.xie@linaro.org>
* License terms: GNU General Public License (GPL) version 2
*/
#include <dt-bindings/soc/zte,pm_domains.h>
#include "zx2967_pm_domains.h"
static u16 zx296718_offsets[REG_ARRAY_SIZE] = {
[REG_CLKEN] = 0x18,
[REG_ISOEN] = 0x1c,
[REG_RSTEN] = 0x20,
[REG_PWREN] = 0x24,
[REG_ACK_SYNC] = 0x28,
};
enum {
PCU_DM_VOU = 0,
PCU_DM_SAPPU,
PCU_DM_VDE,
PCU_DM_VCE,
PCU_DM_HDE,
PCU_DM_VIU,
PCU_DM_USB20,
PCU_DM_USB21,
PCU_DM_USB30,
PCU_DM_HSIC,
PCU_DM_GMAC,
PCU_DM_TS,
};
static struct zx2967_pm_domain vou_domain = {
.dm = {
.name = "vou_domain",
},
.bit = PCU_DM_VOU,
.polarity = PWREN,
.reg_offset = zx296718_offsets,
};
static struct zx2967_pm_domain sappu_domain = {
.dm = {
.name = "sappu_domain",
},
.bit = PCU_DM_SAPPU,
.polarity = PWREN,
.reg_offset = zx296718_offsets,
};
static struct zx2967_pm_domain vde_domain = {
.dm = {
.name = "vde_domain",
},
.bit = PCU_DM_VDE,
.polarity = PWREN,
.reg_offset = zx296718_offsets,
};
static struct zx2967_pm_domain vce_domain = {
.dm = {
.name = "vce_domain",
},
.bit = PCU_DM_VCE,
.polarity = PWREN,
.reg_offset = zx296718_offsets,
};
static struct zx2967_pm_domain hde_domain = {
.dm = {
.name = "hde_domain",
},
.bit = PCU_DM_HDE,
.polarity = PWREN,
.reg_offset = zx296718_offsets,
};
static struct zx2967_pm_domain viu_domain = {
.dm = {
.name = "viu_domain",
},
.bit = PCU_DM_VIU,
.polarity = PWREN,
.reg_offset = zx296718_offsets,
};
static struct zx2967_pm_domain usb20_domain = {
.dm = {
.name = "usb20_domain",
},
.bit = PCU_DM_USB20,
.polarity = PWREN,
.reg_offset = zx296718_offsets,
};
static struct zx2967_pm_domain usb21_domain = {
.dm = {
.name = "usb21_domain",
},
.bit = PCU_DM_USB21,
.polarity = PWREN,
.reg_offset = zx296718_offsets,
};
static struct zx2967_pm_domain usb30_domain = {
.dm = {
.name = "usb30_domain",
},
.bit = PCU_DM_USB30,
.polarity = PWREN,
.reg_offset = zx296718_offsets,
};
static struct zx2967_pm_domain hsic_domain = {
.dm = {
.name = "hsic_domain",
},
.bit = PCU_DM_HSIC,
.polarity = PWREN,
.reg_offset = zx296718_offsets,
};
static struct zx2967_pm_domain gmac_domain = {
.dm = {
.name = "gmac_domain",
},
.bit = PCU_DM_GMAC,
.polarity = PWREN,
.reg_offset = zx296718_offsets,
};
static struct zx2967_pm_domain ts_domain = {
.dm = {
.name = "ts_domain",
},
.bit = PCU_DM_TS,
.polarity = PWREN,
.reg_offset = zx296718_offsets,
};
static struct generic_pm_domain *zx296718_pm_domains[] = {
[DM_ZX296718_VOU] = &vou_domain.dm,
[DM_ZX296718_SAPPU] = &sappu_domain.dm,
[DM_ZX296718_VDE] = &vde_domain.dm,
[DM_ZX296718_VCE] = &vce_domain.dm,
[DM_ZX296718_HDE] = &hde_domain.dm,
[DM_ZX296718_VIU] = &viu_domain.dm,
[DM_ZX296718_USB20] = &usb20_domain.dm,
[DM_ZX296718_USB21] = &usb21_domain.dm,
[DM_ZX296718_USB30] = &usb30_domain.dm,
[DM_ZX296718_HSIC] = &hsic_domain.dm,
[DM_ZX296718_GMAC] = &gmac_domain.dm,
[DM_ZX296718_TS] = &ts_domain.dm,
};
static int zx296718_pd_probe(struct platform_device *pdev)
{
return zx2967_pd_probe(pdev,
zx296718_pm_domains,
ARRAY_SIZE(zx296718_pm_domains));
}
static const struct of_device_id zx296718_pm_domain_matches[] = {
{ .compatible = "zte,zx296718-pcu", },
{ },
};
static struct platform_driver zx296718_pd_driver = {
.driver = {
.name = "zx296718-powerdomain",
.of_match_table = zx296718_pm_domain_matches,
},
.probe = zx296718_pd_probe,
};
static int __init zx296718_pd_init(void)
{
return platform_driver_register(&zx296718_pd_driver);
}
subsys_initcall(zx296718_pd_init);
|
/*
* Driver for ADI Direct Digital Synthesis ad9852
*
* Copyright (c) 2010 Analog Devices Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
*/
#include <linux/types.h>
#include <linux/mutex.h>
#include <linux/device.h>
#include <linux/spi/spi.h>
#include <linux/slab.h>
#include <linux/sysfs.h>
#include "../iio.h"
#include "../sysfs.h"
#define DRV_NAME "ad9852"
#define addr_phaad1 0x0
#define addr_phaad2 0x1
#define addr_fretu1 0x2
#define addr_fretu2 0x3
#define addr_delfre 0x4
#define addr_updclk 0x5
#define addr_ramclk 0x6
#define addr_contrl 0x7
#define addr_optskm 0x8
#define addr_optskr 0xa
#define addr_dacctl 0xb
#define COMPPD (1 << 4)
#define REFMULT2 (1 << 2)
#define BYPPLL (1 << 5)
#define PLLRANG (1 << 6)
#define IEUPCLK (1)
#define OSKEN (1 << 5)
#define read_bit (1 << 7)
/* Register format: 1 byte addr + value */
struct ad9852_config {
u8 phajst0[3];
u8 phajst1[3];
u8 fretun1[6];
u8 fretun2[6];
u8 dltafre[6];
u8 updtclk[5];
u8 ramprat[4];
u8 control[5];
u8 outpskm[3];
u8 outpskr[2];
u8 daccntl[3];
};
struct ad9852_state {
struct mutex lock;
struct iio_dev *idev;
struct spi_device *sdev;
};
static ssize_t ad9852_set_parameter(struct device *dev,
struct device_attribute *attr,
const char *buf,
size_t len)
{
struct spi_message msg;
struct spi_transfer xfer;
int ret;
struct ad9852_config *config = (struct ad9852_config *)buf;
struct iio_dev *idev = dev_get_drvdata(dev);
struct ad9852_state *st = idev->dev_data;
xfer.len = 3;
xfer.tx_buf = &config->phajst0[0];
mutex_lock(&st->lock);
spi_message_init(&msg);
spi_message_add_tail(&xfer, &msg);
ret = spi_sync(st->sdev, &msg);
if (ret)
goto error_ret;
xfer.len = 3;
xfer.tx_buf = &config->phajst1[0];
spi_message_init(&msg);
spi_message_add_tail(&xfer, &msg);
ret = spi_sync(st->sdev, &msg);
if (ret)
goto error_ret;
xfer.len = 6;
xfer.tx_buf = &config->fretun1[0];
spi_message_init(&msg);
spi_message_add_tail(&xfer, &msg);
ret = spi_sync(st->sdev, &msg);
if (ret)
goto error_ret;
xfer.len = 6;
xfer.tx_buf = &config->fretun2[0];
spi_message_init(&msg);
spi_message_add_tail(&xfer, &msg);
ret = spi_sync(st->sdev, &msg);
if (ret)
goto error_ret;
xfer.len = 6;
xfer.tx_buf = &config->dltafre[0];
spi_message_init(&msg);
spi_message_add_tail(&xfer, &msg);
ret = spi_sync(st->sdev, &msg);
if (ret)
goto error_ret;
xfer.len = 5;
xfer.tx_buf = &config->updtclk[0];
spi_message_init(&msg);
spi_message_add_tail(&xfer, &msg);
ret = spi_sync(st->sdev, &msg);
if (ret)
goto error_ret;
xfer.len = 4;
xfer.tx_buf = &config->ramprat[0];
spi_message_init(&msg);
spi_message_add_tail(&xfer, &msg);
ret = spi_sync(st->sdev, &msg);
if (ret)
goto error_ret;
xfer.len = 5;
xfer.tx_buf = &config->control[0];
spi_message_init(&msg);
spi_message_add_tail(&xfer, &msg);
ret = spi_sync(st->sdev, &msg);
if (ret)
goto error_ret;
xfer.len = 3;
xfer.tx_buf = &config->outpskm[0];
spi_message_init(&msg);
spi_message_add_tail(&xfer, &msg);
ret = spi_sync(st->sdev, &msg);
if (ret)
goto error_ret;
xfer.len = 2;
xfer.tx_buf = &config->outpskr[0];
spi_message_init(&msg);
spi_message_add_tail(&xfer, &msg);
ret = spi_sync(st->sdev, &msg);
if (ret)
goto error_ret;
xfer.len = 3;
xfer.tx_buf = &config->daccntl[0];
spi_message_init(&msg);
spi_message_add_tail(&xfer, &msg);
ret = spi_sync(st->sdev, &msg);
if (ret)
goto error_ret;
error_ret:
mutex_unlock(&st->lock);
return ret ? ret : len;
}
static IIO_DEVICE_ATTR(dds, S_IWUSR, NULL, ad9852_set_parameter, 0);
static void ad9852_init(struct ad9852_state *st)
{
struct spi_message msg;
struct spi_transfer xfer;
int ret;
u8 config[5];
config[0] = addr_contrl;
config[1] = COMPPD;
config[2] = REFMULT2 | BYPPLL | PLLRANG;
config[3] = IEUPCLK;
config[4] = OSKEN;
mutex_lock(&st->lock);
xfer.len = 5;
xfer.tx_buf = &config;
spi_message_init(&msg);
spi_message_add_tail(&xfer, &msg);
ret = spi_sync(st->sdev, &msg);
if (ret)
goto error_ret;
error_ret:
mutex_unlock(&st->lock);
}
static struct attribute *ad9852_attributes[] = {
&iio_dev_attr_dds.dev_attr.attr,
NULL,
};
static const struct attribute_group ad9852_attribute_group = {
.name = DRV_NAME,
.attrs = ad9852_attributes,
};
static const struct iio_info ad9852_info = {
.attrs = &ad9852_attribute_group,
.driver_module = THIS_MODULE,
};
static int __devinit ad9852_probe(struct spi_device *spi)
{
struct ad9852_state *st;
int ret = 0;
st = kzalloc(sizeof(*st), GFP_KERNEL);
if (st == NULL) {
ret = -ENOMEM;
goto error_ret;
}
spi_set_drvdata(spi, st);
mutex_init(&st->lock);
st->sdev = spi;
st->idev = iio_allocate_device(0);
if (st->idev == NULL) {
ret = -ENOMEM;
goto error_free_st;
}
st->idev->dev.parent = &spi->dev;
st->idev->info = &ad9852_info;
st->idev->dev_data = (void *)(st);
st->idev->modes = INDIO_DIRECT_MODE;
ret = iio_device_register(st->idev);
if (ret)
goto error_free_dev;
spi->max_speed_hz = 2000000;
spi->mode = SPI_MODE_3;
spi->bits_per_word = 8;
spi_setup(spi);
ad9852_init(st);
return 0;
error_free_dev:
iio_free_device(st->idev);
error_free_st:
kfree(st);
error_ret:
return ret;
}
static int __devexit ad9852_remove(struct spi_device *spi)
{
struct ad9852_state *st = spi_get_drvdata(spi);
iio_device_unregister(st->idev);
kfree(st);
return 0;
}
static struct spi_driver ad9852_driver = {
.driver = {
.name = DRV_NAME,
.owner = THIS_MODULE,
},
.probe = ad9852_probe,
.remove = __devexit_p(ad9852_remove),
};
static __init int ad9852_spi_init(void)
{
return spi_register_driver(&ad9852_driver);
}
module_init(ad9852_spi_init);
static __exit void ad9852_spi_exit(void)
{
spi_unregister_driver(&ad9852_driver);
}
module_exit(ad9852_spi_exit);
MODULE_AUTHOR("Cliff Cai");
MODULE_DESCRIPTION("Analog Devices ad9852 driver");
MODULE_LICENSE("GPL v2");
|
/*
** Copyright (c) 2013, Bradley A. Minch
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are met:
**
** 1. Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** 2. Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
** POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _OC_H_
#define _OC_H_
#include <stdint.h>
#include "pin.h"
#include "timer.h"
void init_oc(void);
typedef struct {
uint16_t *OCxCON1;
uint16_t *OCxCON2;
uint16_t *OCxRS;
uint16_t *OCxR;
uint16_t *OCxTMR;
uint16_t rpnum;
uint16_t servooffset;
uint16_t servomultiplier;
_PIN *pin;
} _OC;
extern _OC oc1, oc2, oc3, oc4, oc5, oc6, oc7, oc8, oc9;
void oc_init(_OC *self, uint16_t *OCxCON1, uint16_t *OCxCON2,
uint16_t *OCxRS, uint16_t *OCxR, uint16_t *OCxTMR,
uint16_t rpnum);
void oc_free(_OC *self);
void oc_pwm(_OC *self, _PIN *out, _TIMER *timer, float freq, uint16_t duty);
void oc_servo(_OC *self, _PIN *out, _TIMER *timer, float interval,
float min_width, float max_width, uint16_t pos);
#endif
|
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#else
#ifndef FOUNDATION_EXPORT
#if defined(__cplusplus)
#define FOUNDATION_EXPORT extern "C"
#else
#define FOUNDATION_EXPORT extern
#endif
#endif
#endif
#import "TTGSnackbar.h"
FOUNDATION_EXPORT double TTGSnackbarVersionNumber;
FOUNDATION_EXPORT const unsigned char TTGSnackbarVersionString[];
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.