text
stringlengths 4
6.14k
|
|---|
// Copyright (c) 2014, 임경현
// 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 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.
#include <IkhWinLib2/CForm.h>
#include <IkhWinLib2/IControl.h>
#include <IkhWinLib2/CListBoxCtrl.h>
using namespace IkhProgram::IkhWinLib2;
class CDesignerCtrl final : public CForm, public virtual IControl
{
DECLARE_MSGMAP();
public:
using IControl::Create;
using IControl::CreateEx;
virtual void CreateEx(DWORD dwExStyle, DWORD dwStyle,
int x, int y, int nWidth, int nHeight, int id, HWND hWndParent) override;
private:
typedef std::shared_ptr<IControl> (*CtrlCtor)();
static std::vector<CtrlCtor> m_vtCtrlCtor;
CtrlCtor m_NowCtrlCtor;
RECT m_SelRect;
public:
CDesignerCtrl();
void InitToolList(CListBoxCtrl &ToolList);
void OnToolListSelChange(int idx);
protected:
BOOL OnCreate(LPCREATESTRUCT lpcs);
void OnLButtonDown(BOOL fDoubleClick, int x, int y, UINT keyFlags);
void OnMouseMove(int x, int y, UINT keyFlags);
void OnLButtonUp(int x, int y, UINT keyFlags);
void ChangeSelRect(int x, int y);
void OnDestroy();
};
|
/*
Copyright 2009-2012 Urban Airship 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 binaryform must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided withthe distribution.
THIS SOFTWARE IS PROVIDED BY THE URBAN AIRSHIP 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 URBAN AIRSHIP 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.
*/
#import <UIKit/UIKit.h>
@interface SplitViewInboxSampleAppDelegate : NSObject <UIApplicationDelegate>
@property (nonatomic, retain) IBOutlet UIWindow *window;
@end
|
/*
* Copyright (c) 2003-2004 HighPoint Technologies, 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 THE AUTHOR 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 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.
*
* $FreeBSD: src/sys/dev/hptmv/mv.c,v 1.1 2004/10/24 05:37:23 scottl Exp $
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <vm/vm.h>
#include <vm/pmap.h>
#include <vm/vm_extern.h>
#include <dev/hptmv/global.h>
#include <dev/hptmv/hptintf.h>
#include <dev/hptmv/mvOs.h>
#include <dev/hptmv/osbsd.h>
void HPTLIBAPI
MV_REG_WRITE_BYTE(MV_BUS_ADDR_T base, MV_U32 offset, MV_U8 val)
{
mv_reg_write_byte(base, offset, val);
}
void HPTLIBAPI
MV_REG_WRITE_WORD(MV_BUS_ADDR_T base, MV_U32 offset, MV_U16 val)
{
mv_reg_write_word(base, offset, val);
}
void HPTLIBAPI
MV_REG_WRITE_DWORD(MV_BUS_ADDR_T base, MV_U32 offset, MV_U32 val)
{
mv_reg_write_dword(base, offset, val);
}
MV_U8
HPTLIBAPI MV_REG_READ_BYTE(MV_BUS_ADDR_T base, MV_U32 offset)
{
return (mv_reg_read_byte(base, offset));
}
MV_U16
HPTLIBAPI MV_REG_READ_WORD(MV_BUS_ADDR_T base, MV_U32 offset)
{
return (mv_reg_read_word(base, offset));
}
MV_U32
HPTLIBAPI MV_REG_READ_DWORD(MV_BUS_ADDR_T base, MV_U32 offset)
{
return (mv_reg_read_dword(base, offset));
}
int HPTLIBAPI
os_memcmp(const void *cs, const void *ct, unsigned len)
{
return memcmp(cs, ct, len);
}
void HPTLIBAPI
os_memcpy(void *to, const void *from, unsigned len)
{
memcpy(to, from, len);
}
void
HPTLIBAPI os_memset(void *s, char c, unsigned len)
{
memset(s, c, len);
}
unsigned
HPTLIBAPI os_strlen(const char *s)
{
return strlen(s);
}
void HPTLIBAPI mvMicroSecondsDelay(MV_U32 msecs)
{
DELAY(msecs);
}
/*
* XXX
*
* The binary raid.obj requires this function!
*/
ULONG_PTR HPTLIBAPI fOsPhysicalAddress(void *addr)
{
return (ULONG_PTR)(vtophys(addr));
}
|
/*===================================================================
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 QmitkSPSAOptimizerViewWidgetHIncluded
#define QmitkSPSAOptimizerViewWidgetHIncluded
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationOptimizerGUIBase.h"
#include "ui_QmitkSPSAOptimizerControls.h"
#include <itkArray.h>
#include <itkImage.h>
#include <itkObject.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkSPSAOptimizerView : public QmitkRigidRegistrationOptimizerGUIBase
{
public:
QmitkSPSAOptimizerView(QWidget *parent = nullptr, Qt::WindowFlags f = nullptr);
~QmitkSPSAOptimizerView();
virtual mitk::OptimizerParameters::OptimizerType GetOptimizerType() override;
virtual itk::Object::Pointer GetOptimizer() override;
virtual itk::Array<double> GetOptimizerParameters() override;
virtual void SetOptimizerParameters(itk::Array<double> metricValues) override;
virtual void SetNumberOfTransformParameters(int transformParameters) override;
virtual QString GetName() override;
virtual void SetupUI(QWidget *parent) override;
protected:
Ui::QmitkSPSAOptimizerControls m_Controls;
int m_NumberTransformParameters;
};
#endif
|
// Copyright (c) 2018, Smart Projects Holdings Ltd
// All rights reserved.
// See LICENSE file for license details.
/*
* shared_memory.h
*
* Created on: Oct 24, 2013
* Author: Janis
*/
#ifndef _UGCS_VSM_SHARED_MEMORY_H_
#define _UGCS_VSM_SHARED_MEMORY_H_
#include <ugcs/vsm/utils.h>
namespace ugcs {
namespace vsm {
/** Platform independent implementation of system-wide named shared memory
* used for interprocess communications.
* Workflow:
* 1) Call Shared_memory::Create() to create class instance.
* 2) Call Shared_memory::Open() to open or create shared memory.
* 3) Call Shared_memory::Get() to Get the pointer to shared memory.
*
* The pointer is valid until object is closed.
* Object is closed:
* - explicitly via call to Close()
* - implicitly when calling Open() on the same instance.
* - in destructor.
*
* User must be aware of the following platform specific differences
* in shared memory semantics:
* Windows:
* 1) When the last handle to memory is closed the OS destroys the memory.
* (Note: OS closes all open handles on application termination/crash)
* 2) By default the memory is created in Session Kernel object namespace.
* 3) Shared memory cannot be explicitly deleted.
* Implemented via CreateFileMapping() and friends.
*
* Linux:
* 1) Shared memory persists in the system until explicitly deleted or system restarted.
* 2) It is accessible from any session of its creator user.
* Implemented via shm_open() and friends.
*
*/
class Shared_memory: public std::enable_shared_from_this<Shared_memory>
{
DEFINE_COMMON_CLASS(Shared_memory, Shared_memory)
public:
/** Possible return codes from Open() call */
typedef enum {
OPEN_RESULT_OK,
OPEN_RESULT_CREATED,
OPEN_RESULT_ERROR
} Open_result;
/**
* Constructor should not be called explicitly.
* Use Create() function to instantiate the object.
*/
Shared_memory():
memory(nullptr)
{};
virtual
~Shared_memory() {}
/**
* Open/create shared memory.
* Closes previously opened memory if any.
* @param name Name of memory object
* @param size size in bytes. Will return error if size==0
* @return OPEN_RESULT_OK Opened existing shared memory.
* OPEN_RESULT_CREATED Created new shared memory.
* OPEN_RESULT_ERROR Error while creating shared memory.
* Previously opened memory is closed.
*/
virtual Open_result
Open(const std::string& name, const size_t size) = 0;
/**
* Closes previously opened memory.
*/
virtual void
Close() = 0;
/**
* Returns the pointer to shared memory.
* @return pointer to shared memory. Returns nullptr if not opened.
*/
virtual void*
Get() {return memory;}
/**
* Deletes the named memory. (Linux-only)
* Does not affect any opened memory with this name.
* @param name Shared memory name.
* @return true Shared memory deleted.
* false error occurred.
*/
static bool
Delete(const std::string& name);
/**
* Creates Platform specific class instance.
* This does not create the memory itself,
* you should call Open() to create the named memory.
* @return shared_ptr<Shared_memory> of newly created instance
*/
static Ptr
Create();
/** pointer to shared memory */
protected:
void* memory;
};
} /* namespace vsm */
} /* namespace ugcs */
#endif /* _UGCS_VSM_SHARED_MEMORY_H_ */
|
//
// FUEFirstView.h
// RHFirstUserExperience
//
// Created by Richard Heard on 24/06/12.
// Copyright (c) 2012 Richard Heard. All rights reserved.
//
#import "RHFirstUserExperienceGenericOverlayView.h"
@interface FUEFirstView : RHFirstUserExperienceGenericOverlayView {
UIImageView *_leftBubble;
UIImageView *_rightBubble;
}
-(void)updateVisibility;
-(IBAction)hideSelf:(id)sender;
@end
|
/**
* @file PoseRotationPrior.h
*
* @brief Implements a prior on the rotation component of a pose
*
* @date Jun 14, 2012
* @author Alex Cunningham
*/
#pragma once
#include <gtsam/geometry/concepts.h>
#include <gtsam/nonlinear/NonlinearFactor.h>
namespace gtsam {
template<class POSE>
class PoseRotationPrior : public NoiseModelFactor1<POSE> {
public:
typedef PoseRotationPrior<POSE> This;
typedef NoiseModelFactor1<POSE> Base;
typedef POSE Pose;
typedef typename POSE::Translation Translation;
typedef typename POSE::Rotation Rotation;
GTSAM_CONCEPT_POSE_TYPE(Pose)
GTSAM_CONCEPT_GROUP_TYPE(Pose)
GTSAM_CONCEPT_LIE_TYPE(Rotation)
protected:
Rotation measured_;
public:
/** standard constructor */
PoseRotationPrior(Key key, const Rotation& rot_z, const SharedNoiseModel& model)
: Base(model, key), measured_(rot_z) {}
/** Constructor that pulls the translation from an incoming POSE */
PoseRotationPrior(Key key, const POSE& pose_z, const SharedNoiseModel& model)
: Base(model, key), measured_(pose_z.rotation()) {}
virtual ~PoseRotationPrior() {}
/// @return a deep copy of this factor
virtual gtsam::NonlinearFactor::shared_ptr clone() const {
return boost::static_pointer_cast<gtsam::NonlinearFactor>(
gtsam::NonlinearFactor::shared_ptr(new This(*this))); }
// access
const Rotation& measured() const { return measured_; }
// testable
/** equals specialized to this factor */
virtual bool equals(const NonlinearFactor& expected, double tol=1e-9) const {
const This *e = dynamic_cast<const This*> (&expected);
return e != NULL && Base::equals(*e, tol) && measured_.equals(e->measured_, tol);
}
/** print contents */
void print(const std::string& s="", const KeyFormatter& keyFormatter = DefaultKeyFormatter) const {
Base::print(s + "PoseRotationPrior", keyFormatter);
measured_.print("Measured Rotation");
}
/** h(x)-z */
Vector evaluateError(const Pose& pose, boost::optional<Matrix&> H = boost::none) const {
const Rotation& newR = pose.rotation();
const size_t rDim = newR.dim(), xDim = pose.dim();
if (H) {
*H = gtsam::zeros(rDim, xDim);
std::pair<size_t, size_t> rotInterval = POSE::rotationInterval();
(*H).middleCols(rotInterval.first, rDim).setIdentity(rDim, rDim);
}
return measured_.localCoordinates(newR);
}
private:
/** Serialization function */
friend class boost::serialization::access;
template<class ARCHIVE>
void serialize(ARCHIVE & ar, const unsigned int version) {
ar & boost::serialization::make_nvp("NoiseModelFactor1",
boost::serialization::base_object<Base>(*this));
ar & BOOST_SERIALIZATION_NVP(measured_);
}
};
} // \namespace gtsam
|
//
// Created by messi on 12/6/16.
//
#ifndef COMMON_LINKAGE_H
#define COMMON_LINKAGE_H
#define LINKAGE
#endif //COMMON_LINKAGE_H
|
/*
* prgbox.c -- implements the message box and info box
*
* AUTHOR: Savio Lam (lam836@cs.cuhk.hk)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <dialog.h>
#include <errno.h>
#include <sys/wait.h>
#include "dialog.priv.h"
/*
* Display a message box. Program will pause and display an "OK" button
* if the parameter 'pause' is non-zero.
*/
int dialog_prgbox(unsigned char *title, const unsigned char *line, int height, int width, int pause, int use_shell)
{
int i, x, y, key = 0;
WINDOW *dialog;
FILE *f;
const unsigned char *name;
unsigned char *s, buf[MAX_LEN];
int status;
if (height < 0 || width < 0) {
endwin();
fprintf(stderr, "\nAutosizing is impossible in dialog_prgbox().\n");
exit(-1);
}
width = MAX(width,10);
if (width > COLS)
width = COLS;
if (height > LINES)
height = LINES;
/* center dialog box on screen */
x = DialogX ? DialogX : (COLS - width)/2;
y = DialogY ? DialogY : (LINES - height)/2;
#ifdef HAVE_NCURSES
if (use_shadow)
draw_shadow(stdscr, y, x, height, width);
#endif
dialog = newwin(height, width, y, x);
if (dialog == NULL) {
endwin();
fprintf(stderr, "\nnewwin(%d,%d,%d,%d) failed, maybe wrong dims\n", height,width,y,x);
exit(1);
}
keypad(dialog, TRUE);
draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr);
if (title != NULL) {
wattrset(dialog, title_attr);
wmove(dialog, 0, (width - strlen(title))/2 - 1);
waddch(dialog, ' ');
waddstr(dialog, title);
waddch(dialog, ' ');
}
wattrset(dialog, dialog_attr);
wmove(dialog, 1, 2);
if (!use_shell) {
char cmdline[MAX_LEN];
char *av[51], **ap = av, *val, *p;
strcpy(cmdline, line);
p = cmdline;
while ((val = strsep(&p," \t")) != NULL) {
if (*val != '\0')
*ap++ = val;
}
*ap = NULL;
f = raw_popen(name = av[0], av, "r");
} else
f = raw_popen(name = line, NULL, "r");
status = -1;
if (f == NULL) {
err:
sprintf(buf, "%s: %s\n", name, strerror(errno));
prr:
print_autowrap(dialog, buf, height-(pause?3:1), width-2, width, 1, 2, FALSE, TRUE);
wrefresh(dialog);
} else {
while (fgets(buf, sizeof(buf), f) != NULL) {
i = strlen(buf);
if (buf[i-1] == '\n')
buf[i-1] = '\0';
s = buf;
while ((s = strchr(s, '\t')) != NULL)
*s++ = ' ';
print_autowrap(dialog, buf, height-(pause?3:1), width-2, width, 1, 2, FALSE, TRUE);
print_autowrap(dialog, "\n", height-(pause?3:1), width-2, width, 1, 2, FALSE, FALSE);
wrefresh(dialog);
}
if ((status = raw_pclose(f)) == -1)
goto err;
if (WIFEXITED(status) && WEXITSTATUS(status) == 127) {
sprintf(buf, "%s: program not found\n", name);
goto prr;
}
}
if (pause) {
wattrset(dialog, border_attr);
wmove(dialog, height-3, 0);
waddch(dialog, ACS_LTEE);
for (i = 0; i < width-2; i++)
waddch(dialog, ACS_HLINE);
wattrset(dialog, dialog_attr);
waddch(dialog, ACS_RTEE);
wmove(dialog, height-2, 1);
for (i = 0; i < width-2; i++)
waddch(dialog, ' ');
display_helpline(dialog, height-1, width);
print_button(dialog, " OK ", height-2, width/2-6, TRUE);
wrefresh(dialog);
while (key != ESC && key != '\n' && key != ' ' && key != '\r')
key = wgetch(dialog);
if (key == '\r')
key = '\n';
}
else {
key = '\n';
wrefresh(dialog);
}
delwin(dialog);
return (status);
}
/* End of dialog_msgbox() */
|
// This file is part of MANTIS OS, Operating System
// See http://mantis.cs.colorado.edu/
//
// Copyright (C) 2003,2004,2005 University of Colorado, Boulder
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the mos license (see file LICENSE)
/**************************************************************************/
/* File: relay.c */
/* Author Jeff Rose & Brian Shucker: rosejn & shucker@cs.colorado.edu */
/* Date: 03/09/04 */
/* Edited Charles Gruenwald III : gruenwal@colorado.edu */
/* Date: 03/30/04 */
/* */
/* Base station app for bionet sensor connected to a host computer over */
/* a serial link. */
/**************************************************************************/
#if defined(PLATFORM_MICA2)
#include "cc1000.h"
#endif
#include "mos.h"
#include "msched.h"
#include "com.h"
//#include "config.h"
//#include "command_daemon.h"
#include "uart.h"
#include "printf.h"
#include "net.h"
#include "led.h"
#include "dev.h"
#include "clock.h"
#include "printf.h"
#include "node_net_event.h"
#include "bedrest_config.h"
#include "bedrest_shared.h"
uint16_t*items;
comBuf *recv_pkt; //give us a packet pointer
comBuf send_pkt;
uint8_t digit(uint8_t i)
{
if(i<10)
return '0'+i;
i-=10;
return 'A'+i;
}
void print16bit(uint16_t i)
{
send_pkt.data[3] = digit((i>>0)&15);
send_pkt.data[2] = digit((i>>4)&15);
send_pkt.data[1] = digit((i>>8)&15);
send_pkt.data[0] = digit((i>>12)&15);
com_send(IFACE_SERIAL,&send_pkt);
}
net_event_t *event;
bedrest_t *inpacket;
static comBuf send;
net_event_t *sendEvent;
void receiver()
{
send_pkt.size = 6;
send_pkt.data[4]=32;
send_pkt.data[5]=0;
send.size=4;
sendEvent = (net_event_t*)&send.data;
sendEvent->from = 0;
com_mode(IFACE_RADIO, IF_LISTEN);
#if defined(PLATFORM_MICA2)
// cc1000_change_freq(FREQ_917_537_MHZ);
#endif
uint8_t a;
while(1)
{
recv_pkt = com_recv(IFACE_RADIO); //blocking recv a packet
event = (net_event_t *)recv_pkt->data;
inpacket = (bedrest_t *)&(recv_pkt->data[6]);
if(event->to == 0)
{ //packet meant for base-station..
items = (uint16_t*)&recv_pkt->data;
printf("%d :", recv_pkt->size);
for(a=0;a<recv_pkt->size>>1;a++)
print16bit(*items++);
if((recv_pkt->size&1)==1)
{
recv_pkt->data[recv_pkt->size]=0;
print16bit(*items++);
}
printf("\n");
if(event->event == BEDREST_CONFIG_PACKET)
mos_led_toggle(2);
#ifdef DTPA_ENABLED
else
{
mos_led_toggle(1);
sendEvent->to = event->from;
com_send (IFACE_RADIO, &send);
}
#endif
}
com_free_buf(recv_pkt); //free the recv'd packet to the pool
// mos_thread_sleep(200);
mos_led_toggle(0);
}
}
void start(void)
{
mos_thread_new(receiver,128, PRIORITY_NORMAL);
}
|
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include <ABI38_0_0React/core/ShadowNode.h>
#include <ABI38_0_0React/mounting/ShadowViewMutation.h>
namespace ABI38_0_0facebook {
namespace ABI38_0_0React {
/*
* Calculates a list of view mutations which describes how the old
* `ShadowTree` can be transformed to the new one.
* The list of mutations might be and might not be optimal.
*/
ShadowViewMutationList calculateShadowViewMutations(
ShadowNode const &oldRootShadowNode,
ShadowNode const &newRootShadowNode);
/*
* Generates a list of `ShadowViewNodePair`s that represents a layer of a
* flattened view hierarchy.
*/
ShadowViewNodePair::List sliceChildShadowNodeViewPairs(
ShadowNode const &shadowNode);
} // namespace ABI38_0_0React
} // namespace ABI38_0_0facebook
|
#include <smaccm_receiver.h>
#include <receiver.h>
void ping_received(test3__a_array_impl test_data) {
printf("receiver ping received (%d, %d, %d, %d)\n", test_data[0], test_data[1], test_data[2], test_data[3]);
}
|
#include <stdio.h>
#include <xmp.h>
#pragma xmp nodes p[2]
#pragma xmp template t[10]
#pragma xmp distribute t[block] onto p
int a[10];
int main(){
for(int i=0;i<10;i++)
a[i] = i+1;
for(int i=0;i<10;i++)
printf("[%d] %d\n", xmpc_node_num(), a[i]);
return 0;
}
|
iBegin(unpack, Unpack, "unpack")
iTarget(optype::(type,iterator<bytes>))
iOp1(optype::(iterator<bytes>,iterator<bytes>), trueX)
iOp2(optype::enum, trueX)
iOp3(optype::[type], trueX)
iValidate {
auto ty_target = as<type::(type,iterator<bytes>)>(target->type());
auto ty_op1 = as<type::(iterator<bytes>,iterator<bytes>)>(op1->type());
auto ty_op2 = as<type::enum>(op2->type());
auto ty_op3 = as<type::[type]>(op3->type());
}
iDoc(R"(
Unpacks an instance of a particular type (as determined by *target*;
see below) from the binary data enclosed by the iterator tuple *op1*.
*op2* defines the binary layout as an enum of type ``Hilti::Packed``
and must be a constant. Depending on *op2*, *op3* is may be an
additional, format-specific parameter with further information about
the binary layout. The operator returns a ``tuple<T,
iterator<bytes>>``, in the first component is the newly unpacked
instance and the second component is locates the first bytes that has
*not* been consumed anymore. Raises ~~WouldBlock if there are not
sufficient bytes available for unpacking the type. Can also raise
other exceptions if other errors occur, in particular if the raw bytes
are not as expected (and that fact can be verified). Note: The
``unpack`` operator uses a generic implementation able to handle all
data types. Different from most other operators, it's implementation
is not overloaded on a per-type based. However, each type must come
with an ~~unpack decorated function, which the generic operator
implementatin relies on for doing the unpacking. Note: We should
define error semantics more crisply. Ideally, a single UnpackError
should be raised in all error cases.
)")
iEnd
|
/*
* Copyright 2010 The Native Client Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can
* be found in the LICENSE file.
*/
#include <assert.h>
#include <errno.h>
#include <string.h>
#include <sys/nacl_syscalls.h>
#include "native_client/tests/dynamic_code_loading/templates.h"
/* TODO(mseaborn): Add a symbol to the linker script for finding the
end of the static code segment more accurately. The value below is
an approximation. */
#define DYNAMIC_CODE_SEGMENT_START 0x80000
/* This test checks that the validator check is disabled in debug mode. */
int main() {
void *dest = (void *) DYNAMIC_CODE_SEGMENT_START;
char buf[32];
int rc;
/* This data won't pass the validators, but in debug mode it can be
loaded anyway. */
memset(buf, 0, sizeof(buf));
assert(sizeof(buf) >= &invalid_code_end - &invalid_code);
memcpy(buf, &invalid_code, &invalid_code_end - &invalid_code);
rc = nacl_dyncode_copy(dest, buf, sizeof(buf));
assert(rc == 0);
return 0;
}
|
//
// Simple_PlayerAppDelegate.h
// Simple Player
//
// Created by Daniel Kennett on 10/3/11.
/*
Copyright (c) 2011, Spotify AB
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 Spotify AB 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 SPOTIFY AB 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 <UIKit/UIKit.h>
#import "CocoaLibSpotify.h"
#import "SPPlaybackManager.h"
@interface Simple_PlayerAppDelegate : NSObject <UIApplicationDelegate, SPSessionDelegate, SPSessionPlaybackDelegate> {
UIViewController *_mainViewController;
UITextField *_trackURIField;
UILabel *_trackTitle;
UILabel *_trackArtist;
UIImageView *_coverView;
UISlider *_positionSlider;
SPPlaybackManager *_playbackManager;
SPTrack *_currentTrack;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UIViewController *mainViewController;
@property (nonatomic, retain) IBOutlet UITextField *trackURIField;
@property (nonatomic, retain) IBOutlet UILabel *trackTitle;
@property (nonatomic, retain) IBOutlet UILabel *trackArtist;
@property (nonatomic, retain) IBOutlet UIImageView *coverView;
@property (nonatomic, retain) IBOutlet UISlider *positionSlider;
@property (nonatomic, retain) SPTrack *currentTrack;
@property (nonatomic, retain) SPPlaybackManager *playbackManager;
- (IBAction)playTrack:(id)sender;
- (IBAction)setTrackPosition:(id)sender;
@end
|
#pragma once
#ifndef __BENCH_EXPORT_H__
#define __BENCH_EXPORT_H__
#define BENCH_API
#define BENCH_API_C extern "C"
#endif // __BENCH_EXPORT_H__
|
#ifndef _TBIGMEMORYMANAGER_
#define _TBIGMEMORYMANAGER_
class Chunkinfo;
#undef DVAPI
#undef DVVAR
#ifdef TSYSTEM_EXPORTS
#define DVAPI DV_EXPORT_API
#define DVVAR DV_EXPORT_VAR
#else
#define DVAPI DV_IMPORT_API
#define DVVAR DV_IMPORT_VAR
#endif
#include "tcommon.h"
#include "tthreadmessage.h"
class TRaster;
class DVAPI TBigMemoryManager
{
TThread::Mutex m_mutex;
UCHAR *m_theMemory;
std::map<UCHAR *, Chunkinfo> m_chunks;
UCHAR *allocate(UINT &size);
TUINT32 m_availableMemory, m_allocatedMemory;
std::map<UCHAR *, Chunkinfo>::iterator shiftBlock(const std::map<UCHAR *, Chunkinfo>::iterator &it, TUINT32 offset);
TRaster *findRaster(TRaster *ras);
void checkConsistency();
UCHAR *remap(TUINT32 RequestedSize);
void printLog(TUINT32 size);
public:
TBigMemoryManager();
~TBigMemoryManager();
bool init(TUINT32 sizeinKb);
bool putRaster(TRaster *ras, bool canPutOnDisk = true);
bool releaseRaster(TRaster *ras);
void lock(UCHAR *buffer);
void unlock(UCHAR *buffer);
UCHAR *getBuffer(UINT size);
static TBigMemoryManager *instance();
bool isActive() const { return m_theMemory != 0; }
//void releaseSubraster(UCHAR *chunk, TRaster*subRas);
TUINT32 getAvailableMemoryinKb() const
{
assert(m_theMemory != 0);
return m_availableMemory >> 10;
}
void getRasterInfo(int &rasterCount, TUINT32 &totRasterMemInKb, int ¬CachedRasterCount, TUINT32 ¬CachedRasterMemInKb);
#ifdef _DEBUG
TUINT32 m_totRasterMemInKb;
void printMap();
#endif
int getAllocationPeak();
int getAllocationMean();
void setRunOutOfContiguousMemoryHandler(void (*callback)(unsigned long size));
private:
friend class TRaster;
void (*m_runOutCallback)(unsigned long);
};
#endif
|
/**
* \file RIAAFilter.h
* Filters for RIAA correction
*/
#ifndef ATK_EQ_RIAAFILTER_H
#define ATK_EQ_RIAAFILTER_H
#include <gsl/gsl>
#include <ATK/EQ/SecondOrderFilter.h>
namespace ATK
{
/// RIAA coefficients used for RIAA correction
template<typename DataType_>
class RIAACoefficients : public SecondOrderCoreCoefficients<DataType_>
{
public:
/// Simplify parent calls
using Parent = SecondOrderCoreCoefficients<DataType_>;
using typename Parent::AlignedScalarVector;
using typename Parent::DataType;
using CoeffDataType = typename TypeTraits<DataType>::Scalar;
using Parent::input_sampling_rate;
using Parent::output_sampling_rate;
using Parent::setup;
protected:
using Parent::in_order;
using Parent::out_order;
using Parent::coefficients_in;
using Parent::coefficients_out;
void setup() override;
public:
/*!
* @brief Constructor
* @param nb_channels is the number of input and output channels
*/
explicit RIAACoefficients(gsl::index nb_channels = 1);
};
/// RIAA coefficients used to create the inverse compensation (for mastering engineers)
template<typename DataType_>
class InverseRIAACoefficients : public SecondOrderCoreCoefficients<DataType_>
{
public:
/// Simplify parent calls
using Parent = SecondOrderCoreCoefficients<DataType_>;
using typename Parent::AlignedScalarVector;
using typename Parent::DataType;
using CoeffDataType = typename TypeTraits<DataType>::Scalar;
using Parent::input_sampling_rate;
using Parent::output_sampling_rate;
using Parent::setup;
protected:
using Parent::in_order;
using Parent::out_order;
using Parent::coefficients_in;
using Parent::coefficients_out;
void setup() override;
public:
/*!
* @brief Constructor
* @param nb_channels is the number of input and output channels
*/
explicit InverseRIAACoefficients(gsl::index nb_channels = 1);
};
}
#endif
|
#ifndef STATISTICS_ONLINE_LASSO_H
#define STATISTICS_ONLINE_LASSO_H
#include "statistics.h"
#include <KrisLibrary/math/LDL.h>
namespace Statistics {
/** @brief Stochastic estimation of solution to y = A x via a LASSO-like
* procedure
* min_x ||b-A x||^2 + alpha*||x||_1
*
* The A matrix is the "data" vector, y is the "outcome" vector.
* Each update step takes O(n) time, where n is the number of
* dimensions in x.
*
* The change in coeffs is estimated each step via a LASSO-like step. It is
* then added to the current estimate via the rule
* x(m) = x(m-1) + w(m)*deltax(m)
* where w(m) is a weight equal to 1/P(m), with P(m) being a polynomial.
*/
struct StochasticPseudoLASSO
{
StochasticPseudoLASSO(Real alpha=0.01);
void SetPrior(const Vector& coeffs,int strength);
void AddPoint(const Vector& data,Real outcome);
Real alpha;
int numObservations;
std::vector<Real> weightPolynomial;
Vector coeffs; //stores estimate of coeffs
};
} //namespace Statistics
#endif
|
/*--------------------------------------------------------------------*
*
* Developed by;
* Neal Horman - http://www.wanlink.com
* Copyright (c) 2003 Neal Horman. 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. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Neal Horman.
* 4. Neither the name Neal Horman nor the names of any contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY NEAL HORMAN AND ANY 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 NEAL HORMAN OR ANY 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.
*
* CVSID: $Id: dns.h,v 1.10 2012/05/04 00:14:06 neal Exp $
*
* DESCRIPTION:
* application: spamilter
* module: dns.h
*--------------------------------------------------------------------*/
#ifndef _SPAMILTER_DNS_H_
#define _SPAMILTER_DNS_H_
#include "config.h"
#include <stdarg.h>
#define mkip(a,b,c,d) ((((a)&0xff)<<24)|(((b)&0xff)<<16)|(((c)&0xff)<<8)|((d)&0xff))
typedef struct _ds_t
{
res_state statp;
const char *pSessionId;
int bLoggingEnabled;
}ds_t; // Dns Session Type
typedef struct _dqrr_t
{
// the session logging
const ds_t *pDs;
int nsType;
int tries;
// the response buffer
u_char *pResp;
size_t respLen;
// the ns parser
ns_rr rr;
int rrNum;
ns_msg rrMsg;
int rrCount;
} dqrr_t; // Dns Query Rr Response Type
// Create a query structure, and init with a specified type
dqrr_t *dns_query_rr_init(const ds_t *pDs, int nsType);
// Reinitialize the query structure with a speciied type
dqrr_t * dns_query_rr_reinit(dqrr_t *pDqrr, int nsType);
// Free a query structure
void dns_query_rr_free(dqrr_t *pDqrr);
// Execute a query with a specified type
int dns_query_rr_resp(dqrr_t *pDqrr, const char *pQuery);
// Execute a vprintf style query with a specified type
int dns_query_rr_resp_vprintf(dqrr_t *pDqrr, const char *pFmt, va_list vl);
// Execute a printf style query with a specified type
int dns_query_rr_resp_printf(dqrr_t *pDqrr, const char *pFmt, ...);
// Do a query of a specified type, returning 1 if there was at least one result
int dns_query_rr(const ds_t *pDs, int nsType, const char *pQuery);
// Iterate a given section of a response
void dns_parse_response(dqrr_t *pDqrr, ns_sect nsSect, int (*pCallbackFn)(dqrr_t *, void *), void *pCallbackData);
// Iterate the Answer Section of a response
void dns_parse_response_answer(dqrr_t *pDqrr, int (*pCallbackFn)(dqrr_t *, void *), void *pCallbackData);
// Query a hostname of a specified type and find a match
int dns_hostname_ip_match_af(const ds_t *pDs, const char *hostname, int afType, const char *in);
int dns_hostname_ip_match_sa(const ds_t *pDs, const char *hostname, struct sockaddr *psa);
// Build an arpa request for an ipv4 or ipv6 address.
// The consumer must free() the return value.
char *dns_inet_ptoarpa(const char *pHost, int afType, const char *pDomainRoot);
#endif
|
/*============================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center (DKFZ)
All rights reserved.
Use of this source code is governed by a 3-clause BSD license that can be
found in the LICENSE file.
============================================================================*/
#ifndef QMITKDATANODECOLORMAPACTION_H
#define QMITKDATANODECOLORMAPACTION_H
#include <org_mitk_gui_qt_application_Export.h>
#include "QmitkAbstractDataNodeAction.h"
// mitk core
#include <mitkDataNode.h>
// qt
#include <QAction>
class MITK_QT_APP QmitkDataNodeColorMapAction : public QAction, public QmitkAbstractDataNodeAction
{
Q_OBJECT
public:
QmitkDataNodeColorMapAction(QWidget* parent, berry::IWorkbenchPartSite::Pointer workbenchPartSite);
QmitkDataNodeColorMapAction(QWidget* parent, berry::IWorkbenchPartSite* workbenchPartSite);
private Q_SLOTS:
void OnMenuAboutShow();
void OnActionTriggered(bool);
protected:
void InitializeAction() override;
void UseWholePixelRange(mitk::DataNode* node);
};
#endif // QMITKDATANODECOLORMAPACTION_H
|
/*
* Copyright © 2009 Université Bordeaux 1
* See COPYING in top-level directory.
*/
#ifndef HWLOC_PORT_SYS_CPUSET_H
#define HWLOC_PORT_SYS_CPUSET_H
#include <limits.h>
typedef long cpuset_t;
typedef int cpulevel_t;
typedef int cpuwhich_t;
#define CPU_LEVEL_WHICH 3
#define CPU_WHICH_TID 1
#define CPU_WHICH_PID 2
#undef CPU_SETSIZE
#define CPU_SETSIZE (sizeof(cpuset_t) * CHAR_BIT)
#undef CPU_ZERO
#define CPU_ZERO(cpuset) (*(cpuset) = 0)
#undef CPU_SET
#define CPU_SET(cpu, cpuset) (*(cpuset) |= (1<<(cpu)))
#undef CPU_ISSET
#define CPU_ISSET(cpu, cpuset) (*(cpuset) & (1<<(cpu)))
int cpuset_getaffinity(cpulevel_t level, cpuwhich_t which, id_t id, size_t size, cpuset_t *cpuset);
int cpuset_setaffinity(cpulevel_t level, cpuwhich_t which, id_t id, size_t size, const cpuset_t *cpuset);
#endif /* HWLOC_PORT_SYS_CPUSET_H */
|
//////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2018, Image Engine Design Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above
// copyright notice, this list of conditions and the following
// disclaimer.
//
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided with
// the distribution.
//
// * Neither the name of John Haddon nor the names of
// any other contributors to this software may be used to endorse or
// promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////
#ifndef GAFFERUI_AUXILIARYNODEGADGET_H
#define GAFFERUI_AUXILIARYNODEGADGET_H
#include "GafferUI/NodeGadget.h"
namespace GafferUI
{
class GAFFERUI_API AuxiliaryNodeGadget : public NodeGadget
{
public :
GAFFER_GRAPHCOMPONENT_DECLARE_TYPE( GafferUI::AuxiliaryNodeGadget, AuxiliaryNodeGadgetTypeId, NodeGadget );
AuxiliaryNodeGadget( Gaffer::NodePtr node );
~AuxiliaryNodeGadget() override;
Imath::Box3f bound() const override;
protected :
void doRenderLayer( Layer layer, const Style *style ) const override;
private :
static NodeGadgetTypeDescription<AuxiliaryNodeGadget> g_nodeGadgetTypeDescription;
void nodeMetadataChanged( IECore::TypeId nodeTypeId, IECore::InternedString key, const Gaffer::Node *node );
bool updateLabel();
bool updateUserColor();
// \todo Consolidate the mechanism for reading userColor with the one in StandardConnectionGadget
boost::optional<Imath::Color3f> m_userColor;
std::string m_label;
float m_radius;
};
IE_CORE_DECLAREPTR( AuxiliaryNodeGadget )
} // namespace GafferUI
#endif // GAFFERUI_AUXILIARYNODEGADGET_H
|
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_CHROMEOS_ARC_ARC_SUPPORT_HOST_H_
#define CHROME_BROWSER_CHROMEOS_ARC_ARC_SUPPORT_HOST_H_
#include "base/macros.h"
#include "chrome/browser/chromeos/arc/arc_auth_service.h"
#include "components/prefs/pref_change_registrar.h"
#include "extensions/browser/api/messaging/native_message_host.h"
#include "ui/display/display_observer.h"
// Supports communication with Arc support dialog.
class ArcSupportHost : public extensions::NativeMessageHost,
public arc::ArcAuthService::Observer,
public display::DisplayObserver {
public:
static const char kHostName[];
static const char kHostAppId[];
static const char kStorageId[];
static const char* const kHostOrigin[];
static std::unique_ptr<NativeMessageHost> Create();
~ArcSupportHost() override;
// Overrides NativeMessageHost:
void Start(Client* client) override;
void OnMessage(const std::string& request_string) override;
scoped_refptr<base::SingleThreadTaskRunner> task_runner() const override;
// Overrides arc::ArcAuthService::Observer:
void OnOptInUIClose() override;
void OnOptInUIShowPage(arc::ArcAuthService::UIPage page,
const base::string16& status) override;
// display::DisplayObserver:
void OnDisplayAdded(const display::Display& new_display) override;
void OnDisplayRemoved(const display::Display& old_display) override;
void OnDisplayMetricsChanged(const display::Display& display,
uint32_t changed_metrics) override;
private:
ArcSupportHost();
bool Initialize();
void OnMetricsPreferenceChanged();
void SendMetricsMode();
void EnableMetrics(bool is_enabled);
void EnableBackupRestore(bool is_enabled);
void EnableLocationService(bool is_enabled);
// Unowned pointer.
Client* client_ = nullptr;
// Used to track metrics preference.
PrefChangeRegistrar pref_change_registrar_;
DISALLOW_COPY_AND_ASSIGN(ArcSupportHost);
};
#endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SUPPORT_HOST_H_
|
#ifndef __INGREDIENT
#define __INGREDIENT
namespace Graphos
{
namespace Graphics
{
class IShader;
}
namespace Core
{
// Forward declaration
class GameObject;
class IComponent
{
public:
IComponent( GameObject* owner = nullptr ) : owner( owner ) { }
virtual ~IComponent( void ) { }
virtual void Update( void ) { };
virtual void Draw( Graphics::IShader* shader ) { };
virtual void Shutdown( void ) { };
GameObject* const Owner( void ) const { return owner; }
protected:
GameObject* owner;
};
}
}
#endif//__INGREDIENT
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE190_Integer_Overflow__int_rand_preinc_12.c
Label Definition File: CWE190_Integer_Overflow__int.label.xml
Template File: sources-sinks-12.tmpl.c
*/
/*
* @description
* CWE: 190 Integer Overflow
* BadSource: rand Set data to result of rand(), which may be zero
* GoodSource: Set data to a small, non-zero number (two)
* Sinks: increment
* GoodSink: Ensure there will not be an overflow before incrementing data
* BadSink : Increment data, which can cause an overflow
* Flow Variant: 12 Control flow: if(globalReturnsTrueOrFalse())
*
* */
#include "std_testcase.h"
#ifndef OMITBAD
void CWE190_Integer_Overflow__int_rand_preinc_12_bad()
{
int data;
/* Initialize data */
data = 0;
if(globalReturnsTrueOrFalse())
{
/* POTENTIAL FLAW: Set data to a random value */
data = RAND32();
}
else
{
/* FIX: Use a small, non-zero value that will not cause an integer overflow in the sinks */
data = 2;
}
if(globalReturnsTrueOrFalse())
{
{
/* POTENTIAL FLAW: Incrementing data could cause an overflow */
++data;
int result = data;
printIntLine(result);
}
}
else
{
/* FIX: Add a check to prevent an overflow from occurring */
if (data < INT_MAX)
{
++data;
int result = data;
printIntLine(result);
}
else
{
printLine("data value is too large to perform arithmetic safely.");
}
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodB2G() - use badsource and goodsink by changing the first "if" so that
both branches use the BadSource and the second "if" so that both branches
use the GoodSink */
static void goodB2G()
{
int data;
/* Initialize data */
data = 0;
if(globalReturnsTrueOrFalse())
{
/* POTENTIAL FLAW: Set data to a random value */
data = RAND32();
}
else
{
/* POTENTIAL FLAW: Set data to a random value */
data = RAND32();
}
if(globalReturnsTrueOrFalse())
{
/* FIX: Add a check to prevent an overflow from occurring */
if (data < INT_MAX)
{
++data;
int result = data;
printIntLine(result);
}
else
{
printLine("data value is too large to perform arithmetic safely.");
}
}
else
{
/* FIX: Add a check to prevent an overflow from occurring */
if (data < INT_MAX)
{
++data;
int result = data;
printIntLine(result);
}
else
{
printLine("data value is too large to perform arithmetic safely.");
}
}
}
/* goodG2B() - use goodsource and badsink by changing the first "if" so that
both branches use the GoodSource and the second "if" so that both branches
use the BadSink */
static void goodG2B()
{
int data;
/* Initialize data */
data = 0;
if(globalReturnsTrueOrFalse())
{
/* FIX: Use a small, non-zero value that will not cause an integer overflow in the sinks */
data = 2;
}
else
{
/* FIX: Use a small, non-zero value that will not cause an integer overflow in the sinks */
data = 2;
}
if(globalReturnsTrueOrFalse())
{
{
/* POTENTIAL FLAW: Incrementing data could cause an overflow */
++data;
int result = data;
printIntLine(result);
}
}
else
{
{
/* POTENTIAL FLAW: Incrementing data could cause an overflow */
++data;
int result = data;
printIntLine(result);
}
}
}
void CWE190_Integer_Overflow__int_rand_preinc_12_good()
{
goodB2G();
goodG2B();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
its own for testing or for building a binary to use in testing binary
analysis tools. It is not used when compiling all the testcases as one
application, which is how source code analysis tools are tested. */
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE190_Integer_Overflow__int_rand_preinc_12_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE190_Integer_Overflow__int_rand_preinc_12_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
//
// DDNSLoggerLogger.h
// Created by Peter Steinberger on 26.10.10.
//
#import <Foundation/Foundation.h>
#import "DDLog.h"
@interface DDNSLoggerLogger : DDAbstractLogger <DDLogger>
@property (nonatomic, readonly) BOOL running;
+ (DDNSLoggerLogger *)sharedInstance;
/// should setup before `- (void)start`
- (void)setupWithBonjourServiceName:(NSString *)serviceName;
- (void)setupWithHostAddress:(NSString *)host port:(int)port;
- (void)start;
- (void)stop;
@end
|
//
// SFPSDSolidFillEffectLayerInformation.h
// SFPSDWriter Mac OS X
//
// Created by Konstantin Erokhin on 15/06/14.
// Copyright (c) 2014 Shiny Frog. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "SFPSDLayerBlendModes.h"
@interface SFPSDSolidFillEffectLayerInformation : NSObject
@property (nonatomic, strong) NSString *blendMode;
@property (nonatomic, assign) CGColorRef color;
@property (nonatomic, assign) long opacity; // (0...100)
@property (nonatomic, assign) BOOL enabled;
- (long)opacity255; // (0...255)
@end
|
// Copyright 2016 The Cobalt Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef COBALT_CSSOM_COLOR_STOP_H_
#define COBALT_CSSOM_COLOR_STOP_H_
#include <memory>
#include <string>
#include "base/memory/ref_counted.h"
#include "cobalt/cssom/length_value.h"
#include "cobalt/cssom/percentage_value.h"
#include "cobalt/cssom/property_value.h"
#include "cobalt/cssom/rgba_color_value.h"
namespace cobalt {
namespace cssom {
// A color stop is a combination of a color and a position. Percentages refer to
// the length of the gradient line, with 0% being at the starting point and 100%
// being at the ending point. Lengths are measured from the starting point in
// the direction of the ending point.
// See https://www.w3.org/TR/css3-images/#color-stop-syntax
// 4.4. Gradient Color-Stops for details.
class ColorStop {
public:
explicit ColorStop(const scoped_refptr<RGBAColorValue>& rgba)
: rgba_(rgba), position_(NULL) {}
ColorStop(const scoped_refptr<RGBAColorValue>& rgba,
const scoped_refptr<PropertyValue>& position)
: rgba_(rgba), position_(position) {}
const scoped_refptr<RGBAColorValue>& rgba() const { return rgba_; }
const scoped_refptr<PropertyValue>& position() const { return position_; }
std::string ToString() const;
bool operator==(const ColorStop& other) const;
private:
const scoped_refptr<RGBAColorValue> rgba_;
const scoped_refptr<PropertyValue> position_;
DISALLOW_COPY_AND_ASSIGN(ColorStop);
};
// A list of ColorStopValue. Color-stops are points placed along the line
// defined by gradient line at the beginning of the rule. Color-stops must be
// specified in order.
typedef std::vector<std::unique_ptr<ColorStop>> ColorStopList;
bool ColorStopListsEqual(const ColorStopList& lhs, const ColorStopList& rhs);
} // namespace cssom
} // namespace cobalt
#endif // COBALT_CSSOM_COLOR_STOP_H_
|
#ifndef ALIHFJET_H
#define ALIHFJET_H
/* Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice */
/* $Id$ */
//*************************************************************************
// \class AliHFJet
// \helper class to handle jet objects
// \authors:
// N. Zardoshti, nima.zardoshti@cern.ch
/////////////////////////////////////////////////////////////
#include "TObject.h"
class AliHFJet : public TObject
{
public:
AliHFJet();
AliHFJet(const AliHFJet &source);
virtual ~AliHFJet();
void Reset();
Float_t GetID() {return fID;}
Float_t GetHFMeson() {return fHFMeson;}
Float_t GetPt() {return fPt;}
Float_t GetEta() {return fEta;}
Float_t GetPhi() {return fPhi;}
Float_t GetDeltaEta() {return fDeltaEta;}
Float_t GetDeltaPhi() {return fDeltaPhi;}
Float_t GetDeltaR() {return fDeltaR;}
Float_t GetN() {return fN;}
Float_t GetZg() {return fZg;}
Float_t GetRg() {return fRg;}
Float_t GetNsd() {return fNsd;}
Float_t GetPt_splitting() {return fPt_splitting;}
Float_t Getk0() {return fk0;}
Float_t GetZk0() {return fZk0;}
Float_t GetRk0() {return fRk0;}
Float_t Getk1() {return fk1;}
Float_t GetZk1() {return fZk1;}
Float_t GetRk1() {return fRk1;}
Float_t Getk2() {return fk2;}
Float_t GetZk2() {return fZk2;}
Float_t GetRk2() {return fRk2;}
Float_t GetkT() {return fkT;}
Float_t GetZkT() {return fZkT;}
Float_t GetRkT() {return fRkT;}
Float_t fID; //unique (in event) jet ID
Float_t fHFMeson; //determines if the jet contains the HF candidtae or particle
Float_t fPt; //jet pT
Float_t fEta; //jet pseudorapidity
Float_t fPhi; //jet phi
Float_t fDeltaEta; //pseudorapidity difference of jet axis and HF candidiate or particle
Float_t fDeltaPhi; //phi difference of jet axis and HF candidiate or particle
Float_t fDeltaR; //pseudorapidity-phi distnace of jet axis and HF candidiate or particle
Float_t fN; //number of jet constituents
Float_t fZg; //soft dropped splitting momentum fraction
Float_t fRg; //soft dropped splitting angle
Float_t fNsd; //number of splittings passing soft drop
Float_t fPt_splitting; //total pT going into soft drop splitting
Float_t fk0; //dynamical grooming kappa with alpha=0
Float_t fZk0; //dynamical grooming with alpha=0 splitting momentum fraction
Float_t fRk0; //dynamical grooming with alpha=0 splitting angle
Float_t fk1; //dynamical grooming kappa with alpha=1
Float_t fZk1; //dynamical grooming with alpha=1 splitting momentum fraction
Float_t fRk1; //dynamical grooming with alpha=1 splitting angle
Float_t fk2; //dynamical grooming kappa with alpha=2
Float_t fZk2; //dynamical grooming with alpha=2 splitting momentum fraction
Float_t fRk2; //dynamical grooming with alpha=2 splitting angle
Float_t fkT; //Splitting witht the largest kT (following hardest branch)
Float_t fZkT; //Splitting witht the largest kT (following hardest branch) splitting momentum fraction
Float_t fRkT; //Splitting witht the largest kT (following hardest branch) splitting angle
/// \cond CLASSIMP
ClassDef(AliHFJet,1); ///
/// \endcond
};
#endif
|
#ifndef MOVEIT_PICK_PLACE_MANIPULATION_PIPELINE_
#define MOVEIT_PICK_PLACE_MANIPULATION_PIPELINE_
#include <moveit/katana_pick_place/manipulation_stage.h>
#include <boost/thread.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/function.hpp>
#include <vector>
#include <deque>
namespace pick_place
{
/** \brief Represent the sequence of steps that are executed for a manipulation plan */
class ManipulationPipeline
{
public:
ManipulationPipeline(const std::string &name, unsigned int nthreads);
virtual ~ManipulationPipeline();
const std::string& getName() const
{
return name_;
}
void setSolutionCallback(const boost::function<void()> &callback)
{
solution_callback_ = callback;
}
void setEmptyQueueCallback(const boost::function<void()> &callback)
{
empty_queue_callback_ = callback;
}
ManipulationPipeline& addStage(const ManipulationStagePtr &next);
const ManipulationStagePtr& getFirstStage() const;
const ManipulationStagePtr& getLastStage() const;
void reset();
void setVerbose(bool flag);
void signalStop();
void start();
void stop();
void push(const ManipulationPlanPtr &grasp);
void clear();
const std::vector<ManipulationPlanPtr>& getSuccessfulManipulationPlans() const
{
return success_;
}
const std::vector<ManipulationPlanPtr>& getFailedManipulationPlans() const
{
return failed_;
}
void reprocessLastFailure();
protected:
void processingThread(unsigned int index);
std::string name_;
unsigned int nthreads_;
bool verbose_;
std::vector<ManipulationStagePtr> stages_;
std::deque<ManipulationPlanPtr> queue_;
std::vector<ManipulationPlanPtr> success_;
std::vector<ManipulationPlanPtr> failed_;
std::vector<boost::thread*> processing_threads_;
boost::condition_variable queue_access_cond_;
boost::mutex queue_access_lock_;
boost::mutex result_lock_;
boost::function<void()> solution_callback_;
boost::function<void()> empty_queue_callback_;
unsigned int empty_queue_threads_;
bool stop_processing_;
};
}
#endif
|
#include "c_stack.h"
#include <stdio.h>
#include <stdlib.h>
int main()
{
long int d=42;
long int *intptr;
int cnt,i;
struct x {
int a;
int b;
} myStruct;
/* initialize the stack
- optional as its done automagically on first push */
cstack_container *stack = cstack_init();
/* push a RO char array */
puts("Pushing first item");
cstack_push(stack,"item A");
/* make sure its there */
cstack_dump(stack);
/* push an int addr */
puts("Pushing second item");
cstack_push(stack,&d);
/* push a structure */
puts("Pushing third item");
cstack_push(stack,&myStruct);
/* make sure its there */
cstack_dump(stack);
/* get 2nd item
- this makes it other than a pure LIFO buffer */
puts("Getting 2nd item off stack");
intptr=cstack_getItem(stack,2);
printf("second item value: %ld\n",*intptr);
/* loop through the items on the stack */
cnt = cstack_getCount(stack);
for(i=0;i<cnt;i++) {
long int *ptr = cstack_getItem(stack,i);
/* just like with a real stack we have to know what type of data it is
* right now we only know its an address
* long int intptr=(long int *)ptr;
*/
printf("Item %d address %08lX\n",i,(unsigned long int)ptr);
}
/* insert an item after the specified index */
puts("Dumping stack before insert");
cstack_dump(stack);
cstack_insertAfter(stack,cstack_getCount(stack)-1,&d);
puts("Dumping stack after insert");
cstack_dump(stack);
puts("Popping items off stack");
while ((d=(long int)cstack_pop(stack)) != (long int)NULL) {
printf("Address: %08lX\n",d);
}
/* make sure stack is empty */
puts("Dumping stack");
cstack_dump(stack);
free(stack);
return(0);
}
|
#include "errors.h"
#include "utils.h"
#include "ast_list.h"
int new_mj_ast_list(list *list, ast **node)
{
mj_ast_list *al = jrv_malloc(sizeof(mj_ast_list));
al->type = MJ_AST_LIST;
al->list = list;
*node = (ast *) al;
return JRV_SUCCESS;
}
int empty_mj_ast_list(ast **node)
{
list *l;
mj_ast_list *al = jrv_malloc(sizeof(mj_ast_list));
new_list(&l);
al->type = MJ_AST_LIST;
al->list = l;
*node = (ast *) al;
return JRV_SUCCESS;
}
int mj_ast_list_prepend(ast *list, ast *node)
{
mj_ast_list *l;
if(NULL == list) {
return JRV_NULL_PTR_ERROR;
}
if(NULL == node) {
return JRV_SUCCESS;
}
if(MJ_AST_LIST != list->type) {
return JRV_INVALID_TYPE;
}
l = (mj_ast_list *) list;
if(node->type == MJ_AST_LIST) {
list_prepend_list(l->list, ((mj_ast_list *) node)->list);
jrv_free(&node);
} else {
list_prepend_ele(l->list, node);
}
return JRV_SUCCESS;
}
static void delete_element(void *data)
{
delete_ast((ast *) data);
}
void delete_mj_ast_list(mj_ast_list *list)
{
delete_list_cb(list->list, &delete_element);
jrv_free(&list);
}
|
/******************************************************************************
* Quantitative Kit Library *
* *
* Copyright (C) 2017 Xiaojun Gao *
* *
* Distributed under the terms and conditions of the BSD 3-Clause License. *
******************************************************************************/
#ifndef QUANT_FRAMEWORK_H
#define QUANT_FRAMEWORK_H
#include "quant_config.h"
#include "quant_event.h"
QUANT_BEGIN_DECLS
typedef struct _QuantContext QuantContext;
QUANT_EXPORT
QuantContext *quant_context_new();
QUANT_EXPORT
QuantContext *quant_context_ref(QuantContext *ctx);
QUANT_EXPORT
QuantContext *quant_context_unref(QuantContext *ctx);
typedef enum {
QUANT_CONTEXT_MODE_SIMULATOR,
QUANT_CONTEXT_MODE_REALTIME
}QuantContextMode;
typedef enum {
QUANT_CONTEXT_STATUS_STARTED,
QUANT_CONTEXT_STATUS_STOPPED,
QUANT_CONTEXT_STATUS_STEPING,
QUANT_CONTEXT_STATUS_PAUSED
}QuantContextStatus;
QUANT_EXPORT
QuantContextMode *quant_context_get_mode(QuantContext *ctx);
QUANT_EXPORT
QuantContextStatus quant_context_get_statue(QuantContext *ctx);
QUANT_EXPORT
void quant_context_set_mode(QuantContext *ctx, QuantContextMode *mode);
QUANT_EXPORT
int quant_context_start(QuantContext *ctx);
QUANT_EXPORT
int quant_context_stop(QuantContext *ctx);
QUANT_EXPORT
int quant_context_step(QuantContext *ctx, QuantEventType stop_on_type);
QUANT_EXPORT
int quant_context_pause(QuantContext *ctx);
QUANT_EXPORT
int quant_context_pause_with_timeout(QuantContext *ctx, int microseconds);
QUANT_END_DECLS
#endif // QUANT_FRAMEWORK_H
|
//------------------------------------------------------------------
// Vqec. Client Interface API for Rapid Channel Change.
//
//
// Copyright (c) 2007-2008 by cisco Systems, Inc.
// All rights reserved.
//------------------------------------------------------------------
#ifndef __VQEC_IFCLIENT_FCC_H__
#define __VQEC_IFCLIENT_FCC_H__
#include "vqec_ifclient_defs.h"
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/*----------------------------------------------------------------------------
* Get the PAT stored in the source associated with a given tuner.
*
* @param[in] id ID of the tuner whose PAT to get.
* @param[out] pat_buf Pointer to buffer to copy PAT to.
* @param[out] pat_len Pointer to value to copy PAT length to.
* @param[in] buf_len Size of pat_buf.
*--------------------------------------------------------------------------*/
vqec_error_t
vqec_ifclient_tuner_get_pat(const vqec_tunerid_t id,
uint8_t *pat_buf,
uint32_t *pat_len,
uint32_t buf_len);
/*----------------------------------------------------------------------------
* Get the PMT stored in the source associated with a given tuner.
*
* @param[in] id ID of the tuner whose PMT to get.
* @param[out] pmt_buf Pointer to buffer to copy PMT to.
* @param[out] pmt_len Pointer to value to copy PMT length to.
* @param[in] buf_len Size of pmt_buf.
*--------------------------------------------------------------------------*/
vqec_error_t
vqec_ifclient_tuner_get_pmt(const vqec_tunerid_t id,
uint8_t *pmt_buf,
uint32_t *pmt_len,
uint32_t buf_len);
/*----------------------------------------------------------------------------
* Get the PMT's PID stored in the source associated with a given tuner.
*
* @param[in] id ID of the tuner whose PMT to get.
* @param[out] pmt_pid Pointer to value to copy PMT PID to.
*--------------------------------------------------------------------------*/
vqec_error_t
vqec_ifclient_tuner_get_pmt_pid(const vqec_tunerid_t id,
uint16_t *pmt_pid);
#ifdef __cplusplus
}
#endif // __cplusplus
#endif /* __VQEC_IFCLIENT_FCC_H__ */
|
/*============================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center (DKFZ)
All rights reserved.
Use of this source code is governed by a 3-clause BSD license that can be
found in the LICENSE file.
============================================================================*/
#ifndef TextAnnotation3D_H
#define TextAnnotation3D_H
#include "MitkAnnotationExports.h"
#include <mitkLocalStorageHandler.h>
#include <mitkVtkAnnotation3D.h>
class vtkFollower;
class vtkVectorText;
class vtkTextActor3D;
namespace mitk
{
/** \brief Displays at 3D position, always facing the camera */
class MITKANNOTATION_EXPORT TextAnnotation3D : public mitk::VtkAnnotation3D
{
public:
/** \brief Internal class holding the mapper, actor, etc. for each of the render windows */
/**
* To render the Annotation on transveral, coronal, and sagittal, the update method
* is called for each renderwindow. For performance reasons, the corresponding data
* for each view is saved in the internal helper class LocalStorage.
* This allows rendering n views with just 1 mitkAnnotation using n vtkMapper.
* */
class LocalStorage : public mitk::Annotation::BaseLocalStorage
{
public:
/** \brief Actor of a 2D render window. */
vtkSmartPointer<vtkFollower> m_follower;
vtkSmartPointer<vtkVectorText> m_textSource;
/** \brief Timestamp of last update of stored data. */
itk::TimeStamp m_LastUpdateTime;
/** \brief Default constructor of the local storage. */
LocalStorage();
/** \brief Default deconstructor of the local storage. */
~LocalStorage();
};
mitkClassMacro(TextAnnotation3D, mitk::VtkAnnotation3D);
itkFactorylessNewMacro(Self) itkCloneMacro(Self)
protected :
/** \brief The LocalStorageHandler holds all LocalStorages for the render windows. */
mutable mitk::LocalStorageHandler<LocalStorage> m_LSH;
vtkProp *GetVtkProp(BaseRenderer *renderer) const override;
void UpdateVtkAnnotation(mitk::BaseRenderer *renderer) override;
/** \brief explicit constructor which disallows implicit conversions */
explicit TextAnnotation3D();
/** \brief virtual destructor in order to derive from this class */
~TextAnnotation3D() override;
private:
/** \brief copy constructor */
TextAnnotation3D(const TextAnnotation3D &);
/** \brief assignment operator */
TextAnnotation3D &operator=(const TextAnnotation3D &);
};
} // namespace mitk
#endif // TextAnnotation3D_H
|
// Copyright 2016 Takashi Toyoshima <toyoshim@gmail.com>. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "run68.h"
extern jsrt_zmusic_call(
ULong base, ULong d1, ULong d2, ULong d3, ULong d4, ULong a1);
int zmusic_call() {
rd[0] = 0;
switch (rd[1]) {
case 0x00: // M_INIT
//printf("$%06x ZMUSIC(M_INIT)\n", pc - 2);
break;
case 0x08: // M_PLAY
//printf("$%06x ZMUSIC(M_PLAY); d2=$%08x, d3=$%08x, d4=$08x\n", pc - 2,
// rd[2], rd[3], rd[4]);
break;
case 0x0a: // M_STOP
//printf("$%06x ZMUSIC(M_STOP); d2=$%08x, d3=$%08x, d4=$08x\n", pc - 2,
// rd[2], rd[3], rd[4]);
break;
case 0x11: // PLAY_CNV_DATA
//printf("$%06x ZMUSIC(PLAY_CNV_DATA); size=$%08x, addr=$%08x\n", pc - 2,
// rd[2], ra[1]);
break;
case 0x12: // SE_PLAY
//printf("$%06x ZMUSIC(SE_PLAY); track=$%08x, addr=$%08x\n", pc - 2,
// rd[2], ra[1]);
break;
case 0x14: // SE_ADPCM2
//printf("$%06x ZMUSIC(SE_ADPCM2); d2=$%08x, d3=$%08x\n", pc - 2, rd[2],
// rd[3]);
break;
case 0x1A: // FADE_OUT
//printf("$%06x ZMUSIC(FADE_OUT); mode=$%08x\n", pc - 2, rd[2]);
break;
default:
printf("$%06x ZMUSIC($%08x)\n", pc - 2, rd[1]);
return -1;
}
jsrt_zmusic_call(prog_ptr, rd[1], rd[2], rd[3], rd[4], ra[1]);
return 0;
}
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE190_Integer_Overflow__unsigned_int_max_preinc_31.c
Label Definition File: CWE190_Integer_Overflow.label.xml
Template File: sources-sinks-31.tmpl.c
*/
/*
* @description
* CWE: 190 Integer Overflow
* BadSource: max Set data to the max value for unsigned int
* GoodSource: Set data to a small, non-zero number (two)
* Sinks: increment
* GoodSink: Ensure there will not be an overflow before incrementing data
* BadSink : Increment data, which can cause an overflow
* Flow Variant: 31 Data flow using a copy of data within the same function
*
* */
#include "std_testcase.h"
#ifndef OMITBAD
void CWE190_Integer_Overflow__unsigned_int_max_preinc_31_bad()
{
unsigned int data;
data = 0;
/* POTENTIAL FLAW: Use the maximum size of the data type */
data = UINT_MAX;
{
unsigned int dataCopy = data;
unsigned int data = dataCopy;
{
/* POTENTIAL FLAW: Incrementing data could cause an overflow */
++data;
unsigned int result = data;
printUnsignedLine(result);
}
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B() uses the GoodSource with the BadSink */
static void goodG2B()
{
unsigned int data;
data = 0;
/* FIX: Use a small, non-zero value that will not cause an overflow in the sinks */
data = 2;
{
unsigned int dataCopy = data;
unsigned int data = dataCopy;
{
/* POTENTIAL FLAW: Incrementing data could cause an overflow */
++data;
unsigned int result = data;
printUnsignedLine(result);
}
}
}
/* goodB2G() uses the BadSource with the GoodSink */
static void goodB2G()
{
unsigned int data;
data = 0;
/* POTENTIAL FLAW: Use the maximum size of the data type */
data = UINT_MAX;
{
unsigned int dataCopy = data;
unsigned int data = dataCopy;
/* FIX: Add a check to prevent an overflow from occurring */
if (data < UINT_MAX)
{
++data;
unsigned int result = data;
printUnsignedLine(result);
}
else
{
printLine("data value is too large to perform arithmetic safely.");
}
}
}
void CWE190_Integer_Overflow__unsigned_int_max_preinc_31_good()
{
goodG2B();
goodB2G();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
its own for testing or for building a binary to use in testing binary
analysis tools. It is not used when compiling all the testcases as one
application, which is how source code analysis tools are tested. */
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE190_Integer_Overflow__unsigned_int_max_preinc_31_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE190_Integer_Overflow__unsigned_int_max_preinc_31_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
/*
* Copyright (c) 2016, ARM Limited and Contributors. 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 ARM 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 __PMU_COM_H__
#define __PMU_COM_H__
/*
* Use this macro to instantiate lock before it is used in below
* rockchip_pd_lock_xxx() macros
*/
DECLARE_BAKERY_LOCK(rockchip_pd_lock);
/*
* These are wrapper macros to the powe domain Bakery Lock API.
*/
#define rockchip_pd_lock_init() bakery_lock_init(&rockchip_pd_lock)
#define rockchip_pd_lock_get() bakery_lock_get(&rockchip_pd_lock)
#define rockchip_pd_lock_rls() bakery_lock_release(&rockchip_pd_lock)
/*****************************************************************************
* power domain on or off
*****************************************************************************/
enum pmu_pd_state {
pmu_pd_on = 0,
pmu_pd_off = 1
};
#pragma weak plat_ic_get_pending_interrupt_id
#pragma weak pmu_power_domain_ctr
#pragma weak check_cpu_wfie
static inline uint32_t pmu_power_domain_st(uint32_t pd)
{
uint32_t pwrdn_st = mmio_read_32(PMU_BASE + PMU_PWRDN_ST) & BIT(pd);
if (pwrdn_st)
return pmu_pd_off;
else
return pmu_pd_on;
}
static int pmu_power_domain_ctr(uint32_t pd, uint32_t pd_state)
{
uint32_t val;
uint32_t loop = 0;
int ret = 0;
rockchip_pd_lock_get();
val = mmio_read_32(PMU_BASE + PMU_PWRDN_CON);
if (pd_state == pmu_pd_off)
val |= BIT(pd);
else
val &= ~BIT(pd);
mmio_write_32(PMU_BASE + PMU_PWRDN_CON, val);
dsb();
while ((pmu_power_domain_st(pd) != pd_state) && (loop < PD_CTR_LOOP)) {
udelay(1);
loop++;
}
if (pmu_power_domain_st(pd) != pd_state) {
WARN("%s: %d, %d, error!\n", __func__, pd, pd_state);
ret = -EINVAL;
}
rockchip_pd_lock_rls();
return ret;
}
static int check_cpu_wfie(uint32_t cpu_id, uint32_t wfie_msk)
{
uint32_t cluster_id, loop = 0;
if (cpu_id >= PLATFORM_CLUSTER0_CORE_COUNT) {
cluster_id = 1;
cpu_id -= PLATFORM_CLUSTER0_CORE_COUNT;
} else {
cluster_id = 0;
}
if (cluster_id)
wfie_msk <<= (clstb_cpu_wfe + cpu_id);
else
wfie_msk <<= (clstl_cpu_wfe + cpu_id);
while (!(mmio_read_32(PMU_BASE + PMU_CORE_PWR_ST) & wfie_msk) &&
(loop < CHK_CPU_LOOP)) {
udelay(1);
loop++;
}
if ((mmio_read_32(PMU_BASE + PMU_CORE_PWR_ST) & wfie_msk) == 0) {
WARN("%s: %d, %d, %d, error!\n", __func__,
cluster_id, cpu_id, wfie_msk);
return -EINVAL;
}
return 0;
}
#endif /* __PMU_COM_H__ */
|
// Copyright 2017 The Cobalt Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef STARBOARD_RASPI_2_ATOMIC_PUBLIC_H_
#define STARBOARD_RASPI_2_ATOMIC_PUBLIC_H_
#include "starboard/raspi/shared/atomic_public.h"
#endif // STARBOARD_RASPI_2_ATOMIC_PUBLIC_H_
|
/*
* libgit2.c
*/
#include "libgit2.h"
typedef struct GitErrorRec {
ScmError common;
int error_number;
} GitError;
SCM_CLASS_DECL(Git_ErrorClass);
#define GIT_ERROR_CLASS (&Scm_SystemErrorClass)
#define GIT_ERROR(obj) ((GitError*)(obj))
#define GIT_ERROR_P(obj) SCM_XTYPEP(obj, GIT_ERROR_CLASS)
static ScmObj git_error_allocate(ScmClass *klass, ScmObj initargs)
{
GitError *e = SCM_ALLOCATE(GitError, klass);
SCM_SET_CLASS(e, klass);
e->common.message = SCM_FALSE; /* set by initialize */
e->error_number = 0; /* set by initialize */
return SCM_OBJ(e);
}
static ScmClass *error_cpl[] = {
SCM_CLASS_STATIC_PTR(Scm_ErrorClass),
SCM_CLASS_STATIC_PTR(Scm_MessageConditionClass),
SCM_CLASS_STATIC_PTR(Scm_SeriousConditionClass),
SCM_CLASS_STATIC_PTR(Scm_ConditionClass),
SCM_CLASS_STATIC_PTR(Scm_TopClass),
NULL
};
SCM_DEFINE_BUILTIN_CLASS(Git_ErrorClass,
NULL, NULL, NULL,
git_error_allocate, error_cpl);
static ScmObj make_error(ScmObj message, int en)
{
GitError *e =
GIT_ERROR(git_error_allocate(GIT_ERROR_CLASS, SCM_NIL));
e->common.message = SCM_LIST2(message, message);
e->error_number = en;
return SCM_OBJ(e);
}
void Git_Error(int error, const char *msg, ...)
{
ScmObj e;
ScmVM *vm = Scm_VM();
va_list args;
if (SCM_VM_RUNTIME_FLAG_IS_SET(vm, SCM_ERROR_BEING_HANDLED)) {
e = Scm_MakeError(SCM_MAKE_STR("Error occurred in error handler"));
Scm_VMThrowException2(vm, e, SCM_RAISE_NON_CONTINUABLE);
}
SCM_VM_RUNTIME_FLAG_SET(vm, SCM_ERROR_BEING_HANDLED);
SCM_UNWIND_PROTECT {
ScmObj ostr = Scm_MakeOutputStringPort(TRUE);
va_start(args, msg);
Scm_Vprintf(SCM_PORT(ostr), msg, args, TRUE);
va_end(args);
Scm_Printf(SCM_PORT(ostr), ": %A", Scm_MakeInteger(error));
e = make_error(Scm_GetOutputString(SCM_PORT(ostr), 0), error);
}
SCM_WHEN_ERROR {
/* TODO: should check continuation? */
e = Scm_MakeError(SCM_MAKE_STR("Error occurred in error handler"));
}
SCM_END_PROTECT;
Scm_VMThrowException2(vm, e, SCM_RAISE_NON_CONTINUABLE);
Scm_Panic("Scm_Error: Scm_VMThrowException returned. something wrong.");
}
static ScmObj git_error_number_get(GitError *obj)
{
return SCM_MAKE_INT(obj->error_number);
}
static ScmClassStaticSlotSpec git_error_slots[] = {
SCM_CLASS_SLOT_SPEC("error", git_error_number_get, NULL),
SCM_CLASS_SLOT_SPEC_END()
};
/*
* Module initialization function.
*/
extern void Scm_Init_libgit2lib(ScmModule*);
void Scm_Init_libgit2(void)
{
ScmModule *mod;
/* Register this DSO to Gauche */
SCM_INIT_EXTENSION(libgit2);
/* Create the module if it doesn't exist yet. */
mod = SCM_MODULE(SCM_FIND_MODULE("libgit2", TRUE));
ScmClass *cond_meta = Scm_ClassOf(SCM_OBJ(SCM_CLASS_CONDITION));
Scm_InitStaticClassWithMeta(GIT_ERROR_CLASS,
"<git-error>",
mod, cond_meta, SCM_FALSE,
git_error_slots, 0);
/* Register stub-generated procedures */
Scm_Init_libgit2lib(mod);
}
|
/*
* The olsr.org Optimized Link-State Routing daemon(olsrd)
* Copyright (c) 2004-2009, the olsr.org team - see HISTORY file
* 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 olsr.org, olsrd 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.
*
* Visit http://www.olsr.org for more information.
*
* If you find this software useful feel free to make a donation
* to the project. For more information see the website or contact
* the copyright holders.
*
*/
/*
* Dynamic linked library for the olsr.org olsr daemon
*/
#include "olsrd_dot_draw.h"
#include "olsr.h"
#include "defs.h"
#include "olsr_logging.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <netinet/in.h>
#define PLUGIN_NAME "OLSRD dot draw plugin"
#define PLUGIN_VERSION "0.3"
#define PLUGIN_AUTHOR "Andreas Tonnesen"
#define MOD_DESC PLUGIN_NAME " " PLUGIN_VERSION " by " PLUGIN_AUTHOR
#define PLUGIN_INTERFACE_VERSION 5
union olsr_ip_addr ipc_accept_ip;
int ipc_port;
static void my_init(void) __attribute__ ((constructor));
static void my_fini(void) __attribute__ ((destructor));
/**
*Constructor
*/
static void
my_init(void)
{
/* Print plugin info to stdout */
OLSR_INFO(LOG_PLUGINS, "%s\n", MOD_DESC);
/* defaults for parameters */
ipc_port = 2004;
ipc_accept_ip.v4.s_addr = htonl(INADDR_LOOPBACK);
}
/**
*Destructor
*/
static void
my_fini(void)
{
/* Calls the destruction function
* olsr_plugin_exit()
* This function should be present in your
* sourcefile and all data destruction
* should happen there - NOT HERE!
*/
olsr_plugin_exit();
}
int
olsrd_plugin_interface_version(void)
{
return PLUGIN_INTERFACE_VERSION;
}
static const struct olsrd_plugin_parameters plugin_parameters[] = {
{.name = "port",.set_plugin_parameter = &set_plugin_port,.data = &ipc_port},
{.name = "accept",.set_plugin_parameter = &set_plugin_ipaddress,.data = &ipc_accept_ip},
};
void
olsrd_get_plugin_parameters(const struct olsrd_plugin_parameters **params, int *size)
{
*params = plugin_parameters;
*size = ARRAYSIZE(plugin_parameters);
}
/*
* Local Variables:
* mode: c
* style: linux
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
*/
|
/* $NetBSD: darwin_ioframebuffer.h,v 1.10 2003/12/09 17:13:19 manu Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Emmanuel Dreyfus
*
* 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. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 _DARWIN_IOFRAMEBUFFER_H_
#define _DARWIN_IOFRAMEBUFFER_H_
extern struct mach_iokit_devclass darwin_ioframebuffer_devclass;
#define DARWIN_IOFRAMEBUFFER_CURSOR_MEMORY 100
#define DARWIN_IOFRAMEBUFFER_VRAM_MEMORY 110
#define DARWIN_IOFRAMEBUFFER_SYSTEM_APERTURE 0
struct darwin_ioframebuffer_shmem {
darwin_ev_lock_data_t dis_sem;
char dis_cursshow;
char dis_sursobscured;
char dis_shieldflag;
char dis_dhielded;
darwin_iogbounds dis_saverect;
darwin_iogbounds dis_shieldrect;
darwin_iogpoint dis_location;
darwin_iogbounds dis_cursrect;
darwin_iogbounds dis_oldcursrect;
darwin_iogbounds dis_screen;
int version;
darwin_absolutetime dis_vbltime;
darwin_absolutetime dis_vbldelta;
unsigned int dis_reserved1[30];
unsigned char dis_hwcurscapable;
unsigned char dis_hwcursactive;
unsigned char dis_hwcursshields;
unsigned char dis_reserved2;
darwin_iogsize dis_cursorsize[4];
darwin_iogpoint dis_hotspot[4];
unsigned char dis_curs[0];
};
/* I/O selectors for io_connect_method_{scalar|struct}i_{scalar|struct}o */
#define DARWIN_IOFBCREATESHAREDCURSOR 0
#define DARWIN_IOFBGETPIXELINFORMATION 1
#define DARWIN_IOFBGETCURRENTDISPLAYMODE 2
#define DARWIN_IOFBSETSTARTUPDISPLAYMODE 3
#define DARWIN_IOFBSETDISPLAYMODE 4
#define DARWIN_IOFBGETINFORMATIONFORDISPLAYMODE 5
#define DARWIN_IOFBGETDISPLAYMODECOUNT 6
#define DARWIN_IOFBGETDISPLAYCOUNT 7
#define DARWIN_IOFBGETVRAMMAPOFFSET 8
#define DARWIN_IOFBSETBOUNDS 9
#define DARWIN_IOFBSETNEWCURSOR 10
#define DARWIN_IOFBSETGAMMATABLE 11
#define DARWIN_IOFBSETCURSORVISIBLE 12
#define DARWIN_IOFBSETCURSORPOSITION 13
#define DARWIN_IOFBACKNOWLEDGENOTIFICATION 14
#define DARWIN_IOFBSETCOLORCONVERTTABLE 15
#define DARWIN_IOFBSETCLUTWITHENTRIES 16
#define DARWIN_IOFBVALIDATEDETAILEDTIMING 17
#define DARWIN_IOFBGETATTRIBUTE 18
/* For DARWIN_IOFBSETCLUTWITHENTRIES */
typedef uint16_t darwin_iocolorcomponent;
struct darwin_iocolorentry {
uint16_t index;
darwin_iocolorcomponent red;
darwin_iocolorcomponent green;
darwin_iocolorcomponent blue;
};
/* For DARWIN_IOFBCREATESHAREDCURSOR */
#define DARWIN_IOMAXPIXELBITS 64
typedef int32_t darwin_ioindex;
typedef int32_t darwin_iodisplaymodeid;
typedef uint32_t darwin_iobytecount;
typedef darwin_ioindex darwin_iopixelaperture;
typedef char darwin_iopixelencoding[DARWIN_IOMAXPIXELBITS];
/* pixeltype */
#define DARWIN_IOFB_CLUTPIXELS 0;
#define DARWIN_IOFB_FIXEDCLUTPIXELS 1;
#define DARWIN_IOFB_RGBDIRECTPIXELS 2;
#define DARWIN_IOFB_MONODIRECTPIXELS 3;
#define DARWIN_IOFB_MONOINVERSEDIRECTPIXELS 4;
typedef struct {
darwin_iobytecount bytesperrow;
darwin_iobytecount bytesperplane;
uint32_t bitsperpixel;
uint32_t pixeltype;
uint32_t componentcount;
uint32_t bitspercomponent;
uint32_t componentmasks[16];
darwin_iopixelencoding pixelformat;
uint32_t flags;
uint32_t activewidth;
uint32_t activeheight;
uint32_t reserved[2];
} darwin_iopixelinformation;
int
darwin_ioframebuffer_connect_method_scalari_scalaro(struct mach_trap_args *);
int
darwin_ioframebuffer_connect_method_scalari_structo(struct mach_trap_args *);
int
darwin_ioframebuffer_connect_method_structi_structo(struct mach_trap_args *);
int
darwin_ioframebuffer_connect_method_scalari_structi(struct mach_trap_args *);
int darwin_ioframebuffer_connect_map_memory(struct mach_trap_args *);
#endif /* _DARWIN_IOFRAMEBUFFER_H_ */
|
/* Common subexpression elimination for GNU compiler.
Copyright (C) 1987, 88, 89, 92-7, 1998, 1999 Free Software Foundation, Inc.
This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU CC 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 GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* Describe a value. */
typedef struct cselib_val_struct
{
/* The hash value. */
unsigned int value;
union
{
/* A VALUE rtx that points back to this structure. */
rtx val_rtx;
/* Used to keep a list of free cselib_val structures. */
struct cselib_val_struct *next_free;
} u;
/* All rtl expressions that hold this value at the current time during a
scan. */
struct elt_loc_list *locs;
/* If this value is used as an address, points to a list of values that
use it as an address in a MEM. */
struct elt_list *addr_list;
} cselib_val;
/* A list of rtl expressions that hold the same value. */
struct elt_loc_list
{
/* Next element in the list. */
struct elt_loc_list *next;
/* An rtl expression that holds the value. */
rtx loc;
/* The insn that made the equivalence. */
rtx setting_insn;
};
/* A list of cselib_val structures. */
struct elt_list
{
struct elt_list *next;
cselib_val *elt;
};
extern cselib_val *cselib_lookup PARAMS ((rtx, enum machine_mode, int));
extern void cselib_update_varray_sizes PARAMS ((void));
extern void cselib_init PARAMS ((void));
extern void cselib_finish PARAMS ((void));
extern void cselib_process_insn PARAMS ((rtx));
extern int rtx_equal_for_cselib_p PARAMS ((rtx, rtx));
extern int references_value_p PARAMS ((rtx, int));
|
/* $NetBSD: aout_machdep.h,v 1.1 2002/06/06 19:48:07 fredette Exp $ */
#include <hppa/aout_machdep.h>
|
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include <folly/dynamic.h>
#include <ABI38_0_0jsi/ABI38_0_0JSIDynamic.h>
#include <ABI38_0_0jsi/ABI38_0_0jsi.h>
#include <ABI38_0_0React/core/EventHandler.h>
#include <ABI38_0_0React/core/ShadowNode.h>
namespace ABI38_0_0facebook {
namespace ABI38_0_0React {
struct EventHandlerWrapper : public EventHandler {
EventHandlerWrapper(jsi::Function eventHandler)
: callback(std::move(eventHandler)) {}
jsi::Function callback;
};
struct ShadowNodeWrapper : public jsi::HostObject {
ShadowNodeWrapper(SharedShadowNode shadowNode)
: shadowNode(std::move(shadowNode)) {}
SharedShadowNode shadowNode;
};
struct ShadowNodeListWrapper : public jsi::HostObject {
ShadowNodeListWrapper(SharedShadowNodeUnsharedList shadowNodeList)
: shadowNodeList(shadowNodeList) {}
SharedShadowNodeUnsharedList shadowNodeList;
};
inline static SharedShadowNode shadowNodeFromValue(
jsi::Runtime &runtime,
const jsi::Value &value) {
return value.getObject(runtime)
.getHostObject<ShadowNodeWrapper>(runtime)
->shadowNode;
}
inline static jsi::Value valueFromShadowNode(
jsi::Runtime &runtime,
const SharedShadowNode &shadowNode) {
return jsi::Object::createFromHostObject(
runtime, std::make_shared<ShadowNodeWrapper>(shadowNode));
}
inline static SharedShadowNodeUnsharedList shadowNodeListFromValue(
jsi::Runtime &runtime,
const jsi::Value &value) {
return value.getObject(runtime)
.getHostObject<ShadowNodeListWrapper>(runtime)
->shadowNodeList;
}
inline static jsi::Value valueFromShadowNodeList(
jsi::Runtime &runtime,
const SharedShadowNodeUnsharedList &shadowNodeList) {
return jsi::Object::createFromHostObject(
runtime, std::make_unique<ShadowNodeListWrapper>(shadowNodeList));
}
inline static SharedEventTarget eventTargetFromValue(
jsi::Runtime &runtime,
const jsi::Value &eventTargetValue,
const jsi::Value &tagValue) {
return std::make_shared<EventTarget>(
runtime, eventTargetValue, tagValue.getNumber());
}
inline static Tag tagFromValue(jsi::Runtime &runtime, const jsi::Value &value) {
return (Tag)value.getNumber();
}
inline static SurfaceId surfaceIdFromValue(
jsi::Runtime &runtime,
const jsi::Value &value) {
return (SurfaceId)value.getNumber();
}
inline static std::string stringFromValue(
jsi::Runtime &runtime,
const jsi::Value &value) {
return value.getString(runtime).utf8(runtime);
}
inline static folly::dynamic commandArgsFromValue(
jsi::Runtime &runtime,
const jsi::Value &value) {
return jsi::dynamicFromValue(runtime, value);
}
} // namespace ABI38_0_0React
} // namespace ABI38_0_0facebook
|
//
// ALSettingsForDebug.h
// applozicdemo
//
// Created by Divjyot Singh on 16/05/16.
// Copyright © 2016 applozic Inc. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ALSettingsForDebug : UIViewController
@property (weak, nonatomic) IBOutlet UISwitch *contextualChatSwitchOutlet;
@property (weak, nonatomic) IBOutlet UISwitch *backWallaperSwitchOutlet;
@property (weak, nonatomic) IBOutlet UITextField *moduleIDTextField;
@property (weak, nonatomic) IBOutlet UILabel *selectedEnvirnLabel;
@property (weak, nonatomic) IBOutlet UIPickerView *environmentPickerView;
@property (weak, nonatomic) IBOutlet UISwitch *turnNotificationSwitch;
@end
|
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
#include "common_tools.h"
#include "lwjgl_malloc.h"
#include "include/nfd.h"
EXTERN_C_ENTER
JNIEXPORT jint JNICALL Java_org_lwjgl_util_nfd_NativeFileDialog_nNFD_1OpenDialog(JNIEnv *__env, jclass clazz, jlong filterListAddress, jlong defaultPathAddress, jlong outPathAddress) {
nfdchar_t const *filterList = (nfdchar_t const *)(intptr_t)filterListAddress;
nfdchar_t const *defaultPath = (nfdchar_t const *)(intptr_t)defaultPathAddress;
nfdchar_t **outPath = (nfdchar_t **)(intptr_t)outPathAddress;
UNUSED_PARAMS(__env, clazz)
return (jint)NFD_OpenDialog(filterList, defaultPath, outPath);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_util_nfd_NativeFileDialog_nNFD_1OpenDialogMultiple(JNIEnv *__env, jclass clazz, jlong filterListAddress, jlong defaultPathAddress, jlong outPathsAddress) {
nfdchar_t const *filterList = (nfdchar_t const *)(intptr_t)filterListAddress;
nfdchar_t const *defaultPath = (nfdchar_t const *)(intptr_t)defaultPathAddress;
nfdpathset_t *outPaths = (nfdpathset_t *)(intptr_t)outPathsAddress;
UNUSED_PARAMS(__env, clazz)
return (jint)NFD_OpenDialogMultiple(filterList, defaultPath, outPaths);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_util_nfd_NativeFileDialog_nNFD_1SaveDialog(JNIEnv *__env, jclass clazz, jlong filterListAddress, jlong defaultPathAddress, jlong outPathAddress) {
nfdchar_t const *filterList = (nfdchar_t const *)(intptr_t)filterListAddress;
nfdchar_t const *defaultPath = (nfdchar_t const *)(intptr_t)defaultPathAddress;
nfdchar_t **outPath = (nfdchar_t **)(intptr_t)outPathAddress;
UNUSED_PARAMS(__env, clazz)
return (jint)NFD_SaveDialog(filterList, defaultPath, outPath);
}
JNIEXPORT jint JNICALL Java_org_lwjgl_util_nfd_NativeFileDialog_nNFD_1PickFolder(JNIEnv *__env, jclass clazz, jlong defaultPathAddress, jlong outPathAddress) {
nfdchar_t const *defaultPath = (nfdchar_t const *)(intptr_t)defaultPathAddress;
nfdchar_t **outPath = (nfdchar_t **)(intptr_t)outPathAddress;
UNUSED_PARAMS(__env, clazz)
return (jint)NFD_PickFolder(defaultPath, outPath);
}
JNIEXPORT jlong JNICALL Java_org_lwjgl_util_nfd_NativeFileDialog_nNFD_1GetError(JNIEnv *__env, jclass clazz) {
UNUSED_PARAMS(__env, clazz)
return (jlong)(intptr_t)NFD_GetError();
}
JNIEXPORT jlong JNICALL Java_org_lwjgl_util_nfd_NativeFileDialog_nNFD_1PathSet_1GetCount(JNIEnv *__env, jclass clazz, jlong pathSetAddress) {
nfdpathset_t const *pathSet = (nfdpathset_t const *)(intptr_t)pathSetAddress;
UNUSED_PARAMS(__env, clazz)
return (jlong)NFD_PathSet_GetCount(pathSet);
}
JNIEXPORT jlong JNICALL Java_org_lwjgl_util_nfd_NativeFileDialog_nNFD_1PathSet_1GetPath(JNIEnv *__env, jclass clazz, jlong pathSetAddress, jlong index) {
nfdpathset_t const *pathSet = (nfdpathset_t const *)(intptr_t)pathSetAddress;
UNUSED_PARAMS(__env, clazz)
return (jlong)(intptr_t)NFD_PathSet_GetPath(pathSet, (size_t)index);
}
JNIEXPORT void JNICALL Java_org_lwjgl_util_nfd_NativeFileDialog_nNFD_1PathSet_1Free(JNIEnv *__env, jclass clazz, jlong pathSetAddress) {
nfdpathset_t *pathSet = (nfdpathset_t *)(intptr_t)pathSetAddress;
UNUSED_PARAMS(__env, clazz)
NFD_PathSet_Free(pathSet);
}
JNIEXPORT void JNICALL Java_org_lwjgl_util_nfd_NativeFileDialog_nNFD_1Free(JNIEnv *__env, jclass clazz, jlong outPathAddress) {
void *outPath = (void *)(intptr_t)outPathAddress;
UNUSED_PARAMS(__env, clazz)
NFD_Free(outPath);
}
EXTERN_C_EXIT
|
/*
* This file is part of the Soletta Project
*
* Copyright (C) 2015 Intel Corporation. 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 Intel Corporation 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
#include <stdbool.h>
#include <systemd/sd-bus.h>
struct sol_bus_properties {
const char *member;
bool (*set)(void *data, sd_bus_message *m);
};
sd_bus *sol_bus_get(void (*bus_initialized)(sd_bus *bus));
void sol_bus_close(void);
int sol_bus_map_cached_properties(sd_bus *bus,
const char *dest, const char *path, const char *iface,
const struct sol_bus_properties property_table[],
void (*changed)(void *data, uint64_t mask),
const void *data);
int sol_bus_unmap_cached_properties(const struct sol_bus_properties property_table[],
const void *data);
/* convenience methods */
int sol_bus_log_callback(sd_bus_message *reply, void *userdata,
sd_bus_error *ret_error);
|
#ifndef FEATURES_MESSAGE_H
#define FEATURES_MESSAGE_H
/// PROJECT
#include <csapex/msg/message_template.hpp>
#include <csapex_ml/csapex_ml_export.h>
#include <csapex/utility/yaml.h>
namespace csapex
{
namespace connection_types
{
struct CSAPEX_ML_EXPORT FeaturesMessage : public Message
{
protected:
CLONABLE_IMPLEMENTATION(FeaturesMessage);
public:
enum class Type
{
CLASSIFICATION = 0,
REGRESSION = 1
};
static const int INVALID_LABEL = -1;
typedef std::shared_ptr<FeaturesMessage> Ptr;
typedef std::shared_ptr<FeaturesMessage const> ConstPtr;
FeaturesMessage(Type type, Message::Stamp stamp_micro_seconds = 0);
FeaturesMessage(Message::Stamp stamp_micro_seconds = 0);
std::vector<float> value;
Type type;
int classification;
std::vector<float> regression_result;
float confidence;
};
/// TRAITS
template <>
struct CSAPEX_ML_EXPORT type<FeaturesMessage>
{
static std::string name()
{
return "FeaturesMessage";
}
};
} // namespace connection_types
} // namespace csapex
/// YAML
namespace YAML
{
template <>
struct CSAPEX_ML_EXPORT convert<csapex::connection_types::FeaturesMessage>
{
static Node encode(const csapex::connection_types::FeaturesMessage& rhs);
static bool decode(const Node& node, csapex::connection_types::FeaturesMessage& rhs);
};
} // namespace YAML
#endif // FEATURES_MESSAGE_H
|
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_COMMON_SERVICE_WORKER_SERVICE_WORKER_LOADER_HELPERS_H_
#define CONTENT_COMMON_SERVICE_WORKER_SERVICE_WORKER_LOADER_HELPERS_H_
#include "base/containers/flat_map.h"
#include "base/optional.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "net/http/http_request_headers.h"
#include "net/url_request/redirect_info.h"
#include "services/network/public/mojom/url_response_head.mojom-forward.h"
#include "third_party/blink/public/mojom/blob/blob.mojom.h"
#include "third_party/blink/public/mojom/fetch/fetch_api_response.mojom.h"
namespace network {
struct ResourceRequest;
}
namespace content {
// Helper functions for service worker classes that use URLLoader
//(e.g., ServiceWorkerNavigationLoader and ServiceWorkerSubresourceLoader).
class ServiceWorkerLoaderHelpers {
public:
// Populates |out_head->headers| with the given |status_code|, |status_text|,
// and |headers|.
static void SaveResponseHeaders(
const int status_code,
const std::string& status_text,
const base::flat_map<std::string, std::string>& headers,
network::mojom::URLResponseHead* out_head);
// Populates |out_head| (except for headers) with given |response|.
static void SaveResponseInfo(const blink::mojom::FetchAPIResponse& response,
network::mojom::URLResponseHead* out_head);
// Returns a redirect info if |response_head| is an redirect response.
// Otherwise returns base::nullopt.
static base::Optional<net::RedirectInfo> ComputeRedirectInfo(
const network::ResourceRequest& original_request,
const network::mojom::URLResponseHead& response_head);
// Reads |blob| into |handle_out|. Calls |on_blob_read_complete| when done or
// if an error occurred. Currently this always returns net::OK but
// the plan is to return an error if reading couldn't start, in
// which case |on_blob_read_complete| isn't called.
static int ReadBlobResponseBody(
mojo::Remote<blink::mojom::Blob>* blob,
uint64_t blob_size,
base::OnceCallback<void(int net_error)> on_blob_read_complete,
mojo::ScopedDataPipeConsumerHandle* handle_out);
};
} // namespace content
#endif // CONTENT_COMMON_SERVICE_WORKER_SERVICE_WORKER_LOADER_HELPERS_H_
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SERVICE_H_
#define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SERVICE_H_
#include <vector>
#include "base/basictypes.h"
#include "base/callback_forward.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "components/browser_context_keyed_service/browser_context_keyed_service.h"
class ChromeDownloadManagerDelegate;
class DownloadHistory;
class DownloadUIController;
class ExtensionDownloadsEventRouter;
class Profile;
namespace content {
class DownloadManager;
}
// Owning class for ChromeDownloadManagerDelegate.
class DownloadService : public ProfileKeyedService {
public:
explicit DownloadService(Profile* profile);
virtual ~DownloadService();
// Get the download manager delegate, creating it if it doesn't already exist.
ChromeDownloadManagerDelegate* GetDownloadManagerDelegate();
// Get the interface to the history system. Returns NULL if profile is
// incognito or if the DownloadManager hasn't been created yet or if there is
// no HistoryService for profile.
DownloadHistory* GetDownloadHistory();
#if !defined(OS_ANDROID)
ExtensionDownloadsEventRouter* GetExtensionEventRouter() {
return extension_event_router_.get();
}
#endif
// Has a download manager been created?
bool HasCreatedDownloadManager();
// Number of downloads associated with this instance of the service.
int DownloadCount() const;
// Number of downloads associated with all profiles.
static int DownloadCountAllProfiles();
// Sets the DownloadManagerDelegate associated with this object and
// its DownloadManager. Takes ownership of |delegate|, and destroys
// the previous delegate. For testing.
void SetDownloadManagerDelegateForTesting(
ChromeDownloadManagerDelegate* delegate);
// Will be called to release references on other services as part
// of Profile shutdown.
virtual void Shutdown() OVERRIDE;
private:
bool download_manager_created_;
Profile* profile_;
// ChromeDownloadManagerDelegate may be the target of callbacks from
// the history service/DB thread and must be kept alive for those
// callbacks.
scoped_refptr<ChromeDownloadManagerDelegate> manager_delegate_;
scoped_ptr<DownloadHistory> download_history_;
// The UI controller is responsible for observing the download manager and
// notifying the UI of any new downloads. Its lifetime matches that of the
// associated download manager.
scoped_ptr<DownloadUIController> download_ui_;
// On Android, GET downloads are not handled by the DownloadManager.
// Once we have extensions on android, we probably need the EventRouter
// in ContentViewDownloadDelegate which knows about both GET and POST
// downloads.
#if !defined(OS_ANDROID)
// The ExtensionDownloadsEventRouter dispatches download creation, change, and
// erase events to extensions. Like ChromeDownloadManagerDelegate, it's a
// chrome-level concept and its lifetime should match DownloadManager. There
// should be a separate EDER for on-record and off-record managers.
// There does not appear to be a separate ExtensionSystem for on-record and
// off-record profiles, so ExtensionSystem cannot own the EDER.
scoped_ptr<ExtensionDownloadsEventRouter> extension_event_router_;
#endif
DISALLOW_COPY_AND_ASSIGN(DownloadService);
};
#endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SERVICE_H_
|
#include "jellyfish.h"
/*
* struct jellyfish_ObjectReturn
{
//* ANSI C/C++ Variable requirement
double DoubleResultReturn ;
int IntResultReturn ;
char* StringReturn ;
// Python Variable requirement
PyObject *ObjectErrorReturn ;
// Ruby Variable requirement
unsigned long RubyValue ;
unsigned long RubyID ;
char *StringValuePtr ;
char *ConstStringValue ;
struct RBasic RubyBasicType ;
struct RObject RubyObjectType ;
struct RClass RubyClassType ;
struct RFloat RubyFloatType ;
struct RString RubyStringType ;
struct RArray RubyArrayType ;
struct RRegexp RubyRegexpType ;
struct RHash RubyHashType ;
};
*/
PyObjPolypodiozoa* levenshtein_distance(const char *s1, const char *s2)
{
size_t s1_len = strlen(s1);
size_t s2_len = strlen(s2);
size_t rows = s1_len + 1;
size_t cols = s2_len + 1;
size_t i, j;
unsigned result;
unsigned d1, d2, d3;
unsigned *dist = malloc(rows * cols * sizeof(unsigned));
if (!dist)
{
return -1;
}
for (i = 0; i < rows; i++)
{
dist[i * cols] = i;
}
for (j = 0; j < cols; j++)
{
dist[j] = j;
}
for (j = 1; j < cols; j++)
{
for (i = 1; i < rows; i++)
{
if (s1[i - 1] == s2[j - 1])
{
dist[(i * cols) + j] = dist[((i - 1) * cols) + (j - 1)];
}
else
{
d1 = dist[((i - 1) * cols) + j] + 1;
d2 = dist[(i * cols) + (j - 1)] + 1;
d3 = dist[((i - 1) * cols) + (j - 1)] + 1;
dist[(i * cols) + j] = MIN(d1, MIN(d2, d3));
}
}
}
result = dist[(cols * rows) - 1];
free(dist);
return result;
}
|
// Copyright 2021 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 SERVICES_AUDIO_OUTPUT_DEVICE_MIXER_MANAGER_H_
#define SERVICES_AUDIO_OUTPUT_DEVICE_MIXER_MANAGER_H_
#include <memory>
#include <set>
#include <string>
#include "base/callback.h"
#include "base/containers/flat_map.h"
#include "base/feature_list.h"
#include "base/memory/weak_ptr.h"
#include "base/sequence_checker.h"
#include "media/base/audio_parameters.h"
#include "services/audio/device_output_listener.h"
#include "services/audio/output_device_mixer.h"
#include "services/audio/reference_output.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
namespace media {
class AudioManager;
class AudioOutputStream;
} // namespace media
namespace audio {
// Creates OutputDeviceMixers as needed, when playback is requested through
// MakeOutputStream(). OutputDeviceMixers are destroyed on device change, or
// when the Audio service shuts down, but are not cleaned up otherwise.
// Listening to a device has no effect, until that device's OutputDeviceMixer is
// created and playback has started.
class OutputDeviceMixerManager : public DeviceOutputListener {
public:
OutputDeviceMixerManager(
media::AudioManager* audio_manager,
OutputDeviceMixer::CreateCallback create_mixer_callback);
OutputDeviceMixerManager(const OutputDeviceMixerManager&) = delete;
OutputDeviceMixerManager& operator=(const OutputDeviceMixerManager&) = delete;
~OutputDeviceMixerManager() override;
// Makes an output stream for the given output device.
// The returned stream must be closed synchronously from
// |close_stream_on_device_change|.
media::AudioOutputStream* MakeOutputStream(
const std::string& device_id,
const media::AudioParameters& params,
base::OnceClosure close_stream_on_device_change);
// DeviceOutputListener implementation
void StartListening(ReferenceOutput::Listener* listener,
const std::string& device_id) final;
void StopListening(ReferenceOutput::Listener* listener,
const std::string& device_id) final;
private:
friend class OutputDeviceMixerManagerTest;
using ListenerSet = std::set<ReferenceOutput::Listener*>;
using OutputDeviceMixers = std::vector<std::unique_ptr<OutputDeviceMixer>>;
using DeviceToListenersMap = base::flat_map<std::string, ListenerSet>;
// Forwards device change notifications to OutputDeviceMixers.
void OnDeviceChange();
// Returns the current physical default device ID, which can change after
// OnDeviceChange().
const std::string& GetCurrentDefaultDeviceId();
// Returns |device_id|, or the current default device ID if |device_id| is
// the default ID.
const std::string& ConvertToPhysicalDeviceId(const std::string& device_id);
// Returns a callback that call OnDeviceChange(), and that can be cancelled
// through invalidating |device_change_weak_ptr_factory_|.
// This is split out into its own method to simplify UTs.
base::OnceClosure GetOnDeviceChangeCallback();
media::AudioOutputStream* CreateMixerOwnedStream(
const std::string& device_id,
const media::AudioParameters& params);
media::AudioOutputStream* CreateDeviceListenerStream(
base::OnceClosure on_device_change_callback,
const std::string& device_id,
const media::AudioParameters& params);
void AttachListenersById(const std::string& device_id,
OutputDeviceMixer* mixer);
// Returns a mixer if it exists, or nullptr otherwise.
OutputDeviceMixer* FindMixer(const std::string& physical_device_id);
// Creates and returns a new mixer, or nullptr if the creation failed.
OutputDeviceMixer* AddMixer(const std::string& physical_device_id);
SEQUENCE_CHECKER(owning_sequence_);
absl::optional<std::string> current_default_device_id_ = absl::nullopt;
media::AudioManager* const audio_manager_;
OutputDeviceMixer::CreateCallback create_mixer_callback_;
OutputDeviceMixers output_device_mixers_;
DeviceToListenersMap device_id_to_listeners_;
base::WeakPtrFactory<OutputDeviceMixerManager> device_change_weak_ptr_factory_
GUARDED_BY_CONTEXT(owning_sequence_);
};
} // namespace audio
#endif // SERVICES_AUDIO_OUTPUT_DEVICE_MIXER_MANAGER_H_
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef NET_QUIC_QUIC_SERVER_INFO_H_
#define NET_QUIC_QUIC_SERVER_INFO_H_
#include <memory>
#include <string>
#include <vector>
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/time/time.h"
#include "net/third_party/quic/core/quic_server_id.h"
#include "net/third_party/quic/platform/api/quic_export.h"
namespace net {
// QuicServerInfo is an interface for fetching information about a QUIC server.
// This information may be stored on disk so does not include keys or other
// sensitive information. Primarily it's intended for caching the QUIC server's
// crypto config.
class QUIC_EXPORT_PRIVATE QuicServerInfo {
public:
// Enum to track failure reasons to read/load/write of QuicServerInfo to
// and from disk cache.
enum FailureReason {
WAIT_FOR_DATA_READY_INVALID_ARGUMENT_FAILURE = 0,
GET_BACKEND_FAILURE = 1,
OPEN_FAILURE = 2,
CREATE_OR_OPEN_FAILURE = 3,
PARSE_NO_DATA_FAILURE = 4,
PARSE_FAILURE = 5,
READ_FAILURE = 6,
READY_TO_PERSIST_FAILURE = 7,
PERSIST_NO_BACKEND_FAILURE = 8,
WRITE_FAILURE = 9,
NO_FAILURE = 10,
PARSE_DATA_DECODE_FAILURE = 11,
NUM_OF_FAILURES = 12,
};
explicit QuicServerInfo(const quic::QuicServerId& server_id);
virtual ~QuicServerInfo();
// Fetches the server config from the backing store, and returns true
// if the server config was found.
virtual bool Load() = 0;
// Persist allows for the server information to be updated for future uses.
virtual void Persist() = 0;
// Returns the size of dynamically allocated memory in bytes.
virtual size_t EstimateMemoryUsage() const = 0;
struct State {
State();
~State();
void Clear();
// This class matches QuicClientCryptoConfig::CachedState.
std::string server_config; // A serialized handshake message.
std::string source_address_token; // An opaque proof of IP ownership.
std::string cert_sct; // Signed timestamp of the leaf cert.
std::string chlo_hash; // Hash of the CHLO message.
std::vector<std::string> certs; // A list of certificates in leaf-first
// order.
std::string server_config_sig; // A signature of |server_config_|.
private:
DISALLOW_COPY_AND_ASSIGN(State);
};
// Once the data is ready, it can be read using the following members. These
// members can then be updated before calling |Persist|.
const State& state() const;
State* mutable_state();
protected:
// Parse parses pickled data and fills out the public member fields of this
// object. It returns true iff the parse was successful. The public member
// fields will be set to something sane in any case.
bool Parse(const std::string& data);
std::string Serialize();
State state_;
// This is the QUIC server (hostname, port, is_https, privacy_mode) tuple for
// which we restore the crypto_config.
const quic::QuicServerId server_id_;
private:
// ParseInner is a helper function for Parse.
bool ParseInner(const std::string& data);
// SerializeInner is a helper function for Serialize.
std::string SerializeInner() const;
DISALLOW_COPY_AND_ASSIGN(QuicServerInfo);
};
} // namespace net
#endif // NET_QUIC_QUIC_SERVER_INFO_H_
|
/*
* Copyright (c) 2005, Peter Sommerlad and IFS Institute for Software at HSR Rapperswil, Switzerland
* All rights reserved.
*
* This library/application is free software; you can redistribute and/or modify it under the terms of
* the license that is included with this library/application in the file license.txt.
*/
#ifndef _EmailAddressCheckAction_H
#define _EmailAddressCheckAction_H
#include "NotEmptyCheckAction.h"
//---- EmailAddressCheckAction ----------------------------------------------------------
//! <B>Primitiv check for valid email address.</B><BR>Configuration:
//! <PRE>
//! {
//! /FieldName { Rendererspec } # mandatory, field that is checked, if missing false is returned
//! /SearchBase { Rendererspec } # optional, default is query["FieldName"] but can be like "AnySlot.InAStore"
//! }
//! </PRE>
//! Checks if the field contains a least @ and at least one . afterwards and no but trailing blanks
//! If further enhancements are needed, think of a RegExp checking action
class EmailAddressCheckAction : public NotEmptyCheckAction
{
public:
//--- constructors
EmailAddressCheckAction(const char *name);
~EmailAddressCheckAction();
protected:
//!Checks if the String fieldToCheck contains a formal valid email address
//! \param fieldToCheck the String to be checked
//! \param ctx the context the action runs within.
//! \param config the configuration of the action.
//! \return true if fieldToCheck contains a formal valid email address
virtual bool DoCheck(String &fieldToCheck, Context &ctx, const ROAnything &config);
};
#endif
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_ASH_LOGIN_ENROLLMENT_AUTO_ENROLLMENT_CHECK_SCREEN_H_
#define CHROME_BROWSER_ASH_LOGIN_ENROLLMENT_AUTO_ENROLLMENT_CHECK_SCREEN_H_
#include <memory>
#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/ash/login/enrollment/auto_enrollment_check_screen_view.h"
#include "chrome/browser/ash/login/enrollment/auto_enrollment_controller.h"
// TODO(https://crbug.com/1164001): move to forward declaration.
#include "chrome/browser/ash/login/error_screens_histogram_helper.h"
#include "chrome/browser/ash/login/screens/base_screen.h"
#include "chrome/browser/ash/login/screens/error_screen.h"
#include "chrome/browser/ash/login/screens/network_error.h"
#include "chromeos/network/portal_detector/network_portal_detector.h"
namespace ash {
// Handles the control flow after OOBE auto-update completes to wait for the
// enterprise auto-enrollment check that happens as part of OOBE. This includes
// keeping track of current auto-enrollment state and displaying and updating
// the error screen upon failures. Similar to a screen controller, but it
// doesn't actually drive a dedicated screen.
class AutoEnrollmentCheckScreen
: public AutoEnrollmentCheckScreenView::Delegate,
public BaseScreen,
public NetworkPortalDetector::Observer {
public:
using TView = AutoEnrollmentCheckScreenView;
AutoEnrollmentCheckScreen(AutoEnrollmentCheckScreenView* view,
ErrorScreen* error_screen,
const base::RepeatingClosure& exit_callback);
AutoEnrollmentCheckScreen(const AutoEnrollmentCheckScreen&) = delete;
AutoEnrollmentCheckScreen& operator=(const AutoEnrollmentCheckScreen&) =
delete;
~AutoEnrollmentCheckScreen() override;
// Clears the cached state causing the forced enrollment check to be retried.
void ClearState();
void set_auto_enrollment_controller(
AutoEnrollmentController* auto_enrollment_controller) {
auto_enrollment_controller_ = auto_enrollment_controller;
}
void set_exit_callback_for_testing(const base::RepeatingClosure& callback) {
exit_callback_ = callback;
}
// AutoEnrollmentCheckScreenView::Delegate implementation:
void OnViewDestroyed(AutoEnrollmentCheckScreenView* view) override;
// NetworkPortalDetector::Observer implementation:
void OnPortalDetectionCompleted(
const NetworkState* network,
const NetworkPortalDetector::CaptivePortalStatus status) override;
protected:
// BaseScreen:
void ShowImpl() override;
void HideImpl() override;
// Runs `exit_callback_` - used to prevent `exit_callback_` from running after
// `this` has been destroyed (by wrapping it with a callback bound to a weak
// ptr).
void RunExitCallback() { exit_callback_.Run(); }
private:
// Handles update notifications regarding the auto-enrollment check.
void OnAutoEnrollmentCheckProgressed(policy::AutoEnrollmentState state);
// Handles a state update, updating the UI and saving the state.
void UpdateState();
// Configures the UI to reflect `new_captive_portal_status`. Returns true if
// and only if a UI change has been made.
bool UpdateCaptivePortalStatus(
NetworkPortalDetector::CaptivePortalStatus new_captive_portal_status);
// Configures the UI to reflect `new_auto_enrollment_state`. Returns true if
// and only if a UI change has been made.
bool UpdateAutoEnrollmentState(
policy::AutoEnrollmentState new_auto_enrollment_state);
// Configures the error screen.
void ShowErrorScreen(NetworkError::ErrorState error_state);
// Passed as a callback to the error screen when it's shown. Called when the
// error screen gets hidden.
void OnErrorScreenHidden();
// Asynchronously signals completion. The owner might destroy `this` in
// response, so no code should be run after the completion of a message loop
// task, in which this function was called.
void SignalCompletion();
// Returns whether enrollment check was completed and decision was made.
bool IsCompleted() const;
// The user requested a connection attempt to be performed.
void OnConnectRequested();
// Returns true if an error response from the server should cause a network
// error screen to be displayed and block the wizard from continuing. If false
// is returned, an error response from the server is treated as "no enrollment
// necessary".
bool ShouldBlockOnServerError() const;
AutoEnrollmentCheckScreenView* view_;
ErrorScreen* error_screen_;
base::RepeatingClosure exit_callback_;
AutoEnrollmentController* auto_enrollment_controller_;
base::CallbackListSubscription auto_enrollment_progress_subscription_;
NetworkPortalDetector::CaptivePortalStatus captive_portal_status_;
policy::AutoEnrollmentState auto_enrollment_state_;
std::unique_ptr<ErrorScreensHistogramHelper> histogram_helper_;
base::CallbackListSubscription connect_request_subscription_;
base::WeakPtrFactory<AutoEnrollmentCheckScreen> weak_ptr_factory_{this};
};
} // namespace ash
// TODO(https://crbug.com/1164001): remove after the //chrome/browser/chromeos
// source migration is finished.
namespace chromeos {
using ::ash::AutoEnrollmentCheckScreen;
}
#endif // CHROME_BROWSER_ASH_LOGIN_ENROLLMENT_AUTO_ENROLLMENT_CHECK_SCREEN_H_
|
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_DOWNLOAD_INTERNAL_BACKGROUND_SERVICE_BLOB_TASK_PROXY_H_
#define COMPONENTS_DOWNLOAD_INTERNAL_BACKGROUND_SERVICE_BLOB_TASK_PROXY_H_
#include <memory>
#include <string>
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/task/single_thread_task_runner.h"
#include "storage/browser/blob/blob_storage_constants.h"
namespace storage {
class BlobDataHandle;
class BlobStorageContext;
} // namespace storage
namespace download {
// Proxy for blob related task on IO thread.
// Created on main thread and do work on IO thread, destroyed on IO thread.
class BlobTaskProxy {
public:
using BlobContextGetter =
base::RepeatingCallback<base::WeakPtr<storage::BlobStorageContext>()>;
using BlobDataHandleCallback =
base::OnceCallback<void(std::unique_ptr<storage::BlobDataHandle>,
storage::BlobStatus status)>;
static std::unique_ptr<BlobTaskProxy> Create(
BlobContextGetter blob_context_getter,
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner);
BlobTaskProxy(BlobContextGetter blob_context_getter,
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner);
BlobTaskProxy(const BlobTaskProxy&) = delete;
BlobTaskProxy& operator=(const BlobTaskProxy&) = delete;
~BlobTaskProxy();
// Save blob data on UI thread. |callback| will be called on main thread after
// blob construction completes.
void SaveAsBlob(std::unique_ptr<std::string> data,
BlobDataHandleCallback callback);
private:
void InitializeOnIO(BlobContextGetter blob_context_getter);
void SaveAsBlobOnIO(std::unique_ptr<std::string> data,
BlobDataHandleCallback callback);
void BlobSavedOnIO(BlobDataHandleCallback callback,
storage::BlobStatus status);
scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
// Used to build blob data, must accessed on |io_task_runner_|.
base::WeakPtr<storage::BlobStorageContext> blob_storage_context_;
// Used to access blob storage context.
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
// BlobDataHandle that will be eventually passed to main thread.
std::unique_ptr<storage::BlobDataHandle> blob_data_handle_;
// Bounded to IO thread task runner.
base::WeakPtrFactory<BlobTaskProxy> weak_ptr_factory_{this};
};
} // namespace download
#endif // COMPONENTS_DOWNLOAD_INTERNAL_BACKGROUND_SERVICE_BLOB_TASK_PROXY_H_
|
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_CHROMEOS_SMB_CLIENT_DISCOVERY_HOST_LOCATOR_H_
#define CHROME_BROWSER_CHROMEOS_SMB_CLIENT_DISCOVERY_HOST_LOCATOR_H_
#include <map>
#include <string>
#include "base/callback.h"
#include "net/base/ip_address.h"
namespace chromeos {
namespace smb_client {
using Hostname = std::string;
using Address = net::IPAddress;
using HostMap = std::map<Hostname, Address>;
// |success| will be false if an error occurred when finding hosts. |success|
// can be true even if |hosts| is empty.
using FindHostsCallback =
base::OnceCallback<void(bool success, const HostMap& hosts)>;
// Interface that abstracts the multiple methods of finding SMB hosts in a
// network. (e.g. mDNS, NetBIOS over TCP, LMHosts, DNS)
class HostLocator {
public:
HostLocator() = default;
virtual ~HostLocator() = default;
// Finds hosts in the local network. |callback| will be called once finished
// finding all the hosts. If no hosts are found, an empty map will be passed
// in the |callback|.
virtual void FindHosts(FindHostsCallback callback) = 0;
private:
DISALLOW_COPY_AND_ASSIGN(HostLocator);
};
} // namespace smb_client
} // namespace chromeos
#endif // CHROME_BROWSER_CHROMEOS_SMB_CLIENT_DISCOVERY_HOST_LOCATOR_H_
|
/*
Copyright (c) 2014, Jeff Koftinoff
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 {organization} 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.
*/
#include "jdksavb_world.h"
#ifndef TODO
const char *jdksavb_gptp_file = "jdksavb_gptp.c";
#endif
|
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include <CoreFoundation/CFRunLoop.h>
#include <CoreFoundation/CoreFoundation.h>
#include <ABI42_0_0React/core/EventBeat.h>
#include <ABI42_0_0React/utils/RuntimeExecutor.h>
namespace ABI42_0_0facebook {
namespace ABI42_0_0React {
/*
* Event beat associated with main run loop cycle.
* The callback is always called on the main thread.
*/
class MainRunLoopEventBeat final : public EventBeat {
public:
MainRunLoopEventBeat(
EventBeat::SharedOwnerBox const &ownerBox,
RuntimeExecutor runtimeExecutor);
~MainRunLoopEventBeat();
void induce() const override;
private:
void lockExecutorAndBeat() const;
const RuntimeExecutor runtimeExecutor_;
CFRunLoopObserverRef mainRunLoopObserver_;
};
} // namespace ABI42_0_0React
} // namespace ABI42_0_0facebook
|
/*-
* Copyright (c) 2001-2003, Shunsuke Akiyama <akiyama@FreeBSD.org>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 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.
*
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: releng/9.3/sys/dev/usb/net/ruephy.c 235000 2012-05-04 15:05:30Z hselasky $");
/*
* driver for RealTek RTL8150 internal PHY
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/socket.h>
#include <sys/bus.h>
#include <net/if.h>
#include <net/if_arp.h>
#include <net/if_media.h>
#include <dev/mii/mii.h>
#include <dev/mii/miivar.h>
#include "miidevs.h"
#include <dev/usb/net/ruephyreg.h>
#include "miibus_if.h"
static int ruephy_probe(device_t);
static int ruephy_attach(device_t);
static device_method_t ruephy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, ruephy_probe),
DEVMETHOD(device_attach, ruephy_attach),
DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
DEVMETHOD_END
};
static devclass_t ruephy_devclass;
static driver_t ruephy_driver = {
.name = "ruephy",
.methods = ruephy_methods,
.size = sizeof(struct mii_softc)
};
DRIVER_MODULE(ruephy, miibus, ruephy_driver, ruephy_devclass, 0, 0);
static int ruephy_service(struct mii_softc *, struct mii_data *, int);
static void ruephy_reset(struct mii_softc *);
static void ruephy_status(struct mii_softc *);
/*
* The RealTek RTL8150 internal PHY doesn't have vendor/device ID
* registers; rue(4) fakes up a return value of all zeros.
*/
static const struct mii_phydesc ruephys[] = {
{ 0, 0, "RealTek RTL8150 internal media interface" },
MII_PHY_END
};
static const struct mii_phy_funcs ruephy_funcs = {
ruephy_service,
ruephy_status,
ruephy_reset
};
static int
ruephy_probe(device_t dev)
{
if (strcmp(device_get_name(device_get_parent(device_get_parent(dev))),
"rue") == 0)
return (mii_phy_dev_probe(dev, ruephys, BUS_PROBE_DEFAULT));
return (ENXIO);
}
static int
ruephy_attach(device_t dev)
{
mii_phy_dev_attach(dev, MIIF_NOISOLATE | MIIF_NOMANPAUSE,
&ruephy_funcs, 1);
return (0);
}
static int
ruephy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
{
struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
int reg;
switch (cmd) {
case MII_POLLSTAT:
break;
case MII_MEDIACHG:
/*
* If the interface is not up, don't do anything.
*/
if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
break;
mii_phy_setmedia(sc);
break;
case MII_TICK:
/*
* Is the interface even up?
*/
if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
return (0);
/*
* Only used for autonegotiation.
*/
if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO)
break;
/*
* Check to see if we have link. If we do, we don't
* need to restart the autonegotiation process. Read
* the MSR twice in case it's latched.
*/
reg = PHY_READ(sc, RUEPHY_MII_MSR) |
PHY_READ(sc, RUEPHY_MII_MSR);
if (reg & RUEPHY_MSR_LINK)
break;
/* Only retry autonegotiation every mii_anegticks seconds. */
if (sc->mii_ticks <= sc->mii_anegticks)
break;
sc->mii_ticks = 0;
PHY_RESET(sc);
if (mii_phy_auto(sc) == EJUSTRETURN)
return (0);
break;
}
/* Update the media status. */
PHY_STATUS(sc);
/* Callback if something changed. */
mii_phy_update(sc, cmd);
return (0);
}
static void
ruephy_reset(struct mii_softc *sc)
{
mii_phy_reset(sc);
/*
* XXX RealTek RTL8150 PHY doesn't set the BMCR properly after
* XXX reset, which breaks autonegotiation.
*/
PHY_WRITE(sc, MII_BMCR, (BMCR_S100 | BMCR_AUTOEN | BMCR_FDX));
}
static void
ruephy_status(struct mii_softc *phy)
{
struct mii_data *mii = phy->mii_pdata;
struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
int bmsr, bmcr, msr;
mii->mii_media_status = IFM_AVALID;
mii->mii_media_active = IFM_ETHER;
msr = PHY_READ(phy, RUEPHY_MII_MSR) | PHY_READ(phy, RUEPHY_MII_MSR);
if (msr & RUEPHY_MSR_LINK)
mii->mii_media_status |= IFM_ACTIVE;
bmcr = PHY_READ(phy, MII_BMCR);
if (bmcr & BMCR_ISO) {
mii->mii_media_active |= IFM_NONE;
mii->mii_media_status = 0;
return;
}
bmsr = PHY_READ(phy, MII_BMSR) | PHY_READ(phy, MII_BMSR);
if (bmcr & BMCR_AUTOEN) {
if ((bmsr & BMSR_ACOMP) == 0) {
/* Erg, still trying, I guess... */
mii->mii_media_active |= IFM_NONE;
return;
}
if (msr & RUEPHY_MSR_SPEED100)
mii->mii_media_active |= IFM_100_TX;
else
mii->mii_media_active |= IFM_10_T;
if (msr & RUEPHY_MSR_DUPLEX)
mii->mii_media_active |=
IFM_FDX | mii_phy_flowstatus(phy);
else
mii->mii_media_active |= IFM_HDX;
} else
mii->mii_media_active = ife->ifm_media;
}
|
/*
Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
Copyright (C) 2008 Apple Inc. All rights reserved.
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 THIRD_PARTY_BLINK_RENDERER_MODULES_PLUGINS_DOM_PLUGIN_ARRAY_H_
#define THIRD_PARTY_BLINK_RENDERER_MODULES_PLUGINS_DOM_PLUGIN_ARRAY_H_
#include "third_party/blink/renderer/core/execution_context/execution_context_lifecycle_observer.h"
#include "third_party/blink/renderer/core/page/plugins_changed_observer.h"
#include "third_party/blink/renderer/modules/plugins/dom_plugin.h"
#include "third_party/blink/renderer/platform/bindings/script_wrappable.h"
#include "third_party/blink/renderer/platform/heap/handle.h"
#include "third_party/blink/renderer/platform/weborigin/security_origin.h"
#include "third_party/blink/renderer/platform/wtf/forward.h"
namespace blink {
class LocalFrame;
class PluginData;
class DOMPluginArray final : public ScriptWrappable,
public ExecutionContextLifecycleObserver,
public PluginsChangedObserver {
DEFINE_WRAPPERTYPEINFO();
USING_GARBAGE_COLLECTED_MIXIN(DOMPluginArray);
public:
explicit DOMPluginArray(LocalFrame*);
void UpdatePluginData();
unsigned length() const;
DOMPlugin* item(unsigned index);
DOMPlugin* namedItem(const AtomicString& property_name);
void NamedPropertyEnumerator(Vector<String>&, ExceptionState&) const;
bool NamedPropertyQuery(const AtomicString&, ExceptionState&) const;
void refresh(bool reload);
// PluginsChangedObserver implementation.
void PluginsChanged() override;
void Trace(Visitor*) override;
private:
PluginData* GetPluginData() const;
void ContextDestroyed() override;
HeapVector<Member<DOMPlugin>> dom_plugins_;
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_PLUGINS_DOM_PLUGIN_ARRAY_H_
|
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_SUBRESOURCE_FILTER_SAFE_BROWSING_ACTIVATION_THROTTLE_H_
#define COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_SUBRESOURCE_FILTER_SAFE_BROWSING_ACTIVATION_THROTTLE_H_
#include <stddef.h>
#include <memory>
#include <utility>
#include <vector>
#include "base/feature_list.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/single_thread_task_runner.h"
#include "base/time/time.h"
#include "components/safe_browsing/core/db/database_manager.h"
#include "components/subresource_filter/content/browser/subresource_filter_safe_browsing_client.h"
#include "components/subresource_filter/core/browser/subresource_filter_features.h"
#include "components/subresource_filter/core/common/activation_decision.h"
#include "components/subresource_filter/core/common/activation_list.h"
#include "content/public/browser/navigation_throttle.h"
namespace subresource_filter {
class SubresourceFilterClient;
// Enum representing a position in the redirect chain. These values are
// persisted to logs. Entries should not be renumbered and numeric values should
// never be reused.
enum class RedirectPosition {
kOnly = 0,
kFirst = 1,
kMiddle = 2,
kLast = 3,
kMaxValue = kLast
};
// Navigation throttle responsible for activating subresource filtering on page
// loads that match the SUBRESOURCE_FILTER Safe Browsing list.
class SubresourceFilterSafeBrowsingActivationThrottle
: public content::NavigationThrottle,
public base::SupportsWeakPtr<
SubresourceFilterSafeBrowsingActivationThrottle> {
public:
SubresourceFilterSafeBrowsingActivationThrottle(
content::NavigationHandle* handle,
SubresourceFilterClient* client,
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager>
database_manager);
~SubresourceFilterSafeBrowsingActivationThrottle() override;
// content::NavigationThrottle:
content::NavigationThrottle::ThrottleCheckResult WillRedirectRequest()
override;
content::NavigationThrottle::ThrottleCheckResult WillProcessResponse()
override;
const char* GetNameForLogging() override;
void OnCheckUrlResultOnUI(
const SubresourceFilterSafeBrowsingClient::CheckResult& result);
private:
// Highest priority config for a check result.
struct ConfigResult {
Configuration config;
bool warning;
bool matched_valid_configuration;
ActivationList matched_list;
ConfigResult(Configuration config,
bool warning,
bool matched_valid_configuration,
ActivationList matched_list);
~ConfigResult();
ConfigResult();
ConfigResult(const ConfigResult& result);
};
void CheckCurrentUrl();
void NotifyResult();
void LogMetricsOnChecksComplete(ActivationList matched_list,
ActivationDecision decision,
mojom::ActivationLevel level) const;
bool HasFinishedAllSafeBrowsingChecks() const;
// Gets the configuration with the highest priority among those activated.
// Returns it, or none if no valid activated configurations.
ConfigResult GetHighestPriorityConfiguration(
const SubresourceFilterSafeBrowsingClient::CheckResult& result);
// Gets the ActivationDecision for the given Configuration.
// Returns it, or ACTIVATION_CONDITIONS_NOT_MET if no Configuration.
ActivationDecision GetActivationDecision(const ConfigResult& configs);
// Returns whether a main-frame navigation satisfies the activation
// |conditions| of a given configuration, except for |priority|.
bool DoesMainFrameURLSatisfyActivationConditions(
const Configuration::ActivationConditions& conditions,
ActivationList matched_list) const;
std::vector<SubresourceFilterSafeBrowsingClient::CheckResult> check_results_;
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
std::unique_ptr<SubresourceFilterSafeBrowsingClient,
base::OnTaskRunnerDeleter>
database_client_;
// Must outlive this class.
SubresourceFilterClient* client_;
// Set to TimeTicks::Now() when the navigation is deferred in
// WillProcessResponse. If deferral was not necessary, will remain null.
base::TimeTicks defer_time_;
// Whether this throttle is deferring the navigation. Only set to true in
// WillProcessResponse if there are ongoing safe browsing checks.
bool deferring_ = false;
DISALLOW_COPY_AND_ASSIGN(SubresourceFilterSafeBrowsingActivationThrottle);
};
} // namespace subresource_filter
#endif // COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_SUBRESOURCE_FILTER_SAFE_BROWSING_ACTIVATION_THROTTLE_H_
|
/*
* Copyright (c) 2015, The Regents of the University of California (Regents).
* 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 copyright holder nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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.
*
* Please contact the author(s) of this library if you have any questions.
* Authors: Erik Nelson ( eanelson@eecs.berkeley.edu )
* David Fridovich-Keil ( dfk@eecs.berkeley.edu )
*/
///////////////////////////////////////////////////////////////////////////////
//
// This file defines helpful drawing/debugging utilities for images, feature
// matching, and SFM.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef BSFM_IMAGE_DRAWING_UTILS_H
#define BSFM_IMAGE_DRAWING_UTILS_H
#include "image.h"
#include "../camera/camera.h"
#include "../matching/feature_match.h"
#include "../slam/observation.h"
#include "../util/types.h"
namespace bsfm {
namespace drawing {
// Annotate an image by drawing features as green circles on it.
void AnnotateFeatures(const FeatureList& features, Image* image,
unsigned int radius = 1,
unsigned int line_thickness = 2);
// Draw features as red circles in an image.
void DrawImageFeatures(const FeatureList& features, const Image& image,
const std::string& window_name = std::string(),
unsigned int radius = 3,
unsigned int line_thickness = 2);
// Given two images, and data containing their features and matches between
// those features, draw the two images side by side, with matches drawn as lines
// between them.
void DrawImageFeatureMatches(const Image& image1, const Image& image2,
const FeatureMatchList& feature_matches,
const std::string& window_name = std::string(),
unsigned int line_thickness = 1);
// Project landmarks into a camera and draw them as blue circles on the input
// image. If 'print_text_distances' is true, draw the distance from the camera
// to each landmark (up to scale).
void AnnotateLandmarks(const std::vector<LandmarkIndex>& landmark_indices,
const Camera& camera,
Image* image,
unsigned int radius = 3,
unsigned int line_thickness = 2,
bool print_text_distances = false);
// Draw landmarks as blue circles in an image. If 'print_text_distances' is
// true, draw the distance from the camera to each landmark (up to scale).
void DrawLandmarks(const std::vector<LandmarkIndex>& landmark_indices,
const Camera& camera,
const Image& image,
const std::string& window_name = std::string(),
unsigned int radius = 3,
unsigned int line_thickness = 2,
bool print_text_distances = false);
// Annotate 2D<-->3D matches stored in a set of observations. The view index is
// passed in so that we only draw observations that came from the correct view
// index. This method does not annotate the landmarks and features themselves.
void AnnotateObservations(ViewIndex view_index,
const std::vector<Observation::Ptr>& observations,
Image* image,
unsigned int line_thickness = 2);
// Draw 2D<-->3D matches stored in the set of input observations. See
// description for AnnotateObservations().
void DrawObservations(ViewIndex view_index,
const std::vector<Observation::Ptr>& observations,
const Image& image,
const std::string& window_name = std::string(),
unsigned int line_thickness = 2);
// Annotate feature tracks. This will iterate over all tracks, drawing the
// feature position of each track as a line sequence in the most recent view.
// Triangulated tracks will be displayed as blue circles, and untriangulated
// tracks will be displayed as red circles.
void AnnotateTracks(const std::vector<LandmarkIndex>& tracks, Image* image,
unsigned int radius = 3, unsigned int line_thickness = 2);
} //\namespace drawing
} //\namespace bsfm
#endif
|
/****************************************************************************
** SCALASCA http://www.scalasca.org/ **
*****************************************************************************
** Copyright (c) 1998-2013 **
** Forschungszentrum Juelich GmbH, Juelich Supercomputing Centre **
** **
** Copyright (c) 2010-2013 **
** German Research School for Simulation Sciences GmbH, **
** Laboratory for Parallel Programming **
** **
** See the file COPYRIGHT in the package base directory for details **
****************************************************************************/
#ifndef SILAS_BUFFER_H
#define SILAS_BUFFER_H
#include <cstddef>
namespace silas
{
class Buffer
{
public:
Buffer(std::size_t capacity=1024);
~Buffer();
void *get_buffer();
void *get_buffer(std::size_t required_capacity);
std::size_t get_size();
private:
char* m_buffer;
std::size_t m_size;
};
}
#endif
|
/*
* Copyright (C) 2019 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 SRC_PROFILING_MEMORY_UNHOOKED_ALLOCATOR_H_
#define SRC_PROFILING_MEMORY_UNHOOKED_ALLOCATOR_H_
#include <stdlib.h>
#include <atomic>
#include <exception>
namespace perfetto {
namespace profiling {
// An allocator that uses the given |malloc| & |free| function pointers to
// allocate/deallocate memory. Used in the heapprofd_client library, which hooks
// the malloc functions in a target process, and therefore needs to use this
// allocator to not have its own heap usage enter the hooks.
//
// See https://en.cppreference.com/w/cpp/named_req/Allocator.
template <typename T>
class UnhookedAllocator {
public:
template <typename U>
friend class UnhookedAllocator;
// to satisfy the Allocator interface
using value_type = T;
// for implementation convenience
using unhooked_malloc_t = void* (*)(size_t);
using unhooked_free_t = void (*)(void*);
UnhookedAllocator(unhooked_malloc_t unhooked_malloc,
unhooked_free_t unhooked_free)
: unhooked_malloc_(unhooked_malloc), unhooked_free_(unhooked_free) {}
template <typename U>
constexpr UnhookedAllocator(const UnhookedAllocator<U>& other) noexcept
: unhooked_malloc_(other.unhooked_malloc_),
unhooked_free_(other.unhooked_free_) {}
T* allocate(size_t n) {
if (n > size_t(-1) / sizeof(T))
std::terminate();
if (T* p = static_cast<T*>(unhooked_malloc_(n * sizeof(T))))
return p;
std::terminate();
}
void deallocate(T* p, size_t) noexcept { unhooked_free_(p); }
private:
unhooked_malloc_t unhooked_malloc_ = nullptr;
unhooked_free_t unhooked_free_ = nullptr;
};
template <typename T, typename U>
bool operator==(const UnhookedAllocator<T>& first,
const UnhookedAllocator<U>& second) {
return first.unhooked_malloc_ == second.unhooked_malloc_ &&
first.unhooked_free_ == second.unhooked_free_;
}
template <typename T, typename U>
bool operator!=(const UnhookedAllocator<T>& first,
const UnhookedAllocator<U>& second) {
return !(first == second);
}
} // namespace profiling
} // namespace perfetto
#endif // SRC_PROFILING_MEMORY_UNHOOKED_ALLOCATOR_H_
|
/*
* Copyright (c) 2015, 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.
*
*/
#pragma once
#include <chrono>
#include <stdint.h>
#include <string>
#include <folly/Range.h>
namespace facebook { namespace memcache {
class ClientSocket {
public:
static constexpr size_t kMaxReplySize = 1000;
/**
* @throws std::runtime_error if failed to create a socket and connect
*/
explicit ClientSocket(uint16_t port);
~ClientSocket();
/**
* Write data to socket.
*
* @param data data to write
* @param timeout max time to wait for write
*
* @throws std::runtime_error if failed to write data
*/
void write(folly::StringPiece data,
std::chrono::milliseconds timeout = std::chrono::seconds(1));
/**
* Send a request and receive a reply of `replySize`.
*
* @param request string to send
* @param timeout max time to wait for send/receive
*
* @throws std::runtime_error if failed to send/receive data
*/
std::string sendRequest(
folly::StringPiece request,
size_t replySize,
std::chrono::milliseconds timeout = std::chrono::seconds(1));
std::string sendRequest(
folly::StringPiece request,
std::chrono::milliseconds timeout = std::chrono::seconds(1));
// movable, but not copyable
ClientSocket(ClientSocket&& other) noexcept;
ClientSocket& operator=(ClientSocket&& other) noexcept;
ClientSocket(const ClientSocket&) = delete;
ClientSocket& operator=(const ClientSocket&) = delete;
private:
int socketFd_{-1};
};
}} // facebook::memcache
|
/**ARGS: symbols --locate */
/**SYSCODE: = 0 */
#ifdef FOO1
KEEP ME
#endif
#if defined(FOO2) && defined(FOO2)
KEEP ME
#elif defined FOO3 || defined FOO4
KEEP ME
#elif FOO5
KEEP ME
#endif
|
//===-- ClangExpressionParser.h ---------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef liblldb_ClangExpressionParser_h_
#define liblldb_ClangExpressionParser_h_
#include "lldb/lldb-public.h"
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/ClangForward.h"
#include "lldb/Core/Error.h"
#include "lldb/Expression/ExpressionParser.h"
#include <string>
#include <vector>
namespace lldb_private
{
class IRExecutionUnit;
//----------------------------------------------------------------------
/// @class ClangExpressionParser ClangExpressionParser.h "lldb/Expression/ClangExpressionParser.h"
/// @brief Encapsulates an instance of Clang that can parse expressions.
///
/// ClangExpressionParser is responsible for preparing an instance of
/// ClangExpression for execution. ClangExpressionParser uses ClangExpression
/// as a glorified parameter list, performing the required parsing and
/// conversion to formats (DWARF bytecode, or JIT compiled machine code)
/// that can be executed.
//----------------------------------------------------------------------
class ClangExpressionParser : public ExpressionParser
{
public:
//------------------------------------------------------------------
/// Constructor
///
/// Initializes class variables.
///
/// @param[in] exe_scope,
/// If non-NULL, an execution context scope that can help to
/// correctly create an expression with a valid process for
/// optional tuning Objective-C runtime support. Can be NULL.
///
/// @param[in] expr
/// The expression to be parsed.
//------------------------------------------------------------------
ClangExpressionParser (ExecutionContextScope *exe_scope,
Expression &expr,
bool generate_debug_info);
//------------------------------------------------------------------
/// Destructor
//------------------------------------------------------------------
~ClangExpressionParser () override;
//------------------------------------------------------------------
/// Parse a single expression and convert it to IR using Clang. Don't
/// wrap the expression in anything at all.
///
/// @param[in] stream
/// The stream to print errors to.
///
/// @return
/// The number of errors encountered during parsing. 0 means
/// success.
//------------------------------------------------------------------
unsigned
Parse (Stream &stream) override;
//------------------------------------------------------------------
/// Ready an already-parsed expression for execution, possibly
/// evaluating it statically.
///
/// @param[out] func_addr
/// The address to which the function has been written.
///
/// @param[out] func_end
/// The end of the function's allocated memory region. (func_addr
/// and func_end do not delimit an allocated region; the allocated
/// region may begin before func_addr.)
///
/// @param[in] execution_unit_sp
/// After parsing, ownership of the execution unit for
/// for the expression is handed to this shared pointer.
///
/// @param[in] exe_ctx
/// The execution context to write the function into.
///
/// @param[out] evaluated_statically
/// Set to true if the expression could be interpreted statically;
/// untouched otherwise.
///
/// @param[out] const_result
/// If the result of the expression is constant, and the
/// expression has no side effects, this is set to the result of the
/// expression.
///
/// @param[in] execution_policy
/// Determines whether the expression must be JIT-compiled, must be
/// evaluated statically, or whether this decision may be made
/// opportunistically.
///
/// @return
/// An error code indicating the success or failure of the operation.
/// Test with Success().
//------------------------------------------------------------------
Error
PrepareForExecution (lldb::addr_t &func_addr,
lldb::addr_t &func_end,
lldb::IRExecutionUnitSP &execution_unit_sp,
ExecutionContext &exe_ctx,
bool &can_interpret,
lldb_private::ExecutionPolicy execution_policy) override;
private:
std::unique_ptr<llvm::LLVMContext> m_llvm_context; ///< The LLVM context to generate IR into
std::unique_ptr<clang::FileManager> m_file_manager; ///< The Clang file manager object used by the compiler
std::unique_ptr<clang::CompilerInstance> m_compiler; ///< The Clang compiler used to parse expressions into IR
std::unique_ptr<clang::Builtin::Context> m_builtin_context; ///< Context for Clang built-ins
std::unique_ptr<clang::SelectorTable> m_selector_table; ///< Selector table for Objective-C methods
std::unique_ptr<clang::CodeGenerator> m_code_generator; ///< The Clang object that generates IR
class LLDBPreprocessorCallbacks;
LLDBPreprocessorCallbacks *m_pp_callbacks; ///< Called when the preprocessor encounters module imports
std::unique_ptr<ClangASTContext> m_ast_context;
};
}
#endif // liblldb_ClangExpressionParser_h_
|
//
// RLLoadingScreenViewController.h
// Project
//
// Created by Dominik Pich on 02.06.10.
// Copyright 2010 medicus42. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface M42LoadingScreenViewController : UIViewController
@property(readonly) UILabel *label;
@property(readonly) UIActivityIndicatorView *activityView;
@property(readonly) UIProgressView *progressView;
@property(retain) UIViewController *child;
@end
|
#ifndef SLANG_RIFF_FILE_SYSTEM_H
#define SLANG_RIFF_FILE_SYSTEM_H
#include "slang-archive-file-system.h"
#include "slang-riff.h"
#include "slang-io.h"
namespace Slang
{
// The riff information used for RiffArchiveFileSystem
struct RiffFileSystemBinary
{
static const FourCC kContainerFourCC = SLANG_FOUR_CC('S', 'c', 'o', 'n');
static const FourCC kEntryFourCC = SLANG_FOUR_CC('S', 'f', 'i', 'l');
static const FourCC kHeaderFourCC = SLANG_FOUR_CC('S', 'h', 'e', 'a');
struct Header
{
uint32_t compressionSystemType; /// One of CompressionSystemType
};
struct Entry
{
uint32_t compressedSize;
uint32_t uncompressedSize;
uint32_t pathSize; ///< The size of the path in bytes, including terminating 0
uint32_t pathType; ///< One of SlangPathType
// Followed by the path (including terminating0)
// Followed by the compressed data
};
};
class RiffFileSystem : public ArchiveFileSystem
{
public:
// ISlangUnknown
SLANG_REF_OBJECT_IUNKNOWN_ALL
// ISlangFileSystem
virtual SLANG_NO_THROW SlangResult SLANG_MCALL loadFile(char const* path, ISlangBlob** outBlob) SLANG_OVERRIDE;
// ISlangFileSystemExt
virtual SLANG_NO_THROW SlangResult SLANG_MCALL getFileUniqueIdentity(const char* path, ISlangBlob** uniqueIdentityOut) SLANG_OVERRIDE;
virtual SLANG_NO_THROW SlangResult SLANG_MCALL calcCombinedPath(SlangPathType fromPathType, const char* fromPath, const char* path, ISlangBlob** pathOut) SLANG_OVERRIDE;
virtual SLANG_NO_THROW SlangResult SLANG_MCALL getPathType(const char* path, SlangPathType* pathTypeOut) SLANG_OVERRIDE;
virtual SLANG_NO_THROW SlangResult SLANG_MCALL getSimplifiedPath(const char* path, ISlangBlob** outSimplifiedPath) SLANG_OVERRIDE;
virtual SLANG_NO_THROW SlangResult SLANG_MCALL getCanonicalPath(const char* path, ISlangBlob** outCanonicalPath) SLANG_OVERRIDE;
virtual SLANG_NO_THROW void SLANG_MCALL clearCache() SLANG_OVERRIDE {}
virtual SLANG_NO_THROW SlangResult SLANG_MCALL enumeratePathContents(const char* path, FileSystemContentsCallBack callback, void* userData) SLANG_OVERRIDE;
// ISlangModifyableFileSystem
virtual SLANG_NO_THROW SlangResult SLANG_MCALL saveFile(const char* path, const void* data, size_t size) SLANG_OVERRIDE;
virtual SLANG_NO_THROW SlangResult SLANG_MCALL remove(const char* path) SLANG_OVERRIDE;
virtual SLANG_NO_THROW SlangResult SLANG_MCALL createDirectory(const char* path) SLANG_OVERRIDE;
// ArchiveFileSystem
virtual SlangResult loadArchive(const void* archive, size_t archiveSizeInBytes) SLANG_OVERRIDE;
virtual SlangResult storeArchive(bool blobOwnsContent, ISlangBlob** outBlob) SLANG_OVERRIDE;
virtual void setCompressionStyle(const CompressionStyle& style) SLANG_OVERRIDE { m_compressionStyle = style; }
RiffFileSystem(ICompressionSystem* compressionSystem);
/// True if this appears to be Riff archive
static bool isArchive(const void* data, size_t sizeInBytes);
protected:
struct Entry : RefObject
{
SlangPathType m_type;
String m_canonicalPath;
size_t m_uncompressedSizeInBytes; ///< Needed if m_contents is compressed.
ComPtr<ISlangBlob> m_contents; ///< Can be compressed or not
};
ISlangMutableFileSystem* getInterface(const Guid& guid);
SlangResult _calcCanonicalPath(const char* path, StringBuilder& out);
Entry* _getEntryFromPath(const char* path, String* outPath = nullptr);
Entry* _getEntryFromCanonicalPath(const String& canonicalPath);
void _clear() { m_entries.Clear(); }
// Maps a path to an entry
Dictionary<String, RefPtr<Entry>> m_entries;
ComPtr<ICompressionSystem> m_compressionSystem;
CompressionStyle m_compressionStyle;
};
}
#endif
|
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
void validity(int nv, int nk){
int min;
int chk = 0;
for (int j = 0; j < nv; j++){
scanf("%d ",&min);
if (min<=0) {
chk = chk + 1;
}
}
if (chk >= nk) {
printf("NO\n");
}else {
printf("YES\n");
}
}
void angry_prof(int tick) {
int n,k;
int i;
for (i =0; i < tick; i++){
scanf("%d %d",&n,&k);
validity(n,k);
}
}
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
int T;
scanf("%d", &T);
angry_prof(T);
return 0;
}
|
// To check if a library is compiled with CocoaPods you
// can use the `COCOAPODS` macro definition which is
// defined in the xcconfigs so it is available in
// headers also when they are imported in the client
// project.
// DMListener
#define COCOAPODS_POD_AVAILABLE_DMListener
#define COCOAPODS_VERSION_MAJOR_DMListener 0
#define COCOAPODS_VERSION_MINOR_DMListener 1
#define COCOAPODS_VERSION_PATCH_DMListener 0
|
// This code contains NVIDIA Confidential Information and is disclosed to you
// under a form of NVIDIA software license agreement provided separately to you.
//
// Notice
// NVIDIA Corporation and its licensors retain all intellectual property and
// proprietary rights in and to this software and related documentation and
// any modifications thereto. Any use, reproduction, disclosure, or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA Corporation is strictly prohibited.
//
// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
//
// Information and code furnished is believed to be accurate and reliable.
// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
// information or for any infringement of patents or other rights of third parties that may
// result from its use. No license is granted by implication or otherwise under any patent
// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
// This code supersedes and replaces all information previously supplied.
// NVIDIA Corporation products are not authorized for use as critical
// components in life support devices or systems without express written approval of
// NVIDIA Corporation.
//
// Copyright (c) 2008-2013 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#define THERE_IS_NO_INCLUDE_GUARD_HERE_FOR_A_REASON
#ifndef REPX_DEFINE_ERROR_CODE
#define REPX_DEFINE_ERROR_CODE(x)
#endif
REPX_DEFINE_ERROR_CODE(eSuccess)
REPX_DEFINE_ERROR_CODE(eExtensionNotFound)
REPX_DEFINE_ERROR_CODE(eReferenceNotFound)
REPX_DEFINE_ERROR_CODE(eInvalidParameters)
#undef THERE_IS_NO_INCLUDE_GUARD_HERE_FOR_A_REASON
|
/* Generated by CIL v. 1.7.0 */
/* print_CIL_Input is false */
struct _IO_FILE;
struct timeval;
extern float strtof(char const *str , char const *endptr ) ;
extern void signal(int sig , void *func ) ;
typedef struct _IO_FILE FILE;
extern int atoi(char const *s ) ;
extern double strtod(char const *str , char const *endptr ) ;
extern int fclose(void *stream ) ;
extern void *fopen(char const *filename , char const *mode ) ;
extern void abort() ;
extern void exit(int status ) ;
extern int raise(int sig ) ;
extern int fprintf(struct _IO_FILE *stream , char const *format , ...) ;
extern int strcmp(char const *a , char const *b ) ;
extern int rand() ;
extern unsigned long strtoul(char const *str , char const *endptr , int base ) ;
void RandomFunc(unsigned int input[1] , unsigned int output[1] ) ;
extern int strncmp(char const *s1 , char const *s2 , unsigned long maxlen ) ;
extern int gettimeofday(struct timeval *tv , void *tz , ...) ;
extern int printf(char const *format , ...) ;
int main(int argc , char *argv[] ) ;
void megaInit(void) ;
extern unsigned long strlen(char const *s ) ;
extern long strtol(char const *str , char const *endptr , int base ) ;
extern unsigned long strnlen(char const *s , unsigned long maxlen ) ;
extern void *memcpy(void *s1 , void const *s2 , unsigned long size ) ;
struct timeval {
long tv_sec ;
long tv_usec ;
};
extern void *malloc(unsigned long size ) ;
extern int scanf(char const *format , ...) ;
int main(int argc , char *argv[] )
{
unsigned int input[1] ;
unsigned int output[1] ;
int randomFuns_i5 ;
unsigned int randomFuns_value6 ;
int randomFuns_main_i7 ;
{
megaInit();
if (argc != 2) {
printf("Call this program with %i arguments\n", 1);
exit(-1);
} else {
}
randomFuns_i5 = 0;
while (randomFuns_i5 < 1) {
randomFuns_value6 = (unsigned int )strtoul(argv[randomFuns_i5 + 1], 0, 10);
input[randomFuns_i5] = randomFuns_value6;
randomFuns_i5 ++;
}
RandomFunc(input, output);
if (output[0] == 1175584138U) {
printf("You win!\n");
} else {
}
randomFuns_main_i7 = 0;
while (randomFuns_main_i7 < 1) {
printf("%u\n", output[randomFuns_main_i7]);
randomFuns_main_i7 ++;
}
}
}
void RandomFunc(unsigned int input[1] , unsigned int output[1] )
{
unsigned int state[1] ;
unsigned int local1 ;
unsigned short copy11 ;
{
state[0UL] = (input[0UL] + 914778474UL) * 2674260758U;
local1 = 0UL;
while (local1 < 0U) {
copy11 = *((unsigned short *)(& state[local1]) + 1);
*((unsigned short *)(& state[local1]) + 1) = *((unsigned short *)(& state[local1]) + 0);
*((unsigned short *)(& state[local1]) + 0) = copy11;
local1 ++;
}
local1 = 0UL;
while (local1 < 0U) {
local1 ++;
}
output[0UL] = state[0UL] * 1070846533U;
}
}
void megaInit(void)
{
{
}
}
|
//
// AppDelegate.h
// FMDB存储对象类型
//
// Created by 郭伟林 on 16/3/23.
// Copyright © 2016年 SR. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
// Copyright (c) 2011-2019 The Starwels developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef STARWELS_QT_RPCCONSOLE_H
#define STARWELS_QT_RPCCONSOLE_H
#include <qt/guiutil.h>
#include <qt/peertablemodel.h>
#include <net.h>
#include <QWidget>
#include <QCompleter>
#include <QThread>
class ClientModel;
class PlatformStyle;
class RPCTimerInterface;
namespace Ui {
class RPCConsole;
}
QT_BEGIN_NAMESPACE
class QMenu;
class QItemSelection;
QT_END_NAMESPACE
/** Local Starwels RPC console. */
class RPCConsole: public QWidget
{
Q_OBJECT
public:
explicit RPCConsole(const PlatformStyle *platformStyle, QWidget *parent);
~RPCConsole();
static bool RPCParseCommandLine(std::string &strResult, const std::string &strCommand, bool fExecute, std::string * const pstrFilteredOut = nullptr);
static bool RPCExecuteCommandLine(std::string &strResult, const std::string &strCommand, std::string * const pstrFilteredOut = nullptr) {
return RPCParseCommandLine(strResult, strCommand, true, pstrFilteredOut);
}
void setClientModel(ClientModel *model);
enum MessageClass {
MC_ERROR,
MC_DEBUG,
CMD_REQUEST,
CMD_REPLY,
CMD_ERROR
};
enum TabTypes {
TAB_INFO = 0,
TAB_CONSOLE = 1,
TAB_GRAPH = 2,
TAB_PEERS = 3
};
protected:
virtual bool eventFilter(QObject* obj, QEvent *event);
void keyPressEvent(QKeyEvent *);
private Q_SLOTS:
void on_lineEdit_returnPressed();
void on_tabWidget_currentChanged(int index);
/** open the debug.log from the current datadir */
void on_openDebugLogfileButton_clicked();
/** change the time range of the network traffic graph */
void on_sldGraphRange_valueChanged(int value);
/** update traffic statistics */
void updateTrafficStats(quint64 totalBytesIn, quint64 totalBytesOut);
void resizeEvent(QResizeEvent *event);
void showEvent(QShowEvent *event);
void hideEvent(QHideEvent *event);
/** Show custom context menu on Peers tab */
void showPeersTableContextMenu(const QPoint& point);
/** Show custom context menu on Bans tab */
void showBanTableContextMenu(const QPoint& point);
/** Hides ban table if no bans are present */
void showOrHideBanTableIfRequired();
/** clear the selected node */
void clearSelectedNode();
public Q_SLOTS:
void clear(bool clearHistory = true);
void fontBigger();
void fontSmaller();
void setFontSize(int newSize);
/** Append the message to the message widget */
void message(int category, const QString &message, bool html = false);
/** Set number of connections shown in the UI */
void setNumConnections(int count);
/** Set network state shown in the UI */
void setNetworkActive(bool networkActive);
/** Set number of blocks and last block date shown in the UI */
void setNumBlocks(int count, const QDateTime& blockDate, double nVerificationProgress, bool headers);
/** Set size (number of transactions and memory usage) of the mempool in the UI */
void setMempoolSize(long numberOfTxs, size_t dynUsage);
/** Go forward or back in history */
void browseHistory(int offset);
/** Scroll console view to end */
void scrollToEnd();
/** Handle selection of peer in peers list */
void peerSelected(const QItemSelection &selected, const QItemSelection &deselected);
/** Handle selection caching before update */
void peerLayoutAboutToChange();
/** Handle updated peer information */
void peerLayoutChanged();
/** Disconnect a selected node on the Peers tab */
void disconnectSelectedNode();
/** Ban a selected node on the Peers tab */
void banSelectedNode(int bantime);
/** Unban a selected node on the Bans tab */
void unbanSelectedNode();
/** set which tab has the focus (is visible) */
void setTabFocus(enum TabTypes tabType);
Q_SIGNALS:
// For RPC command executor
void stopExecutor();
void cmdRequest(const QString &command);
private:
void startExecutor();
void setTrafficGraphRange(int mins);
/** show detailed information on ui about selected node */
void updateNodeDetail(const CNodeCombinedStats *stats);
enum ColumnWidths
{
ADDRESS_COLUMN_WIDTH = 200,
SUBVERSION_COLUMN_WIDTH = 150,
PING_COLUMN_WIDTH = 80,
BANSUBNET_COLUMN_WIDTH = 200,
BANTIME_COLUMN_WIDTH = 250
};
Ui::RPCConsole *ui;
ClientModel *clientModel;
QStringList history;
int historyPtr;
QString cmdBeforeBrowsing;
QList<NodeId> cachedNodeids;
const PlatformStyle *platformStyle;
RPCTimerInterface *rpcTimerInterface;
QMenu *peersTableContextMenu;
QMenu *banTableContextMenu;
int consoleFontSize;
QCompleter *autoCompleter;
QThread thread;
/** Update UI with latest network info from model. */
void updateNetworkState();
};
#endif // STARWELS_QT_RPCCONSOLE_H
|
//
// FLJson.h
// FishLamp
//
// Created by Mike Fullerton on 5/12/11.
// Copyright (c) 2013 GreenTongue Software LLC, Mike Fullerton.
// The FishLamp Framework is released under the MIT License: http://fishlamp.com/license
//
#import "FLCocoaRequired.h"
@interface FLJsonParser : NSObject {
@private
}
+ (FLJsonParser*) jsonParser;
- (id) parseData:(NSData*) data;
- (id) parseFileAtPath:(NSString*) path;
- (id) parseFileAtURL:(NSURL*) url;
+ (BOOL) canParseData:(NSData*) data;
@end
|
//
// DetailViewController.h
// MyMangoTV
//
// Created by apple on 14-8-21.
// Copyright (c) 2014年 戴维营教育. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface DetailViewController : UIViewController
@end
|
// Chilkat Objective-C header.
// This is a generated header file for Chilkat version 9.5.0.14
// Generic/internal class name = Bz2
// Wrapped Chilkat C++ class name = CkBz2
@class CkoBaseProgress;
@interface CkoBz2 : NSObject {
@private
void *m_eventCallback;
void *m_obj;
}
- (id)init;
- (void)dealloc;
- (void)dispose;
- (NSString *)stringWithUtf8: (const char *)s;
- (void *)CppImplObj;
- (void)setCppImplObj: (void *)pObj;
// property setter: EventCallbackObject
- (void)setEventCallbackObject: (CkoBaseProgress *)eventObj;
// property getter: DebugLogFilePath
- (NSString *)DebugLogFilePath;
// property setter: DebugLogFilePath
- (void)setDebugLogFilePath: (NSString *)input;
// property getter: HeartbeatMs
- (NSNumber *)HeartbeatMs;
// property setter: HeartbeatMs
- (void)setHeartbeatMs: (NSNumber *)intVal;
// property getter: LastErrorHtml
- (NSString *)LastErrorHtml;
// property getter: LastErrorText
- (NSString *)LastErrorText;
// property getter: LastErrorXml
- (NSString *)LastErrorXml;
// property getter: VerboseLogging
- (BOOL)VerboseLogging;
// property setter: VerboseLogging
- (void)setVerboseLogging: (BOOL)boolVal;
// property getter: Version
- (NSString *)Version;
// method: CompressFile
- (BOOL)CompressFile: (NSString *)inPath
toPath: (NSString *)toPath;
// method: CompressFileToMem
- (NSData *)CompressFileToMem: (NSString *)inPath;
// method: CompressMemToFile
- (BOOL)CompressMemToFile: (NSData *)inData
toPath: (NSString *)toPath;
// method: CompressMemory
- (NSData *)CompressMemory: (NSData *)inData;
// method: SaveLastError
- (BOOL)SaveLastError: (NSString *)path;
// method: UncompressFile
- (BOOL)UncompressFile: (NSString *)inPath
toPath: (NSString *)toPath;
// method: UncompressFileToMem
- (NSData *)UncompressFileToMem: (NSString *)inPath;
// method: UncompressMemToFile
- (BOOL)UncompressMemToFile: (NSData *)inData
toPath: (NSString *)toPath;
// method: UncompressMemory
- (NSData *)UncompressMemory: (NSData *)inData;
// method: UnlockComponent
- (BOOL)UnlockComponent: (NSString *)unlockCode;
@end
|
/*
Erica Sadun, http://ericasadun.com
iPhone Developer's Cookbook, 3.0 Edition
BSD License, Use at your own risk
*/
/**
UIView的读数据扩展的
*/
#import <UIKit/UIKit.h>
CGPoint CGRectGetCenter(CGRect rect);
CGRect CGRectMoveToCenter(CGRect rect, CGPoint center);
@interface UIView (ViewFrameGeometry)
@property CGPoint origin;
@property CGSize size;
@property (readonly) CGPoint bottomLeft;
@property (readonly) CGPoint bottomRight;
@property (readonly) CGPoint topRight;
@property CGFloat height;
@property CGFloat width;
@property CGFloat top;
@property CGFloat left;
@property CGFloat bottom;
@property CGFloat right;
/*add 2014-11-24 by evol*/
@property (nonatomic) CGFloat centerX;
@property (nonatomic) CGFloat centerY;
/*end*/
- (void) moveBy: (CGPoint) delta;
- (void) scaleBy: (CGFloat) scaleFactor;
- (void) fitInSize: (CGSize) aSize;
@end
|
#pragma once
#include <string>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <XnCppWrapper.h>
class DepthCamera
{
public:
DepthCamera();
virtual ~DepthCamera();
static const XnMapOutputMode OUTPUT_MODE;
void getFrame(cv::Mat &bgrImage, cv::Mat &depthImage);
xn::Context m_context;
xn::ScriptNode m_scriptNode;
xn::DepthGenerator m_depthGenerator;
xn::ImageGenerator m_imageGenerator;
xn::DepthMetaData m_depthMetaData;
xn::ImageMetaData m_imageMetaData;
cv::VideoCapture m_bgrReader;
cv::VideoCapture m_depthReader;
};
|
//
// XHDataStoreManager.h
// XHNewsFrameworkExample
//
// Created by qtone-1 on 14-4-29.
// Copyright (c) 2014年 曾宪华 开发团队(http://iyilunba.com ) 本人QQ:543413507 本人QQ群(142557668). All rights reserved.
//
#import <Foundation/Foundation.h>
#import "XHNewsModel.h"
@interface XHDataStoreManager : NSObject
+ (instancetype)shareDataStoreManager;
- (void)loadNetDataSourceWithPagesize:(NSInteger)pagesize pageNumber:(NSInteger)pageNumber compledBlock:(void (^)(NSMutableArray *datas))compled;
@end
|
/** Configure pins as
* Analog
* Input
* Output
* EVENT_OUT
* EXTI
*/
void MX_GPIO_Init(void)
{
GPIO_InitTypeDef GPIO_InitStruct;
/* GPIO Ports Clock Enable */
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOH_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
__HAL_RCC_GPIOD_CLK_ENABLE();
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOC, M0_nCS_Pin|M1_nCS_Pin, GPIO_PIN_SET);
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOC, M1_DC_CAL_Pin|M0_DC_CAL_Pin, GPIO_PIN_RESET);
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(EN_GATE_GPIO_Port, EN_GATE_Pin, GPIO_PIN_RESET);
/*Configure GPIO pins : PCPin PCPin PCPin PCPin */
GPIO_InitStruct.Pin = M0_nCS_Pin|M1_nCS_Pin|M1_DC_CAL_Pin|M0_DC_CAL_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
/*Configure GPIO pin : PtPin */
GPIO_InitStruct.Pin = GPIO_3_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
HAL_GPIO_Init(GPIO_3_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pins : PAPin PAPin */
GPIO_InitStruct.Pin = GPIO_4_Pin|M0_ENC_Z_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/*Configure GPIO pins : PBPin PBPin */
GPIO_InitStruct.Pin = GPIO_5_Pin|M1_ENC_Z_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
/*Configure GPIO pin : PtPin */
GPIO_InitStruct.Pin = EN_GATE_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(EN_GATE_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pin : PtPin */
GPIO_InitStruct.Pin = nFAULT_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_PULLUP;
HAL_GPIO_Init(nFAULT_GPIO_Port, &GPIO_InitStruct);
/* EXTI interrupt init*/
HAL_NVIC_SetPriority(EXTI2_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(EXTI2_IRQn);
}
|
/*********************************************************************
Blosc - Blocked Shuffling and Compression Library
Author: Francesc Alted <francesc@blosc.org>
See LICENSES/BLOSC.txt for details about copyright and rights to use.
**********************************************************************/
/* AVX2-accelerated shuffle/unshuffle routines. */
#ifndef SHUFFLE_AVX2_H
#define SHUFFLE_AVX2_H
#include "blosc-common.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
AVX2-accelerated shuffle routine.
*/
BLOSC_NO_EXPORT void blosc_internal_shuffle_avx2(const size_t bytesoftype, const size_t blocksize,
const uint8_t* const _src, uint8_t* const _dest);
/**
AVX2-accelerated unshuffle routine.
*/
BLOSC_NO_EXPORT void blosc_internal_unshuffle_avx2(const size_t bytesoftype, const size_t blocksize,
const uint8_t* const _src, uint8_t* const _dest);
#ifdef __cplusplus
}
#endif
#endif /* SHUFFLE_AVX2_H */
|
/*-------------------------------------------------------------------------
*
* tupdesc.h
* POSTGRES tuple descriptor definitions.
*
*
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/access/tupdesc.h,v 1.54 2009/01/01 17:23:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef TUPDESC_H
#define TUPDESC_H
#include "access/attnum.h"
#include "catalog/pg_attribute.h"
#include "nodes/pg_list.h"
typedef struct attrDefault
{
AttrNumber adnum;
char *adbin; /* nodeToString representation of expr */
} AttrDefault;
typedef struct constrCheck
{
char *ccname;
char *ccbin; /* nodeToString representation of expr */
} ConstrCheck;
/* This structure contains constraints of a tuple */
typedef struct tupleConstr
{
AttrDefault *defval; /* array */
ConstrCheck *check; /* array */
uint16 num_defval;
uint16 num_check;
bool has_not_null;
} TupleConstr;
/*
* This struct is passed around within the backend to describe the structure
* of tuples. For tuples coming from on-disk relations, the information is
* collected from the pg_attribute, pg_attrdef, and pg_constraint catalogs.
* Transient row types (such as the result of a join query) have anonymous
* TupleDesc structs that generally omit any constraint info; therefore the
* structure is designed to let the constraints be omitted efficiently.
*
* Note that only user attributes, not system attributes, are mentioned in
* TupleDesc; with the exception that tdhasoid indicates if OID is present.
*
* If the tupdesc is known to correspond to a named rowtype (such as a table's
* rowtype) then tdtypeid identifies that type and tdtypmod is -1. Otherwise
* tdtypeid is RECORDOID, and tdtypmod can be either -1 for a fully anonymous
* row type, or a value >= 0 to allow the rowtype to be looked up in the
* typcache.c type cache.
*
* Tuple descriptors that live in caches (relcache or typcache, at present)
* are reference-counted: they can be deleted when their reference count goes
* to zero. Tuple descriptors created by the executor need no reference
* counting, however: they are simply created in the appropriate memory
* context and go away when the context is freed. We set the tdrefcount
* field of such a descriptor to -1, while reference-counted descriptors
* always have tdrefcount >= 0.
*/
typedef struct tupleDesc
{
int natts; /* number of attributes in the tuple */
Form_pg_attribute *attrs;
/* attrs[N] is a pointer to the description of Attribute Number N+1 */
TupleConstr *constr; /* constraints, or NULL if none */
Oid tdtypeid; /* composite type ID for tuple type */
int32 tdtypmod; /* typmod for tuple type */
bool tdhasoid; /* tuple has oid attribute in its header */
int tdrefcount; /* reference count, or -1 if not counting */
} *TupleDesc;
extern TupleDesc CreateTemplateTupleDesc(int natts, bool hasoid);
extern TupleDesc CreateTupleDesc(int natts, bool hasoid,
Form_pg_attribute *attrs);
extern TupleDesc CreateTupleDescCopy(TupleDesc tupdesc);
extern TupleDesc CreateTupleDescCopyConstr(TupleDesc tupdesc);
extern void FreeTupleDesc(TupleDesc tupdesc);
extern void IncrTupleDescRefCount(TupleDesc tupdesc);
extern void DecrTupleDescRefCount(TupleDesc tupdesc);
#define PinTupleDesc(tupdesc) \
do { \
if ((tupdesc)->tdrefcount >= 0) \
IncrTupleDescRefCount(tupdesc); \
} while (0)
#define ReleaseTupleDesc(tupdesc) \
do { \
if ((tupdesc)->tdrefcount >= 0) \
DecrTupleDescRefCount(tupdesc); \
} while (0)
extern bool equalTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2);
extern void TupleDescInitEntry(TupleDesc desc,
AttrNumber attributeNumber,
const char *attributeName,
Oid oidtypeid,
int32 typmod,
int attdim);
extern TupleDesc BuildDescForRelation(List *schema);
extern TupleDesc BuildDescFromLists(List *names, List *types, List *typmods);
#endif /* TUPDESC_H */
|
/*
*/
#include <iostream>
#include <string.h>
#ifndef _samochod_h
#define _samochod_h
using namespace std;
class samochod
{
private:
string nr_rej;
string model;
string marka;
long cena;
string stan;
/*
Zapisz dane do klasy
*/
public:
void zapisz (
string numer_rejestr,
string model_auta,
string marka_auta,
long cena_auta,
string stan_auta
);
/*
Wywietl dane z klasy
*/
void wyswietl();
};
#endif
|
/* Get file status. Linux version.
Copyright (C) 2020-2021 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
<https://www.gnu.org/licenses/>. */
#include <sys/stat.h>
#include <fcntl.h>
#include <kernel_stat.h>
#if !XSTAT_IS_XSTAT64
int
__lstat (const char *file, struct stat *buf)
{
return __fstatat (AT_FDCWD, file, buf, AT_SYMLINK_NOFOLLOW);
}
weak_alias (__lstat, lstat)
#endif
|
#import <UIKit/UIKit.h>
FOUNDATION_EXPORT double PGMTimerVersionNumber;
FOUNDATION_EXPORT const unsigned char PGMTimerVersionString[];
|
//
// MFSCacheStorageObject.h
// MFSCache
//
// Created by maxfong on 15/7/6.
// Copyright (c) 2015年 maxfong. All rights reserved.
// https://github.com/maxfong/MFSCache
#import <Foundation/Foundation.h>
typedef NS_ENUM(NSUInteger, MFSCacheStorageObjectTimeOutInterval) {
MFSCacheStorageObjectIntervalDefault,
MFSCacheStorageObjectIntervalTiming, //定时
MFSCacheStorageObjectIntervalAllTime //永久
};
@interface MFSCacheStorageObject : NSObject <NSCoding>
/** 数据String */
@property (nonatomic, copy, readonly) NSString *storageString;
/** 数据类名 */
@property (nonatomic, strong, readonly) id storageObject;
/** 数据的存储时效性 */
@property (nonatomic, assign, readonly) MFSCacheStorageObjectTimeOutInterval storageInterval;
/** 当前对象的标识符(KEY),默认会自动生成,可自定义*/
@property (nonatomic, copy) NSString *objectIdentifier;
/** 存储文件的过期时间
* -1表示永久文件,慎用 */
@property (nonatomic, assign) NSTimeInterval timeoutInterval;
/** 根据(String,URL,Data,Number,Dictionary,Array,Null,实体)初始化对象 */
- (instancetype)initWithObject:(id)object;
@end
|
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2010-2011 Artyom Beilis (Tonkikh) <artyomtnk@yahoo.com>
//
// Distributed under:
//
// the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// or (at your opinion) under:
//
// The MIT License
// (See accompanying file MIT.txt or a copy at
// http://www.opensource.org/licenses/mit-license.php)
//
///////////////////////////////////////////////////////////////////////////////
#ifndef CPPDB_CONNECTION_SPECIFIC_H
#define CPPDB_CONNECTION_SPECIFIC_H
#include <cppdb/defs.h>
#include <memory>
namespace cppdb {
///
/// \brief Special abstract object that holds a connection specific data
///
/// The user is expected to derive its own object from this class
/// and save them withing the connection
///
class CPPDB_API connection_specific_data {
connection_specific_data(connection_specific_data const &);
void operator=(connection_specific_data const &);
public:
connection_specific_data();
virtual ~connection_specific_data();
private:
struct data;
std::auto_ptr<data> d;
};
} // cppdb
#endif
|
/* Copyright (C) 2014 mod_auth_gssapi contributors - See COPYING for (C) terms */
struct mag_req_cfg;
struct mag_conn;
void mag_post_config_session(void);
void mag_check_session(struct mag_req_cfg *cfg, struct mag_conn **conn);
void mag_attempt_session(struct mag_req_cfg *cfg, struct mag_conn *mc);
bool mag_basic_check(struct mag_req_cfg *cfg, struct mag_conn *mc,
gss_buffer_desc user, gss_buffer_desc pwd);
void mag_basic_cache(struct mag_req_cfg *cfg, struct mag_conn *mc,
gss_buffer_desc user, gss_buffer_desc pwd);
|
precision highp float;
const float PI = 3.141592653589793;
varying vec4 position;
varying vec3 N;
varying mat3 R;
uniform sampler2D s2bumpmap;
uniform sampler2D s2texture;
uniform mat4 g_WorldViewMatrix;
void main() {
vec3 test = normalize( N );
vec2 UVCoord;
UVCoord.x = 0.5 + 0.5 * atan( test.x, test.z ) / PI;
UVCoord.y = 0.5 - 0.5 * test.y;
mat3 R2 = mat3( normalize( R[ 0 ] ), normalize( R[ 1 ] ), normalize( R[ 2 ] ) );
vec3 normal = normalize( R * normalize( texture2D( s2bumpmap, UVCoord ).rgb * 2.0 - 1.0 ) );
vec3 L = normalize( position.xyz );
vec3 eye = normalize( position.xyz - vec3( 0.0, 0.0, 5.0 ) );
vec3 lightColor = texture2D( s2texture, UVCoord ).xyz;
float diffuse = max( dot( -normal, L ), 0.0 );
float specular = pow( max( dot( reflect( -L, normal ), eye ), 0.0 ), 60.0 );
gl_FragColor = vec4( ( 0.2 + 0.8 * diffuse + 1.0 * specular ) * lightColor, 1.0 );
}
|
/*
* Copyright 1998 by Abacus Research and
* Development, Inc. All rights reserved.
*
* Derived from public domain source code written by Sam Lantinga
*/
/* Separate the memory management routines because they don't compile with
USE_WINDOWS_NOT_MAC_TYPEDEFS_AND_DEFINES enabled
*/
extern char *sdl_ReallocHandle(char **mem, int len);
|
//
// NSDictionary+RemoveNSNull.h
// Trip2013
//
// Created by hongye.hxm on 14-5-29.
// Copyright (c) 2014年 alibaba. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSDictionary (RemoveNSNull)
- (NSMutableDictionary *)RemoveNSNull;
@end
|
//
// NSDate+Common.h
// _BusinessApp_
//
// Created by Gytenis Mikulėnas on 6/5/13.
// Copyright (c) 2015 Gytenis Mikulėnas
// https://github.com/GitTennis/SuccessFramework
//
// 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. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSDate (Common)
@end
|
/*********************************************************************
* Portions COPYRIGHT 2014 STMicroelectronics *
* Portions SEGGER Microcontroller GmbH & Co. KG *
* Solutions for real time microcontroller applications *
**********************************************************************
* *
* (c) 1996 - 2014 SEGGER Microcontroller GmbH & Co. KG *
* *
* Internet: www.segger.com Support: support@segger.com *
* *
**********************************************************************
** emWin V5.26 - Graphical user interface for embedded applications **
All Intellectual Property rights in the Software belongs to SEGGER.
emWin is protected by international copyright laws. Knowledge of the
source code may not be used to write a similar product. This file may
only be used in accordance with the following terms:
The software has been licensed to STMicroelectronics International
N.V. a Dutch company with a Swiss branch and its headquarters in Plan-
les-Ouates, Geneva, 39 Chemin du Champ des Filles, Switzerland for the
purposes of creating libraries for ARM Cortex-M-based 32-bit microcon_
troller products commercialized by Licensee only, sublicensed and dis_
tributed under the terms and conditions of the End User License Agree_
ment supplied by STMicroelectronics International N.V.
Full source code is available at: www.segger.com
We appreciate your understanding and fairness.
----------------------------------------------------------------------
File : ICONVIEW_Private.h
Purpose : ICONVIEW private header file
--------------------END-OF-HEADER-------------------------------------
*/
/**
******************************************************************************
* @attention
*
* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.st.com/software_license_agreement_liberty_v2
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************
*/
#ifndef ICONVIEW_PRIVATE_H
#define ICONVIEW_PRIVATE_H
#include "WM.h"
#include "GUI_ARRAY.h"
#include "ICONVIEW.h"
#if GUI_WINSUPPORT
/*********************************************************************
*
* Types
*
**********************************************************************
*/
typedef struct {
const GUI_FONT * pFont;
GUI_COLOR aBkColor[3];
GUI_COLOR aTextColor[3];
int FrameX, FrameY;
int SpaceX, SpaceY;
int TextAlign;
int IconAlign;
GUI_WRAPMODE WrapMode;
} ICONVIEW_PROPS;
typedef struct {
WIDGET Widget;
WM_SCROLL_STATE ScrollStateV;
WM_SCROLL_STATE ScrollStateH;
ICONVIEW_PROPS Props;
GUI_ARRAY ItemArray;
int xSizeItems;
int ySizeItems;
int Sel;
U16 Flags;
/* Type check in debug version */
#if GUI_DEBUG_LEVEL >= GUI_DEBUG_LEVEL_CHECK_ALL
U32 DebugId;
#endif
} ICONVIEW_OBJ;
typedef void tDrawImage (const void * pData, int xPos, int yPos);
typedef void tDrawText (ICONVIEW_OBJ * pObj, GUI_RECT * pRect, const char * s);
typedef void tGetImageSizes(const void * pData, int * xSize, int * ySize);
typedef struct {
tDrawImage * pfDrawImage;
tDrawText * pfDrawText;
tGetImageSizes * pfGetImageSizes;
const void * pData;
U32 UserData;
int SizeofData;
char acText[1];
} ICONVIEW_ITEM;
/*********************************************************************
*
* Function pointer(s)
*
**********************************************************************
*/
extern void (* ICONVIEW__pfDrawStreamedBitmap)(const void * p, int x, int y);
/*********************************************************************
*
* Macros for internal use
*
**********************************************************************
*/
#if GUI_DEBUG_LEVEL >= GUI_DEBUG_LEVEL_CHECK_ALL
#define ICONVIEW_INIT_ID(p) (p->DebugId = ICONVIEW_ID)
#else
#define ICONVIEW_INIT_ID(p)
#endif
#if GUI_DEBUG_LEVEL >= GUI_DEBUG_LEVEL_CHECK_ALL
ICONVIEW_OBJ * ICONVIEW_LockH(ICONVIEW_Handle h);
#define ICONVIEW_LOCK_H(h) ICONVIEW_LockH(h)
#else
#define ICONVIEW_LOCK_H(h) (ICONVIEW_OBJ *)GUI_LOCK_H(h)
#endif
#endif /* GUI_WINSUPPORT */
#endif /* ICONVIEW_H */
/*************************** End of file ****************************/
|
/*****************************************************************************
* vlc_es_out.h: es_out (demuxer output) descriptor, queries and methods
*****************************************************************************
* Copyright (C) 1999-2004 the VideoLAN team
* $Id: 57fc5c003ad3d319f75c6dcbae650c1f45e50d28 $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, 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 VLC_ES_OUT_H
#define VLC_ES_OUT_H 1
/**
* \file
* This file defines functions and structures for handling es_out in stream output
*/
/**
* \defgroup es out Es Out
* @{
*/
enum es_out_query_e
{
/* set ES selected for the es category (audio/video/spu) */
ES_OUT_SET_ES, /* arg1= es_out_id_t* */
ES_OUT_RESTART_ES, /* arg1= es_out_id_t* */
/* set 'default' tag on ES (copied across from container) */
ES_OUT_SET_ES_DEFAULT, /* arg1= es_out_id_t* */
/* force selection/unselection of the ES (bypass current mode) */
ES_OUT_SET_ES_STATE,/* arg1= es_out_id_t* arg2=bool */
ES_OUT_GET_ES_STATE,/* arg1= es_out_id_t* arg2=bool* */
/* */
ES_OUT_SET_GROUP, /* arg1= int */
/* PCR handling, DTS/PTS will be automatically computed using thoses PCR
* XXX: SET_PCR(_GROUP) are in charge of the pace control. They will wait
* to slow down the demuxer so that it reads at the right speed.
* XXX: if you want PREROLL just call ES_OUT_SET_NEXT_DISPLAY_TIME and send
* as you would normally do.
*/
ES_OUT_SET_PCR, /* arg1=int64_t i_pcr(microsecond!) (using default group 0)*/
ES_OUT_SET_GROUP_PCR, /* arg1= int i_group, arg2=int64_t i_pcr(microsecond!)*/
ES_OUT_RESET_PCR, /* no arg */
/* Try not to use this one as it is a bit hacky */
ES_OUT_SET_ES_FMT, /* arg1= es_out_id_t* arg2=es_format_t* */
/* Allow preroll of data (data with dts/pts < i_pts for all ES will be decoded but not displayed */
ES_OUT_SET_NEXT_DISPLAY_TIME, /* arg1=int64_t i_pts(microsecond) */
/* Set meta data for group (dynamic) (The vlc_meta_t is not modified nor released) */
ES_OUT_SET_GROUP_META, /* arg1=int i_group arg2=const vlc_meta_t */
/* Set epg for group (dynamic) (The vlc_epg_t is not modified nor released) */
ES_OUT_SET_GROUP_EPG, /* arg1=int i_group arg2=const vlc_epg_t */
/* */
ES_OUT_DEL_GROUP, /* arg1=int i_group */
/* Set scrambled state for one es */
ES_OUT_SET_ES_SCRAMBLED_STATE, /* arg1=int i_group arg2=es_out_id_t* */
/* Stop any buffering being done, and ask if es_out has no more data to
* play.
* It will not block and so MUST be used carrefully. The only good reason
* is for interactive playback (like for DVD menu).
* XXX You SHALL call ES_OUT_RESET_PCR before any other es_out_Control/Send calls. */
ES_OUT_GET_EMPTY, /* arg1=bool* res=cannot fail */
/* Set global meta data (The vlc_meta_t is not modified nor released) */
ES_OUT_SET_META, /* arg1=const vlc_meta_t * */
/* PCR system clock manipulation for external clock synchronization */
ES_OUT_GET_PCR_SYSTEM, /* arg1=mtime_t *, arg2=mtime_t * res=can fail */
ES_OUT_MODIFY_PCR_SYSTEM, /* arg1=int is_absolute, arg2=mtime_t, res=can fail */
/* First value usable for private control */
ES_OUT_PRIVATE_START = 0x10000,
};
struct es_out_t
{
es_out_id_t *(*pf_add) ( es_out_t *, const es_format_t * );
int (*pf_send) ( es_out_t *, es_out_id_t *, block_t * );
void (*pf_del) ( es_out_t *, es_out_id_t * );
int (*pf_control)( es_out_t *, int i_query, va_list );
void (*pf_destroy)( es_out_t * );
es_out_sys_t *p_sys;
};
LIBVLC_USED
static inline es_out_id_t * es_out_Add( es_out_t *out, const es_format_t *fmt )
{
return out->pf_add( out, fmt );
}
static inline void es_out_Del( es_out_t *out, es_out_id_t *id )
{
out->pf_del( out, id );
}
static inline int es_out_Send( es_out_t *out, es_out_id_t *id,
block_t *p_block )
{
return out->pf_send( out, id, p_block );
}
static inline int es_out_vaControl( es_out_t *out, int i_query, va_list args )
{
return out->pf_control( out, i_query, args );
}
static inline int es_out_Control( es_out_t *out, int i_query, ... )
{
va_list args;
int i_result;
va_start( args, i_query );
i_result = es_out_vaControl( out, i_query, args );
va_end( args );
return i_result;
}
static inline void es_out_Delete( es_out_t *p_out )
{
p_out->pf_destroy( p_out );
}
static inline int es_out_ControlSetMeta( es_out_t *out, const vlc_meta_t *p_meta )
{
return es_out_Control( out, ES_OUT_SET_META, p_meta );
}
static inline int es_out_ControlGetPcrSystem( es_out_t *out, mtime_t *pi_system, mtime_t *pi_delay )
{
return es_out_Control( out, ES_OUT_GET_PCR_SYSTEM, pi_system, pi_delay );
}
static inline int es_out_ControlModifyPcrSystem( es_out_t *out, bool b_absolute, mtime_t i_system )
{
return es_out_Control( out, ES_OUT_MODIFY_PCR_SYSTEM, b_absolute, i_system );
}
/**
* @}
*/
#endif
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.