text stringlengths 4 6.14k |
|---|
/*
* wiiuse
*
* Written By:
* Michael Laforest < para >
* Email: < thepara (--AT--) g m a i l [--DOT--] com >
*
* Copyright 2006-2007
*
* This file is part of wiiuse.
*
* 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/>.
*
* $Header$
*
*/
/**
* @file
* @brief Operating system related definitions.
*
* This file is an attempt to separate operating system
* dependent functions and choose what should be used
* at compile time.
*/
#ifndef OS_H_INCLUDED
#define OS_H_INCLUDED
#ifdef WIN32
/* windows */
#define isnan(x) _isnan(x)
#define isinf(x) !_finite(x)
/* disable warnings I don't care about */
#pragma warning(disable:4244) /* possible loss of data conversion */
#pragma warning(disable:4273) /* inconsistent dll linkage */
#pragma warning(disable:4217)
#else
/* nix */
#endif
#endif // OS_H_INCLUDED
|
/* Test re_search with dotless i.
Copyright (C) 2006-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2006.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#include <locale.h>
#include <regex.h>
#include <string.h>
int
main (void)
{
struct re_pattern_buffer r;
struct re_registers s;
setlocale (LC_ALL, "en_US.UTF-8");
memset (&r, 0, sizeof (r));
memset (&s, 0, sizeof (s));
re_set_syntax (RE_SYNTAX_GREP | RE_HAT_LISTS_NOT_NEWLINE | RE_ICASE);
re_compile_pattern ("insert into", 11, &r);
re_search (&r, "\xFF\0\x12\xA2\xAA\xC4\xB1,K\x12\xC4\xB1*\xACK",
15, 0, 15, &s);
return 0;
}
|
// ==============================
// Fichier: UHostInfoTests.h
// Projet: Einstein
// Ecrit par: Paul Guyot (pguyot@kallisys.net)
//
// Cr le: 22/5/2005
// Tabulation: 4 espaces
//
// Copyright: © 2005 by Paul Guyot.
// Tous droits rservs pour tous pays.
// ===========
// $Id: UHostInfoTests.h 147 2005-09-29 20:17:58Z paul $
// ===========
#ifndef _UHOSTINFOTESTS_H
#define _UHOSTINFOTESTS_H
#include <K/Defines/KDefinitions.h>
///
/// Class to test THostInfo.
///
/// \author Paul Guyot <pguyot@kallisys.net>
/// \version $Revision: 147 $
///
/// \test aucun test dfini.
///
class UHostInfoTests
{
public:
///
/// Test THostInfo
///
static void HostInfoTest( void );
};
#endif
// _UHOSTINFOTESTS_H
// ====================================================== //
// The world is coming to an end ... SAVE YOUR BUFFERS!!! //
// ====================================================== //
|
#include "chmgr_file.h"
#include "stdio.h"
#include "stdlib.h"
#include "log_print.h"
#define FIX_BUFFER_SIZE (1024 * 16)
static char work_buffer[FIX_BUFFER_SIZE];
static char * find_key_value(char *buffer,int buff_size,const char*keyword)
{
char *pTmp=buffer;
char *pBufferEnd=(buffer+buff_size);
char *pKeyTmp=(char *)keyword;
int key_len=0;
int i=0;
int j=0;
char bKeyFind=0;
if(!pTmp)
{
return 0;
}
key_len=strlen(keyword);
while(pTmp<=pBufferEnd)
{
if(pTmp[i]==pKeyTmp[j])
{
i++;
j++;
}
else
{
j=0;
i=0;
pTmp++;
}
if(j>=key_len)
{
bKeyFind=1;
break;
}
}
if(bKeyFind)
{
return pTmp+i;
}
return 0;
}
int load_key_value(const char *filename,const char *keyword,int *keyvalue)
{
FILE *fp=0;
int filesize=0;
char *pBuffer=0;
char *key_ptr=0;
int i=0;
if(!filename || !keyword||!keyvalue)
{
log_print("!filename %d || !keyword %d ||!keyvalue %d\n", (unsigned int)filename, (unsigned int)keyword, (unsigned int)keyvalue);
return -1;
}
fp=fopen(filename,"rb+");
if(!fp)
{
log_print("can't open file %s\n", filename);
return -1;
}
fseek(fp,0,SEEK_END);
filesize=ftell(fp);
fseek(fp,0,SEEK_SET);
if(!filesize)
{
log_print("filesize zero\n");
return -1;
}
if(filesize<=FIX_BUFFER_SIZE)
{
}
else
{
//TODO
log_print("!!!!! file size exceeds 16KB !!!!!!!\n");
filesize=FIX_BUFFER_SIZE-1;
}
pBuffer= work_buffer;
if(!pBuffer)
{
log_print("no pBuffer\n");
return -1;
}
fread(pBuffer,1,filesize,fp);
key_ptr=find_key_value(pBuffer,filesize,keyword);
if(key_ptr)
{
while(key_ptr[i]!='\n'&&i<strlen(key_ptr))
{
i++;
}
key_ptr[i]=0;
*keyvalue=atoi(key_ptr);
}
fclose(fp);
return 0;
}
int load_freq_value(const char *filename,const char *keyword,int *keyvalue, int **keylist)
{
FILE *fp=0;
int filesize=0, tmp_size=0;
char *pBuffer=0;
char *key_ptr=NULL;
int i=0;
int offset = 0;
int *list=NULL;
if(!filename || !keyword||!keyvalue||!keylist)
{
return -1;
}
fp=fopen(filename,"rb+");
if(!fp)
{
return -1;
}
fseek(fp,0,SEEK_END);
filesize=ftell(fp);
fseek(fp,0,SEEK_SET);
if(!filesize)
{
return -1;
}
if(filesize<=FIX_BUFFER_SIZE)
{
}
else
{
//TODO
log_print("!!!!! file size exceeds 16KB !!!!!!!\n");
filesize=FIX_BUFFER_SIZE-1;
}
pBuffer= work_buffer;
tmp_size = filesize;
if(!pBuffer)
{
return -1;
}
fread(pBuffer,1,filesize,fp);
i = 0;
do {
key_ptr=find_key_value(pBuffer,tmp_size,keyword);
if(key_ptr) {
i++;
tmp_size -= key_ptr - pBuffer;
pBuffer = key_ptr;
offset = 0;
while(key_ptr[offset]!='\n'&&offset<strlen(key_ptr))
{
offset++;
tmp_size--;
pBuffer++;
}
}
} while(key_ptr);
*keyvalue = i;
if(*keyvalue) {
list = malloc(sizeof(int) * i);
if(list == NULL) {
fclose(fp);
return -1;
}
pBuffer= work_buffer;
tmp_size = filesize;
i = 0;
do {
key_ptr=find_key_value(pBuffer,tmp_size,keyword);
if(key_ptr) {
tmp_size -= key_ptr - pBuffer;
pBuffer = key_ptr;
offset = 0;
while(key_ptr[offset]!='\n'&&offset<strlen(key_ptr))
{
offset++;
tmp_size--;
pBuffer++;
}
key_ptr[offset]=0;
list[i++]=atoi(key_ptr);
}
} while(key_ptr != NULL);
}
*keylist = list;
fclose(fp);
return 0;
}
#if 0
int main(int argc ,char **argv)
{
int key_value;
load_key_value("test.txt","freq=",&key_value);
printf("key_value=%d\n",key_value);
load_key_value("test.txt","symbol_rate=",&key_value);
printf("key_value=%d\n",key_value);
load_key_value("test.txt","qam=",&key_value);
printf("key_value=%d\n",key_value);
load_key_value("test.txt","v_pid=",&key_value);
printf("key_value=%d\n",key_value);
load_key_value("test.txt","a_pid=",&key_value);
printf("key_value=%d\n",key_value);
load_key_value("test.txt","v_type=",&key_value);
printf("key_value=%d\n",key_value);
}
#endif
|
/*
* Copyright (C) 2016 Alberts Muktupāvels
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "gf-sn-watcher-v0.h"
#include "gf-status-notifier-watcher.h"
struct _GfStatusNotifierWatcher
{
GObject parent;
GfSnWatcherV0 *v0;
};
G_DEFINE_TYPE (GfStatusNotifierWatcher, gf_status_notifier_watcher, G_TYPE_OBJECT)
static void
gf_status_notifier_watcher_dispose (GObject *object)
{
GfStatusNotifierWatcher *watcher;
watcher = GF_STATUS_NOTIFIER_WATCHER (object);
g_clear_object (&watcher->v0);
G_OBJECT_CLASS (gf_status_notifier_watcher_parent_class)->dispose (object);
}
static void
gf_status_notifier_watcher_class_init (GfStatusNotifierWatcherClass *watcher_class)
{
GObjectClass *object_class;
object_class = G_OBJECT_CLASS (watcher_class);
object_class->dispose = gf_status_notifier_watcher_dispose;
}
static void
gf_status_notifier_watcher_init (GfStatusNotifierWatcher *watcher)
{
watcher->v0 = gf_sn_watcher_v0_new ();
}
GfStatusNotifierWatcher *
gf_status_notifier_watcher_new (void)
{
return g_object_new (GF_TYPE_STATUS_NOTIFIER_WATCHER, NULL);
}
|
/*
* VP9 SIMD optimizations
*
* Copyright (c) 2013 Ronald S. Bultje <rsbultje gmail com>
*
* This file is part of FFmpeg.
*
* FFmpeg 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.
*
* FFmpeg 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 FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavutil/attributes.h"
#include "libavutil/cpu.h"
#include "libavutil/mem.h"
#include "libavutil/x86/cpu.h"
#include "libavcodec/vp9dsp.h"
#include "libavcodec/x86/vp9dsp_init.h"
#if HAVE_YASM
decl_fpel_func(put, 8, , mmx);
decl_fpel_func(avg, 8, _16, mmxext);
decl_fpel_func(put, 16, , sse);
decl_fpel_func(put, 32, , sse);
decl_fpel_func(put, 64, , sse);
decl_fpel_func(put, 128, , sse);
decl_fpel_func(avg, 16, _16, sse2);
decl_fpel_func(avg, 32, _16, sse2);
decl_fpel_func(avg, 64, _16, sse2);
decl_fpel_func(avg, 128, _16, sse2);
decl_fpel_func(put, 32, , avx);
decl_fpel_func(put, 64, , avx);
decl_fpel_func(put, 128, , avx);
decl_fpel_func(avg, 32, _16, avx2);
decl_fpel_func(avg, 64, _16, avx2);
decl_fpel_func(avg, 128, _16, avx2);
decl_ipred_fns(v, 16, mmx, sse);
decl_ipred_fns(h, 16, mmxext, sse2);
decl_ipred_fns(dc, 16, mmxext, sse2);
decl_ipred_fns(dc_top, 16, mmxext, sse2);
decl_ipred_fns(dc_left, 16, mmxext, sse2);
#define decl_ipred_dir_funcs(type) \
decl_ipred_fns(type, 16, sse2, sse2); \
decl_ipred_fns(type, 16, ssse3, ssse3); \
decl_ipred_fns(type, 16, avx, avx)
decl_ipred_dir_funcs(dl);
decl_ipred_dir_funcs(dr);
decl_ipred_dir_funcs(vl);
decl_ipred_dir_funcs(vr);
decl_ipred_dir_funcs(hu);
decl_ipred_dir_funcs(hd);
#endif /* HAVE_YASM */
av_cold void ff_vp9dsp_init_16bpp_x86(VP9DSPContext *dsp)
{
#if HAVE_YASM
int cpu_flags = av_get_cpu_flags();
if (EXTERNAL_MMX(cpu_flags)) {
init_fpel_func(4, 0, 8, put, , mmx);
init_ipred_func(v, VERT, 4, 16, mmx);
}
if (EXTERNAL_MMXEXT(cpu_flags)) {
init_fpel_func(4, 1, 8, avg, _16, mmxext);
init_ipred_func(h, HOR, 4, 16, mmxext);
init_ipred_func(dc, DC, 4, 16, mmxext);
init_ipred_func(dc_top, TOP_DC, 4, 16, mmxext);
init_ipred_func(dc_left, LEFT_DC, 4, 16, mmxext);
}
if (EXTERNAL_SSE(cpu_flags)) {
init_fpel_func(3, 0, 16, put, , sse);
init_fpel_func(2, 0, 32, put, , sse);
init_fpel_func(1, 0, 64, put, , sse);
init_fpel_func(0, 0, 128, put, , sse);
init_8_16_32_ipred_funcs(v, VERT, 16, sse);
}
if (EXTERNAL_SSE2(cpu_flags)) {
init_fpel_func(3, 1, 16, avg, _16, sse2);
init_fpel_func(2, 1, 32, avg, _16, sse2);
init_fpel_func(1, 1, 64, avg, _16, sse2);
init_fpel_func(0, 1, 128, avg, _16, sse2);
init_8_16_32_ipred_funcs(h, HOR, 16, sse2);
init_8_16_32_ipred_funcs(dc, DC, 16, sse2);
init_8_16_32_ipred_funcs(dc_top, TOP_DC, 16, sse2);
init_8_16_32_ipred_funcs(dc_left, LEFT_DC, 16, sse2);
init_ipred_funcs(dl, DIAG_DOWN_LEFT, 16, sse2);
init_ipred_funcs(dr, DIAG_DOWN_RIGHT, 16, sse2);
init_ipred_funcs(vl, VERT_LEFT, 16, sse2);
init_ipred_funcs(vr, VERT_RIGHT, 16, sse2);
init_ipred_funcs(hu, HOR_UP, 16, sse2);
init_ipred_funcs(hd, HOR_DOWN, 16, sse2);
}
if (EXTERNAL_SSSE3(cpu_flags)) {
init_ipred_funcs(dl, DIAG_DOWN_LEFT, 16, ssse3);
init_ipred_funcs(dr, DIAG_DOWN_RIGHT, 16, ssse3);
init_ipred_funcs(vl, VERT_LEFT, 16, ssse3);
init_ipred_funcs(vr, VERT_RIGHT, 16, ssse3);
init_ipred_funcs(hu, HOR_UP, 16, ssse3);
init_ipred_funcs(hd, HOR_DOWN, 16, ssse3);
}
if (EXTERNAL_AVX_FAST(cpu_flags)) {
init_fpel_func(2, 0, 32, put, , avx);
init_fpel_func(1, 0, 64, put, , avx);
init_fpel_func(0, 0, 128, put, , avx);
init_ipred_funcs(dl, DIAG_DOWN_LEFT, 16, avx);
init_ipred_funcs(dr, DIAG_DOWN_RIGHT, 16, avx);
init_ipred_funcs(vl, VERT_LEFT, 16, avx);
init_ipred_funcs(vr, VERT_RIGHT, 16, avx);
init_ipred_funcs(hu, HOR_UP, 16, avx);
init_ipred_funcs(hd, HOR_DOWN, 16, avx);
}
if (EXTERNAL_AVX2(cpu_flags)) {
init_fpel_func(2, 1, 32, avg, _16, avx2);
init_fpel_func(1, 1, 64, avg, _16, avx2);
init_fpel_func(0, 1, 128, avg, _16, avx2);
}
#endif /* HAVE_YASM */
}
|
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 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 <https://www.gnu.org/licenses/>.
*
*/
#pragma once
#include "../inc/MarlinConfigPre.h"
#include "../HAL/shared/Marduino.h"
typedef union {
uint8_t bits;
struct { bool info:1, errors:1, debug:1; };
} flag_t;
#if ENABLED(HOST_PROMPT_SUPPORT)
enum PromptReason : uint8_t {
PROMPT_NOT_DEFINED,
PROMPT_FILAMENT_RUNOUT,
PROMPT_USER_CONTINUE,
PROMPT_FILAMENT_RUNOUT_REHEAT,
PROMPT_PAUSE_RESUME,
PROMPT_INFO
};
#endif
class HostUI {
public:
static flag_t flag;
HostUI() { flag.bits = 0xFF; }
static void action(FSTR_P const fstr, const bool eol=true);
#ifdef ACTION_ON_KILL
static void kill();
#endif
#ifdef ACTION_ON_PAUSE
static void pause(const bool eol=true);
#endif
#ifdef ACTION_ON_PAUSED
static void paused(const bool eol=true);
#endif
#ifdef ACTION_ON_RESUME
static void resume();
#endif
#ifdef ACTION_ON_RESUMED
static void resumed();
#endif
#ifdef ACTION_ON_CANCEL
static void cancel();
#endif
#ifdef ACTION_ON_START
static void start();
#endif
#ifdef SHUTDOWN_ACTION
static void shutdown();
#endif
#if ENABLED(G29_RETRY_AND_RECOVER)
#ifdef ACTION_ON_G29_RECOVER
static void g29_recover();
#endif
#ifdef ACTION_ON_G29_FAILURE
static void g29_failure();
#endif
#endif
#if ENABLED(HOST_PROMPT_SUPPORT)
private:
static void prompt(FSTR_P const ptype, const bool eol=true);
static void prompt_plus(FSTR_P const ptype, FSTR_P const fstr, const char extra_char='\0');
static void prompt_show();
static void _prompt_show(FSTR_P const btn1, FSTR_P const btn2);
public:
static PromptReason host_prompt_reason;
static void handle_response(const uint8_t response);
static void notify_P(PGM_P const message);
static inline void notify(FSTR_P const fmsg) { notify_P(FTOP(fmsg)); }
static void notify(const char * const message);
static void prompt_begin(const PromptReason reason, FSTR_P const fstr, const char extra_char='\0');
static void prompt_button(FSTR_P const fstr);
static void prompt_end();
static void prompt_do(const PromptReason reason, FSTR_P const pstr, FSTR_P const btn1=nullptr, FSTR_P const btn2=nullptr);
static void prompt_do(const PromptReason reason, FSTR_P const pstr, const char extra_char, FSTR_P const btn1=nullptr, FSTR_P const btn2=nullptr);
static inline void prompt_open(const PromptReason reason, FSTR_P const pstr, FSTR_P const btn1=nullptr, FSTR_P const btn2=nullptr) {
if (host_prompt_reason == PROMPT_NOT_DEFINED) prompt_do(reason, pstr, btn1, btn2);
}
#if ENABLED(ADVANCED_PAUSE_FEATURE)
static void filament_load_prompt();
#endif
#endif
};
extern HostUI hostui;
extern const char CONTINUE_STR[], DISMISS_STR[];
|
/*
** CXSC is a C++ library for eXtended Scientific Computing (V 2.5.4)
**
** Copyright (C) 1990-2000 Institut fuer Angewandte Mathematik,
** Universitaet Karlsruhe, Germany
** (C) 2000-2014 Wiss. Rechnen/Softwaretechnologie
** Universitaet Wuppertal, Germany
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Library General Public
** License as published by the Free Software Foundation; either
** version 2 of the License, or (at your option) any later version.
**
** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Library General Public License for more details.
**
** You should have received a copy of the GNU Library General Public
** License along with this library; if not, write to the Free
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* CVS $Id: f_rds1.c,v 1.21 2014/01/30 17:24:07 cxsc Exp $ */
/****************************************************************/
/* */
/* Filename : f_rds1.c */
/* */
/* Entry : void f_rds1(desc,s) */
/* f_text *desc; */
/* s_trng *s; */
/* */
/* Arguments : desc - device descriptor */
/* s - string */
/* */
/* Description : perform PASCAL read(string). */
/* */
/* one more allocated for direct use of '\0' */
/****************************************************************/
#ifndef ALL_IN_ONE
#ifdef AIX
#include "/u/p88c/runtime/o_defs.h"
#else
#include "o_defs.h"
#endif
#define local
extern dotprecision b_cm__;
#endif
#ifdef LINT_ARGS
local void f_rds1(f_text *desc,s_trng *s)
#else
local void f_rds1(desc,s)
f_text *desc;
s_trng *s;
#endif
{
size_t alen,i,k;
char *buffer,*ptr,*dummy;
E_TPUSH("f_rds1")
if (b_text(desc,TRUE))
{
buffer = (char *)b_cm__;
alen = (size_t)((s->fix==TRUE) ? s->alen : MAXINT);
k = i = 0;
ptr = NULL;
while ((desc->eoln==FALSE) && (i<alen))
{
buffer[k] = desc->win.ch[0];
i++;
if (++k==BUFFERSIZE)
{
k = 0;
if ((dummy = (char*) malloc(i))==NULL)
{
e_trap(I_O_BUFFER,2,E_TMSG,55);
E_TPOPP("f_rds1")
return;
}
else
{
if (ptr)
{
memcpy(dummy,ptr,i-BUFFERSIZE);
#ifdef HEAP_CHECK
b_freh((a_char *)&ptr,(a_char *)ptr,(a_char *)"f_rds1");
#endif
free(ptr);
}
#ifdef HEAP_CHECK
b_geth((a_char *)&ptr,(a_char *)dummy,(a_char *)"f_rds1");
#endif
memcpy(dummy+(i-BUFFERSIZE),buffer,BUFFERSIZE);
ptr = dummy;
}
}
f_getc(desc);
}
if (s->alen<i)
{
if (s->alen>0)
{
#ifdef HEAP_CHECK
b_freh((a_char *)&s->ptr,(a_char *)s->ptr,(a_char *)"f_rds1");
#endif
free((char *)s->ptr);
}
/* one more for direct use of '\0'*/
if ((s->ptr = (char*) malloc(i+1))==NULL)
{
e_trap(ALLOCATION,2,E_TMSG,54);
s->clen = s->alen = 0;
E_TPOPP("f_rds1")
return;
}
else
{
#ifdef HEAP_CHECK
b_geth((a_char *)&s->ptr,(a_char *)s->ptr,(a_char *)"f_rds1");
#endif
s->alen = i;
}
}
s->clen = i;
if (ptr)
{
memcpy(s->ptr,ptr,i-k);
#ifdef HEAP_CHECK
b_freh((a_char *)&ptr,(a_char *)ptr,(a_char *)"f_rds1");
#endif
free(ptr);
}
if (k>0) memcpy(s->ptr+(i-k),buffer,k);
}
E_TPOPP("f_rds1")
}
|
// -----------------------------------------------------------------
// Subtract two matrices -- unlike CDIF, output is always last
// c <-- c - b
// c <-- a - b
#include "../include/config.h"
#include "../include/complex.h"
#include "../include/susy.h"
void dif_matrix(matrix *b, matrix *c) {
register int i, j;
for (i = 0; i < NCOL; i++) {
for (j = 0; j < NCOL; j++) {
c->e[i][j].real -= b->e[i][j].real;
c->e[i][j].imag -= b->e[i][j].imag;
}
}
}
void sub_matrix(matrix *a, matrix *b, matrix *c) {
register int i, j;
for (i = 0; i < NCOL; i++) {
for (j = 0; j < NCOL; j++) {
c->e[i][j].real = a->e[i][j].real - b->e[i][j].real;
c->e[i][j].imag = a->e[i][j].imag - b->e[i][j].imag;
}
}
}
// -----------------------------------------------------------------
|
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSensors module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** As a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QACCELEROMETER_P_H
#define QACCELEROMETER_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include "qsensor_p.h"
QT_BEGIN_NAMESPACE
class QAccelerometerReadingPrivate
{
public:
QAccelerometerReadingPrivate()
: x(0)
, y(0)
, z(0)
{
}
qreal x;
qreal y;
qreal z;
};
class QAccelerometerPrivate : public QSensorPrivate
{
public:
QAccelerometerPrivate()
: accelerationMode(QAccelerometer::Combined)
{
}
QAccelerometer::AccelerationMode accelerationMode;
};
QT_END_NAMESPACE
#endif
|
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the demonstration applications of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial Usage
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef ARTHURWIDGETS_H
#define ARTHURWIDGETS_H
#include "arthurstyle.h"
#include <QBitmap>
#include <QPushButton>
#include <QGroupBox>
#if defined(QT_OPENGL_SUPPORT)
#include <QGLWidget>
#include <QEvent>
class GLWidget : public QGLWidget
{
public:
GLWidget(QWidget *parent)
: QGLWidget(QGLFormat(QGL::SampleBuffers), parent)
{
setAttribute(Qt::WA_AcceptTouchEvents);
}
void disableAutoBufferSwap() { setAutoBufferSwap(false); }
void paintEvent(QPaintEvent *) { parentWidget()->update(); }
protected:
bool event(QEvent *event)
{
switch (event->type()) {
case QEvent::TouchBegin:
case QEvent::TouchUpdate:
case QEvent::TouchEnd:
event->ignore();
return false;
break;
default:
break;
}
return QGLWidget::event(event);
}
};
#endif
QT_FORWARD_DECLARE_CLASS(QTextDocument)
QT_FORWARD_DECLARE_CLASS(QTextEdit)
QT_FORWARD_DECLARE_CLASS(QVBoxLayout)
class ArthurFrame : public QWidget
{
Q_OBJECT
public:
ArthurFrame(QWidget *parent);
virtual void paint(QPainter *) {}
void paintDescription(QPainter *p);
void loadDescription(const QString &filename);
void setDescription(const QString &htmlDesc);
void loadSourceFile(const QString &fileName);
bool preferImage() const { return m_prefer_image; }
#if defined(QT_OPENGL_SUPPORT)
QGLWidget *glWidget() const { return glw; }
#endif
public slots:
void setPreferImage(bool pi) { m_prefer_image = pi; }
void setDescriptionEnabled(bool enabled);
void showSource();
#if defined(QT_OPENGL_SUPPORT)
void enableOpenGL(bool use_opengl);
bool usesOpenGL() { return m_use_opengl; }
#endif
signals:
void descriptionEnabledChanged(bool);
protected:
void paintEvent(QPaintEvent *);
void resizeEvent(QResizeEvent *);
#if defined(QT_OPENGL_SUPPORT)
GLWidget *glw;
bool m_use_opengl;
#endif
QPixmap m_tile;
bool m_show_doc;
bool m_prefer_image;
QTextDocument *m_document;
QString m_sourceFileName;
};
#endif
|
/*!
@file
@author Albert Semenov
@date 12/2009
*/
#ifndef __SCENE_OBJECT_H__
#define __SCENE_OBJECT_H__
#ifdef MYGUI_OGRE_PLATFORM
#include <Ogre.h>
#include "MyGUI_LastHeader.h"
namespace demo
{
class SceneObject
{
public:
SceneObject();
virtual ~SceneObject();
public:
void setEntity(const std::string& _value);
void setMaterial(const std::string& _value);
void setSceneManager(const std::string& _value);
void setCamera(const std::string& _value);
protected:
void setTextureName(const std::string& _name);
bool pickPositionInObject(int& _x, int& _y, int _view_width, int _view_height, int _texture_width, int _texture_height) const;
private:
// Code found in Wiki: www.ogre3d.org/wiki/index.php/RetrieveVertexData
void GetMeshInformation(
const Ogre::MeshPtr mesh,
size_t& vertex_count,
Ogre::Vector3* &vertices,
size_t& index_count,
unsigned long* &indices,
Ogre::Vector2* &coords,
const Ogre::Vector3& position,
const Ogre::Quaternion& orient,
const Ogre::Vector3& scale,
const std::string& _material);
void clear();
bool isIntersectMesh(int& _x, int& _y, const Ogre::Ray& _ray, int _texture_width, int _texture_height) const;
Ogre::Vector2 getCoordByTriangle(Ogre::Vector3 _position, const Ogre::Vector3& _corner0, const Ogre::Vector3& _corner1, const Ogre::Vector3& _corner2) const;
Ogre::Vector2 getCoordByRel(Ogre::Vector2 _position, const Ogre::Vector2& _corner0, const Ogre::Vector2& _corner1, const Ogre::Vector2& _corner2) const;
void updateData();
Ogre::SceneManager* getSceneManager() const;
Ogre::Camera* getCamera() const;
private:
Ogre::Vector2* mTextureCoords;
Ogre::Vector3* mVertices;
unsigned long* mIndices;
size_t mVertexCount;
size_t mIndexCount;
float mUScale;
float mVScale;
mutable Ogre::RaySceneQuery* mRaySceneQuery;
std::string mEntityName;
std::string mMaterialName;
std::string mTextureName;
std::string mSceneManager;
std::string mCamera;
Ogre::TextureUnitState* mTextureUnit;
};
} // namespace demo
#endif
#endif // __SCENE_OBJECT_H__
|
/*
* Copyright (C) Tildeslash Ltd. All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* In addition, as a special exception, the copyright holders give
* permission to link the code of portions of this program with the
* OpenSSL library under certain conditions as described in each
* individual source file, and distribute linked combinations
* including the two.
*
* You must obey the GNU Affero General Public License in all respects
* for all of the code used other than OpenSSL.
*/
#include "config.h"
#ifdef HAVE_STDIO_H
#include <stdio.h>
#endif
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include "protocol.h"
/* Private prototypes */
static int say(Socket_T s, char *msg);
static int expect(Socket_T s, int expect, int log);
/**
* Check the server for greeting code 220 and send EHLO. If that failed
* try HELO and test for return code 250 and finally send QUIT and check
* for return code 221. If alive return TRUE else return FALSE.
*
* @file
*/
int check_smtp(Socket_T socket) {
ASSERT(socket);
/* Try HELO also before giving up as of rfc2821 4.1.1.1 */
if (expect(socket, 220, TRUE)
&& ((say(socket, "EHLO localhost\r\n") && expect(socket, 250, FALSE)) || (say(socket, "HELO localhost\r\n") && expect(socket, 250, TRUE)))
&& (say(socket, "QUIT\r\n") && expect(socket, 221, TRUE)))
return TRUE;
return FALSE;
}
/* --------------------------------------------------------------- Private */
static int say(Socket_T socket, char *msg) {
if (socket_write(socket, msg, strlen(msg)) < 0) {
socket_setError(socket, "SMTP: error sending data -- %s\n", STRERROR);
return FALSE;
}
return TRUE;
}
static int expect(Socket_T socket, int expect, int log) {
int status;
char buf[STRLEN];
do {
if (! socket_readln(socket, buf, STRLEN)) {
socket_setError(socket, "SMTP: error receiving data -- %s\n", STRERROR);
return FALSE;
}
Str_chomp(buf);
} while (buf[3] == '-'); // Discard multi-line response
if (sscanf(buf, "%d", &status) != 1) {
if(log)
socket_setError(socket, "SMTP error: %s\n", buf);
return FALSE;
}
return TRUE;
}
|
#ifndef __OpenViBEPlugins_SimpleVisualisation_CStreamedMatrixDatabase_H__
#define __OpenViBEPlugins_SimpleVisualisation_CStreamedMatrixDatabase_H__
#include "ovp_defines.h"
#include "ovpIStreamDatabase.h"
#include <openvibe/ov_all.h>
#include <toolkit/ovtk_all.h>
#include <vector>
#include <deque>
#include <queue>
#include <string>
#include <cfloat>
#include <iostream>
namespace OpenViBEPlugins
{
namespace SimpleVisualisation
{
/**
* This class is used to store information about the incoming matrix stream. It can request a IStreamDisplayDrawable
* object to redraw itself upon changes in its data.
*/
class CStreamedMatrixDatabase : public IStreamDatabase
{
public:
/**
* \brief Constructor
* \param
*/
CStreamedMatrixDatabase(
OpenViBEToolkit::TBoxAlgorithm<OpenViBE::Plugins::IBoxAlgorithm>& oPlugin);
/**
* \brief Destructor
*/
virtual ~CStreamedMatrixDatabase();
virtual OpenViBE::boolean initialize();
virtual void setDrawable(
IStreamDisplayDrawable* pDrawable);
virtual void setRedrawOnNewData(
OpenViBE::boolean bRedrawOnNewData);
virtual OpenViBE::boolean isFirstBufferReceived();
virtual OpenViBE::boolean setMaxBufferCount(
OpenViBE::uint32 ui32MaxBufferCount);
virtual OpenViBE::boolean setTimeScale(
OpenViBE::float64 f64TimeScale);
virtual OpenViBE::boolean decodeMemoryBuffer(
const OpenViBE::IMemoryBuffer* pMemoryBuffer,
OpenViBE::uint64 ui64StartTime,
OpenViBE::uint64 ui64EndTime);
virtual OpenViBE::uint32 getMaxBufferCount();
virtual OpenViBE::uint32 getCurrentBufferCount();
virtual const OpenViBE::float64* getBuffer(
OpenViBE::uint32 ui32BufferIndex);
virtual OpenViBE::uint64 getStartTime(
OpenViBE::uint32 ui32BufferIndex);
virtual OpenViBE::uint64 getEndTime(
OpenViBE::uint32 ui32BufferIndex);
virtual OpenViBE::uint32 getBufferElementCount();
virtual OpenViBE::uint64 getBufferDuration();
virtual OpenViBE::boolean isBufferTimeStepComputed();
virtual OpenViBE::uint64 getBufferTimeStep();
virtual OpenViBE::uint32 getSampleCountPerBuffer();
virtual OpenViBE::uint32 getChannelCount();
virtual OpenViBE::boolean getChannelLabel(
const OpenViBE::uint32 ui32ChannelIndex,
OpenViBE::CString& rElectrodeLabel);
virtual OpenViBE::boolean getChannelMinMaxValues(
OpenViBE::uint32 ui32Channel,
OpenViBE::float64& f64Min,
OpenViBE::float64& f64Max);
virtual OpenViBE::boolean getGlobalMinMaxValues(
OpenViBE::float64& f64Min,
OpenViBE::float64& f64Max);
virtual OpenViBE::boolean getLastBufferChannelMinMaxValues(
OpenViBE::uint32 ui32Channel,
OpenViBE::float64& f64Min,
OpenViBE::float64& f64Max);
virtual OpenViBE::boolean getLastBufferGlobalMinMaxValues(
OpenViBE::float64& f64Min,
OpenViBE::float64& f64Max);
protected:
OpenViBE::boolean onBufferCountChanged();
virtual OpenViBE::boolean decodeHeader();
virtual OpenViBE::boolean decodeBuffer(
OpenViBE::uint64 ui64StartTime,
OpenViBE::uint64 ui64EndTime);
protected:
// parent plugin
OpenViBEToolkit::TBoxAlgorithm<OpenViBE::Plugins::IBoxAlgorithm>& m_oParentPlugin;
//decoder algorithm
OpenViBE::Kernel::IAlgorithmProxy* m_pDecoder;
//drawable object to update (if needed)
IStreamDisplayDrawable* m_pDrawable;
//flag stating whether to redraw the IStreamDisplayDrawable upon new data reception if true (default)
OpenViBE::boolean m_bRedrawOnNewData;
//flag stating whether first samples buffer has been received
OpenViBE::boolean m_bFirstBufferReceived;
//flag stating whether buffer time step was computed
OpenViBE::boolean m_bBufferTimeStepComputed;
//time difference between start times of two consecutive buffers
OpenViBE::uint64 m_ui64BufferTimeStep;
//maximum number of buffers stored in database
OpenViBE::uint32 m_ui32MaxBufferCount;
//flag stating whether time scale should be ignored (max buffer count externally set)
OpenViBE::boolean m_bIgnoreTimeScale;
//maximum duration of displayed buffers (in seconds)
OpenViBE::float64 m_f64TimeScale;
//double-linked list of start times of stored buffers
std::deque<OpenViBE::uint64> m_oStartTime;
//double-linked list of end times of stored buffers
std::deque<OpenViBE::uint64> m_oEndTime;
//streamed matrix header
OpenViBE::CMatrix m_oStreamedMatrixHeader;
//streamed matrix history
std::deque<OpenViBE::CMatrix*> m_oStreamedMatrices;
//min/max values for each channel
std::vector<std::deque<std::pair<OpenViBE::float64, OpenViBE::float64> > > m_oChannelMinMaxValues;
};
}
}
#endif //#ifndef __OpenViBEPlugins_SimpleVisualisation_CStreamedMatrixDatabase_H__
|
/*
* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:
*
*/
#ifndef ECntFetchTemplateIds1_H_
#define ECntFetchTemplateIds1_H_
//Include the suite header
#include "csuite.h"
#include "ccntserver.h"
#include "ccntipccodes.h"
class CECntFetchTemplateIds1Step: public CCapabilityTestStep
{
public:
//Get the version of the server to be called
TVersion Version()
{
return TVersion(KLockSrvMajorVersionNumber, KLockSrvMinorVersionNumber, KLockSrvBuildVersionNumber);
}
//Constructor called from the respective Suite.cpp from their "AddTestStep" function
CECntFetchTemplateIds1Step() ;
//Always clean your mess
~CECntFetchTemplateIds1Step()
{
tChildThread.Close();
}
//This is the Function called from "doTestStepL" by the test Suite,and it creates an
//child thread which internally calls the corresponding Exec_SendReceive_SERVERNAME fn.
TVerdict MainThread();
//Here's where the connection and testing the message takes place
TInt Exec_SendReceive();
};
#endif
|
/* integration/qk51.c
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 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 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "gsl__config.h"
#include "gsl_integration.h"
/* Gauss quadrature weights and kronrod quadrature abscissae and
weights as evaluated with 80 decimal digit arithmetic by
L. W. Fullerton, Bell Labs, Nov. 1981. */
static const double xgk[26] = /* abscissae of the 51-point kronrod rule */
{
0.999262104992609834193457486540341,
0.995556969790498097908784946893902,
0.988035794534077247637331014577406,
0.976663921459517511498315386479594,
0.961614986425842512418130033660167,
0.942974571228974339414011169658471,
0.920747115281701561746346084546331,
0.894991997878275368851042006782805,
0.865847065293275595448996969588340,
0.833442628760834001421021108693570,
0.797873797998500059410410904994307,
0.759259263037357630577282865204361,
0.717766406813084388186654079773298,
0.673566368473468364485120633247622,
0.626810099010317412788122681624518,
0.577662930241222967723689841612654,
0.526325284334719182599623778158010,
0.473002731445714960522182115009192,
0.417885382193037748851814394594572,
0.361172305809387837735821730127641,
0.303089538931107830167478909980339,
0.243866883720988432045190362797452,
0.183718939421048892015969888759528,
0.122864692610710396387359818808037,
0.061544483005685078886546392366797,
0.000000000000000000000000000000000
};
/* xgk[1], xgk[3], ... abscissae of the 25-point gauss rule.
xgk[0], xgk[2], ... abscissae to optimally extend the 25-point gauss rule */
static const double wg[13] = /* weights of the 25-point gauss rule */
{
0.011393798501026287947902964113235,
0.026354986615032137261901815295299,
0.040939156701306312655623487711646,
0.054904695975835191925936891540473,
0.068038333812356917207187185656708,
0.080140700335001018013234959669111,
0.091028261982963649811497220702892,
0.100535949067050644202206890392686,
0.108519624474263653116093957050117,
0.114858259145711648339325545869556,
0.119455763535784772228178126512901,
0.122242442990310041688959518945852,
0.123176053726715451203902873079050
};
static const double wgk[26] = /* weights of the 51-point kronrod rule */
{
0.001987383892330315926507851882843,
0.005561932135356713758040236901066,
0.009473973386174151607207710523655,
0.013236229195571674813656405846976,
0.016847817709128298231516667536336,
0.020435371145882835456568292235939,
0.024009945606953216220092489164881,
0.027475317587851737802948455517811,
0.030792300167387488891109020215229,
0.034002130274329337836748795229551,
0.037116271483415543560330625367620,
0.040083825504032382074839284467076,
0.042872845020170049476895792439495,
0.045502913049921788909870584752660,
0.047982537138836713906392255756915,
0.050277679080715671963325259433440,
0.052362885806407475864366712137873,
0.054251129888545490144543370459876,
0.055950811220412317308240686382747,
0.057437116361567832853582693939506,
0.058689680022394207961974175856788,
0.059720340324174059979099291932562,
0.060539455376045862945360267517565,
0.061128509717053048305859030416293,
0.061471189871425316661544131965264,
0.061580818067832935078759824240066
};
/* wgk[25] was calculated from the values of wgk[0..24] */
void
gsl_integration_qk51 (const gsl_function * f, double a, double b,
double *result, double *abserr,
double *resabs, double *resasc)
{
double fv1[26], fv2[26];
gsl_integration_qk (26, xgk, wg, wgk, fv1, fv2, f, a, b, result, abserr, resabs, resasc);
}
|
#import "MWMTableViewCell.h"
@class MWMNoteCell;
@protocol MWMNoteCelLDelegate <NSObject>
- (void)cellShouldChangeSize:(MWMNoteCell *)cell text:(NSString *)text;
- (void)cell:(MWMNoteCell *)cell didFinishEditingWithText:(NSString *)text;
@end
@interface MWMNoteCell : MWMTableViewCell
- (void)configWithDelegate:(id<MWMNoteCelLDelegate>)delegate noteText:(NSString *)text
placeholder:(NSString *)placeholder;
- (CGFloat)cellHeight;
- (void)updateTextViewForHeight:(CGFloat)height;
- (CGFloat)textViewContentHeight;
+ (CGFloat)minimalHeight;
- (void)registerObserver;
@end
|
#import "OBAHasReferencesV2.h"
@interface OBAEntryWithReferencesV2 : OBAHasReferencesV2
@property (nonatomic,strong) id entry;
@end
|
/*******************************************************************************
Copyright (c) 2011 Yahoo! Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. See accompanying LICENSE file.
The Initial Developer of the Original Code is Shravan Narayanamurthy.
******************************************************************************/
/*
* Unigram_Model_Trainer.h
*
* Created on: 06-Jan-2011
*
*/
#ifndef UNIGRAM_MODEL_TRAINER_H_
#define UNIGRAM_MODEL_TRAINER_H_
#include "TopicLearner/Model_Refiner.h"
#include "TypeTopicCounts.h"
#include "TopicLearner/Parameter.h"
#include "DocumentReader.h"
#include "DocumentWriter.h"
#include <boost/random/variate_generator.hpp>
#include <boost/random/uniform_real.hpp>
using namespace boost;
using namespace std;
/**
* The default implementation of Model_Refiner for the
* Unigram model
*/
class Unigram_Model_Trainer: public Model_Refiner {
public:
Unigram_Model_Trainer(TypeTopicCounts&, Parameter&, Parameter&);
virtual ~Unigram_Model_Trainer();
google::protobuf::Message* allocate_document_buffer(size_t);
void deallocate_document_buffer(google::protobuf::Message*);
google::protobuf::Message* get_nth_document(
google::protobuf::Message* docs, size_t n);
//!Reads a document from the protobuf
//!format word & topic files using DocumentReader
void* read(google::protobuf::Message&);
//!Does Gibbs sampling using sampler.cpp to
//!figure out new topic assignments to each
//!word present in the document passed in the msg
void* sample(void*);
//!Takes a msg which contains the document to be
//!processed and the updated topics for each word
//!in the document as a vector. It then processes
//!each update by just calling upd_count on the
//!TypeTopicCounts object with the update details
void* update(void*);
//!Performs stochastic GD to optimize the alphas. The
//!gradients are accumulated for tau docs and then the
//!global alphas are updated.
void* optimize(void*);
//!Compute the document portion of the log-likelihood
void* eval(void*, double&);
//!Takes the document and writes it to disk. Here we
//!use a simple optimization of not writing the
//!body/words in the document but only the topics.
//!This is because the words in the document never
//!change. Its only the topics that change. The documents
//!are written using a DocumentWriter to disk
void write(void*);
void iteration_done();
void* test(void*);
static long doc_index; //!Running count of all the documents processed by the optimizer
private:
void set_up_io(string, string, string);
void release_io();
//!Sampler
void do_one_doc(int num_words_in_doc, LDA::unigram_document *& doc,
topicCounts & current_topic_counts,
atomic<topic_t> *& tokens_per_topic,
topic_t *& document_topic_counts, topic_t *& document_topic_index,
int& non_zero_topics, double &Abar, double &Bbar,
double *& C_cac_coeff, double *& topic_term_scores,
vector<change_elem_t> *& updates);
void sample_topics(update_t* upd, vector<change_elem_t> *updates);
private:
TypeTopicCounts& _ttc;
Parameter& _alpha;
Parameter& _beta;
bool ignore_old_topic;
int _num_words, _num_topics;
//!Reader
DocumentReader *_wdoc_rdr, *_tdoc_rdr;
DocumentWriter *_tdoc_writer;
//!Sampler
//!The structures needed to setup boost RNG
//!Its a combination of a variate generator
//!and distribution object. We create an
//!array of RNGs since its hard to maintain
//!thread local state in TBB. We choose an
//!index into the array randomly and hope
//!different threads land up at different
//!RNGS
base_generator_type *generators[NUM_RNGS];
uniform_real<> *uni_dists[NUM_RNGS];
variate_generator<base_generator_type&, boost::uniform_real<> >
*unif01[NUM_RNGS];
long rng_ind;
//!Optimizer
double *part_grads, //!Local Alphas into which we accumulate the gradients
part_grads_top_indep; //!Local AlphaBar
int tau; //!The number documents to accumulate gradients
double eta; //!The fraction of the gradient to be merged into global alphas
};
#endif /* UNIGRAM_MODEL_TRAINER_H_ */
|
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
@class MSURLSessionDataTask;
@class MSGraphDirectoryObjectRequestBuilder;
@class MSGraphOwnedDevicesCollectionRequestBuilder;
@class MSGraphRegisteredDevicesCollectionRequestBuilder;
@class MSGraphDirectReportsCollectionRequestBuilder;
@class MSGraphMemberOfCollectionRequestBuilder;
@class MSGraphCreatedObjectsCollectionRequestBuilder;
@class MSGraphOwnedObjectsCollectionRequestBuilder;
@class MSGraphMessageRequestBuilder;
@class MSGraphMessagesCollectionRequestBuilder;
@class MSGraphMailFolderRequestBuilder;
@class MSGraphMailFoldersCollectionRequestBuilder;
@class MSGraphCalendarRequestBuilder;
@class MSGraphCalendarsCollectionRequestBuilder;
@class MSGraphCalendarGroupRequestBuilder;
@class MSGraphCalendarGroupsCollectionRequestBuilder;
@class MSGraphEventRequestBuilder;
@class MSGraphCalendarViewCollectionRequestBuilder;
@class MSGraphEventsCollectionRequestBuilder;
@class MSGraphContactRequestBuilder;
@class MSGraphContactsCollectionRequestBuilder;
@class MSGraphContactFolderRequestBuilder;
@class MSGraphContactFoldersCollectionRequestBuilder;
@class MSGraphProfilePhotoRequestBuilder;
@class MSGraphDriveRequestBuilder;
#import "MSGraphModels.h"
#import "MSRequest.h"
@interface MSGraphUserRequest : MSRequest
- (MSURLSessionDataTask *)getWithCompletion:(void (^)(MSGraphUser *response, NSError *error))completionHandler;
- (MSURLSessionDataTask *)update:(MSGraphUser *)user withCompletion:(void (^)(MSGraphUser *response, NSError *error))completionHandler;
- (MSURLSessionDataTask *)deleteWithCompletion:(void(^)(NSError *error))completionHandler;
@end
|
#ifndef SkBlitRow_DEFINED
#define SkBlitRow_DEFINED
#include "SkBitmap.h"
#include "SkColor.h"
class SkBlitRow {
public:
enum Flags16 {
//! If set, the alpha parameter will be != 255
kGlobalAlpha_Flag = 0x01,
//! If set, the src colors may have alpha != 255
kSrcPixelAlpha_Flag = 0x02,
//! If set, the resulting 16bit colors should be dithered
kDither_Flag = 0x04
};
/** Function pointer that reads a scanline of src SkPMColors, and writes
a corresponding scanline of 16bit colors (specific format based on the
config passed to the Factory.
The x,y params are useful just for dithering
@param alpha A global alpha to be applied to all of the src colors
@param x The x coordinate of the beginning of the scanline
@param y THe y coordinate of the scanline
*/
typedef void (*Proc)(uint16_t* SK_RESTRICT dst,
const SkPMColor* SK_RESTRICT src,
int count, U8CPU alpha, int x, int y);
/** Function pointer that blends a single color with a row of 32-bit colors
onto a 32-bit destination
*/
typedef void (*ColorProc)(SkPMColor* dst, const SkPMColor* src, int count,
SkPMColor color);
//! Public entry-point to return a blit function ptr
static Proc Factory(unsigned flags, SkBitmap::Config);
///////////// D32 version
enum Flags32 {
kGlobalAlpha_Flag32 = 1 << 0,
kSrcPixelAlpha_Flag32 = 1 << 1,
};
/** Function pointer that blends 32bit colors onto a 32bit destination.
@param dst array of dst 32bit colors
@param src array of src 32bit colors (w/ or w/o alpha)
@param count number of colors to blend
@param alpha global alpha to be applied to all src colors
*/
typedef void (*Proc32)(uint32_t* SK_RESTRICT dst,
const SkPMColor* SK_RESTRICT src,
int count, U8CPU alpha);
static Proc32 Factory32(unsigned flags32);
/** Blend a single color onto a row of S32 pixels, writing the result
into a row of D32 pixels. src and dst may be the same memory, but
if they are not, they may not overlap.
*/
static void Color32(SkPMColor dst[], const SkPMColor src[],
int count, SkPMColor color);
static ColorProc ColorProcFactory();
/** These static functions are called by the Factory and Factory32
functions, and should return either NULL, or a
platform-specific function-ptr to be used in place of the
system default.
*/
static Proc32 PlatformProcs32(unsigned flags);
static Proc PlatformProcs565(unsigned flags);
static Proc PlatformProcs4444(unsigned flags);
static ColorProc PlatformColorProc();
private:
enum {
kFlags16_Mask = 7,
kFlags32_Mask = 3
};
};
/**
* Factory for blitmask procs
*/
class SkBlitMask {
public:
/**
* Function pointer that blits the mask into a device (dst) colorized
* by color. The number of pixels to blit is specified by width and height,
* but each scanline is offset by dstRB (rowbytes) and srcRB respectively.
*/
typedef void (*Proc)(void* dst, size_t dstRB, SkBitmap::Config dstConfig,
const uint8_t* mask, size_t maskRB, SkColor color,
int width, int height);
/* Public entry-point to return a blitmask function ptr
*/
static Proc Factory(SkBitmap::Config dstConfig, SkColor color);
/* return either platform specific optimized blitmask function-ptr,
* or NULL if no optimized
*/
static Proc PlatformProcs(SkBitmap::Config dstConfig, SkColor color);
};
#endif
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <axis2_conf_ctx.h>
#include <axis2_svc_grp.h>
#include <axis2_const.h>
#include <axutil_allocator.h>
#include <axutil_env.h>
#include <stdio.h>
#include <cut_defs.h>
void
axis2_test_conf_ctx_init(axutil_env_t *env
)
{
struct axis2_conf *conf = NULL;
struct axis2_svc_grp_ctx *svc_grp_ctx1 = NULL;
struct axis2_svc_grp_ctx *svc_grp_ctx2 = NULL;
struct axis2_svc_grp *svc_grp1 = NULL;
struct axis2_svc_grp *svc_grp2 = NULL;
struct axis2_conf_ctx *conf_ctx = NULL;
struct axis2_svc_ctx *svc_ctx1 = NULL;
struct axis2_svc_ctx *svc_ctx2 = NULL;
struct axis2_svc *svc1 = NULL;
struct axis2_svc *svc2 = NULL;
struct axutil_qname *qname1 = NULL;
struct axutil_qname *qname2 = NULL;
struct axis2_op_ctx *op_ctx1 = NULL;
struct axis2_op_ctx *op_ctx2 = NULL;
struct axis2_op *op = NULL;
struct axutil_hash_t *op_ctx_map = NULL;
struct axutil_hash_t *svc_ctx_map = NULL;
struct axutil_hash_t *svc_grp_ctx_map = NULL;
axis2_status_t status = AXIS2_FAILURE;
conf = axis2_conf_create(env);
CUT_ASSERT_PTR_NOT_EQUAL(conf, NULL, 1);
conf_ctx = axis2_conf_ctx_create(env, conf);
CUT_ASSERT_PTR_NOT_EQUAL(conf_ctx, NULL, 1);
svc_grp1 = axis2_svc_grp_create(env);
CUT_ASSERT_PTR_NOT_EQUAL(svc_grp1, NULL, 0);
svc_grp2 = axis2_svc_grp_create(env);
CUT_ASSERT_PTR_NOT_EQUAL(svc_grp2, NULL, 0);
svc_grp_ctx1 = axis2_svc_grp_ctx_create(env, svc_grp1, conf_ctx);
CUT_ASSERT_PTR_NOT_EQUAL(svc_grp_ctx1, NULL, 0);
svc_grp_ctx2 = axis2_svc_grp_ctx_create(env, svc_grp2, conf_ctx);
CUT_ASSERT_PTR_NOT_EQUAL(svc_grp_ctx2, NULL, 0);
qname1 = axutil_qname_create(env, "name1", NULL, NULL);
CUT_ASSERT_PTR_NOT_EQUAL(qname1, NULL, 0);
qname2 = axutil_qname_create(env, "name2", NULL, NULL);
CUT_ASSERT_PTR_NOT_EQUAL(qname2, NULL, 0);
svc1 = axis2_svc_create_with_qname(env, qname1);
CUT_ASSERT_PTR_NOT_EQUAL(svc1, NULL, 0);
svc2 = axis2_svc_create_with_qname(env, qname2);
CUT_ASSERT_PTR_NOT_EQUAL(svc2, NULL, 0);
svc_ctx1 = axis2_svc_ctx_create(env, svc1, svc_grp_ctx1);
CUT_ASSERT_PTR_NOT_EQUAL(svc_ctx1, NULL, 0);
svc_ctx2 = axis2_svc_ctx_create(env, svc2, svc_grp_ctx2);
CUT_ASSERT_PTR_NOT_EQUAL(svc_ctx1, NULL, 0);
op = axis2_op_create(env);
CUT_ASSERT_PTR_NOT_EQUAL(op, NULL, 0);
op_ctx1 = axis2_op_ctx_create(env, op, svc_ctx1);
CUT_ASSERT_PTR_NOT_EQUAL(op_ctx1, NULL, 0);
op_ctx2 = axis2_op_ctx_create(env, op, svc_ctx2);
CUT_ASSERT_PTR_NOT_EQUAL(op_ctx2, NULL, 0);
op_ctx_map = axis2_conf_ctx_get_op_ctx_map(conf_ctx, env);
CUT_ASSERT_PTR_NOT_EQUAL(op_ctx_map, NULL, 0);
if (op_ctx_map)
{
axutil_hash_set(op_ctx_map, "op_ctx1", AXIS2_HASH_KEY_STRING, op_ctx1);
axutil_hash_set(op_ctx_map, "op_ctx2", AXIS2_HASH_KEY_STRING, op_ctx2);
}
svc_ctx_map = axis2_conf_ctx_get_svc_ctx_map(conf_ctx, env);
CUT_ASSERT_PTR_NOT_EQUAL(svc_ctx_map, NULL, 0);
if (svc_ctx_map)
{
axutil_hash_set(svc_ctx_map, "svc_ctx1", AXIS2_HASH_KEY_STRING,
svc_ctx1);
axutil_hash_set(svc_ctx_map, "svc_ctx2", AXIS2_HASH_KEY_STRING,
svc_ctx2);
}
svc_grp_ctx_map = axis2_conf_ctx_get_svc_grp_ctx_map(conf_ctx, env);
CUT_ASSERT_PTR_NOT_EQUAL(svc_grp_ctx_map, NULL, 0);
if (svc_grp_ctx_map)
{
axutil_hash_set(svc_ctx_map, "svc_grp_ctx1", AXIS2_HASH_KEY_STRING,
svc_grp_ctx1);
axutil_hash_set(svc_ctx_map, "svc_grp_ctx2", AXIS2_HASH_KEY_STRING,
svc_grp_ctx2);
}
status = axis2_conf_ctx_init(conf_ctx, env, conf);
CUT_ASSERT_INT_EQUAL(status, AXIS2_SUCCESS, 0);
printf("Error code : %d\n", env->error->error_number);
/*
CUT_ASSERT_INT_EQUAL(env->error->status_code, AXIS2_SUCCESS, 0);
*/
/* To avoid warning of not using cut_str_equal */
CUT_ASSERT_STR_EQUAL("", "", 0);
axis2_conf_ctx_free(conf_ctx, env);
}
int
main(
)
{
axutil_env_t *env = cut_setup_env("Context");
CUT_ASSERT(env != NULL);
if (env) {
axis2_test_conf_ctx_init(env);
axutil_env_free(env);
}
CUT_RETURN_ON_FAILURE(-1);
return 0;
}
|
////////////////////////////////////////////////////////////////////////////////
/// DISCLAIMER
///
/// Copyright 2014-2016 ArangoDB GmbH, Cologne, Germany
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
///
/// 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.
///
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
///
/// @author Dr. Frank Celler
////////////////////////////////////////////////////////////////////////////////
#ifndef ARANGODB_BASICS_MAKE__UNIQUE_H
#define ARANGODB_BASICS_MAKE__UNIQUE_H 1
#include <cstddef>
#include <memory>
#include <type_traits>
#include <utility>
// VS 2013 and VS 2015 already provide std::make_unique
#ifndef _WIN32
// c++98: 199711 (not supported)
// c++11: 201103 (no std::make_unique)
// c++14: 201402 (std::make_unique included)
#if __cplusplus == 201103L
////////////////////////////////////////////////////////////////////////////////
/// Provide a make_unique() function for C++11 too
/// http://stackoverflow.com/questions/17902405/how-to-implement-make-unique-function-in-c11
////////////////////////////////////////////////////////////////////////////////
namespace std {
template <class T>
struct _Unique_if {
typedef unique_ptr<T> _Single_object;
};
template <class T>
struct _Unique_if<T[]> {
typedef unique_ptr<T[]> _Unknown_bound;
};
template <class T, size_t N>
struct _Unique_if<T[N]> {
typedef void _Known_bound;
};
template <class T, class... Args>
typename _Unique_if<T>::_Single_object make_unique(Args&&... args) {
return unique_ptr<T>(new T(std::forward<Args>(args)...));
}
template <class T>
typename _Unique_if<T>::_Unknown_bound make_unique(size_t n) {
typedef typename remove_extent<T>::type U;
return unique_ptr<T>(new U[n]());
}
template <class T, class... Args>
typename _Unique_if<T>::_Known_bound make_unique(Args&&...) = delete;
}
#endif
#endif
#endif
|
/*
Copyright 2017-present the Material Components for iOS 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.
*/
#import <UIKit/UIKit.h>
@class MDCTabBarIndicatorAttributes;
/** View responsible for drawing the indicator behind tab content and animating changes. */
@interface MDCTabBarIndicatorView : UIView
/**
Called to indicate that the indicator should update to display new attributes. This method may be
called from an implicit animation block.
*/
- (void)applySelectionIndicatorAttributes:(MDCTabBarIndicatorAttributes *)attributes;
@end
|
@interface QCDashboardButton : NSButton
{
NSInteger _direction; // 92 = 0x5c
NSMutableDictionary *_attr; // 96 = 0x60
NSInteger _trackingRectTag; // 100 = 0x64
BOOL _active; // 104 = 0x68
BOOL _displayCapsule; // 105 = 0x69
NSRect _activeRect; // 108 = 0x6c
NSString *_string; // 124 = 0x7c
id _controller; // 128 = 0x80
}
- (id)initWithFrame:(NSRect)FrameRect andController:(id)fp24;
- (void)dealloc;
- (BOOL)isOpaque;
- (void)drawRect:(NSRect)rect;
- (void)setDirection:(int)fp8;
- (void)setIndex:(NSUInteger)fp8 count:(NSUInteger)fp12;
- (void)mouseUp:(NSEvent*)theEvent;
- (void)mouseDown:(NSEvent*)theEvent;
- (void)viewDidMoveToWindow;
- (void)mouseEntered:(NSEvent*)theEvent;
- (void)mouseExited:(NSEvent*)theEvent;
- (BOOL)mouseDownCanMoveWindow;
@end
@interface QCDashboardButton (Private)
- (id)leftArrowPathInRect:(NSRect)fp8;
- (id)rightArrowPathInRect:(NSRect)fp8;
- (id)capsulePathInRect:(NSRect)fp8;
- (NSSize)sizeForString;
- (void)updateTrackingRect;
- (void)drawHoverTarget;
- (void)drawCapsule;
- (NSRect)capsuleRectForDirection;
- (NSRect)hoverRectForDirection;
- (BOOL)checkPoint:(NSPoint)fp8;
@end
|
// 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 MEDIA_CDM_JSON_WEB_KEY_H_
#define MEDIA_CDM_JSON_WEB_KEY_H_
#include <stdint.h>
#include <string>
#include <utility>
#include <vector>
#include "media/base/media_export.h"
#include "media/base/media_keys.h"
namespace media {
// The ClearKey license request format is a JSON object containing the following
// members (http://w3c.github.io/encrypted-media/#clear-key-request-format):
// "kids" : An array of key IDs. Each element of the array is the base64url
// encoding of the octet sequence containing the key ID value.
// "type" : The requested MediaKeySessionType.
// An example:
// { "kids":["67ef0gd8pvfd0","77ef0gd8pvfd0"], "type":"temporary" }
// The ClearKey license format is a JSON Web Key (JWK) Set containing
// representation of the symmetric key to be used for decryption.
// (http://w3c.github.io/encrypted-media/#clear-key-license-format)
// For each JWK in the set, the parameter values are as follows:
// "kty" (key type) : "oct" (octet sequence)
// "alg" (algorithm) : "A128KW" (AES key wrap using a 128-bit key)
// "k" (key value) : The base64url encoding of the octet sequence
// containing the symmetric key value.
// "kid" (key ID) : The base64url encoding of the octet sequence
// containing the key ID value.
// The JSON object may have an optional "type" member value, which may be
// any of the SessionType values. If not specified, the default value of
// "temporary" is used.
// A JSON Web Key Set looks like the following in JSON:
// { "keys": [ JWK1, JWK2, ... ], "type":"temporary" }
// A symmetric keys JWK looks like the following in JSON:
// { "kty":"oct",
// "alg":"A128KW",
// "kid":"AQIDBAUGBwgJCgsMDQ4PEA",
// "k":"FBUWFxgZGhscHR4fICEiIw" }
// There may be other properties specified, but they are ignored.
// Ref: http://tools.ietf.org/html/draft-ietf-jose-json-web-key and:
// http://tools.ietf.org/html/draft-jones-jose-json-private-and-symmetric-key
// Vector of key IDs.
typedef std::vector<std::vector<uint8_t>> KeyIdList;
// Vector of [key_id, key_value] pairs. Values are raw binary data, stored in
// strings for convenience.
typedef std::pair<std::string, std::string> KeyIdAndKeyPair;
typedef std::vector<KeyIdAndKeyPair> KeyIdAndKeyPairs;
// Converts a single |key|, |key_id| pair to a JSON Web Key Set.
MEDIA_EXPORT std::string GenerateJWKSet(const uint8_t* key,
int key_length,
const uint8_t* key_id,
int key_id_length);
// Converts a set of |key|, |key_id| pairs to a JSON Web Key Set.
MEDIA_EXPORT std::string GenerateJWKSet(const KeyIdAndKeyPairs& keys,
MediaKeys::SessionType session_type);
// Extracts the JSON Web Keys from a JSON Web Key Set. If |input| looks like
// a valid JWK Set, then true is returned and |keys| and |session_type| are
// updated to contain the values found. Otherwise return false.
MEDIA_EXPORT bool ExtractKeysFromJWKSet(const std::string& jwk_set,
KeyIdAndKeyPairs* keys,
MediaKeys::SessionType* session_type);
// Extracts the Key Ids from a Key IDs Initialization Data
// (https://w3c.github.io/encrypted-media/keyids-format.html). If |input| looks
// valid, then true is returned and |key_ids| is updated to contain the values
// found. Otherwise return false and |error_message| contains the reason.
MEDIA_EXPORT bool ExtractKeyIdsFromKeyIdsInitData(const std::string& input,
KeyIdList* key_ids,
std::string* error_message);
// Creates a license request message for the |key_ids| and |session_type|
// specified. |license| is updated to contain the resulting JSON string.
MEDIA_EXPORT void CreateLicenseRequest(const KeyIdList& key_ids,
MediaKeys::SessionType session_type,
std::vector<uint8_t>* license);
// Creates a keyIDs init_data message for the |key_ids| specified.
// |key_ids_init_data| is updated to contain the resulting JSON string.
MEDIA_EXPORT void CreateKeyIdsInitData(const KeyIdList& key_ids,
std::vector<uint8_t>* key_ids_init_data);
// Extract the first key from the license request message. Returns true if
// |license| is a valid license request and contains at least one key,
// otherwise false and |first_key| is not touched.
MEDIA_EXPORT bool ExtractFirstKeyIdFromLicenseRequest(
const std::vector<uint8_t>& license,
std::vector<uint8_t>* first_key);
} // namespace media
#endif // MEDIA_CDM_JSON_WEB_KEY_H_
|
// =================================================================================================
// Copyright 2007 Adobe Systems Incorporated
// All Rights Reserved.
//
// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms
// of the Adobe license agreement accompanying it.
//
// =================================================================================================
#ifndef XMPQE_GLOBALS_H
#define XMPQE_GLOBALS_H
#include <string>
#include <cstdlib> // Various libraries needed for gcc 4.x builds.
#include <cstring>
#include <cstdio>
//sanity check platform/endianess
#if !defined(WIN_ENV) && !defined(MAC_ENV) && !defined(UNIX_ENV) && !defined(IOS_ENV)
#error "XMP environment error - must define one of MAC_ENV, WIN_ENV, UNIX_ENV or IOS_ENV"
#endif
#ifdef WIN_ENV
#define XMPQE_LITTLE_ENDIAN 1
#elif (defined(MAC_ENV) || defined(UNIX_ENV) || defined(IOS_ENV))
#if __BIG_ENDIAN__
#define XMPQE_BIG_ENDIAN 1
#elif __LITTLE_ENDIAN__
#define XMPQE_LITTLE_ENDIAN 1
#else
#error "Neither __BIG_ENDIAN__ nor __LITTLE_ENDIAN__ is set"
#endif
#else
#error "Unknown build environment, neither WIN_ENV nor MAC_ENV nor UNIX_ENV"
#endif
const static unsigned int XMPQE_BUFFERSIZE=4096; //should do for all my buffer output, but you never now (stdarg dilemma)
const char OMNI_CSTRING[]={0x41,0xE4,0xB8,0x80,0x42,0xE4,0xBA,0x8C,0x43,0xC3,0x96,0x44,0xF0,0x90,0x81,0x91,0x45,'\0'};
const char BOM_CSTRING[]={0xEF,0xBB,0xBF,'\0'}; // nb: forgetting the '\0' is a very evil mistake.
const std::string OMNI_STRING(OMNI_CSTRING);
// if plain utf8 conversion, mac/win local encoding is a different story...
const std::string OMNI_BUGINESE("A<E4 B8 80>B<E4 BA 8C>C<C3 96>D<F0 90 81 91>E");
// if utf16LE
const std::string OMNI_BUGINESE_16LE("A<00 4E>B<8C 4E>C<D6 00>D<00 D8 51 DC>E");
// if utf16 BE
const std::string OMNI_BUGINESE_16BE("A<4E 00>B<4E 8C>C<00 D6>D<D8 00 DC 51>E");
// degraded version of omni-strings
// (sometimes useful for asserts after roundtrips, for setting values see OMNI_STRING in TestCase.h)
// ==> filed bug 2302354 on this issue.
#if WIN_ENV
// a *wrongly* degraded omni-string (non-BMP-char to ??)
const std::string DEG_OMNI_BUGINESE("A?B?C<C3 96>D??E");
// ditto albeit MacRoman encoding
const std::string MAC_OMNI_BUGINESE("A?B?C<85>D??E");
#else
// a *correctly* degraded omni-string (non-BMP-char to ?)
const std::string DEG_OMNI_BUGINESE("A?B?C<C3 96>D?E");
// ditto albeit MacRoman encoding
const std::string MAC_OMNI_BUGINESE("A?B?C<85>D?E");
#endif
// -> #issue# the non-BMP character in OMNI_STRING between D and E gets converted
// into two question marks (wrong) , not into one (correct)
const char AEOEUE_WIN_LOCAL_CSTRING[]={0xC4,0xD6,0xDC,'\0'};
const char AEOEUE_MAC_LOCAL_CSTRING[]={0x80,0x85,0x86,'\0'};
const char AEOEUE_UTF8_CSTRING[]={0xC3, 0x84, 0xC3, 0x96, 0xC3, 0x9C,'\0'};
const std::string AEOEUE_UTF8(AEOEUE_UTF8_CSTRING);
const std::string AEOEUE_UTF8_BUGINESE("<C3 84 C3 96 C3 9C>");
const std::string AEOEUE_WIN_LOCAL_BUGINESE("<C4 D6 DC>");
const std::string AEOEUE_MAC_LOCAL_BUGINESE("<80 85 86>");
const std::string AEOEUE_WIN_MOJIBAKE_BUGINESE("<E2 82 AC E2 80 A6 E2 80 A0>");
const std::string AEOEUE_MAC_MOJIBAKE_BUGINESE("<C6 92 C3 B7 E2 80 B9>");
const std::string AEOEUE_LATIN1_MOJIBAKE_BUGINESE("<C2 80 C2 85 C2 86>");
#if MAC_ENV
const std::string AEOEUE_LOCAL = std::string(AEOEUE_MAC_LOCAL_CSTRING);
const std::string AEOEUE_WIN_LOCAL_TO_UTF8 = AEOEUE_MAC_MOJIBAKE_BUGINESE;
const std::string AEOEUE_MAC_LOCAL_TO_UTF8 = AEOEUE_UTF8_BUGINESE;
#elif WIN_ENV
const std::string AEOEUE_LOCAL = std::string(AEOEUE_WIN_LOCAL_CSTRING);
const std::string AEOEUE_WIN_LOCAL_TO_UTF8 = AEOEUE_UTF8_BUGINESE;
const std::string AEOEUE_MAC_LOCAL_TO_UTF8 = AEOEUE_WIN_MOJIBAKE_BUGINESE;
#else
// windows local encoding will work for UNIX (Latin1), but mac will result MOJIBAKE
const std::string AEOEUE_WIN_LOCAL_TO_UTF8 = AEOEUE_UTF8_BUGINESE;
const std::string AEOEUE_MAC_LOCAL_TO_UTF8 = AEOEUE_LATIN1_MOJIBAKE_BUGINESE;
#endif
#endif // XMPQE_GLOBALS_H
|
/*-
* This file is in the public domain.
*/
/* $FreeBSD$ */
#include <i386/pcb.h>
|
/*
* Copyright (C) 2013 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SharedWorkerRepositoryClientImpl_h
#define SharedWorkerRepositoryClientImpl_h
#include "core/workers/SharedWorkerRepositoryClient.h"
#include "wtf/Noncopyable.h"
#include "wtf/PassOwnPtr.h"
#include "wtf/PassRefPtr.h"
namespace blink {
class WebSharedWorkerRepositoryClient;
class SharedWorkerRepositoryClientImpl final : public SharedWorkerRepositoryClient {
WTF_MAKE_NONCOPYABLE(SharedWorkerRepositoryClientImpl);
WTF_MAKE_FAST_ALLOCATED(SharedWorkerRepositoryClientImpl);
public:
static PassOwnPtr<SharedWorkerRepositoryClientImpl> create(WebSharedWorkerRepositoryClient* client)
{
return adoptPtr(new SharedWorkerRepositoryClientImpl(client));
}
~SharedWorkerRepositoryClientImpl() override { }
void connect(SharedWorker*, PassOwnPtr<WebMessagePortChannel>, const KURL&, const String& name, ExceptionState&) override;
void documentDetached(Document*) override;
private:
explicit SharedWorkerRepositoryClientImpl(WebSharedWorkerRepositoryClient*);
WebSharedWorkerRepositoryClient* m_client;
};
} // namespace blink
#endif // SharedWorkerRepositoryClientImpl_h
|
// RUN: %clang_cc1 -triple i386-apple-darwin9 %s -emit-llvm -o - | FileCheck -check-prefix CHECK-X32 %s
// CHECK-X32: %struct.s0 = type { i64, i64, i32, [12 x i32] }
// CHECK-X32: %struct.s1 = type { [15 x i32], %struct.s0 }
// RUN: %clang_cc1 -triple x86_64-apple-darwin9 %s -emit-llvm -o - | FileCheck -check-prefix CHECK-X64 %s
// CHECK-X64: %struct.s0 = type <{ i64, i64, i32, [12 x i32] }>
// CHECK-X64: %struct.s1 = type <{ [15 x i32], %struct.s0 }>
// rdar://problem/7095436
#pragma pack(4)
struct s0 {
long long a __attribute__((aligned(8)));
long long b __attribute__((aligned(8)));
unsigned int c __attribute__((aligned(8)));
int d[12];
} a;
struct s1 {
int a[15];
struct s0 b;
} b;
|
//-*****************************************************************************
//
// Copyright (c) 2009-2012,
// Sony Pictures Imageworks Inc. and
// Industrial Light & Magic, a division of Lucasfilm Entertainment Company Ltd.
//
// 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 Industrial Light & Magic nor the names of
// its contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//-*****************************************************************************
#ifndef _Alembic_Util_Foundation_h_
#define _Alembic_Util_Foundation_h_
// tr1/memory is not avaliable in Visual Studio.
#if !defined(_MSC_VER)
#if defined(__GXX_EXPERIMENTAL_CXX0X) || __cplusplus >= 201103L
#include <unordered_map>
#else
#include <tr1/memory>
#include <tr1/unordered_map>
#endif
#elif _MSC_VER <= 1600
// no tr1 in these older versions of MS VS so fall back to boost
#include <boost/type_traits.hpp>
#include <boost/ref.hpp>
#include <boost/format.hpp>
#include <boost/smart_ptr.hpp>
#include <boost/static_assert.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/utility.hpp>
#include <boost/cstdint.hpp>
#include <boost/array.hpp>
#include <boost/operators.hpp>
#include <boost/foreach.hpp>
#include <boost/unordered_map.hpp>
#else
#include <unordered_map>
#endif
#include <memory>
#include <half.h>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <exception>
#include <limits>
#include <map>
#include <string>
#include <vector>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#ifdef _MSC_VER
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
// needed for mutex stuff
#include <Windows.h>
#endif
#ifndef ALEMBIC_VERSION_NS
#define ALEMBIC_VERSION_NS v6
#endif
namespace Alembic {
namespace Util {
namespace ALEMBIC_VERSION_NS {
#if defined( _MSC_VER ) && _MSC_VER <= 1600
using boost::dynamic_pointer_cast;
using boost::enable_shared_from_this;
using boost::shared_ptr;
using boost::static_pointer_cast;
using boost::weak_ptr;
using boost::unordered_map;
#elif defined(__GXX_EXPERIMENTAL_CXX0X) || __cplusplus >= 201103L
using std::dynamic_pointer_cast;
using std::enable_shared_from_this;
using std::shared_ptr;
using std::static_pointer_cast;
using std::weak_ptr;
using std::unordered_map;
#else
using std::tr1::dynamic_pointer_cast;
using std::tr1::enable_shared_from_this;
using std::tr1::shared_ptr;
using std::tr1::static_pointer_cast;
using std::tr1::weak_ptr;
using std::tr1::unordered_map;
#endif
using std::auto_ptr;
// similiar to boost::noncopyable
// explicitly hides copy construction and copy assignment
class noncopyable
{
protected:
noncopyable() {}
~noncopyable() {}
private:
noncopyable( const noncopyable& );
const noncopyable& operator=( const noncopyable& );
};
// similiar to boost::totally_ordered
// only need < and == operators and this fills in the rest
template < class T >
class totally_ordered
{
friend bool operator > ( const T& x, const T& y )
{
return y < x;
}
friend bool operator <= ( const T& x, const T& y )
{
return !( y < x );
}
friend bool operator >= ( const T& x, const T& y )
{
return !( x < y );
}
friend bool operator != ( const T& x, const T& y )
{
return !( x == y );
}
};
// inspired by boost::mutex
#ifdef _MSC_VER
class mutex : noncopyable
{
public:
mutex()
{
m = CreateMutex( NULL, FALSE, NULL );
}
~mutex()
{
CloseHandle( m );
}
void lock()
{
WaitForSingleObject( m, INFINITE );
}
void unlock()
{
ReleaseMutex( m );
}
private:
HANDLE m;
};
#else
class mutex : noncopyable
{
public:
mutex()
{
pthread_mutex_init( &m, NULL );
}
~mutex()
{
pthread_mutex_destroy( &m );
}
void lock()
{
pthread_mutex_lock( &m );
}
void unlock()
{
pthread_mutex_unlock( &m );
}
private:
pthread_mutex_t m;
};
#endif
class scoped_lock : noncopyable
{
public:
scoped_lock( mutex & l ) : m( l )
{
m.lock();
}
~scoped_lock()
{
m.unlock();
}
private:
mutex & m;
};
} // End namespace ALEMBIC_VERSION_NS
using namespace ALEMBIC_VERSION_NS;
} // End namespace Util
} // End namespace Alembic
#endif
|
/**
* \private
*/
struct genhash_entry_t {
/** The key for this entry */
void *key;
/** The value for this entry */
void *value;
/** Pointer to the next entry */
struct genhash_entry_t *next;
};
struct _genhash {
size_t size;
struct hash_ops ops;
struct genhash_entry_t *buckets[];
};
|
int Pow(int, int);
int Abs(int);
int Max(int, int);
double Average(int, int);
double Ln(int);
|
/* Area: closure_call
Purpose: Check return value ushort.
Limitations: none.
PR: none.
Originator: <andreast@gcc.gnu.org> 20030828 */
/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */
#include "ffitest.h"
static void cls_ret_ushort_fn(ffi_cif* cif,void* resp,void** args,
void* userdata)
{
*(ffi_arg*)resp = *(unsigned short *)args[0];
printf("%d: %d\n",*(unsigned short *)args[0],
*(ffi_arg*)resp);
}
typedef unsigned short (*cls_ret_ushort)(unsigned short);
int main (void)
{
ffi_cif cif;
#ifndef USING_MMAP
static ffi_closure cl;
#endif
ffi_closure *pcl;
ffi_type * cl_arg_types[2];
unsigned short res;
#ifdef USING_MMAP
pcl = allocate_mmap (sizeof(ffi_closure));
#else
pcl = &cl;
#endif
cl_arg_types[0] = &ffi_type_ushort;
cl_arg_types[1] = NULL;
/* Initialize the cif */
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
&ffi_type_ushort, cl_arg_types) == FFI_OK);
CHECK(ffi_prep_closure(pcl, &cif, cls_ret_ushort_fn, NULL) == FFI_OK);
res = (*((cls_ret_ushort)pcl))(65535);
/* { dg-output "65535: 65535" } */
printf("res: %d\n",res);
/* { dg-output "\nres: 65535" } */
exit(0);
}
|
/*
* Copyright (c) 2008-2015 Travis Geiselbrecht
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files
* (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <compiler.h>
#include <debug.h>
#include <trace.h>
/* Default implementation of panic time getc/putc.
* Just calls through to the underlying dputc/dgetc implementation
* unless the platform overrides it.
*/
__WEAK void platform_pputc(char c)
{
return platform_dputc(c);
}
__WEAK int platform_pgetc(char *c, bool wait)
{
return platform_dgetc(c, wait);
}
|
/*
* This source file is part of MyGUI. For the latest info, see http://mygui.info/
* Distributed under the MIT License
* (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
*/
#ifndef MYGUI_LAYOUT_MANAGER_H_
#define MYGUI_LAYOUT_MANAGER_H_
#include "MyGUI_Prerequest.h"
#include "MyGUI_Singleton.h"
#include "MyGUI_XmlDocument.h"
#include "MyGUI_WidgetDefines.h"
#include "MyGUI_ResourceLayout.h"
#include "MyGUI_BackwardCompatibility.h"
namespace MyGUI
{
typedef delegates::CMultiDelegate3<Widget*, const std::string&, const std::string&> EventHandle_AddUserStringDelegate;
class MYGUI_EXPORT LayoutManager :
public Singleton<LayoutManager>,
public MemberObsolete<LayoutManager>
{
public:
LayoutManager();
void initialise();
void shutdown();
/** Load layout file
@param _file name of layout
@param _prefix will be added to all loaded widgets names
@param _parent widget to load on
@return Return vector of pointers of loaded root widgets (root == without parents)
*/
VectorWidgetPtr loadLayout(const std::string& _file, const std::string& _prefix = "", Widget* _parent = nullptr);
/** Unload layout (actually deletes vector of widgets returned by loadLayout) */
void unloadLayout(VectorWidgetPtr& _widgets);
/** Get ResourceLayout by name */
ResourceLayout* getByName(const std::string& _name, bool _throw = true) const;
/** Check if skin with specified name exist */
bool isExist(const std::string& _name) const;
/** Event : Multidelegate. UserString was added from layout.\n
signature : void method(MyGUI::Widget* _widget, const std::string& _key, const std::string& _value)
@param _widget Widget that got new UserString.
@param _key UserString key.
@param _key UserString value.
@note Happens only when UserString was loaded from layout, but not when it was added in code.
*/
EventHandle_AddUserStringDelegate eventAddUserString;
const std::string& getCurrentLayout() const;
private:
void _load(xml::ElementPtr _node, const std::string& _file, Version _version);
private:
bool mIsInitialise;
std::string mCurrentLayoutName;
std::string mXmlLayoutTagName;
};
} // namespace MyGUI
#endif // MYGUI_LAYOUT_MANAGER_H_
|
//
// AppDelegate.h
// Third_Homework
//
// Created by zhuzhu on 15/11/3.
// Copyright © 2015年 zhuzhu. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
//
// SwiftR Mac.h
// SwiftR Mac
//
// Created by Adam Hartford on 4/16/15.
// Copyright (c) 2015 Adam Hartford. All rights reserved.
//
#import <Cocoa/Cocoa.h>
//! Project version number for SwiftR Mac.
FOUNDATION_EXPORT double SwiftR_MacVersionNumber;
//! Project version string for SwiftR Mac.
FOUNDATION_EXPORT const unsigned char SwiftR_MacVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <SwiftR_Mac/PublicHeader.h>
|
//
// The MIT License (MIT)
//
// Copyright (c) 2013 Joan Martin (vilanovi@gmail.com)
// 2014 Suyeol Jeon (http://xoul.kr)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
#import <UIKit/UIKit.h>
typedef struct __UICornerInset
{
CGFloat topLeft;
CGFloat topRight;
CGFloat bottomLeft;
CGFloat bottomRight;
} UICornerInset;
UIKIT_EXTERN const UICornerInset UICornerInsetZero;
UIKIT_STATIC_INLINE UICornerInset UICornerInsetMake(CGFloat topLeft, CGFloat topRight, CGFloat bottomLeft, CGFloat bottomRight)
{
UICornerInset cornerInset = {topLeft, topRight, bottomLeft, bottomRight};
return cornerInset;
}
UIKIT_STATIC_INLINE UICornerInset UICornerInsetMakeWithRadius(CGFloat radius)
{
UICornerInset cornerInset = {radius, radius, radius, radius};
return cornerInset;
}
UIKIT_STATIC_INLINE BOOL UICornerInsetEqualToCornerInset(UICornerInset cornerInset1, UICornerInset cornerInset2)
{
return
cornerInset1.topLeft == cornerInset2.topLeft &&
cornerInset1.topRight == cornerInset2.topRight &&
cornerInset1.bottomLeft == cornerInset2.bottomLeft &&
cornerInset1.bottomRight == cornerInset2.bottomRight;
}
FOUNDATION_EXTERN NSString* NSStringFromUICornerInset(UICornerInset cornerInset);
typedef enum __UIImageTintedStyle
{
UIImageTintedStyleKeepingAlpha = 1,
UIImageTintedStyleOverAlpha = 2
} UIImageTintedStyle;
typedef enum __UIImageGradientDirection
{
UIImageGradientDirectionVertical = 1,
UIImageGradientDirectionHorizontal = 2,
} UIImageGradientDirection;
@interface UIImage (Additions)
/*
* Create images from colors
*/
+ (UIImage*)imageWithColor:(UIColor*)color;
+ (UIImage*)imageWithColor:(UIColor*)color size:(CGSize)size;
+ (UIImage*)imageWithColor:(UIColor*)color borderAttributes:(NSDictionary*)borderAttributes size:(CGSize)size;
+ (UIImage*)imageWithColor:(UIColor*)color borderAttributes:(NSDictionary*)borderAttributes size:(CGSize)size cornerRadius:(CGFloat)cornerRadius;
+ (UIImage*)imageWithColor:(UIColor*)color borderAttributes:(NSDictionary*)borderAttributes size:(CGSize)size cornerInset:(UICornerInset)cornerInset;
/*
* Create rezisable images from colors
*/
+ (UIImage*)resizableImageWithColor:(UIColor*)color;
+ (UIImage*)resizableImageWithColor:(UIColor*)color cornerRadius:(CGFloat)cornerRadius;
+ (UIImage*)resizableImageWithColor:(UIColor*)color borderAttributes:(NSDictionary*)borderAttributes cornerRadius:(CGFloat)cornerRadius;
+ (UIImage*)resizableImageWithColor:(UIColor*)color borderAttributes:(NSDictionary*)borderAttributes cornerInset:(UICornerInset)cornerInset;
+ (UIImage*)blackColorImage;
+ (UIImage*)darkGrayColorImage;
+ (UIImage*)lightGrayColorImage;
+ (UIImage*)whiteColorImage;
+ (UIImage*)grayColorImage;
+ (UIImage*)redColorImage;
+ (UIImage*)greenColorImage;
+ (UIImage*)blueColorImage;
+ (UIImage*)cyanColorImage;
+ (UIImage*)yellowColorImage;
+ (UIImage*)magentaColorImage;
+ (UIImage*)orangeColorImage;
+ (UIImage*)purpleColorImage;
+ (UIImage*)brownColorImage;
+ (UIImage*)clearColorImage;
/*
* Tint Images
*/
+ (UIImage*)imageNamed:(NSString *)name tintColor:(UIColor*)color style:(UIImageTintedStyle)tintStyle;
- (UIImage*)tintedImageWithColor:(UIColor*)color style:(UIImageTintedStyle)tintStyle;
/*
* Rounding corners
*/
- (UIImage*)imageWithRoundedBounds;
- (UIImage*)imageWithCornerRadius:(CGFloat)cornerRadius;
- (UIImage*)imageWithCornerInset:(UICornerInset)cornerInset;
- (BOOL)isValidCornerInset:(UICornerInset)cornerInset;
/*
* Drawing image on image
*/
- (UIImage*)imageAddingImage:(UIImage*)image;
- (UIImage*)imageAddingImage:(UIImage*)image offset:(CGPoint)offset;
/*
* Gradient image generation
*/
+ (UIImage*)imageWithGradient:(NSArray*)colors size:(CGSize)size direction:(UIImageGradientDirection)direction;
+ (UIImage*)resizableImageWithGradient:(NSArray*)colors size:(CGSize)size direction:(UIImageGradientDirection)direction;
@end
#pragma mark - Categories
@interface NSValue (UICornerInset)
+ (NSValue*)valueWithUICornerInset:(UICornerInset)cornerInset;
- (UICornerInset)UICornerInsetValue;
@end
|
#ifndef java_util_AbstractSequentialList_H
#define java_util_AbstractSequentialList_H
#include "java/util/AbstractList.h"
namespace java {
namespace util {
class ListIterator;
class Iterator;
class Collection;
}
namespace lang {
class Object;
class Class;
}
}
template<class T> class JArray;
namespace java {
namespace util {
class AbstractSequentialList : public ::java::util::AbstractList {
public:
enum {
mid_add_f7cd74a4,
mid_addAll_006cd2b7,
mid_get_29be6a55,
mid_iterator_40858c90,
mid_listIterator_4145ee6a,
mid_remove_29be6a55,
mid_set_211591b1,
max_mid
};
static ::java::lang::Class *class$;
static jmethodID *mids$;
static bool live$;
static jclass initializeClass(bool);
explicit AbstractSequentialList(jobject obj) : ::java::util::AbstractList(obj) {
if (obj != NULL)
env->getClass(initializeClass);
}
AbstractSequentialList(const AbstractSequentialList& obj) : ::java::util::AbstractList(obj) {}
void add(jint, const ::java::lang::Object &) const;
jboolean addAll(jint, const ::java::util::Collection &) const;
::java::lang::Object get(jint) const;
::java::util::Iterator iterator() const;
::java::util::ListIterator listIterator(jint) const;
::java::lang::Object remove(jint) const;
::java::lang::Object set(jint, const ::java::lang::Object &) const;
};
}
}
#include <Python.h>
namespace java {
namespace util {
extern PyTypeObject PY_TYPE(AbstractSequentialList);
class t_AbstractSequentialList {
public:
PyObject_HEAD
AbstractSequentialList object;
PyTypeObject *parameters[1];
static PyTypeObject **parameters_(t_AbstractSequentialList *self)
{
return (PyTypeObject **) &(self->parameters);
}
static PyObject *wrap_Object(const AbstractSequentialList&);
static PyObject *wrap_jobject(const jobject&);
static PyObject *wrap_Object(const AbstractSequentialList&, PyTypeObject *);
static PyObject *wrap_jobject(const jobject&, PyTypeObject *);
static void install(PyObject *module);
static void initialize(PyObject *module);
};
}
}
#endif
|
#include <kernel.h>
#include <tty.h>
#include <vt.h>
#include <devtty.h>
#include "vc_asm.h"
unsigned char vt_mangle_6847(unsigned char c);
/* Use macros so that functions are kept identical to Kernel/vt.c */
#undef VT_MAP_CHAR
#define VT_MAP_CHAR(x) vt_mangle_6847(x)
#define VT_BASE ((uint8_t *) VC_BASE + 0x200 * (curtty - 2))
#define VT_WIDTH 32
#define VC (curtty - 2)
static unsigned char *cpos[2];
static unsigned char csave[2];
static uint8_t *char_addr(uint8_t y1, uint8_t x1)
{
return VT_BASE + VT_WIDTH * y1 + x1;
}
void vc_cursor_off(void)
{
if (cpos[VC])
vc_write_char(cpos[VC], csave[VC]);
}
void vc_cursor_on(int8_t y, int8_t x)
{
cpos[VC] = char_addr(y, x);
csave[VC] = vc_read_char(cpos[VC]);
vc_write_char(cpos[VC], 0x80); /* black square */
}
void vc_plot_char(int8_t y, int8_t x, uint16_t c)
{
vc_write_char(char_addr(y, x), VT_MAP_CHAR(c));
}
void vc_clear_lines(int8_t y, int8_t ct)
{
unsigned char *s = char_addr(y, 0);
vc_memset(s, ' ', ct * VT_WIDTH);
}
void vc_clear_across(int8_t y, int8_t x, int16_t l)
{
unsigned char *s = char_addr(y, x);
vc_memset(s, ' ', l);
}
void vc_vtattr_notify(void)
{
}
unsigned char vt_mangle_6847(unsigned char c)
{
if (c >= 96)
c -= 32;
c &= 0x3F;
return c;
}
|
/*
* linux/drivers/ide/legacy/gayle.c -- Amiga Gayle IDE Driver
*
* Created 9 Jul 1997 by Geert Uytterhoeven
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file COPYING in the main directory of this archive for
* more details.
*/
#include <linux/config.h>
#include <linux/types.h>
#include <linux/mm.h>
#include <linux/interrupt.h>
#include <linux/blkdev.h>
#include <linux/hdreg.h>
#include <linux/ide.h>
#include <linux/init.h>
#include <linux/zorro.h>
#include <asm/setup.h>
#include <asm/amigahw.h>
#include <asm/amigaints.h>
#include <asm/amigayle.h>
/*
* Bases of the IDE interfaces
*/
#define GAYLE_BASE_4000 0xdd2020 /* A4000/A4000T */
#define GAYLE_BASE_1200 0xda0000 /* A1200/A600 */
/*
* Offsets from one of the above bases
*/
#define GAYLE_DATA 0x00
#define GAYLE_ERROR 0x06 /* see err-bits */
#define GAYLE_NSECTOR 0x0a /* nr of sectors to read/write */
#define GAYLE_SECTOR 0x0e /* starting sector */
#define GAYLE_LCYL 0x12 /* starting cylinder */
#define GAYLE_HCYL 0x16 /* high byte of starting cyl */
#define GAYLE_SELECT 0x1a /* 101dhhhh , d=drive, hhhh=head */
#define GAYLE_STATUS 0x1e /* see status-bits */
#define GAYLE_CONTROL 0x101a
static int gayle_offsets[IDE_NR_PORTS] __initdata = {
GAYLE_DATA, GAYLE_ERROR, GAYLE_NSECTOR, GAYLE_SECTOR, GAYLE_LCYL,
GAYLE_HCYL, GAYLE_SELECT, GAYLE_STATUS, -1, -1
};
/*
* These are at different offsets from the base
*/
#define GAYLE_IRQ_4000 0xdd3020 /* MSB = 1, Harddisk is source of */
#define GAYLE_IRQ_1200 0xda9000 /* interrupt */
/*
* Offset of the secondary port for IDE doublers
* Note that GAYLE_CONTROL is NOT available then!
*/
#define GAYLE_NEXT_PORT 0x1000
#ifndef CONFIG_BLK_DEV_IDEDOUBLER
#define GAYLE_NUM_HWIFS 1
#define GAYLE_NUM_PROBE_HWIFS GAYLE_NUM_HWIFS
#define GAYLE_HAS_CONTROL_REG 1
#define GAYLE_IDEREG_SIZE 0x2000
#else /* CONFIG_BLK_DEV_IDEDOUBLER */
#define GAYLE_NUM_HWIFS 2
#define GAYLE_NUM_PROBE_HWIFS (ide_doubler ? GAYLE_NUM_HWIFS : \
GAYLE_NUM_HWIFS-1)
#define GAYLE_HAS_CONTROL_REG (!ide_doubler)
#define GAYLE_IDEREG_SIZE (ide_doubler ? 0x1000 : 0x2000)
int ide_doubler = 0; /* support IDE doublers? */
#endif /* CONFIG_BLK_DEV_IDEDOUBLER */
/*
* Check and acknowledge the interrupt status
*/
static int gayle_ack_intr_a4000(ide_hwif_t *hwif)
{
unsigned char ch;
ch = z_readb(hwif->io_ports[IDE_IRQ_OFFSET]);
if (!(ch & GAYLE_IRQ_IDE))
return 0;
return 1;
}
static int gayle_ack_intr_a1200(ide_hwif_t *hwif)
{
unsigned char ch;
ch = z_readb(hwif->io_ports[IDE_IRQ_OFFSET]);
if (!(ch & GAYLE_IRQ_IDE))
return 0;
(void)z_readb(hwif->io_ports[IDE_STATUS_OFFSET]);
z_writeb(0x7c, hwif->io_ports[IDE_IRQ_OFFSET]);
return 1;
}
/*
* Probe for a Gayle IDE interface (and optionally for an IDE doubler)
*/
void __init gayle_init(void)
{
int a4000, i;
if (!MACH_IS_AMIGA)
return;
if (!(a4000 = AMIGAHW_PRESENT(A4000_IDE)) && !AMIGAHW_PRESENT(A1200_IDE))
return;
for (i = 0; i < GAYLE_NUM_PROBE_HWIFS; i++) {
ide_ioreg_t base, ctrlport, irqport;
ide_ack_intr_t *ack_intr;
hw_regs_t hw;
ide_hwif_t *hwif;
int index;
unsigned long phys_base, res_start, res_n;
if (a4000) {
phys_base = GAYLE_BASE_4000;
irqport = (ide_ioreg_t)ZTWO_VADDR(GAYLE_IRQ_4000);
ack_intr = gayle_ack_intr_a4000;
} else {
phys_base = GAYLE_BASE_1200;
irqport = (ide_ioreg_t)ZTWO_VADDR(GAYLE_IRQ_1200);
ack_intr = gayle_ack_intr_a1200;
}
/*
* FIXME: we now have selectable modes between mmio v/s iomio
*/
phys_base += i*GAYLE_NEXT_PORT;
res_start = ((unsigned long)phys_base) & ~(GAYLE_NEXT_PORT-1);
res_n = GAYLE_IDEREG_SIZE;
if (!request_mem_region(res_start, res_n, "IDE"))
continue;
base = (ide_ioreg_t)ZTWO_VADDR(phys_base);
ctrlport = GAYLE_HAS_CONTROL_REG ? (base + GAYLE_CONTROL) : 0;
ide_setup_ports(&hw, base, gayle_offsets,
ctrlport, irqport, ack_intr,
// &gayle_iops,
IRQ_AMIGA_PORTS);
index = ide_register_hw(&hw, &hwif);
if (index != -1) {
hwif->mmio = 2;
switch (i) {
case 0:
printk("ide%d: Gayle IDE interface (A%d style)\n", index,
a4000 ? 4000 : 1200);
break;
#ifdef CONFIG_BLK_DEV_IDEDOUBLER
case 1:
printk("ide%d: IDE doubler\n", index);
break;
#endif /* CONFIG_BLK_DEV_IDEDOUBLER */
}
} else
release_mem_region(res_start, res_n);
#if 1 /* TESTING */
if (i == 1) {
volatile u_short *addr = (u_short *)base;
u_short data;
printk("+++ Probing for IDE doubler... ");
*addr = 0xffff;
data = *addr;
printk("probe returned 0x%02x (PLEASE REPORT THIS!!)\n", data);
}
#endif /* TESTING */
}
}
|
/*
* This file is part of the coreboot project.
*
* Copyright 2014 Google 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 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __SOC_NVIDIA_TEGRA132_INCLUDE_SOC_ID_H__
#define __SOC_NVIDIA_TEGRA132_INCLUDE_SOC_ID_H__
#include <arch/io.h>
#include <soc/addressmap.h>
static inline int context_avp(void)
{
const uint32_t avp_id = 0xaaaaaaaa;
void * const uptag = (void *)(uintptr_t)TEGRA_PG_UP_BASE;
return read32(uptag) == avp_id;
}
#endif /* define __SOC_NVIDIA_TEGRA132_INCLUDE_SOC_ID_H__ */
|
/***************************************************************************
qgsprocessingmodelcomponent.h
-----------------------------
begin : June 2017
copyright : (C) 2017 by Nyall Dawson
email : nyall dot dawson at gmail dot com
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSPROCESSINGMODELCOMPONENT_H
#define QGSPROCESSINGMODELCOMPONENT_H
#include "qgis_core.h"
#include "qgis.h"
#include <QPointF>
///@cond NOT_STABLE
/**
* Represents a component of a model algorithm.
* \since QGIS 3.0
* \ingroup core
*/
class CORE_EXPORT QgsProcessingModelComponent
{
public:
/**
* Returns the friendly description text for the component.
* \see setDescription()
*/
QString description() const;
/**
* Sets the friendly \a description text for the component.
* \see description()
*/
void setDescription( const QString &description );
/**
* Returns the position of the model component within the graphical modeler.
* \see setPosition()
*/
QPointF position() const;
/**
* Sets the \a position of the model component within the graphical modeler.
* \see position()
*/
void setPosition( QPointF position );
protected:
//! Only subclasses can be created
QgsProcessingModelComponent( const QString &description = QString() );
//! Copies are protected to avoid slicing
QgsProcessingModelComponent( const QgsProcessingModelComponent &other ) = default;
//! Copies are protected to avoid slicing
QgsProcessingModelComponent &operator=( const QgsProcessingModelComponent &other ) = default;
/**
* Saves the component properties to a QVariantMap.
* \see restoreCommonProperties()
*/
void saveCommonProperties( QVariantMap &map ) const;
/**
* Restores the component properties from a QVariantMap.
* \see saveCommonProperties()
*/
void restoreCommonProperties( const QVariantMap &map );
private:
//! Position of component within model
QPointF mPosition;
QString mDescription;
};
///@endcond
#endif // QGSPROCESSINGMODELCOMPONENT_H
|
/* GStreamer
* Copyright (C) 2011 Axis Communications <dev-gstreamer@axis.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_CURL_HTTP_SINK__
#define __GST_CURL_HTTP_SINK__
#include <gst/gst.h>
#include <gst/base/gstbasesink.h>
#include <curl/curl.h>
#include "gstcurltlssink.h"
G_BEGIN_DECLS
#define GST_TYPE_CURL_HTTP_SINK \
(gst_curl_http_sink_get_type())
#define GST_CURL_HTTP_SINK(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_CURL_HTTP_SINK, GstCurlHttpSink))
#define GST_CURL_HTTP_SINK_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_CURL_HTTP_SINK, GstCurlHttpSinkClass))
#define GST_IS_CURL_HTTP_SINK(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_CURL_HTTP_SINK))
#define GST_IS_CURL_HTTP_SINK_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_CURL_HTTP_SINK))
typedef struct _GstCurlHttpSink GstCurlHttpSink;
typedef struct _GstCurlHttpSinkClass GstCurlHttpSinkClass;
struct _GstCurlHttpSink
{
GstCurlTlsSink parent;
/*< private > */
struct curl_slist *header_list;
gchar *proxy;
guint proxy_port;
gchar *proxy_user;
gchar *proxy_passwd;
gboolean use_content_length;
gchar *content_type;
gboolean use_proxy;
gboolean proxy_headers_set;
gboolean proxy_auth;
gboolean proxy_conn_established;
glong proxy_resp;
};
struct _GstCurlHttpSinkClass
{
GstCurlTlsSinkClass parent_class;
};
GType gst_curl_http_sink_get_type (void);
G_END_DECLS
#endif
|
/*
* \brief Cube 3D object
* \author Norman Feske
* \date 2015-06-19
*/
/*
* Copyright (C) 2015 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _INCLUDE__NANO3D__CUBE_SHAPE_H_
#define _INCLUDE__NANO3D__CUBE_SHAPE_H_
#include <nano3d/vertex_array.h>
namespace Nano3d { class Cube_shape; }
class Nano3d::Cube_shape
{
private:
enum { NUM_VERTICES = 8, NUM_FACES = 6 };
typedef Nano3d::Vertex_array<NUM_VERTICES> Vertex_array;
Vertex_array _vertices;
enum { VERTICES_PER_FACE = 4 };
typedef unsigned Face[VERTICES_PER_FACE];
Face _faces[NUM_FACES] { { 0, 1, 3, 2 },
{ 6, 7, 5, 4 },
{ 1, 0, 4, 5 },
{ 3, 1, 5, 7 },
{ 2, 3, 7, 6 },
{ 0, 2, 6, 4 } };
public:
Cube_shape(int size)
{
for (unsigned i = 0; i < NUM_VERTICES; i++)
_vertices[i] = Nano3d::Vertex((i&1) ? size : -size,
(i&2) ? size : -size,
(i&4) ? size : -size);
}
Vertex_array const &vertex_array() const { return _vertices; }
/**
* Call functor 'fn' for each face of the object
*
* The functor is called with an array of 'unsigned' vertex indices
* and the number of indices as arguments.
*/
template <typename FN>
void for_each_face(FN const &fn) const
{
for (unsigned i = 0; i < NUM_FACES; i++)
fn(_faces[i], VERTICES_PER_FACE);
}
};
#endif /* _INCLUDE__NANO3D__CUBE_SHAPE_H_ */
|
/* 1-D PEF estimation with complex data using Burg's algorithm */
/*
Copyright (C) 2007 University of Texas at Austin
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
*/
/* The algorithm is described in J.F. Clarbout, FGDP, p. 133-... */
#include <rsf.h>
#include "burg.h"
static int n, nf, nc;
float **f, **b;
void burg_init (int n_in /* trace length */,
int nc_in /* number of traces */,
int nf_in /* filter length */)
/*< initialize >*/
{
n = n_in;
nf = nf_in;
nc = nc_in;
f = sf_floatalloc2(n,nc);
b = sf_floatalloc2(n,nc);
}
void burg_close(void)
/*< free allocated storage >*/
{
free (*f);
free (f);
free (*b);
free (b);
}
void burg_apply (float *x /* [n*nc] input data */,
float *a /* [nf] output prediction-error filter */)
/*< estimate PEF >*/
{
double den, num, cj;
float fi, bi, ai;
int j, ic, i;
for (ic=0; ic < nc; ic++) {
for (i=0; i < n; i++) {
b[ic][i] = f[ic][i] = x[ic*n+i];
}
}
a[0] = 1.;
for (j=1; j < nf; j++) {
num = den = 0.;
for (ic=0; ic < nc; ic++) {
for (i=j; i < n; i++) {
fi = f[ic][i];
bi = b[ic][i-j];
num += fi*bi;
den += fi*fi + bi*bi;
}
}
cj = 2.*num/den;
for (ic=0; ic < nc; ic++) {
for (i=j; i < n; i++) {
fi = f[ic][i];
bi = b[ic][i-j];
f[ic][i] -= cj*bi;
b[ic][i-j] -= cj*fi;
}
}
for (i=1; i <= j/2; i++) {
ai = a[j-i]-cj*a[i];
a[i] -= cj*a[j-i];
a[j-i] = ai;
}
a[j] = -cj;
}
}
|
// PARSECMD.H
// Copyright (c) 1997-1999 Symbian Ltd. All rights reserved.
//
// handles parsing of makesis command line args
//
#ifndef __PARSE_CMD_H_
#define __PARSE_CMD_H_
// ===========================================================================
// CONSTANTS
// ===========================================================================
#define SOURCEFILE L".pkg"
#define DESTFILE L".sis"
enum TCommandLineException
{ErrInsufficientArgs,
ErrBadCommandFlag,
ErrBadSourceFile,
ErrNoSourceFile,
ErrCannotOpenSourceFile,
ErrBadTargetFile
};
// ===========================================================================
// CLASS DEFINITION
// ===========================================================================
class CParseCmd
// Responsible for processing and maintaining the command line options
{
public:
CParseCmd();
BOOL ParseCommandLine(int argc, _TCHAR *argv[]);
BOOL ShowSyntax() const { return m_fShowSyntax; }
DWORD Flags() const { return m_dwOptions; }
LPCWSTR GetPassword() const { return m_pszPassword; }
LPCWSTR SourceFile() const { return m_pszSource; }
LPCWSTR SearchPath() const { return m_pszDir; }
LPCWSTR TargetFile();
enum TOptions
{EOptVerbose = 0x01,
EOptMakeStub = 0x02,
EOptDirectory = 0x04,
EOptPassword = 0x08
};
private:
void SetDirectory(LPCWSTR pszPath);
void SetSource(LPCWSTR pszSource);
void SetTarget(LPCWSTR pszTarget);
WCHAR m_pszDir[MAX_PATH];
WCHAR m_pszSource[MAX_PATH];
WCHAR m_pszTarget[MAX_PATH];
WCHAR m_pszPassword[MAX_PATH];
DWORD m_dwOptions;
BOOL m_fShowSyntax;
};
#endif // __PARSE_CMD_H_
|
/*----------------------------------------------------------------------------
* U S B - K e r n e l
*----------------------------------------------------------------------------
* Name: USBHW.H
* Purpose: USB Hardware Layer Definitions
* Version: V1.10
*----------------------------------------------------------------------------
* This software is supplied "AS IS" without any warranties, express,
* implied or statutory, including but not limited to the implied
* warranties of fitness for purpose, satisfactory quality and
* noninfringement. Keil extends you a royalty-free right to reproduce
* and distribute executable files created using this software for use
* on NXP Semiconductors LPC family microcontroller devices only. Nothing
* else gives you the right to use this software.
*
* Copyright (c) 2005-2009 Keil Software.
*---------------------------------------------------------------------------*/
#ifndef __USBHW_H__
#define __USBHW_H__
#define USB_PORT 1 /* 1/2 */
/* USB RAM Definitions */
#define USB_RAM_ADR LPC_PERI_RAM_BASE /* USB RAM Start Address */
#define USB_RAM_SZ 0x00004000 /* USB RAM Size (4kB) */
/* DMA Endpoint Descriptors */
#define DD_NISO_CNT 16 /* Non-Iso EP DMA Descr. Count (max. 32) */
#define DD_ISO_CNT 8 /* Iso EP DMA Descriptor Count (max. 32) */
#define DD_NISO_SZ (DD_NISO_CNT * 16) /* Non-Iso DMA Descr. Size */
#define DD_ISO_SZ (DD_ISO_CNT * 20) /* Iso DMA Descriptor Size */
#define DD_NISO_ADR (USB_RAM_ADR + 128) /* Non-Iso DMA Descr. Address */
#define DD_ISO_ADR (DD_NISO_ADR + DD_NISO_SZ) /* Iso DMA Descr. Address */
#define DD_SZ (128 + DD_NISO_SZ + DD_ISO_SZ) /* Descr. Size */
/* DMA Buffer Memory Definitions */
#define DMA_BUF_ADR (USB_RAM_ADR + DD_SZ) /* DMA Buffer Start Address */
#define DMA_BUF_SZ (USB_RAM_SZ - DD_SZ) /* DMA Buffer Size */
/* USB Error Codes */
#define USB_ERR_PID 0x0001 /* PID Error */
#define USB_ERR_UEPKT 0x0002 /* Unexpected Packet */
#define USB_ERR_DCRC 0x0004 /* Data CRC Error */
#define USB_ERR_TIMOUT 0x0008 /* Bus Time-out Error */
#define USB_ERR_EOP 0x0010 /* End of Packet Error */
#define USB_ERR_B_OVRN 0x0020 /* Buffer Overrun */
#define USB_ERR_BTSTF 0x0040 /* Bit Stuff Error */
#define USB_ERR_TGL 0x0080 /* Toggle Bit Error */
/* USB DMA Status Codes */
#define USB_DMA_INVALID 0x0000 /* DMA Invalid - Not Configured */
#define USB_DMA_IDLE 0x0001 /* DMA Idle - Waiting for Trigger */
#define USB_DMA_BUSY 0x0002 /* DMA Busy - Transfer in progress */
#define USB_DMA_DONE 0x0003 /* DMA Transfer Done (no Errors)*/
#define USB_DMA_OVER_RUN 0x0004 /* Data Over Run */
#define USB_DMA_UNDER_RUN 0x0005 /* Data Under Run (Short Packet) */
#define USB_DMA_ERROR 0x0006 /* Error */
#define USB_DMA_UNKNOWN 0xFFFF /* Unknown State */
/* USB DMA Descriptor */
typedef struct _USB_DMA_DESCRIPTOR {
uint32_t BufAdr; /* DMA Buffer Address */
uint16_t BufLen; /* DMA Buffer Length */
uint16_t MaxSize; /* Maximum Packet Size */
uint32_t InfoAdr; /* Packet Info Memory Address */
union { /* DMA Configuration */
struct {
uint32_t Link : 1; /* Link to existing Descriptors */
uint32_t IsoEP : 1; /* Isonchronous Endpoint */
uint32_t ATLE : 1; /* ATLE (Auto Transfer Length Extract) */
uint32_t Rsrvd : 5; /* Reserved */
uint32_t LenPos : 8; /* Length Position (ATLE) */
} Type;
uint32_t Val;
} Cfg;
} USB_DMA_DESCRIPTOR;
/* USB Hardware Functions */
extern void USB_Init (void);
extern void USB_Connect (uint32_t con);
extern void USB_Reset (void);
extern void USB_Suspend (void);
extern void USB_Resume (void);
extern void USB_WakeUp (void);
extern void USB_WakeUpCfg (uint32_t cfg);
extern void USB_SetAddress (uint32_t adr);
extern void USB_Configure (uint32_t cfg);
extern void USB_ConfigEP (USB_ENDPOINT_DESCRIPTOR *pEPD);
extern void USB_DirCtrlEP (uint32_t dir);
extern void USB_EnableEP (uint32_t EPNum);
extern void USB_DisableEP (uint32_t EPNum);
extern void USB_ResetEP (uint32_t EPNum);
extern void USB_SetStallEP (uint32_t EPNum);
extern void USB_ClrStallEP (uint32_t EPNum);
extern uint32_t USB_ReadEP (uint32_t EPNum, uint8_t *pData);
extern uint32_t USB_WriteEP (uint32_t EPNum, uint8_t *pData, uint32_t cnt);
extern uint32_t USB_DMA_Setup (uint32_t EPNum, USB_DMA_DESCRIPTOR *pDD);
extern void USB_DMA_Enable (uint32_t EPNum);
extern void USB_DMA_Disable(uint32_t EPNum);
extern uint32_t USB_DMA_Status (uint32_t EPNum);
extern uint32_t USB_DMA_BufAdr (uint32_t EPNum);
extern uint32_t USB_DMA_BufCnt (uint32_t EPNum);
extern uint32_t USB_GetFrame (void);
extern void USB_IRQHandler (void);
#endif /* __USBHW_H__ */
|
/* Public domain. */
#include "byte.h"
void byte_copyr(to,n,from)
register char *to;
register unsigned int n;
register char *from;
{
to += n;
from += n;
for (;;) {
if (!n) return; *--to = *--from; --n;
if (!n) return; *--to = *--from; --n;
if (!n) return; *--to = *--from; --n;
if (!n) return; *--to = *--from; --n;
}
}
|
//
// VTAcknowledgement.h
//
// Copyright (c) 2013-2014 Vincent Tourraine (http://www.vtourraine.net)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <Foundation/Foundation.h>
@interface VTAcknowledgement : NSObject
@property (nonatomic, copy) NSString *title;
@property (nonatomic, copy) NSString *text;
@end
|
/*
* Linux cfg80211 driver - Android related functions
*
* $Copyright Open Broadcom Corporation$
*
* $Id: wl_android.h 487838 2014-06-27 05:51:44Z $
*/
#ifndef _wl_android_
#define _wl_android_
#include <linux/module.h>
#include <linux/netdevice.h>
#include <wldev_common.h>
/* If any feature uses the Generic Netlink Interface, put it here to enable WL_GENL
* automatically
*/
#if defined(WL_SDO) || defined(BT_WIFI_HANDOVER) || defined(WL_NAN)
#define WL_GENL
#endif
#ifdef WL_GENL
#include <net/genetlink.h>
#endif
/**
* Android platform dependent functions, feel free to add Android specific functions here
* (save the macros in dhd). Please do NOT declare functions that are NOT exposed to dhd
* or cfg, define them as static in wl_android.c
*/
/**
* wl_android_init will be called from module init function (dhd_module_init now), similarly
* wl_android_exit will be called from module exit function (dhd_module_cleanup now)
*/
int wl_android_init(void);
int wl_android_exit(void);
void wl_android_post_init(void);
int wl_android_wifi_on(struct net_device *dev);
int wl_android_wifi_off(struct net_device *dev);
int wl_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd);
#ifdef WL_GENL
typedef struct bcm_event_hdr {
u16 event_type;
u16 len;
} bcm_event_hdr_t;
/* attributes (variables): the index in this enum is used as a reference for the type,
* userspace application has to indicate the corresponding type
* the policy is used for security considerations
*/
enum {
BCM_GENL_ATTR_UNSPEC,
BCM_GENL_ATTR_STRING,
BCM_GENL_ATTR_MSG,
__BCM_GENL_ATTR_MAX
};
#define BCM_GENL_ATTR_MAX (__BCM_GENL_ATTR_MAX - 1)
/* commands: enumeration of all commands (functions),
* used by userspace application to identify command to be ececuted
*/
enum {
BCM_GENL_CMD_UNSPEC,
BCM_GENL_CMD_MSG,
__BCM_GENL_CMD_MAX
};
#define BCM_GENL_CMD_MAX (__BCM_GENL_CMD_MAX - 1)
/* Enum values used by the BCM supplicant to identify the events */
enum {
BCM_E_UNSPEC,
BCM_E_SVC_FOUND,
BCM_E_DEV_FOUND,
BCM_E_DEV_LOST,
BCM_E_DEV_BT_WIFI_HO_REQ,
BCM_E_MAX
};
s32 wl_genl_send_msg(struct net_device *ndev, u32 event_type,
u8 *string, u16 len, u8 *hdr, u16 hdrlen);
#endif /* WL_GENL */
s32 wl_netlink_send_msg(int pid, int type, int seq, void *data, size_t size);
/* hostap mac mode */
#define MACLIST_MODE_DISABLED 0
#define MACLIST_MODE_DENY 1
#define MACLIST_MODE_ALLOW 2
/* max number of assoc list */
#define MAX_NUM_OF_ASSOCLIST 64
/* max number of mac filter list
* restrict max number to 10 as maximum cmd string size is 255
*/
#define MAX_NUM_MAC_FILT 10
int wl_android_set_ap_mac_list(struct net_device *dev, int macmode, struct maclist *maclist);
/* terence:
* BSSCACHE: Cache bss list
* RSSAVG: Average RSSI of BSS list
* RSSIOFFSET: RSSI offset
*/
#define BSSCACHE
#define RSSIAVG
#define RSSIOFFSET
//#define RSSIOFFSET_NEW
#define RSSI_MAXVAL -2
#define RSSI_MINVAL -200
#if defined(ESCAN_RESULT_PATCH)
#define REPEATED_SCAN_RESULT_CNT 2
#else
#define REPEATED_SCAN_RESULT_CNT 1
#endif
#if defined(RSSIAVG)
#define RSSIAVG_LEN (4*REPEATED_SCAN_RESULT_CNT)
#define RSSICACHE_TIMEOUT 15
typedef struct wl_rssi_cache {
struct wl_rssi_cache *next;
int dirty;
struct timeval tv;
struct ether_addr BSSID;
int16 RSSI[RSSIAVG_LEN];
} wl_rssi_cache_t;
typedef struct wl_rssi_cache_ctrl {
wl_rssi_cache_t *m_cache_head;
} wl_rssi_cache_ctrl_t;
void wl_free_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl);
void wl_delete_dirty_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl);
void wl_delete_disconnected_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl, u8 *bssid);
void wl_reset_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl);
void wl_update_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl, wl_scan_results_t *ss_list);
int wl_update_connected_rssi_cache(struct net_device *net, wl_rssi_cache_ctrl_t *rssi_cache_ctrl, int *rssi_avg);
int16 wl_get_avg_rssi(wl_rssi_cache_ctrl_t *rssi_cache_ctrl, void *addr);
#endif
#if defined(RSSIOFFSET)
#define RSSI_OFFSET 5
#if defined(RSSIOFFSET_NEW)
#define RSSI_OFFSET_MAXVAL -80
#define RSSI_OFFSET_MINVAL -94
#define RSSI_OFFSET_INTVAL ((RSSI_OFFSET_MAXVAL-RSSI_OFFSET_MINVAL)/RSSI_OFFSET)
#endif
#define BCM4330_CHIP_ID 0x4330
#define BCM4330B2_CHIP_REV 4
int wl_update_rssi_offset(struct net_device *net, int rssi);
#endif
#if defined(BSSCACHE)
#define BSSCACHE_TIMEOUT 15
typedef struct wl_bss_cache {
struct wl_bss_cache *next;
int dirty;
struct timeval tv;
wl_scan_results_t results;
} wl_bss_cache_t;
typedef struct wl_bss_cache_ctrl {
wl_bss_cache_t *m_cache_head;
} wl_bss_cache_ctrl_t;
void wl_free_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl);
void wl_delete_dirty_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl);
void wl_delete_disconnected_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl, u8 *bssid);
void wl_reset_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl);
void wl_update_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl, wl_scan_results_t *ss_list);
void wl_release_bss_cache_ctrl(wl_bss_cache_ctrl_t *bss_cache_ctrl);
#endif
#endif /* _wl_android_ */
|
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
/*
* (C) 2008 by Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#ifndef OPA_GCC_PPC_H_INCLUDED
#define OPA_GCC_PPC_H_INCLUDED
/* these need to be aligned on an 8-byte boundary to work on a BG/P */
typedef struct { volatile int v OPA_ATTRIBUTE((aligned (8))); } OPA_int_t;
typedef struct { void * volatile v OPA_ATTRIBUTE((aligned (8))); } OPA_ptr_t;
#define OPA_INT_T_INITIALIZER(val_) { (val_) }
#define OPA_PTR_T_INITIALIZER(val_) { (val_) }
/* Aligned loads and stores are atomic. */
static _opa_inline int OPA_load_int(_opa_const OPA_int_t *ptr)
{
return ptr->v;
}
/* Aligned loads and stores are atomic. */
static _opa_inline void OPA_store_int(OPA_int_t *ptr, int val)
{
ptr->v = val;
}
/* Aligned loads and stores are atomic. */
static _opa_inline void *OPA_load_ptr(_opa_const OPA_ptr_t *ptr)
{
return ptr->v;
}
/* Aligned loads and stores are atomic. */
static _opa_inline void OPA_store_ptr(OPA_ptr_t *ptr, void *val)
{
ptr->v = val;
}
/* a useful link for PPC memory ordering issues:
* http://www.rdrop.com/users/paulmck/scalability/paper/N2745r.2009.02.22a.html
*
* lwsync: orders L-L, S-S, L-S, but *not* S-L (i.e. gives x86-ish ordering)
* eieio: orders S-S (but only for cacheable memory, not for MMIO)
* sync: totally orders memops
* isync: force all preceeding insns to appear complete before starting
* subsequent insns, but w/o cumulativity (very confusing)
*/
/* helper macros */
#define OPA_ppc_lwsync_() __asm__ __volatile__ ( "lwsync" ::: "memory" )
#define OPA_ppc_hwsync_() __asm__ __volatile__ ( "sync" ::: "memory" )
#define OPA_ppc_eieio_() __asm__ __volatile__ ( "eieio" ::: "memory" )
#define OPA_write_barrier() OPA_ppc_eieio_()
#define OPA_read_barrier() OPA_ppc_lwsync_()
#define OPA_read_write_barrier() OPA_ppc_hwsync_()
#define OPA_compiler_barrier() __asm__ __volatile__ ( "" ::: "memory" )
/* NOTE-PPC-1 we use lwsync, although I think we might be able to use
* conditional-branch+isync in some cases (load_acquire?) once we understand it
* better */
static _opa_inline int OPA_load_acquire_int(_opa_const OPA_int_t *ptr)
{
int tmp;
tmp = ptr->v;
OPA_ppc_lwsync_(); /* NOTE-PPC-1 */
return tmp;
}
static _opa_inline void OPA_store_release_int(OPA_int_t *ptr, int val)
{
OPA_ppc_lwsync_();
ptr->v = val;
}
static _opa_inline void *OPA_load_acquire_ptr(_opa_const OPA_ptr_t *ptr)
{
void *tmp;
tmp = ptr->v;
OPA_ppc_lwsync_(); /* NOTE-PPC-1 */
return tmp;
}
static _opa_inline void OPA_store_release_ptr(OPA_ptr_t *ptr, void *val)
{
OPA_ppc_lwsync_();
ptr->v = val;
}
/*
load-link/store-conditional (LL/SC) primitives. We LL/SC implement
these here, which are arch-specific, then use the generic
implementations from opa_emulated.h */
static _opa_inline int OPA_LL_int(OPA_int_t *ptr)
{
int val;
__asm__ __volatile__ ("lwarx %[val],0,%[ptr]"
: [val] "=r" (val)
: [ptr] "r" (&ptr->v)
: "cc");
return val;
}
/* Returns non-zero if the store was successful, zero otherwise. */
static _opa_inline int OPA_SC_int(OPA_int_t *ptr, int val)
{
int ret = 1; /* init to non-zero, will be reset to 0 if SC was unsuccessful */
__asm__ __volatile__ ("stwcx. %[val],0,%[ptr];\n"
"beq 1f;\n"
"li %[ret], 0;\n"
"1: ;\n"
: [ret] "=r" (ret)
: [ptr] "r" (&ptr->v), [val] "r" (val), "0" (ret)
: "cc", "memory");
return ret;
}
/* Pointer versions of LL/SC. */
/* Set OPA_SS (Size Suffix) which is used to choose between lwarx/stwcx and
* ldarx/stdcx when using 4 or 8 byte pointer operands */
#if OPA_SIZEOF_VOID_P == 4
#define OPA_SS "w"
#elif OPA_SIZEOF_VOID_P == 8
#define OPA_SS "d"
#else
#error OPA_SIZEOF_VOID_P is not 4 or 8
#endif
static _opa_inline void *OPA_LL_ptr(OPA_ptr_t *ptr)
{
void *val;
__asm__ __volatile__ ("l"OPA_SS"arx %[val],0,%[ptr]"
: [val] "=r" (val)
: [ptr] "r" (&ptr->v)
: "cc");
return val;
}
/* Returns non-zero if the store was successful, zero otherwise. */
static _opa_inline int OPA_SC_ptr(OPA_ptr_t *ptr, void *val)
{
int ret = 1; /* init to non-zero, will be reset to 0 if SC was unsuccessful */
__asm__ __volatile__ ("st"OPA_SS"cx. %[val],0,%[ptr];\n"
"beq 1f;\n"
"li %[ret], 0;\n"
"1: ;\n"
: [ret] "=r" (ret)
: [ptr] "r" (&ptr->v), [val] "r" (val), "0" (ret)
: "cc", "memory");
return ret;
}
#undef OPA_SS
/* necessary to enable LL/SC emulation support */
#define OPA_LL_SC_SUPPORTED 1
/* Implement all function using LL/SC */
#define OPA_add_int_by_llsc OPA_add_int
#define OPA_incr_int_by_llsc OPA_incr_int
#define OPA_decr_int_by_llsc OPA_decr_int
#define OPA_decr_and_test_int_by_llsc OPA_decr_and_test_int
#define OPA_fetch_and_add_int_by_llsc OPA_fetch_and_add_int
#define OPA_fetch_and_decr_int_by_llsc OPA_fetch_and_decr_int
#define OPA_fetch_and_incr_int_by_llsc OPA_fetch_and_incr_int
#define OPA_cas_ptr_by_llsc OPA_cas_ptr
#define OPA_cas_int_by_llsc OPA_cas_int
#define OPA_swap_ptr_by_llsc OPA_swap_ptr
#define OPA_swap_int_by_llsc OPA_swap_int
#include "opa_emulated.h"
#endif /* OPA_GCC_PPC_H_INCLUDED */
|
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2014 Eurecom
OpenAirInterface 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.
OpenAirInterface 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 OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@eurecom.fr
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/
/*! \file vars.hles
* \brief rrc variables
* \author Raymond Knopp and Navid Nikaein
* \date 2013
* \version 1.0
* \company Eurecom
* \email: navid.nikaein@eurecom.fr
*/
#ifndef __OPENAIR_RRC_VARS_H__
#define __OPENAIR_RRC_VARS_H__
#include "defs.h"
#include "LAYER2/RLC/rlc.h"
#include "COMMON/mac_rrc_primitives.h"
#include "LAYER2/MAC/defs.h"
eNB_RRC_INST *eNB_rrc_inst;
UE_RRC_INST *UE_rrc_inst;
//RRC_XFACE *Rrc_xface;
#ifndef USER_MODE
//MAC_RLC_XFACE *Mac_rlc_xface;
#ifndef NO_RRM
int S_rrc= RRC2RRM_FIFO;
#endif //NO_RRM
//int R_rrc= RRM2RRC_FIFO;
#else
#include "LAYER2/MAC/extern.h"
#ifndef NO_RRM
sock_rrm_t S_rrc;
#endif
#endif
#ifndef NO_RRM
#ifndef USER_MODE
char *Header_buf;
char *Data;
unsigned short Header_read_idx,Data_read_idx,Header_size;
#endif
unsigned short Data_to_read;
#endif //NO_RRM
#define MAX_U32 0xFFFFFFFF
uint8_t DRB2LCHAN[8];
long logicalChannelGroup0 = 0;
long logicalChannelSR_Mask_r9=0;
struct LogicalChannelConfig__ul_SpecificParameters LCSRB1 = {1,
LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity,
0,
&logicalChannelGroup0
};
struct LogicalChannelConfig__ul_SpecificParameters LCSRB2 = {3,
LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity,
0,
&logicalChannelGroup0
};
// These are the default SRB configurations from 36.331 (Chapter 9, p. 176-179 in v8.6)
LogicalChannelConfig_t SRB1_logicalChannelConfig_defaultValue = {&LCSRB1
#ifdef Rel10
,
&logicalChannelSR_Mask_r9
#endif
};
LogicalChannelConfig_t SRB2_logicalChannelConfig_defaultValue = {&LCSRB2
#ifdef Rel10
,
&logicalChannelSR_Mask_r9
#endif
};
//CONSTANTS
rlc_info_t Rlc_info_um,Rlc_info_am_config;
uint16_t RACH_FREQ_ALLOC;
//uint8_t NB_RACH;
LCHAN_DESC BCCH_LCHAN_DESC,CCCH_LCHAN_DESC,DCCH_LCHAN_DESC,DTCH_DL_LCHAN_DESC,DTCH_UL_LCHAN_DESC;
MAC_MEAS_T BCCH_MEAS_TRIGGER,CCCH_MEAS_TRIGGER,DCCH_MEAS_TRIGGER,DTCH_MEAS_TRIGGER;
MAC_AVG_T BCCH_MEAS_AVG, CCCH_MEAS_AVG,DCCH_MEAS_AVG, DTCH_MEAS_AVG;
// timers
uint16_t T300[8] = {100,200,300,400,600,1000,1500,2000};
uint16_t T310[8] = {0,50,100,200,500,1000,2000};
uint16_t N310[8] = {1,2,3,4,6,8,10,20};
uint16_t N311[8] = {1,2,3,4,6,8,10,20};
uint32_t T304[8] = {50,100,150,200,500,1000,2000,MAX_U32};
// TimeToTrigger enum mapping table (36.331 TimeToTrigger IE)
uint32_t timeToTrigger_ms[16] = {0,40,64,80,100,128,160,256,320,480,512,640,1024,1280,2560,5120};
/* 36.133 Section 9.1.4 RSRP Measurement Report Mapping, Table: 9.1.4-1 */
float RSRP_meas_mapping[98] = {
-140,
-139,
-138,
-137,
-136,
-135,
-134,
-133,
-132,
-131,
-130,
-129,
-128,
-127,
-126,
-125,
-124,
-123,
-122,
-121,
-120,
-119,
-118,
-117,
-116,
-115,
-114,
-113,
-112,
-111,
-110,
-109,
-108,
-107,
-106,
-105,
-104,
-103,
-102,
-101,
-100,
-99,
-98,
-97,
-96,
-95,
-94,
-93,
-92,
-91,
-90,
-89,
-88,
-87,
-86,
-85,
-84,
-83,
-82,
-81,
-80,
-79,
-78,
-77,
-76,
-75,
-74,
-73,
-72,
-71,
-70,
-69,
-68,
-67,
-66,
-65,
-64,
-63,
-62,
-61,
-60,
-59,
-58,
-57,
-56,
-55,
-54,
-53,
-52,
-51,
-50,
-49,
-48,
-47,
-46,
-45,
-44,
-43
};
float RSRQ_meas_mapping[35] = {
-19,
-18.5,
-18,
-17.5,
-17,
-16.5,
-16,
-15.5,
-15,
-14.5,
-14,
-13.5,
-13,
-12.5,
-12,
-11.5,
-11,
-10.5,
-10,
-9.5,
-9,
-8.5,
-8,
-7.5,
-7,
-6.5,
-6,
-5.5,
-5,
-4.5,
-4,
-3.5,
-3,
-2.5,
-2
};
#endif
|
/*
* MicroHH
* Copyright (c) 2011-2020 Chiel van Heerwaarden
* Copyright (c) 2011-2020 Thijs Heus
* Copyright (c) 2014-2020 Bart van Stratum
*
* This file is part of MicroHH
*
* MicroHH 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.
* MicroHH 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 MicroHH. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef BOUNDARY_H
#define BOUNDARY_H
#include <memory>
#include "timedep.h"
#include "boundary_cyclic.h"
#include "field3d_io.h"
class Master;
class Netcdf_handle;
template<typename> class Grid;
template<typename> class Fields;
template<typename> class Diff;
template<typename> class Thermo;
template<typename> class Timedep;
template<typename> class Stats;
class Input;
enum class Boundary_type {Dirichlet_type, Neumann_type, Flux_type, Ustar_type, Off_type};
enum class Boundary_w_type {Normal_type, Conservation_type};
/**
* Structure containing the boundary options and values per 3d field.
*/
template<typename TF>
struct Field3dBc
{
TF bot; ///< Value of the bottom boundary.
TF top; ///< Value of the top boundary.
Boundary_type bcbot; ///< Switch for the bottom boundary.
Boundary_type bctop; ///< Switch for the top boundary.
};
/**
* Base class for the boundary scheme.
* This class handles the case when the boundary is turned off. Derived classes are
* implemented that handle different boundary schemes.
*/
template<typename TF>
class Boundary
{
public:
Boundary(Master&, Grid<TF>&, Fields<TF>&, Input&); ///< Constuctor of the boundary class.
virtual ~Boundary(); ///< Destructor of the boundary class.
static std::shared_ptr<Boundary> factory(Master&, Grid<TF>&, Fields<TF>&, Input&); ///< Factory function for boundary class generation.
virtual void init(Input&, Thermo<TF>&); ///< Initialize the fields.
virtual void create(Input&, Netcdf_handle&, Stats<TF>&); ///< Create the fields.
virtual void update_time_dependent(Timeloop<TF>&); ///< Update the time dependent parameters.
virtual void set_values(); ///< Set all 2d fields to the prober BC value.
virtual void exec(Thermo<TF>&); ///< Update the boundary conditions.
virtual void set_ghost_cells_w(Boundary_w_type); ///< Update the boundary conditions.
virtual void exec_stats(Stats<TF>&); ///< Execute statistics of surface
// virtual void exec_cross(); ///< Execute cross sections of surface
// virtual void get_mask(Field3d*, Field3d*, Mask*); ///< Calculate statistics mask
// virtual void get_surface_mask(Field3d*); ///< Calculate surface mask
std::string get_switch();
// GPU functions and variables
virtual void prepare_device();
virtual void forward_device();
virtual void backward_device();
TF z0m;
TF z0h;
std::vector<TF> ustar;
std::vector<TF> obuk;
std::vector<int> nobuk;
TF* obuk_g;
TF* ustar_g;
int* nobuk_g;
protected:
Master& master;
Grid<TF>& grid;
Fields<TF>& fields;
Boundary_cyclic<TF> boundary_cyclic;
Field3d_io<TF> field3d_io;
std::string swboundary;
Boundary_type mbcbot;
Boundary_type mbctop;
TF ubot;
TF utop;
TF vbot;
TF vtop;
typedef std::map<std::string, Field3dBc<TF>> BcMap;
BcMap sbc;
std::map<std::string, Timedep<TF>*> tdep_bc;
std::vector<std::string> sbot_2d_list;
void process_bcs(Input&); ///< Process the boundary condition settings from the ini file.
void process_time_dependent(Input&, Netcdf_handle&); ///< Process the time dependent settings from the ini file.
#ifdef USECUDA
void clear_device();
#endif
// void set_bc(double*, double*, double*, Boundary_type, double, double, double); ///< Set the values for the boundary fields.
// GPU functions and variables
void set_bc_g(TF*, TF*, TF*, Boundary_type, TF, TF, TF); ///< Set the values for the boundary fields.
private:
virtual void update_bcs(Thermo<TF>&); // Update the boundary values.
virtual void update_slave_bcs(); // Update the slave boundary values.
};
#endif
|
#include <verifier-builtins.h>
#include <stdlib.h>
#define LIST_HEAD_INIT(name) { &(name), &(name) }
#define LIST_HEAD(name) \
struct list_head name = LIST_HEAD_INIT(name)
struct list_head {
struct list_head *next, *prev;
};
static inline void INIT_LIST_HEAD(struct list_head *list)
{
list->next = list;
list->prev = list;
}
static inline void __list_add(struct list_head *new,
struct list_head *prev,
struct list_head *next)
{
next->prev = new;
new->next = next;
new->prev = prev;
prev->next = new;
}
static inline void list_add_tail(struct list_head *new, struct list_head *head)
{
__list_add(new, head->prev, head);
}
struct my_nested_list {
struct list_head head;
int x;
};
struct my_list {
struct my_list *next;
struct list_head nested;
};
void add_item(struct my_list **my_list) {
struct my_list *item = malloc(sizeof *item);
if (!item)
abort();
INIT_LIST_HEAD(&item->nested);
while (__VERIFIER_nondet_int())
{
struct my_nested_list *nested = malloc(sizeof *nested);
if (!nested)
abort();
list_add_tail(&nested->head, &item->nested);
}
item->next = *my_list;
*my_list = item;
}
int main() {
struct my_list *my_list = NULL;
while (__VERIFIER_nondet_int()) {
add_item(&my_list);
}
__VERIFIER_plot(NULL);
while (my_list) {
struct list_head *head = my_list->nested.next;
while (&my_list->nested != head) {
struct list_head *next = head->next;
free(/* FIXME: should use list_entry() */ head);
head = next;
}
struct my_list *next = my_list->next;
free(my_list);
my_list = next;
}
return 0;
}
|
#ifndef _PACKING_
#define _PACKING_
/*
Copyright (C) 1991-2001 and beyond by Bungie Studios, Inc.
and the "Aleph One" developers.
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.
This license is contained in the file "COPYING",
which is included with this source code; it is available online at
http://www.gnu.org/licenses/gpl.html
Created by Loren Petrich, August 28, 2000
Basic packing and unpacking routines. These are used because the Marathon series has used
packed big-endian data formats, while internally, data is most efficiently accessed
if it has native alignments, which often involve compiler-generated padding.
Furthermore, the data may internally be little-endian instead of big-endian.
The packed form of the data is a simple stream of bytes, and as the routines run,
they advance the stream pointer appropriately. So be sure to keep a copy of an object's
base pointer when using these routines.
The syntax was chosen to make it easy to create an unpacking version of a packing routine,
by simply changing the routine names.
StreamToValue(uint8* &Stream, T& Number)
unpacks a stream into a numerical value (T is int16, uint16, int32, uint32)
ValueToStream(uint8* &Stream, T Number)
packs a numerical value (T is int16, uint16, int32, uint32) into a stream
StreamToList(uint8* &Stream, T* List, size_t Count)
unpacks a stream into a list of numerical values (T is int16, uint16, int32, uint32)
ListToStream(uint8* &Stream, const T* List, size_t Count)
packs a list of numerical values (T is int16, uint16, int32, uint32) into a stream
StreamToBytes(uint8* &Stream, void* Bytes, size_t Count)
unpacks a stream into a block of bytes
BytesToStream(uint8* &Stream, const void* Bytes, size_t Count)
packs a block of bytes into a stream
Aug 27, 2002 (Alexander Strange):
Moved functions to Packing.cpp to get around inlining issues.
*/
#include "cstypes.h"
// Default: packed-data is big-endian.
// May be overridden by some previous definition,
// as is the case for the 3D Studio Max loader code,
// which uses little-endian order
#if !(defined(PACKED_DATA_IS_BIG_ENDIAN)) && !(defined(PACKED_DATA_IS_LITTLE_ENDIAN)) && (!defined(PACKING_INTERNAL))
#define PACKED_DATA_IS_BIG_ENDIAN
#undef PACKED_DATA_IS_LITTLE_ENDIAN
#endif
#if (defined(PACKED_DATA_IS_BIG_ENDIAN)) && (defined(PACKED_DATA_IS_LITTLE_ENDIAN))
#error "PACKED_DATA_IS_BIG_ENDIAN and PACKED_DATA_IS_LITTLE_ENDIAN cannot both be defined at the same time!"
#endif
#ifdef PACKED_DATA_IS_BIG_ENDIAN
#define StreamToValue StreamToValueBE
#define ValueToStream ValueToStreamBE
#endif
#ifdef PACKED_DATA_IS_LITTLE_ENDIAN
#define StreamToValue StreamToValueLE
#define ValueToStream ValueToStreamLE
#endif
extern void StreamToValue(uint8* &Stream, uint16 &Value);
extern void StreamToValue(uint8* &Stream, int16 &Value);
extern void StreamToValue(uint8* &Stream, uint32 &Value);
extern void StreamToValue(uint8* &Stream, int32 &Value);
extern void ValueToStream(uint8* &Stream, uint16 Value);
extern void ValueToStream(uint8* &Stream, int16 Value);
extern void ValueToStream(uint8* &Stream, uint32 Value);
extern void ValueToStream(uint8* &Stream, int32 Value);
#ifndef PACKING_INTERNAL
template<class T> inline static void StreamToList(uint8* &Stream, T* List, size_t Count)
{
T* ValuePtr = List;
for (size_t k=0; k<Count; k++)
StreamToValue(Stream,*(ValuePtr++));
}
template<class T> inline static void ListToStream(uint8* &Stream, T* List, size_t Count)
{
T* ValuePtr = List;
for (size_t k=0; k<Count; k++)
ValueToStream(Stream,*(ValuePtr++));
}
inline static void StreamToBytes(uint8* &Stream, void* Bytes, size_t Count)
{
memcpy(Bytes,Stream,Count);
Stream += Count;
}
inline static void BytesToStream(uint8* &Stream, const void* Bytes, size_t Count)
{
memcpy(Stream,Bytes,Count);
Stream += Count;
}
#endif
#endif
|
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2015 - Daniel De Matteis
*
* RetroArch 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 Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch 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 RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "../../driver.h"
#include <stdlib.h>
#include <boolean.h>
#include "../../general.h"
#include <string.h>
#include <retro_inline.h>
#ifdef GEKKO
#include <gccore.h>
#include <ogcsys.h>
#else
#include <cafe/ai.h>
#endif
#include "../../gfx/drivers/gx_sdk_defines.h"
#define CHUNK_FRAMES 64
#define CHUNK_SIZE (CHUNK_FRAMES * sizeof(uint32_t))
#define BLOCKS 16
#ifdef GEKKO
#define AIInit AUDIO_Init
#define AIInitDMA AUDIO_InitDMA
#define AIStartDMA AUDIO_StartDMA
#define AIStopDMA AUDIO_StopDMA
#define AIRegisterDMACallback AUDIO_RegisterDMACallback
#define AISetDSPSampleRate AUDIO_SetDSPSampleRate
#endif
typedef struct
{
uint32_t data[BLOCKS][CHUNK_FRAMES];
volatile unsigned dma_busy;
volatile unsigned dma_next;
volatile unsigned dma_write;
size_t write_ptr;
OSCond cond;
bool nonblock;
bool is_paused;
} gx_audio_t;
static volatile gx_audio_t *gx_audio_data;
static volatile bool stop_audio;
static void dma_callback(void)
{
gx_audio_t *wa = (gx_audio_t*)gx_audio_data;
if (stop_audio)
return;
/* Erase last chunk to avoid repeating audio. */
memset(wa->data[wa->dma_busy], 0, CHUNK_SIZE);
wa->dma_busy = wa->dma_next;
wa->dma_next = (wa->dma_next + 1) & (BLOCKS - 1);
DCFlushRange(wa->data[wa->dma_next], CHUNK_SIZE);
AIInitDMA((uint32_t)wa->data[wa->dma_next], CHUNK_SIZE);
OSSignalCond(wa->cond);
}
static void *gx_audio_init(const char *device,
unsigned rate, unsigned latency)
{
settings_t *settings = config_get_ptr();
gx_audio_t *wa = (gx_audio_t*)memalign(32, sizeof(*wa));
if (!wa)
return NULL;
gx_audio_data = (gx_audio_t*)wa;
memset(wa, 0, sizeof(*wa));
AIInit(NULL);
AIRegisterDMACallback(dma_callback);
if (rate < 33000)
{
AISetDSPSampleRate(AI_SAMPLERATE_32KHZ);
settings->audio.out_rate = 32000;
}
else
{
AISetDSPSampleRate(AI_SAMPLERATE_48KHZ);
settings->audio.out_rate = 48000;
}
OSInitThreadQueue(&wa->cond);
wa->dma_write = BLOCKS - 1;
DCFlushRange(wa->data, sizeof(wa->data));
stop_audio = false;
AIInitDMA((uint32_t)wa->data[wa->dma_next], CHUNK_SIZE);
AIStartDMA();
return wa;
}
/* Wii uses silly R, L, R, L interleaving. */
static INLINE void copy_swapped(uint32_t * restrict dst,
const uint32_t * restrict src, size_t size)
{
do
{
uint32_t s = *src++;
*dst++ = (s >> 16) | (s << 16);
}while(--size);
}
static ssize_t gx_audio_write(void *data, const void *buf_, size_t size)
{
size_t frames = size >> 2;
const uint32_t *buf = buf_;
gx_audio_t *wa = data;
while (frames)
{
size_t to_write = CHUNK_FRAMES - wa->write_ptr;
if (frames < to_write)
to_write = frames;
/* FIXME: Nonblocking audio should break out of loop
* when it has nothing to write. */
while ((wa->dma_write == wa->dma_next ||
wa->dma_write == wa->dma_busy) && !wa->nonblock)
OSSleepThread(wa->cond);
copy_swapped(wa->data[wa->dma_write] + wa->write_ptr, buf, to_write);
wa->write_ptr += to_write;
frames -= to_write;
buf += to_write;
if (wa->write_ptr >= CHUNK_FRAMES)
{
wa->write_ptr -= CHUNK_FRAMES;
wa->dma_write = (wa->dma_write + 1) & (BLOCKS - 1);
}
}
return size;
}
static bool gx_audio_stop(void *data)
{
gx_audio_t *wa = (gx_audio_t*)data;
if (!wa)
return false;
AIStopDMA();
memset(wa->data, 0, sizeof(wa->data));
DCFlushRange(wa->data, sizeof(wa->data));
wa->is_paused = true;
return true;
}
static void gx_audio_set_nonblock_state(void *data, bool state)
{
gx_audio_t *wa = (gx_audio_t*)data;
if (wa)
wa->nonblock = state;
}
static bool gx_audio_start(void *data)
{
gx_audio_t *wa = (gx_audio_t*)data;
if (!wa)
return false;
AIStartDMA();
wa->is_paused = false;
return true;
}
static bool gx_audio_alive(void *data)
{
gx_audio_t *wa = (gx_audio_t*)data;
if (!wa)
return false;
return !wa->is_paused;
}
static void gx_audio_free(void *data)
{
gx_audio_t *wa = (gx_audio_t*)data;
if (!wa)
return;
stop_audio = true;
AIStopDMA();
AIRegisterDMACallback(NULL);
if (wa->cond)
LWP_CloseQueue(wa->cond);
wa->cond = 0;
free(data);
}
static size_t gx_audio_write_avail(void *data)
{
gx_audio_t *wa = (gx_audio_t*)data;
return ((wa->dma_busy - wa->dma_write + BLOCKS)
& (BLOCKS - 1)) * CHUNK_SIZE;
}
static size_t gx_audio_buffer_size(void *data)
{
(void)data;
return BLOCKS * CHUNK_SIZE;
}
static bool gx_audio_use_float(void *data)
{
/* TODO/FIXME - verify */
(void)data;
return false;
}
audio_driver_t audio_gx = {
gx_audio_init,
gx_audio_write,
gx_audio_stop,
gx_audio_start,
gx_audio_alive,
gx_audio_set_nonblock_state,
gx_audio_free,
gx_audio_use_float,
"gx",
gx_audio_write_avail,
gx_audio_buffer_size,
};
|
/**
******************************************************************************
* @file usb_conf.h
* @author MCD Application Team
* @version V4.0.0
* @date 21-January-2013
* @brief Custom HID demo configuration file
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>
*
* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.st.com/software_license_agreement_liberty_v2
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __USB_CONF_H
#define __USB_CONF_H
/* Includes ------------------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
/* External variables --------------------------------------------------------*/
/*-------------------------------------------------------------*/
/* EP_NUM */
/* defines how many endpoints are used by the device */
/*-------------------------------------------------------------*/
#define EP_NUM (2)
/*-------------------------------------------------------------*/
/* -------------- Buffer Description Table -----------------*/
/*-------------------------------------------------------------*/
/* buffer table base address */
/* buffer table base address */
#define BTABLE_ADDRESS (0x00)
/* EP0 */
/* rx/tx buffer base address */
#define ENDP0_RXADDR (0x18)
#define ENDP0_TXADDR (0x58)
/* EP1 */
/* tx buffer base address */
#define ENDP1_TXADDR (0x100)
#define ENDP1_RXADDR (0x104)
/*-------------------------------------------------------------*/
/* ------------------- ISTR events -------------------------*/
/*-------------------------------------------------------------*/
/* IMR_MSK */
/* mask defining which events has to be handled */
/* by the device application software */
#define IMR_MSK (CNTR_CTRM | CNTR_WKUPM | CNTR_SUSPM | CNTR_ERRM | CNTR_SOFM \
| CNTR_ESOFM | CNTR_RESETM )
/* CTR service routines */
/* associated to defined endpoints */
/* #define EP1_IN_Callback NOP_Process */
#define EP2_IN_Callback NOP_Process
#define EP3_IN_Callback NOP_Process
#define EP4_IN_Callback NOP_Process
#define EP5_IN_Callback NOP_Process
#define EP6_IN_Callback NOP_Process
#define EP7_IN_Callback NOP_Process
//#define EP1_OUT_Callback NOP_Process
#define EP2_OUT_Callback NOP_Process
#define EP3_OUT_Callback NOP_Process
#define EP4_OUT_Callback NOP_Process
#define EP5_OUT_Callback NOP_Process
#define EP6_OUT_Callback NOP_Process
#define EP7_OUT_Callback NOP_Process
#endif /*__USB_CONF_H*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
/**
* @file exdispid.h
* Copyright 2012, 2013 MinGW.org project
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#ifndef _EXDISPID_H
#define _EXDISPID_H
#pragma GCC system_header
#include <_mingw.h>
#define DISPID_BEFORENAVIGATE2 250
#define DISPID_NEWWINDOW2 251
#define DISPID_PROGRESSCHANGE 108
#define DISPID_DOCUMENTCOMPLETE 259
#define DISPID_STATUSTEXTCHANGE 102
#define DISPID_TITLECHANGE 113
#endif
|
/*
* SRT - Secure, Reliable, Transport
* Copyright (c) 2018 Haivision Systems Inc.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
*/
/*****************************************************************************
written by
Haivision Systems Inc.
2014-03-11 (jdube)
Adaptation for SRT.
*****************************************************************************/
#include <string.h> /* memset, memcpy */
#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#else
#include <arpa/inet.h> /* htonl, ntohl */
#endif
#include "hcrypt.h"
/*
* HaiCrypt SRT (Secure Reliable Transport) Media Stream (MS) Msg Prefix:
* This is UDT data header with Crypto Key Flags (KF) added.
* Header is in 32bit host order words in the context of the functions of this handler.
*
* 0 1 2 3
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
* +-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-+
* 0x00 |0| Packet Sequence Number (pki) |
* +-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-+
* 0x04 |FF |o|KF | Message Number |
* +-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-+
* 0x08 | Time Stamp |
* +-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-+
* 0x0C | Destination Socket ID) |
* +-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-+
* | Payload... |
*/
/*
* HaiCrypt Standalone Transport Keying Material (KM) Msg header kept in SRT
* Message and cache maintained in network order
*
* 0 1 2 3
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
* +-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-+
* 0x00 |0|Vers | PT | Sign | resv |
* +-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-|-+-+-+-+-+-+-+-+
* ... .
*/
#define HCRYPT_MSG_SRT_HDR_SZ 16
#define HCRYPT_MSG_SRT_PFX_SZ 16
#define HCRYPT_MSG_SRT_OFS_PKI 0
#define HCRYPT_MSG_SRT_OFS_MSGNO 4
#define HCRYPT_MSG_SRT_SHF_KFLGS 27 //shift
static hcrypt_MsgInfo _hcMsg_SRT_MsgInfo;
static unsigned hcryptMsg_SRT_GetKeyFlags(unsigned char *msg)
{
uint32_t msgno;
memcpy(&msgno, &msg[HCRYPT_MSG_SRT_OFS_MSGNO], sizeof(msgno)); //header is in host order
return((unsigned)((msgno >> HCRYPT_MSG_SRT_SHF_KFLGS) & HCRYPT_MSG_F_xSEK));
}
static hcrypt_Pki hcryptMsg_SRT_GetPki(unsigned char *msg, int nwkorder)
{
hcrypt_Pki pki;
memcpy(&pki, &msg[HCRYPT_MSG_SRT_OFS_PKI], sizeof(pki)); //header is in host order
return (nwkorder ? htonl(pki) : pki);
}
static void hcryptMsg_SRT_SetPki(unsigned char *msg, hcrypt_Pki pki)
{
memcpy(&msg[HCRYPT_MSG_SRT_OFS_PKI], &pki, sizeof(pki)); //header is in host order
}
static void hcryptMsg_SRT_ResetCache(unsigned char *pfx_cache, unsigned pkt_type, unsigned kflgs)
{
switch(pkt_type) {
case HCRYPT_MSG_PT_MS: /* Media Stream */
/* Nothing to do, header filled by protocol */
break;
case HCRYPT_MSG_PT_KM: /* Keying Material */
pfx_cache[HCRYPT_MSG_KM_OFS_VERSION] = (unsigned char)((HCRYPT_MSG_VERSION << 4) | pkt_type); // version || PT
pfx_cache[HCRYPT_MSG_KM_OFS_SIGN] = (unsigned char)((HCRYPT_MSG_SIGN >> 8) & 0xFF); // Haivision PnP Mfr ID
pfx_cache[HCRYPT_MSG_KM_OFS_SIGN+1] = (unsigned char)(HCRYPT_MSG_SIGN & 0xFF);
pfx_cache[HCRYPT_MSG_KM_OFS_KFLGS] = (unsigned char)kflgs; //HCRYPT_MSG_F_xxx
break;
default:
break;
}
}
static void hcryptMsg_SRT_IndexMsg(unsigned char *msg, unsigned char *pfx_cache)
{
(void)msg;
(void)pfx_cache;
return; //nothing to do, header and index maintained by SRT
}
static int hcryptMsg_SRT_ParseMsg(unsigned char *msg)
{
int rc;
if ((HCRYPT_MSG_VERSION == hcryptMsg_KM_GetVersion(msg)) /* Version 1 */
&& (HCRYPT_MSG_PT_KM == hcryptMsg_KM_GetPktType(msg)) /* Keying Material */
&& (HCRYPT_MSG_SIGN == hcryptMsg_KM_GetSign(msg))) { /* 'HAI' PnP Mfr ID */
rc = HCRYPT_MSG_PT_KM;
} else {
//Assume it's data.
//SRT does not call this for MS msg
rc = HCRYPT_MSG_PT_MS;
}
switch(rc) {
case HCRYPT_MSG_PT_MS:
if (hcryptMsg_HasNoSek(&_hcMsg_SRT_MsgInfo, msg)
|| hcryptMsg_HasBothSek(&_hcMsg_SRT_MsgInfo, msg)) {
HCRYPT_LOG(LOG_ERR, "invalid MS msg flgs: %02x\n",
hcryptMsg_GetKeyIndex(&_hcMsg_SRT_MsgInfo, msg));
return(-1);
}
break;
case HCRYPT_MSG_PT_KM:
if (HCRYPT_SE_TSSRT != hcryptMsg_KM_GetSE(msg)) { //Check Stream Encapsulation (SE)
HCRYPT_LOG(LOG_ERR, "invalid KM msg SE: %d\n",
hcryptMsg_KM_GetSE(msg));
return(-1);
}
if (hcryptMsg_KM_HasNoSek(msg)) {
HCRYPT_LOG(LOG_ERR, "invalid KM msg flgs: %02x\n",
hcryptMsg_KM_GetKeyIndex(msg));
return(-1);
}
break;
default:
HCRYPT_LOG(LOG_ERR, "invalid pkt type: %d\n", rc);
rc = 0; /* unknown packet type */
break;
}
return(rc); /* -1: error, 0: unknown: >0: PT */
}
static hcrypt_MsgInfo _hcMsg_SRT_MsgInfo;
hcrypt_MsgInfo *hcryptMsg_SRT_MsgInfo(void)
{
_hcMsg_SRT_MsgInfo.hdr_len = HCRYPT_MSG_SRT_HDR_SZ;
_hcMsg_SRT_MsgInfo.pfx_len = HCRYPT_MSG_SRT_PFX_SZ;
_hcMsg_SRT_MsgInfo.getKeyFlags = hcryptMsg_SRT_GetKeyFlags;
_hcMsg_SRT_MsgInfo.getPki = hcryptMsg_SRT_GetPki;
_hcMsg_SRT_MsgInfo.setPki = hcryptMsg_SRT_SetPki;
_hcMsg_SRT_MsgInfo.resetCache = hcryptMsg_SRT_ResetCache;
_hcMsg_SRT_MsgInfo.indexMsg = hcryptMsg_SRT_IndexMsg;
_hcMsg_SRT_MsgInfo.parseMsg = hcryptMsg_SRT_ParseMsg;
return(&_hcMsg_SRT_MsgInfo);
}
|
/******************************************************************************
* $Id$
*
* Project: GDAL Core
* Purpose: Read metadata from Kompsat imagery.
* Author: Alexander Lisovenko
* Author: Dmitry Baryshnikov, polimax@mail.ru
*
******************************************************************************
* Copyright (c) 2014-2015 NextGIS <info@nextgis.ru>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
****************************************************************************/
#ifndef READER_KOMPSAT_H_INCLUDED
#define READER_KOMPSAT_H_INCLUDED
#include "reader_pleiades.h"
/**
@brief Metadata reader for Kompsat
TIFF filename: aaaaaaaaaa.tif
Metadata filename: aaaaaaaaaa.eph aaaaaaaaaa.txt
RPC filename: aaaaaaaaaa.rpc
Common metadata (from metadata filename):
SatelliteId: AUX_SATELLITE_NAME
AcquisitionDateTime: IMG_ACQISITION_START_TIME, IMG_ACQISITION_END_TIME
*/
class GDALMDReaderKompsat: public GDALMDReaderBase
{
public:
GDALMDReaderKompsat(const char *pszPath, char **papszSiblingFiles);
virtual ~GDALMDReaderKompsat();
virtual const bool HasRequiredFiles() const;
virtual char** GetMetadataFiles() const;
protected:
virtual void LoadMetadata();
char** ReadTxtToList();
virtual const time_t GetAcquisitionTimeFromString(const char* pszDateTime);
protected:
CPLString m_osIMDSourceFilename;
CPLString m_osRPBSourceFilename;
};
#endif // READER_KOMPSAT_H_INCLUDED
|
/*
* Copyright (C) 1998 Nikos Mavroyanopoulos
* Copyright (C) 1999,2000 Sascha Schumman, Nikos Mavroyanopoulos
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Library General Public License as published
* by the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* This is a simple test driver for use in combination with test_hash.sh
*
* It's ugly, limited and you should hit :q! now
*
* $Id: driver.c,v 1.7 2006/01/08 09:08:29 imipak Exp $
*/
#define MUTILS_USE_MHASH_CONFIG
#include <mhash.h>
#define MAX_DIGEST_SIZE 256
int main(int argc, char **argv)
{
mutils_word8 digest[MAX_DIGEST_SIZE]; /* enough space to hold digests */
mutils_word8 data[1024];
ssize_t r;
mutils_word32 i;
mutils_boolean found;
hashid hashid;
MHASH td;
if (argc != 2)
{
fprintf(stderr, "Syntax: %s <name of hash function>\n", argv[0]);
exit(1);
}
/* Look for the right mhash hash id */
for (found = MUTILS_FALSE, hashid = 0; hashid <= mhash_count(); hashid++)
{
if (mhash_get_hash_name_static(hashid))
{
if (! mutils_strcmp((mutils_word8 *) argv[1], mhash_get_hash_name_static(hashid)))
{
found = MUTILS_TRUE;
break;
}
}
}
if (found == MUTILS_FALSE)
{
fprintf(stderr, "FATAL: hash function %s not available!\n", argv[1]);
exit(MUTILS_INVALID_FUNCTION);
}
assert(mhash_get_block_size(hashid) <= MAX_DIGEST_SIZE);
td = mhash_init(hashid); /* hash stdin until EOF ist reached */
do
{
r = read(0, data, sizeof data);
assert(r >= 0);
mhash(td, data, r);
} while (r);
mhash_deinit(td, digest);
for (i = 0; i < mhash_get_block_size(hashid); i++)
{
printf("%02X", digest[i]);
}
printf("\n");
return(MUTILS_OK);
}
|
#pragma once
namespace DX
{
// Provides an interface for an application that owns DeviceResources to be notified of the device being lost or created.
interface IDeviceNotify
{
virtual void OnDeviceLost() = 0;
virtual void OnDeviceRestored() = 0;
};
// Controls all the DirectX device resources.
class DeviceResources
{
public:
DeviceResources();
void SetWindow(Windows::UI::Core::CoreWindow^ window);
void SetLogicalSize(Windows::Foundation::Size logicalSize);
void SetCurrentOrientation(Windows::Graphics::Display::DisplayOrientations currentOrientation);
void SetDpi(float dpi);
void ValidateDevice();
void HandleDeviceLost();
void RegisterDeviceNotify(IDeviceNotify* deviceNotify);
void Trim();
void Present();
// The size of the render target, in pixels.
Windows::Foundation::Size GetOutputSize() const { return m_outputSize; }
// The size of the render target, in dips.
Windows::Foundation::Size GetLogicalSize() const { return m_logicalSize; }
float GetDpi() const { return m_effectiveDpi; }
// D3D Accessors.
ID3D11Device3* GetD3DDevice() const { return m_d3dDevice.Get(); }
ID3D11DeviceContext3* GetD3DDeviceContext() const { return m_d3dContext.Get(); }
IDXGISwapChain3* GetSwapChain() const { return m_swapChain.Get(); }
D3D_FEATURE_LEVEL GetDeviceFeatureLevel() const { return m_d3dFeatureLevel; }
ID3D11RenderTargetView1* GetBackBufferRenderTargetView() const { return m_d3dRenderTargetView.Get(); }
ID3D11DepthStencilView* GetDepthStencilView() const { return m_d3dDepthStencilView.Get(); }
D3D11_VIEWPORT GetScreenViewport() const { return m_screenViewport; }
DirectX::XMFLOAT4X4 GetOrientationTransform3D() const { return m_orientationTransform3D; }
// D2D Accessors.
ID2D1Factory3* GetD2DFactory() const { return m_d2dFactory.Get(); }
ID2D1Device2* GetD2DDevice() const { return m_d2dDevice.Get(); }
ID2D1DeviceContext2* GetD2DDeviceContext() const { return m_d2dContext.Get(); }
ID2D1Bitmap1* GetD2DTargetBitmap() const { return m_d2dTargetBitmap.Get(); }
IDWriteFactory3* GetDWriteFactory() const { return m_dwriteFactory.Get(); }
IWICImagingFactory2* GetWicImagingFactory() const { return m_wicFactory.Get(); }
D2D1::Matrix3x2F GetOrientationTransform2D() const { return m_orientationTransform2D; }
private:
void CreateDeviceIndependentResources();
void CreateDeviceResources();
void CreateWindowSizeDependentResources();
void UpdateRenderTargetSize();
DXGI_MODE_ROTATION ComputeDisplayRotation();
// Direct3D objects.
Microsoft::WRL::ComPtr<ID3D11Device3> m_d3dDevice;
Microsoft::WRL::ComPtr<ID3D11DeviceContext3> m_d3dContext;
Microsoft::WRL::ComPtr<IDXGISwapChain3> m_swapChain;
// Direct3D rendering objects. Required for 3D.
Microsoft::WRL::ComPtr<ID3D11RenderTargetView1> m_d3dRenderTargetView;
Microsoft::WRL::ComPtr<ID3D11DepthStencilView> m_d3dDepthStencilView;
D3D11_VIEWPORT m_screenViewport;
// Direct2D drawing components.
Microsoft::WRL::ComPtr<ID2D1Factory3> m_d2dFactory;
Microsoft::WRL::ComPtr<ID2D1Device2> m_d2dDevice;
Microsoft::WRL::ComPtr<ID2D1DeviceContext2> m_d2dContext;
Microsoft::WRL::ComPtr<ID2D1Bitmap1> m_d2dTargetBitmap;
// DirectWrite drawing components.
Microsoft::WRL::ComPtr<IDWriteFactory3> m_dwriteFactory;
Microsoft::WRL::ComPtr<IWICImagingFactory2> m_wicFactory;
// Cached reference to the Window.
Platform::Agile<Windows::UI::Core::CoreWindow> m_window;
// Cached device properties.
D3D_FEATURE_LEVEL m_d3dFeatureLevel;
Windows::Foundation::Size m_d3dRenderTargetSize;
Windows::Foundation::Size m_outputSize;
Windows::Foundation::Size m_logicalSize;
Windows::Graphics::Display::DisplayOrientations m_nativeOrientation;
Windows::Graphics::Display::DisplayOrientations m_currentOrientation;
float m_dpi;
// This is the DPI that will be reported back to the app. It takes into account whether the app supports high resolution screens or not.
float m_effectiveDpi;
// Transforms used for display orientation.
D2D1::Matrix3x2F m_orientationTransform2D;
DirectX::XMFLOAT4X4 m_orientationTransform3D;
// The IDeviceNotify can be held directly as it owns the DeviceResources.
IDeviceNotify* m_deviceNotify;
};
} |
/*
* 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 "../AmazonServiceException.h"
/**
* <p>
* The queue referred to does not exist.
* </p>
*/
@interface SQSQueueDoesNotExistException:AmazonServiceException
{
}
-(id)initWithMessage:(NSString *)message;
/**
* Returns a string representation of this object; useful for testing and
* debugging.
*
* @return A string representation of this object.
*/
-(NSString *)description;
@end
|
// Copyright 2017 The Abseil Authors.
//
// 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 S2_THIRD_PARTY_ABSL_BASE_INTERNAL_IDENTITY_H_
#define S2_THIRD_PARTY_ABSL_BASE_INTERNAL_IDENTITY_H_
namespace absl {
namespace internal {
template <typename T>
struct identity {
typedef T type;
};
template <typename T>
using identity_t = typename identity<T>::type;
} // namespace internal
} // namespace absl
#endif // S2_THIRD_PARTY_ABSL_BASE_INTERNAL_IDENTITY_H_
|
/*++
Copyright (c) 2006 - 2010, 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.h
Abstract:
GUIDs used for ACPI Description
--*/
#ifndef _EFI_ACPI_DESCRIPTION_H_
#define _EFI_ACPI_DESCRIPTION_H_
#define EFI_ACPI_DESCRIPTION_GUID \
{ \
0x3c699197, 0x93c, 0x4c69, {0xb0, 0x6b, 0x12, 0x8a, 0xe3, 0x48, 0x1d, 0xc9} \
}
#pragma pack(1)
typedef struct {
UINT8 AddressSpaceId;
UINT8 RegisterBitWidth;
UINT8 RegisterBitOffset;
UINT8 AccessSize;
UINT64 Address;
} EFI_ACPI_GENERIC_ADDRESS_STRUCTURE;
#define ACPI_ADDRESS_ID_MEMORY 0
#define ACPI_ADDRESS_ID_IO 1
#define ACPI_ADDRESS_ID_PCI 2
#define ACPI_ADDRESS_ID_EC 3
#define ACPI_ADDRESS_ID_SMBUS 4
#define ACPI_ADDRESS_ACCESS_ANY 0
#define ACPI_ADDRESS_ACCESS_BYTE 1
#define ACPI_ADDRESS_ACCESS_WORD 2
#define ACPI_ADDRESS_ACCESS_DWORD 3
#define ACPI_ADDRESS_ACCESS_QWORD 4
//
// Following structure defines ACPI Description information.
// This information is platform specific, may be consumed by DXE generic driver.
//
typedef struct _EFI_ACPI_DESCRIPTION {
//
// For Timer
//
EFI_ACPI_GENERIC_ADDRESS_STRUCTURE PM_TMR_BLK;
UINT8 PM_TMR_LEN;
UINT8 TMR_VAL_EXT;
//
// For RTC
//
UINT8 DAY_ALRM;
UINT8 MON_ALRM;
UINT8 CENTURY;
//
// For Reset
//
EFI_ACPI_GENERIC_ADDRESS_STRUCTURE RESET_REG;
UINT8 RESET_VALUE;
//
// For Shutdown
//
EFI_ACPI_GENERIC_ADDRESS_STRUCTURE PM1a_EVT_BLK;
EFI_ACPI_GENERIC_ADDRESS_STRUCTURE PM1b_EVT_BLK;
EFI_ACPI_GENERIC_ADDRESS_STRUCTURE PM1a_CNT_BLK;
EFI_ACPI_GENERIC_ADDRESS_STRUCTURE PM1b_CNT_BLK;
EFI_ACPI_GENERIC_ADDRESS_STRUCTURE PM2_CNT_BLK;
UINT8 PM1_EVT_LEN;
UINT8 PM1_CNT_LEN;
UINT8 PM2_CNT_LEN;
UINT8 SLP_TYPa;
UINT8 SLP_TYPb;
//
// For sleep
//
UINT8 SLP1_TYPa;
UINT8 SLP1_TYPb;
UINT8 SLP2_TYPa;
UINT8 SLP2_TYPb;
UINT8 SLP3_TYPa;
UINT8 SLP3_TYPb;
UINT8 SLP4_TYPa;
UINT8 SLP4_TYPb;
//
// GPE
//
EFI_ACPI_GENERIC_ADDRESS_STRUCTURE GPE0_BLK;
EFI_ACPI_GENERIC_ADDRESS_STRUCTURE GPE1_BLK;
UINT8 GPE0_BLK_LEN;
UINT8 GPE1_BLK_LEN;
UINT8 GPE1_BASE;
//
// IAPC Boot Arch
//
UINT16 IAPC_BOOT_ARCH;
//
// Flags
//
UINT32 Flags;
} EFI_ACPI_DESCRIPTION;
#pragma pack()
extern EFI_GUID gEfiAcpiDescriptionGuid;
#endif
|
/*
* Copyright (C) 2011 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. 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 INC. 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.
*/
#pragma once
#include "JSCJSValue.h"
namespace JSC {
typedef enum { } Unknown;
typedef JSValue* HandleSlot;
template<typename T> struct HandleTypes {
typedef T* ExternalType;
static ExternalType getFromSlot(HandleSlot slot) { return (slot && *slot) ? reinterpret_cast<ExternalType>(static_cast<void*>(slot->asCell())) : 0; }
static JSValue toJSValue(T* cell) { return reinterpret_cast<JSCell*>(cell); }
template<typename U> static void validateUpcast() { T* temp; temp = (U*)0; }
};
template<> struct HandleTypes<Unknown> {
typedef JSValue ExternalType;
static ExternalType getFromSlot(HandleSlot slot) { return slot ? *slot : JSValue(); }
static JSValue toJSValue(const JSValue& v) { return v; }
template<typename U> static void validateUpcast() { }
};
} // namespace JSC
|
/**@file
Copyright (c) 2006 - 2009, 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:
MiscSystemLanguageStringData.c
Abstract:
This driver parses the mMiscSubclassDataTable structure and reports
any generated data to the DataHub.
**/
#include "MiscSubclassDriver.h"
//
// Static (possibly build generated) Bios Vendor data.
//
MISC_SMBIOS_TABLE_DATA(EFI_MISC_SYSTEM_LANGUAGE_STRING_DATA, SystemLanguageString) = {
0,
STRING_TOKEN(STR_MISC_SYSTEM_LANGUAGE_STRING)
};
/* eof - MiscSystemLanguageStringData.c */
|
/*
* Copyright (c) 2013 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Event delivery mechanism
* Based on the 'Observer' pattern
*/
#pragma once
#include "vmm_startup.h"
#define EVENT_MGR_ERROR (UINT32)-1
/*
* CALLBACK
*/
typedef BOOLEAN (*event_callback) (
GUEST_CPU_HANDLE gcpu,
void *pv
);
/*
* EVENTS
*
* This enumeration specify the supported UVMM events.
* Note that for every event there should be an entry in EVENT_CHARACTERISTICS
* characterizing the event in event_mgr.c.
*
* failing to add entry in EVENT_CHARACTERISTICS triggers assertion at the
* event_initialize_event_manger entry point
*/
#ifndef UVMM_EVENT_INTERNAL
typedef enum {
// emulator
EVENT_EMULATOR_BEFORE_MEM_WRITE = 0,
EVENT_EMULATOR_AFTER_MEM_WRITE,
EVENT_EMULATOR_AS_GUEST_ENTER,
EVENT_EMULATOR_AS_GUEST_LEAVE,
// guest cpu CR writes
EVENT_GCPU_AFTER_GUEST_CR0_WRITE,
EVENT_GCPU_AFTER_GUEST_CR3_WRITE,
EVENT_GCPU_AFTER_GUEST_CR4_WRITE,
// guest cpu invalidate page
EVENT_GCPU_INVALIDATE_PAGE,
EVENT_GCPU_PAGE_FAULT,
// guest cpu msr writes
EVENT_GCPU_AFTER_EFER_MSR_WRITE,
EVENT_GCPU_AFTER_PAT_MSR_WRITE,
EVENT_GCPU_AFTER_MTRR_MSR_WRITE,
// guest activity state
EVENT_GCPU_ACTIVITY_STATE_CHANGE,
EVENT_GCPU_ENTERING_S3,
EVENT_GCPU_RETURNED_FROM_S3,
// ept events
EVENT_GCPU_EPT_MISCONFIGURATION,
EVENT_GCPU_EPT_VIOLATION,
// mtf events
EVENT_GCPU_MTF,
// GPM modification
EVENT_BEGIN_GPM_MODIFICATION_BEFORE_CPUS_STOPPED,
EVENT_BEGIN_GPM_MODIFICATION_AFTER_CPUS_STOPPED,
EVENT_END_GPM_MODIFICATION_BEFORE_CPUS_RESUMED,
EVENT_END_GPM_MODIFICATION_AFTER_CPUS_RESUMED,
// guest memory modification
EVENT_BEGIN_GUEST_MEMORY_MODIFICATION,
EVENT_END_GUEST_MEMORY_MODIFICATION,
// guest lifecycle
EVENT_GUEST_CREATE,
EVENT_GUEST_DESTROY,
// gcpu lifecycle
EVENT_GCPU_ADD,
EVENT_GCPU_REMOVE,
EVENT_GUEST_LAUNCH,
EVENT_GUEST_CPU_BREAKPOINT,
EVENT_GUEST_CPU_SINGLE_STEP,
EVENTS_COUNT
} UVMM_EVENT_INTERNAL;
#endif
typedef enum {
EVENT_GLOBAL_SCOPE = 1,
EVENT_GUEST_SCOPE = 2,
EVENT_GCPU_SCOPE = 4,
EVENT_ALL_SCOPE = (EVENT_GLOBAL_SCOPE | EVENT_GUEST_SCOPE | EVENT_GCPU_SCOPE)
} EVENT_SCOPE;
typedef struct _EVENT_CHARACTERISTICS
{
UINT32 specific_observers_limits;
EVENT_SCOPE scope;
CHAR8 *event_str;
} EVENT_CHARACTERISTICS, * PEVENT_CHARACTERISTICS;
/*
* Event Manager Interface
*/
UINT32 event_initialize_event_manger(const VMM_STARTUP_STRUCT* startup_struct);
UINT32 event_manager_initialize(UINT32 num_of_host_cpus);
UINT32 event_manager_guest_initialize(GUEST_ID guest_id);
UINT32 event_manager_gcpu_initialize(GUEST_CPU_HANDLE gcpu);
void event_cleanup_event_manger(void);
BOOLEAN event_global_register(
UVMM_EVENT_INTERNAL e, // in: event
event_callback call // in: callback to register on event e
);
BOOLEAN event_guest_register(
UVMM_EVENT_INTERNAL e, // in: event
GUEST_HANDLE guest, // in: guest handle
event_callback call // in: callback to register on event e
);
BOOLEAN event_gcpu_register(
UVMM_EVENT_INTERNAL e, // in: event
GUEST_CPU_HANDLE gcpu, // in: guest cpu
event_callback call // in: callback to register on event e
);
BOOLEAN event_global_unregister(
UVMM_EVENT_INTERNAL e, // in: event
event_callback call // in: callback to unregister from event e
);
BOOLEAN event_guest_unregister(
UVMM_EVENT_INTERNAL e, // in: event
GUEST_HANDLE guest, // in: guest handle
event_callback call // in: callback to unregister from event e
);
BOOLEAN event_gcpu_unregister(
UVMM_EVENT_INTERNAL e, // in: event
GUEST_CPU_HANDLE gcpu, // in: guest cpu
event_callback call // in: callback to unregister from event e
);
typedef enum {
EVENT_NO_HANDLERS_REGISTERED,
EVENT_HANDLED,
EVENT_NOT_HANDLED,
} RAISE_EVENT_RETVAL;
// returns counter of executed observers
BOOLEAN event_raise(
UVMM_EVENT_INTERNAL e, // in: event
GUEST_CPU_HANDLE gcpu, // in: guest cpu
void *p // in: pointer to event specific structure
);
BOOLEAN event_is_registered(
UVMM_EVENT_INTERNAL e, // in: event
GUEST_CPU_HANDLE gcpu, // in: guest cpu
event_callback call // in: callback to check
);
|
/*
* Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
*/
#ifndef __XMPP_CLIENT_H__
#define __XMPP_CLIENT_H__
#include <boost/asio/ip/tcp.hpp>
#include <boost/ptr_container/ptr_map.hpp>
#include "io/ssl_server.h"
#include "io/ssl_session.h"
#include "xmpp/xmpp_config.h"
#include "xmpp/xmpp_connection.h"
#include "xmpp/xmpp_connection_manager.h"
class LifetimeActor;
class LifetimeManager;
class XmppSession;
// Class to represent Xmpp Client
class XmppClient : public XmppConnectionManager {
public:
typedef boost::asio::ip::tcp::endpoint Endpoint;
explicit XmppClient(EventManager *evm);
XmppClient(EventManager *evm, const XmppChannelConfig *config);
virtual ~XmppClient();
void Shutdown();
typedef boost::function<void(XmppChannelMux *, xmps::PeerState)>
ConnectionEventCb;
void RegisterConnectionEvent(xmps::PeerId, ConnectionEventCb);
void UnRegisterConnectionEvent(xmps::PeerId);
void NotifyConnectionEvent(XmppChannelMux *, xmps::PeerState);
size_t ConnectionEventCount() const;
virtual TcpSession *CreateSession();
virtual bool Initialize(short port) ;
XmppClientConnection *CreateConnection(const XmppChannelConfig *config);
XmppClientConnection *FindConnection(const std::string &address);
void InsertConnection(XmppClientConnection *connection);
void RemoveConnection(XmppClientConnection *connection);
size_t ConnectionCount() const;
XmppChannel *FindChannel(const std::string &address);
void ConfigUpdate(const XmppConfigData *cfg);
XmppConfigManager *xmpp_config_mgr() { return config_mgr_.get(); }
LifetimeManager *lifetime_manager();
virtual LifetimeActor *deleter();
protected:
virtual SslSession *AllocSession(SslSocket *socket);
private:
class DeleteActor;
friend class XmppSessionTest;
friend class XmppStreamMessageTest;
friend class DeleteActor;
typedef std::map<Endpoint, XmppClientConnection *> ConnectionMap;
typedef std::map<xmps::PeerId, ConnectionEventCb> ConnectionEventCbMap;
void ProcessConfigUpdate(XmppConfigManager::DiffType delta,
const XmppChannelConfig *current, const XmppChannelConfig *future);
ConnectionMap connection_map_;
ConnectionEventCbMap connection_event_map_;
boost::scoped_ptr<XmppConfigManager> config_mgr_;
boost::scoped_ptr<LifetimeManager> lifetime_manager_;
boost::scoped_ptr<DeleteActor> deleter_;
bool auth_enabled_;
DISALLOW_COPY_AND_ASSIGN(XmppClient);
};
#endif
|
// Helper class to do a lookup of a tag/entity/event to its Atom and convert
// atom to string.
#ifndef CPP_HTMLPARSER_ATOMUTIL_H_
#define CPP_HTMLPARSER_ATOMUTIL_H_
#include <string>
#include "cpp/htmlparser/atom.h"
namespace htmlparser {
class AtomUtil {
public:
static Atom ToAtom(const std::string& s);
// Returns the string representation (tag name) of the atom.
// If the atom is unknown, returns the optional unknown_tag_name which
// defaults to empty (no tagname).
static std::string ToString(Atom a, std::string_view unknown_tag_name = "");
private:
inline static std::string ToString(uint32_t atom_as_int) {
return ToString(static_cast<Atom>(atom_as_int));
}
inline static Atom CastToAtom(uint32_t atom_as_int) {
return static_cast<Atom>(atom_as_int);
}
// No instances of this class.
AtomUtil() = delete;
};
} // namespace htmlparser
#endif // CPP_HTMLPARSER_ATOMUTIL_H_
|
/**
* @file
*
* AutoIP Automatic LinkLocal IP Configuration
*/
/*
*
* Copyright (c) 2007 Dominik Spies <kontakt@dspies.de>
* 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. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* 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.
*
* Author: Dominik Spies <kontakt@dspies.de>
*
* This is a AutoIP implementation for the lwIP TCP/IP stack. It aims to conform
* with RFC 3927.
*
*
* Please coordinate changes and requests with Dominik Spies
* <kontakt@dspies.de>
*/
#ifndef LWIP_HDR_AUTOIP_H
#define LWIP_HDR_AUTOIP_H
#include "lwip/opt.h"
#if LWIP_IPV4 && LWIP_AUTOIP /* don't build if not configured for use in lwipopts.h */
#include "lwip/netif.h"
/* #include "lwip/udp.h" */
#include "netif/etharp.h"
#ifdef __cplusplus
extern "C" {
#endif
/* AutoIP Timing */
#define AUTOIP_TMR_INTERVAL 100
#define AUTOIP_TICKS_PER_SECOND (1000 / AUTOIP_TMR_INTERVAL)
/* RFC 3927 Constants */
#define PROBE_WAIT 1 /* second (initial random delay) */
#define PROBE_MIN 1 /* second (minimum delay till repeated probe) */
#define PROBE_MAX 2 /* seconds (maximum delay till repeated probe) */
#define PROBE_NUM 3 /* (number of probe packets) */
#define ANNOUNCE_NUM 2 /* (number of announcement packets) */
#define ANNOUNCE_INTERVAL 2 /* seconds (time between announcement packets) */
#define ANNOUNCE_WAIT 2 /* seconds (delay before announcing) */
#define MAX_CONFLICTS LWIP_AUTOIP_MAX_CONFLICTS /* (max conflicts before rate limiting) */
#define RATE_LIMIT_INTERVAL LWIP_AUTOIP_RATE_LIMIT_INTERVAL /* seconds (delay between successive attempts) */
#define DEFEND_INTERVAL 10 /* seconds (min. wait between defensive ARPs) */
/* AutoIP client states */
#define AUTOIP_STATE_OFF 0
#define AUTOIP_STATE_PROBING 1
#define AUTOIP_STATE_ANNOUNCING 2
#define AUTOIP_STATE_BOUND 3
struct autoip
{
ip4_addr_t llipaddr; /* the currently selected, probed, announced or used LL IP-Address */
u8_t state; /* current AutoIP state machine state */
u8_t sent_num; /* sent number of probes or announces, dependent on state */
u16_t ttw; /* ticks to wait, tick is AUTOIP_TMR_INTERVAL long */
u8_t lastconflict; /* ticks until a conflict can be solved by defending */
u8_t tried_llipaddr; /* total number of probed/used Link Local IP-Addresses */
};
#define autoip_init() /* Compatibility define, no init needed. */
/** Set a struct autoip allocated by the application to work with */
void autoip_set_struct(struct netif *netif, struct autoip *autoip);
/** Remove a struct autoip previously set to the netif using autoip_set_struct() */
#define autoip_remove_struct(netif) do { (netif)->autoip = NULL; } while (0)
/** Start AutoIP client */
err_t autoip_start(struct netif *netif);
/** Stop AutoIP client */
err_t autoip_stop(struct netif *netif);
/** Handles every incoming ARP Packet, called by etharp_arp_input */
void autoip_arp_reply(struct netif *netif, struct etharp_hdr *hdr);
/** Has to be called in loop every AUTOIP_TMR_INTERVAL milliseconds */
void autoip_tmr(void);
/** Handle a possible change in the network configuration */
void autoip_network_changed(struct netif *netif);
/** check if AutoIP supplied netif->ip_addr */
u8_t autoip_supplied_address(struct netif *netif);
#ifdef __cplusplus
}
#endif
#endif /* LWIP_IPV4 && LWIP_AUTOIP */
#endif /* LWIP_HDR_AUTOIP_H */
|
/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#include <errno.h>
#include <stdio.h>
#include <string.h>
#ifdef _WIN32
# include <io.h>
#else
# include <unistd.h>
#endif
#include "uv.h"
#include "runner.h"
#include "task.h"
/* Actual tests and helpers are defined in test-list.h */
#include "test-list.h"
/* The time in milliseconds after which a single test times out. */
#define TEST_TIMEOUT 5000
int ipc_helper(int listen_after_write);
int ipc_helper_tcp_connection(void);
int ipc_send_recv_helper(void);
int stdio_over_pipes_helper(void);
static int maybe_run_test(int argc, char **argv);
int main(int argc, char **argv) {
platform_init(argc, argv);
argv = uv_setup_args(argc, argv);
switch (argc) {
case 1: return run_tests(TEST_TIMEOUT, 0);
case 2: return maybe_run_test(argc, argv);
case 3: return run_test_part(argv[1], argv[2]);
default:
LOGF("Too many arguments.\n");
return 1;
}
}
static int maybe_run_test(int argc, char **argv) {
if (strcmp(argv[1], "--list") == 0) {
print_tests(stdout);
return 0;
}
if (strcmp(argv[1], "ipc_helper_listen_before_write") == 0) {
return ipc_helper(0);
}
if (strcmp(argv[1], "ipc_helper_listen_after_write") == 0) {
return ipc_helper(1);
}
if (strcmp(argv[1], "ipc_send_recv_helper") == 0) {
return ipc_send_recv_helper();
}
if (strcmp(argv[1], "ipc_helper_tcp_connection") == 0) {
return ipc_helper_tcp_connection();
}
if (strcmp(argv[1], "stdio_over_pipes_helper") == 0) {
return stdio_over_pipes_helper();
}
if (strcmp(argv[1], "spawn_helper1") == 0) {
return 1;
}
if (strcmp(argv[1], "spawn_helper2") == 0) {
printf("hello world\n");
return 1;
}
if (strcmp(argv[1], "spawn_helper3") == 0) {
char buffer[256];
ASSERT(buffer == fgets(buffer, sizeof(buffer) - 1, stdin));
buffer[sizeof(buffer) - 1] = '\0';
fputs(buffer, stdout);
return 1;
}
if (strcmp(argv[1], "spawn_helper4") == 0) {
/* Never surrender, never return! */
while (1) uv_sleep(10000);
}
if (strcmp(argv[1], "spawn_helper5") == 0) {
const char out[] = "fourth stdio!\n";
#ifdef _WIN32
DWORD bytes;
WriteFile((HANDLE) _get_osfhandle(3), out, sizeof(out) - 1, &bytes, NULL);
#else
{
ssize_t r;
do
r = write(3, out, sizeof(out) - 1);
while (r == -1 && errno == EINTR);
fsync(3);
}
#endif
return 1;
}
if (strcmp(argv[1], "spawn_helper6") == 0) {
int r;
r = fprintf(stdout, "hello world\n");
ASSERT(r > 0);
r = fprintf(stderr, "hello errworld\n");
ASSERT(r > 0);
return 1;
}
if (strcmp(argv[1], "spawn_helper7") == 0) {
int r;
char *test;
/* Test if the test value from the parent is still set */
test = getenv("ENV_TEST");
ASSERT(test != NULL);
r = fprintf(stdout, "%s", test);
ASSERT(r > 0);
return 1;
}
return run_test(argv[1], TEST_TIMEOUT, 0);
}
|
/* mbed Microcontroller Library
*******************************************************************************
* Copyright (c) 2014, STMicroelectronics
* 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 STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************
*/
#ifndef MBED_PINNAMES_H
#define MBED_PINNAMES_H
#include "cmsis.h"
#include "PinNamesTypes.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
ALT0 = 0x100,
ALT1 = 0x200
} ALTx;
typedef enum {
PA_0 = 0x00,
PA_1 = 0x01,
PA_2 = 0x02,
PA_2_ALT0 = PA_2 | ALT0,
PA_3 = 0x03,
PA_3_ALT0 = PA_3 | ALT0,
PA_4 = 0x04,
PA_4_ALT0 = PA_4 | ALT0,
PA_5 = 0x05,
PA_6 = 0x06,
PA_7 = 0x07,
PA_7_ALT0 = PA_7 | ALT0,
PA_8 = 0x08,
PA_9 = 0x09,
PA_10 = 0x0A,
PA_11 = 0x0B,
PA_12 = 0x0C,
PA_13 = 0x0D,
PA_14 = 0x0E,
PA_15 = 0x0F,
PA_15_ALT0 = PA_15 | ALT0,
PB_0 = 0x10,
PB_0_ALT0 = PB_0 | ALT0,
PB_1 = 0x11,
PB_1_ALT0 = PB_1 | ALT0,
PB_2 = 0x12,
PB_3 = 0x13,
PB_3_ALT0 = PB_3 | ALT0,
PB_4 = 0x14,
PB_4_ALT0 = PB_4 | ALT0,
PB_5 = 0x15,
PB_5_ALT0 = PB_5 | ALT0,
PB_6 = 0x16,
PB_7 = 0x17,
PB_8 = 0x18,
PB_8_ALT0 = PB_8 | ALT0,
PB_9 = 0x19,
PB_9_ALT0 = PB_9 | ALT0,
PB_10 = 0x1A,
PB_12 = 0x1C,
PB_13 = 0x1D,
PB_14 = 0x1E,
PB_15 = 0x1F,
PC_0 = 0x20,
PC_1 = 0x21,
PC_2 = 0x22,
PC_3 = 0x23,
PC_4 = 0x24,
PC_5 = 0x25,
PC_6 = 0x26,
PC_7 = 0x27,
PC_8 = 0x28,
PC_9 = 0x29,
PC_10 = 0x2A,
PC_11 = 0x2B,
PC_12 = 0x2C,
PC_13 = 0x2D,
PC_14 = 0x2E,
PC_15 = 0x2F,
PD_0 = 0x30,
PD_1 = 0x31,
PD_2 = 0x32,
PD_3 = 0x33,
PD_4 = 0x34,
PD_5 = 0x35,
PD_6 = 0x36,
PD_7 = 0x37,
PD_8 = 0x38,
PD_9 = 0x39,
PD_10 = 0x3A,
PD_11 = 0x3B,
PD_12 = 0x3C,
PD_13 = 0x3D,
PD_14 = 0x3E,
PD_15 = 0x3F,
PE_0 = 0x40,
PE_1 = 0x41,
PE_2 = 0x42,
PE_3 = 0x43,
PE_4 = 0x44,
PE_5 = 0x45,
PE_6 = 0x46,
PE_7 = 0x47,
PE_8 = 0x48,
PE_9 = 0x49,
PE_10 = 0x4A,
PE_11 = 0x4B,
PE_12 = 0x4C,
PE_13 = 0x4D,
PE_14 = 0x4E,
PE_15 = 0x4F,
PH_0 = 0x70, // Connected to RCC_OSC_IN
PH_1 = 0x71, // Connected to RCC_OSC_OUT
// ADC internal channels
ADC_TEMP = 0xF0,
ADC_VREF = 0xF1,
ADC_VBAT = 0xF2,
// STDIO for console print
#ifdef MBED_CONF_TARGET_STDIO_UART_TX
STDIO_UART_TX = MBED_CONF_TARGET_STDIO_UART_TX,
#else
STDIO_UART_TX = PA_9,
#endif
#ifdef MBED_CONF_TARGET_STDIO_UART_RX
STDIO_UART_RX = MBED_CONF_TARGET_STDIO_UART_RX,
#else
STDIO_UART_RX = PA_10,
#endif
// Generic signals namings
LED1 = PA_5,
LED2 = PA_5,
LED3 = PA_5,
LED4 = PA_5,
LED_RED = LED1,
USER_BUTTON = PE_7,
// Standardized button names
BUTTON1 = USER_BUTTON,
SERIAL_TX = STDIO_UART_TX,
SERIAL_RX = STDIO_UART_RX,
USBTX = STDIO_UART_TX,
USBRX = STDIO_UART_RX,
I2C_SCL = PB_8,
I2C_SDA = PB_9,
SPI_MOSI = PA_7,
SPI_MISO = PA_6,
SPI_SCK = PA_5,
SPI_CS = PB_6,
PWM_OUT = PB_3,
/**** USB OTG FS pins ****/
USB_OTG_FS_DM = PA_11,
USB_OTG_FS_DP = PA_12,
USB_OTG_FS_ID = PA_10,
USB_OTG_FS_SOF = PA_8,
USB_OTG_FS_VBUS = PA_9,
/**** OSCILLATOR pins ****/
RCC_OSC32_IN = PC_14,
RCC_OSC32_OUT = PC_15,
RCC_OSC_IN = PH_0,
RCC_OSC_OUT = PH_1,
/**** DEBUG pins ****/
SYS_JTCK_SWCLK = PA_14,
SYS_JTDI = PA_15,
SYS_JTDO_SWO = PB_3,
SYS_JTMS_SWDIO = PA_13,
SYS_JTRST = PB_4,
SYS_TRACECLK = PE_2,
SYS_TRACED0 = PE_3,
SYS_TRACED1 = PE_4,
SYS_TRACED2 = PE_5,
SYS_TRACED3 = PE_6,
SYS_WKUP = PA_0,
// Not connected
NC = (int)0xFFFFFFFF
} PinName;
#ifdef __cplusplus
}
#endif
#endif
|
/**********************************************************************
// @@@ START COPYRIGHT @@@
//
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
//
// @@@ END COPYRIGHT @@@
**********************************************************************/
#ifndef EXSM_TASK_H
#define EXSM_TASK_H
#include "ExSMCommon.h"
class ExSMTask;
class ExSMTaskList;
class ExSMQueue;
class SMConnection;
class NAMemory;
class ex_tcb;
class ExSMTask
{
public:
ExSMTask(const sm_target_t &receiver,
uint32_t queueSize,
int32_t *scheduledAddr,
NAMemory *heap,
ex_tcb *tcb,
SMConnection *smConnection);
ExSMTask(); // Do not implement
virtual ~ExSMTask();
ExSMQueue *getInQueue() { return inQueue_; }
ExSMQueue *getOutQueue() { return outQueue_; }
const sm_target_t &getReceiver() const { return receiver_; }
int32_t *getScheduledAddr() { return scheduledAddr_; }
// The TCB pointer is for debugging and tracing only and should not
// be dereferenced
ex_tcb *getTCB() { return tcb_; }
void incrReceiveCount() { receiveCount_++; }
int64_t getReceiveCount() { return receiveCount_; }
SMConnection *getSMConnection() const { return smConnection_; }
// The following methods are used for control flow when a message is
// larger than the expected size. First the sender sends a short
// message announcing the size of the reply. Then the sender waits
// for an ack. The receiver posts a receive buffer of sufficient
// size and sends an ack. Once the ack arrives the large buffer can
// be sent. No other messages are sent by the sender while waiting
// for the ack.
// Methods for receiving a large buffer
void recvChunk_Enter(void *buffer, uint32_t msgSize, uint32_t chunkSize);
void recvChunk_Exit();
void recvChunk_Receive(uint32_t bytesReceived);
void *recvChunk_GetPrepostAddr() const;
bool recvChunk_MoreExpected() const;
void *recvChunk_GetBuffer() const { return recvChunk_buffer_; }
uint32_t recvChunk_GetMessageSize() const { return recvChunk_msgSize_; }
uint32_t recvChunk_GetChunkSize() const { return recvChunk_chunkSize_; }
// Methods for sending a large buffer
void sendChunk_SetAckArrived(bool b);
bool sendChunk_GetAckArrived() const { return sendChunk_ackArrived_; }
protected:
ExSMQueue *inQueue_;
ExSMQueue *outQueue_;
sm_target_t receiver_;
int32_t *scheduledAddr_;
NAMemory *heap_;
// The TCB pointer is for debugging and tracing only and should not
// be dereferenced
ex_tcb *tcb_;
int64_t receiveCount_;
SMConnection *smConnection_;
// The task list object maintains a table of tasks and requires
// access to the protected field hashBucketNext_ to manage the hash
// chains.
friend class ExSMTaskList;
ExSMTask *hashBucketNext_;
// Each task contains pointers for a doubly-linked list called the
// ready list. The reader thread places tasks on the ready list when
// messages arrive that need to be processed by the main thread.
// The interface to add and remove from the ready list is provided
// by a separate class ExSMReadyList.
friend class ExSMReadyList;
ExSMTask *readyListNext_;
ExSMTask *readyListPrev_;
// The following data members are for control flow when a message is
// larger than the expected size. The control flow protocol is
// explained in comments above, with the control flow methods.
//
// Data members for receiving a large buffer
void *recvChunk_buffer_; // Points to an IpcMessageBuffer
uint32_t recvChunk_msgSize_; // Size of the complete message
uint32_t recvChunk_chunkSize_; // Chunk size
uint32_t recvChunk_bytesSoFar_; // Bytes seen so far
// Data members for sending a large buffer
bool sendChunk_ackArrived_; // Did an ack arrive?
}; // class ExSMTask
#endif // EXSM_TASK_H
|
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_ANDROID_COMPOSITOR_SCENE_LAYER_TAB_STRIP_SCENE_LAYER_H_
#define CHROME_BROWSER_ANDROID_COMPOSITOR_SCENE_LAYER_TAB_STRIP_SCENE_LAYER_H_
#include <memory>
#include <vector>
#include "base/android/jni_android.h"
#include "base/android/jni_weak_ref.h"
#include "base/android/scoped_java_ref.h"
#include "base/macros.h"
#include "cc/layers/layer.h"
#include "cc/layers/ui_resource_layer.h"
#include "chrome/browser/android/compositor/scene_layer/scene_layer.h"
namespace cc {
class SolidColorLayer;
}
namespace android {
class LayerTitleCache;
class TabHandleLayer;
// A scene layer to draw one or more tab strips. Note that content tree can be
// added as a subtree.
class TabStripSceneLayer : public SceneLayer {
public:
TabStripSceneLayer(JNIEnv* env, jobject jobj);
~TabStripSceneLayer() override;
void SetContentTree(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& jobj,
const base::android::JavaParamRef<jobject>& jcontent_tree);
void BeginBuildingFrame(JNIEnv* env,
const base::android::JavaParamRef<jobject>& jobj,
jboolean visible);
void FinishBuildingFrame(JNIEnv* env,
const base::android::JavaParamRef<jobject>& jobj);
void UpdateTabStripLayer(JNIEnv* env,
const base::android::JavaParamRef<jobject>& jobj,
jfloat width,
jfloat height,
jfloat y_offset,
jfloat background_tab_brightness,
jfloat brightness,
jboolean should_readd_background);
void UpdateNewTabButton(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& jobj,
jint resource_id,
jfloat x,
jfloat y,
jfloat width,
jfloat height,
jboolean visible,
const base::android::JavaParamRef<jobject>& jresource_manager);
void UpdateModelSelectorButton(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& jobj,
jint resource_id,
jfloat x,
jfloat y,
jfloat width,
jfloat height,
jboolean incognito,
jboolean visible,
const base::android::JavaParamRef<jobject>& jresource_manager);
void UpdateTabStripLeftFade(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& jobj,
jint resource_id,
jfloat opacity,
const base::android::JavaParamRef<jobject>& jresource_manager);
void UpdateTabStripRightFade(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& jobj,
jint resource_id,
jfloat opacity,
const base::android::JavaParamRef<jobject>& jresource_manager);
void PutStripTabLayer(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& jobj,
jint id,
jint close_resource_id,
jint handle_resource_id,
jboolean foreground,
jboolean close_pressed,
jfloat toolbar_width,
jfloat x,
jfloat y,
jfloat width,
jfloat height,
jfloat content_offset_x,
jfloat close_button_alpha,
jboolean is_loading,
jfloat spinner_rotation,
jfloat border_opacity,
const base::android::JavaParamRef<jobject>& jlayer_title_cache,
const base::android::JavaParamRef<jobject>& jresource_manager);
private:
scoped_refptr<TabHandleLayer> GetNextLayer(
LayerTitleCache* layer_title_cache);
typedef std::vector<scoped_refptr<TabHandleLayer>> TabHandleLayerList;
scoped_refptr<cc::SolidColorLayer> tab_strip_layer_;
scoped_refptr<cc::Layer> scrollable_strip_layer_;
scoped_refptr<cc::UIResourceLayer> new_tab_button_;
scoped_refptr<cc::UIResourceLayer> left_fade_;
scoped_refptr<cc::UIResourceLayer> right_fade_;
scoped_refptr<cc::UIResourceLayer> model_selector_button_;
float background_tab_brightness_;
float brightness_;
unsigned write_index_;
TabHandleLayerList tab_handle_layers_;
SceneLayer* content_tree_;
DISALLOW_COPY_AND_ASSIGN(TabStripSceneLayer);
};
bool RegisterTabStripSceneLayer(JNIEnv* env);
} // namespace android
#endif // CHROME_BROWSER_ANDROID_COMPOSITOR_SCENE_LAYER_TAB_STRIP_SCENE_LAYER_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_CHROMEOS_INPUT_METHOD_INPUT_METHOD_DELEGATE_H_
#define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_DELEGATE_H_
#include <string>
#include "base/basictypes.h"
namespace chromeos {
namespace input_method {
// Provides access to read/persist Input Method-related properties.
class InputMethodDelegate {
public:
InputMethodDelegate() {}
virtual ~InputMethodDelegate() {}
// Retrieves the hardware keyboard layout ID. May return an empty string if
// the ID is unknown.
virtual std::string GetHardwareKeyboardLayout() const = 0;
// Retrieves the currently active UI locale.
virtual std::string GetActiveLocale() const = 0;
private:
DISALLOW_COPY_AND_ASSIGN(InputMethodDelegate);
};
} // namespace input_method
} // namespace chromeos
#endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_DELEGATE_H_
|
// Copyright (c) 2011 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.
/*
* Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com. All rights reserved.
* Copyright (C) 2008, 2009 Google Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, LOSS OF USE, DATA, OR
* PROFITS, OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef UI_BASE_KEYCODES_KEYBOARD_CODES_POSIX_H_
#define UI_BASE_KEYCODES_KEYBOARD_CODES_POSIX_H_
#pragma once
namespace ui {
typedef enum {
VKEY_BACK = 0x08,
VKEY_TAB = 0x09,
VKEY_CLEAR = 0x0C,
VKEY_RETURN = 0x0D,
VKEY_SHIFT = 0x10,
VKEY_CONTROL = 0x11,
VKEY_MENU = 0x12,
VKEY_PAUSE = 0x13,
VKEY_CAPITAL = 0x14,
VKEY_KANA = 0x15,
VKEY_HANGUL = 0x15,
VKEY_JUNJA = 0x17,
VKEY_FINAL = 0x18,
VKEY_HANJA = 0x19,
VKEY_KANJI = 0x19,
VKEY_ESCAPE = 0x1B,
VKEY_CONVERT = 0x1C,
VKEY_NONCONVERT = 0x1D,
VKEY_ACCEPT = 0x1E,
VKEY_MODECHANGE = 0x1F,
VKEY_SPACE = 0x20,
VKEY_PRIOR = 0x21,
VKEY_NEXT = 0x22,
VKEY_END = 0x23,
VKEY_HOME = 0x24,
VKEY_LEFT = 0x25,
VKEY_UP = 0x26,
VKEY_RIGHT = 0x27,
VKEY_DOWN = 0x28,
VKEY_SELECT = 0x29,
VKEY_PRINT = 0x2A,
VKEY_EXECUTE = 0x2B,
VKEY_SNAPSHOT = 0x2C,
VKEY_INSERT = 0x2D,
VKEY_DELETE = 0x2E,
VKEY_HELP = 0x2F,
VKEY_0 = 0x30,
VKEY_1 = 0x31,
VKEY_2 = 0x32,
VKEY_3 = 0x33,
VKEY_4 = 0x34,
VKEY_5 = 0x35,
VKEY_6 = 0x36,
VKEY_7 = 0x37,
VKEY_8 = 0x38,
VKEY_9 = 0x39,
VKEY_A = 0x41,
VKEY_B = 0x42,
VKEY_C = 0x43,
VKEY_D = 0x44,
VKEY_E = 0x45,
VKEY_F = 0x46,
VKEY_G = 0x47,
VKEY_H = 0x48,
VKEY_I = 0x49,
VKEY_J = 0x4A,
VKEY_K = 0x4B,
VKEY_L = 0x4C,
VKEY_M = 0x4D,
VKEY_N = 0x4E,
VKEY_O = 0x4F,
VKEY_P = 0x50,
VKEY_Q = 0x51,
VKEY_R = 0x52,
VKEY_S = 0x53,
VKEY_T = 0x54,
VKEY_U = 0x55,
VKEY_V = 0x56,
VKEY_W = 0x57,
VKEY_X = 0x58,
VKEY_Y = 0x59,
VKEY_Z = 0x5A,
VKEY_LWIN = 0x5B,
VKEY_COMMAND = VKEY_LWIN, // Provide the Mac name for convenience.
VKEY_RWIN = 0x5C,
VKEY_APPS = 0x5D,
VKEY_SLEEP = 0x5F,
VKEY_NUMPAD0 = 0x60,
VKEY_NUMPAD1 = 0x61,
VKEY_NUMPAD2 = 0x62,
VKEY_NUMPAD3 = 0x63,
VKEY_NUMPAD4 = 0x64,
VKEY_NUMPAD5 = 0x65,
VKEY_NUMPAD6 = 0x66,
VKEY_NUMPAD7 = 0x67,
VKEY_NUMPAD8 = 0x68,
VKEY_NUMPAD9 = 0x69,
VKEY_MULTIPLY = 0x6A,
VKEY_ADD = 0x6B,
VKEY_SEPARATOR = 0x6C,
VKEY_SUBTRACT = 0x6D,
VKEY_DECIMAL = 0x6E,
VKEY_DIVIDE = 0x6F,
VKEY_F1 = 0x70,
VKEY_F2 = 0x71,
VKEY_F3 = 0x72,
VKEY_F4 = 0x73,
VKEY_F5 = 0x74,
VKEY_F6 = 0x75,
VKEY_F7 = 0x76,
VKEY_F8 = 0x77,
VKEY_F9 = 0x78,
VKEY_F10 = 0x79,
VKEY_F11 = 0x7A,
VKEY_F12 = 0x7B,
VKEY_F13 = 0x7C,
VKEY_F14 = 0x7D,
VKEY_F15 = 0x7E,
VKEY_F16 = 0x7F,
VKEY_F17 = 0x80,
VKEY_F18 = 0x81,
VKEY_F19 = 0x82,
VKEY_F20 = 0x83,
VKEY_F21 = 0x84,
VKEY_F22 = 0x85,
VKEY_F23 = 0x86,
VKEY_F24 = 0x87,
VKEY_NUMLOCK = 0x90,
VKEY_SCROLL = 0x91,
VKEY_LSHIFT = 0xA0,
VKEY_RSHIFT = 0xA1,
VKEY_LCONTROL = 0xA2,
VKEY_RCONTROL = 0xA3,
VKEY_LMENU = 0xA4,
VKEY_RMENU = 0xA5,
VKEY_BROWSER_BACK = 0xA6,
VKEY_BROWSER_FORWARD = 0xA7,
VKEY_BROWSER_REFRESH = 0xA8,
VKEY_BROWSER_STOP = 0xA9,
VKEY_BROWSER_SEARCH = 0xAA,
VKEY_BROWSER_FAVORITES = 0xAB,
VKEY_BROWSER_HOME = 0xAC,
VKEY_VOLUME_MUTE = 0xAD,
VKEY_VOLUME_DOWN = 0xAE,
VKEY_VOLUME_UP = 0xAF,
VKEY_MEDIA_NEXT_TRACK = 0xB0,
VKEY_MEDIA_PREV_TRACK = 0xB1,
VKEY_MEDIA_STOP = 0xB2,
VKEY_MEDIA_PLAY_PAUSE = 0xB3,
VKEY_MEDIA_LAUNCH_MAIL = 0xB4,
VKEY_MEDIA_LAUNCH_MEDIA_SELECT = 0xB5,
VKEY_MEDIA_LAUNCH_APP1 = 0xB6,
VKEY_MEDIA_LAUNCH_APP2 = 0xB7,
VKEY_OEM_1 = 0xBA,
VKEY_OEM_PLUS = 0xBB,
VKEY_OEM_COMMA = 0xBC,
VKEY_OEM_MINUS = 0xBD,
VKEY_OEM_PERIOD = 0xBE,
VKEY_OEM_2 = 0xBF,
VKEY_OEM_3 = 0xC0,
VKEY_OEM_4 = 0xDB,
VKEY_OEM_5 = 0xDC,
VKEY_OEM_6 = 0xDD,
VKEY_OEM_7 = 0xDE,
VKEY_OEM_8 = 0xDF,
VKEY_OEM_102 = 0xE2,
VKEY_PROCESSKEY = 0xE5,
VKEY_PACKET = 0xE7,
VKEY_ATTN = 0xF6,
VKEY_CRSEL = 0xF7,
VKEY_EXSEL = 0xF8,
VKEY_EREOF = 0xF9,
VKEY_PLAY = 0xFA,
VKEY_ZOOM = 0xFB,
VKEY_NONAME = 0xFC,
VKEY_PA1 = 0xFD,
VKEY_OEM_CLEAR = 0xFE,
VKEY_UNKNOWN = 0
} KeyboardCode;
} // namespace ui
#endif // UI_BASE_KEYCODES_KEYBOARD_CODES_POSIX_H_
|
/*=========================================================================
Program: Visualization Toolkit
Module: vtkWebGLPolyData.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkWebGLPolyData
// .SECTION Description
// PolyData representation for WebGL.
#ifndef __vtkWebGLPolyData_h
#define __vtkWebGLPolyData_h
#include "vtkWebGLObject.h"
#include "vtkWebGLExporterModule.h" // needed for export macro
class vtkActor;
class vtkMatrix4x4;
class vtkMapper;
class vtkPointData;
class vtkPolyData;
class vtkTriangleFilter;
class VTKWEBGLEXPORTER_EXPORT vtkWebGLPolyData : public vtkWebGLObject
{
public:
static vtkWebGLPolyData* New();
vtkTypeMacro(vtkWebGLPolyData, vtkWebGLObject);
void PrintSelf(ostream &os, vtkIndent indent);
void GenerateBinaryData();
unsigned char* GetBinaryData(int part);
int GetBinarySize(int part);
int GetNumberOfParts();
void GetPoints(vtkTriangleFilter* polydata, vtkActor* actor, int maxSize);
void GetLinesFromPolygon(vtkMapper* mapper, vtkActor* actor, int lineMaxSize, double* edgeColor);
void GetLines(vtkTriangleFilter* polydata, vtkActor* actor, int lineMaxSize);
void GetColorsFromPolyData(unsigned char* color, vtkPolyData* polydata, vtkActor* actor);
// Get following data from the actor
void GetPolygonsFromPointData(vtkTriangleFilter* polydata, vtkActor* actor, int maxSize);
void GetPolygonsFromCellData(vtkTriangleFilter* polydata, vtkActor* actor, int maxSize);
void GetColorsFromPointData(unsigned char* color, vtkPointData* pointdata, vtkPolyData* polydata, vtkActor* actor);
void SetMesh(float* _vertices, int _numberOfVertices, int* _index, int _numberOfIndexes, float* _normals, unsigned char* _colors, float* _tcoords, int maxSize);
void SetLine(float* _points, int _numberOfPoints, int* _index, int _numberOfIndex, unsigned char* _colors, int maxSize);
void SetPoints(float* points, int numberOfPoints, unsigned char* colors, int maxSize);
void SetTransformationMatrix(vtkMatrix4x4* m);
protected:
vtkWebGLPolyData();
~vtkWebGLPolyData();
private:
vtkWebGLPolyData(const vtkWebGLPolyData&); // Not implemented
void operator=(const vtkWebGLPolyData&); // Not implemented
vtkTriangleFilter* TriangleFilter;
class vtkInternal;
vtkInternal* Internal;
};
#endif
|
//===--- DWARFExpression.h - DWARF Expression handling ----------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_DEBUGINFO_DWARFEXPRESSION_H
#define LLVM_DEBUGINFO_DWARFEXPRESSION_H
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/iterator.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/Support/DataExtractor.h"
namespace llvm {
class DWARFUnit;
class MCRegisterInfo;
class raw_ostream;
class DWARFExpression {
public:
class iterator;
/// This class represents an Operation in the Expression. Each operation can
/// have up to 2 oprerands.
///
/// An Operation can be in Error state (check with isError()). This
/// means that it couldn't be decoded successfully and if it is the
/// case, all others fields contain undefined values.
class Operation {
public:
/// Size and signedness of expression operations' operands.
enum Encoding : uint8_t {
Size1 = 0,
Size2 = 1,
Size4 = 2,
Size8 = 3,
SizeLEB = 4,
SizeAddr = 5,
SizeRefAddr = 6,
SizeBlock = 7, ///< Preceding operand contains block size
SignBit = 0x8,
SignedSize1 = SignBit | Size1,
SignedSize2 = SignBit | Size2,
SignedSize4 = SignBit | Size4,
SignedSize8 = SignBit | Size8,
SignedSizeLEB = SignBit | SizeLEB,
SizeNA = 0xFF ///< Unused operands get this encoding.
};
enum DwarfVersion : uint8_t {
DwarfNA, ///< Serves as a marker for unused entries
Dwarf2 = 2,
Dwarf3,
Dwarf4
};
/// Description of the encoding of one expression Op.
struct Description {
DwarfVersion Version; ///< Dwarf version where the Op was introduced.
Encoding Op[2]; ///< Encoding for Op operands, or SizeNA.
Description(DwarfVersion Version = DwarfNA, Encoding Op1 = SizeNA,
Encoding Op2 = SizeNA)
: Version(Version) {
Op[0] = Op1;
Op[1] = Op2;
}
};
private:
friend class DWARFExpression::iterator;
uint8_t Opcode; ///< The Op Opcode, DW_OP_<something>.
Description Desc;
bool Error;
uint32_t EndOffset;
uint64_t Operands[2];
public:
Description &getDescription() { return Desc; }
uint8_t getCode() { return Opcode; }
uint64_t getRawOperand(unsigned Idx) { return Operands[Idx]; }
uint32_t getEndOffset() { return EndOffset; }
bool extract(DataExtractor Data, uint16_t Version, uint8_t AddressSize,
uint32_t Offset);
bool isError() { return Error; }
bool print(raw_ostream &OS, const DWARFExpression *U,
const MCRegisterInfo *RegInfo, bool isEH);
};
/// An iterator to go through the expression operations.
class iterator
: public iterator_facade_base<iterator, std::forward_iterator_tag,
Operation> {
friend class DWARFExpression;
const DWARFExpression *Expr;
uint32_t Offset;
Operation Op;
iterator(const DWARFExpression *Expr, uint32_t Offset)
: Expr(Expr), Offset(Offset) {
Op.Error =
Offset >= Expr->Data.getData().size() ||
!Op.extract(Expr->Data, Expr->Version, Expr->AddressSize, Offset);
}
public:
class Operation &operator++() {
Offset = Op.isError() ? Expr->Data.getData().size() : Op.EndOffset;
Op.Error =
Offset >= Expr->Data.getData().size() ||
!Op.extract(Expr->Data, Expr->Version, Expr->AddressSize, Offset);
return Op;
}
class Operation &operator*() {
return Op;
}
// Comparison operators are provided out of line.
friend bool operator==(const iterator &, const iterator &);
};
DWARFExpression(DataExtractor Data, uint16_t Version, uint8_t AddressSize)
: Data(Data), Version(Version), AddressSize(AddressSize) {
assert(AddressSize == 8 || AddressSize == 4);
}
iterator begin() const { return iterator(this, 0); }
iterator end() const { return iterator(this, Data.getData().size()); }
void print(raw_ostream &OS, const MCRegisterInfo *RegInfo,
bool IsEH = false) const;
private:
DataExtractor Data;
uint16_t Version;
uint8_t AddressSize;
};
inline bool operator==(const DWARFExpression::iterator &LHS,
const DWARFExpression::iterator &RHS) {
return LHS.Expr == RHS.Expr && LHS.Offset == RHS.Offset;
}
inline bool operator!=(const DWARFExpression::iterator &LHS,
const DWARFExpression::iterator &RHS) {
return !(LHS == RHS);
}
}
#endif
|
/* -----------------------------------------------------------------------------
*
* (c) The University of Glasgow 2002
*
* Definitions that characterise machine specific properties of basic
* types (C & Haskell).
*
* NB: Keep in sync with HsFFI.h and StgTypes.h.
* NB: THIS FILE IS INCLUDED IN HASKELL SOURCE!
*
* To understand the structure of the RTS headers, see the wiki:
* http://hackage.haskell.org/trac/ghc/wiki/Commentary/SourceTree/Includes
*
* ---------------------------------------------------------------------------*/
#ifndef MACHDEPS_H
#define MACHDEPS_H
/* Sizes of C types come from here... */
#include "ghcautoconf.h"
/* Sizes of Haskell types follow. These sizes correspond to:
* - the number of bytes in the primitive type (eg. Int#)
* - the number of bytes in the external representation (eg. HsInt)
* - the scale offset used by writeFooOffAddr#
*
* In the heap, the type may take up more space: eg. SIZEOF_INT8 == 1,
* but it takes up SIZEOF_HSWORD (4 or 8) bytes in the heap.
*/
/* First, check some assumptions.. */
#if SIZEOF_CHAR != 1
#error GHC untested on this architecture: sizeof(char) != 1
#endif
#if SIZEOF_SHORT != 2
#error GHC untested on this architecture: sizeof(short) != 2
#endif
#if SIZEOF_UNSIGNED_INT != 4
#error GHC untested on this architecture: sizeof(unsigned int) != 4
#endif
#define SIZEOF_HSCHAR SIZEOF_WORD32
#define ALIGNMENT_HSCHAR ALIGNMENT_WORD32
#define SIZEOF_HSINT SIZEOF_VOID_P
#define ALIGNMENT_HSINT ALIGNMENT_VOID_P
#define SIZEOF_HSWORD SIZEOF_VOID_P
#define ALIGNMENT_HSWORD ALIGNMENT_VOID_P
#define SIZEOF_HSDOUBLE SIZEOF_DOUBLE
#define ALIGNMENT_HSDOUBLE ALIGNMENT_DOUBLE
#define SIZEOF_HSFLOAT SIZEOF_FLOAT
#define ALIGNMENT_HSFLOAT ALIGNMENT_FLOAT
#define SIZEOF_HSPTR SIZEOF_VOID_P
#define ALIGNMENT_HSPTR ALIGNMENT_VOID_P
#define SIZEOF_HSFUNPTR SIZEOF_VOID_P
#define ALIGNMENT_HSFUNPTR ALIGNMENT_VOID_P
#define SIZEOF_HSSTABLEPTR SIZEOF_VOID_P
#define ALIGNMENT_HSSTABLEPTR ALIGNMENT_VOID_P
#define SIZEOF_INT8 SIZEOF_CHAR
#define ALIGNMENT_INT8 ALIGNMENT_CHAR
#define SIZEOF_WORD8 SIZEOF_UNSIGNED_CHAR
#define ALIGNMENT_WORD8 ALIGNMENT_UNSIGNED_CHAR
#define SIZEOF_INT16 SIZEOF_SHORT
#define ALIGNMENT_INT16 ALIGNMENT_SHORT
#define SIZEOF_WORD16 SIZEOF_UNSIGNED_SHORT
#define ALIGNMENT_WORD16 ALIGNMENT_UNSIGNED_SHORT
#define SIZEOF_INT32 SIZEOF_INT
#define ALIGNMENT_INT32 ALIGNMENT_INT
#define SIZEOF_WORD32 SIZEOF_UNSIGNED_INT
#define ALIGNMENT_WORD32 ALIGNMENT_UNSIGNED_INT
#if SIZEOF_LONG == 8
#define SIZEOF_INT64 SIZEOF_LONG
#define ALIGNMENT_INT64 ALIGNMENT_LONG
#define SIZEOF_WORD64 SIZEOF_UNSIGNED_LONG
#define ALIGNMENT_WORD64 ALIGNMENT_UNSIGNED_LONG
#elif HAVE_LONG_LONG && SIZEOF_LONG_LONG == 8
#define SIZEOF_INT64 SIZEOF_LONG_LONG
#define ALIGNMENT_INT64 ALIGNMENT_LONG_LONG
#define SIZEOF_WORD64 SIZEOF_UNSIGNED_LONG_LONG
#define ALIGNMENT_WORD64 ALIGNMENT_UNSIGNED_LONG_LONG
#else
#error Cannot find a 64bit type.
#endif
#ifndef WORD_SIZE_IN_BITS
#if SIZEOF_HSWORD == 4
#define WORD_SIZE_IN_BITS 32
#else
#define WORD_SIZE_IN_BITS 64
#endif
#endif
#ifndef TAG_BITS
#if SIZEOF_HSWORD == 4
#define TAG_BITS 2
#else
#define TAG_BITS 3
#endif
#endif
#define TAG_MASK ((1 << TAG_BITS) - 1)
#endif /* MACHDEPS_H */
|
#ifndef _LINUX_GLOB_H
#define _LINUX_GLOB_H
#include <linux/types.h> /* For bool */
#include <linux/compiler.h> /* For __pure */
bool __pure glob_match(char const *pat, char const *str);
#endif /* _LINUX_GLOB_H */
|
//
// UIViewController+AutomaticTracks.h
// HelloMixpanel
//
// Created by Sam Green on 2/23/16.
// Copyright © 2016 Mixpanel. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UIViewController (AutomaticTracks)
- (void)mp_viewDidAppear:(BOOL)animated;
@end
NS_ASSUME_NONNULL_END
|
#ifndef SPOTIFY_PLUSPLUS_TRACKLINK_H
#define SPOTIFY_PLUSPLUS_TRACKLINK_H
#include "../utils/json.h"
class TrackLink
{
public:
TrackLink(nlohmann::json trackJson);
std::map<std::string, std::string> GetExternalUrls() const;
std::string GetHref() const;
std::string GetId() const;
std::string GetType() const;
std::string GetUri() const;
private:
std::map<std::string, std::string> externalUrls;
std::string href;
std::string id;
std::string type;
std::string uri;
};
#endif
|
typedef struct
{
int w __attribute__((packed));
int h __attribute__((packed));
char *bmp __attribute__((packed));
char *alpha __attribute__((packed));
} GB_BMP __attribute__((packed));
void gb_pixel_set(GB_BMP *b, int x, int y, unsigned c);
int gb_pixel_get(GB_BMP *b, int x, int y, unsigned *c);
void gb_line(GB_BMP *b, int x1, int y1, int x2, int y2, unsigned c);
void gb_rect(GB_BMP *b, int x, int y, int w, int h, unsigned c);
void gb_bar(GB_BMP *b, int x, int y, int w, int h, unsigned c);
void gb_circle(GB_BMP *b, int x, int y, int r, unsigned c);
void gb_image_set(GB_BMP *b_dest, int x_d, int y_d, GB_BMP *b_src, int x_s, int y_s, int w, int h);
void gb_image_set_t(GB_BMP *b_dest, int x_d, int y_d, GB_BMP *b_src, int x_s, int y_s, int w, int h, unsigned c);
|
/*
FreeRTOS V8.2.3 - Copyright (C) 2015 Real Time Engineers Ltd.
All rights reserved
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
This file is part of the FreeRTOS distribution.
FreeRTOS 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 >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
***************************************************************************
>>! NOTE: The modification to the GPL is included to allow you to !<<
>>! distribute a combined work that includes FreeRTOS without being !<<
>>! obliged to provide the source code for proprietary components !<<
>>! outside of the FreeRTOS kernel. !<<
***************************************************************************
FreeRTOS 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. Full license text is available on the following
link: http://www.freertos.org/a00114.html
***************************************************************************
* *
* FreeRTOS provides completely free yet professionally developed, *
* robust, strictly quality controlled, supported, and cross *
* platform software that is more than just the market leader, it *
* is the industry's de facto standard. *
* *
* Help yourself get started quickly while simultaneously helping *
* to support the FreeRTOS project by purchasing a FreeRTOS *
* tutorial book, reference manual, or both: *
* http://www.FreeRTOS.org/Documentation *
* *
***************************************************************************
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
the FAQ page "My application does not run, what could be wrong?". Have you
defined configASSERT()?
http://www.FreeRTOS.org/support - In return for receiving this top quality
embedded software for free we request you assist our global community by
participating in the support forum.
http://www.FreeRTOS.org/training - Investing in training allows your team to
be as productive as possible as early as possible. Now you can receive
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
Ltd, and the world's leading authority on the world's leading RTOS.
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
compatible FAT file system, and our tiny thread aware UDP/IP stack.
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
licenses offer ticketed support, indemnification and commercial middleware.
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
engineered and independently SIL3 certified version for use in safety and
mission critical applications that require provable dependability.
1 tab == 4 spaces!
*/
/* Scheduler includes. */
#include "FreeRTOS.h"
#include "portable.h"
/* Demo app includes. */
#include "partest.h"
#include "demoGpio.h"
#define partstNUM_LEDS ( 8 )
#define partstALL_OUTPUTS_OFF ( ( unsigned long ) ~(0xFFFFFFFF << partstNUM_LEDS) )
static unsigned long ulLEDReg;
/*-----------------------------------------------------------
* Simple parallel port IO routines.
*-----------------------------------------------------------*/
static void SetLeds (unsigned int leds)
{
gpio->out.leds = leds;
}
/*-----------------------------------------------------------*/
void vParTestInitialise( void )
{
gpio->dir.leds = 0xff;
}
/*-----------------------------------------------------------*/
void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
{
/* Switch an LED on or off as requested. */
if (uxLED < partstNUM_LEDS)
{
if( xValue )
{
ulLEDReg &= ~( 1 << uxLED );
}
else
{
ulLEDReg |= ( 1 << uxLED );
}
SetLeds( ulLEDReg );
}
}
/*-----------------------------------------------------------*/
void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
{
/* Toggle the state of the requested LED. */
if (uxLED < partstNUM_LEDS)
{
ulLEDReg ^= ( 1 << uxLED );
SetLeds( ulLEDReg );
}
}
|
#pragma once
#include <memory>
#include <boost/noncopyable.hpp>
#include <glm/fwd.hpp>
#include <SDL2/SDL_events.h>
class CAbstractWindow : private boost::noncopyable
{
public:
CAbstractWindow();
virtual ~CAbstractWindow();
void Show(glm::ivec2 const& size);
void DoGameLoop();
protected:
void SetBackgroundColor(glm::vec4 const& color);
virtual void OnWindowEvent(const SDL_Event &event) = 0;
virtual void OnUpdateWindow(float deltaSeconds) = 0;
virtual void OnDrawWindow(glm::ivec2 const& size) = 0;
private:
class Impl;
std::unique_ptr<Impl> m_pImpl;
};
|
// 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 CONTENT_SHELL_SHELL_BROWSER_CONTEXT_H_
#define CONTENT_SHELL_SHELL_BROWSER_CONTEXT_H_
#include "base/compiler_specific.h"
#include "base/files/file_path.h"
#include "base/files/scoped_temp_dir.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/content_browser_client.h"
#include "net/url_request/url_request_job_factory.h"
namespace nw {
class Package;
class NwFormDatabaseService;
}
namespace content {
using base::FilePath;
class DownloadManagerDelegate;
class ResourceContext;
class ShellDownloadManagerDelegate;
class ShellURLRequestContextGetter;
class ShellBrowserContext : public BrowserContext {
public:
explicit ShellBrowserContext(bool off_the_record,
nw::Package* package);
virtual ~ShellBrowserContext();
// BrowserContext implementation.
virtual FilePath GetPath() const OVERRIDE;
virtual bool IsOffTheRecord() const OVERRIDE;
virtual DownloadManagerDelegate* GetDownloadManagerDelegate() OVERRIDE;
virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE;
virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess(
int renderer_child_id) OVERRIDE;
virtual net::URLRequestContextGetter* GetMediaRequestContext() OVERRIDE;
virtual net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess(
int renderer_child_id) OVERRIDE;
virtual net::URLRequestContextGetter*
GetMediaRequestContextForStoragePartition(
const FilePath& partition_path,
bool in_memory) OVERRIDE;
virtual ResourceContext* GetResourceContext() OVERRIDE;
virtual GeolocationPermissionContext*
GetGeolocationPermissionContext() OVERRIDE;
virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE;
virtual void RequestMidiSysExPermission(
int render_process_id,
int render_view_id,
int bridge_id,
const GURL& requesting_frame,
bool user_gesture,
const MidiSysExPermissionCallback& callback) OVERRIDE;
virtual void CancelMidiSysExPermissionRequest(
int render_process_id,
int render_view_id,
int bridge_id,
const GURL& requesting_frame) OVERRIDE;
virtual void RequestProtectedMediaIdentifierPermission(
int render_process_id,
int render_view_id,
int bridge_id,
int group_id,
const GURL& requesting_frame,
const ProtectedMediaIdentifierPermissionCallback& callback) OVERRIDE;
virtual void CancelProtectedMediaIdentifierPermissionRequests(
int group_id) OVERRIDE;
nw::NwFormDatabaseService* GetFormDatabaseService();
// Maps to BrowserMainParts::PreMainMessageLoopRun.
void PreMainMessageLoopRun();
virtual net::URLRequestContextGetter* CreateRequestContext(
ProtocolHandlerMap* protocol_handlers,
ProtocolHandlerScopedVector protocol_interceptors);
virtual net::URLRequestContextGetter* CreateRequestContextForStoragePartition(
const base::FilePath& partition_path,
bool in_memory,
ProtocolHandlerMap* protocol_handlers);
bool pinning_renderer() { return !disable_pinning_renderer_; }
void set_pinning_renderer(bool val) { disable_pinning_renderer_ = !val; }
private:
class ShellResourceContext;
// Performs initialization of the ShellBrowserContext while IO is still
// allowed on the current thread.
void InitWhileIOAllowed();
bool disable_pinning_renderer_; // whether dev reload is in process
// or we want to disable pinning
// temporarily
bool off_the_record_;
bool ignore_certificate_errors_;
nw::Package* package_;
FilePath path_;
scoped_ptr<ShellResourceContext> resource_context_;
scoped_refptr<ShellDownloadManagerDelegate> download_manager_delegate_;
scoped_refptr<ShellURLRequestContextGetter> url_request_getter_;
scoped_ptr<nw::NwFormDatabaseService> form_database_service_;
DISALLOW_COPY_AND_ASSIGN(ShellBrowserContext);
};
} // namespace content
#endif // CONTENT_SHELL_SHELL_BROWSER_CONTEXT_H_
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#include "testrunnerswitcher.h"
#ifdef WINCE
#include "windows.h"
#endif
int main(void)
{
size_t failedTestCount = 0;
RUN_TEST_SUITE(iothubclient_ll_unittests, failedTestCount);
return failedTestCount;
}
|
/*
* Copyright (c) 2003, 2007-11 Matteo Frigo
* Copyright (c) 2003, 2007-11 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Sat Apr 28 11:01:59 EDT 2012 */
#include "codelet-dft.h"
#ifdef HAVE_FMA
/* Generated by: ../../../genfft/gen_twiddle_c.native -fma -reorder-insns -schedule-for-pipeline -simd -compact -variables 4 -pipeline-latency 8 -n 2 -name t1bv_2 -include t1b.h -sign 1 */
/*
* This function contains 3 FP additions, 2 FP multiplications,
* (or, 3 additions, 2 multiplications, 0 fused multiply/add),
* 5 stack variables, 0 constants, and 4 memory accesses
*/
#include "t1b.h"
static void t1bv_2(R *ri, R *ii, const R *W, stride rs, INT mb, INT me, INT ms)
{
{
INT m;
R *x;
x = ii;
for (m = mb, W = W + (mb * ((TWVL / VL) * 2)); m < me; m = m + VL, x = x + (VL * ms), W = W + (TWVL * 2), MAKE_VOLATILE_STRIDE(rs)) {
V T1, T2, T3;
T1 = LD(&(x[0]), ms, &(x[0]));
T2 = LD(&(x[WS(rs, 1)]), ms, &(x[WS(rs, 1)]));
T3 = BYTW(&(W[0]), T2);
ST(&(x[0]), VADD(T1, T3), ms, &(x[0]));
ST(&(x[WS(rs, 1)]), VSUB(T1, T3), ms, &(x[WS(rs, 1)]));
}
}
VLEAVE();
}
static const tw_instr twinstr[] = {
VTW(0, 1),
{TW_NEXT, VL, 0}
};
static const ct_desc desc = { 2, XSIMD_STRING("t1bv_2"), twinstr, &GENUS, {3, 2, 0, 0}, 0, 0, 0 };
void XSIMD(codelet_t1bv_2) (planner *p) {
X(kdft_dit_register) (p, t1bv_2, &desc);
}
#else /* HAVE_FMA */
/* Generated by: ../../../genfft/gen_twiddle_c.native -simd -compact -variables 4 -pipeline-latency 8 -n 2 -name t1bv_2 -include t1b.h -sign 1 */
/*
* This function contains 3 FP additions, 2 FP multiplications,
* (or, 3 additions, 2 multiplications, 0 fused multiply/add),
* 5 stack variables, 0 constants, and 4 memory accesses
*/
#include "t1b.h"
static void t1bv_2(R *ri, R *ii, const R *W, stride rs, INT mb, INT me, INT ms)
{
{
INT m;
R *x;
x = ii;
for (m = mb, W = W + (mb * ((TWVL / VL) * 2)); m < me; m = m + VL, x = x + (VL * ms), W = W + (TWVL * 2), MAKE_VOLATILE_STRIDE(rs)) {
V T1, T3, T2;
T1 = LD(&(x[0]), ms, &(x[0]));
T2 = LD(&(x[WS(rs, 1)]), ms, &(x[WS(rs, 1)]));
T3 = BYTW(&(W[0]), T2);
ST(&(x[WS(rs, 1)]), VSUB(T1, T3), ms, &(x[WS(rs, 1)]));
ST(&(x[0]), VADD(T1, T3), ms, &(x[0]));
}
}
VLEAVE();
}
static const tw_instr twinstr[] = {
VTW(0, 1),
{TW_NEXT, VL, 0}
};
static const ct_desc desc = { 2, XSIMD_STRING("t1bv_2"), twinstr, &GENUS, {3, 2, 0, 0}, 0, 0, 0 };
void XSIMD(codelet_t1bv_2) (planner *p) {
X(kdft_dit_register) (p, t1bv_2, &desc);
}
#endif /* HAVE_FMA */
|
#include <linux/platform_device.h>
#include <linux/workqueue.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/reboot.h>
#include <linux/pm.h>
#include <linux/delay.h>
#include <mach/gpio.h>
#include <mach/mfp.h>
#include <mach/mfp-pxa168.h>
#include <plat/mfp.h>
#include <linux/input.h>
#include <mach/power_button.h>
#include <asm/mach-types.h>
#include <linux/wakelock.h>
enum PM_EVENT{
PM_STANDBY ,
PM_SHUTDOWN,
PM_STANDBY_NOW ,
PM_SHUTDOWN_NOW,
PM_NORMAL,
};
struct work_struct irq_work;
static struct power_button_platform_data *ops;
struct input_dev *input;
static struct wake_lock power_button_wakeup;
atomic_t event;
enum PM_STATUS{
PM_INIT,
PM_SHUTDOWN_WAITING,
};
enum PM_STATUS status_pm;
static struct class *power_button_class;
#define SLEEP_CODE 0x58
#define SHUTDOWN_CODE 0x57
void shutdown_ok(void)
{
printk("shutdown now\n");
kernel_power_off();
}
void standby_ok(void)
{
printk("standby now\n");
ops->send_standby_ack();
}
static ssize_t shutdown_show_status(struct device *dev,
struct device_attribute *attr, char *buf)
{
return sprintf(buf, "%d\n", 0);
}
static ssize_t standby_show_status(struct device *dev,
struct device_attribute *attr, char *buf)
{
return sprintf(buf, "%d\n", 0);
}
static ssize_t shutdown_store_status(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{
printk("OS shutdown the system\n");
atomic_set(&event, PM_SHUTDOWN_NOW);
schedule_work(&irq_work);
return 0;
}
static ssize_t standby_store_status(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{
printk("OS make the systemto be standby\n");
atomic_set(&event , PM_STANDBY_NOW);
schedule_work(&irq_work);
return 0;
}
static struct device_attribute bl_device_attributes[] = {
__ATTR(pm_shutdown, 0644, shutdown_show_status, shutdown_store_status),
__ATTR(pm_standby, 0644, standby_show_status,
standby_store_status),
__ATTR_NULL,
};
static void power_button_irq_work(struct work_struct *work)
{
int status;
status = atomic_read(&event) ;
switch (status) {
case PM_SHUTDOWN_NOW:
shutdown_ok();
return;
case PM_STANDBY_NOW:
standby_ok();
return;
case PM_SHUTDOWN:
/* ACK */
printk("long press is detected\n");
ops->send_powerdwn_ack();
input_event(input, EV_KEY, SHUTDOWN_CODE, 1);
input_sync(input);
input_event(input, EV_KEY, SHUTDOWN_CODE, 0);
input_sync(input);
return;
case PM_STANDBY:
printk("short press is detected\n");
input_event(input, EV_KEY, SLEEP_CODE, 1);
input_sync(input);
input_event(input, EV_KEY, SLEEP_CODE, 0);
input_sync(input);
return;
default:
return;
}
}
static irqreturn_t standby_handler(int irq, void *dev_id)
{
atomic_set(&event, PM_STANDBY);
schedule_work(&irq_work);
return IRQ_HANDLED;
}
static irqreturn_t shutdown_handler(int irq, void *dev_id)
{
atomic_set(&event, PM_SHUTDOWN);
schedule_work(&irq_work);
return IRQ_HANDLED;
}
static int power_button_probe(struct platform_device *pdev)
{
int ret = 0;
ops = pdev->dev.platform_data;
ops->init(shutdown_handler, standby_handler);
INIT_WORK(&irq_work , power_button_irq_work);
atomic_set(&event , PM_NORMAL);
input = input_allocate_device();
if (!input)
goto out;
input->name = "power-button";
input->phys = "power-button/input0";
input->dev.parent = &pdev->dev;
input->id.bustype = BUS_HOST;
input->id.vendor = 0x0001;
input->id.product = 0x0001;
input->id.version = 0x0100;
input_set_capability(input, EV_KEY , SLEEP_CODE);
input_set_capability(input, EV_KEY , SHUTDOWN_CODE);
ret = input_register_device(input);
if (ret) {
pr_err("power button: Unable to register input device, "
"error: %d\n", ret);
goto out;
}
status_pm = PM_INIT;
printk("power button probe finished\n");
return 0;
out:
return ret;
}
static int power_button_suspend(struct platform_device *pdev)
{
if (wake_lock_active(&power_button_wakeup))
return -EBUSY;
return 0;
}
static int power_button_resume(struct platform_device *pdev)
{
printk(KERN_ERR "%s\n", __func__);
input_event(input, EV_KEY, SLEEP_CODE, 1);
input_sync(input);
input_event(input, EV_KEY, SLEEP_CODE, 0);
input_sync(input);
wake_lock_timeout(&power_button_wakeup, HZ * 5);
return 0;
}
static struct platform_driver power_button_driver = {
.probe = power_button_probe,
.driver = {
.name = "power-button",
.owner = THIS_MODULE,
},
.suspend = power_button_suspend,
.resume = power_button_resume,
};
static int __init power_button_init(void)
{
int ret;
power_button_class = class_create(THIS_MODULE, "power-button");
if (IS_ERR(power_button_class)) {
printk(KERN_WARNING "Unable to create power_button class; errno = %ld\n",
PTR_ERR(power_button_class));
return PTR_ERR(power_button_class);
}
power_button_class->dev_attrs = bl_device_attributes;
ret = platform_driver_register(&power_button_driver);
if (ret) {
printk(KERN_ERR "power_button_driver register failure\n");
return ret;
}
wake_lock_init(&power_button_wakeup, WAKE_LOCK_SUSPEND, "power_button");
return 0;
}
static void __exit power_button_exit(void)
{
input_unregister_device(input);
platform_driver_unregister(&power_button_driver);
class_destroy(power_button_class);
wake_lock_destroy(&power_button_wakeup);
}
module_init(power_button_init);
module_exit(power_button_exit);
MODULE_LICENSE("GPL");
|
/*
* TI Keystone 16550 UART "driver"
*
* This isn't a full driver; it just provides for special initialization
* that keystone UARTs need. Everything else is just using the standard
* 8250 support.
*
* Copyright (C) 2016 Texas Instruments Incorporated - http://www.ti.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 version 2.
*
* This program is distributed "as is" WITHOUT ANY WARRANTY of any
* kind, whether express or implied; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#include <linux/of_platform.h>
#include <linux/serial_8250.h>
#include <linux/serial_reg.h>
#include "8250.h"
/*
* Texas Instruments Keystone registers
*/
#define UART_KEYSTONE_PWREMU 0x0c /* Power and Emulation */
/*
* Keystone PWREMU register definitions
*/
#define UART_KEYSTONE_PWREMU_FREE (1 << 0) /* Free-running enable */
#define UART_KEYSTONE_PWREMU_URRST (1 << 13) /* Receiver reset and enable */
#define UART_KEYSTONE_PWREMU_UTRST (1 << 14) /* Transmitter reset and enable */
int keystone_serial8250_init(struct uart_port *port)
{
unsigned long flags;
if (!of_device_is_compatible(port->dev->of_node, "ti,keystone-uart"))
return 0;
spin_lock_irqsave(&port->lock, flags);
serial_port_out(port, UART_KEYSTONE_PWREMU,
UART_KEYSTONE_PWREMU_FREE |
UART_KEYSTONE_PWREMU_URRST |
UART_KEYSTONE_PWREMU_UTRST);
spin_unlock_irqrestore(&port->lock, flags);
return 0;
}
EXPORT_SYMBOL(keystone_serial8250_init);
|
/* Copyright (c) 2012, 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.
*
*/
#include "kgsl.h"
#include "kgsl_device.h"
#include "z180.h"
#include "z180_reg.h"
#define Z180_STREAM_PACKET_CALL 0x7C000275
/* Postmortem Dump formatted Output parameters */
/* Number of Words per dump data line */
#define WORDS_PER_LINE 8
/* Number of spaces per dump data line */
#define NUM_SPACES (WORDS_PER_LINE - 1)
/*
* Output dump data is formatted as string, hence number of chars
* per line for line string allocation
*/
#define CHARS_PER_LINE \
((WORDS_PER_LINE * (2*sizeof(unsigned int))) + NUM_SPACES + 1)
/* Z180 registers (byte offsets) to be dumped */
static const unsigned int regs_to_dump[] = {
ADDR_VGC_VERSION,
ADDR_VGC_SYSSTATUS,
ADDR_VGC_IRQSTATUS,
ADDR_VGC_IRQENABLE,
ADDR_VGC_IRQ_ACTIVE_CNT,
ADDR_VGC_CLOCKEN,
ADDR_VGC_MH_DATA_ADDR,
ADDR_VGC_GPR0,
ADDR_VGC_GPR1,
ADDR_VGC_BUSYCNT,
ADDR_VGC_FIFOFREE,
};
/**
* z180_dump_regs - Dumps all of Z180 external registers. Prints the word offset
* of the register in each output line.
* @device: kgsl_device pointer to the Z180 core
*/
static void z180_dump_regs(struct kgsl_device *device)
{
unsigned int i;
unsigned int reg_val;
z180_idle(device);
KGSL_LOG_DUMP(device, "Z180 Register Dump\n");
for (i = 0; i < ARRAY_SIZE(regs_to_dump); i++) {
kgsl_regread(device,
regs_to_dump[i]/sizeof(unsigned int), ®_val);
KGSL_LOG_DUMP(device, "REG: %04X: %08X\n",
regs_to_dump[i]/sizeof(unsigned int), reg_val);
}
}
/**
* z180_dump_ringbuffer - Dumps the Z180 core's ringbuffer contents
* @device: kgsl_device pointer to the z180 core
*/
static void z180_dump_ringbuffer(struct kgsl_device *device)
{
unsigned int rb_size;
unsigned int *rb_hostptr;
unsigned int rb_words;
unsigned int rb_gpuaddr;
struct z180_device *z180_dev = Z180_DEVICE(device);
unsigned int i;
char linebuf[CHARS_PER_LINE];
KGSL_LOG_DUMP(device, "Z180 ringbuffer dump\n");
rb_hostptr = (unsigned int *) z180_dev->ringbuffer.cmdbufdesc.hostptr;
rb_size = Z180_RB_SIZE;
rb_gpuaddr = z180_dev->ringbuffer.cmdbufdesc.gpuaddr;
rb_words = rb_size/sizeof(unsigned int);
KGSL_LOG_DUMP(device, "ringbuffer size: %u\n", rb_size);
KGSL_LOG_DUMP(device, "rb_words: %d\n", rb_words);
for (i = 0; i < rb_words; i += WORDS_PER_LINE) {
hex_dump_to_buffer(rb_hostptr+i,
rb_size - i*sizeof(unsigned int),
WORDS_PER_LINE*sizeof(unsigned int),
sizeof(unsigned int), linebuf,
sizeof(linebuf), false);
KGSL_LOG_DUMP(device, "RB: %04X: %s\n",
rb_gpuaddr + i*sizeof(unsigned int), linebuf);
}
}
static void z180_dump_ib(struct kgsl_device *device)
{
unsigned int rb_size;
unsigned int *rb_hostptr;
unsigned int rb_words;
unsigned int rb_gpuaddr;
unsigned int ib_gpuptr = 0;
unsigned int ib_size = 0;
void *ib_hostptr = NULL;
int rb_slot_num = -1;
struct z180_device *z180_dev = Z180_DEVICE(device);
struct kgsl_mem_entry *entry = NULL;
phys_addr_t pt_base;
unsigned int i;
unsigned int j;
char linebuf[CHARS_PER_LINE];
unsigned int current_ib_slot;
unsigned int len;
unsigned int rowsize;
KGSL_LOG_DUMP(device, "Z180 IB dump\n");
rb_hostptr = (unsigned int *) z180_dev->ringbuffer.cmdbufdesc.hostptr;
rb_size = Z180_RB_SIZE;
rb_gpuaddr = z180_dev->ringbuffer.cmdbufdesc.gpuaddr;
rb_words = rb_size/sizeof(unsigned int);
KGSL_LOG_DUMP(device, "Ringbuffer size (bytes): %u\n", rb_size);
KGSL_LOG_DUMP(device, "rb_words: %d\n", rb_words);
pt_base = kgsl_mmu_get_current_ptbase(&device->mmu);
/* Dump the current IB */
for (i = 0; i < rb_words; i++) {
if (rb_hostptr[i] == Z180_STREAM_PACKET_CALL) {
rb_slot_num++;
current_ib_slot =
z180_dev->current_timestamp % Z180_PACKET_COUNT;
if (rb_slot_num != current_ib_slot)
continue;
ib_gpuptr = rb_hostptr[i+1];
entry = kgsl_get_mem_entry(device, pt_base, ib_gpuptr,
1);
if (entry == NULL) {
KGSL_LOG_DUMP(device,
"IB mem entry not found for ringbuffer slot#: %d\n",
rb_slot_num);
continue;
}
ib_hostptr = kgsl_memdesc_map(&entry->memdesc);
if (ib_hostptr == NULL) {
KGSL_LOG_DUMP(device,
"Could not map IB to kernel memory, Ringbuffer Slot: %d\n",
rb_slot_num);
kgsl_mem_entry_put(entry);
continue;
}
ib_size = entry->memdesc.size;
KGSL_LOG_DUMP(device,
"IB size: %dbytes, IB size in words: %d\n",
ib_size,
ib_size/sizeof(unsigned int));
for (j = 0; j < ib_size; j += WORDS_PER_LINE) {
len = ib_size - j*sizeof(unsigned int);
rowsize = WORDS_PER_LINE*sizeof(unsigned int);
hex_dump_to_buffer(ib_hostptr+j, len, rowsize,
sizeof(unsigned int), linebuf,
sizeof(linebuf), false);
KGSL_LOG_DUMP(device, "IB%d: %04X: %s\n",
rb_slot_num,
(rb_gpuaddr +
j*sizeof(unsigned int)),
linebuf);
}
KGSL_LOG_DUMP(device, "IB Dump Finished\n");
kgsl_mem_entry_put(entry);
}
}
}
/**
* z180_dump - Dumps the Z180 ringbuffer and registers (and IBs if asked for)
* for postmortem
* analysis.
* @device: kgsl_device pointer to the Z180 core
*/
int z180_dump(struct kgsl_device *device, int manual)
{
struct z180_device *z180_dev = Z180_DEVICE(device);
mb();
KGSL_LOG_DUMP(device, "Retired Timestamp: %d\n", atomic_read(&z180_dev->timestamp));
KGSL_LOG_DUMP(device,
"Current Timestamp: %d\n", z180_dev->current_timestamp);
/* Dump ringbuffer */
z180_dump_ringbuffer(device);
/* Dump registers */
z180_dump_regs(device);
/* Dump IBs, if asked for */
if (device->pm_ib_enabled)
z180_dump_ib(device);
/* Get the stack trace if the dump was automatic */
if (!manual)
BUG_ON(1);
return 0;
}
|
/* Per-frame user registers, for GDB, the GNU debugger.
Copyright (C) 2002, 2003, 2007, 2008, 2009 Free Software Foundation, Inc.
Contributed by Red Hat.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef USER_REGS_H
#define USER_REGS_H
/* Implement both builtin, and architecture specific, per-frame user
visible registers.
Builtin registers apply to all architectures, where as architecture
specific registers are present when the architecture is selected.
These registers are assigned register numbers outside the
architecture's register range
[0 .. gdbarch_num_regs + gdbarch_num_pseudo_regs].
Their values should be constructed using per-frame information. */
/* TODO: cagney/2003-06-27: Need to think more about how these
registers are added, read, and modified. At present they are kind
of assumed to be read-only. Should it, for instance, return a
register descriptor that contains all the relvent access methods. */
struct frame_info;
struct gdbarch;
/* Given an architecture, map a user visible register name onto its
index. */
extern int user_reg_map_name_to_regnum (struct gdbarch *gdbarch,
const char *str, int len);
extern const char *user_reg_map_regnum_to_name (struct gdbarch *gdbarch,
int regnum);
/* Return the value of the frame register in the specified frame.
Note; These methods return a "struct value" instead of the raw
bytes as, at the time the register is being added, the type needed
to describe the register has not bee initialized. */
typedef struct value *(user_reg_read_ftype) (struct frame_info *frame,
const void *baton);
extern struct value *value_of_user_reg (int regnum, struct frame_info *frame);
/* Add a builtin register (present in all architectures). */
extern void user_reg_add_builtin (const char *name,
user_reg_read_ftype *read, const void *baton);
/* Add a per-architecture frame register. */
extern void user_reg_add (struct gdbarch *gdbarch, const char *name,
user_reg_read_ftype *read, const void *baton);
#endif
|
//=============================================================================
// MuseScore
// Music Composition & Notation
//
// Copyright (C) 2002-2011 Werner Schweer
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2
// as published by the Free Software Foundation and appearing in
// the file LICENCE.GPL
//=============================================================================
#ifndef __BREATH_H__
#define __BREATH_H__
#include "element.h"
namespace Ms {
enum class SymId;
//---------------------------------------------------------
// BreathType
//---------------------------------------------------------
struct BreathType {
SymId id;
bool isCaesura;
qreal pause;
};
//---------------------------------------------------------
// @@ Breath
//! breathType() is index in symList
//---------------------------------------------------------
class Breath final : public Element {
qreal _pause;
SymId _symId;
public:
Breath(Score* s);
virtual ElementType type() const override { return ElementType::BREATH; }
virtual Breath* clone() const override { return new Breath(*this); }
void setSymId(SymId id) { _symId = id; }
SymId symId() const { return _symId; }
qreal pause() const { return _pause; }
void setPause(qreal v) { _pause = v; }
Segment* segment() const { return (Segment*)parent(); }
virtual void draw(QPainter*) const override;
virtual void layout() override;
virtual void write(XmlWriter&) const override;
virtual void read(XmlReader&) override;
virtual QPointF pagePos() const override; ///< position in page coordinates
virtual QVariant getProperty(Pid propertyId) const override;
virtual bool setProperty(Pid propertyId, const QVariant&) override;
virtual QVariant propertyDefault(Pid) const override;
virtual Element* nextSegmentElement() override;
virtual Element* prevSegmentElement() override;
virtual QString accessibleInfo() const override;
bool isCaesura() const;
static const std::vector<BreathType> breathList;
};
} // namespace Ms
#endif
|
/* $Id: fctiw.c,v 1.1 1999/08/23 18:59:30 cort Exp $
*/
#include <linux/types.h>
#include <linux/errno.h>
#include <asm/uaccess.h>
#include "soft-fp.h"
#include "double.h"
int
fctiw(u32 *frD, void *frB)
{
FP_DECL_D(B);
unsigned int r;
__FP_UNPACK_D(B, frB);
FP_TO_INT_D(r, B, 32, 1);
frD[1] = r;
#ifdef DEBUG
printk("%s: D %p, B %p: ", __FUNCTION__, frD, frB);
dump_double(frD);
printk("\n");
#endif
return 0;
}
|
/************************************************************************
filename: CEGUIProgressBarProperties.h
created: 10/7/2004
author: Paul D Turner
purpose: Interface to properties for the ProgressBar class
*************************************************************************/
/*************************************************************************
Crazy Eddie's GUI System (http://www.cegui.org.uk)
Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*************************************************************************/
#ifndef _CEGUIProgressBarProperties_h_
#define _CEGUIProgressBarProperties_h_
#include "CEGUIProperty.h"
// Start of CEGUI namespace section
namespace CEGUI
{
// Start of ProgressBarProperties namespace section
/*!
\brief
Namespace containing all classes that make up the properties interface for the ProgressBar class
*/
namespace ProgressBarProperties
{
/*!
\brief
Property to access the current progress of the progress bar.
\par Usage:
- Name: CurrentProgress
- Format: "[float]".
\par Where:
- [float] is the current progress of the bar expressed as a value between 0 and 1.
*/
class CurrentProgress : public Property
{
public:
CurrentProgress() : Property(
"CurrentProgress",
"Property to get/set the current progress of the progress bar. Value is a float value between 0.0 and 1.0 specifying the progress.",
"0.000000")
{}
String get(const PropertyReceiver* receiver) const;
void set(PropertyReceiver* receiver, const String& value);
};
/*!
\brief
Property to access the step size setting for the progress bar.
\par Usage:
- Name: StepSize
- Format: "[float]".
\par Where:
- [float] is the size of the invisible sizing border in screen pixels.
*/
class StepSize : public Property
{
public:
StepSize() : Property(
"StepSize",
"Property to get/set the step size setting for the progress bar. Value is a float value.",
"0.010000")
{}
String get(const PropertyReceiver* receiver) const;
void set(PropertyReceiver* receiver, const String& value);
};
} // End of ProgressBarProperties namespace section
} // End of CEGUI namespace section
#endif // end of guard _CEGUIProgressBarProperties_h_
|
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2016 - ROLI Ltd.
Permission is granted to use this software under the terms of the ISC license
http://www.isc.org/downloads/software-support-policy/isc-license/
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT,
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
OF THIS SOFTWARE.
-----------------------------------------------------------------------------
To release a closed-source product which uses other parts of JUCE not
licensed under the ISC terms, commercial licenses are available: visit
www.juce.com for more information.
==============================================================================
*/
/**
Interpolator for resampling a stream of floats using 4-point lagrange interpolation.
Note that the resampler is stateful, so when there's a break in the continuity
of the input stream you're feeding it, you should call reset() before feeding
it any new data. And like with any other stateful filter, if you're resampling
multiple channels, make sure each one uses its own LagrangeInterpolator
object.
@see CatmullRomInterpolator
*/
class JUCE_API LagrangeInterpolator
{
public:
LagrangeInterpolator() noexcept;
~LagrangeInterpolator() noexcept;
/** Resets the state of the interpolator.
Call this when there's a break in the continuity of the input data stream.
*/
void reset() noexcept;
/** Resamples a stream of samples.
@param speedRatio the number of input samples to use for each output sample
@param inputSamples the source data to read from. This must contain at
least (speedRatio * numOutputSamplesToProduce) samples.
@param outputSamples the buffer to write the results into
@param numOutputSamplesToProduce the number of output samples that should be created
@returns the actual number of input samples that were used
*/
int process (double speedRatio,
const float* inputSamples,
float* outputSamples,
int numOutputSamplesToProduce) noexcept;
/** Resamples a stream of samples, adding the results to the output data
with a gain.
@param speedRatio the number of input samples to use for each output sample
@param inputSamples the source data to read from. This must contain at
least (speedRatio * numOutputSamplesToProduce) samples.
@param outputSamples the buffer to write the results to - the result values will be added
to any pre-existing data in this buffer after being multiplied by
the gain factor
@param numOutputSamplesToProduce the number of output samples that should be created
@param gain a gain factor to multiply the resulting samples by before
adding them to the destination buffer
@returns the actual number of input samples that were used
*/
int processAdding (double speedRatio,
const float* inputSamples,
float* outputSamples,
int numOutputSamplesToProduce,
float gain) noexcept;
private:
float lastInputSamples[5];
double subSamplePos;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LagrangeInterpolator)
};
|
/****************************************************************/
/* DO NOT MODIFY THIS HEADER */
/* MOOSE - Multiphysics Object Oriented Simulation Environment */
/* */
/* (c) 2010 Battelle Energy Alliance, LLC */
/* ALL RIGHTS RESERVED */
/* */
/* Prepared by Battelle Energy Alliance, LLC */
/* Under Contract No. DE-AC07-05ID14517 */
/* With the U. S. Department of Energy */
/* */
/* See COPYRIGHT for full restrictions */
/****************************************************************/
#ifndef LINEMATERIALSAMPLERBASE_H
#define LINEMATERIALSAMPLERBASE_H
#include "GeneralVectorPostprocessor.h"
#include "RayTracing.h"
#include "SamplerBase.h"
#include "FEProblem.h"
#include "InputParameters.h"
#include "BlockRestrictable.h"
//Forward Declarations
template<typename T>
class LineMaterialSamplerBase;
template<>
InputParameters validParams<LineMaterialSamplerBase<Real> >();
/**
* This is a base class for sampling material properties for the integration points
* in all elements that are intersected by a user-defined line. The positions of
* those points are output in x, y, z coordinates, as well as in terms of the projected
* positions of those points along the line. Derived classes can be created to sample
* arbitrary types of material properties.
*/
template<typename T>
class LineMaterialSamplerBase :
public GeneralVectorPostprocessor,
public SamplerBase,
public BlockRestrictable
{
public:
/**
* Class constructor
* Sets up variables for output based on the properties to be output
* @param name The name of the class
* @param parameters The input parameters
*/
LineMaterialSamplerBase(const std::string & name, InputParameters parameters);
/**
* Class destructor
*/
virtual ~LineMaterialSamplerBase() {}
/**
* Initialize
* Calls through to base class's initialize()
*/
virtual void initialize();
/**
* Finds all elements along the user-defined line, loops through them, and samples their
* material properties.
*/
virtual void execute();
/**
* Finalize
* Calls through to base class's finalize()
*/
virtual void finalize();
/**
* Thread Join
* Calls through to base class's threadJoin()
* @param sb SamplerBase object to be joint into this object
*/
virtual void threadJoin(const SamplerBase & sb);
/**
* Reduce the material property to a scalar for output
* @param property The material property
* @param curr_point The point corresponding to this material property
* @return A scalar value from this material property to be output
*/
virtual Real getScalarFromProperty(T & property, const Point * curr_point) = 0;
protected:
/// The beginning of the line
Point _start;
/// The end of the line
Point _end;
/// The material properties to be output
std::vector<MaterialProperty<T> *> _material_properties;
/// The mesh
MooseMesh & _mesh;
/// The quadrature rule
QBase * & _qrule;
/// The quadrature points
const MooseArray<Point> & _q_point;
};
template <typename T>
LineMaterialSamplerBase<T>::LineMaterialSamplerBase(const std::string & name, InputParameters parameters) :
GeneralVectorPostprocessor(name, parameters),
SamplerBase(name, parameters, this, _communicator),
BlockRestrictable(parameters),
_start(getParam<Point>("start")),
_end(getParam<Point>("end")),
_mesh(_subproblem.mesh()),
_qrule(_subproblem.assembly(_tid).qRule()),
_q_point(_subproblem.assembly(_tid).qPoints())
{
std::vector<std::string> material_property_names = getParam<std::vector<std::string> >("property");
for (unsigned int i=0; i<material_property_names.size(); ++i)
{
if (!hasMaterialProperty<T>(material_property_names[i]))
mooseError("In LineMaterialSamplerBase material property: " + material_property_names[i] + " does not exist.");
_material_properties.push_back(&getMaterialProperty<T>(material_property_names[i]));
}
SamplerBase::setupVariables(material_property_names);
}
template <typename T>
void
LineMaterialSamplerBase<T>::initialize()
{
SamplerBase::initialize();
}
template <typename T>
void
LineMaterialSamplerBase<T>::execute()
{
std::vector<Elem *> intersected_elems;
Moose::elementsIntersectedByLine(_start, _end, _fe_problem.mesh(), intersected_elems);
const RealVectorValue line_vec = _end - _start;
const Real line_length(line_vec.size());
const RealVectorValue line_unit_vec = line_vec / line_length;
std::vector<Real> values(_material_properties.size());
for (unsigned int i=0; i<intersected_elems.size(); ++i)
{
const Elem * elem = intersected_elems[i];
if (elem->processor_id() != processor_id())
continue;
if (!hasBlocks(elem->subdomain_id()))
continue;
_subproblem.prepare(elem, _tid);
_subproblem.reinitElem(elem, _tid);
_fe_problem.reinitMaterials(elem->subdomain_id(), _tid);
for (unsigned int qp=0; qp<_qrule->n_points(); ++qp)
{
const RealVectorValue qp_pos(_q_point[qp]);
const RealVectorValue start_to_qp(qp_pos - _start);
const Real qp_proj_dist_along_line = start_to_qp * line_unit_vec;
if (qp_proj_dist_along_line < 0 || qp_proj_dist_along_line > line_length)
continue;
for (unsigned int j=0; j<_material_properties.size(); ++j)
values[j] = getScalarFromProperty((*_material_properties[j])[qp], &_q_point[qp]);
addSample(_q_point[qp], qp_proj_dist_along_line, values);
}
_fe_problem.swapBackMaterials(_tid);
}
}
template <typename T>
void
LineMaterialSamplerBase<T>::finalize()
{
SamplerBase::finalize();
}
template <typename T>
void
LineMaterialSamplerBase<T>::threadJoin(const SamplerBase & sb)
{
SamplerBase::threadJoin(sb);
}
#endif
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.