text stringlengths 4 6.14k |
|---|
/*
* This definitions of the PIC16F723A MCU.
*
* This file is part of the GNU PIC library for SDCC, originally
* created by Molnar Karoly <molnarkaroly@users.sf.net> 2014.
*
* This file is generated automatically by the cinc2h.pl, 2014-09-15 14:38:40 UTC.
*
* SDCC is licensed under the GNU Public license (GPL) v2. Note that
* this license covers the code to the compiler and other executables,
* but explicitly does not cover any code or objects generated by sdcc.
*
* For pic device libraries and header files which are derived from
* Microchip header (.inc) and linker script (.lkr) files Microchip
* requires that "The header files should state that they are only to be
* used with authentic Microchip devices" which makes them incompatible
* with the GPL. Pic device libraries and header files are located at
* non-free/lib and non-free/include directories respectively.
* Sdcc should be run with the --use-non-free command line option in
* order to include non-free header files and libraries.
*
* See http://sdcc.sourceforge.net/ for the latest information on sdcc.
*/
#include <pic16f723a.h>
//==============================================================================
__at(0x0000) __sfr INDF;
__at(0x0001) __sfr TMR0;
__at(0x0002) __sfr PCL;
__at(0x0003) __sfr STATUS;
__at(0x0003) volatile __STATUSbits_t STATUSbits;
__at(0x0004) __sfr FSR;
__at(0x0005) __sfr PORTA;
__at(0x0005) volatile __PORTAbits_t PORTAbits;
__at(0x0006) __sfr PORTB;
__at(0x0006) volatile __PORTBbits_t PORTBbits;
__at(0x0007) __sfr PORTC;
__at(0x0007) volatile __PORTCbits_t PORTCbits;
__at(0x0009) __sfr PORTE;
__at(0x0009) volatile __PORTEbits_t PORTEbits;
__at(0x000A) __sfr PCLATH;
__at(0x000B) __sfr INTCON;
__at(0x000B) volatile __INTCONbits_t INTCONbits;
__at(0x000C) __sfr PIR1;
__at(0x000C) volatile __PIR1bits_t PIR1bits;
__at(0x000D) __sfr PIR2;
__at(0x000D) volatile __PIR2bits_t PIR2bits;
__at(0x000E) __sfr TMR1;
__at(0x000E) __sfr TMR1L;
__at(0x000F) __sfr TMR1H;
__at(0x0010) __sfr T1CON;
__at(0x0010) volatile __T1CONbits_t T1CONbits;
__at(0x0011) __sfr TMR2;
__at(0x0012) __sfr T2CON;
__at(0x0012) volatile __T2CONbits_t T2CONbits;
__at(0x0013) __sfr SSPBUF;
__at(0x0014) __sfr SSPCON;
__at(0x0014) volatile __SSPCONbits_t SSPCONbits;
__at(0x0015) __sfr CCPR1;
__at(0x0015) __sfr CCPR1L;
__at(0x0016) __sfr CCPR1H;
__at(0x0017) __sfr CCP1CON;
__at(0x0017) volatile __CCP1CONbits_t CCP1CONbits;
__at(0x0018) __sfr RCSTA;
__at(0x0018) volatile __RCSTAbits_t RCSTAbits;
__at(0x0019) __sfr TXREG;
__at(0x001A) __sfr RCREG;
__at(0x001B) __sfr CCPR2;
__at(0x001B) __sfr CCPR2L;
__at(0x001C) __sfr CCPR2H;
__at(0x001D) __sfr CCP2CON;
__at(0x001D) volatile __CCP2CONbits_t CCP2CONbits;
__at(0x001E) __sfr ADRES;
__at(0x001F) __sfr ADCON0;
__at(0x001F) volatile __ADCON0bits_t ADCON0bits;
__at(0x0081) __sfr OPTION_REG;
__at(0x0081) volatile __OPTION_REGbits_t OPTION_REGbits;
__at(0x0085) __sfr TRISA;
__at(0x0085) volatile __TRISAbits_t TRISAbits;
__at(0x0086) __sfr TRISB;
__at(0x0086) volatile __TRISBbits_t TRISBbits;
__at(0x0087) __sfr TRISC;
__at(0x0087) volatile __TRISCbits_t TRISCbits;
__at(0x0089) __sfr TRISE;
__at(0x0089) volatile __TRISEbits_t TRISEbits;
__at(0x008C) __sfr PIE1;
__at(0x008C) volatile __PIE1bits_t PIE1bits;
__at(0x008D) __sfr PIE2;
__at(0x008D) volatile __PIE2bits_t PIE2bits;
__at(0x008E) __sfr PCON;
__at(0x008E) volatile __PCONbits_t PCONbits;
__at(0x008F) __sfr T1GCON;
__at(0x008F) volatile __T1GCONbits_t T1GCONbits;
__at(0x0090) __sfr OSCCON;
__at(0x0090) volatile __OSCCONbits_t OSCCONbits;
__at(0x0091) __sfr OSCTUNE;
__at(0x0091) volatile __OSCTUNEbits_t OSCTUNEbits;
__at(0x0092) __sfr PR2;
__at(0x0093) __sfr SSPADD;
__at(0x0093) __sfr SSPMSK;
__at(0x0094) __sfr SSPSTAT;
__at(0x0094) volatile __SSPSTATbits_t SSPSTATbits;
__at(0x0095) __sfr WPU;
__at(0x0095) volatile __WPUbits_t WPUbits;
__at(0x0095) __sfr WPUB;
__at(0x0095) volatile __WPUBbits_t WPUBbits;
__at(0x0096) __sfr IOC;
__at(0x0096) volatile __IOCbits_t IOCbits;
__at(0x0096) __sfr IOCB;
__at(0x0096) volatile __IOCBbits_t IOCBbits;
__at(0x0098) __sfr TXSTA;
__at(0x0098) volatile __TXSTAbits_t TXSTAbits;
__at(0x0099) __sfr SPBRG;
__at(0x0099) volatile __SPBRGbits_t SPBRGbits;
__at(0x009C) __sfr APFCON;
__at(0x009C) volatile __APFCONbits_t APFCONbits;
__at(0x009D) __sfr FVRCON;
__at(0x009D) volatile __FVRCONbits_t FVRCONbits;
__at(0x009F) __sfr ADCON1;
__at(0x009F) volatile __ADCON1bits_t ADCON1bits;
__at(0x0108) __sfr CPSCON0;
__at(0x0108) volatile __CPSCON0bits_t CPSCON0bits;
__at(0x0109) __sfr CPSCON1;
__at(0x0109) volatile __CPSCON1bits_t CPSCON1bits;
__at(0x010C) __sfr PMDATA;
__at(0x010C) __sfr PMDATL;
__at(0x010D) __sfr PMADR;
__at(0x010D) __sfr PMADRL;
__at(0x010E) __sfr PMDATH;
__at(0x010F) __sfr PMADRH;
__at(0x0185) __sfr ANSELA;
__at(0x0185) volatile __ANSELAbits_t ANSELAbits;
__at(0x0186) __sfr ANSELB;
__at(0x0186) volatile __ANSELBbits_t ANSELBbits;
__at(0x018C) __sfr PMCON1;
__at(0x018C) volatile __PMCON1bits_t PMCON1bits;
|
#pragma once
#include <QString>
#include <QMap>
#include <QSet>
#include <QStringList>
#include <QFile>
#include <QDomDocument>
#include "Renderer.h"
#include "../../../SyntopiaCore/Math/Vector3.h"
namespace StructureSynth {
namespace Model {
namespace Rendering {
using namespace SyntopiaCore::Math;
using namespace SyntopiaCore::GLEngine;
/// A TemplatePrimitive is the definition for a single primitive (like Box or Sphere).
/// It is a simple text string with placeholders for stuff like coordinates and color.
class TemplatePrimitive {
public:
TemplatePrimitive() {};
TemplatePrimitive(QString def) : def(def) {};
TemplatePrimitive(const TemplatePrimitive& t) { this->def = t.def; };
QString getText() { return def; }
void substitute(QString before, QString after) {
def.replace(before, after);
};
bool contains(QString input) {
return def.contains(input);
};
private:
QString def;
};
// A Template contains a number of TemplatePrimitives:
// text definitions for each of the standard primitives (box, sphere, ...) with placeholders
// for stuff like coordinates and color.
class Template {
public:
Template() {};
Template(QFile& file) { read(file); }
Template(QString xmlString) { read(xmlString); }
void read(QFile& file);
void read(QString xmlString);
void parse(QDomDocument& doc);
QMap<QString, TemplatePrimitive>& getPrimitives() { return primitives; }
TemplatePrimitive get(QString name) { return primitives[name]; }
QString getDescription() { return description; }
QString getFullText() { return fullText; }
QString getName() { return name; }
QString getDefaultExtension() { return defaultExtension; }
QString getRunAfter() { return runAfter; }
private:
QMap<QString, TemplatePrimitive> primitives;
QString description;
QString name;
QString defaultExtension;
QString fullText;
QString runAfter;
};
/// A renderer implementation based on the SyntopiaCore POV widget.
class TemplateRenderer : public Renderer {
public:
TemplateRenderer();
TemplateRenderer(QString xmlDefinitionFile);
TemplateRenderer(Template myTemplate);
virtual ~TemplateRenderer();
virtual QString renderClass() { return "template"; }
/// The primitives
virtual void drawBox(SyntopiaCore::Math::Vector3f base,
SyntopiaCore::Math::Vector3f dir1 ,
SyntopiaCore::Math::Vector3f dir2,
SyntopiaCore::Math::Vector3f dir3,
PrimitiveClass* classID);
virtual void drawSphere(SyntopiaCore::Math::Vector3f center, float radius,
PrimitiveClass* classID);
virtual void drawMesh( SyntopiaCore::Math::Vector3f startBase,
SyntopiaCore::Math::Vector3f startDir1,
SyntopiaCore::Math::Vector3f startDir2,
SyntopiaCore::Math::Vector3f endBase,
SyntopiaCore::Math::Vector3f endDir1,
SyntopiaCore::Math::Vector3f endDir2,
PrimitiveClass* classID);
virtual void drawGrid(SyntopiaCore::Math::Vector3f base,
SyntopiaCore::Math::Vector3f dir1,
SyntopiaCore::Math::Vector3f dir2,
SyntopiaCore::Math::Vector3f dir3,
PrimitiveClass* classID);
virtual void drawLine(SyntopiaCore::Math::Vector3f from,
SyntopiaCore::Math::Vector3f to,
PrimitiveClass* classID);
virtual void drawDot(SyntopiaCore::Math::Vector3f pos,
PrimitiveClass* classID);
virtual void drawTriangle(SyntopiaCore::Math::Vector3f p1,
SyntopiaCore::Math::Vector3f p2,
SyntopiaCore::Math::Vector3f p3,
PrimitiveClass* classID);
virtual void callGeneric(PrimitiveClass* classID);
virtual void begin();
virtual void end();
virtual void setColor(SyntopiaCore::Math::Vector3f rgb) { this->rgb = rgb; }
virtual void setBackgroundColor(SyntopiaCore::Math::Vector3f rgb);
virtual void setAlpha(double alpha) { this->alpha = alpha; }
virtual void setPreviousColor(SyntopiaCore::Math::Vector3f rgb) { this->oldRgb = rgb; }
virtual void setPreviousAlpha(double alpha) { this->oldAlpha = alpha; }
QString getOutput() ;
// Issues a command for a specific renderclass such as 'template' or 'opengl'
virtual void callCommand(const QString& renderClass, const QString& command);
bool assertPrimitiveExists(QString templateName);
void setCamera(Vector3f cameraPosition, Vector3f cameraUp, Vector3f cameraRight, Vector3f cameraTarget, int width, int height, double aspect, double fov) {
this->cameraPosition = cameraPosition;
this->cameraUp = cameraUp;
this->cameraRight = cameraRight;
this->cameraTarget = cameraTarget;
this->width = width;
this->height = height;
this->aspect = aspect;
this->fov = fov;
}
void doBeginEndSubstitutions(TemplatePrimitive& t);
void doStandardSubstitutions(SyntopiaCore::Math::Vector3f base,
SyntopiaCore::Math::Vector3f dir1,
SyntopiaCore::Math::Vector3f dir2,
SyntopiaCore::Math::Vector3f dir3,
TemplatePrimitive& t);
private:
SyntopiaCore::Math::Vector3f cameraPosition;
SyntopiaCore::Math::Vector3f cameraUp;
SyntopiaCore::Math::Vector3f cameraRight;
SyntopiaCore::Math::Vector3f cameraTarget;
SyntopiaCore::Math::Vector3f rgb;
SyntopiaCore::Math::Vector3f backRgb;
double alpha;
Template workingTemplate;
QStringList output;
int counter;
int width;
int height;
double aspect;
double fov;
QSet<QString> missingTypes;
SyntopiaCore::Math::Vector3f oldRgb;
double oldAlpha;
};
}
}
}
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
/*
* Copyright © 2003 Greg Kroah-Hartman <greg@kroah.com>
*/
#include "sd-device.h"
#include "sd-netlink.h"
#include "hashmap.h"
#include "macro.h"
#include "udev-rules.h"
#include "udev-util.h"
#include "util.h"
#define READ_END 0
#define WRITE_END 1
#define UDEV_ALLOWED_CHARS_INPUT "/ $%?,"
typedef struct UdevEvent {
sd_device *dev;
sd_device *dev_parent;
sd_device *dev_db_clone;
char *name;
char *program_result;
mode_t mode;
uid_t uid;
gid_t gid;
OrderedHashmap *seclabel_list;
OrderedHashmap *run_list;
usec_t exec_delay_usec;
usec_t birth_usec;
sd_netlink *rtnl;
unsigned builtin_run;
unsigned builtin_ret;
UdevRuleEscapeType esc:8;
bool inotify_watch;
bool inotify_watch_final;
bool group_final;
bool owner_final;
bool mode_final;
bool name_final;
bool devlink_final;
bool run_final;
bool log_level_was_debug;
int default_log_level;
} UdevEvent;
UdevEvent *udev_event_new(sd_device *dev, usec_t exec_delay_usec, sd_netlink *rtnl, int log_level);
UdevEvent *udev_event_free(UdevEvent *event);
DEFINE_TRIVIAL_CLEANUP_FUNC(UdevEvent*, udev_event_free);
size_t udev_event_apply_format(
UdevEvent *event,
const char *src,
char *dest,
size_t size,
bool replace_whitespace);
int udev_check_format(const char *value, size_t *offset, const char **hint);
int udev_event_spawn(
UdevEvent *event,
usec_t timeout_usec,
int timeout_signal,
bool accept_failure,
const char *cmd,
char *result,
size_t ressize);
int udev_event_execute_rules(
UdevEvent *event,
int inotify_fd,
usec_t timeout_usec,
int timeout_signal,
Hashmap *properties_list,
UdevRules *rules);
void udev_event_execute_run(UdevEvent *event, usec_t timeout_usec, int timeout_signal);
int udev_event_process_inotify_watch(UdevEvent *event, int inotify_fd);
static inline usec_t udev_warn_timeout(usec_t timeout_usec) {
return DIV_ROUND_UP(timeout_usec, 3);
}
|
#include <stdio.h>
#include <arpa/inet.h>
#include <string.h>
#include <stdlib.h>
int ping(char *ipaddr) {
char *command = NULL;
char buffer[1024];
FILE *fp;
int stat = 0;
//asprintf (&command, "%s %s -q 2>&1", "fping", ipaddr);
asprintf (&command, "%s %s -c 1", "ping", ipaddr);
printf("%s\n", command);
fp = popen(command, "r");
if (fp == NULL) {
fprintf(stderr, "Failed to execute fping command\n");
free(command);
return -1;
}
while(fread(buffer, sizeof(char), 1024, fp)) {
if (strstr(buffer, "1 received"))
return 0;
}
stat = pclose(fp);
free(command);
return 1;
}
/* Check if an ip address is valid */
int isValidIpAddress(char *ipaddr) {
struct sockaddr_in sa;
int result = inet_pton(AF_INET, ipaddr, &(sa.sin_addr));
return result != 0;
}
int main(int argc, char **argv) {
int status = 0;
if(argc != 2) {
printf("Example Usage: %s 192.168.1.1\n", argv[0]);
return 1;
} else if(!isValidIpAddress(argv[1])) {
printf("%s is an invalid IP Address\n", argv[1]);
return 1;
}
status = ping(argv[1]);
if (status == 0) {
printf("Could ping %s successfully, status %d\n", argv[1], status);
} else {
printf("Machine not reachable, status %d\n", status);
}
return status;
} |
/*-
* Copyright (c) 2003 Marcel Moolenaar
* 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 ``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 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/sys/_null.h,v 1.6.2.1 2005/01/31 23:26:55 imp Exp $
*/
#ifndef NULL
#if defined(_KERNEL) || !defined(__cplusplus)
#define NULL ((void *)0)
#else
#if defined(__LP64__)
#define NULL (0L)
#else
#define NULL 0
#endif /* __LP64__ */
#endif /* _KERNEL || !__cplusplus */
#endif
|
/* Copyright (c) 2002-2012 Croteam Ltd.
This program is free software; you can redistribute it and/or modify
it under the terms of version 2 of the GNU General Public License as published by
the Free Software Foundation
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
// ScriptDoc.h : header file
//
#ifndef SCRIPTDOC_H
#define SCRIPTDOC_H 1
/////////////////////////////////////////////////////////////////////////////
// CScriptDoc document
class CScriptDoc : public CDocument
{
protected:
CScriptDoc(); // protected constructor used by dynamic creation
DECLARE_DYNCREATE(CScriptDoc)
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CScriptDoc)
public:
virtual void Serialize(CArchive& ar); // overridden for document i/o
protected:
virtual BOOL OnNewDocument();
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CScriptDoc();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
// Generated message map functions
protected:
//{{AFX_MSG(CScriptDoc)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#endif // SCRIPTDOC_H
|
/*
* Copyright (c) 2015 Cedric Hnyda <chnyda@suse.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it would 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 the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
* Create a virtual device (mouse), send events to /dev/uinput
* and check that the events are not received in /dev/input/eventX
* because the device is grabbed by another process
*/
#include <linux/input.h>
#include "test.h"
#include "safe_macros.h"
#include "lapi/fcntl.h"
#include "input_helper.h"
#define NB_TEST 20
static void setup(void);
static void send_information(void);
static void cleanup(void);
static int fd;
static int fd2;
char *TCID = "input02";
int main(int ac, char **av)
{
int lc;
int pid;
tst_parse_opts(ac, av, NULL, NULL);
setup();
for (lc = 0; TEST_LOOPING(lc); ++lc) {
pid = tst_fork();
fd2 = open_device();
switch (pid) {
case 0:
send_information();
exit(0);
case -1:
tst_brkm(TBROK | TERRNO, cleanup, "fork() failed");
default:
if (no_events_queued(fd2, 0))
tst_resm(TPASS, "No data received in eventX");
else
tst_resm(TFAIL, "Data received in eventX");
SAFE_CLOSE(NULL, fd2);
break;
}
SAFE_WAITPID(NULL, pid, NULL, 0);
}
cleanup();
tst_exit();
}
static void setup(void)
{
tst_require_root();
fd = open_uinput();
setup_mouse_events(fd);
create_device(fd);
}
static void send_information(void)
{
int nb;
SAFE_IOCTL(NULL, fd2, EVIOCGRAB, 1);
tst_resm(TINFO, "The virtual device was grabbed");
for (nb = 0; nb < NB_TEST; ++nb) {
send_rel_move(fd, 10, 1);
usleep(1000);
}
SAFE_CLOSE(NULL, fd2);
}
static void cleanup(void)
{
destroy_device(fd);
}
|
/*
* This file was generated by mib2c and is intended for use as a mib module
* for the ucd-snmp snmpd agent.
*/
#ifndef _MIBGROUP_LMSENSORS_H
#define _MIBGROUP_LMSENSORS_H
config_require(util_funcs)
config_add_mib(LM-SENSORS-MIB)
void init_lmSensors(void);
FindVarMethod var_lmSensorsTable;
#endif /* _MIBGROUP_LMSENSORS_H */
|
/******************************************************************************
°æÈ¨ËùÓÐ (C), 2001-2011, »ªÎª¼¼ÊõÓÐÏÞ¹«Ë¾
******************************************************************************
ÎÄ ¼þ Ãû : lpc_om_def.h
°æ ±¾ ºÅ : ³õ¸å
×÷ Õß : Hong Huiyong
Éú³ÉÈÕÆÚ : 2013Äê6ÔÂ15ÈÕ
×î½üÐÞ¸Ä :
¹¦ÄÜÃèÊö :
º¯ÊýÁбí :
ÐÞ¸ÄÀúÊ· :
1. ÈÕ ÆÚ : 2013Äê6ÔÂ215
×÷ Õß : Hong Huiyong
ÐÞ¸ÄÄÚÈÝ : ´´½¨Îļþ
******************************************************************************/
#include "balong_lte_dsp.h"
#ifndef __LPC_OM_DEF_H__
#define __LPC_OM_DEF_H__
#define MAX_LPC_CMD_CONTEXT_LENGTH (120)
typedef enum __HSO_SMP_CMD_OPID_ENUM__
{
LPC_SMP_START,
LPC_SMP_QUERY,
LPC_SMP_STOP,
LPC_SMP_CLEAR,
LPC_SMP_START_ONE_ROUND,
}HSO_SMP_CMD_OPID_ENUM;
typedef UINT16 HSO_SMP_CMD_OPID_ENUM_UINT16;
typedef enum __HSO_SMP_CMD_REG_CFG_TYPE_ENUM__
{
LPC_SMP_REG_FULL_REG_CFG,
LPC_SMP_REG_PART_REG_CFG,
}HSO_SMP_CMD_REG_CFG_TYPE_ENUM;
typedef UINT8 HSO_SMP_CMD_REG_CFG_TYPE_ENUM_UINT8;
typedef struct __LPHY_LPC_HSO_SMP_CMD_STRU__
{
UINT32 ulMsgID;
HSO_SMP_CMD_OPID_ENUM_UINT16 enOpID;
UINT16 usPDMap;
UINT32 aulPayload[0];
}LPHY_LPC_HSO_SMP_CMD_STRU;
typedef struct __LPHY_LPC_HSO_SMP_RPT_STRU__
{
UINT32 ulMsgID;
HSO_SMP_CMD_OPID_ENUM_UINT16 enOpID;
UINT16 usValid;
UINT32 aulPayload[0];
}LPHY_LPC_HSO_SMP_RPT_STRU;
typedef struct __LPHY_LPC_HSO_CFG_REG_STRU__
{
UINT32 ulAddr;
UINT32 ulBitMask;
UINT32 ulValue;
}LPHY_LPC_HSO_CFG_REG_STRU;
typedef struct __LPHY_LPC_HSO_RPT_REG_STRU__
{
UINT32 ulAddr;
UINT32 ulValue;
}LPHY_LPC_HSO_RPT_REG_STRU;
/*****************************************************************************
Êý¾Ý½á¹¹ËµÃ÷ : LPHY_CSU_OM_REQ_ÀàÐͶ¨Òå
*****************************************************************************/
typedef enum __LPHY_OM_REQ_LPC_ID_ENUM__
{
LPHY_LPC_OM_REQ_RESERVED = OM_CMD_ID(LPHY_LPC_MID, OM_TYPE_REQ, 0x0),
LPHY_LPC_OM_REQ_HSO_SMP,
}LPHY_OM_REQ_LPC_ID_ENUM;
typedef enum __LPHY_SG_MSGID_LPC_SG_ENUM__
{
LPHY_SG_LPC_RESERVED = OM_CMD_ID(LPHY_LPC_MID,OM_TYPE_SG, 0x0),
LPHY_SG_LPC_HSO_SMP_RPT,
LPHY_SG_LPC_RPT_BUTT,
}LPHY_SG_MSGID_LPC_SG_ENUM;
#endif
|
/*
* machine_kexec.c - handle transition of Linux booting another kernel
*/
#include <linux/cpu.h>
#include <linux/mm.h>
#include <linux/kexec.h>
#include <linux/delay.h>
#include <linux/reboot.h>
#include <linux/io.h>
#include <linux/irq.h>
#include <linux/memblock.h>
#include <asm/pgtable.h>
#include <linux/of_fdt.h>
#include <asm/pgalloc.h>
#include <asm/mmu_context.h>
#include <asm/cacheflush.h>
#include <asm/mach-types.h>
#include <asm/smp_plat.h>
#include <asm/system_misc.h>
extern const unsigned char relocate_new_kernel[];
extern const unsigned int relocate_new_kernel_size;
extern unsigned long kexec_start_address;
extern unsigned long kexec_indirection_page;
extern unsigned long kexec_mach_type;
extern unsigned long kexec_boot_atags;
static atomic_t waiting_for_crash_ipi;
/*
* Provide a dummy crash_notes definition while crash dump arrives to arm.
* This prevents breakage of crash_notes attribute in kernel/ksysfs.c.
*/
int machine_kexec_prepare(struct kimage *image)
{
struct kexec_segment *current_segment;
__be32 header;
int i, err;
/*
* Validate that if the current HW supports SMP, then the SW supports
* and implements CPU hotplug for the current HW. If not, we won't be
* able to kexec reliably, so fail the prepare operation.
*/
if (num_possible_cpus() > 1 && !platform_can_cpu_hotplug())
return -EINVAL;
/*
* No segment at default ATAGs address. try to locate
* a dtb using magic.
*/
for (i = 0; i < image->nr_segments; i++) {
current_segment = &image->segment[i];
if (!memblock_is_region_memory(current_segment->mem,
current_segment->memsz))
return -EINVAL;
err = get_user(header, (__be32*)current_segment->buf);
if (err)
return err;
if (be32_to_cpu(header) == OF_DT_HEADER)
kexec_boot_atags = current_segment->mem;
}
return 0;
}
void machine_kexec_cleanup(struct kimage *image)
{
}
void machine_crash_nonpanic_core(void *unused)
{
struct pt_regs regs;
crash_setup_regs(®s, NULL);
printk(KERN_DEBUG "CPU %u will stop doing anything useful since another CPU has crashed\n",
smp_processor_id());
crash_save_cpu(®s, smp_processor_id());
flush_cache_all();
set_cpu_online(smp_processor_id(), false);
atomic_dec(&waiting_for_crash_ipi);
while (1)
cpu_relax();
}
static void machine_kexec_mask_interrupts(void)
{
unsigned int i;
struct irq_desc *desc;
for_each_irq_desc(i, desc) {
struct irq_chip *chip;
chip = irq_desc_get_chip(desc);
if (!chip)
continue;
if (chip->irq_eoi && irqd_irq_inprogress(&desc->irq_data))
chip->irq_eoi(&desc->irq_data);
if (chip->irq_mask)
chip->irq_mask(&desc->irq_data);
if (chip->irq_disable && !irqd_irq_disabled(&desc->irq_data))
chip->irq_disable(&desc->irq_data);
}
}
void machine_crash_shutdown(struct pt_regs *regs)
{
unsigned long msecs;
local_irq_disable();
disable_nonboot_cpus();
atomic_set(&waiting_for_crash_ipi, num_online_cpus() - 1);
smp_call_function(machine_crash_nonpanic_core, NULL, false);
msecs = 1000; /* Wait at most a second for the other cpus to stop */
while ((atomic_read(&waiting_for_crash_ipi) > 0) && msecs) {
mdelay(1);
msecs--;
}
if (atomic_read(&waiting_for_crash_ipi) > 0)
printk(KERN_WARNING "Non-crashing CPUs did not react to IPI\n");
crash_save_cpu(regs, smp_processor_id());
machine_kexec_mask_interrupts();
printk(KERN_INFO "Loading crashdump kernel...\n");
}
/*
* Function pointer to optional machine-specific reinitialization
*/
void (*kexec_reinit)(void);
void machine_kexec(struct kimage *image)
{
unsigned long page_list;
unsigned long reboot_code_buffer_phys;
void *reboot_code_buffer;
/*
* This can only happen if machine_shutdown() failed to disable some
* CPU, and that can only happen if the checks in
* machine_kexec_prepare() were not correct. If this fails, we can't
* reliably kexec anyway, so BUG_ON is appropriate.
*/
BUG_ON(num_online_cpus() > 1);
page_list = image->head & PAGE_MASK;
/* we need both effective and real address here */
reboot_code_buffer_phys =
page_to_pfn(image->control_code_page) << PAGE_SHIFT;
reboot_code_buffer = page_address(image->control_code_page);
/* Prepare parameters for reboot_code_buffer*/
kexec_start_address = image->start;
kexec_indirection_page = page_list;
kexec_mach_type = machine_arch_type;
if (!kexec_boot_atags)
kexec_boot_atags = image->start - KEXEC_ARM_ZIMAGE_OFFSET + KEXEC_ARM_ATAGS_OFFSET;
/* copy our kernel relocation code to the control code page */
memcpy(reboot_code_buffer,
relocate_new_kernel, relocate_new_kernel_size);
flush_icache_range((unsigned long) reboot_code_buffer,
(unsigned long) reboot_code_buffer + KEXEC_CONTROL_PAGE_SIZE);
printk(KERN_INFO "Bye!\n");
if (kexec_reinit)
kexec_reinit();
soft_restart(reboot_code_buffer_phys);
}
|
/**
* AES CTR routines supporting the Power 7+ Nest Accelerators driver
*
* Copyright (C) 2011-2012 International Business Machines Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 only.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Author: Kent Yoder <yoder1@us.ibm.com>
*/
#include <crypto/aes.h>
#include <crypto/ctr.h>
#include <crypto/algapi.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/crypto.h>
#include <asm/vio.h>
#include "nx_csbcpb.h"
#include "nx.h"
static int ctr_aes_nx_set_key(struct crypto_tfm *tfm,
const u8 *in_key,
unsigned int key_len)
{
struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(tfm);
struct nx_csbcpb *csbcpb = nx_ctx->csbcpb;
nx_ctx_init(nx_ctx, HCOP_FC_AES);
switch (key_len) {
case AES_KEYSIZE_128:
NX_CPB_SET_KEY_SIZE(csbcpb, NX_KS_AES_128);
nx_ctx->ap = &nx_ctx->props[NX_PROPS_AES_128];
break;
case AES_KEYSIZE_192:
NX_CPB_SET_KEY_SIZE(csbcpb, NX_KS_AES_192);
nx_ctx->ap = &nx_ctx->props[NX_PROPS_AES_192];
break;
case AES_KEYSIZE_256:
NX_CPB_SET_KEY_SIZE(csbcpb, NX_KS_AES_256);
nx_ctx->ap = &nx_ctx->props[NX_PROPS_AES_256];
break;
default:
return -EINVAL;
}
csbcpb->cpb.hdr.mode = NX_MODE_AES_CTR;
memcpy(csbcpb->cpb.aes_ctr.key, in_key, key_len);
return 0;
}
static int ctr3686_aes_nx_set_key(struct crypto_tfm *tfm,
const u8 *in_key,
unsigned int key_len)
{
struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(tfm);
if (key_len < CTR_RFC3686_NONCE_SIZE)
return -EINVAL;
memcpy(nx_ctx->priv.ctr.iv,
in_key + key_len - CTR_RFC3686_NONCE_SIZE,
CTR_RFC3686_NONCE_SIZE);
key_len -= CTR_RFC3686_NONCE_SIZE;
return ctr_aes_nx_set_key(tfm, in_key, key_len);
}
static int ctr_aes_nx_crypt(struct blkcipher_desc *desc,
struct scatterlist *dst,
struct scatterlist *src,
unsigned int nbytes)
{
struct nx_crypto_ctx *nx_ctx = crypto_blkcipher_ctx(desc->tfm);
struct nx_csbcpb *csbcpb = nx_ctx->csbcpb;
unsigned long irq_flags;
unsigned int processed = 0, to_process;
u32 max_sg_len;
int rc;
spin_lock_irqsave(&nx_ctx->lock, irq_flags);
max_sg_len = min_t(u32, nx_driver.of.max_sg_len/sizeof(struct nx_sg),
nx_ctx->ap->sglen);
do {
to_process = min_t(u64, nbytes - processed,
nx_ctx->ap->databytelen);
to_process = min_t(u64, to_process,
NX_PAGE_SIZE * (max_sg_len - 1));
to_process = to_process & ~(AES_BLOCK_SIZE - 1);
rc = nx_build_sg_lists(nx_ctx, desc, dst, src, to_process,
processed, csbcpb->cpb.aes_ctr.iv);
if (rc)
goto out;
if (!nx_ctx->op.inlen || !nx_ctx->op.outlen) {
rc = -EINVAL;
goto out;
}
rc = nx_hcall_sync(nx_ctx, &nx_ctx->op,
desc->flags & CRYPTO_TFM_REQ_MAY_SLEEP);
if (rc)
goto out;
memcpy(desc->info, csbcpb->cpb.aes_cbc.cv, AES_BLOCK_SIZE);
atomic_inc(&(nx_ctx->stats->aes_ops));
atomic64_add(csbcpb->csb.processed_byte_count,
&(nx_ctx->stats->aes_bytes));
processed += to_process;
} while (processed < nbytes);
out:
spin_unlock_irqrestore(&nx_ctx->lock, irq_flags);
return rc;
}
static int ctr3686_aes_nx_crypt(struct blkcipher_desc *desc,
struct scatterlist *dst,
struct scatterlist *src,
unsigned int nbytes)
{
struct nx_crypto_ctx *nx_ctx = crypto_blkcipher_ctx(desc->tfm);
u8 *iv = nx_ctx->priv.ctr.iv;
memcpy(iv + CTR_RFC3686_NONCE_SIZE,
desc->info, CTR_RFC3686_IV_SIZE);
iv[15] = 1;
desc->info = nx_ctx->priv.ctr.iv;
return ctr_aes_nx_crypt(desc, dst, src, nbytes);
}
struct crypto_alg nx_ctr_aes_alg = {
.cra_name = "ctr(aes)",
.cra_driver_name = "ctr-aes-nx",
.cra_priority = 300,
.cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
.cra_blocksize = 1,
.cra_ctxsize = sizeof(struct nx_crypto_ctx),
.cra_type = &crypto_blkcipher_type,
.cra_module = THIS_MODULE,
.cra_list = LIST_HEAD_INIT(nx_ctr_aes_alg.cra_list),
.cra_init = nx_crypto_ctx_aes_ctr_init,
.cra_exit = nx_crypto_ctx_exit,
.cra_blkcipher = {
.min_keysize = AES_MIN_KEY_SIZE,
.max_keysize = AES_MAX_KEY_SIZE,
.ivsize = AES_BLOCK_SIZE,
.setkey = ctr_aes_nx_set_key,
.encrypt = ctr_aes_nx_crypt,
.decrypt = ctr_aes_nx_crypt,
}
};
struct crypto_alg nx_ctr3686_aes_alg = {
.cra_name = "rfc3686(ctr(aes))",
.cra_driver_name = "rfc3686-ctr-aes-nx",
.cra_priority = 300,
.cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
.cra_blocksize = 1,
.cra_ctxsize = sizeof(struct nx_crypto_ctx),
.cra_type = &crypto_blkcipher_type,
.cra_module = THIS_MODULE,
.cra_list = LIST_HEAD_INIT(nx_ctr3686_aes_alg.cra_list),
.cra_init = nx_crypto_ctx_aes_ctr_init,
.cra_exit = nx_crypto_ctx_exit,
.cra_blkcipher = {
.min_keysize = AES_MIN_KEY_SIZE + CTR_RFC3686_NONCE_SIZE,
.max_keysize = AES_MAX_KEY_SIZE + CTR_RFC3686_NONCE_SIZE,
.ivsize = CTR_RFC3686_IV_SIZE,
.geniv = "seqiv",
.setkey = ctr3686_aes_nx_set_key,
.encrypt = ctr3686_aes_nx_crypt,
.decrypt = ctr3686_aes_nx_crypt,
}
};
|
/*
* data_breakpoint.c - Sample HW Breakpoint file to watch kernel data address
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* usage: insmod data_breakpoint.ko ksym=<ksym_name>
*
* This file is a kernel module that places a breakpoint over ksym_name kernel
* variable using Hardware Breakpoint register. The corresponding handler which
* prints a backtrace is invoked every time a write operation is performed on
* that variable.
*
* Copyright (C) IBM Corporation, 2009
*
* Author: K.Prasad <prasad@linux.vnet.ibm.com>
*/
#include <linux/module.h> /* Needed by all modules */
#include <linux/kernel.h> /* Needed for KERN_INFO */
#include <linux/init.h> /* Needed for the macros */
#include <linux/kallsyms.h>
#include <linux/perf_event.h>
#include <linux/hw_breakpoint.h>
struct perf_event * __percpu *sample_hbp;
static char ksym_name[KSYM_NAME_LEN] = "pid_max";
module_param_string(ksym, ksym_name, KSYM_NAME_LEN, S_IRUGO);
MODULE_PARM_DESC(ksym, "Kernel symbol to monitor; this module will report any"
" write operations on the kernel symbol");
static void sample_hbp_handler(struct perf_event *bp,
struct perf_sample_data *data,
struct pt_regs *regs)
{
printk(KERN_INFO "%s value is changed\n", ksym_name);
dump_stack();
printk(KERN_INFO "Dump stack from sample_hbp_handler\n");
}
static int __init hw_break_module_init(void)
{
int ret;
struct perf_event_attr attr;
hw_breakpoint_init(&attr);
attr.bp_addr = kallsyms_lookup_name(ksym_name);
attr.bp_len = HW_BREAKPOINT_LEN_4;
attr.bp_type = HW_BREAKPOINT_W | HW_BREAKPOINT_R;
sample_hbp = register_wide_hw_breakpoint(&attr, sample_hbp_handler);
if (IS_ERR((void __force *)sample_hbp)) {
ret = PTR_ERR((void __force *)sample_hbp);
goto fail;
}
printk(KERN_INFO "HW Breakpoint for %s write installed\n", ksym_name);
return 0;
fail:
printk(KERN_INFO "Breakpoint registration failed\n");
return ret;
}
static void __exit hw_break_module_exit(void)
{
unregister_wide_hw_breakpoint(sample_hbp);
printk(KERN_INFO "HW Breakpoint for %s write uninstalled\n", ksym_name);
}
module_init(hw_break_module_init);
module_exit(hw_break_module_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("K.Prasad");
MODULE_DESCRIPTION("ksym breakpoint");
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the files COPYING and Copyright.html. COPYING can be found at the root *
* of the source code distribution tree; Copyright.html can be found at the *
* root level of an installed copy of the electronic HDF5 document set and *
* is linked from the top-level documents page. It can also be found at *
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* If you are reading this file and it has a '.h' suffix, it was automatically
* generated from the '.in' version. Make changes there. But for OpenVMS, this
* file is created by hand.
*/
/* Set the 'srcdir' path from configure time */
static const char *config_srcdir = "[.]";
|
/*---------------------------------------------------------------------------*\
FILE........: defines.h
AUTHOR......: David Rowe
DATE CREATED: 23/4/93
Defines and structures used throughout the codec.
\*---------------------------------------------------------------------------*/
/*
Copyright (C) 2009 David Rowe
All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License version 2.1, as
published by the Free Software Foundation. This program is
distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __DEFINES__
#define __DEFINES__
/*---------------------------------------------------------------------------*\
DEFINES
\*---------------------------------------------------------------------------*/
/* General defines */
#define N_S 0.01 /* internal proc frame length in secs */
#define TW_S 0.005 /* trapezoidal synth window overlap */
#define MAX_AMP 160 /* maximum number of harmonics */
#ifndef PI
#define PI 3.141592654 /* mathematical constant */
#endif
#define TWO_PI 6.283185307 /* mathematical constant */
#define MAX_STR 2048 /* maximum string size */
#define FFT_ENC 512 /* size of FFT used for encoder */
#define FFT_DEC 512 /* size of FFT used in decoder */
#define V_THRESH 6.0 /* voicing threshold in dB */
#define LPC_ORD 10 /* LPC order */
#define LPC_ORD_LOW 6 /* LPC order for lower rates */
/* Pitch estimation defines */
#define M_PITCH_S 0.0400 /* pitch analysis window in s */
#define P_MIN_S 0.0025 /* minimum pitch period in s */
#define P_MAX_S 0.0200 /* maximum pitch period in s */
/*---------------------------------------------------------------------------*\
TYPEDEFS
\*---------------------------------------------------------------------------*/
/* Structure to hold constants calculated at run time based on sample rate */
typedef struct {
int Fs; /* sample rate of this instance */
int n_samp; /* number of samples per 10ms frame at Fs */
int max_amp; /* maximum number of harmonics */
int m_pitch; /* pitch estimation window size in samples */
int p_min; /* minimum pitch period in samples */
int p_max; /* maximum pitch period in samples */
float Wo_min;
float Wo_max;
int nw; /* analysis window size in samples */
int tw; /* trapezoidal synthesis window overlap */
} C2CONST;
/* Structure to hold model parameters for one frame */
typedef struct {
float Wo; /* fundamental frequency estimate in radians */
int L; /* number of harmonics */
float A[MAX_AMP+1]; /* amplitiude of each harmonic */
float phi[MAX_AMP+1]; /* phase of each harmonic */
int voiced; /* non-zero if this frame is voiced */
} MODEL;
/* describes each codebook */
struct lsp_codebook {
int k; /* dimension of vector */
int log2m; /* number of bits in m */
int m; /* elements in codebook */
const float * cb; /* The elements */
};
extern const struct lsp_codebook lsp_cb[];
extern const struct lsp_codebook lsp_cbd[];
extern const struct lsp_codebook lsp_cbvq[];
extern const struct lsp_codebook lsp_cbjnd[];
extern const struct lsp_codebook lsp_cbdt[];
extern const struct lsp_codebook lsp_cbjvm[];
extern const struct lsp_codebook lsp_cbvqanssi[];
extern const struct lsp_codebook mel_cb[];
extern const struct lsp_codebook ge_cb[];
extern const struct lsp_codebook lspmelvq_cb[];
extern const struct lsp_codebook newamp1vq_cb[];
extern const struct lsp_codebook newamp1_energy_cb[];
extern const struct lsp_codebook newamp2vq_cb[];
extern const struct lsp_codebook newamp2_energy_cb[];
#ifdef _GNU_SOURCE
#define POW10F(x) exp10f((x))
#else
#define POW10F(x) expf(2.302585092994046f*(x))
#endif
#endif
|
#define NMAX 2000
#define A_SIZE NMAX
#define B_SIZE NMAX
static double A[A_SIZE][A_SIZE];
static double B[B_SIZE][B_SIZE];
static double C[B_SIZE][B_SIZE];
|
// Copyright (c) the JPEG XL Project Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#ifndef LIB_JXL_CONVOLVE_H_
#define LIB_JXL_CONVOLVE_H_
// 2D convolution.
#include <stddef.h>
#include <stdint.h>
#include "lib/jxl/base/data_parallel.h"
#include "lib/jxl/image.h"
namespace jxl {
// No valid values outside [0, xsize), but the strategy may still safely load
// the preceding vector, and/or round xsize up to the vector lane count. This
// avoids needing PadImage.
// Requires xsize >= kConvolveLanes + kConvolveMaxRadius.
static constexpr size_t kConvolveMaxRadius = 3;
// Weights must already be normalized.
struct WeightsSymmetric3 {
// d r d (each replicated 4x)
// r c r
// d r d
float c[4];
float r[4];
float d[4];
};
struct WeightsSymmetric5 {
// The lower-right quadrant is: c r R (each replicated 4x)
// r d L
// R L D
float c[4];
float r[4];
float R[4];
float d[4];
float D[4];
float L[4];
};
// Weights for separable 5x5 filters (typically but not necessarily the same
// values for horizontal and vertical directions). The kernel must already be
// normalized, but note that values for negative offsets are omitted, so the
// given values do not sum to 1.
struct WeightsSeparable5 {
// Horizontal 1D, distances 0..2 (each replicated 4x)
float horz[3 * 4];
float vert[3 * 4];
};
// Weights for separable 7x7 filters (typically but not necessarily the same
// values for horizontal and vertical directions). The kernel must already be
// normalized, but note that values for negative offsets are omitted, so the
// given values do not sum to 1.
//
// NOTE: for >= 7x7 Gaussian kernels, it is faster to use FastGaussian instead,
// at least when images exceed the L1 cache size.
struct WeightsSeparable7 {
// Horizontal 1D, distances 0..3 (each replicated 4x)
float horz[4 * 4];
float vert[4 * 4];
};
const WeightsSymmetric3& WeightsSymmetric3Lowpass();
const WeightsSeparable5& WeightsSeparable5Lowpass();
const WeightsSymmetric5& WeightsSymmetric5Lowpass();
void SlowSymmetric3(const ImageF& in, const Rect& rect,
const WeightsSymmetric3& weights, ThreadPool* pool,
ImageF* JXL_RESTRICT out);
void SlowSymmetric3(const Image3F& in, const Rect& rect,
const WeightsSymmetric3& weights, ThreadPool* pool,
Image3F* JXL_RESTRICT out);
void SlowSeparable5(const ImageF& in, const Rect& rect,
const WeightsSeparable5& weights, ThreadPool* pool,
ImageF* out);
void SlowSeparable5(const Image3F& in, const Rect& rect,
const WeightsSeparable5& weights, ThreadPool* pool,
Image3F* out);
void SlowSeparable7(const ImageF& in, const Rect& rect,
const WeightsSeparable7& weights, ThreadPool* pool,
ImageF* out);
void SlowSeparable7(const Image3F& in, const Rect& rect,
const WeightsSeparable7& weights, ThreadPool* pool,
Image3F* out);
void SlowLaplacian5(const ImageF& in, const Rect& rect, ThreadPool* pool,
ImageF* out);
void SlowLaplacian5(const Image3F& in, const Rect& rect, ThreadPool* pool,
Image3F* out);
void Symmetric3(const ImageF& in, const Rect& rect,
const WeightsSymmetric3& weights, ThreadPool* pool,
ImageF* out);
void Symmetric5(const ImageF& in, const Rect& rect,
const WeightsSymmetric5& weights, ThreadPool* pool,
ImageF* JXL_RESTRICT out);
void Symmetric5_3(const Image3F& in, const Rect& rect,
const WeightsSymmetric5& weights, ThreadPool* pool,
Image3F* JXL_RESTRICT out);
void Separable5(const ImageF& in, const Rect& rect,
const WeightsSeparable5& weights, ThreadPool* pool,
ImageF* out);
void Separable5_3(const Image3F& in, const Rect& rect,
const WeightsSeparable5& weights, ThreadPool* pool,
Image3F* out);
void Separable7(const ImageF& in, const Rect& rect,
const WeightsSeparable7& weights, ThreadPool* pool,
ImageF* out);
void Separable7_3(const Image3F& in, const Rect& rect,
const WeightsSeparable7& weights, ThreadPool* pool,
Image3F* out);
} // namespace jxl
#endif // LIB_JXL_CONVOLVE_H_
|
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
/**
* Driver for the Philips PCA9632 LED driver.
* Written by Robert Mendon Feb 2017.
*/
struct LEDColor;
typedef LEDColor LEDColor;
void pca9632_set_led_color(const LEDColor &color);
|
// rijndael.h - originally written and placed in the public domain by Wei Dai
/// \file rijndael.h
/// \brief Classes for Rijndael encryption algorithm
/// \details All key sizes are supported. The library only provides Rijndael with 128-bit blocks,
/// and not 192-bit or 256-bit blocks
/// \since Rijndael since Crypto++ 3.1, Intel AES-NI since Crypto++ 5.6.1, ARMv8 AES since Crypto++ 6.0,
/// Power8 AES since Crypto++ 6.0, ARMv7 AES since Crypto++ 8.0
#ifndef CRYPTOPP_RIJNDAEL_H
#define CRYPTOPP_RIJNDAEL_H
#include "seckey.h"
#include "secblock.h"
// Clang 3.3 integrated assembler crash on Linux. Clang 3.4 due to compiler
// error with .intel_syntax, http://llvm.org/bugs/show_bug.cgi?id=24232
#if CRYPTOPP_BOOL_X32 || defined(CRYPTOPP_DISABLE_MIXED_ASM)
# define CRYPTOPP_DISABLE_RIJNDAEL_ASM 1
#endif
#if CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_ARM32 || \
CRYPTOPP_BOOL_ARMV8 || CRYPTOPP_BOOL_PPC32 || CRYPTOPP_BOOL_PPC64
# define CRYPTOPP_RIJNDAEL_ADVANCED_PROCESS_BLOCKS 1
#endif
NAMESPACE_BEGIN(CryptoPP)
/// \brief Rijndael block cipher information
/// \details All key sizes are supported. The library only provides Rijndael with 128-bit blocks,
/// and not 192-bit or 256-bit blocks
/// \since Rijndael since Crypto++ 3.1, Intel AES-NI since Crypto++ 5.6.1, ARMv8 AES since Crypto++ 6.0,
/// Power8 AES since Crypto++ 6.0, ARMv7 AES since Crypto++ 8.0
struct Rijndael_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 32, 8>
{
CRYPTOPP_DLL static const char * CRYPTOPP_API StaticAlgorithmName() {return CRYPTOPP_RIJNDAEL_NAME;}
};
/// \brief Rijndael block cipher
/// \details All key sizes are supported. The library only provides Rijndael with 128-bit blocks,
/// and not 192-bit or 256-bit blocks
/// \since Rijndael since Crypto++ 3.1, Intel AES-NI since Crypto++ 5.6.1, ARMv8 AES since Crypto++ 6.0,
/// Power8 AES since Crypto++ 6.0, ARMv7 AES since Crypto++ 8.0
/// \sa <a href="http://www.cryptopp.com/wiki/Rijndael">Rijndael</a>
class CRYPTOPP_DLL Rijndael : public Rijndael_Info, public BlockCipherDocumentation
{
/// \brief Rijndael block cipher transformation functions
/// \details Provides implementation common to encryption and decryption
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<Rijndael_Info>
{
public:
void UncheckedSetKey(const byte *userKey, unsigned int keyLength, const NameValuePairs ¶ms);
std::string AlgorithmProvider() const;
unsigned int OptimalDataAlignment() const;
protected:
static void FillEncTable();
static void FillDecTable();
// VS2005 workaround: have to put these on separate lines, or error C2487 is triggered in DLL build
static const byte Se[256];
static const byte Sd[256];
static const word32 rcon[];
unsigned int m_rounds;
SecBlock<word32, AllocatorWithCleanup<word32, true> > m_key;
mutable SecByteBlock m_aliasBlock;
};
/// \brief Encryption transformation
/// \details Enc provides implementation for encryption transformation. All key sizes are supported.
/// The library only provides Rijndael with 128-bit blocks, and not 192-bit or 256-bit blocks
/// \since Rijndael since Crypto++ 3.1, Intel AES-NI since Crypto++ 5.6.1, ARMv8 AES since Crypto++ 6.0,
/// Power8 AES since Crypto++ 6.0, ARMv7 AES since Crypto++ 8.0
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Enc : public Base
{
public:
void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
#if CRYPTOPP_RIJNDAEL_ADVANCED_PROCESS_BLOCKS
size_t AdvancedProcessBlocks(const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags) const;
#endif
};
/// \brief Decryption transformation
/// \details Dec provides implementation for decryption transformation. All key sizes are supported.
/// The library only provides Rijndael with 128-bit blocks, and not 192-bit or 256-bit blocks
/// \since Rijndael since Crypto++ 3.1, Intel AES-NI since Crypto++ 5.6.1, ARMv8 AES since Crypto++ 6.0,
/// Power8 AES since Crypto++ 6.0, ARMv7 AES since Crypto++ 8.0
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Dec : public Base
{
public:
void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
#if CRYPTOPP_RIJNDAEL_ADVANCED_PROCESS_BLOCKS
size_t AdvancedProcessBlocks(const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags) const;
#endif
};
public:
typedef BlockCipherFinal<ENCRYPTION, Enc> Encryption;
typedef BlockCipherFinal<DECRYPTION, Dec> Decryption;
};
typedef Rijndael::Encryption RijndaelEncryption;
typedef Rijndael::Decryption RijndaelDecryption;
NAMESPACE_END
#endif
|
/*
* This file is part of the libsigrok project.
*
* Copyright (C) 2013 Uwe Hermann <uwe@hermann-uwe.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stdlib.h>
#include <check.h>
#include "../libsigrok.h"
Suite *suite_core(void);
Suite *suite_driver_all(void);
Suite *suite_input_all(void);
Suite *suite_input_binary(void);
Suite *suite_output_all(void);
Suite *suite_strutil(void);
Suite *suite_version(void);
int main(void)
{
int ret;
Suite *s;
SRunner *srunner;
s = suite_create("mastersuite");
srunner = srunner_create(s);
/* Add all testsuites to the master suite. */
srunner_add_suite(srunner, suite_core());
srunner_add_suite(srunner, suite_driver_all());
srunner_add_suite(srunner, suite_input_all());
srunner_add_suite(srunner, suite_input_binary());
srunner_add_suite(srunner, suite_output_all());
srunner_add_suite(srunner, suite_strutil());
srunner_add_suite(srunner, suite_version());
srunner_run_all(srunner, CK_VERBOSE);
ret = srunner_ntests_failed(srunner);
srunner_free(srunner);
return (ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
|
/*
Kopete Yahoo Protocol
Notifies about new mails
Copyright (c) 2005 André Duffeck <duffeck@kde.org>
*************************************************************************
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
*************************************************************************
*/
#ifndef MAILNOTIFIERTASK_H
#define MAILNOTIFIERTASK_H
#include "task.h"
class QString;
class YMSGTransfer;
/**
@author André Duffeck
*/
class MailNotifierTask : public Task
{
Q_OBJECT
public:
MailNotifierTask(Task *parent);
~MailNotifierTask();
bool take(Transfer *transfer);
protected:
virtual bool forMe( const Transfer *transfer ) const;
void parseMail( YMSGTransfer *transfer );
signals:
void mailNotify(const QString&, const QString&, int);
};
#endif
|
/*
* vz_sdk.h: core driver functions for managing
* Parallels Cloud Server hosts
*
* Copyright (C) 2014 Parallels, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
#pragma once
#include <Parallels.h>
#include "vz_utils.h"
int prlsdkInit(void);
void prlsdkDeinit(void);
int prlsdkConnect(vzDriverPtr driver);
void prlsdkDisconnect(vzDriverPtr driver);
int
prlsdkLoadDomains(vzDriverPtr driver);
virDomainObjPtr
prlsdkAddDomainByUUID(vzDriverPtr driver, const unsigned char *uuid);
virDomainObjPtr
prlsdkAddDomainByName(vzDriverPtr driver, const char *name);
int prlsdkUpdateDomain(vzDriverPtr driver, virDomainObjPtr dom);
int prlsdkStart(virDomainObjPtr dom);
int prlsdkKill(virDomainObjPtr dom);
int prlsdkStop(virDomainObjPtr dom);
int prlsdkPause(virDomainObjPtr dom);
int prlsdkResume(virDomainObjPtr dom);
int prlsdkSuspend(virDomainObjPtr dom);
int prlsdkRestart(virDomainObjPtr dom);
int prlsdkReset(virDomainObjPtr dom);
int
prlsdkApplyConfig(vzDriverPtr driver,
virDomainObjPtr dom,
virDomainDefPtr new);
int prlsdkCreateVm(vzDriverPtr driver, virDomainDefPtr def);
int prlsdkCreateCt(virConnectPtr conn, virDomainDefPtr def);
int
prlsdkUnregisterDomain(vzDriverPtr driver, virDomainObjPtr dom, unsigned int flags);
int
prlsdkDomainManagedSaveRemove(virDomainObjPtr dom);
int
prlsdkAttachDevice(vzDriverPtr driver, virDomainObjPtr dom, virDomainDeviceDefPtr dev);
int
prlsdkDetachDevice(vzDriverPtr driver, virDomainObjPtr dom, virDomainDeviceDefPtr dev);
int
prlsdkUpdateDevice(vzDriverPtr driver, virDomainObjPtr dom, virDomainDeviceDefPtr dev);
int
prlsdkGetBlockStats(PRL_HANDLE sdkstats, virDomainDiskDefPtr disk, virDomainBlockStatsPtr stats, bool isCt);
int
prlsdkGetNetStats(PRL_HANDLE sdkstas, PRL_HANDLE sdkdom, const char *path, virDomainInterfaceStatsPtr stats);
int
prlsdkGetVcpuStats(PRL_HANDLE sdkstas, int idx, unsigned long long *time);
int
prlsdkGetMemoryStats(PRL_HANDLE sdkstas, virDomainMemoryStatPtr stats, unsigned int nr_stats);
/* memsize is in MiB */
int prlsdkSetMemsize(virDomainObjPtr dom, unsigned int memsize);
int prlsdkSetCpuCount(virDomainObjPtr dom, unsigned int count);
int
prlsdkDomainSetUserPassword(virDomainObjPtr dom,
const char *user,
const char *password);
virDomainSnapshotObjListPtr prlsdkLoadSnapshots(virDomainObjPtr dom);
int prlsdkCreateSnapshot(virDomainObjPtr dom, const char *description);
int prlsdkDeleteSnapshot(virDomainObjPtr dom, const char *uuid, bool children);
int prlsdkSwitchToSnapshot(virDomainObjPtr dom, const char *uuid, bool paused);
int
prlsdkMigrate(virDomainObjPtr dom,
virURIPtr uri,
const char unsigned *session_uuid,
const char *dname,
unsigned int flags);
PRL_HANDLE
prlsdkSdkDomainLookupByName(vzDriverPtr driver, const char *name);
int prlsdkCancelJob(virDomainObjPtr dom);
int prlsdkResizeImage(virDomainObjPtr dom, virDomainDiskDefPtr disk, unsigned long long newsize);
|
#ifndef __XML_LITE_SERIALIZABLE_H__
#define __XML_LITE_SERIALIZABLE_H__
#include "io/OutputStream.h"
#include "io/InputStream.h"
#include "io/Serializable.h"
#include "xml/lite/MinidomParser.h"
/*!
* \file Serializable.h
* \brief Provides the class for creating and processing XML documents
*
* This file contains the serializable class for XML documents
*/
namespace xml
{
namespace lite
{
/*!
* \class Serializable
* \brief Document building and processing class
*
* This class provides a Serializable interface for XML documents.
* Internally, it has a parser for XML, and it has a "document"
* containing a tree representation for all of its nodes. Note that
* all nodes in a document are dynamically allocated. They are deleted
* by the class at destruction time.
*/
class Serializable : public io::Serializable
{
public:
//! Constructor
Serializable() {}
Serializable(Document* document, bool own = true)
{
setDocument(document, own);
}
//! Destructor
virtual ~Serializable() {}
/*!
* Return in the document as it is. Consider throwing null-pointer
* ref upon null.
* \return A Document
*/
virtual Document *getDocument() const
{
return mParser.getDocument();
}
virtual Document *getDocument(bool steal = false)
{
return mParser.getDocument(steal);
}
/*!
* This is the public interface for resetting the
* XML document. This will call the handler version of this
* function, which will delete the old document.
*
* \param newDocument The new document.
*/
void setDocument(Document* document, bool own = true)
{
mParser.setDocument(document, own);
}
/*!
* Transfer this object into a byte stream
* \param os The object to serialize this to
*/
virtual void serialize(io::OutputStream& os);
/*!
* Unpack this input stream to the object
* \param is Stream to read object from
*/
virtual void deserialize(io::InputStream& is);
protected:
//! The parser
::xml::lite::MinidomParser mParser;
};
}
}
#endif
|
/*++
Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
AcpiDescription.c
Abstract:
GUIDs used for ACPI Description
--*/
#include "Tiano.h"
#include EFI_GUID_DEFINITION (AcpiDescription)
EFI_GUID gEfiAcpiDescriptionGuid = EFI_ACPI_DESCRIPTION_GUID;
EFI_GUID_STRING(&gEfiAcpiDescriptionGuid, "ACPI Description", "ACPI Description GUID");
|
/*
* Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#import "AutoScalingAlarm.h"
/**
* Scaling Policy
*/
@interface AutoScalingScalingPolicy:NSObject
{
NSString *autoScalingGroupName;
NSString *policyName;
NSNumber *scalingAdjustment;
NSString *adjustmentType;
NSNumber *cooldown;
NSString *policyARN;
NSMutableArray *alarms;
NSNumber *minAdjustmentStep;
}
/**
* Default constructor for a new object. Callers should use the
* property methods to initialize this object after creating it.
*/
-(id)init;
/**
* The name of the Auto Scaling group associated with this scaling
* policy.
* <p>
* <b>Constraints:</b><br/>
* <b>Length: </b>1 - 255<br/>
* <b>Pattern: </b>[\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*<br/>
*/
@property (nonatomic, retain) NSString *autoScalingGroupName;
/**
* The name of the scaling policy.
* <p>
* <b>Constraints:</b><br/>
* <b>Length: </b>1 - 255<br/>
* <b>Pattern: </b>[\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*<br/>
*/
@property (nonatomic, retain) NSString *policyName;
/**
* The number associated with the specified adjustment type. A positive
* value adds to the current capacity and a negative value removes from
* the current capacity.
*/
@property (nonatomic, retain) NSNumber *scalingAdjustment;
/**
* Specifies whether the <code>ScalingAdjustment</code> is an absolute
* number or a percentage of the current capacity. Valid values are
* <code>ChangeInCapacity</code>, <code>ExactCapacity</code>, and
* <code>PercentChangeInCapacity</code>.
* <p>
* <b>Constraints:</b><br/>
* <b>Length: </b>1 - 255<br/>
* <b>Pattern: </b>[\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*<br/>
*/
@property (nonatomic, retain) NSString *adjustmentType;
/**
* The amount of time, in seconds, after a scaling activity completes
* before any further trigger-related scaling activities can start.
*/
@property (nonatomic, retain) NSNumber *cooldown;
/**
* The Amazon Resource Name (ARN) of the policy.
* <p>
* <b>Constraints:</b><br/>
* <b>Length: </b>1 - 1600<br/>
* <b>Pattern: </b>[\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*<br/>
*/
@property (nonatomic, retain) NSString *policyARN;
/**
* A list of CloudWatch Alarms related to the policy.
*/
@property (nonatomic, retain) NSMutableArray *alarms;
/**
* Changes the <code>DesiredCapacity</code> of the Auto Scaling group by
* at least the specified number of instances.
*/
@property (nonatomic, retain) NSNumber *minAdjustmentStep;
/**
* Adds a single object to alarms.
* This function will alloc and init alarms if not already done.
*/
-(void)addAlarm:(AutoScalingAlarm *)alarmObject;
/**
* Returns a string representation of this object; useful for testing and
* debugging.
*
* @return A string representation of this object.
*/
-(NSString *)description;
@end
|
/*
* Copyright (c) 2001, Swedish Institute of Computer Science.
* 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 Institute 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 INSTITUTE 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 INSTITUTE 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.
*
* This file is part of the lwIP TCP/IP stack.
*
* Author: Adam Dunkels <adam@sics.se>
*
* $Id: sys_arch.h,v 1.3 2005/03/13 16:03:23 bear Exp $
*/
#ifndef __ARCH_SYS_ARCH_H__
#define __ARCH_SYS_ARCH_H__
#include "arch/cc.h"
#include <rtthread.h>
#ifndef BYTE_ORDER
#define BYTE_ORDER LITTLE_ENDIAN
#endif
#define SYS_MBOX_NULL RT_NULL
#define SYS_SEM_NULL RT_NULL
typedef u32_t sys_prot_t;
#define SYS_MBOX_SIZE 10
#define SYS_LWIP_TIMER_NAME "timer"
#define SYS_LWIP_MBOX_NAME "mbox"
#define SYS_LWIP_SEM_NAME "sem"
#define SYS_LWIP_MUTEX_NAME "mu"
typedef rt_sem_t sys_sem_t;
typedef rt_mutex_t sys_mutex_t;
typedef rt_mailbox_t sys_mbox_t;
typedef rt_thread_t sys_thread_t;
// err_t sys_mbox_trypost_fromisr(sys_mbox_t *q, void *msg);
#endif /* __ARCH_SYS_ARCH_H__ */
|
/*
* Copyright 2012 Facebook
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#import "FBSession.h"
@interface FBSession (Internal)
- (void)refreshAccessToken:(NSString*)token expirationDate:(NSDate*)expireDate;
- (BOOL)shouldExtendAccessToken;
+ (FBSession*)activeSessionIfOpen;
+ (void)deleteFacebookCookies;
+ (NSDate*)expirationDateFromExpirationTimeString:(NSString*)expirationTime;
@end
|
/* Copyright 2020 The TensorFlow 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 TENSORFLOW_COMPILER_MLIR_LITE_UTILS_CONSTANT_UTILS_H_
#define TENSORFLOW_COMPILER_MLIR_LITE_UTILS_CONSTANT_UTILS_H_
#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project
#include "mlir/IR/BuiltinTypes.h" // from @llvm-project
#include "mlir/IR/Location.h" // from @llvm-project
#include "mlir/IR/Operation.h" // from @llvm-project
#include "mlir/IR/PatternMatch.h" // from @llvm-project
#include "tensorflow/stream_executor/lib/statusor.h"
namespace mlir {
namespace TFL {
// Returns a Constant op with a single value.
stream_executor::port::StatusOr<arith::ConstantOp> CreateConstOpWithSingleValue(
PatternRewriter* rewriter, Location loc, ShapedType shaped_type, int value);
} // namespace TFL
} // namespace mlir
#endif // TENSORFLOW_COMPILER_MLIR_LITE_UTILS_CONSTANT_UTILS_H_
|
#ifndef C_IDENTIFIER_CLASS_H
#define C_IDENTIFIER_CLASS_H
#include "7c-identifier-lib++_export.h"
class _7C_IDENTIFIER_LIB___EXPORT CIdentifierClass
{
public:
int someMethod() const;
};
#endif
|
/*
* Copyright (c) 1980 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*/
/*
* Somewhat modified to key on strstr(" instead of error(", for use
* as a general purpose string stripper. Also replaces pointer with
* a (long) pointer.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#define ungetchar(c) ungetc(c, stdin)
/*
* mkstr - create a string error message file by massaging C source
*
* Bill Joy UCB August 1977
*
* Modified March 1978 to hash old messages to be able to recompile
* without addding messages to the message file (usually)
*
* Based on an earlier program conceived by Bill Joy and Chuck Haley
*
* Program to create a string error message file
* from a group of C programs. Arguments are the name
* of the file where the strings are to be placed, the
* prefix of the new files where the processed source text
* is to be placed, and the files to be processed.
*
* The program looks for 'strstr("' in the source stream.
* Whenever it finds this, the following characters from the '"'
* to a '"' are replaced by 'seekpt' where seekpt is a
* pointer into the error message file.
* If the '(' is not immediately followed by a '"' no change occurs.
*
* The optional '-' causes strings to be added at the end of the
* existing error message file for recompilation of single routines.
*/
FILE *mesgread, *mesgwrite;
char *progname;
char usagestr[] = "usage: %s [ - ] mesgfile prefix file ...\n";
char name[100], *np;
#define NBUCKETS 511
struct hash {
long hval;
long hpt;
struct hash *hnext;
} *bucket[NBUCKETS];
static int
fgetNUL(obuf, rmdr, file)
char *obuf;
register int rmdr;
FILE *file;
{
register int c;
register char *buf = obuf;
while (--rmdr > 0 && (c = getc(file)) != 0 && c != EOF)
*buf++ = c;
*buf++ = 0;
getc(file);
if (feof(file) || ferror(file))
return 0;
return 1;
}
static long
hashit(str, really, fakept)
char *str;
int really;
unsigned fakept;
{
int i;
register struct hash *hp;
char buf[512];
long hashval = 0;
register char *cp;
if (really)
fflush(mesgwrite);
for (cp = str; *cp;)
hashval = (hashval << 1) + *cp++;
i = hashval % NBUCKETS;
if (i < 0)
i += NBUCKETS;
if (really != 0)
for (hp = bucket[i]; hp != 0; hp = hp->hnext)
if (hp->hval == hashval) {
fseek(mesgread, (long) hp->hpt, 0);
fgetNUL(buf, sizeof buf, mesgread);
#ifdef DEBUG
fprintf(stderr, "Got (from %ld) %s\n", hp->hpt, buf);
#endif
if (strcmp(buf, str) == 0)
break;
}
if (!really || hp == 0) {
hp = (struct hash *) calloc(1, sizeof *hp);
hp->hnext = bucket[i];
hp->hval = hashval;
hp->hpt = really ? ftell(mesgwrite) : fakept;
if (really) {
fwrite(str, sizeof (char), strlen(str) + 1, mesgwrite);
fwrite("\n", sizeof (char), 1, mesgwrite);
}
bucket[i] = hp;
}
#ifdef DEBUG
fprintf(stderr, "%s hashed to %ld at %ld\n", str, hp->hval, hp->hpt);
#endif
return (hp->hpt);
}
static int
octdigit(c)
int c;
{
return (c >= '0' && c <= '7');
}
static void
copystr()
{
register int c, ch;
char buf[512];
register char *cp = buf;
for (;;) {
c = getchar();
if (c == EOF)
break;
switch (c) {
case '"':
*cp++ = 0;
goto out;
case '\\':
c = getchar();
switch (c) {
case 'b':
c = '\b';
break;
case 't':
c = '\t';
break;
case 'r':
c = '\r';
break;
case 'n':
c = '\n';
break;
case '\n':
continue;
case 'f':
c = '\f';
break;
case '0':
c = 0;
break;
case '\\':
break;
default:
if (!octdigit(c))
break;
c -= '0';
ch = getchar();
if (!octdigit(ch))
break;
c <<= 7, c += ch - '0';
ch = getchar();
if (!octdigit(ch))
break;
c <<= 3, c+= ch - '0', ch = -1;
break;
}
}
*cp++ = c;
}
out:
*cp = 0;
printf("%ld", hashit(buf, 1, 0));
}
static int
match(ocp)
char *ocp;
{
register char *cp;
register int c;
for (cp = ocp + 1; *cp; cp++) {
c = getchar();
if (c != *cp) {
while (ocp < cp)
putchar(*ocp++);
ungetchar(c);
return (0);
}
}
return (1);
}
static void
process()
{
register int c;
for (;;) {
c = getchar();
if (c == EOF)
return;
if (c != 's') {
putchar(c);
continue;
}
if (match("strstr(")) {
printf("strstr(");
c = getchar();
if (c != '"')
putchar(c);
else
copystr();
}
}
}
static void
inithash()
{
char buf[512];
int mesgpt = 0;
rewind(mesgread);
while (fgetNUL(buf, sizeof buf, mesgread) != 0) {
hashit(buf, 0, mesgpt);
mesgpt += strlen(buf) + 2;
}
}
int
main(argc, argv)
int argc;
char *argv[];
{
char addon = 0;
argc--, progname = *argv++;
if (argc > 1 && argv[0][0] == '-')
addon++, argc--, argv++;
if (argc < 3)
fprintf(stderr, usagestr, progname), exit(1);
mesgwrite = fopen(argv[0], addon ? "a" : "w");
if (mesgwrite == NULL)
perror(argv[0]), exit(1);
mesgread = fopen(argv[0], "r");
if (mesgread == NULL)
perror(argv[0]), exit(1);
inithash();
argc--, argv++;
strcpy(name, argv[0]);
np = name + strlen(name);
argc--, argv++;
do {
strcpy(np, argv[0]);
if (freopen(name, "w", stdout) == NULL)
perror(name), exit(1);
if (freopen(argv[0], "r", stdin) == NULL)
perror(argv[0]), exit(1);
process();
argc--, argv++;
} while (argc > 0);
exit(0);
}
|
#include <hre/config.h>
#include <pins2lts-mc/algorithm/reach.h>
ref_t *
get_parent_ref (wctx_t *ctx, ref_t ref)
{
alg_shared_t *shared = ctx->run->shared;
return &shared->parent_ref[ref];
}
|
// Copyright (c) 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 SYNC_INTERNAL_API_PUBLIC_EVENTS_PROTOCOL_EVENT_H_
#define SYNC_INTERNAL_API_PUBLIC_EVENTS_PROTOCOL_EVENT_H_
#include <memory>
#include <string>
#include "base/time/time.h"
#include "base/values.h"
#include "sync/base/sync_export.h"
namespace syncer {
// SyncNetworkEvents represent a single client <-> server sync protocol event
// that recently took place. Sync protocol events occur when the client decides
// to send a sync protocol request (such as GetUpdates or Commit) to the server,
// and when the server responds. Note that the requests and responses themselves
// are modelled by {GetUpdates, Commit}x{Request,Response} objects.
//
// These objects are intended to be used for displaying information on
// about:sync. They should be considered to be immutable and opaque. No
// program behavior should depend on their contents.
//
// Each type of request can maintain its own set of additional metadata and have
// its own custom serialization routines. For example, the "configure"
// GetUpdates request will include information about its "origin" in its debug
// info.
class SYNC_EXPORT ProtocolEvent {
public:
ProtocolEvent();
virtual ~ProtocolEvent();
// Returns the time when the request was sent or received.
virtual base::Time GetTimestamp() const = 0;
// Returns a string representing they type of the request. Should be short.
virtual std::string GetType() const = 0;
// Returns a string representing details of the request. May be verbose. The
// implementer is allowed to return lots of data separated by newlines.
virtual std::string GetDetails() const = 0;
// Returns a DictionaryValue representing the protobuf message associated with
// this event.
virtual std::unique_ptr<base::DictionaryValue> GetProtoMessage() const = 0;
// Need a virtual copy contructor to copy this object across threads.
virtual std::unique_ptr<ProtocolEvent> Clone() const = 0;
// A static function that assembles the data exposed through the
// ProtocolEvent's interface into a single DictionaryValue.
static std::unique_ptr<base::DictionaryValue> ToValue(
const ProtocolEvent& event);
};
} // namespace syncer
#endif // SYNC_INTERNAL_API_PUBLIC_EVENTS_PROTOCOL_EVENT_H_
|
/*** Copyright (c), The Regents of the University of California ***
*** For more information please refer to files in the COPYRIGHT directory ***/
/* See sslEnd.h for a description of this API call.*/
#include "sslEnd.h"
int
rsSslEnd(rsComm_t *rsComm, sslEndInp_t *sslEndInp)
{
#if defined(USE_SSL)
/* if SSL isn't on, just return success */
if (!rsComm->ssl_on) {
return 0;
}
/* let the agent service loop know that it needs to shut
down SSL after this API call completes */
rsComm->ssl_do_shutdown = 1;
return 0;
#else
return SSL_NOT_BUILT_INTO_SERVER;
#endif
}
|
// Copyright 2019 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_PUBLIC_BROWSER_FILE_SYSTEM_ACCESS_WRITE_ITEM_H_
#define CONTENT_PUBLIC_BROWSER_FILE_SYSTEM_ACCESS_WRITE_ITEM_H_
#include <cstdint>
#include <string>
#include "base/files/file_path.h"
#include "base/memory/raw_ptr.h"
#include "content/common/content_export.h"
#include "content/public/browser/global_routing_id.h"
#include "url/gurl.h"
#include "url/origin.h"
namespace content {
class BrowserContext;
class WebContents;
// Represents the state of a FileSystemAccessFileWriter when it is closed,
// containing all the data necessary to do a safe browsing download protection
// check on the data written to disk.
struct CONTENT_EXPORT FileSystemAccessWriteItem {
FileSystemAccessWriteItem();
~FileSystemAccessWriteItem();
FileSystemAccessWriteItem(const FileSystemAccessWriteItem&) = delete;
FileSystemAccessWriteItem& operator=(const FileSystemAccessWriteItem&) =
delete;
// The path on disk where the data will eventually end up.
base::FilePath target_file_path;
// The path on disk where the data was written to. If the safe browsing check
// completes the file at |full_path| will be moved to |target_file_path|.
base::FilePath full_path;
// SHA256 hash of the file contents.
std::string sha256_hash;
// Size of the file in bytes.
int64_t size = 0;
// URL of the frame in which the write operation took place.
GURL frame_url;
// id of the outermost main frame in which the write operation took place.
GlobalRenderFrameHostId outermost_main_frame_id;
// True iff the frame had a transient user activation when the writer was
// created.
bool has_user_gesture = false;
// BrowserContext and WebContents the writer is associated with. These fields
// can be nullptr when calling
// FileSystemAccessPermissionContext::PerformAfterWriteChecks(), in which
// case they will be filled by that method.
raw_ptr<WebContents> web_contents = nullptr;
raw_ptr<BrowserContext> browser_context = nullptr;
};
} // namespace content
#endif // CONTENT_PUBLIC_BROWSER_FILE_SYSTEM_ACCESS_WRITE_ITEM_H_
|
//
// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// BinaryStream.h: Provides binary serialization of simple types.
#ifndef LIBGLESV2_BINARYSTREAM_H_
#define LIBGLESV2_BINARYSTREAM_H_
#include "common/angleutils.h"
#include "common/mathutil.h"
#include <cstddef>
#include <string>
#include <vector>
namespace gl
{
class BinaryInputStream
{
public:
BinaryInputStream(const void *data, size_t length)
{
mError = false;
mOffset = 0;
mData = static_cast<const char*>(data);
mLength = length;
}
// readInt will generate an error for bool types
template <class IntT>
IntT readInt()
{
int value;
read(&value);
return static_cast<IntT>(value);
}
template <class IntT>
void readInt(IntT *outValue)
{
*outValue = readInt<IntT>();
}
bool readBool()
{
int value;
read(&value);
return (value > 0);
}
void readBool(bool *outValue)
{
*outValue = readBool();
}
void readBytes(unsigned char outArray[], size_t count)
{
read<unsigned char>(outArray, count);
}
std::string readString()
{
std::string outString;
readString(&outString);
return outString;
}
void readString(std::string *v)
{
size_t length;
readInt(&length);
if (mError)
{
return;
}
if (mOffset + length > mLength)
{
mError = true;
return;
}
v->assign(mData + mOffset, length);
mOffset += length;
}
void skip(size_t length)
{
if (mOffset + length > mLength)
{
mError = true;
return;
}
mOffset += length;
}
size_t offset() const
{
return mOffset;
}
bool error() const
{
return mError;
}
bool endOfStream() const
{
return mOffset == mLength;
}
private:
DISALLOW_COPY_AND_ASSIGN(BinaryInputStream);
bool mError;
size_t mOffset;
const char *mData;
size_t mLength;
template <typename T>
void read(T *v, size_t num)
{
META_ASSERT(std::is_fundamental<T>::value);
size_t length = num * sizeof(T);
if (mOffset + length > mLength)
{
mError = true;
return;
}
memcpy(v, mData + mOffset, length);
mOffset += length;
}
template <typename T>
void read(T *v)
{
read(v, 1);
}
};
class BinaryOutputStream
{
public:
BinaryOutputStream()
{
}
// writeInt also handles bool types
template <class IntT>
void writeInt(IntT param)
{
ASSERT(rx::IsIntegerCastSafe<int>(param));
int intValue = static_cast<int>(param);
write(&intValue, 1);
}
void writeString(const std::string &v)
{
writeInt(v.length());
write(v.c_str(), v.length());
}
void writeBytes(const unsigned char *bytes, size_t count)
{
write(bytes, count);
}
size_t length() const
{
return mData.size();
}
const void* data() const
{
return mData.size() ? &mData[0] : NULL;
}
private:
DISALLOW_COPY_AND_ASSIGN(BinaryOutputStream);
std::vector<char> mData;
template <typename T>
void write(const T *v, size_t num)
{
META_ASSERT(std::is_fundamental<T>::value);
const char *asBytes = reinterpret_cast<const char*>(v);
mData.insert(mData.end(), asBytes, asBytes + num * sizeof(T));
}
};
}
#endif // LIBGLESV2_BINARYSTREAM_H_
|
#include "../../src/gui/image/qimagewriter.h"
|
/*
Copyright (C) 2009-2011 Stig Brautaset. 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 author 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.
*/
#import "SBJson5Writer.h"
#import "SBJson5StreamParser.h"
#import "SBJson5Parser.h"
#import "SBJson5StreamWriter.h"
#import "SBJson5StreamTokeniser.h"
|
/* Generated automatically. DO NOT EDIT! */
#define SIMD_HEADER "simd-support/simd-generic256.h"
#include "../common/t1fv_9.c"
|
//
// Created by escoz on 1/15/12.
//
#import <Foundation/Foundation.h>
#import "QRadioElement.h"
@interface QSegmentedElement : QRadioElement {
}
- (QSegmentedElement *)initWithItems:(NSArray *)stringArray selected:(NSInteger)selected;
- (QSegmentedElement *)initWithItems:(NSArray *)stringArray selected:(NSInteger)selected title:(NSString *)title;
- (QSegmentedElement *)init;
@end
|
/*
* (C) Copyright 2001
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
* See file CREDITS for list of people who contributed to this
* project.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
#include <common.h>
#include <mpc8xx.h>
/* ------------------------------------------------------------------------- */
static long int dram_size (long int, long int *, long int);
/* ------------------------------------------------------------------------- */
#define _NOT_USED_ 0xFFFFFFFF
const uint sdram_table[] =
{
/*
* Single Read. (Offset 0 in UPMA RAM)
*/
0x1F07FC04, 0xEEAEFC04, 0x11ADFC04, 0xEFBBBC00,
0x1FF77C47, /* last */
/*
* SDRAM Initialization (offset 5 in UPMA RAM)
*
* This is no UPM entry point. The following definition uses
* the remaining space to establish an initialization
* sequence, which is executed by a RUN command.
*
*/
0x1FF77C34, 0xEFEABC34, 0x1FB57C35, /* last */
/*
* Burst Read. (Offset 8 in UPMA RAM)
*/
0x1F07FC04, 0xEEAEFC04, 0x10ADFC04, 0xF0AFFC00,
0xF0AFFC00, 0xF1AFFC00, 0xEFBBBC00, 0x1FF77C47, /* last */
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
/*
* Single Write. (Offset 18 in UPMA RAM)
*/
0x1F07FC04, 0xEEAEBC00, 0x01B93C04, 0x1FF77C47, /* last */
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
/*
* Burst Write. (Offset 20 in UPMA RAM)
*/
0x1F07FC04, 0xEEAEBC00, 0x10AD7C00, 0xF0AFFC00,
0xF0AFFC00, 0xE1BBBC04, 0x1FF77C47, /* last */
_NOT_USED_,
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
/*
* Refresh (Offset 30 in UPMA RAM)
*/
0x1FF5FC84, 0xFFFFFC04, 0xFFFFFC04, 0xFFFFFC04,
0xFFFFFC84, 0xFFFFFC07, /* last */
_NOT_USED_, _NOT_USED_,
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
/*
* Exception. (Offset 3c in UPMA RAM)
*/
0x7FFFFC07, /* last */
_NOT_USED_, _NOT_USED_, _NOT_USED_,
};
/* ------------------------------------------------------------------------- */
/*
* Check Board Identity:
*/
int checkboard (void)
{
unsigned char *s = getenv ("serial#");
puts ("Board: TTTech C2MON ");
for (; s && *s; ++s) {
if (*s == ' ')
break;
putc (*s);
}
putc ('\n');
return (0);
}
/* ------------------------------------------------------------------------- */
long int initdram (int board_type)
{
volatile immap_t *immap = (immap_t *) CFG_IMMR;
volatile memctl8xx_t *memctl = &immap->im_memctl;
unsigned long reg;
long int size8, size9;
long int size = 0;
upmconfig (UPMA, (uint *)sdram_table, sizeof(sdram_table) / sizeof(uint));
/*
* Preliminary prescaler for refresh (depends on number of
* banks): This value is selected for four cycles every 62.4 us
* with two SDRAM banks or four cycles every 31.2 us with one
* bank. It will be adjusted after memory sizing.
*/
memctl->memc_mptpr = CFG_MPTPR_2BK_8K;
memctl->memc_mar = 0x00000088;
/*
* Map controller bank 2 the SDRAM bank 2 at physical address 0.
*/
memctl->memc_or2 = CFG_OR2_PRELIM;
memctl->memc_br2 = CFG_BR2_PRELIM;
memctl->memc_mamr = CFG_MAMR_8COL & (~(MAMR_PTAE)); /* no refresh yet */
udelay (200);
/* perform SDRAM initializsation sequence */
memctl->memc_mcr = 0x80004105; /* SDRAM bank 0 */
udelay (1);
memctl->memc_mcr = 0x80004230; /* SDRAM bank 0 - execute twice */
udelay (1);
memctl->memc_mamr |= MAMR_PTAE; /* enable refresh */
udelay (1000);
/*
* Check Bank 0 Memory Size
*
* try 8 column mode
*/
size8 = dram_size (CFG_MAMR_8COL,
(ulong *)SDRAM_BASE2_PRELIM,
SDRAM_MAX_SIZE);
udelay (1000);
/*
* try 9 column mode
*/
size9 = dram_size (CFG_MAMR_9COL,
(ulong *) SDRAM_BASE2_PRELIM,
SDRAM_MAX_SIZE);
if (size8 < size9) { /* leave configuration at 9 columns */
size = size9;
/* debug ("SDRAM Bank 0 in 9 column mode: %ld MB\n", size >> 20); */
} else { /* back to 8 columns */
size = size8;
memctl->memc_mamr = CFG_MAMR_8COL;
udelay (500);
/* debug ("SDRAM Bank 0 in 8 column mode: %ld MB\n", size >> 20); */
}
udelay (1000);
/*
* Adjust refresh rate depending on SDRAM type
* For types > 128 MBit leave it at the current (fast) rate
*/
if (size < 0x02000000) {
/* reduce to 15.6 us (62.4 us / quad) */
memctl->memc_mptpr = CFG_MPTPR_2BK_4K;
udelay (1000);
}
/*
* Final mapping
*/
memctl->memc_or2 = ((-size) & 0xFFFF0000) | CFG_OR_TIMING_SDRAM;
memctl->memc_br2 = (CFG_SDRAM_BASE & BR_BA_MSK) | BR_MS_UPMA | BR_V;
/*
* No bank 1
*
* invalidate bank
*/
memctl->memc_br3 = 0;
/* adjust refresh rate depending on SDRAM type, one bank */
reg = memctl->memc_mptpr;
reg >>= 1; /* reduce to CFG_MPTPR_1BK_8K / _4K */
memctl->memc_mptpr = reg;
udelay (10000);
return (size);
}
/* ------------------------------------------------------------------------- */
/*
* Check memory range for valid RAM. A simple memory test determines
* the actually available RAM size between addresses `base' and
* `base + maxsize'. Some (not all) hardware errors are detected:
* - short between address lines
* - short between data lines
*/
static long int dram_size (long int mamr_value, long int *base,
long int maxsize)
{
volatile immap_t *immap = (immap_t *) CFG_IMMR;
volatile memctl8xx_t *memctl = &immap->im_memctl;
memctl->memc_mamr = mamr_value;
return (get_ram_size(base, maxsize));
}
|
/*
* entry2.h
* A string entry box class
* AYM 1999-04-12
*/
#ifndef YH_ENTRY2 /* To prevent multiple inclusion */
#define YH_ENTRY2 /* To prevent multiple inclusion */
typedef enum
{
ACT_NONE,
ACT_VALID,
ACT_CANCEL
} Entry2_action_t;
class Entry2
{
typedef enum // Strictly private to the class
{
FF_TYPE = 0xf000, // Type mask
FF_ENTRY = 0x0000, // Entry
FF_CHECK = 0x1000, // Check button (unimplemented)
FF_RADIO = 0x2000, // Radio button (unimplemented)
FF_BUTTON = 0x3000, // Button (unimplemented)
FF_SUBTYPE = 0x0f00, // Subtype mask
FF_STRING = 0x0000, // Entry: String entry
FF_INTEGER = 0x0100, // Entry: Integer entry
FF_UPPERCASE = 0x0001, // String entry: upper-case everything
FF_NONEMPTY = 0x0002, // String entry: can't be empty
FF_SIGNED = 0x0001, // Integer entry: it can be signed (unimplemented)
FF_INTSIZE = 0x000e, // Integer entry: size mask
FF_CHAR = 0x0000, // char (signed or unsigned)
FF_SHORT = 0x0002, // short (signed or unsigned)
FF_INT = 0x0004, // int (signed or unsigned)
FF_SIZE_T = 0x0006, // size_t
FF_LONG = 0x0008, // long (signed or unsigned)
FF__
} _field_flags_t;
public :
Entry2 (const char *title, const char *fmt, ...);
~Entry2 ();
int loop ();
Entry2_action_t process_event (const input_status_t &is);
void refresh ();
private :
int count_widgets (const char *fmt);
int fill_in_widgets_info (const char *fmt, va_list args);
void do_geom ();
void jump_to_field (size_t field_no);
void prev_field ();
void next_field ();
// Per-field data
unsigned short *box_len;
char **buf;
unsigned short *buf_max_len;
const char **caption;
bool *entry_drawn;
_field_flags_t *entry_flags;
// Input
bool first_key;
size_t field_no;
size_t nfields;
// General display stuff
const char *title;
bool background_drawn;
// Geometry constants
int entry_hofs;
int entry_vofs;
int win_hofs;
int win_vofs;
int title_vspacing;
// Geometry stuff
bool geom_up_to_date;
int outer_width;
int outer_height;
int vstep;
int win_x0;
int win_y0;
int win_x1;
int win_y1;
int title_x0;
int title_y0;
int caption_x0;
int caption_y0;
int entry_box_x0;
int entry_box_y0;
int entry_box_x1;
int entry_box_y1;
int entry_text_x0;
int entry_text_y0;
int entry_text_x1;
int entry_text_y1;
// Convenience functions.
bool is_integer_entry (_field_flags_t flags)
{
return (flags & FF_TYPE) == FF_ENTRY
&& (flags & FF_SUBTYPE) == FF_INTEGER;
}
bool is_string_entry (_field_flags_t flags)
{
return (flags & FF_TYPE) == FF_ENTRY
&& (flags & FF_SUBTYPE) == FF_STRING;
}
};
#endif /* DO NOT ADD ANYTHING AFTER THIS LINE */
|
//
// c't-Bot-NanoVM, a tiny java VM for the c't-Bot
//
// Copyright (C) 2007 by Nils Springob <nils@nicai-systems.de>
// Based on work by Benjamin Benz(c't-Bot) and Till Harbaum(NanoVM)
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// native_clock.c
//
#include "types.h"
#include "debug.h"
#include "config.h"
#include "error.h"
#ifdef CTBOT
#include "delay.h"
#include "stack.h"
#include "vm.h"
#include "ctbot/native.h"
#include "ctbot/native_clock.h"
#include "ctbot/pwm.h"
#include <util/delay.h>
#include <avr/interrupt.h>
#define NATIVE_METHOD_getSeconds 1
#define NATIVE_METHOD_getMilliseconds 2
#define NATIVE_METHOD_delayMilliseconds 3
#define NATIVE_METHOD_delayMicroseconds 4
// initialize the ctbot hardware
void native_ctbot_clock_init(void) {
pwm_init();
}
// the ctbot class
void native_ctbot_clock_invoke(u08_t mref) {
// JAVA: void delayMilliseconds(int msec)
if(mref == NATIVE_METHOD_delayMilliseconds) {
nvm_int_t time = stack_pop_int();
while(time--)
_delay_ms(1);
}
// JAVA: void delayMicroseconds(int usec)
else if(mref == NATIVE_METHOD_delayMicroseconds) {
nvm_int_t time = stack_pop_int();
_delay_us(time);
}
// JAVA: int getSeconds()
else if(mref == NATIVE_METHOD_getSeconds) {
cli();
nvm_int_t res = pwm_timer_sec;
sei();
stack_push(res);
}
// JAVA: int getMiliseconds()
else if(mref == NATIVE_METHOD_getMilliseconds) {
cli();
nvm_int_t res = pwm_timer_ms;
sei();
stack_push(res);
}
}
#endif
|
/* sort/gsl_sort_vector_ulong.h
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000 Thomas Walter, Brian Gough
*
* 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.
*/
#ifndef __GSL_SORT_VECTOR_ULONG_H__
#define __GSL_SORT_VECTOR_ULONG_H__
#include <stdlib.h>
#include <gsl/gsl_errno.h>
#include <gsl/gsl_permutation.h>
#include <gsl/gsl_vector_ulong.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
void gsl_sort_vector_ulong (gsl_vector_ulong * v);
int gsl_sort_vector_ulong_index (gsl_permutation * p, const gsl_vector_ulong * v);
int gsl_sort_vector_ulong_smallest (unsigned long * dest, const size_t k, const gsl_vector_ulong * v);
int gsl_sort_vector_ulong_largest (unsigned long * dest, const size_t k, const gsl_vector_ulong * v);
int gsl_sort_vector_ulong_smallest_index (size_t * p, const size_t k, const gsl_vector_ulong * v);
int gsl_sort_vector_ulong_largest_index (size_t * p, const size_t k, const gsl_vector_ulong * v);
__END_DECLS
#endif /* __GSL_SORT_VECTOR_ULONG_H__ */
|
/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef MSM_SENSOR_H
#define MSM_SENSOR_H
#include <linux/debugfs.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/miscdevice.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/types.h>
#include <linux/uaccess.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/of_gpio.h>
#include <linux/gpio.h>
#include <soc/qcom/camera2.h>
#include <media/msm_cam_sensor.h>
#include <media/v4l2-subdev.h>
#include "io/msm_camera_i2c.h"
#include "io/msm_camera_dt_util.h"
#include "msm_sd.h"
#define DEFINE_MSM_MUTEX(mutexname) \
static struct mutex mutexname = __MUTEX_INITIALIZER(mutexname)
struct msm_sensor_ctrl_t;
enum msm_sensor_state_t {
MSM_SENSOR_POWER_DOWN,
MSM_SENSOR_POWER_UP,
};
struct msm_sensor_fn_t {
int (*sensor_config) (struct msm_sensor_ctrl_t *, void __user *);
int (*sensor_power_down) (struct msm_sensor_ctrl_t *);
int (*sensor_power_up) (struct msm_sensor_ctrl_t *);
int (*sensor_match_id) (struct msm_sensor_ctrl_t *);
#ifdef CONFIG_MACH_YULONG
int (*sensor_prepare_otp)(struct msm_sensor_ctrl_t *s_ctrl);
int (*sensor_update_otp) (struct msm_sensor_ctrl_t *);
#endif
};
struct msm_sensor_ctrl_t {
struct platform_device *pdev;
struct mutex *msm_sensor_mutex;
enum msm_camera_device_type_t sensor_device_type;
struct msm_camera_sensor_board_info *sensordata;
struct msm_sensor_power_setting_array power_setting_array;
struct msm_sensor_packed_cfg_t *cfg_override;
struct msm_sd_subdev msm_sd;
enum cci_i2c_master_t cci_i2c_master;
struct msm_camera_i2c_client *sensor_i2c_client;
struct v4l2_subdev_info *sensor_v4l2_subdev_info;
uint8_t sensor_v4l2_subdev_info_size;
struct v4l2_subdev_ops *sensor_v4l2_subdev_ops;
struct msm_sensor_fn_t *func_tbl;
struct msm_camera_i2c_reg_setting stop_setting;
void *misc_regulator;
enum msm_sensor_state_t sensor_state;
uint8_t is_probe_succeed;
uint32_t id;
struct device_node *of_node;
enum msm_camera_stream_type_t camera_stream_type;
uint32_t set_mclk_23880000;
#ifdef CONFIG_MACH_YULONG
uint32_t module_id;
#endif
};
int msm_sensor_config(struct msm_sensor_ctrl_t *s_ctrl, void __user *argp);
int msm_sensor_power_up(struct msm_sensor_ctrl_t *s_ctrl);
int msm_sensor_power_down(struct msm_sensor_ctrl_t *s_ctrl);
int msm_sensor_check_id(struct msm_sensor_ctrl_t *s_ctrl);
int msm_sensor_match_id(struct msm_sensor_ctrl_t *s_ctrl);
int32_t msm_sensor_platform_probe(struct platform_device *pdev,
const void *data);
int msm_sensor_update_cfg(struct msm_sensor_ctrl_t *s_ctrl);
int msm_sensor_i2c_probe(struct i2c_client *client,
const struct i2c_device_id *id, struct msm_sensor_ctrl_t *s_ctrl);
int msm_sensor_free_sensor_data(struct msm_sensor_ctrl_t *s_ctrl);
int32_t msm_sensor_init_default_params(struct msm_sensor_ctrl_t *s_ctrl);
int32_t msm_sensor_get_dt_gpio_req_tbl(struct device_node *of_node,
struct msm_camera_gpio_conf *gconf, uint16_t *gpio_array,
uint16_t gpio_array_size);
int32_t msm_sensor_get_dt_gpio_set_tbl(struct device_node *of_node,
struct msm_camera_gpio_conf *gconf, uint16_t *gpio_array,
uint16_t gpio_array_size);
int32_t msm_sensor_init_gpio_pin_tbl(struct device_node *of_node,
struct msm_camera_gpio_conf *gconf, uint16_t *gpio_array,
uint16_t gpio_array_size);
#ifdef CONFIG_MACH_YULONG
bool msm_sensor_is_probed(int position);
#endif
#endif
|
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#ifdef FIX_CLASS
FixStyle(momentum,FixMomentum)
#else
#ifndef LMP_FIX_MOMENTUM_H
#define LMP_FIX_MOMENTUM_H
#include "fix.h"
namespace LAMMPS_NS {
class FixMomentum : public Fix {
public:
FixMomentum(class LAMMPS *, int, char **);
int setmask();
void init();
void end_of_step();
private:
int linear,angular;
int xflag,yflag,zflag;
double masstotal;
};
}
#endif
#endif
|
/* ***** BEGIN LICENSE BLOCK *****
* Source last modified: $Id: string_utils.h,v 1.1.1.1.2.1 2005/05/04 18:21:22 hubbe Exp $
*
* REALNETWORKS CONFIDENTIAL--NOT FOR DISTRIBUTION IN SOURCE CODE FORM
* Portions Copyright (c) 1995-2005 RealNetworks, Inc.
* All Rights Reserved.
*
* The contents of this file, and the files included with this file,
* are subject to the current version of the Real Format Source Code
* Porting and Optimization License, available at
* https://helixcommunity.org/2005/license/realformatsource (unless
* RealNetworks otherwise expressly agrees in writing that you are
* subject to a different license). You may also obtain the license
* terms directly from RealNetworks. You may not use this file except
* in compliance with the Real Format Source Code Porting and
* Optimization License. There are no redistribution rights for the
* source code of this file. Please see the Real Format Source Code
* Porting and Optimization License for the rights, obligations and
* limitations governing use of the contents of the file.
*
* RealNetworks is the developer of the Original Code and owns the
* copyrights in the portions it created.
*
* This file, and the files included with this file, is distributed and
* made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL
* SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT
* OR NON-INFRINGEMENT.
*
* Technology Compatibility Kit Test Suite(s) Location:
* https://rarvcode-tck.helixcommunity.org
*
* Contributor(s):
*
* ***** END LICENSE BLOCK ***** */
#ifndef STRING_UTILS_H
#define STRING_UTILS_H
#include "helix_types.h"
#include "rm_memory.h"
/* Create and copy a string */
char* copy_string(void* pUserMem,
rm_malloc_func_ptr fpMalloc,
const char* pszStr);
/* Free a string */
void free_string(void* pUserMem,
rm_free_func_ptr fpFree,
char** ppszStr);
#if defined(_WINDOWS)
int strcasecmp(const char* pszStr1, const char* pszStr2);
int strncasecmp(const char* pszStr1, const char* pszStr2, int len);
#elif defined(_UNIX)
#include <strings.h>
#endif
#endif /* #ifndef STRING_UTILS_H */
|
/*
* strtoul.c --
*
* Source code for the "strtoul" library procedure.
*
* Copyright (c) 1988 The Regents of the University of California.
* All rights reserved.
*
* Permission is hereby granted, without written agreement and without
* license or royalty fees, to use, copy, modify, and distribute this
* software and its documentation for any purpose, provided that the
* above copyright notice and the following two paragraphs appear in
* all copies of this software.
*
* IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
* CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*/
#ifndef lint
static char rcsid[] = "$Header: /home/auspex6/CVSROOT/tcl/compat/strtoul.c,v 1.1.1.1 1993/11/29 10:44:46 a904209 Exp $ SPRITE (Berkeley)";
#endif /* not lint */
#include <ctype.h>
/*
* The table below is used to convert from ASCII digits to a
* numerical equivalent. It maps from '0' through 'z' to integers
* (100 for non-digit characters).
*/
static char cvtIn[] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, /* '0' - '9' */
100, 100, 100, 100, 100, 100, 100, /* punctuation */
10, 11, 12, 13, 14, 15, 16, 17, 18, 19, /* 'A' - 'Z' */
20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
30, 31, 32, 33, 34, 35,
100, 100, 100, 100, 100, 100, /* punctuation */
10, 11, 12, 13, 14, 15, 16, 17, 18, 19, /* 'a' - 'z' */
20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
30, 31, 32, 33, 34, 35};
/*
*----------------------------------------------------------------------
*
* strtoul --
*
* Convert an ASCII string into an integer.
*
* Results:
* The return value is the integer equivalent of string. If endPtr
* is non-NULL, then *endPtr is filled in with the character
* after the last one that was part of the integer. If string
* doesn't contain a valid integer value, then zero is returned
* and *endPtr is set to string.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
unsigned long int
strtoul(string, endPtr, base)
char *string; /* String of ASCII digits, possibly
* preceded by white space. For bases
* greater than 10, either lower- or
* upper-case digits may be used.
*/
char **endPtr; /* Where to store address of terminating
* character, or NULL. */
int base; /* Base for conversion. Must be less
* than 37. If 0, then the base is chosen
* from the leading characters of string:
* "0x" means hex, "0" means octal, anything
* else means decimal.
*/
{
register char *p;
register unsigned long int result = 0;
register unsigned digit;
int anyDigits = 0;
/*
* Skip any leading blanks.
*/
p = string;
while (isspace(*p)) {
p += 1;
}
/*
* If no base was provided, pick one from the leading characters
* of the string.
*/
if (base == 0)
{
if (*p == '0') {
p += 1;
if (*p == 'x') {
p += 1;
base = 16;
} else {
/*
* Must set anyDigits here, otherwise "0" produces a
* "no digits" error.
*/
anyDigits = 1;
base = 8;
}
}
else base = 10;
} else if (base == 16) {
/*
* Skip a leading "0x" from hex numbers.
*/
if ((p[0] == '0') && (p[1] == 'x')) {
p += 2;
}
}
/*
* Sorry this code is so messy, but speed seems important. Do
* different things for base 8, 10, 16, and other.
*/
if (base == 8) {
for ( ; ; p += 1) {
digit = *p - '0';
if (digit > 7) {
break;
}
result = (result << 3) + digit;
anyDigits = 1;
}
} else if (base == 10) {
for ( ; ; p += 1) {
digit = *p - '0';
if (digit > 9) {
break;
}
result = (10*result) + digit;
anyDigits = 1;
}
} else if (base == 16) {
for ( ; ; p += 1) {
digit = *p - '0';
if (digit > ('z' - '0')) {
break;
}
digit = cvtIn[digit];
if (digit > 15) {
break;
}
result = (result << 4) + digit;
anyDigits = 1;
}
} else {
for ( ; ; p += 1) {
digit = *p - '0';
if (digit > ('z' - '0')) {
break;
}
digit = cvtIn[digit];
if (digit >= base) {
break;
}
result = result*base + digit;
anyDigits = 1;
}
}
/*
* See if there were any digits at all.
*/
if (!anyDigits) {
p = string;
}
if (endPtr != 0) {
*endPtr = p;
}
return result;
}
|
#define _GNU_SOURCE
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <errno.h>
int main()
{
int fds[2];
int status;
uint8_t buffer;
status = pipe2(fds, O_NONBLOCK);
if (status < 0) {
perror("pipe2");
exit(EXIT_FAILURE);
}
(void) alarm(5);
(void) read(fds[0], &buffer, 1);
if (errno != EAGAIN && errno != EWOULDBLOCK) {
perror("read");
exit(EXIT_FAILURE);
}
exit(EXIT_SUCCESS);
}
|
/* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
as published by the Free Software Foundation.
This program is also distributed with certain software (including
but not limited to OpenSSL) that is licensed under separate terms,
as designated in a particular file or component or in included license
documentation. The authors of MySQL hereby grant you an additional
permission to link the program and your derivative works with the
separately licensed software that they have included with MySQL.
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, version 2.0, for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA */
#ifndef RPL_TABLE_ACCESS_H_
#define RPL_TABLE_ACCESS_H_
#include "my_global.h"
#include "thr_lock.h" // thr_lock_type
#include "mysql/mysql_lex_string.h" // LEX_STRING
class Open_tables_backup;
class THD;
struct TABLE;
typedef struct st_mysql_lex_string LEX_STRING;
/**
A base class for accessing a system table.
*/
class System_table_access
{
public:
virtual ~System_table_access() { }
/**
Opens and locks a system table.
It's assumed that the caller knows what they are doing:
- whether it was necessary to reset-and-backup the open tables state
- whether the requested lock does not lead to a deadlock
- whether this open mode would work under LOCK TABLES, or inside a
stored function or trigger.
Note that if the table can't be locked successfully this operation will
close it. Therefore it provides guarantee that it either opens and locks
table or fails without leaving any tables open.
@param[in] thd Thread requesting to open the table
@param[in] dbstr Database where the table resides
@param[in] tbstr Table to be openned
@param[in] max_num_field Maximum number of fields
@param[in] lock_type How to lock the table
@param[out] table We will store the open table here
@param[out] backup Save the lock info. here
@return
@retval TRUE open and lock failed - an error message is pushed into the
stack
@retval FALSE success
*/
bool open_table(THD* thd, const LEX_STRING dbstr, const LEX_STRING tbstr,
uint max_num_field, enum thr_lock_type lock_type,
TABLE** table, Open_tables_backup* backup);
/**
Prepares before opening table.
@param[in] thd Thread requesting to open the table
*/
virtual void before_open(THD* thd)= 0;
/**
Commits the changes, unlocks the table and closes it. This method
needs to be called even if the open_table fails, in order to ensure
the lock info is properly restored.
@param[in] thd Thread requesting to close the table
@param[in] table Table to be closed
@param[in] backup Restore the lock info from here
@param[in] error If there was an error while updating
the table
@param[in] need_commit Need to commit current transaction
if it is true.
@return
@retval true failed
@retval false success
If there is an error, rolls back the current statement. Otherwise,
commits it. However, if a new thread was created and there is an
error, the transaction must be rolled back. Otherwise, it must be
committed. In this case, the changes were not done on behalf of
any user transaction and if not finished, there would be pending
changes.
*/
bool close_table(THD *thd, TABLE* table, Open_tables_backup *backup,
bool error, bool need_commit);
/**
Creates a new thread in the bootstrap process or in the mysqld startup,
a thread is created in order to be able to access a table.
@return
@retval THD* Pointer to thread structure
*/
THD *create_thd();
/**
Destroys the created thread and restores the
system_thread information.
@param thd Thread requesting to be destroyed
*/
void drop_thd(THD *thd);
/* Flags for opening table */
uint m_flags;
};
#endif /* RPL_TABLE_ACCESS_H_ */
|
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
int main(void)
{
int fd;
int status;
bool stop = false;
fd = open("/proc/self/cmdline", O_RDONLY);
if (fd < 0) {
perror("open()");
exit(EXIT_FAILURE);
}
do {
char buffer;
status = read(fd, &buffer, 1);
if (status < 0) {
perror("read()");
exit(EXIT_FAILURE);
}
stop = (status == 0);
status = write(1, &buffer, 1);
if (status < 0) {
perror("write()");
exit(EXIT_FAILURE);
}
} while (!stop);
exit(EXIT_SUCCESS);
}
|
/**
* $Id$
*
* mem is responsible for creating and maintaining the overall system memory
* map, as visible from the SH4 processor. (Note the ARM has a different map)
*
* Copyright (c) 2005 Nathan Keynes.
*
* 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.
*/
#ifndef lxdream_gendec_H
#define lxdream_gendec_H 1
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#define MAX_OPERAND_NAME 8
#define MAX_OPERANDS 4
#define MAX_OPERATION_FORMAT 64
#define MAX_RULES 512
#define USE_NONE 0
#define USE_READ 1
#define USE_WRITE 2
#define USE_READWRITE 3
struct operand {
int bit_count;
int bit_shift;
int left_shift;
int is_signed;
int use_mode;
char name[MAX_OPERAND_NAME+1];
};
struct rule {
uint32_t bits;
uint32_t mask;
int bit_count;
int operand_count;
int flags_use_mode;
struct operand operands[MAX_OPERANDS];
char format[MAX_OPERATION_FORMAT+1];
};
struct ruleset {
uint32_t rule_count;
struct rule *rules[MAX_RULES];
};
struct ruleset *parse_ruleset_file( FILE *f );
void dump_ruleset( struct ruleset *rules, FILE *f );
void dump_rulesubset( struct ruleset *rules, int ruleidx[], int rule_count, FILE *f );
struct action {
const char *filename;
int lineno;
const char *text;
};
typedef struct actionfile *actionfile_t;
typedef struct actiontoken {
enum { NONE, TEXT, ACTIONS, END, ERROR } symbol;
const char *filename;
int lineno;
char *text;
struct action actions[MAX_RULES];
} *actiontoken_t;
actionfile_t action_file_open( const char *filename, struct ruleset *rules );
actiontoken_t action_file_next( actionfile_t af );
void action_file_close( actionfile_t af );
#ifdef __cplusplus
}
#endif
#endif /* !lxdream_gendec_H */
|
/*
* linux/include/asm-arm/arch-dm270/shmparam.h
*
* Copyright (c) 1996 Russell King.
*/
|
/* -*- c++ -*- */
/*
* Copyright 2004,2009,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
*/
#ifndef ADD_BLK_IMPL_H
#define ADD_BLK_IMPL_H
#include <gnuradio/blocks/add_blk.h>
namespace gr {
namespace blocks {
template <class T>
class BLOCKS_API add_blk_impl : public add_blk<T>
{
private:
const size_t d_vlen;
public:
add_blk_impl(size_t vlen);
int work(int noutput_items,
gr_vector_const_void_star& input_items,
gr_vector_void_star& output_items) override;
};
} /* namespace blocks */
} /* namespace gr */
#endif /* ADD_BLK_IMPL_H */
|
#ifndef ESPMISSINGINCLUDES_H
#define ESPMISSINGINCLUDES_H
#include <ets_sys.h>
//Missing function prototypes in include folders. Gcc will warn on these if we don't define 'em anywhere.
//MOST OF THESE ARE GUESSED! but they seem to swork and shut up the compiler.
typedef struct espconn espconn;
int atoi(const char *nptr);
void ets_install_putc1(void *routine);
void ets_isr_attach(int intr, void *handler, void *arg);
void ets_isr_mask(unsigned intr);
void ets_isr_unmask(unsigned intr);
int ets_memcmp(const void *s1, const void *s2, size_t n);
void *ets_memcpy(void *dest, const void *src, size_t n);
void *ets_memset(void *s, int c, size_t n);
int ets_sprintf(char *str, const char *format, ...) __attribute__ ((format (printf, 2, 3)));
int ets_str2macaddr(void *, void *);
int ets_strcmp(const char *s1, const char *s2);
char *ets_strcpy(char *dest, const char *src);
size_t ets_strlen(const char *s);
int ets_strncmp(const char *s1, const char *s2, int len);
char *ets_strncpy(char *dest, const char *src, size_t n);
char *ets_strstr(const char *haystack, const char *needle);
void ets_timer_arm_new(ETSTimer *a, int b, int c, int isMstimer);
void ets_timer_disarm(ETSTimer *a);
void ets_timer_setfn(ETSTimer *t, ETSTimerFunc *fn, void *parg);
void ets_update_cpu_frequency(int freqmhz);
int os_printf(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
int os_snprintf(char *str, size_t size, const char *format, ...) __attribute__ ((format (printf, 3, 4)));
int os_printf_plus(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
void pvPortFree(void *ptr);
void *pvPortMalloc(size_t xWantedSize);
void *pvPortZalloc(size_t);
void uart_div_modify(int no, unsigned int freq);
void vPortFree(void *ptr);
void *vPortMalloc(size_t xWantedSize);
uint8 wifi_get_opmode(void);
uint32 system_get_time();
int rand(void);
void ets_bzero(void *s, size_t n);
void ets_delay_us(int ms);
#endif
|
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/dcscreen.h
// Purpose: wxScreenDC class
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// RCS-ID: $Id: dcscreen.h,v 1.12 2004/08/24 10:31:34 ABX Exp $
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DCSCREEN_H_
#define _WX_DCSCREEN_H_
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma interface "dcscreen.h"
#endif
#include "wx/dcclient.h"
class WXDLLEXPORT wxScreenDC : public wxWindowDC
{
public:
// Create a DC representing the whole screen
wxScreenDC();
// Compatibility with X's requirements for drawing on top of all windows
static bool StartDrawingOnTop(wxWindow* WXUNUSED(window)) { return true; }
static bool StartDrawingOnTop(wxRect* WXUNUSED(rect) = NULL) { return true; }
static bool EndDrawingOnTop() { return true; }
protected:
virtual void DoGetSize(int *width, int *height) const;
private:
DECLARE_DYNAMIC_CLASS_NO_COPY(wxScreenDC)
};
#endif
// _WX_DCSCREEN_H_
|
/*
* Copyright (C) 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef AccessibilityListBoxOption_h
#define AccessibilityListBoxOption_h
#include "AccessibilityObject.h"
#include "HTMLElement.h"
namespace WebCore {
class AccessibilityListBox;
class Element;
class HTMLElement;
class HTMLSelectElement;
class String;
class AccessibilityListBoxOption : public AccessibilityObject {
private:
AccessibilityListBoxOption();
public:
static PassRefPtr<AccessibilityListBoxOption> create();
virtual ~AccessibilityListBoxOption();
void setHTMLElement(HTMLElement* element) { m_optionElement = element; }
virtual AccessibilityRole roleValue() const { return ListBoxOptionRole; }
virtual bool accessibilityIsIgnored() const;
virtual bool isSelected() const;
virtual bool isEnabled() const;
virtual String stringValue() const;
virtual Element* actionElement() const;
virtual void setSelected(bool);
virtual bool canSetSelectedAttribute() const;
virtual IntRect elementRect() const;
virtual IntSize size() const;
virtual AccessibilityObject* parentObject() const;
bool isListBoxOption() const { return true; }
private:
HTMLElement* m_optionElement;
virtual String language() const;
virtual bool canHaveChildren() const { return false; }
HTMLSelectElement* listBoxOptionParentNode() const;
int listBoxOptionIndex() const;
IntRect listBoxOptionRect() const;
AccessibilityObject* listBoxOptionAccessibilityObject(HTMLElement* element) const;
};
} // namespace WebCore
#endif // AccessibilityListBoxOption_h
|
//* This file is part of the MOOSE framework
//* https://www.mooseframework.org
//*
//* All rights reserved, see COPYRIGHT for full restrictions
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
//*
//* Licensed under LGPL 2.1, please see LICENSE for details
//* https://www.gnu.org/licenses/lgpl-2.1.html
#pragma once
#include "libmesh/mesh_base.h"
#include "libmesh/boundary_info.h"
#include "MooseUtils.h"
#include "MooseTypes.h"
namespace MooseMeshUtils
{
// Changes the old ID to new ID in the mesh given in parameters
void changeBoundaryId(MeshBase & mesh,
const libMesh::boundary_id_type old_id,
const libMesh::boundary_id_type new_id,
bool delete_prev);
std::vector<libMesh::boundary_id_type>
getBoundaryIDs(const libMesh::MeshBase & mesh,
const std::vector<BoundaryName> & boundary_name,
bool generate_unknown);
/**
* Gets the boundary ID associated with the given BoundaryName.
*
* This is needed because the BoundaryName can be either an ID or a name.
* If it is a name, the mesh is queried for the ID associated with said name.
*/
BoundaryID getBoundaryID(const BoundaryName & boundary_name, const MeshBase & mesh);
std::vector<subdomain_id_type> getSubdomainIDs(const libMesh::MeshBase & mesh,
const std::vector<SubdomainName> & subdomain_name);
}
|
/* The LibVMI Library is an introspection library that simplifies access to
* memory in a target virtual machine or in a file containing a dump of
* a system's physical memory. LibVMI is based on the XenAccess Library.
*
* Author: Kevin Mayer (kevin.mayer@gdata.de)
*
* This file is part of LibVMI.
*
* LibVMI is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* LibVMI 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 LibVMI. If not, see <http://www.gnu.org/licenses/>.
*/
#include "private.h"
#include "driver/xen/xen.h"
#include "driver/xen/xen_private.h"
status_t xen_altp2m_get_domain_state (vmi_instance_t vmi, bool *state)
{
int rc;
xen_instance_t *xen = xen_get_instance(vmi);
xc_interface * xch = xen_get_xchandle(vmi);
domid_t domain_id = xen_get_domainid(vmi);
if ( !xch ) {
errprint("%s error: invalid xc_interface handle\n", __FUNCTION__);
return VMI_FAILURE;
}
if ( domain_id == (domid_t)VMI_INVALID_DOMID ) {
errprint ("%s error: invalid domid\n", __FUNCTION__);
return VMI_FAILURE;
}
rc = xen->libxcw.xc_altp2m_get_domain_state (xch, domain_id, state);
if ( rc ) {
errprint ("xc_altp2m_get_domain_state returned rc: %i\n", rc);
return VMI_FAILURE;
}
return VMI_SUCCESS;
}
status_t xen_altp2m_set_domain_state (vmi_instance_t vmi, bool state)
{
int rc;
xen_instance_t *xen = xen_get_instance(vmi);
xc_interface * xch = xen_get_xchandle(vmi);
domid_t domain_id = xen_get_domainid(vmi);
if ( !xch ) {
errprint("%s error: invalid xc_interface handle\n", __FUNCTION__);
return VMI_FAILURE;
}
if ( domain_id == (domid_t)VMI_INVALID_DOMID ) {
errprint ("%s error: invalid domid\n", __FUNCTION__);
return VMI_FAILURE;
}
rc = xen->libxcw.xc_altp2m_set_domain_state (xch, domain_id, state);
if ( rc ) {
errprint ("xc_altp2m_set_domain_state returned rc: %i\n", rc);
return VMI_FAILURE;
}
return VMI_SUCCESS;
}
status_t xen_altp2m_create_p2m ( vmi_instance_t vmi, uint16_t *altp2m_idx )
{
int rc;
xen_instance_t *xen = xen_get_instance(vmi);
xc_interface * xch = xen_get_xchandle(vmi);
domid_t domain_id = xen_get_domainid(vmi);
if ( !xch ) {
errprint("%s error: invalid xc_interface handle\n", __FUNCTION__);
return VMI_FAILURE;
}
if ( domain_id == (domid_t)VMI_INVALID_DOMID ) {
errprint ("%s error: invalid domid\n", __FUNCTION__);
return VMI_FAILURE;
}
rc = xen->libxcw.xc_altp2m_create_view (xch, domain_id, VMI_MEMACCESS_N, altp2m_idx );
if ( rc ) {
errprint ("xc_altp2m_create_view returned rc: %i\n", rc);
return VMI_FAILURE;
}
return VMI_SUCCESS;
}
status_t xen_altp2m_destroy_p2m ( vmi_instance_t vmi, uint16_t altp2m_idx )
{
int rc;
xen_instance_t *xen = xen_get_instance(vmi);
xc_interface * xch = xen_get_xchandle(vmi);
domid_t domain_id = xen_get_domainid(vmi);
if ( !xch ) {
errprint("%s error: invalid xc_interface handle\n", __FUNCTION__);
return VMI_FAILURE;
}
if ( domain_id == (domid_t)VMI_INVALID_DOMID ) {
errprint ("%s error: invalid domid\n", __FUNCTION__);
return VMI_FAILURE;
}
rc = xen->libxcw.xc_altp2m_destroy_view (xch, domain_id, altp2m_idx );
if ( rc ) {
errprint ("xc_altp2m_destroy_view returned rc: %i\n", rc);
return VMI_FAILURE;
}
return VMI_SUCCESS;
}
status_t xen_altp2m_switch_p2m ( vmi_instance_t vmi, uint16_t altp2m_idx )
{
int rc;
xen_instance_t *xen = xen_get_instance(vmi);
xc_interface * xch = xen_get_xchandle(vmi);
domid_t domain_id = xen_get_domainid(vmi);
if ( !xch ) {
errprint("%s error: invalid xc_interface handle\n", __FUNCTION__);
return VMI_FAILURE;
}
if ( domain_id == (domid_t)VMI_INVALID_DOMID ) {
errprint ("%s error: invalid domid\n", __FUNCTION__);
return VMI_FAILURE;
}
rc = xen->libxcw.xc_altp2m_switch_to_view (xch, domain_id, altp2m_idx );
if ( rc ) {
errprint ("xc_altp2m_switch_to_view returned rc: %i\n", rc);
return VMI_FAILURE;
}
return VMI_SUCCESS;
}
status_t xen_altp2m_change_gfn ( vmi_instance_t vmi, uint16_t altp2m_idx, addr_t old_gfn, addr_t new_gfn )
{
int rc;
xen_instance_t *xen = xen_get_instance(vmi);
xc_interface * xch = xen_get_xchandle(vmi);
domid_t domain_id = xen_get_domainid(vmi);
if ( !xch ) {
errprint("%s error: invalid xc_interface handle\n", __FUNCTION__);
return VMI_FAILURE;
}
if ( domain_id == (domid_t)VMI_INVALID_DOMID ) {
errprint ("%s error: invalid domid\n", __FUNCTION__);
return VMI_FAILURE;
}
rc = xen->libxcw.xc_altp2m_change_gfn (xch, domain_id, altp2m_idx, old_gfn, new_gfn );
if ( rc ) {
errprint ("xc_altp2m_change_gfn returned rc: %i\n", rc);
return VMI_FAILURE;
}
return VMI_SUCCESS;
}
|
/*
* camconditionalaccess.c - CAM (EN50221) Conditional Access resource
* Copyright (C) 2007 Alessandro Decina
*
* Authors:
* Alessandro Decina <alessandro@nnva.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
#include <unistd.h>
#include <string.h>
#include "camutils.h"
#include "camconditionalaccess.h"
#define GST_CAT_DEFAULT cam_debug_cat
#define TAG_CONDITIONAL_ACCESS_INFO_ENQUIRY 0x9F8030
#define TAG_CONDITIONAL_ACCESS_INFO_REPLY 0x9F8031
#define TAG_CONDITIONAL_ACCESS_PMT 0x9F8032
static CamReturn session_request_impl (CamALApplication * application,
CamSLSession * session, CamSLResourceStatus * status);
static CamReturn open_impl (CamALApplication * application,
CamSLSession * session);
static CamReturn close_impl (CamALApplication * application,
CamSLSession * session);
static CamReturn data_impl (CamALApplication * application,
CamSLSession * session, guint tag, guint8 * buffer, guint length);
CamConditionalAccess *
cam_conditional_access_new ()
{
CamConditionalAccess *cas;
CamALApplication *application;
cas = g_new0 (CamConditionalAccess, 1);
application = CAM_AL_APPLICATION (cas);
_cam_al_application_init (application);
application->resource_id = CAM_AL_CONDITIONAL_ACCESS_ID;
application->session_request = session_request_impl;
application->open = open_impl;
application->close = close_impl;
application->data = data_impl;
cas->ready = FALSE;
return cas;
}
void
cam_conditional_access_destroy (CamConditionalAccess * cas)
{
_cam_al_application_destroy (CAM_AL_APPLICATION (cas));
g_free (cas);
}
static CamReturn
send_ca_pmt (CamConditionalAccess * cas, GstStructure * pmt,
guint8 list_management, guint8 cmd_id)
{
CamReturn ret;
guint8 *buffer;
guint buffer_size;
guint offset;
guint8 *ca_pmt;
guint ca_pmt_size;
GList *walk;
ca_pmt = cam_build_ca_pmt (pmt, list_management, cmd_id, &ca_pmt_size);
cam_al_calc_buffer_size (CAM_AL_APPLICATION (cas)->al,
ca_pmt_size, &buffer_size, &offset);
buffer = g_malloc0 (buffer_size);
memcpy (buffer + offset, ca_pmt, ca_pmt_size);
for (walk = CAM_AL_APPLICATION (cas)->sessions; walk; walk = walk->next) {
CamSLSession *session = CAM_SL_SESSION (walk->data);
ret = cam_al_application_write (CAM_AL_APPLICATION (cas), session,
TAG_CONDITIONAL_ACCESS_PMT, buffer, buffer_size, ca_pmt_size);
if (CAM_FAILED (ret)) {
GST_ERROR ("error sending ca_pmt to slot %d, error: %d",
session->connection->slot, ret);
continue;
}
}
g_free (ca_pmt);
g_free (buffer);
return CAM_RETURN_OK;
}
CamReturn
cam_conditional_access_set_pmt (CamConditionalAccess * cas,
GstStructure * pmt, CamConditionalAccessPmtFlag flag)
{
return send_ca_pmt (cas, pmt, flag, 0x01 /* ok_descrambling */ );
}
static CamReturn
send_simple (CamConditionalAccess * cas, CamSLSession * session, guint tag)
{
guint8 *buffer;
guint offset;
guint buffer_size;
CamReturn ret;
cam_al_calc_buffer_size (CAM_AL_APPLICATION (cas)->al, 0, &buffer_size,
&offset);
buffer = g_malloc (buffer_size);
ret = cam_al_application_write (CAM_AL_APPLICATION (cas), session,
tag, buffer, buffer_size, 0);
g_free (buffer);
return ret;
}
static CamReturn
send_conditional_access_enquiry (CamConditionalAccess * cas,
CamSLSession * session)
{
GST_DEBUG ("sending application cas enquiry");
return send_simple (cas, session, TAG_CONDITIONAL_ACCESS_INFO_ENQUIRY);
}
static CamReturn
session_request_impl (CamALApplication * application,
CamSLSession * session, CamSLResourceStatus * status)
{
*status = CAM_SL_RESOURCE_STATUS_OPEN;
return CAM_RETURN_OK;
}
static CamReturn
open_impl (CamALApplication * application, CamSLSession * session)
{
CamConditionalAccess *cas = CAM_CONDITIONAL_ACCESS (application);
GST_INFO ("opening conditional access session %d", session->session_nb);
return send_conditional_access_enquiry (cas, session);
}
static CamReturn
close_impl (CamALApplication * application, CamSLSession * session)
{
GST_INFO ("closing conditional access session %d", session->session_nb);
return CAM_RETURN_OK;
}
static CamReturn
handle_conditional_access_info_reply (CamConditionalAccess * cas,
CamSLSession * session, guint8 * buffer, guint length)
{
int i;
guint16 cas_id;
GST_INFO ("conditional access info enquiry reply");
for (i = 0; i < length / 2; ++i) {
cas_id = GST_READ_UINT16_BE (buffer);
GST_INFO ("slot %d, cas_id 0x%x", session->connection->slot, cas_id);
buffer += 2;
}
cas->ready = TRUE;
return CAM_RETURN_OK;
}
static CamReturn
data_impl (CamALApplication * application, CamSLSession * session,
guint tag, guint8 * buffer, guint length)
{
CamReturn ret;
CamConditionalAccess *cas = CAM_CONDITIONAL_ACCESS (application);
switch (tag) {
case TAG_CONDITIONAL_ACCESS_INFO_REPLY:
ret = handle_conditional_access_info_reply (cas, session, buffer, length);
break;
default:
g_return_val_if_reached (CAM_RETURN_ERROR);
}
return ret;
}
|
/* Copyright 2019 The TensorFlow 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 TENSORFLOW_CORE_COMMON_RUNTIME_EAGER_EAGER_OP_REWRITE_REGISTRY_H_
#define TENSORFLOW_CORE_COMMON_RUNTIME_EAGER_EAGER_OP_REWRITE_REGISTRY_H_
#include <map>
#include <vector>
#include "tensorflow/core/common_runtime/eager/eager_operation.h"
namespace tensorflow {
// Eager op rewrites should inherit from this class and
// implement the Run method.
class EagerOpRewrite {
public:
EagerOpRewrite(string name, string file, string line) {
debug_info_.name = name;
debug_info_.file = file;
debug_info_.line = line;
}
virtual ~EagerOpRewrite() {}
// To be implemented by an Eager op rewrite pass.
virtual Status Run(EagerOperation* orig_op,
std::unique_ptr<tensorflow::EagerOperation>* out_op) = 0;
// Holds information about the rewrite registration.
struct DebugInfo {
string name, file, line;
};
// Returns information about the registered Eager op rewrite.
DebugInfo GetDebugInfo() const { return debug_info_; }
private:
DebugInfo debug_info_;
};
class EagerOpRewriteRegistry {
public:
// Phases at which the Eager op rewrite pass should run.
// For now we only added PRE_EXECUTION. Expand as needed.
enum Phase {
PRE_EXECUTION = 0 // right before executing an eager op
};
// Add a rewrite pass to the registry.
// Only one rewrite pass is allowed per phase.
void Register(Phase phase, std::unique_ptr<EagerOpRewrite> pass);
// Run the rewrite pass registered for a given phase.
Status RunRewrite(Phase phase, EagerOperation* orig_op,
std::unique_ptr<tensorflow::EagerOperation>* out_op);
// Returns the global registry of rewrite passes.
static EagerOpRewriteRegistry* Global();
private:
static constexpr int32 kNumPhases = 1;
// Holds all the registered Eager op rewrites.
std::array<std::unique_ptr<EagerOpRewrite>, kNumPhases> rewrites_;
};
namespace eager_rewrite_registration {
// This class is used to register a new Eager Op rewrite.
class EagerRewriteRegistration {
public:
EagerRewriteRegistration(EagerOpRewriteRegistry::Phase phase,
std::unique_ptr<EagerOpRewrite> pass) {
EagerOpRewriteRegistry::Global()->Register(phase, std::move(pass));
}
};
} // namespace eager_rewrite_registration
#define REGISTER_REWRITE(phase, rewrite) \
REGISTER_REWRITE_UNIQ_HELPER(__COUNTER__, __FILE__, __LINE__, phase, rewrite)
#define REGISTER_REWRITE_UNIQ_HELPER(ctr, file, line, phase, rewrite) \
REGISTER_REWRITE_UNIQ(ctr, file, line, phase, rewrite)
#define REGISTER_REWRITE_UNIQ(ctr, file, line, phase, rewrite) \
static ::tensorflow::eager_rewrite_registration::EagerRewriteRegistration \
register_rewrite_##ctr(phase, \
::std::unique_ptr<::tensorflow::EagerOpRewrite>( \
new rewrite(#rewrite, file, #line)))
} // namespace tensorflow
#endif // TENSORFLOW_CORE_COMMON_RUNTIME_EAGER_EAGER_OP_REWRITE_REGISTRY_H_
|
/* vim: set ft=objc fenc=utf-8 sw=2 ts=2 et: */
/*
* DOUAudioStreamer - A Core Audio based streaming audio player for iOS/Mac:
*
* https://github.com/douban/DOUAudioStreamer
*
* Copyright 2013-2014 Douban Inc. All rights reserved.
*
* Use and distribution licensed under the BSD license. See
* the LICENSE file for full text.
*
* Authors:
* Chongyu Zhu <i@lembacon.com>
*
*/
#import <Foundation/Foundation.h>
typedef void (^DOUSimpleHTTPRequestCompletedBlock)(void);
typedef void (^DOUSimpleHTTPRequestProgressBlock)(double downloadProgress);
typedef void (^DOUSimpleHTTPRequestDidReceiveResponseBlock)(void);
typedef void (^DOUSimpleHTTPRequestDidReceiveDataBlock)(NSData *data);
@interface DOUSimpleHTTPRequest : NSObject
+ (instancetype)requestWithURL:(NSURL *)url;
- (instancetype)initWithURL:(NSURL *)url;
+ (NSTimeInterval)defaultTimeoutInterval;
+ (NSString *)defaultUserAgent;
@property (nonatomic, assign) NSTimeInterval timeoutInterval;
@property (nonatomic, strong) NSString *userAgent;
@property (nonatomic, readonly) NSData *responseData;
@property (nonatomic, readonly) NSString *responseString;
@property (nonatomic, readonly) NSDictionary *responseHeaders;
@property (nonatomic, readonly) NSUInteger responseContentLength;
@property (nonatomic, readonly) NSInteger statusCode;
@property (nonatomic, readonly) NSString *statusMessage;
@property (nonatomic, readonly) NSUInteger downloadSpeed;
@property (nonatomic, readonly, getter = isFailed) BOOL failed;
@property (copy) DOUSimpleHTTPRequestCompletedBlock completedBlock;
@property (copy) DOUSimpleHTTPRequestProgressBlock progressBlock;
@property (copy) DOUSimpleHTTPRequestDidReceiveResponseBlock didReceiveResponseBlock;
@property (copy) DOUSimpleHTTPRequestDidReceiveDataBlock didReceiveDataBlock;
- (void)start;
- (void)cancel;
@end
|
/*
* Copyright (C) the libgit2 contributors. All rights reserved.
*
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
#ifndef INCLUDE_index_h__
#define INCLUDE_index_h__
#include "fileops.h"
#include "filebuf.h"
#include "vector.h"
#include "idxmap.h"
#include "tree-cache.h"
#include "git2/odb.h"
#include "git2/index.h"
#define GIT_INDEX_FILE "index"
#define GIT_INDEX_FILE_MODE 0666
struct git_index {
git_refcount rc;
char *index_file_path;
git_futils_filestamp stamp;
git_oid checksum; /* checksum at the end of the file */
git_vector entries;
git_idxmap *entries_map;
git_vector deleted; /* deleted entries if readers > 0 */
git_atomic readers; /* number of active iterators */
unsigned int on_disk:1;
unsigned int ignore_case:1;
unsigned int distrust_filemode:1;
unsigned int no_symlinks:1;
git_tree_cache *tree;
git_pool tree_pool;
git_vector names;
git_vector reuc;
git_vector_cmp entries_cmp_path;
git_vector_cmp entries_search;
git_vector_cmp entries_search_path;
git_vector_cmp reuc_search;
};
struct git_index_conflict_iterator {
git_index *index;
size_t cur;
};
extern void git_index_entry__init_from_stat(
git_index_entry *entry, struct stat *st, bool trust_mode);
/* Index entry comparison functions for array sorting */
extern int git_index_entry_cmp(const void *a, const void *b);
extern int git_index_entry_icmp(const void *a, const void *b);
/* Index entry search functions for search using a search spec */
extern int git_index_entry_srch(const void *a, const void *b);
extern int git_index_entry_isrch(const void *a, const void *b);
/* Index time handling functions */
GIT_INLINE(bool) git_index_time_eq(const git_index_time *one, const git_index_time *two)
{
if (one->seconds != two->seconds)
return false;
#ifdef GIT_USE_NSEC
if (one->nanoseconds != two->nanoseconds)
return false;
#endif
return true;
}
/*
* Test if the given index time is newer than the given existing index entry.
* If the timestamps are exactly equivalent, then the given index time is
* considered "racily newer" than the existing index entry.
*/
GIT_INLINE(bool) git_index_entry_newer_than_index(
const git_index_entry *entry, git_index *index)
{
/* If we never read the index, we can't have this race either */
if (!index || index->stamp.mtime.tv_sec == 0)
return false;
/* If the timestamp is the same or newer than the index, it's racy */
#if defined(GIT_USE_NSEC)
if ((int32_t)index->stamp.mtime.tv_sec < entry->mtime.seconds)
return true;
else if ((int32_t)index->stamp.mtime.tv_sec > entry->mtime.seconds)
return false;
else
return (uint32_t)index->stamp.mtime.tv_nsec <= entry->mtime.nanoseconds;
#else
return ((int32_t)index->stamp.mtime.tv_sec) <= entry->mtime.seconds;
#endif
}
/* Search index for `path`, returning GIT_ENOTFOUND if it does not exist
* (but not setting an error message).
*
* `at_pos` is set to the position where it is or would be inserted.
* Pass `path_len` as strlen of path or 0 to call strlen internally.
*/
extern int git_index__find_pos(
size_t *at_pos, git_index *index, const char *path, size_t path_len, int stage);
extern int git_index__fill(git_index *index, const git_vector *source_entries);
extern void git_index__set_ignore_case(git_index *index, bool ignore_case);
extern unsigned int git_index__create_mode(unsigned int mode);
GIT_INLINE(const git_futils_filestamp *) git_index__filestamp(git_index *index)
{
return &index->stamp;
}
extern int git_index__changed_relative_to(git_index *index, const git_oid *checksum);
/* Copy the current entries vector *and* increment the index refcount.
* Call `git_index__release_snapshot` when done.
*/
extern int git_index_snapshot_new(git_vector *snap, git_index *index);
extern void git_index_snapshot_release(git_vector *snap, git_index *index);
/* Allow searching in a snapshot; entries must already be sorted! */
extern int git_index_snapshot_find(
size_t *at_pos, git_vector *snap, git_vector_cmp entry_srch,
const char *path, size_t path_len, int stage);
/* Replace an index with a new index */
int git_index_read_index(git_index *index, const git_index *new_index);
typedef struct {
git_index *index;
git_filebuf file;
unsigned int should_write:1;
} git_indexwriter;
#define GIT_INDEXWRITER_INIT { NULL, GIT_FILEBUF_INIT }
/* Lock the index for eventual writing. */
extern int git_indexwriter_init(git_indexwriter *writer, git_index *index);
/* Lock the index for eventual writing by a repository operation: a merge,
* revert, cherry-pick or a rebase. Note that the given checkout strategy
* will be updated for the operation's use so that checkout will not write
* the index.
*/
extern int git_indexwriter_init_for_operation(
git_indexwriter *writer,
git_repository *repo,
unsigned int *checkout_strategy);
/* Write the index and unlock it. */
extern int git_indexwriter_commit(git_indexwriter *writer);
/* Cleanup an index writing session, unlocking the file (if it is still
* locked and freeing any data structures.
*/
extern void git_indexwriter_cleanup(git_indexwriter *writer);
#endif
|
/*
Copyright (c) 2013, salesforce.com, inc. All rights reserved.
Redistribution and use of this software in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of
conditions and the following disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of salesforce.com, inc. nor the names of its contributors may be used to
endorse or promote products derived from this software without specific prior written
permission of salesforce.com, inc.
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.
*/
#import <Foundation/Foundation.h>
#import "SFPasscodeProviderManager.h"
@interface SFPBKDF2PasscodeProvider : NSObject <SFPasscodeProvider>
/**
* The length in bytes to use for the random-generated salt. This value defaults to
* kSFPBKDFDefaultSaltByteLength in SFSDKCryptoUtils.h.
* NOTE: Differences in this value affect the generated key. You must keep track of
* this value if you wish to generate the same key at a future date.
*/
@property (nonatomic, assign) NSUInteger saltLengthInBytes;
/**
* The number of derivation rounds to use when generating a key. This value defaults
* to kSFPBKDFDefaultNumberOfDerivationRounds in SFSDKCryptoUtils.h.
* NOTE: Differences in this value affect the generated key. You must keep track of
* this value if you wish to generate the same key at a future date.
*/
@property (nonatomic, assign) NSUInteger numDerivationRounds;
/**
* The desired length in bytes of the derived key to use when generating a key. This
* value defaults to kSFPBKDFDefaultDerivedKeyByteLength in SFSDKCryptoUtils.h.
* NOTE: Differences in this value affect the generated key. You must keep track of
* this value if you wish to generate the same key at a future date.
*/
@property (nonatomic, assign) NSUInteger derivedKeyLengthInBytes;
@end
|
/*
* Copyright (C) 2002-2007 Akira Nukada. All rights reserved.
* Copyright (C) 2002-2007 The SSI Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE SSI PROJECT ``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 SSI PROJECT 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 "libfftss.h"
#if defined(BlueGene)
#ifdef USE_WRAP440D
#include "wrap440d.h"
#endif
static inline void
kern_r4_bgl_n_f(double *restrict o0,
double *restrict o1,
double *restrict o2,
double *restrict o3,
double *i0,
double *i1,
double *i2,
double *i3,
double *wn,
double *wn2,
long bsize, long blocks)
{
long i, j;
#pragma disjoint(*o0,*o1,*o2,*o3,*i0,*i1,*i2,*i3,*wn,*wn2)
__alignx(16,o0);
__alignx(16,o1);
__alignx(16,o2);
__alignx(16,o3);
__alignx(16,i0);
__alignx(16,i1);
__alignx(16,i2);
__alignx(16,i3);
__alignx(16,wn);
__alignx(16,wn2);
for (i = 0; i < blocks; i++) {
double _Complex w1, w2, w3;
w2 = __lfpd(wn + i * bsize * 4);
w1 = __lfpd(wn + i * bsize * 2);
w3 = __lfpd(wn2 + i * bsize * 2);
for (j = 0; j < bsize; j++) {
double _Complex p0, p1, p2, p3;
double _Complex q0, q1, q2, q3;
p2 = __lfpd(i2 + 2 * j);
p1 = __lfpd(i1 + 2 * j);
p3 = __lfpd(i3 + 2 * j);
p0 = __lfpd(i0 + 2 * j);
p2 = __fxcxnpma(p2, p2, __creal(w2)); /* [-pi2,pr2] */
p1 = __fxcxnpma(p1, p1, __creal(w1)); /* [-pi1,pr1] */
p3 = __fxcxnpma(p3, p3, __creal(w3)); /* [-pi3,pr3] */
q0 = __fxcxnsma(p0, p2, __cimag(w2)); /* [qr0,qi0] */
q2 = __fxcxnpma(p0, p2, __cimag(w2)); /* [qr2,qi2] */
q1 = __fxcpmadd(p1, p3, __cimag(w3)); /* [-qi1,qr1] */
q3 = __fxcpnmsub(p1, p3, __cimag(w3)); /* [-qi3,qr3] */
__stfpd(o0 + 2 * j, __fxcxnsma(q0, q1, __cimag(w1)));
__stfpd(o2 + 2 * j, __fxcxnpma(q0, q1, __cimag(w1)));
__stfpd(o1 + 2 * j, __fxcsnmsub(q2, q3, __cimag(w1)));
__stfpd(o3 + 2 * j, __fxcsmadd(q2, q3, __cimag(w1)));
/* 44flops/26cycle */
}
i0 += 8 * bsize; i1 += 8 * bsize;
i2 += 8 * bsize; i3 += 8 * bsize;
o0 += 2 * bsize; o1 += 2 * bsize;
o2 += 2 * bsize; o3 += 2 * bsize;
}
}
static inline void
kern_r4_bgl_n_b(double *restrict o0,
double *restrict o1,
double *restrict o2,
double *restrict o3,
double *i0,
double *i1,
double *i2,
double *i3,
double *wn,
double *wn2,
long bsize, long blocks)
{
long i, j;
for (i = 0; i < blocks; i++) {
double _Complex w1, w2, w3;
w2 = __lfpd(wn + 4 * i * bsize);
w1 = __lfpd(wn + 2 * i * bsize);
w3 = __lfpd(wn2 + 2 * i * bsize);
for (j = 0; j < bsize; j++) {
double _Complex p0, p1, p2, p3;
double _Complex q0, q1, q2, q3;
p2 = __lfpd(i2 + 2 * j);
p1 = __lfpd(i1 + 2 * j);
p3 = __lfpd(i3 + 2 * j);
p0 = __lfpd(i0 + 2 * j);
p2 = __fxcxnsma(p2, p2, __creal(w2)); /* [pi2,-pr2] */
p1 = __fxcxnsma(p1, p1, __creal(w1)); /* [pi1,-pr1] */
p3 = __fxcxnsma(p3, p3, __creal(w3)); /* [pi3,-pr3] */
q0 = __fxcxnpma(p0, p2, __cimag(w2)); /* [qr0,qi0] */
q2 = __fxcxnsma(p0, p2, __cimag(w2)); /* [qr2,qi2] */
q1 = __fxcpmadd(p1, p3, __cimag(w3)); /* [qi1,-qr1] */
q3 = __fxcpnmsub(p1, p3, __cimag(w3)); /* [qi3,-qr3] */
__stfpd(o0 + 2 * j, __fxcxnpma(q0, q1, __cimag(w1)));
__stfpd(o2 + 2 * j, __fxcxnsma(q0, q1, __cimag(w1)));
__stfpd(o1 + 2 * j, __fxcsnmsub(q2, q3, __cimag(w1)));
__stfpd(o3 + 2 * j, __fxcsmadd(q2, q3, __cimag(w1)));
}
i0 += 8 * bsize; i1 += 8 * bsize;
i2 += 8 * bsize; i3 += 8 * bsize;
o0 += 2 * bsize; o1 += 2 * bsize;
o2 += 2 * bsize; o3 += 2 * bsize;
}
}
void fftss_r4_bgl_n_f(double *in, double *out, double *w,
long bsize, long blocks)
{
kern_r4_bgl_n_f(out, out + bsize * blocks * 2,
out + bsize * blocks * 4, out + bsize * blocks * 6,
in, in + bsize * 2,
in + bsize * 4, in + bsize * 6,
w, w + bsize * blocks * 6, bsize, blocks);
}
void fftss_r4_bgl_n_b(double *in, double *out, double *w,
long bsize, long blocks)
{
kern_r4_bgl_n_b(out, out + bsize * blocks * 2,
out + bsize * blocks * 4, out + bsize * blocks * 6,
in, in + bsize * 2,
in + bsize * 4, in + bsize * 6,
w, w + bsize * blocks * 6, bsize, blocks);
}
#endif
|
/* Copyright 2020 The TensorFlow 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 TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_OPS_N_Z_H_
#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_OPS_N_Z_H_
#include "mlir/Dialect/Traits.h" // from @llvm-project
#include "mlir/IR/Attributes.h" // from @llvm-project
#include "mlir/IR/Builders.h" // from @llvm-project
#include "mlir/IR/BuiltinOps.h" // from @llvm-project
#include "mlir/IR/BuiltinTypes.h" // from @llvm-project
#include "mlir/IR/Dialect.h" // from @llvm-project
#include "mlir/IR/Matchers.h" // from @llvm-project
#include "mlir/IR/OpImplementation.h" // from @llvm-project
#include "mlir/IR/TypeUtilities.h" // from @llvm-project
#include "mlir/Interfaces/CallInterfaces.h" // from @llvm-project
#include "mlir/Interfaces/ControlFlowInterfaces.h" // from @llvm-project
#include "mlir/Interfaces/DerivedAttributeOpInterface.h" // from @llvm-project
#include "mlir/Interfaces/InferTypeOpInterface.h" // from @llvm-project
#include "mlir/Interfaces/LoopLikeInterface.h" // from @llvm-project
#include "mlir/Interfaces/SideEffectInterfaces.h" // from @llvm-project
#include "tensorflow/compiler/mlir/tensorflow/ir/tf_attributes.h"
#include "tensorflow/compiler/mlir/tensorflow/ir/tf_op_interfaces.h"
#include "tensorflow/compiler/mlir/tensorflow/ir/tf_structs.h"
#include "tensorflow/compiler/mlir/tensorflow/ir/tf_traits.h"
#include "tensorflow/compiler/mlir/tensorflow/ir/tf_types.h"
#include "tensorflow/compiler/mlir/tensorflow/ir/tf_verifiers.h"
#define GET_OP_FWD_DEFINES
#include "tensorflow/compiler/mlir/tensorflow/ir/tf_all_ops.h.inc"
#define GET_OP_CLASSES
#include "tensorflow/compiler/mlir/tensorflow/ir/tf_ops_n_z.h.inc"
#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_OPS_N_Z_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_EXTENSIONS_API_IDENTITY_WEB_AUTH_FLOW_H_
#define CHROME_BROWSER_EXTENSIONS_API_IDENTITY_WEB_AUTH_FLOW_H_
#include <string>
#include "base/macros.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/web_contents_observer.h"
#include "extensions/browser/app_window/app_window_registry.h"
#include "ui/gfx/geometry/rect.h"
#include "url/gurl.h"
class Profile;
class WebAuthFlowTest;
namespace content {
class NotificationDetails;
class NotificationSource;
}
namespace extensions {
// Controller class for web based auth flows. The WebAuthFlow creates
// a dialog window in the scope approval component app by firing an
// event. A webview embedded in the dialog will navigate to the
// |provider_url| passed to the WebAuthFlow constructor.
//
// The WebAuthFlow monitors the WebContents of the webview, and
// notifies its delegate interface any time the WebContents navigates
// to a new URL or changes title. The delegate is expected to delete
// the flow when navigation reaches a known target location.
//
// The window is not displayed until the first page load
// completes. This allows the flow to complete without flashing a
// window on screen if the provider immediately redirects to the
// target URL.
//
// A WebAuthFlow can be started in Mode::SILENT, which never displays
// a window. If a window would be required, the flow fails.
class WebAuthFlow : public content::NotificationObserver,
public content::WebContentsObserver,
public AppWindowRegistry::Observer {
public:
enum Mode {
INTERACTIVE, // Show UI to the user if necessary.
SILENT // No UI should be shown.
};
enum Failure {
WINDOW_CLOSED, // Window closed by user.
INTERACTION_REQUIRED, // Non-redirect page load in silent mode.
LOAD_FAILED
};
class Delegate {
public:
// Called when the auth flow fails. This means that the flow did not result
// in a successful redirect to a valid redirect URL.
virtual void OnAuthFlowFailure(Failure failure) = 0;
// Called on redirects and other navigations to see if the URL should stop
// the flow.
virtual void OnAuthFlowURLChange(const GURL& redirect_url) = 0;
// Called when the title of the current page changes.
virtual void OnAuthFlowTitleChange(const std::string& title) = 0;
protected:
virtual ~Delegate() {}
};
// Creates an instance with the given parameters.
// Caller owns |delegate|.
WebAuthFlow(Delegate* delegate,
Profile* profile,
const GURL& provider_url,
Mode mode);
~WebAuthFlow() override;
// Starts the flow.
virtual void Start();
// Prevents further calls to the delegate and deletes the flow.
void DetachDelegateAndDelete();
private:
friend class ::WebAuthFlowTest;
// ::AppWindowRegistry::Observer implementation.
void OnAppWindowAdded(AppWindow* app_window) override;
void OnAppWindowRemoved(AppWindow* app_window) override;
// NotificationObserver implementation.
void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) override;
// WebContentsObserver implementation.
void DidStopLoading() override;
void RenderProcessGone(base::TerminationStatus status) override;
void DidGetRedirectForResourceRequest(
const content::ResourceRedirectDetails& details) override;
void TitleWasSet(content::NavigationEntry* entry, bool explicit_set) override;
void DidStartNavigation(
content::NavigationHandle* navigation_handle) override;
void DidFinishNavigation(
content::NavigationHandle* navigation_handle) override;
void BeforeUrlLoaded(const GURL& url);
void AfterUrlLoaded();
Delegate* delegate_;
Profile* profile_;
GURL provider_url_;
Mode mode_;
AppWindow* app_window_;
std::string app_window_key_;
bool embedded_window_created_;
content::NotificationRegistrar registrar_;
DISALLOW_COPY_AND_ASSIGN(WebAuthFlow);
};
} // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_API_IDENTITY_WEB_AUTH_FLOW_H_
|
/*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can
* be found in the LICENSE file.
*
*/
#pragma once
//
//
//
#include "skc.h"
#include "assert_state.h"
//
// SURFACE
//
struct skc_surface
{
struct skc_context * context;
struct skc_surface_impl * impl;
skc_int ref_count;
void (* release)(struct skc_surface_impl * const impl);
void (* render )(struct skc_surface_impl * const impl,
skc_styling_t styling,
skc_composition_t composition,
skc_framebuffer_t fb,
uint32_t const clip[4],
int32_t const txty[2],
skc_surface_render_notify notify,
void * data);
};
//
//
//
|
// 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 CHROMECAST_BROWSER_MEDIA_CMA_MESSAGE_FILTER_HOST_H_
#define CHROMECAST_BROWSER_MEDIA_CMA_MESSAGE_FILTER_HOST_H_
#include <map>
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/shared_memory.h"
#include "base/memory/weak_ptr.h"
#include "chromecast/common/media/cma_ipc_common.h"
#include "chromecast/media/cma/backend/media_pipeline_device.h"
#include "chromecast/media/cma/pipeline/load_type.h"
#include "content/public/browser/browser_message_filter.h"
#include "content/public/browser/browser_thread.h"
#include "media/base/buffering_state.h"
#include "media/base/pipeline_status.h"
namespace base {
class CancelableSyncSocket;
class SingleThreadTaskRunner;
}
namespace gfx {
class PointF;
class Size;
}
namespace media {
class AudioDecoderConfig;
class BrowserCdm;
class VideoDecoderConfig;
}
namespace chromecast {
namespace media {
class MediaPipelineHost;
class CmaMessageFilterHost
: public content::BrowserMessageFilter {
public:
CmaMessageFilterHost(
int render_process_id,
const media::CreatePipelineDeviceCB& create_pipeline_device_cb);
// content::BrowserMessageFilter implementation.
void OnChannelClosing() override;
void OnDestruct() const override;
bool OnMessageReceived(const IPC::Message& message) override;
private:
typedef std::map<int, MediaPipelineHost*> MediaPipelineMap;
friend class content::BrowserThread;
friend class base::DeleteHelper<CmaMessageFilterHost>;
~CmaMessageFilterHost() override;
void DeleteEntries();
MediaPipelineHost* LookupById(int media_id);
// Handling of incoming IPC messages.
void CreateMedia(int media_id, LoadType load_type);
void DestroyMedia(int media_id);
void SetCdm(int media_id, int render_frame_id, int cdm_id);
void CreateAvPipe(int media_id, TrackId track_id, size_t shared_mem_size);
void OnAvPipeSet(int media_id,
TrackId track_id,
base::SharedMemoryHandle foreign_memory_handle,
scoped_ptr<base::CancelableSyncSocket> foreign_socket);
void AudioInitialize(int media_id,
TrackId track_id,
const ::media::AudioDecoderConfig& config);
void VideoInitialize(
int media_id,
TrackId track_id,
const std::vector<::media::VideoDecoderConfig>& configs);
void StartPlayingFrom(int media_id, base::TimeDelta time);
void Flush(int media_id);
void Stop(int media_id);
void SetPlaybackRate(int media_id, double playback_rate);
void SetVolume(int media_id, TrackId track_id, float volume);
void NotifyPipeWrite(int media_id, TrackId track_id);
void NotifyExternalSurface(int surface_id,
const gfx::PointF& p0, const gfx::PointF& p1,
const gfx::PointF& p2, const gfx::PointF& p3);
// Audio/Video callbacks.
void OnMediaStateChanged(int media_id,
::media::PipelineStatus status);
void OnTrackStateChanged(int media_id,
TrackId track_id,
::media::PipelineStatus status);
void OnPipeReadActivity(int media_id, TrackId track_id);
void OnTimeUpdate(int media_id,
base::TimeDelta media_time,
base::TimeDelta max_media_time,
base::TimeTicks stc);
void OnBufferingNotification(int media_id, ::media::BufferingState state);
void OnEos(int media_id, TrackId track_id);
void OnPlaybackError(int media_id, TrackId track_id,
::media::PipelineStatus status);
void OnStatisticsUpdated(int media_id,
TrackId track_id,
const ::media::PipelineStatistics& stats);
void OnNaturalSizeChanged(int media_id,
TrackId track_id,
const gfx::Size& size);
// Render process ID correponding to this message filter.
const int process_id_;
// Factory function for device-specific part of media pipeline creation
media::CreatePipelineDeviceCB create_pipeline_device_cb_;
// List of media pipeline and message loop media pipelines are running on.
MediaPipelineMap media_pipelines_;
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
base::WeakPtr<CmaMessageFilterHost> weak_this_;
base::WeakPtrFactory<CmaMessageFilterHost> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(CmaMessageFilterHost);
};
} // namespace media
} // namespace chromecast
#endif // CHROMECAST_BROWSER_MEDIA_CMA_MESSAGE_FILTER_HOST_H_
|
/*
*
* University of Luxembourg
* Laboratory of Algorithmics, Cryptology and Security (LACS)
*
* FELICS - Fair Evaluation of Lightweight Cryptographic Systems
*
* Copyright (C) 2016 University of Luxembourg
*
* Written in 2016 by Daniel Dinu <dumitru-daniel.dinu@uni.lu>
*
* This file is part of FELICS.
*
* FELICS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* FELICS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef UPDATE_H
#define UPDATE_H
/*
*
* Update cipher state
* ... state - the cipher state
* ... keyStream - the generated key stream
*
*/
void Update(uint8_t *state, uint8_t *keyStream);
#endif /* UPDATE_H */
|
/*
* This file is a part of the open source stm32plus library.
* Copyright (c) 2011,2012,2013 Andy Brown <www.andybrown.me.uk>
* Please see website for licensing terms.
*/
#pragma once
// ensure the MCU series is correct
#ifndef STM32PLUS_F1
#error This class can only be used with the STM32F4 series
#endif
namespace stm32plus {
/**
* Support for the temp sensor ADC channel is a simple extension of the regular channel
* configuration.
*/
template<uint8_t TSampleCycles,uint16_t TV25=Adc1PeripheralTraits::V25,uint16_t TAvgSlope=Adc1PeripheralTraits::AVG_SLOPE> // from the datasheet (scaled)
struct AdcTemperatureSensorFeature : AdcRegularChannelFeature<1,TSampleCycles,16> {
/**
* Constants used by the conversion function to get good accuracy from
* the integer calculation
*/
enum {
SCALER = 1000
};
/**
* Constructor, initialise upwards then enable the sensor feature
*/
AdcTemperatureSensorFeature(Adc& adc)
: AdcRegularChannelFeature<1,TSampleCycles,16>(adc) {
}
/**
* Post ADC_Init() initialisation
*/
void initialise() {
AdcRegularChannelFeature<1,TSampleCycles,16>::initialise();
ADC_TempSensorVrefintCmd(ENABLE);
}
/**
* Convert the value read from the ADC to a temperature in centigrade. We scale up the
* necessary constants for the calculation to avoid floating point numbers.
* @param vsense The value read from the ADC
* @return The temperature in degrees C
*/
uint8_t getTemperature(uint16_t vsense) const {
uint32_t value;
value=(vsense*3300) & 0xfff;
// scale up the sensed value by 1000
value=value*SCALER;
value=((value-TV25)/TAvgSlope)+(25*SCALER);
return value/SCALER;
}
};
/*
* Typedefs for the difference cycles on ADC1.
*/
typedef AdcTemperatureSensorFeature<ADC_SampleTime_1Cycles5> Adc1Cycle1TemperatureSensorFeature;
typedef AdcTemperatureSensorFeature<ADC_SampleTime_7Cycles5> Adc1Cycle7TemperatureSensorFeature;
typedef AdcTemperatureSensorFeature<ADC_SampleTime_13Cycles5> Adc1Cycle13TemperatureSensorFeature;
typedef AdcTemperatureSensorFeature<ADC_SampleTime_28Cycles5> Adc1Cycle28TemperatureSensorFeature;
typedef AdcTemperatureSensorFeature<ADC_SampleTime_41Cycles5> Adc1Cycle41TemperatureSensorFeature;
typedef AdcTemperatureSensorFeature<ADC_SampleTime_55Cycles5> Adc1Cycle55TemperatureSensorFeature;
typedef AdcTemperatureSensorFeature<ADC_SampleTime_71Cycles5> Adc1Cycle71TemperatureSensorFeature;
typedef AdcTemperatureSensorFeature<ADC_SampleTime_239Cycles5> Adc1Cycle239TemperatureSensorFeature;
}
|
///////////////////////////////////////////////////////////////////////////
//
// Copyright 2010
//
// This file is part of starlight.
//
// starlight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// starlight 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 starlight. If not, see <http://www.gnu.org/licenses/>.
//
///////////////////////////////////////////////////////////////////////////
//
// File and Version Information:
// $Rev:: 292 $: revision of last commit
// $Author:: butter $: author of last commit
// $Date:: 2017-10-17 02:43:54 +0200 #$: date of last commit
//
// Description:
//
//
//
///////////////////////////////////////////////////////////////////////////
#ifndef STARLIGHTLIMITS_H_INCLUDE
#define STARLIGHTLIMITS_H_INCLUDE
namespace starlightLimits
{
static const int MAXWBINS = 3000;
static const int MAXYBINS = 3000;
static const int MAXPTBINS = 3000;
}
#endif // STARLIGHTLIMITS_H_INCLUDE
|
#ifndef NETLISTMGR_UTIL_H
#define NETLISTMGR_UTIL_H
#include <netlistmgr.h>
#if defined(Q_CC_MINGW)
// for some reason MinGW ships an incomplete netlistmgr.h
#include <ocidl.h> // IConnectionPoint and IConnectionPointContainer
#ifdef __cplusplus
extern "C" {
#endif
static const GUID CLSID_NetworkListManager = { 0xDCB00C01, 0x570F, 0x4A9B,{ 0x8D,0x69, 0x19,0x9F,0xDB,0xA5,0x72,0x3B } };
static const GUID IID_INetworkListManager = { 0xDCB00000, 0x570F, 0x4A9B,{ 0x8D,0x69, 0x19,0x9F,0xDB,0xA5,0x72,0x3B } };
static const GUID IID_INetworkListManagerEvents = { 0xDCB00001, 0x570F, 0x4A9B,{ 0x8D,0x69, 0x19,0x9F,0xDB,0xA5,0x72,0x3B } };
interface INetworkListManagerEvents : public IUnknown
{
virtual HRESULT STDMETHODCALLTYPE ConnectivityChanged(
NLM_CONNECTIVITY newConnectivity) = 0;
};
interface IEnumNetworks;
interface INetwork;
interface IEnumNetworkConnections;
interface INetworkConnection;
interface INetworkListManager : public IDispatch
{
virtual HRESULT STDMETHODCALLTYPE GetNetworks(
NLM_ENUM_NETWORK Flags,
IEnumNetworks **ppEnumNetwork) = 0;
virtual HRESULT STDMETHODCALLTYPE GetNetwork(
GUID gdNetworkId,
INetwork **ppNetwork) = 0;
virtual HRESULT STDMETHODCALLTYPE GetNetworkConnections(
IEnumNetworkConnections **ppEnum) = 0;
virtual HRESULT STDMETHODCALLTYPE GetNetworkConnection(
GUID gdNetworkConnectionId,
INetworkConnection **ppNetworkConnection) = 0;
virtual HRESULT STDMETHODCALLTYPE get_IsConnectedToInternet(
VARIANT_BOOL *pbIsConnected) = 0;
virtual HRESULT STDMETHODCALLTYPE get_IsConnected(
VARIANT_BOOL *pbIsConnected) = 0;
virtual HRESULT STDMETHODCALLTYPE GetConnectivity(
NLM_CONNECTIVITY *pConnectivity) = 0;
};
#ifdef __cplusplus
}
#endif
#endif // !(defined(Q_CC_MINGW)
#endif // NETLISTMGR_UTIL_H
|
// Copyright 2022 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_PUBLIC_PROVIDER_CHROME_BROWSER_APP_UTILS_APP_UTILS_API_H_
#define IOS_PUBLIC_PROVIDER_CHROME_BROWSER_APP_UTILS_APP_UTILS_API_H_
#import <Foundation/Foundation.h>
class Browser;
namespace base {
class CommandLine;
}
namespace ios {
namespace provider {
// Initializes global provider state. Must be called as soon as possible
// in the application startup code. It is safe to call it multiple times
// in unit tests.
void Initialize();
// Appends additional command-line flags. Called before web startup.
void AppendSwitchesFromExperimentalSettings(
NSUserDefaults* experimental_settings,
base::CommandLine* command_line);
// Attaches any embedder-specific browser agents to the given |browser|.
void AttachBrowserAgents(Browser* browser);
} // namespace provider
} // namespace ios
#endif // IOS_PUBLIC_PROVIDER_CHROME_BROWSER_APP_UTILS_APP_UTILS_API_H_
|
#import <UIKit/UIKit.h>
@interface ViewControllerTwo : UIViewController
@property (weak, nonatomic) IBOutlet UICollectionView *collectionView;
@end
|
/////////////////////////////////////////////////////////////////////////////
// Name: game.h
// Purpose: Life! game logic
// Author: Guillermo Rodriguez Garcia, <guille@iies.es>
// Modified by:
// Created: Jan/2000
// RCS-ID: $Id$
// Copyright: (c) 2000, Guillermo Rodriguez Garcia
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _LIFE_GAME_H_
#define _LIFE_GAME_H_
// --------------------------------------------------------------------------
// LifePattern
// --------------------------------------------------------------------------
// A class which holds a pattern
class LifePattern
{
public:
// This ctor is used by the LifeReader class
LifePattern(wxString name,
wxString description,
wxString rules,
wxArrayString shape)
{
m_name = name;
m_description = description;
m_rules = rules;
m_shape = shape;
};
// A more convenient ctor for the built-in samples
LifePattern(wxString name,
wxString description,
int width,
int height,
const char *shape)
{
m_name = name;
m_description = description;
m_rules = wxEmptyString;
// TODO: add the positions later, since the formatting command
// causes a crash due to conversion objects not being available
// during initialisation.
#ifndef __WXMAC__
m_shape.Add( wxString::Format(wxT("%i %i"), -width/2, -height/2) );
#endif
for(int j = 0; j < height; j++)
{
wxString tmp;
for(int i = 0; i < width; i++)
{
tmp += wxChar(shape[j * width + i]);
}
m_shape.Add( tmp );
}
};
wxString m_name;
wxString m_description;
wxString m_rules;
wxArrayString m_shape;
};
// --------------------------------------------------------------------------
// Life
// --------------------------------------------------------------------------
// A struct used to pass cell coordinates around
struct LifeCell
{
wxInt32 i;
wxInt32 j;
};
// A private class that contains data about a block of cells
class LifeCellBox;
// A class that models a Life game instance
class Life
{
public:
// ctor and dtor
Life();
~Life();
// accessors
inline wxUint32 GetNumCells() const { return m_numcells; };
inline wxString GetRules() const { return m_rules; };
inline wxString GetDescription() const { return m_description; };
bool IsAlive(wxInt32 x, wxInt32 y);
void SetCell(wxInt32 x, wxInt32 y, bool alive = true);
void SetPattern(const LifePattern &pattern);
// game control
void Clear();
bool NextTic();
// navigation
LifeCell FindNorth();
LifeCell FindSouth();
LifeCell FindWest();
LifeCell FindEast();
LifeCell FindCenter();
// The following functions find cells within a given viewport; either
// all alive cells, or only those cells which have changed since last
// generation. You first call BeginFind() to specify the viewport,
// then keep calling FindMore() until it returns true.
//
// BeginFind:
// Specify the viewport and whether to look for alive cells or for
// cells which have changed since the last generation and thus need
// to be repainted. In this latter case, there is no distinction
// between newborn or just-dead cells.
//
// FindMore:
// Fills an array with cells that match the specification given with
// BeginFind(). The array itself belongs to the Life object and must
// not be modified or freed by the caller. If this function returns
// false, then the operation is not complete: just process all cells
// and call FillMore() again.
//
void BeginFind(wxInt32 x0, wxInt32 y0,
wxInt32 x1, wxInt32 y1,
bool changed);
bool FindMore(LifeCell *cells[], size_t *ncells);
private:
// cellbox-related
LifeCellBox *CreateBox(wxInt32 x, wxInt32 y, wxUint32 hv);
LifeCellBox *LinkBox(wxInt32 x, wxInt32 y, bool create = true);
void KillBox(LifeCellBox *c);
// helper for BeginFind & FindMore
void DoLine(wxInt32 x, wxInt32 y, wxUint32 alive, wxUint32 old = 0);
// pattern description
wxString m_name; // name (currently unused)
wxString m_rules; // rules (currently unused)
wxString m_description; // description
// pattern data
LifeCellBox *m_head; // list of alive boxes
LifeCellBox *m_available; // list of reusable dead boxes
LifeCellBox **m_boxes; // hash table of alive boxes
wxUint32 m_numcells; // population (number of alive cells)
// state vars for BeginFind & FindMore
LifeCell *m_cells; // array of cells
size_t m_ncells; // number of valid entries in m_cells
wxInt32 m_x, m_y, // counters and search mode
m_x0, m_y0,
m_x1, m_y1;
bool m_changed;
bool m_findmore;
};
#endif // _LIFE_GAME_H_
|
/*
* Broadcom Ethernettype protocol definitions
*
* $Copyright Open Broadcom Corporation$
*
* $Id: bcmeth.h 277737 2011-08-16 17:54:59Z $
*/
/*
* Broadcom Ethernet protocol defines
*/
#ifndef _BCMETH_H_
#define _BCMETH_H_
#ifndef _TYPEDEFS_H_
#include <typedefs.h>
#endif
/* This marks the start of a packed structure section. */
#include <packed_section_start.h>
/* ETHER_TYPE_BRCM is defined in ethernet.h */
/*
* Following the 2byte BRCM ether_type is a 16bit BRCM subtype field
* in one of two formats: (only subtypes 32768-65535 are in use now)
*
* subtypes 0-32767:
* 8 bit subtype (0-127)
* 8 bit length in bytes (0-255)
*
* subtypes 32768-65535:
* 16 bit big-endian subtype
* 16 bit big-endian length in bytes (0-65535)
*
* length is the number of additional bytes beyond the 4 or 6 byte header
*
* Reserved values:
* 0 reserved
* 5-15 reserved for iLine protocol assignments
* 17-126 reserved, assignable
* 127 reserved
* 32768 reserved
* 32769-65534 reserved, assignable
* 65535 reserved
*/
/*
* While adding the subtypes and their specific processing code make sure
* bcmeth_bcm_hdr_t is the first data structure in the user specific data structure definition
*/
#define BCMILCP_SUBTYPE_RATE 1
#define BCMILCP_SUBTYPE_LINK 2
#define BCMILCP_SUBTYPE_CSA 3
#define BCMILCP_SUBTYPE_LARQ 4
#define BCMILCP_SUBTYPE_VENDOR 5
#define BCMILCP_SUBTYPE_FLH 17
#define BCMILCP_SUBTYPE_VENDOR_LONG 32769
#define BCMILCP_SUBTYPE_CERT 32770
#define BCMILCP_SUBTYPE_SES 32771
#define BCMILCP_BCM_SUBTYPE_RESERVED 0
#define BCMILCP_BCM_SUBTYPE_EVENT 1
#define BCMILCP_BCM_SUBTYPE_SES 2
/*
* The EAPOL type is not used anymore. Instead EAPOL messages are now embedded
* within BCMILCP_BCM_SUBTYPE_EVENT type messages
*/
/* #define BCMILCP_BCM_SUBTYPE_EAPOL 3 */
#define BCMILCP_BCM_SUBTYPE_DPT 4
#define BCMILCP_BCM_SUBTYPEHDR_MINLENGTH 8
#define BCMILCP_BCM_SUBTYPEHDR_VERSION 0
/* These fields are stored in network order */
typedef BWL_PRE_PACKED_STRUCT struct bcmeth_hdr
{
uint16 subtype; /* Vendor specific..32769 */
uint16 length;
uint8 version; /* Version is 0 */
uint8 oui[3]; /* Broadcom OUI */
/* user specific Data */
uint16 usr_subtype;
} BWL_POST_PACKED_STRUCT bcmeth_hdr_t;
/* This marks the end of a packed structure section. */
#include <packed_section_end.h>
#endif /* _BCMETH_H_ */
|
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "conf-parser.h"
typedef enum HandleAction {
HANDLE_IGNORE,
HANDLE_POWEROFF,
HANDLE_REBOOT,
HANDLE_HALT,
HANDLE_KEXEC,
HANDLE_SUSPEND,
HANDLE_HIBERNATE,
HANDLE_HYBRID_SLEEP,
HANDLE_SUSPEND_THEN_HIBERNATE,
HANDLE_LOCK,
HANDLE_FACTORY_RESET,
_HANDLE_ACTION_MAX,
_HANDLE_ACTION_INVALID = -EINVAL,
} HandleAction;
#include "logind-inhibit.h"
#include "logind.h"
int manager_handle_action(
Manager *m,
InhibitWhat inhibit_key,
HandleAction handle,
bool ignore_inhibited,
bool is_edge);
const char* handle_action_to_string(HandleAction h) _const_;
HandleAction handle_action_from_string(const char *s) _pure_;
const char* manager_target_for_action(HandleAction handle);
CONFIG_PARSER_PROTOTYPE(config_parse_handle_action);
|
/* ============================================================
*
* This file is a part of kipi-plugins project
* http://www.digikam.org
*
* Date : 2011-09-01
* Description : a plugin to create photo layouts by fusion of several images.
* Acknowledge : based on the expoblending plugin
*
* Copyright (C) 2011 by Łukasz Spas <lukasz dot spas at gmail dot com>
* Copyright (C) 2009-2011 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation;
* either version 2, 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.
*
* ============================================================ */
#ifndef PATTERNSCOMBOBOX_H
#define PATTERNSCOMBOBOX_H
#include <QComboBox>
namespace KIPIPhotoLayoutsEditor
{
class PatternsComboBox : public QComboBox
{
Q_OBJECT
public:
explicit PatternsComboBox(QWidget * parent = 0);
Qt::BrushStyle pattern() const;
void setPattern(Qt::BrushStyle pattern);
signals:
void currentPatternChanged(Qt::BrushStyle pattern);
protected:
virtual void paintEvent(QPaintEvent *e);
protected slots:
void emitPatternChanged(int index);
};
}
#endif // PATTERNSCOMBOBOX_H
|
/** @file
ACPI debug port table definition, defined at
Microsoft DebugPortSpecification.
Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _DEBUG_PORT_TABLE_H_
#define _DEBUG_PORT_TABLE_H_
#include <IndustryStandard/Acpi.h>
//
// Ensure proper structure formats
//
#pragma pack(1)
//
// Debug Port Table definition.
//
typedef struct {
EFI_ACPI_DESCRIPTION_HEADER Header;
UINT8 InterfaceType;
UINT8 Reserved_37[3];
EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE BaseAddress;
} EFI_ACPI_DEBUG_PORT_DESCRIPTION_TABLE;
#pragma pack()
//
// DBGP Revision (defined in spec)
//
#define EFI_ACPI_DEBUG_PORT_TABLE_REVISION 0x01
//
// Interface Type
//
#define EFI_ACPI_DBGP_INTERFACE_TYPE_FULL_16550 0
#define EFI_ACPI_DBGP_INTERFACE_TYPE_16550_SUBSET_COMPATIBLE_WITH_MS_DBGP_SPEC 1
#endif
|
/*
* spp_ftptelnet.h
*
* Copyright (C) 2004 Sourcefire,Inc
* Steven A. Sturges <ssturges@sourcefire.com>
* Daniel J. Roelker <droelker@sourcefire.com>
* Marc A. Norton <mnorton@sourcefire.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Description:
*
* This file defines the publicly available functions for the FTPTelnet
* functionality for Snort.
*
* NOTES:
* - 16.09.04: Initial Development. SAS
*
*/
#ifndef __SPP_FTPTELNET_H__
#define __SPP_FTPTELNET_H__
void SetupFTPTelnet();
#endif
|
///////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 1999 Microsoft Corporation. All Rights Reserved.
//
// File: d3dx.h
// Content: D3DX utility library
//
///////////////////////////////////////////////////////////////////////////
#ifndef __D3DX_H__
#define __D3DX_H__
#ifndef D3DXINLINE
#ifdef __cplusplus
#define D3DXINLINE inline
#else
#define D3DXINLINE _inline
#endif
#endif
#include "d3dxcore.h"
#include "d3dxmath.h"
#include "d3dxshapes.h"
#include "d3dxsprite.h"
#endif //__D3DX_H__
|
#ifndef _X86_64_PGALLOC_H
#define _X86_64_PGALLOC_H
#include <asm/fixmap.h>
#include <asm/pda.h>
#include <linux/threads.h>
#include <linux/mm.h>
#define arch_add_exec_range(mm, limit) \
do { (void)(mm), (void)(limit); } while (0)
#define arch_flush_exec_range(mm) \
do { (void)(mm); } while (0)
#define arch_remove_exec_range(mm, limit) \
do { (void)(mm), (void)(limit); } while (0)
#define pmd_populate_kernel(mm, pmd, pte) \
set_pmd(pmd, __pmd(_PAGE_TABLE | __pa(pte)))
#define pud_populate(mm, pud, pmd) \
set_pud(pud, __pud(_PAGE_TABLE | __pa(pmd)))
#define pgd_populate(mm, pgd, pud) \
set_pgd(pgd, __pgd(_PAGE_TABLE | __pa(pud)))
static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *pte)
{
set_pmd(pmd, __pmd(_PAGE_TABLE | (page_to_pfn(pte) << PAGE_SHIFT)));
}
static inline pmd_t *get_pmd(void)
{
return (pmd_t *)get_zeroed_page(GFP_KERNEL);
}
static inline void pmd_free(pmd_t *pmd)
{
BUG_ON((unsigned long)pmd & (PAGE_SIZE-1));
free_page((unsigned long)pmd);
}
static inline pmd_t *pmd_alloc_one (struct mm_struct *mm, unsigned long addr)
{
return (pmd_t *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT);
}
static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr)
{
return (pud_t *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT);
}
static inline void pud_free (pud_t *pud)
{
BUG_ON((unsigned long)pud & (PAGE_SIZE-1));
free_page((unsigned long)pud);
}
static inline void pgd_list_add(pgd_t *pgd)
{
struct page *page = virt_to_page(pgd);
spin_lock(&pgd_lock);
page->index = (pgoff_t)pgd_list;
if (pgd_list)
pgd_list->private = (unsigned long)&page->index;
pgd_list = page;
page->private = (unsigned long)&pgd_list;
spin_unlock(&pgd_lock);
}
static inline void pgd_list_del(pgd_t *pgd)
{
struct page *next, **pprev, *page = virt_to_page(pgd);
spin_lock(&pgd_lock);
next = (struct page *)page->index;
pprev = (struct page **)page->private;
*pprev = next;
if (next)
next->private = (unsigned long)pprev;
spin_unlock(&pgd_lock);
}
static inline pgd_t *pgd_alloc(struct mm_struct *mm)
{
unsigned boundary;
pgd_t *pgd = (pgd_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT);
if (!pgd)
return NULL;
pgd_list_add(pgd);
/*
* Copy kernel pointers in from init.
* Could keep a freelist or slab cache of those because the kernel
* part never changes.
*/
boundary = pgd_index(__PAGE_OFFSET);
memset(pgd, 0, boundary * sizeof(pgd_t));
memcpy(pgd + boundary,
init_level4_pgt + boundary,
(PTRS_PER_PGD - boundary) * sizeof(pgd_t));
return pgd;
}
static inline void pgd_free(pgd_t *pgd)
{
BUG_ON((unsigned long)pgd & (PAGE_SIZE-1));
pgd_list_del(pgd);
free_page((unsigned long)pgd);
}
static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
{
return (pte_t *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT);
}
static inline struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address)
{
void *p = (void *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT);
if (!p)
return NULL;
return virt_to_page(p);
}
/* Should really implement gc for free page table pages. This could be
done with a reference count in struct page. */
static inline void pte_free_kernel(pte_t *pte)
{
BUG_ON((unsigned long)pte & (PAGE_SIZE-1));
free_page((unsigned long)pte);
}
static inline void pte_free(struct page *pte)
{
__free_page(pte);
}
#define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte))
#define __pmd_free_tlb(tlb,x) tlb_remove_page((tlb),virt_to_page(x))
#define __pud_free_tlb(tlb,x) tlb_remove_page((tlb),virt_to_page(x))
#endif /* _X86_64_PGALLOC_H */
|
/*
* emv-tools - a set of tools to work with EMV family of smart cards
* Copyright (C) 2012, 2015 Dmitry Eremin-Solenikov
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*/
#include <stdbool.h>
extern int exec_dda_test(bool verbose);
|
/*
* mmu_fault.h
*
* DSP-BIOS Bridge driver support functions for TI OMAP processors.
*
* Defines DSP MMU fault handling functions.
*
* Copyright (C) 2005-2006 Texas Instruments, Inc.
*
* This package is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef MMU_FAULT_
#define MMU_FAULT_
/*
* ======== MMU_FaultDpc ========
* Deferred procedure call to handle DSP MMU fault.
*/
void MMU_FaultDpc(IN unsigned long pRefData);
/*
* ======== MMU_FaultIsr ========
* ISR to be triggered by a DSP MMU fault interrupt.
*/
irqreturn_t MMU_FaultIsr(int irq, IN void *pRefData);
#endif /* MMU_FAULT_ */
|
/**
* This confidential and proprietary software may be used only as
* authorised by a licensing agreement from ARM Limited
* (C) COPYRIGHT 2010-2014 ARM Limited
* ALL RIGHTS RESERVED
* The entire notice above must be reproduced on all authorised
* copies and copies may only be made to the extent permitted
* by a licensing agreement from ARM Limited.
*/
/**
* @file mali_device_pause_resume.c
* Implementation of the Mali pause/resume functionality
*/
#include <linux/module.h>
#include <linux/mali/mali_utgard.h>
#include "mali_pm.h"
void mali_dev_pause(void)
{
/*
* Deactive all groups to prevent hardware being touched
* during the period of mali device pausing
*/
mali_pm_os_suspend(MALI_FALSE);
}
EXPORT_SYMBOL(mali_dev_pause);
void mali_dev_resume(void)
{
mali_pm_os_resume();
}
EXPORT_SYMBOL(mali_dev_resume);
|
/*p64encoder.h copyright (c)Indranet Technologies ltd (lara@indranet.co.nz)
* Author Derek J Smithies (derek@indranet.co.nz)
*
*
* This file defines the p64encoder class, which is the combined total of
* the grabber, pre encoder, and encoder classes.
*/
/************ Change log
*
* $Log: p64encoder.h,v $
* Revision 1.18 2003/04/03 23:54:15 robertj
* Added fast update to H.261 codec, thanks Gustavo García Bernardo
*
* Revision 1.17 2002/04/05 00:53:19 dereks
* Modify video frame encoding so that frame is encoded on an incremental basis.
* Thanks to Walter Whitlock - good work.
*
* Revision 1.16 2002/01/04 02:48:05 dereks
* Fix previous commit so it compiles OK.
*
* Revision 1.15 2002/01/03 23:05:50 dereks
* Add methods to count number of H261 packets waiting to be sent.
*
* Revision 1.14 2001/12/04 04:26:06 robertj
* Added code to allow change of video quality in H.261, thanks Damian Sandras
*
* Revision 1.13 2001/09/25 03:14:48 dereks
* Add constant bitrate control for the h261 video codec.
* Thanks Tiziano Morganti for the code to set bit rate. Good work!
*
* Revision 1.12 2001/05/10 05:25:44 robertj
* Removed need for VIC code to use ptlib.
*
* Revision 1.11 2001/03/19 01:41:33 robertj
* Removed last vestiges of old grabber code.
*
* Revision 1.10 2000/12/19 22:22:34 dereks
* Remove connection to grabber-OS.cxx files. grabber-OS.cxx files no longer used.
* Video data is now read from a video channel, using the pwlib classes.
*
* Revision 1.9 2000/10/13 01:47:27 dereks
* Include command option for setting the number of transmitted video
* frames per second. use --videotxfps n
*
* Revision 1.8 2000/09/08 06:41:38 craigs
* Added ability to set video device
* Added ability to select test input frames
*
* Revision 1.7 2000/08/25 03:18:50 dereks
* Add change log facility (Thanks Robert for the info on implementation)
*
*
*
********/
#ifndef lib_p64encoder_h
#define lib_p64encoder_h
#include "config.h"
#include "p64.h"
#include "vid_coder.h"
#include "videoframe.h"
#include "encoder-h261.h"
#include "transmitter.h"
#define WIDTH 352
#define HEIGHT 288
class P64Encoder{
public:
/** Constructor for using a grabber. The grabber may elect to read data from a
hardware device, or from data in memory, Data in memory is placed there by
programs such as openmcu.
*/
P64Encoder(int quant_level,int idle);
~P64Encoder();
/** Set the quantization level (or quality level) in the h261 encoder class.
Has a value of 1 (good quality) to 31 (poor quality).
Quality is improved at the expense of bit rate.
*/
void SetQualityLevel(int qLevel);
/** Set the number of blocks in the background that need
to be transmitted with each frame
*/
void SetBackgroundFill(int idle);
/** Set size of the grabbing window, which sets the
size of the vid_frame class. When the vid_frame class
is passed to grabber and encoder, the grabber and
encoder automatically resize
*/
void SetSize(int width,int height);
/** Called by the display routine, so we can display
local video using the grabbed 411 format stuff.
Returns the address of the grabbed 411 format frame.
*/
u_char* GetFramePtr();
// /** Grabs one video frame,
// or generates test pattern if grabber is not operational
// */
// void GrabOneFrame();
/** On a previously grabbed frame,
1)do some motion and block changed checking,
2)h261 format conversion and
3)store result in a series of packets in a list
in the transmitter class.
*/
void ProcessOneFrame();
/** Retrieves the first packet in the list recorded in
in the transmitter class
*/
void ReadOnePacket(
u_char * buffer, // Buffer of encoded data
unsigned & length // Actual length of encoded data buffer
);
/** Pre-process one video frame for later incremental encoding
same as ProcessOneFrame() except that no encoding is done
*/
void PreProcessOneFrame();
/** Incrementally encodes and retrieves one packet
Must call PreProcesOneFrame() first, then call IncEncodeAndGetPacket()
the same way as ReadOnePacket() is called
*/
void IncEncodeAndGetPacket(
u_char * buffer, // Buffer of encoded data
unsigned & length // Actual length of encoded data buffer
);
/** Return true if there are packets waiting to be transmitted. These
packets were created at the last invocation of the video codec.
*/
int PacketsOutStanding()
{ return trans->PacketsOutStanding(); }
/** When incrementally encoding, return true if there is still
more encoding waiting to be done for the current video frame.
*/
int MoreToIncEncode()
{ return h261_edr->MoreToIncEncode(); }
/** Return the count of packets waiting to be transmitted. These
packets were created at the last invocation of the video codec.
*/
int GetCountPacketsOutStanding()
{ return trans->GetCountPacketsOutStanding();}
void FastUpdatePicture();
protected:
//variables used in grabbing/processing the image.
Transmitter *trans;
H261PixelEncoder *h261_edr;
VideoFrame *vid_frame;
Pre_Vid_Coder *pre_vid;
VideoFrame *vid_frame2; // for testing
Pre_Vid_Coder *pre_vid2; // for testing
};
#endif //#ifndef lib_p64encoder_h
|
/*****************************************************************************
*
* PROJECT: Multi Theft Auto v1.0
* (Shared logic for modifications)
* LICENSE: See LICENSE in the top level directory
* FILE: mods/shared_logic/CClientTask.h
* PURPOSE: Task class header
*
*****************************************************************************/
#pragma once
#include <list>
#include "lua/LuaCommon.h"
#include "CClientEntity.h"
class CClientEntity;
class CClientManager;
class CClientPed;
class CElementArray;
class CLuaArgument;
class CPed;
class CTask;
class CVehicle;
class CClientTask
{
public:
CClientTask(CClientManager* pManager);
bool Read(lua_State* luaVM, int iTableIndex, bool bClear);
bool ReadElements(lua_State* luaVM, int iTableIndex, bool bClear);
bool ReadParameters(lua_State* luaVM, int iTableIndex, bool bClear);
bool Write(lua_State* luaVM, int iTableIndex);
bool WriteElements(lua_State* luaVM, int iTableIndex);
bool WriteParameters(lua_State* luaVM, int iTableIndex);
const char* GetTaskName() { return m_strTaskName.c_str(); };
void SetTaskName(const char* szName) { m_strTaskName = szName ? szName : ""; };
static unsigned long GenerateUniqueIdentifier();
unsigned long GetUniqueIdentifier() { return m_ulUniqueIdentifier; };
void SetUniqueIdentifier(unsigned long ulID) { m_ulUniqueIdentifier = ulID; };
void AddElement(CClientEntity* pElement);
void RemoveElement(CClientEntity* pElement);
void ClearElements();
bool IsElementIn(CClientEntity* pElement);
const std::list<ElementID>& GetElements() { return m_Elements; };
const std::list<std::string>& GetKeys() { return m_Keys; };
const std::list<CLuaArgument>& GetValues() { return m_Values; };
void SetParameter(const char* szKey, const CLuaArgument& Value);
void SetParameters(const std::list<std::string>& Keys, const std::list<CLuaArgument>& Values);
void ClearParameters();
CLuaArgument* GetParameter(const char* szKey);
bool GetParameterBool(const char* szKey, bool& Bool);
bool GetParameterNumber(const char* szKey, float& Number);
CPed* GetParameterPed(const char* szKey);
const char* GetParameterString(const char* szKey);
CVehicle* GetParameterVehicle(const char* szKey);
bool ApplyTask(CClientPed& Ped);
private:
CTask* CreateTask(bool& bTaskPrimary, int& iTaskPriority);
CClientManager* m_pManager;
std::string m_strTaskName;
unsigned long m_ulUniqueIdentifier;
std::list<ElementID> m_Elements;
std::list<std::string> m_Keys;
std::list<CLuaArgument> m_Values;
static unsigned long m_ulLastUniqueIdentifier;
};
|
/**
* \file
*
* \brief Assembler abstraction layer: GNU Assembler specifics
*
* Copyright (c) 2009-2012 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name of Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* \asf_license_stop
*
*/
#ifndef ASSEMBLER_GAS_H_INCLUDED
#define ASSEMBLER_GAS_H_INCLUDED
#ifndef __DOXYGEN__
/* IAR doesn't accept dots in macro names */
.macro ld_addr, reg, sym
lda.w \reg, \sym
.endm
/* Define a function \a name that is either globally visible or only
* file-local.
*/
.macro gas_begin_func name, is_public
.if \is_public
.global \name
.endif
.section .text.\name, "ax", @progbits
.type \name, @function
\name :
.endm
/* Define a function \a name that is either globally visible or only
* file-local in a given segment.
*/
.macro gas_begin_func_segm name, is_public, segment
.if \is_public
.global \name
.endif
.section .\segment, "ax", @progbits
.type \name, @function
\name :
.endm
/* Define \a name as a weak alias for the function \a strong_name */
.macro gas_weak_function_alias name, strong_name
.global \name
.weak \name
.type \name, @function
.set \name, \strong_name
.endm
/* Define a weak function called \a name */
.macro gas_weak_function name
.weak \name
gas_begin_func \name 1
.endm
#define REPEAT(count) .rept count
#define END_REPEAT() .endr
#define FILL_BYTES(count) .fill count
#define SET_LOC(offset) .org offset
#define L(name) .L##name
#define EXTERN_SYMBOL(name)
#define TEXT_SECTION(name) \
.section name, "ax", @progbits
#define RODATA_SECTION(name) \
.section name, "a", @progbits
#define DATA_SECTION(name) \
.section name, "aw", @progbits
#define BSS_SECTION(name) \
.section name, "aw", @nobits
#define FUNCTION(name) gas_begin_func name 0
#define PUBLIC_FUNCTION(name) gas_begin_func name 1
#define PUBLIC_FUNCTION_SEGMENT(name, segment) \
gas_begin_func_segm name 1 segment
#define WEAK_FUNCTION(name) gas_weak_function name
#define WEAK_FUNCTION_ALIAS(name, strong_name) \
gas_weak_function_alias name strong_name
#define END_FUNC(name) \
.size name, . - name
#define END_FILE()
#endif /* __DOXYGEN__ */
#endif /* ASSEMBLER_GAS_H_INCLUDED */
|
/****************************************************************
* *
* Copyright 2001, 2002 Sanchez Computer Associates, Inc. *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
* under a license. If you do not know the terms of *
* the license, please stop and do not read further. *
* *
****************************************************************/
/* Per Compaq C 6.2 Library reference guide this define is needed for
VMS kill() function to operate the same as Unix version on VMS 7.0
and later.
*/
#ifdef VMS
# define _POSIX_EXIT
#endif
#include "mdef.h"
#include <sys/types.h>
#include <errno.h>
#include <signal.h>
#include <stdlib.h>
#include "mvalconv.h"
#include "op.h"
void op_fnzsigproc(int pid, int signum, mval *retcode)
{
int rc;
if (-1 == kill(pid, signum))
rc = errno;
else
rc = 0;
MV_FORCE_MVAL(retcode, rc);
return;
}
|
//===-- cmpti2_test.c - Test __cmpti2 -------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file tests __cmpti2 for the compiler_rt library.
//
//===----------------------------------------------------------------------===//
#if __x86_64
#include "int_lib.h"
#include <stdio.h>
// Returns: if (a < b) returns 0
// if (a == b) returns 1
// if (a > b) returns 2
si_int __cmpti2(ti_int a, ti_int b);
int test__cmpti2(ti_int a, ti_int b, si_int expected)
{
si_int x = __cmpti2(a, b);
if (x != expected)
{
twords at;
at.all = a;
twords bt;
bt.all = b;
printf("error in __cmpti2(0x%llX%.16llX, 0x%llX%.16llX) = %d, expected %d\n",
at.s.high, at.s.low, bt.s.high, bt.s.low, x, expected);
}
return x != expected;
}
char assumption_1[sizeof(ti_int) == 2*sizeof(di_int)] = {0};
#endif
int main()
{
#if __x86_64
if (test__cmpti2(0, 0, 1))
return 1;
if (test__cmpti2(1, 1, 1))
return 1;
if (test__cmpti2(2, 2, 1))
return 1;
if (test__cmpti2(0x7FFFFFFF, 0x7FFFFFFF, 1))
return 1;
if (test__cmpti2(0x80000000, 0x80000000, 1))
return 1;
if (test__cmpti2(0x80000001, 0x80000001, 1))
return 1;
if (test__cmpti2(0xFFFFFFFF, 0xFFFFFFFF, 1))
return 1;
if (test__cmpti2(0x000000010000000LL, 0x000000010000000LL, 1))
return 1;
if (test__cmpti2(0xFFFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFFLL, 1))
return 1;
if (test__cmpti2(0x0000000200000002LL, 0x0000000300000001LL, 0))
return 1;
if (test__cmpti2(0x0000000200000002LL, 0x0000000300000002LL, 0))
return 1;
if (test__cmpti2(0x0000000200000002LL, 0x0000000300000003LL, 0))
return 1;
if (test__cmpti2(0x0000000200000002LL, 0x0000000100000001LL, 2))
return 1;
if (test__cmpti2(0x0000000200000002LL, 0x0000000100000002LL, 2))
return 1;
if (test__cmpti2(0x0000000200000002LL, 0x0000000100000003LL, 2))
return 1;
if (test__cmpti2(0x0000000200000002LL, 0x0000000200000001LL, 2))
return 1;
if (test__cmpti2(0x0000000200000002LL, 0x0000000200000002LL, 1))
return 1;
if (test__cmpti2(0x0000000200000002LL, 0x0000000200000003LL, 0))
return 1;
if (test__cmpti2(make_ti(2, 2), make_ti(3, 1), 0))
return 1;
if (test__cmpti2(make_ti(2, 2), make_ti(3, 2), 0))
return 1;
if (test__cmpti2(make_ti(2, 2), make_ti(3, 3), 0))
return 1;
if (test__cmpti2(make_ti(2, 2), make_ti(1, 1), 2))
return 1;
if (test__cmpti2(make_ti(2, 2), make_ti(1, 2), 2))
return 1;
if (test__cmpti2(make_ti(2, 2), make_ti(1, 3), 2))
return 1;
if (test__cmpti2(make_ti(2, 2), make_ti(2, 1), 2))
return 1;
if (test__cmpti2(make_ti(2, 2), make_ti(2, 2), 1))
return 1;
if (test__cmpti2(make_ti(2, 2), make_ti(2, 3), 0))
return 1;
#else
printf("skipped\n");
#endif
return 0;
}
|
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2017 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/
#ifndef INSPECTORCLIENT_H_
#define INSPECTORCLIENT_H_
#include <v8.h>
#include <v8-inspector.h>
#include "KrollBindings.h"
namespace titanium {
class InspectorClient : public v8_inspector::V8InspectorClient
{
public:
InspectorClient(v8::Local<v8::Context>, v8::Platform*);
/**
* Connects to the v8 inspector API and generates a session_
*/
void connect();
/**
* Disconnects the session_
*/
void disconnect();
/**
* Forwards a message down to the v8 inspector API. Response comes back synch in same thread via InspectorFrontend
* @param message The inspector protocol message to send down to the API
*/
void sendMessage(const v8_inspector::StringView&);
/**
* Called via JSDebugger::debugBreak, from CallAndPauseOnStart
* Used to break at beginning of app.js when debugging is on.
*/
void BreakAtStart();
/**
* Callback to initialize JS binding. This is where we hang
* "callAndPauseOnStart" to expose to JS code in module.js
* @param target Target object (module.exports) to hang API off of.
* @param context current JS context
*/
static void Initialize(v8::Local<v8::Object>, v8::Local<v8::Context>);
private:
static const int kContextGroupId = 1;
const int kInspectorClientIndex = v8::Context::kDebugIdIndex + 1;
void runMessageLoopOnPause(int context_group_id) override;
void quitMessageLoopOnPause() override;
static void CallAndPauseOnStart(const v8::FunctionCallbackInfo<v8::Value>& args);
/**
* The native binding entry for the API. Bound as 'inspector'. See module.js
*/
static titanium::bindings::BindEntry bind_entry;
std::unique_ptr<v8_inspector::V8Inspector> inspector_;
std::unique_ptr<v8_inspector::V8InspectorSession> session_;
std::unique_ptr<v8_inspector::V8Inspector::Channel> channel_;
v8::Isolate* isolate_;
v8::Platform* platform_;
bool terminated_;
bool running_nested_loop_;
};
} // namespace titanium
#endif /* INSPECTORCLIENT_H_ */
|
/*
* Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
*/
#ifndef SRC_BGP_BGP_CONDITION_LISTENER_H_
#define SRC_BGP_BGP_CONDITION_LISTENER_H_
#include <boost/intrusive_ptr.hpp>
#include <tbb/mutex.h>
#include <map>
#include <set>
#include "base/task_trigger.h"
#include "bgp/bgp_table.h"
#include "bgp/bgp_route.h"
#include "db/db_table_partition.h"
//
// ConditionMatch
// Base class for ConditionMatch
// Provides interface to match a implementation specific match condition and
// action function
//
class ConditionMatch {
public:
ConditionMatch() : deleted_(false), num_matchstate_(0) {
refcount_ = 0;
}
virtual ~ConditionMatch() {
}
// Performs the Match and action function.
// Runs in the db::DBTable task context
// Actual action can be performed in different task context
// Concurrency: DB:DBTable task either from DB Notification context or
// from DB Walk context
virtual bool Match(BgpServer *server, BgpTable *table,
BgpRoute *route, bool deleted) = 0;
virtual std::string ToString() const = 0;
bool deleted() {
return deleted_;
}
void IncrementNumMatchstate() {
tbb::mutex::scoped_lock lock(mutex_);
num_matchstate_++;
}
void DecrementNumMatchstate() {
assert(num_matchstate_);
num_matchstate_--;
}
uint32_t num_matchstate() const {
return num_matchstate_;
}
private:
friend class BgpConditionListener;
friend void intrusive_ptr_add_ref(ConditionMatch *match);
friend void intrusive_ptr_release(ConditionMatch *match);
void SetDeleted() {
deleted_ = true;
}
bool deleted_;
tbb::mutex mutex_;
uint32_t num_matchstate_;
tbb::atomic<int> refcount_;
};
inline void intrusive_ptr_add_ref(ConditionMatch *match) {
match->refcount_.fetch_and_increment();
}
inline void intrusive_ptr_release(ConditionMatch *match) {
int prev = match->refcount_.fetch_and_decrement();
if (prev == 1) {
delete match;
}
}
//
// Intrusive Pointer for life time management of Condition Match object
//
typedef boost::intrusive_ptr<ConditionMatch> ConditionMatchPtr;
//
// ConditionMatchState
// Base class for meta data that Condition Match adds against BgpRoute
//
class ConditionMatchState {
public:
ConditionMatchState() : refcount_(0), deleted_(false) {
}
virtual ~ConditionMatchState() {
}
uint32_t refcnt() const {
return refcount_;
}
void IncrementRefCnt() {
refcount_++;
}
void set_deleted() {
deleted_ = true;
}
void reset_deleted() {
deleted_ = false;
}
bool deleted() const {
return deleted_;
}
void DecrementRefCnt() {
assert(refcount_);
refcount_--;
}
private:
uint32_t refcount_;
bool deleted_;
};
//
// Helper classes
//
//
// Store the state managed by BgpConditionListener against each table
// it is registered
//
class ConditionMatchTableState;
//
// Store the Walk request and current walk state for each BgpTable with active
// Walk request
//
class WalkRequest;
//
// BgpConditionListener
// Provides a generic interface to match a condition and call action function
// Application module registers with this module with ConditionMatch class
// to start applying the match condition on all BgpRoutes
// Provides an interface to add/remove module specific data on each BgpRoute
//
class BgpConditionListener {
public:
typedef std::map<BgpTable *, ConditionMatchTableState *> TableMap;
typedef std::map<BgpTable *, WalkRequest *> WalkRequestMap;
// Called upon completion of Add or Delete operations
typedef boost::function<void(BgpTable *, ConditionMatch *)> RequestDoneCb;
explicit BgpConditionListener(BgpServer *server);
// Add a new match condition
// All subsequent DB Table notification matches this condition
// DB Table is walked to match this condition for existing entries
void AddMatchCondition(BgpTable *table, ConditionMatch *obj,
RequestDoneCb addDoneCb);
// Delete a match condition
// DB table should be walked to match this deleting condition and
// revert the action taken on previous match
// DeleteDone callback indicates the calling application about Remove
// completion. Application should call UnregisterCondition to
// remove the ConditionMatch object from the table
void RemoveMatchCondition(BgpTable *table, ConditionMatch *obj,
RequestDoneCb deleteDonecb);
// Return the meta-data added by the module requested for Match
ConditionMatchState *GetMatchState(BgpTable *table, BgpRoute *route,
ConditionMatch *obj);
// Set the module specific meta-data after the match/action
void SetMatchState(BgpTable *table, BgpRoute *route,
ConditionMatch *obj,
ConditionMatchState *state);
// Clear the module specific DBState
void RemoveMatchState(BgpTable *table, BgpRoute *route,
ConditionMatch *obj);
// API to remove condition object from the table
void UnregisterCondition(BgpTable *table, ConditionMatch *obj);
BgpServer *server() {
return server_;
}
private:
BgpServer *server_;
TableMap map_;
WalkRequestMap walk_map_;
// Table listener
bool BgpRouteNotify(BgpServer *server, DBTablePartBase *root,
DBEntryBase *entry);
void TableWalk(BgpTable *table, ConditionMatch *obj, RequestDoneCb cb);
bool StartWalk();
// WalkComplete function
void WalkDone(DBTableBase *table);
boost::scoped_ptr<TaskTrigger> walk_trigger_;
DISALLOW_COPY_AND_ASSIGN(BgpConditionListener);
};
#endif // SRC_BGP_BGP_CONDITION_LISTENER_H_
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_SIGNIN_SIGNIN_UTIL_H_
#define IOS_CHROME_BROWSER_SIGNIN_SIGNIN_UTIL_H_
#import <UIKit/UIKit.h>
#include <set>
#include <string>
#include "ios/chrome/browser/signin/constants.h"
@class ChromeIdentity;
namespace signin {
enum class Tribool;
} // namespace signin
// Returns an NSArray of |scopes| as NSStrings.
NSArray* GetScopeArray(const std::set<std::string>& scopes);
// Returns whether the given signin |error| should be handled.
//
// Note that cancel errors and errors handled internally by the signin component
// should not be handled.
bool ShouldHandleSigninError(NSError* error);
// Returns CGSize based on |IdentityAvatarSize|.
CGSize GetSizeForIdentityAvatarSize(IdentityAvatarSize avatar_size);
// Returns whether Chrome has been started after a device restore. This method
// needs to be called for the first time before IO is disallowed on UI thread.
// The value is cached. The result is cached for later calls.
signin::Tribool IsFirstSessionAfterDeviceRestore();
#endif // IOS_CHROME_BROWSER_SIGNIN_SIGNIN_UTIL_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 EXTENSIONS_BROWSER_MOJO_KEEP_ALIVE_IMPL_H_
#define EXTENSIONS_BROWSER_MOJO_KEEP_ALIVE_IMPL_H_
#include "base/callback.h"
#include "base/scoped_observer.h"
#include "extensions/browser/extension_registry_observer.h"
#include "extensions/common/mojo/keep_alive.mojom.h"
#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h"
#include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h"
namespace content {
class BrowserContext;
}
namespace extensions {
class Extension;
// An RAII mojo service implementation for extension keep alives. This adds a
// keep alive on construction and removes it on destruction.
class KeepAliveImpl : public KeepAlive, public ExtensionRegistryObserver {
public:
// Create a keep alive for |extension| running in |context| and connect it to
// |request|. When the requester closes its pipe, the keep alive ends.
static void Create(content::BrowserContext* context,
const Extension* extension,
mojo::InterfaceRequest<KeepAlive> request);
private:
KeepAliveImpl(content::BrowserContext* context,
const Extension* extension,
mojo::InterfaceRequest<KeepAlive> request);
~KeepAliveImpl() override;
// ExtensionRegistryObserver overrides.
void OnExtensionUnloaded(content::BrowserContext* browser_context,
const Extension* extension,
UnloadedExtensionInfo::Reason reason) override;
void OnShutdown(ExtensionRegistry* registry) override;
// Invoked when the mojo connection is disconnected.
void OnDisconnected();
content::BrowserContext* context_;
const Extension* extension_;
ScopedObserver<ExtensionRegistry, KeepAliveImpl> extension_registry_observer_;
mojo::StrongBinding<KeepAlive> binding_;
DISALLOW_COPY_AND_ASSIGN(KeepAliveImpl);
};
} // namespace extensions
#endif // EXTENSIONS_BROWSER_MOJO_KEEP_ALIVE_IMPL_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_UI_ASH_CAPS_LOCK_HANDLER_H_
#define CHROME_BROWSER_UI_ASH_CAPS_LOCK_HANDLER_H_
#include "ash/caps_lock_delegate.h"
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/system_key_event_listener.h"
namespace chromeos {
namespace input_method {
class XKeyboard;
} // namespace input_method
} // namespace chromeos
#endif
// A class which toggles Caps Lock state when the hotkey for Caps Lock
// is pressed.
class CapsLockHandler : public ash::CapsLockDelegate
#if defined(OS_CHROMEOS)
, public chromeos::SystemKeyEventListener::CapsLockObserver
#endif
{
public:
CapsLockHandler() {}
#if defined(OS_CHROMEOS)
explicit CapsLockHandler(chromeos::input_method::XKeyboard* xkeyboard);
#endif
virtual ~CapsLockHandler();
// Overridden from ash::CapsLockHandler:
virtual bool IsCapsLockEnabled() const OVERRIDE;
virtual void SetCapsLockEnabled(bool enabled) OVERRIDE;
virtual void ToggleCapsLock() OVERRIDE;
#if defined(OS_CHROMEOS)
// Overridden from chromeos::SystemKeyEventListener::CapsLockObserver:
virtual void OnCapsLockChange(bool enabled) OVERRIDE;
void set_is_running_on_chromeos_for_test(bool is_running_on_chromeos) {
is_running_on_chromeos_ = is_running_on_chromeos;
}
bool caps_lock_is_on_for_test() const {
return caps_lock_is_on_;
}
private:
chromeos::input_method::XKeyboard* xkeyboard_;
bool is_running_on_chromeos_;
bool caps_lock_is_on_;
#endif
private:
DISALLOW_COPY_AND_ASSIGN(CapsLockHandler);
};
#endif // CHROME_BROWSER_UI_ASH_CAPS_LOCK_HANDLER_H_
|
#pragma once
#include "types.h"
#include "attributes.h"
#include "css_length.h"
#include "css_position.h"
#include "web_color.h"
#include "borders.h"
namespace litehtml
{
class background
{
public:
tstring m_image;
tstring m_baseurl;
web_color m_color;
background_attachment m_attachment;
css_position m_position;
background_repeat m_repeat;
background_box m_clip;
background_box m_origin;
css_border_radius m_radius;
public:
background(void);
background(const background& val);
~background(void);
background& operator=(const background& val);
};
class background_paint
{
public:
tstring image;
tstring baseurl;
background_attachment attachment;
background_repeat repeat;
web_color color;
position clip_box;
position origin_box;
position border_box;
border_radiuses border_radius;
size image_size;
int position_x;
int position_y;
bool is_root;
public:
background_paint();
background_paint(const background_paint& val);
void operator=(const background& val);
};
} |
// 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 COMPONENTS_HISTORY_CORE_BROWSER_VISITSEGMENT_DATABASE_H_
#define COMPONENTS_HISTORY_CORE_BROWSER_VISITSEGMENT_DATABASE_H_
#include <memory>
#include <string>
#include "base/callback_forward.h"
#include "components/history/core/browser/history_types.h"
namespace sql {
class Database;
}
namespace history {
class PageUsageData;
// Tracks pages used for the most visited view.
class VisitSegmentDatabase {
public:
// Must call InitSegmentTables before using any other part of this class.
VisitSegmentDatabase();
VisitSegmentDatabase(const VisitSegmentDatabase&) = delete;
VisitSegmentDatabase& operator=(const VisitSegmentDatabase&) = delete;
virtual ~VisitSegmentDatabase();
// Compute a segment name given a URL. The segment name is currently the
// source url spec less some information such as query strings.
static std::string ComputeSegmentName(const GURL& url);
// Returns the ID of the segment with the corresponding name, or 0 if there
// is no segment with that name.
SegmentID GetSegmentNamed(const std::string& segment_name);
// Update the segment identified by `out_segment_id` with the provided URL ID.
// The URL identifies the page that will now represent the segment. If url_id
// is non zero, it is assumed to be the row id of `url`.
bool UpdateSegmentRepresentationURL(SegmentID segment_id,
URLID url_id);
// Create a segment for the provided URL ID with the given name. Returns the
// ID of the newly created segment, or 0 on failure.
SegmentID CreateSegment(URLID url_id, const std::string& segment_name);
// Increase the segment visit count by the provided amount. Return true on
// success.
bool IncreaseSegmentVisitCount(SegmentID segment_id, base::Time ts,
int amount);
// Computes the segment usage since `from_time`. If `url_filter` is non-null,
// then only URLs for which it returns true will be included.
// Returns the highest-scored segments up to `max_result_count`.
std::vector<std::unique_ptr<PageUsageData>> QuerySegmentUsage(
base::Time from_time,
int max_result_count,
const base::RepeatingCallback<bool(const GURL&)>& url_filter);
// Delete the segment currently using the provided url for representation.
// This will also delete any associated segment usage data.
bool DeleteSegmentForURL(URLID url_id);
protected:
// Returns the database for the functions in this interface.
virtual sql::Database& GetDB() = 0;
// Creates the tables used by this class if necessary. Returns true on
// success.
bool InitSegmentTables();
// Deletes all the segment tables, returning true on success.
bool DropSegmentTables();
// Removes the 'pres_index' column from the segments table and the
// presentation table is removed entirely.
bool MigratePresentationIndex();
// Runs ComputeSegmentName() to recompute 'name'. If multiple segments have
// the same name, they are merged by:
// 1. Choosing one arbitrary `segment_id` and updating all references.
// 2. Merging duplicate `segment_usage` entries (add up visit counts).
// 3. Deleting old data for the absorbed segment.
bool MigrateVisitSegmentNames();
private:
// Updates the `name` column for a single segment. Returns true on success.
bool RenameSegment(SegmentID segment_id, const std::string& new_name);
// Merges two segments such that data is aggregated, all former references to
// `from_segment_id` are updated to `to_segment_id` and `from_segment_id` is
// deleted. Returns true on success.
bool MergeSegments(SegmentID from_segment_id, SegmentID to_segment_id);
};
} // namespace history
#endif // COMPONENTS_HISTORY_CORE_BROWSER_VISITSEGMENT_DATABASE_H_
|
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_RENDERER_SANDBOX_STATUS_EXTENSION_ANDROID_H_
#define CHROME_RENDERER_SANDBOX_STATUS_EXTENSION_ANDROID_H_
#include <memory>
#include "base/memory/ref_counted.h"
#include "base/values.h"
#include "chrome/common/sandbox_status_extension_android.mojom.h"
#include "content/public/renderer/render_frame_observer.h"
#include "mojo/public/cpp/bindings/associated_receiver.h"
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
#include "v8/include/v8.h"
namespace gin {
class Arguments;
}
// On Android, this class adds a function chrome.getAndroidSandboxStatus()
// to the chrome://sandbox/ WebUI page. This is done only after the browser
// SandboxInternalsUI sends an IPC mesage blessing this RenderFrame.
class SandboxStatusExtension
: public base::RefCountedThreadSafe<SandboxStatusExtension>,
public content::RenderFrameObserver,
public chrome::mojom::SandboxStatusExtension {
public:
// Creates a new SandboxStatusExtension for the |frame|.
static void Create(content::RenderFrame* frame);
SandboxStatusExtension(const SandboxStatusExtension&) = delete;
SandboxStatusExtension& operator=(const SandboxStatusExtension&) = delete;
// content::RenderFrameObserver:
void OnDestruct() override;
void DidClearWindowObject() override;
protected:
friend class base::RefCountedThreadSafe<SandboxStatusExtension>;
~SandboxStatusExtension() override;
private:
explicit SandboxStatusExtension(content::RenderFrame* frame);
// chrome::mojom::SandboxStatusExtension
void AddSandboxStatusExtension() override;
void OnSandboxStatusExtensionRequest(
mojo::PendingAssociatedReceiver<chrome::mojom::SandboxStatusExtension>
receiver);
// Installs the JavaScript function into the scripting context, if
// should_install_ is true.
void Install();
// Native implementation of chrome.getAndroidSandboxStatus.
void GetSandboxStatus(gin::Arguments* args);
// Called on the blocking pool, this gets the sandbox status of the current
// renderer process and returns a status object as a base::Value.
std::unique_ptr<base::Value> ReadSandboxStatus();
// Runs the callback argument provided to GetSandboxStatus() with the status
// object computed by ReadSandboxStatus(). This is called back on the thread
// on which GetSandboxStatus() was called originally.
void RunCallback(std::unique_ptr<v8::Global<v8::Function>> callback,
std::unique_ptr<base::Value> status);
// Set to true by AddSandboxStatusExtension().
bool should_install_ = false;
mojo::AssociatedReceiver<chrome::mojom::SandboxStatusExtension> receiver_{
this};
};
#endif // CHROME_RENDERER_SANDBOX_STATUS_EXTENSION_ANDROID_H_
|
/*
* Copyright (c) 2014, 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
void adb_encode(unsigned* inout_state,
char** inout_enc,
char* encend,
const char** inout_in,
const char* inend);
void adb_decode(unsigned* inout_state,
char** inout_dec,
char* decend,
const char** inout_in,
const char* inend);
size_t read_all_adb_encoded(int fd, void* buf, size_t sz);
void write_all_adb_encoded(int fd, const void* buf, size_t sz);
|
/*
* Copyright (C) the libgit2 contributors. All rights reserved.
*
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
#ifndef INCLUDE_hash_h__
#define INCLUDE_hash_h__
#include "git2/oid.h"
typedef struct git_hash_prov git_hash_prov;
typedef struct git_hash_ctx git_hash_ctx;
int git_hash_global_init(void);
void git_hash_global_shutdown(void);
int git_hash_ctx_init(git_hash_ctx *ctx);
void git_hash_ctx_cleanup(git_hash_ctx *ctx);
#if defined(OPENSSL_SHA1)
# include "hash/hash_openssl.h"
#elif defined(WIN32_SHA1)
# include "hash/hash_win32.h"
#else
# include "hash/hash_generic.h"
#endif
typedef struct {
void *data;
size_t len;
} git_buf_vec;
int git_hash_init(git_hash_ctx *c);
int git_hash_update(git_hash_ctx *c, const void *data, size_t len);
int git_hash_final(git_oid *out, git_hash_ctx *c);
int git_hash_buf(git_oid *out, const void *data, size_t len);
int git_hash_vec(git_oid *out, git_buf_vec *vec, size_t n);
#endif /* INCLUDE_hash_h__ */
|
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2015 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////
#import <Foundation/Foundation.h>
#import <Realm/RLMRealm.h>
NS_ASSUME_NONNULL_BEGIN
/**
A block called when opening a Realm for the first time during the life
of a process to determine if it should be compacted before being returned
to the user. It is passed the total file size (data + free space) and the total
bytes used by data in the file.
Return `YES` to indicate that an attempt to compact the file should be made.
The compaction will be skipped if another process is accessing it.
*/
typedef BOOL (^RLMShouldCompactOnLaunchBlock)(NSUInteger totalBytes, NSUInteger bytesUsed);
/**
An `RLMRealmConfiguration` instance describes the different options used to
create an instance of a Realm.
`RLMRealmConfiguration` instances are just plain `NSObject`s. Unlike `RLMRealm`s
and `RLMObject`s, they can be freely shared between threads as long as you do not
mutate them.
Creating configuration objects for class subsets (by setting the
`objectClasses` property) can be expensive. Because of this, you will normally want to
cache and reuse a single configuration object for each distinct configuration rather than
creating a new object each time you open a Realm.
*/
@interface RLMRealmConfiguration : NSObject<NSCopying>
#pragma mark - Default Configuration
/**
Returns the default configuration used to create Realms when no other
configuration is explicitly specified (i.e. `+[RLMRealm defaultRealm]`).
@return The default Realm configuration.
*/
+ (instancetype)defaultConfiguration;
/**
Sets the default configuration to the given `RLMRealmConfiguration`.
@param configuration The new default Realm configuration.
*/
+ (void)setDefaultConfiguration:(RLMRealmConfiguration *)configuration;
#pragma mark - Properties
/// The local URL of the Realm file. Mutually exclusive with `inMemoryIdentifier`.
@property (nonatomic, copy, nullable) NSURL *fileURL;
/// A string used to identify a particular in-memory Realm. Mutually exclusive with `fileURL`.
@property (nonatomic, copy, nullable) NSString *inMemoryIdentifier;
/// A 64-byte key to use to encrypt the data, or `nil` if encryption is not enabled.
@property (nonatomic, copy, nullable) NSData *encryptionKey;
/// Whether to open the Realm in read-only mode.
///
/// This is required to be able to open Realm files which are not writeable or
/// are in a directory which is not writeable. This should only be used on files
/// which will not be modified by anyone while they are open, and not just to
/// get a read-only view of a file which may be written to by another thread or
/// process. Opening in read-only mode requires disabling Realm's reader/writer
/// coordination, so committing a write transaction from another process will
/// result in crashes.
@property (nonatomic) BOOL readOnly;
/// The current schema version.
@property (nonatomic) uint64_t schemaVersion;
/// The block which migrates the Realm to the current version.
@property (nonatomic, copy, nullable) RLMMigrationBlock migrationBlock;
/**
Whether to recreate the Realm file with the provided schema if a migration is required.
This is the case when the stored schema differs from the provided schema or
the stored schema version differs from the version on this configuration.
Setting this property to `YES` deletes the file if a migration would otherwise be required or executed.
@note Setting this property to `YES` doesn't disable file format migrations.
*/
@property (nonatomic) BOOL deleteRealmIfMigrationNeeded;
/**
A block called when opening a Realm for the first time during the life
of a process to determine if it should be compacted before being returned
to the user. It is passed the total file size (data + free space) and the total
bytes used by data in the file.
Return `YES` to indicate that an attempt to compact the file should be made.
The compaction will be skipped if another process is accessing it.
*/
@property (nonatomic, copy, nullable) RLMShouldCompactOnLaunchBlock shouldCompactOnLaunch;
/// The classes managed by the Realm.
@property (nonatomic, copy, nullable) NSArray *objectClasses;
@end
NS_ASSUME_NONNULL_END
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.