text stringlengths 4 6.14k |
|---|
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* 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.
*/
/*
* %ArrayIteratorPrototype% built-in description
*/
#include "ecma-builtin-helpers-macro-defines.inc.h"
#if ENABLED (JERRY_ESNEXT)
STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
LIT_MAGIC_STRING_ARRAY_ITERATOR_UL,
ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* Routine properties:
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
ROUTINE (LIT_MAGIC_STRING_NEXT, ecma_builtin_array_iterator_prototype_object_next, 0, 0)
#endif /* ENABLED (JERRY_ESNEXT) */
#include "ecma-builtin-helpers-macro-undefs.inc.h"
|
// Copyright [2013] [E7, ryuuzaki.uchiha@gmail.com]
// 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 __COMMON_H__
#define __COMMON_H__
#include <unistd.h>
#include <fcntl.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/resource.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <sys/epoll.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/uio.h>
#include <sys/shm.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <execinfo.h>
#include <sched.h>
#include <errno.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
#define __UINT_ZOOO__ (~(uintptr_t)0 >> 1)
#define INTEGER_MAX ((intptr_t)__UINT_ZOOO__)
#define INTEGER_MIN ((intptr_t)~__UINT_ZOOO__)
#if BITS_32
#define STR_INTEGER_MAX "2147483647"
#define STR_INTEGER_MIN "-2147483648"
#else
#define STR_INTEGER_MAX "9223372036854775807"
#define STR_INTEGER_MIN "-9223372036854775808"
#endif
typedef volatile uintptr_t atomic_t;
typedef struct {
uint8_t *mp_data;
ssize_t m_capacity;
} hixo_array_t;
extern void hixo_create_byte_array(hixo_array_t *p_byta_array,
ssize_t capacity);
extern void hixo_byte_array_transfer(hixo_array_t *p_recv,
hixo_array_t *p_send);
extern void hixo_destroy_byte_array(hixo_array_t *p_byta_array);
#define FALSE 0
#define TRUE (!FALSE)
#define do_nothing() do {} while (0)
#define ARRAY_COUNT(a) (sizeof(a) / sizeof(a[0]))
#define OFFSET_OF(s, m) ((size_t)&(((s *)0)->m ))
#define CONTAINER_OF(ptr, type, member) \
({\
const __typeof__(((type *)0)->member) *p_mptr = (ptr);\
(type *)((uint8_t *)p_mptr - OFFSET_OF(type, member));\
})
#define MIN(a, b) (((a) > (b)) ? (b) : (a))
#define MAX(a, b) (((a) < (b)) ? (b) : (a))
static inline
intptr_t abs_value(intptr_t num)
{
if (INTEGER_MIN == num) {
return -1;
} else if (num > 0) {
return num;
} else {
return -num;
}
}
static inline
intptr_t count_places(intptr_t num)
{
static intptr_t const places_max[] = {
9, 99, 999, 9999, 99999, // 1-5
999999, // 6
9999999,
99999999,
999999999, // 9
#if !BITS_32
9999999999, // 10
99999999999,
999999999999,
9999999999999, // 13
99999999999999,
999999999999999, // 15
9999999999999999,
99999999999999999,
999999999999999999, // 18
#endif
};
intptr_t rslt = 0;
intptr_t start = 0;
intptr_t middle = 0;
intptr_t end = ARRAY_COUNT(places_max);
intptr_t positive = 0;
if (INTEGER_MIN == num) {
positive = abs_value(num + 1);
} else {
positive = abs_value(num);
}
while (start < end) {
middle = start + (end - start) / 2;
if (positive <= places_max[middle]) {
rslt = middle + 1;
end = middle;
} else {
rslt = middle + 2;
start = middle + 1;
}
}
if (num < 0) {
++rslt;
}
return rslt;
}
static inline
void __str_reverse__(char str[], ssize_t len)
{
for (int i = 0, j = len - 1; i < j; ++i, --j) {
char tmp = str[i];
str[i] = str[j];
str[j] = tmp;
}
}
static inline
char const *wtoa(intptr_t num, ssize_t places, char buf[], ssize_t len)
{
intptr_t value = abs_value(num);
ssize_t end = 0;
if (places > len - 1) {
return NULL;
}
if (INTEGER_MIN == num) {
(void)strncpy(buf, STR_INTEGER_MIN, sizeof(STR_INTEGER_MIN) - 1);
return buf;
}
if (0 == value) {
buf[end++] = '0';
} else {
while (value > 0) {
intptr_t next_value = value / 10;
buf[end++] = value - next_value * 10 + '0';
value = next_value;
}
if (num < 0) {
buf[end++] = '-';
}
__str_reverse__(buf, end);
}
buf[end] = 0;
return buf;
}
#ifndef ESUCCESS
#define ESUCCESS (0)
#endif
#define HIXO_OK (0)
#define HIXO_ERROR (-1)
#define INVALID_FD (~0)
#define unblocking_fd(fd) fcntl(fd, \
F_SETFL, \
fcntl(fd, F_GETFL) | O_NONBLOCK)
#ifdef __cplusplus
}
#endif // __cplusplus
#endif // __COMMON_H__
|
/*
* Copyright 2020 Makani Technologies LLC
*
* 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 GS_STATE_COMMAND_DETWIST_STATE_H_
#define GS_STATE_COMMAND_DETWIST_STATE_H_
#include <stdint.h>
#include "avionics/common/actuator_types.h"
#include "gs/state_command/state_command.h"
class DetwistStateCommand : public StateCommandBase {
public:
DetwistStateCommand(void) : StateCommandBase("Detwist") {}
~DetwistStateCommand(void) {}
LabelsMap GetLabels(void) const override;
bool GetActuatorState(int32_t index, ActuatorState *state) override;
void SendActuatorStateCommand(ActuatorStateCommand command) override;
};
#endif // GS_STATE_COMMAND_DETWIST_STATE_H_
|
/*
* Copyright 2019 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.
*/
#include <aws/common/common.h>
static AWS_THREAD_LOCAL int tl_last_error = 0;
/**
* It overrides the original aws_raise_error_private implementation, to avoid
* error handler functions (unnecessary for the verification process).
*/
void aws_raise_error_private(int err) {
tl_last_error = err;
}
/**
* It overrides the original aws_last_error implementation.
*/
int aws_last_error(void) {
return tl_last_error;
}
|
/*
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.
*/
//
// MainViewController.h
// c3
//
// Created by INFRA dev1 on 12. 6. 13..
// Copyright INFRAWARE 2012년. All rights reserved.
//
#import "RTViewController.h"
@interface MainViewController : RTViewController
@end
|
/*
* Filename: /mnt/spark-pmof/tool/rpmp/pmpool/ThreadWrapper.h
* Path: /mnt/spark-pmof/tool/rpmp/pmpool
* Created Date: Thursday, November 7th 2019, 3:48:52 pm
* Author: root
*
* Copyright (c) 2019 Intel
*/
#ifndef PMPOOL_THREADWRAPPER_H_
#define PMPOOL_THREADWRAPPER_H_
#include <assert.h>
#include <atomic>
#include <condition_variable> // NOLINT
#include <iostream>
#include <mutex> // NOLINT
#include <thread> // NOLINT
class ThreadWrapper {
public:
ThreadWrapper() : done(false) {}
virtual ~ThreadWrapper() = default;
void join() {
if (thread.joinable()) {
thread.join();
} else {
std::unique_lock<std::mutex> l(join_mutex);
join_event.wait(l, [=] { return done.load(); });
}
}
void start(bool background_thread = false) {
thread = std::thread(&ThreadWrapper::thread_body, this);
if (background_thread) {
thread.detach();
}
}
void stop() { done.store(true); }
void set_affinity(int cpu) {
#ifdef __linux__
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
CPU_SET(cpu, &cpuset);
int res = pthread_setaffinity_np(thread.native_handle(), sizeof(cpu_set_t),
&cpuset);
if (res) {
abort();
}
#endif
}
void thread_body() {
try {
while (true) {
int ret = entry();
if (done.load() || ret == -1) {
if (!thread.joinable()) {
join_event.notify_all();
}
break;
}
}
} catch (ThreadAbortException &) {
abort();
} catch (std::exception &ex) {
ExceptionCaught(ex);
} catch (...) {
UnknownExceptionCaught();
}
}
private:
class ThreadAbortException : std::exception {};
protected:
virtual int entry() = 0;
virtual void abort() = 0;
virtual void ExceptionCaught(const std::exception &exception) {}
virtual void UnknownExceptionCaught() {}
private:
std::thread thread;
std::mutex join_mutex;
std::condition_variable join_event;
std::atomic_bool done = {false};
};
#endif // PMPOOL_THREADWRAPPER_H_
|
#define CONNECTION_REQ 0x74160001
#define CONNECTION_RSP 0x74160001 + 0x1000
#define REPORT_DATA_REQ 0x74160002
#define REPORT_DATA_RSP 0x74160002 + 0x1000
#define PUSH_DATA_REQ 0x74160003
#define PUSH_DATA_RSP 0x74160003 + 0x1000
#define MAX_FILE_NAME 128
struct stMsg{
unsigned int ulMsgId;
unsigned int ulValue[4]; // Reserved
char cName[MAX_FILE_NAME];
};
int msg_send_func(unsigned int ulMsgId, char *strMsg, unsigned int ul1stValue, unsigned int ul2ndValue);
gboolean udp_test_thread(GIOChannel *source, GIOCondition condition, gpointer data);
void *udp_thread_start(void*);
|
//===- llvm/CodeGen/GlobalISel/GISelKnownBits.h ---------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
/// Provides analysis for querying information about KnownBits during GISel
/// passes.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CODEGEN_GLOBALISEL_KNOWNBITSINFO_H
#define LLVM_CODEGEN_GLOBALISEL_KNOWNBITSINFO_H
#include "llvm/CodeGen/GlobalISel/GISelChangeObserver.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/Register.h"
#include "llvm/IR/PassManager.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
#include "llvm/Support/KnownBits.h"
namespace llvm {
class TargetLowering;
class DataLayout;
class GISelKnownBits : public GISelChangeObserver {
MachineFunction &MF;
MachineRegisterInfo &MRI;
const TargetLowering &TL;
const DataLayout &DL;
public:
GISelKnownBits(MachineFunction &MF);
virtual ~GISelKnownBits() = default;
void setMF(MachineFunction &MF);
virtual void computeKnownBitsImpl(Register R, KnownBits &Known,
const APInt &DemandedElts,
unsigned Depth = 0);
// KnownBitsAPI
KnownBits getKnownBits(Register R);
// Calls getKnownBits for first operand def of MI.
KnownBits getKnownBits(MachineInstr &MI);
APInt getKnownZeroes(Register R);
APInt getKnownOnes(Register R);
/// \return true if 'V & Mask' is known to be zero in DemandedElts. We use
/// this predicate to simplify operations downstream.
/// Mask is known to be zero for bits that V cannot have.
bool maskedValueIsZero(Register Val, const APInt &Mask) {
return Mask.isSubsetOf(getKnownBits(Val).Zero);
}
/// \return true if the sign bit of Op is known to be zero. We use this
/// predicate to simplify operations downstream.
bool signBitIsZero(Register Op);
// FIXME: Is this the right place for G_FRAME_INDEX? Should it be in
// TargetLowering?
void computeKnownBitsForFrameIndex(Register R, KnownBits &Known,
const APInt &DemandedElts,
unsigned Depth = 0);
static unsigned inferAlignmentForFrameIdx(int FrameIdx, int Offset,
const MachineFunction &MF);
static void computeKnownBitsForAlignment(KnownBits &Known, unsigned Align);
// Try to infer alignment for MI.
static unsigned inferPtrAlignment(const MachineInstr &MI);
// Observer API. No-op for non-caching implementation.
void erasingInstr(MachineInstr &MI) override{};
void createdInstr(MachineInstr &MI) override{};
void changingInstr(MachineInstr &MI) override{};
void changedInstr(MachineInstr &MI) override{};
protected:
unsigned getMaxDepth() const { return 6; }
};
/// To use KnownBitsInfo analysis in a pass,
/// KnownBitsInfo &Info = getAnalysis<GISelKnownBitsInfoAnalysis>().get(MF);
/// Add to observer if the Info is caching.
/// WrapperObserver.addObserver(Info);
/// Eventually add other features such as caching/ser/deserializing
/// to MIR etc. Those implementations can derive from GISelKnownBits
/// and override computeKnownBitsImpl.
class GISelKnownBitsAnalysis : public MachineFunctionPass {
std::unique_ptr<GISelKnownBits> Info;
public:
static char ID;
GISelKnownBitsAnalysis() : MachineFunctionPass(ID) {
initializeGISelKnownBitsAnalysisPass(*PassRegistry::getPassRegistry());
}
GISelKnownBits &get(MachineFunction &MF) {
if (!Info)
Info = std::make_unique<GISelKnownBits>(MF);
return *Info.get();
}
void getAnalysisUsage(AnalysisUsage &AU) const override;
bool runOnMachineFunction(MachineFunction &MF) override;
void releaseMemory() override { Info.reset(); }
};
} // namespace llvm
#endif // ifdef
|
// RUN: %clang_cc1 -emit-llvm -g -triple x86_64-apple-darwin %s -o - | FileCheck %s
void testVLAwithSize(int s)
{
// CHECK: metadata !{i32 {{.*}}, metadata {{.*}}, metadata !"vla", metadata {{.*}}, i32 [[@LINE+1]], metadata {{.*}}, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [vla] [line [[@LINE+1]]]
int vla[s];
int i;
for (i = 0; i < s; i++) {
vla[i] = i*i;
}
}
|
/*
* 10.6
*
* mofaph@gmail.com
* 2013/5/11
*
* 下面程序的输出是什么?
*
* $ touch {foo,bar,baz}.txt
* $ cc -I../common ../common/csapp.c ex10-6.c -lpthread
*/
#include "csapp.h"
int main(void) {
int fd1, fd2;
fd1 = Open("foo.txt", O_RDONLY, 0); /* fd1: 3 */
fd2 = Open("bar.txt", O_RDONLY, 0); /* fd2: 4 */
Close(fd2);
fd2 = Open("baz.txt", O_RDONLY, 0); /* fd2: 4 */
printf("fd2 = %d\n", fd2);
exit(0);
}
|
/*
* Copyright (c) 2017 RnDity Sp. z o.o.
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_DRIVERS_PINMUX_STM32_PINMUX_STM32F3_H_
#define ZEPHYR_DRIVERS_PINMUX_STM32_PINMUX_STM32F3_H_
/**
* @file Header for STM32F3 pin multiplexing helper
*/
#define STM32F3_PINMUX_FUNC_PA9_USART1_TX \
(STM32_PINMUX_ALT_FUNC_7 | STM32_PUSHPULL_PULLUP)
#define STM32F3_PINMUX_FUNC_PA10_USART1_RX \
(STM32_PINMUX_ALT_FUNC_7 | STM32_PUSHPULL_NOPULL)
#define STM32F3_PINMUX_FUNC_PC4_USART1_TX \
(STM32_PINMUX_ALT_FUNC_7 | STM32_PUSHPULL_PULLUP)
#define STM32F3_PINMUX_FUNC_PC5_USART1_RX \
(STM32_PINMUX_ALT_FUNC_7 | STM32_PUSHPULL_NOPULL)
#define STM32F3_PINMUX_FUNC_PA2_USART2_TX \
(STM32_PINMUX_ALT_FUNC_7 | STM32_PUSHPULL_PULLUP)
#define STM32F3_PINMUX_FUNC_PA3_USART2_RX \
(STM32_PINMUX_ALT_FUNC_7 | STM32_PUSHPULL_NOPULL)
#ifndef CONFIG_SOC_STM32F334X8
#define STM32F3_PINMUX_FUNC_PD5_USART2_TX \
(STM32_PINMUX_ALT_FUNC_7 | STM32_PUSHPULL_PULLUP)
#define STM32F3_PINMUX_FUNC_PD6_USART2_RX \
(STM32_PINMUX_ALT_FUNC_7 | STM32_PUSHPULL_NOPULL)
#endif
#if CONFIG_SOC_STM32F303XC
#define STM32F3_PINMUX_FUNC_PA9_I2C2_SCL \
(STM32_PINMUX_ALT_FUNC_4 | STM32_OPENDRAIN_PULLUP)
#define STM32F3_PINMUX_FUNC_PA10_I2C2_SDA \
(STM32_PINMUX_ALT_FUNC_4 | STM32_OPENDRAIN_PULLUP)
#define STM32F3_PINMUX_FUNC_PB6_I2C1_SCL \
(STM32_PINMUX_ALT_FUNC_4 | STM32_OPENDRAIN_PULLUP)
#define STM32F3_PINMUX_FUNC_PB7_I2C1_SDA \
(STM32_PINMUX_ALT_FUNC_4 | STM32_OPENDRAIN_PULLUP)
#define STM32F3_PINMUX_FUNC_PB10_USART3_TX \
(STM32_PINMUX_ALT_FUNC_7 | STM32_PUSHPULL_PULLUP)
#define STM32F3_PINMUX_FUNC_PB11_USART3_RX \
(STM32_PINMUX_ALT_FUNC_7 | STM32_PUSHPULL_NOPULL)
#define STM32F3_PINMUX_FUNC_PF0_I2C2_SDA \
(STM32_PINMUX_ALT_FUNC_4 | STM32_OPENDRAIN_PULLUP)
#define STM32F3_PINMUX_FUNC_PF1_I2C2_SCL \
(STM32_PINMUX_ALT_FUNC_4 | STM32_OPENDRAIN_PULLUP)
#elif CONFIG_SOC_STM32F334X8
#define STM32F3_PINMUX_FUNC_PB8_USART3_RX \
(STM32_PINMUX_ALT_FUNC_7 | STM32_PUSHPULL_NOPULL)
#define STM32F3_PINMUX_FUNC_PB9_USART3_TX \
(STM32_PINMUX_ALT_FUNC_7 | STM32_PUSHPULL_PULLUP)
#define STM32F3_PINMUX_FUNC_PB10_USART3_TX \
(STM32_PINMUX_ALT_FUNC_7 | STM32_PUSHPULL_PULLUP)
#define STM32F3_PINMUX_FUNC_PB11_USART3_RX \
(STM32_PINMUX_ALT_FUNC_7 | STM32_PUSHPULL_NOPULL)
#elif CONFIG_SOC_STM32F373XC
#define STM32F3_PINMUX_FUNC_PB8_USART3_TX \
(STM32_PINMUX_ALT_FUNC_7 | STM32_PUSHPULL_PULLUP)
#define STM32F3_PINMUX_FUNC_PB9_USART3_RX \
(STM32_PINMUX_ALT_FUNC_7 | STM32_PUSHPULL_NOPULL)
#define STM32F3_PINMUX_FUNC_PB10_USART3_TX \
(STM32_PINMUX_ALT_FUNC_7 | STM32_PUSHPULL_PULLUP)
#endif
#define STM32F3_PINMUX_FUNC_PA4_SPI1_NSS \
(STM32_PINMUX_ALT_FUNC_5 | STM32_PUSHPULL_NOPULL)
#define STM32F3_PINMUX_FUNC_PA5_SPI1_SCK \
(STM32_PINMUX_ALT_FUNC_5 | STM32_PUSHPULL_NOPULL)
#define STM32F3_PINMUX_FUNC_PA6_SPI1_MISO \
(STM32_PINMUX_ALT_FUNC_5 | STM32_PUSHPULL_NOPULL)
#define STM32F3_PINMUX_FUNC_PA7_SPI1_MOSI \
(STM32_PINMUX_ALT_FUNC_5 | STM32_PUSHPULL_NOPULL)
#define STM32F3_PINMUX_FUNC_PA8_PWM1_CH1 \
(STM32_PINMUX_ALT_FUNC_6 | STM32_PUSHPULL_NOPULL)
#define STM32F3_PINMUX_FUNC_PA11_USB_DM \
(STM32_PINMUX_ALT_FUNC_14 | STM32_PUSHPULL_NOPULL)
#define STM32F3_PINMUX_FUNC_PA12_USB_DP \
(STM32_PINMUX_ALT_FUNC_14 | STM32_PUSHPULL_NOPULL)
#define STM32F3_PINMUX_FUNC_PB8_I2C1_SCL \
(STM32_PINMUX_ALT_FUNC_4 | STM32_OPENDRAIN_PULLUP)
#define STM32F3_PINMUX_FUNC_PB9_I2C1_SDA \
(STM32_PINMUX_ALT_FUNC_4 | STM32_OPENDRAIN_PULLUP)
#define STM32F3_PINMUX_FUNC_PB12_SPI2_NSS \
(STM32_PINMUX_ALT_FUNC_5 | STM32_PUSHPULL_NOPULL)
#define STM32F3_PINMUX_FUNC_PB13_SPI2_SCK \
(STM32_PINMUX_ALT_FUNC_5 | STM32_PUSHPULL_NOPULL)
#define STM32F3_PINMUX_FUNC_PB14_SPI2_MISO \
(STM32_PINMUX_ALT_FUNC_5 | STM32_PUSHPULL_NOPULL)
#define STM32F3_PINMUX_FUNC_PB15_SPI2_MOSI \
(STM32_PINMUX_ALT_FUNC_5 | STM32_PUSHPULL_NOPULL)
#endif /* ZEPHYR_DRIVERS_PINMUX_STM32_PINMUX_STM32F3_H_ */
|
/*
* (C) Copyright 2017 Edson (http://edsonaraujosoares.com) and others.
*
* 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.
*
* Contributors:
* Edson Araújo Soares
*/
#ifndef GOF_TEMPLATE_METHOD_GENERIC_AUDIO_PLAYER_H
#define GOF_TEMPLATE_METHOD_GENERIC_AUDIO_PLAYER_H
#include "TemplateMethod/AudioSource.h"
namespace GoF {
namespace TemplateMethod {
class GenericAudioPlayer
{
public:
GenericAudioPlayer()
{ }
void stop(AudioSource *);
void play(AudioSource *);
};
}
}
#endif
|
/*
* Copyright (c) 2014-2017 Pavel Kalvoda <me@pavelkalvoda.com>
*
* libcbor is free software; you can redistribute it and/or modify
* it under the terms of the MIT license. See LICENSE for details.
*/
#ifndef LIBCBOR_STACK_H
#define LIBCBOR_STACK_H
#include "cbor/common.h"
#ifdef __cplusplus
extern "C" {
#endif
/** Simple stack record for the parser */
struct _cbor_stack_record {
struct _cbor_stack_record *lower;
cbor_item_t *item;
size_t subitems;
};
/** Stack handle - contents and size */
struct _cbor_stack {
struct _cbor_stack_record *top;
size_t size;
};
struct _cbor_stack _cbor_stack_init();
void _cbor_stack_pop(struct _cbor_stack *);
struct _cbor_stack_record *_cbor_stack_push(struct _cbor_stack *, cbor_item_t *, size_t);
#ifdef __cplusplus
}
#endif
#endif //LIBCBOR_STACK_H
|
/* @LICENSE(MUSLC_MIT) */
#include <string.h>
char *__stpncpy(char *, const char *, size_t);
char *strncpy(char *d, const char *s, size_t n)
{
__stpncpy(d, s, n);
return d;
}
|
/* @LICENSE(MUSLC_MIT) */
#include <unistd.h>
#include <errno.h>
#include <sys/resource.h>
#include "internal/syscall.h"
#include "libc.h"
struct ctx {
int id, eid, sid;
int nr, rlim, err;
};
/* We jump through hoops to eliminate the possibility of partial failures. */
int __setrlimit(int, const struct rlimit *);
static void do_setxid(void *p)
{
struct ctx *c = p;
if (c->err) return;
if (c->rlim && c->id >= 0 && c->id != getuid()) {
struct rlimit inf = { RLIM_INFINITY, RLIM_INFINITY }, old;
getrlimit(RLIMIT_NPROC, &old);
if ((c->err = -__setrlimit(RLIMIT_NPROC, &inf)) && libc.threads_minus_1)
return;
c->err = -__syscall(c->nr, c->id, c->eid, c->sid);
__setrlimit(RLIMIT_NPROC, &old);
return;
}
c->err = -__syscall(c->nr, c->id, c->eid, c->sid);
}
int __setxid(int nr, int id, int eid, int sid)
{
struct ctx c = { .nr = nr, .id = id, .eid = eid, .sid = sid };
switch (nr) {
case SYS_setuid:
case SYS_setreuid:
case SYS_setresuid:
c.rlim = 1;
}
__synccall(do_setxid, &c);
if (c.err) {
errno = c.err;
return -1;
}
return 0;
}
|
/* scal_arcfour.h */
/*
This file is part of the ARM-Crypto-Lib.
Copyright (C) 2011 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 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 SCAL_ARCFOUR_H_
#define SCAL_ARCFOUR_H_
#include <crypto/streamcipher_descriptor.h>
extern const scdesc_t arcfour_desc;
#endif /* SCAL_ARCFOUR_H_ */
|
/*
* Calendar Functions
* (C) 1999-2009,2015 Jack Lloyd
* (C) 2015 Simon Warta (Kullo GmbH)
*
* Botan is released under the Simplified BSD License (see license.txt)
*/
#ifndef BOTAN_CALENDAR_H_
#define BOTAN_CALENDAR_H_
#include <botan/types.h>
#include <chrono>
#include <string>
namespace Botan {
/**
* Struct representing a particular date and time
*/
class BOTAN_TEST_API calendar_point
{
public:
/** The year */
uint32_t year() const { return m_year; }
/** The month, 1 through 12 for Jan to Dec */
uint32_t month() const { return m_month; }
/** The day of the month, 1 through 31 (or 28 or 30 based on month */
uint32_t day() const { return m_day; }
/** Hour in 24-hour form, 0 to 23 */
uint32_t hour() const { return m_hour; }
/** Minutes in the hour, 0 to 60 */
uint32_t minutes() const { return m_minutes; }
/** Seconds in the minute, 0 to 60, but might be slightly
larger to deal with leap seconds on some systems
*/
uint32_t seconds() const { return m_seconds; }
/**
* Initialize a calendar_point
* @param y the year
* @param mon the month
* @param d the day
* @param h the hour
* @param min the minute
* @param sec the second
*/
calendar_point(uint32_t y, uint32_t mon, uint32_t d, uint32_t h, uint32_t min, uint32_t sec) :
m_year(y), m_month(mon), m_day(d), m_hour(h), m_minutes(min), m_seconds(sec) {}
/**
* Convert a time_point to a calendar_point
* @param time_point a time point from the system clock
*/
calendar_point(const std::chrono::system_clock::time_point& time_point);
/**
* Returns an STL timepoint object
*/
std::chrono::system_clock::time_point to_std_timepoint() const;
/**
* Returns a human readable string of the struct's components.
* Formatting might change over time. Currently it is RFC339 'iso-date-time'.
*/
std::string to_string() const;
private:
uint32_t m_year;
uint32_t m_month;
uint32_t m_day;
uint32_t m_hour;
uint32_t m_minutes;
uint32_t m_seconds;
};
}
#endif
|
/*************************************************************************\
* Copyright (C) 2009 by Ulf Kreissig *
* udev@gmx.net *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
\*************************************************************************/
#ifndef COUNTRYMAP_H
#define COUNTRYMAP_H
//--- QT4 ---
#include <QAbstractListModel>
#include <QAbstractTableModel>
#include <QCache>
#include <QMap>
#include <QModelIndex>
#include <QPointer>
class CountryMap : public QObject //: public QAbstractListModel
{
public:
CountryMap( QObject * parent = NULL );
~CountryMap();
QPixmap getPixmapForCountryCode( const QString & countryCode ) const;
QString countryCode( const QString & country ) const;
QString country( const QString & country ) const;
QStringList timeZones( const QString & countryCode ) const;
private:
static const QString sFlagTemplate;
struct Private;
Private * d;
};
class UnitedStatesMap : public QObject //: public QAbstractTableModel
{
public:
UnitedStatesMap( QObject * parent = NULL );
~UnitedStatesMap();
QString stateCode( const QString & state ) const;
QString state( const QString & stateCode ) const;
QStringList timeZones( const QString & stateCode ) const;
private:
struct Private;
Private * d;
};
#endif // COUNTRYMAP_H
|
/*
$NiH: zip_source_filep.c,v 1.6 2005/06/09 19:57:10 dillo Exp $
zip_source_filep.c -- create data source from FILE *
Copyright (C) 1999, 2003, 2004, 2005 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
The authors can be contacted at <nih@giga.or.at>
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 names of the authors may not be used to endorse or promote
products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/stat.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "zip.h"
#include "zipint.h"
struct read_file {
FILE *f; /* file to copy from */
off_t off; /* start offset of */
off_t len; /* lengt of data to copy */
off_t remain; /* bytes remaining to be copied */
int e[2]; /* error codes */
};
static ssize_t read_file(void *state, void *data, size_t len,
enum zip_source_cmd cmd);
struct zip_source *
zip_source_filep(struct zip *za, FILE *file, off_t start, off_t len)
{
struct read_file *f;
struct zip_source *zs;
if (za == NULL)
return NULL;
if (file == NULL || start < 0 || len < -1) {
_zip_error_set(&za->error, ZIP_ER_INVAL, 0);
return NULL;
}
if ((f=(struct read_file *)malloc(sizeof(struct read_file))) == NULL) {
_zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
return NULL;
}
f->f = file;
f->off = start;
f->len = (len ? len : -1);
if ((zs=zip_source_function(za, read_file, f)) == NULL) {
free(f);
return NULL;
}
return zs;
}
static ssize_t
read_file(void *state, void *data, size_t len, enum zip_source_cmd cmd)
{
struct read_file *z;
char *buf;
int i, n;
z = (struct read_file *)state;
buf = (char *)data;
switch (cmd) {
case ZIP_SOURCE_OPEN:
if (fseeko(z->f, z->off, SEEK_SET) < 0) {
z->e[0] = ZIP_ER_SEEK;
z->e[1] = errno;
return -1;
}
z->remain = z->len;
return 0;
case ZIP_SOURCE_READ:
if (z->remain != -1)
n = len > z->remain ? z->remain : len;
else
n = len;
if ((i=fread(buf, 1, n, z->f)) < 0) {
z->e[0] = ZIP_ER_READ;
z->e[1] = errno;
return -1;
}
if (z->remain != -1)
z->remain -= i;
return i;
case ZIP_SOURCE_CLOSE:
return 0;
case ZIP_SOURCE_STAT:
{
struct zip_stat *st;
struct stat fst;
if (len < sizeof(*st))
return -1;
st = (struct zip_stat *)data;
if (fstat(fileno(z->f), &fst) != 0) {
z->e[0] = ZIP_ER_READ; /* best match */
z->e[1] = errno;
return -1;
}
st->mtime = fst.st_mtime;
st->crc = 0;
if (z->len != -1)
st->size = z->len;
else if ((fst.st_mode&S_IFMT) == S_IFREG)
st->size = fst.st_size;
else
st->size = -1;
st->comp_size = -1;
st->comp_method = ZIP_CM_STORE;
return sizeof(*st);
}
case ZIP_SOURCE_ERROR:
if (len < sizeof(int)*2)
return -1;
memcpy(data, z->e, sizeof(int)*2);
return sizeof(int)*2;
case ZIP_SOURCE_FREE:
fclose(z->f);
free(z);
return 0;
default:
;
}
return -1;
}
|
/*-
* Copyright (C) 2008-2009 by Maxim Ignatenko
* gelraen.ua@gmail.com
*
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* * Redistributions of source code must retain the above copyright *
* notice, this list of conditions and the following disclaimer. *
* * Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in *
* the documentation and/or other materials provided with the *
* distribution. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR *
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT *
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE *
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
*
* $Id$
*/
#ifndef DCCLIENT_H
#define DCCLIENT_H
#include <dcconfig.h>
#include <dcconnection.h>
/**
@author gelraen <gelraen.ua@gmail.com>
*/
class DCClient{
public:
DCClient();
~DCClient();
bool Connect();
bool Disconnect();
bool readCommand(string& str);
bool setConfig(const DCConfig& conf);
const DCConfig& getConfig();
bool writeCommand(const string& str);
bool isLoggedIn() const;
int FdSet(fd_set& fdset);
bool writeMessage(const string& str);
private:
DCConfig m_config;
DCConnection m_connection;
bool m_bLoggedIn;
protected:
static string DecodeLock(string lock);
};
#endif
|
/*
* Copyright (C) 2016 Igalia S.L. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
#if ENABLE(MATHML)
#include "MathMLInlineContainerElement.h"
namespace WebCore {
class MathMLFractionElement final : public MathMLInlineContainerElement {
public:
static Ref<MathMLFractionElement> create(const QualifiedName& tagName, Document&);
const Length& lineThickness();
enum FractionAlignment {
FractionAlignmentCenter,
FractionAlignmentLeft,
FractionAlignmentRight
};
FractionAlignment numeratorAlignment();
FractionAlignment denominatorAlignment();
private:
MathMLFractionElement(const QualifiedName& tagName, Document&);
RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final;
void parseAttribute(const QualifiedName&, const AtomicString&) final;
struct FractionAlignmentAttribute {
FractionAlignment value { FractionAlignmentCenter };
bool dirty { true };
};
FractionAlignment cachedFractionAlignment(const QualifiedName&, FractionAlignmentAttribute&);
Length m_lineThickness;
FractionAlignmentAttribute m_numeratorAlignment;
FractionAlignmentAttribute m_denominatorAlignment;
};
}
#endif // ENABLE(MATHML)
|
/*-------------------------------------------------------------------------
*
* tqual.h
* POSTGRES "time qualification" definitions, ie, tuple visibility rules.
*
* Should be moved/renamed... - vadim 07/28/98
*
* Portions Copyright (c) 1996-2011, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/utils/tqual.h
*
*-------------------------------------------------------------------------
*/
#ifndef TQUAL_H
#define TQUAL_H
#include "utils/snapshot.h"
/* Static variables representing various special snapshot semantics */
extern PGDLLIMPORT SnapshotData SnapshotNowData;
extern PGDLLIMPORT SnapshotData SnapshotSelfData;
extern PGDLLIMPORT SnapshotData SnapshotAnyData;
extern PGDLLIMPORT SnapshotData SnapshotToastData;
#define SnapshotNow (&SnapshotNowData)
#define SnapshotSelf (&SnapshotSelfData)
#define SnapshotAny (&SnapshotAnyData)
#define SnapshotToast (&SnapshotToastData)
/*
* We don't provide a static SnapshotDirty variable because it would be
* non-reentrant. Instead, users of that snapshot type should declare a
* local variable of type SnapshotData, and initialize it with this macro.
*/
#define InitDirtySnapshot(snapshotdata) \
((snapshotdata).satisfies = HeapTupleSatisfiesDirty)
/* This macro encodes the knowledge of which snapshots are MVCC-safe */
#define IsMVCCSnapshot(snapshot) \
((snapshot)->satisfies == HeapTupleSatisfiesMVCC)
/*
* HeapTupleSatisfiesVisibility
* True iff heap tuple satisfies a time qual.
*
* Notes:
* Assumes heap tuple is valid.
* Beware of multiple evaluations of snapshot argument.
* Hint bits in the HeapTuple's t_infomask may be updated as a side effect;
* if so, the indicated buffer is marked dirty.
*/
#define HeapTupleSatisfiesVisibility(tuple, snapshot, buffer) \
((*(snapshot)->satisfies) ((tuple)->t_data, snapshot, buffer))
/* Result codes for HeapTupleSatisfiesVacuum */
typedef enum
{
HEAPTUPLE_DEAD, /* tuple is dead and deletable */
HEAPTUPLE_LIVE, /* tuple is live (committed, no deleter) */
HEAPTUPLE_RECENTLY_DEAD, /* tuple is dead, but not deletable yet */
HEAPTUPLE_INSERT_IN_PROGRESS, /* inserting xact is still in progress */
HEAPTUPLE_DELETE_IN_PROGRESS /* deleting xact is still in progress */
} HTSV_Result;
/* These are the "satisfies" test routines for the various snapshot types */
extern bool HeapTupleSatisfiesMVCC(HeapTupleHeader tuple,
Snapshot snapshot, Buffer buffer);
extern bool HeapTupleSatisfiesNow(HeapTupleHeader tuple,
Snapshot snapshot, Buffer buffer);
extern bool HeapTupleSatisfiesSelf(HeapTupleHeader tuple,
Snapshot snapshot, Buffer buffer);
extern bool HeapTupleSatisfiesAny(HeapTupleHeader tuple,
Snapshot snapshot, Buffer buffer);
extern bool HeapTupleSatisfiesToast(HeapTupleHeader tuple,
Snapshot snapshot, Buffer buffer);
extern bool HeapTupleSatisfiesDirty(HeapTupleHeader tuple,
Snapshot snapshot, Buffer buffer);
/* Special "satisfies" routines with different APIs */
extern HTSU_Result HeapTupleSatisfiesUpdate(HeapTupleHeader tuple,
CommandId curcid, Buffer buffer);
extern HTSV_Result HeapTupleSatisfiesVacuum(HeapTupleHeader tuple,
TransactionId OldestXmin, Buffer buffer);
extern void HeapTupleSetHintBits(HeapTupleHeader tuple, Buffer buffer,
uint16 infomask, TransactionId xid);
#endif /* TQUAL_H */
|
//
// FujiCore.h
// Fuji
//
// Created by David Hart.
// Copyright (c) 2012 hart[dev]. All rights reserved.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the Simplified BSD License.
//
// Support
#import "FUSupport.h"
#import "FUColor.h"
#import "FUMath.h"
#import "FUAssert.h"
// Core
#import "FUSceneObject.h"
#import "FUVisitor.h"
#import "FUViewController.h"
#import "FUInterfaceRotating.h"
#import "FUEngine.h"
#import "FUEntity.h"
#import "FUScene.h"
#import "FUComponent.h"
#import "FUBehavior.h"
// Actions
#import "FUUpdateEngine.h"
#import "FUUpdatableComponent.h"
#import "FUAction.h"
#import "FUAnimator.h"
#import "FUSpawnAction.h"
#import "FUSequenceAction.h"
#import "FUSpeedAction.h"
#import "FUTimedAction.h"
#import "FUGroupAction.h"
#import "FUCallAction.h"
#import "FUTweenAction.h"
#import "FUTimingAction.h"
#import "FUTimingFunctions.h"
// Assets
#import "FUAssetStore.h"
// Graphics
#import "FUGraphicsEngine.h"
#import "FUGraphicsSettings.h"
#import "FUTransform.h"
#import "FURenderer.h"
#import "FUSpriteRenderer.h"
|
/* Copyright (c) 2005, Regents of Massachusetts Institute of Technology,
* Brandeis University, Brown University, and University of Massachusetts
* Boston. 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 Massachusetts Institute of Technology,
* Brandeis University, Brown University, or University of
* Massachusetts Boston 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 POSANDOPERATOR_H
#define POSANDOPERATOR_H
#include <cassert>
#include "../common/Interfaces.h"
#include "../Wrappers/PosRLEBlock.h"
#include "../Wrappers/PosBasicBlock.h"
#include "../Wrappers/PosType2Block.h"
/**
*
* PosAndOperator high-level pseudocode:
* Read in blocks using getNextPosBlock
*/
class PosAndOperator : public Operator {
public:
// CONSTRUCTORS
PosAndOperator(Operator *leftOp_, int leftColIndex_, Operator *rightOp_, int rightColIndex_);
virtual ~PosAndOperator();
// Operator interface
virtual Block* getNextValBlock(int val_);
virtual PosBlock* getNextPosBlock();
virtual PosBlock* getNextPosBlock(int val_);
inline virtual int getLastPosition() { throw UnimplementedException("Not applicable to PosAndOperator"); };
protected:
// INPUT STATE
Operator* leftOp;
int leftColIndex;
Operator* rightOp;
int rightColIndex;
PosBlock* inputBlockL;
PosBlock* inputBlockR;
//Block* inputVBlockR;
// OUTPUT STATE
PosBlock* m_BlockOut; // output block
//Block* m_VBlockOut; // output block
private:
int whatNext;
//postition holders
unsigned int prevPos;
unsigned int curPosL, curPosR;
bool fromL;
// initializes the PosAndOperator
void init();
};
#endif
|
//
// Copyright (c) 2009, Markus Rickert
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
#ifndef GRAPHICSVIEW_H
#define GRAPHICSVIEW_H
#include <QGraphicsView>
#include <QModelIndex>
class GraphicsView : public QGraphicsView
{
Q_OBJECT
public:
GraphicsView(QWidget* parent = nullptr);
virtual ~GraphicsView();
public slots:
void adjust();
void adjust(const QModelIndex&, const QModelIndex&);
protected:
virtual void resizeEvent(QResizeEvent* event);
private:
};
#endif // GRAPHICSVIEW_H
|
/*
* Monte Carlo simulation, Header File
*/
#ifndef __QDAMC_H__
#define __QDAMC_H__
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <assert.h>
#include <malloc.h>
#include "../qdamc_cli.h"
#include <CL/cl.h>
/* constants */
#define FLOAT_TOL 0.000001
#define DEFAULT_Q0 1.0 // is malloc'ed and applied to every element
/* macros */
#define filter(l,m,r) (.25f*l + .5f*m +.25*r)
#define floatEquals(a,b,tol) (fabs(a - b) < tol)
int NP; // Number of particles
pfloat sysLeng; // Length of system
int numCells; // Number of cells in system
pfloat tol; // Relative difference tolerance for convergence
pfloat tol_std; // Tolerance for standard deviation calculations
pfloat fig_upd; // TODO
int runningWidth; // Number of iterations to keep for averaging
/* data structures */
typedef struct {
int iter_avg; //iteration for averaging
afloat phi_left_tot; //tally for average phi
afloat phi_right_tot; //tally for average phi
afloat J_left_tot; //tally for average J
afloat J_right_tot; //tally for average J
afloat E_left_tot; //tally for average E
afloat E_right_tot; //tally for average E
pfloat phi_left_avg;
pfloat phi_right_avg;
pfloat phi_left_avg_old;
pfloat phi_right_avg_old;
pfloat J_left_avg;
pfloat J_right_avg;
pfloat E_left_avg;
pfloat E_right_avg;
} avedat;
typedef struct {
pfloat * a; //sub-diagonal
pfloat * b; //diagonal
pfloat * c; //super-diagonal
} triMat;
// using accumulation fp type
typedef struct {
afloat phi_left;
afloat J_left;
afloat E_left;
afloat phi_right;
afloat J_right;
afloat E_right;
afloat * phi_n;
afloat * phi_n2;
afloat * E_n;
void * buffer;
} colData;
typedef struct {
pfloat * x0;
pfloat * mu0;
pfloat * wx;
pfloat * xf;
int * cell0;
int * cellf;
} colData_additional;
typedef struct {
int lbc_NP;
pfloat * lbc_mu;
int * lbc_wp;
} lbcData;
typedef struct {
pfloat * xf;
int * cell0;
int * cellf;
} xmcData;
typedef struct {
pfloat mean;
pfloat stdDev;
} meanDev __attribute__ ((aligned (16)));
struct simData {
int NP;
int NPstep;
int steps;
pfloat lx;
int nx;
pfloat dx;
pfloat dx2; // cellsize^2
pfloat dx_recip;
pfloat sig_t;
pfloat sig_t_recip;
pfloat sig_s;
pfloat * q0;
pfloat Jp_l;
pfloat eps;
pfloat q0_lo;
pfloat D;
unsigned long NP_tot;
int NPc;
int lbc_flag;
} __attribute__ ((aligned (16)));
struct gpuData
{
cl_float sig_t;
cl_float dx;
};
struct oclData {
cl_context context;
cl_command_queue queue;
cl_platform_id * platforms;
cl_device_id * devices;
cl_program program;
cl_kernel warmup;
cl_kernel pGenerate;
cl_mem ranBuf;
cl_mem clData;
cl_mem clMu0;
cl_mem clX0;
cl_mem clXf;
int devID;
};
int run(int);
void calcStartEnd(int *, int *, int, int, int);
struct oclData oclInit(struct simData *, struct gpuData *);
void sim_param_print(struct simData);
void lo_solver(struct simData, pfloat, pfloat, pfloat, pfloat, pfloat, pfloat, pfloat *, int, pfloat*,triMat,pfloat*);
void triSolve(int, pfloat *, pfloat *, pfloat *, pfloat *, pfloat *);
pfloat absdistcalc(int, int, int, pfloat, pfloat, pfloat, int);
void f_filter(void *, void*, int, int, int, int *);
void mean_std_calc(afloat *, afloat *, unsigned long int, int, int, pfloat, meanDev*);
void gen_particles_and_tally(struct simData, pfloat*, colData*, int, int, float*, float*, float*);
void collision_and_tally(struct simData, pfloat*, colData*, int, int, int, int, int, int, float*, float*, float*);
int getDevID(char * desired, cl_device_id * devices, int numDevices);
#endif /* __QDAMC_H__ */
|
#ifndef ZXING_BIT_MATRIX_PARSER_PDF_H
#define ZXING_BIT_MATRIX_PARSER_PDF_H
/*
* BitMatrixParser.h / PDF417
* zxing
*
* Copyright 2010 ZXing 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.
*/
#include <zxing/ReaderException.h>
#include <zxing/FormatException.h>
#include <zxing/common/BitMatrix.h>
#include <zxing/common/Counted.h>
#include <zxing/common/Array.h>
#include <stdint.h>
namespace zxing {
namespace pdf417 {
namespace decoder {
class BitMatrixParser : public Counted {
private:
static const int MAX_ROWS;
// Maximum Codewords (Data + Error)
static const int MAX_CW_CAPACITY;
static const int MODULES_IN_SYMBOL;
Ref<BitMatrix> bitMatrix_;
int rows_; /* = 0 */
int leftColumnECData_; /* = 0 */
int rightColumnECData_; /* = 0 */
/* added 2012-06-22 HFN */
int aLeftColumnTriple_[3];
int aRightColumnTriple_[3];
int eraseCount_; /* = 0 */
ArrayRef<int> erasures_;
int ecLevel_; /* = -1 */
public:
static const int SYMBOL_TABLE[];
static const int SYMBOL_TABLE_LENGTH;
static const int CODEWORD_TABLE[];
public:
BitMatrixParser(Ref<BitMatrix> bitMatrix);
ArrayRef<int> getErasures() const {return erasures_;}
int getECLevel() const {return ecLevel_;}
int getEraseCount() const {return eraseCount_;}
ArrayRef<int> readCodewords(); /* throw(FormatException) */
static int getCodeword(int64_t symbol, int *pi = NULL);
private:
bool VerifyOuterColumns(int rownumber);
static ArrayRef<int> trimArray(ArrayRef<int> array, int size);
static int findCodewordIndex(int64_t symbol);
int processRow(int rowNumber,
ArrayRef<int> codewords, int next);
int processRow(ArrayRef<int> rowCounters, int rowNumber, int rowHeight,
ArrayRef<int> codewords, int next); /* throw(FormatException) */
protected:
bool IsEqual(int &a, int &b, int rownumber);
};
}
}
}
#endif // ZXING_BIT_MATRIX_PARSER_PDF_H
|
/*******************************************************************************
* utils.h - miscellaneous utility macros and functions
* Part of cuppa, the Common URY Playout Package Architecture
*
* Contributors: Matt Windsor <matt.windsor@ury.org.uk>
*/
/*-
* Copyright (c) 2012, University Radio York Computing Team
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CUPPA_UTILS_H
#define CUPPA_UTILS_H
/* Frees and NULLifies the pointer pointed to by *ptr, if it is currently NULL.
* Silently ignores the case of ptr being NULL itself.
*/
#define SAFE_FREE(ptr) do { \
if (ptr != NULL) \
if (*ptr != NULL) { \
free(*ptr); \
*ptr = NULL; \
} \
} while (0)
char *endof(char *str);
char *skip_space(char *str);
char *skip_nonspace(char *str);
char *nullify_space(char *str);
char *nullify_tspace(char *end);
#endif /* !CUPPA_UTILS_H */
|
/*
Copyright (c) 2007 SIEGE Development Team
All rights reserved.
This file is part of libSIEGE.
This software is copyrighted work licensed under the terms of the
2-clause BSD license. Please consult the file "license.txt" for
details.
If you did not recieve the file with this program, please email
Tim Chas <darkuranium@gmail.com>.
*/
#ifndef __SIEGE_PHYSICS_COLLISION_H__
#define __SIEGE_PHYSICS_COLLISION_H__
#include "../common.h"
#include "../module.h"
#include "../util/list.h"
#include "shape.h"
#ifdef __cplusplus
extern "C"
{
#endif // __cplusplus
typedef struct SGPhysicsCollision
{
void* handle;
SGPhysicsShape* shape1;
SGPhysicsShape* shape2;
} SGPhysicsCollision;
void SG_CALL _sg_cbPhysicsCollisionBegin(SGPhysicsShape* shape1, SGPhysicsShape* shape2, void* handle);
void SG_CALL _sg_cbPhysicsCollisionPreSolve(SGPhysicsShape* shape1, SGPhysicsShape* shape2, void* handle);
void SG_CALL _sg_cbPhysicsCollisionPostSolve(SGPhysicsShape* shape1, SGPhysicsShape* shape2, void* handle);
void SG_CALL _sg_cbPhysicsCollisionSeparate(SGPhysicsShape* shape1, SGPhysicsShape* shape2, void* handle);
void SG_CALL SG_FPTR(sgPhysicsCollisionIgnore)(SGPhysicsCollision* coll);
size_t SG_CALL SG_FPTR(sgPhysicsCollisionGetNumContacts)(SGPhysicsCollision* coll);
void SG_CALL SG_FPTR(sgPhysicsCollisionGetPoint)(SGPhysicsCollision* coll, size_t index, float* x, float* y);
void SG_CALL SG_FPTR(sgPhysicsCollisionGetNormal)(SGPhysicsCollision* coll, size_t index, float* x, float* y);
float SG_CALL SG_FPTR(sgPhysicsCollisionGetDepth)(SGPhysicsCollision* coll, size_t index);
void SG_CALL SG_FPTR(sgPhysicsCollisionGetImpulse)(SGPhysicsCollision* coll, float* x, float* y, SGbool friction);
SGPhysicsShape* SG_CALL SG_FPTR(sgPhysicsCollisionGetShapeOne)(SGPhysicsCollision* coll);
SGPhysicsShape* SG_CALL SG_FPTR(sgPhysicsCollisionGetShapeTwo)(SGPhysicsCollision* coll);
#ifdef __cplusplus
}
#endif // __cplusplus
#endif // __SIEGE_PHYSICS_COLLISION_H__
|
/*
| PC-LISP (C) 1984-1989 Peter J.Ashwood-Smith
*/
#include <stdio.h>
#include <math.h>
#include "lisp.h"
/*************************************************************************
** buminusp:(minusp number) Return t if number is less than zero. **
*************************************************************************/
struct conscell *buminusp(form)
struct conscell *form;
{ struct conscell *temp;
if ((form != NULL)&&(form->cdrp == NULL))
{ if ((temp = form->carp) != NULL)
{ if (temp->celltype == FIXATOM)
{ if (FIX(temp)->atom < 0L)
return(LIST(thold));
else
return(NULL);
};
if (temp->celltype == REALATOM)
{ if (REAL(temp)->atom < 0.0)
return(LIST(thold));
else
return(NULL);
};
};
};
ierror("minusp"); /* doesn't return */
return NULL; /* keep compiler happy */
}
|
#ifndef _DateFmtCtrl_DateFmtCtrl_h
#define _DateFmtCtrl_DateFmtCtrl_h
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
#define LAYOUTFILE <DateFmtCtrl/DateFmtCtrl.lay>
#include <CtrlCore/lay.h>
class DateFmtCtrl : public WithDateFmtCtrlLayout<TopWindow> {
public:
void Print();
void Language();
typedef DateFmtCtrl CLASSNAME;
DateFmtCtrl();
};
#endif
|
/* Copyright (c) 2005, Regents of Massachusetts Institute of Technology,
* Brandeis University, Brown University, and University of Massachusetts
* Boston. 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 Massachusetts Institute of Technology,
* Brandeis University, Brown University, or University of
* Massachusetts Boston 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.
*/
/*
* SProjectUnionNode.h
* cstore
*
* Created by Nga Tran on 6/22/05.
*
* Projection Node which has to use Union
*
* There will be 2 datasources for the projection which will be used to setPositionFilter
* for the joins and then union together
*/
#ifndef _SPROJECTUNIONNODE_H_
#define _SPROJECTUNIONNODE_H_
#include <string>
#include <list>
#include "../Node.h"
#include "../Nodes/SelectNode.h"
#include "../BNodes/BJoinNode.h"
#include "../Util/JoinOutputs.h"
#include "../PlanConstants.h"
#include "../../Operators/Union.h"
#include "../../Operators/Operator.h"
#include "../../common/DataSource.h"
#include "../../parser/Expressions/EColumn.h"
using namespace std;
class SProjectUnionNode: public Node
{
protected:
Node* m_lpJoin;
Node* m_lpSelect1; // m_lpSelect1 and m_lpSelect2 will produce datasources of the same column
Node* m_lpSelect2;
string m_sProjection; // Projection name of the column of m_lpSelect1 and m_lpSelect2
protected:
// Node's constructor is protected because they should not be new directly.
// A node can be new by using static "create" function
// This is for the purpose of memory management
SProjectUnionNode();
SProjectUnionNode(Node* lpJoin, EColumn* lpSelectionColumn);
public:
virtual ~SProjectUnionNode();
// Run ROS
Operator* runROS();
// Run WOS
Operator* runWOS();
// Merge ROS and WOS operators
Operator* mergeROSandWOS();
// show what operators this node will run
//void show(int* lpNodeID, ofstream* lpOfstream);
// show what ROS operators this node will run
void showROS(int* lpNodeID, ofstream* lpOfstream);
// show what WOS operators this node will run
void showWOS(int* lpNodeID, ofstream* lpOfstream);
// show merge operators
void showMerge(ofstream* lpOfstream);
// show tree presentation
void showTree(string sTabs);
//---------------------------------------------------------------
// Memory management functions
public:
// New a node and put it in the m_lpList
static SProjectUnionNode* create();
static SProjectUnionNode* create(Node* lpJoin, EColumn* lpSelectionColumn);
};
#endif //_SPROJECTUNIONNODE_H_
|
//
// Copyright (c) 2009, Markus Rickert
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
#ifndef RL_HAL_LEUZERS4_H
#define RL_HAL_LEUZERS4_H
#include <array>
#include <cstdint>
#include "CyclicDevice.h"
#include "Device.h"
#include "Lidar.h"
#include "Serial.h"
namespace rl
{
namespace hal
{
/**
* Leuze RS4 safety laser scanner.
*/
class RL_HAL_EXPORT LeuzeRs4 : public CyclicDevice, public Lidar
{
public:
enum class BaudRate
{
/** 4,800 bps. */
b4800,
/** 9,600 bps. */
b9600,
/** 19,200 bps. */
b19200,
/** 38,400 bps. */
b38400,
/** 57,600 bps. */
b57600,
/** 115,200 bps. */
b115200,
/** 345,600 bps. */
b345600,
/** 625,000 bps. */
b625000
};
RL_HAL_DEPRECATED static constexpr BaudRate BAUDRATE_4800BPS = BaudRate::b4800;
RL_HAL_DEPRECATED static constexpr BaudRate BAUDRATE_9600BPS = BaudRate::b9600;
RL_HAL_DEPRECATED static constexpr BaudRate BAUDRATE_19200BPS = BaudRate::b19200;
RL_HAL_DEPRECATED static constexpr BaudRate BAUDRATE_38400BPS = BaudRate::b38400;
RL_HAL_DEPRECATED static constexpr BaudRate BAUDRATE_57600BPS = BaudRate::b57600;
RL_HAL_DEPRECATED static constexpr BaudRate BAUDRATE_115200BPS = BaudRate::b115200;
RL_HAL_DEPRECATED static constexpr BaudRate BAUDRATE_345600BPS = BaudRate::b345600;
RL_HAL_DEPRECATED static constexpr BaudRate BAUDRATE_625000BPS = BaudRate::b625000;
/**
* @param[in] password String with 8 characters.
*/
LeuzeRs4(
const ::std::string& device = "/dev/ttyS0",
const BaudRate& baudRate = BaudRate::b57600,
const ::std::string& password = "ROD4LE"
);
virtual ~LeuzeRs4();
void close();
BaudRate getBaudRate() const;
void getDistances(::rl::math::Vector& distances) const;
::std::size_t getDistancesCount() const;
::rl::math::Real getDistancesMaximum(const ::std::size_t& i) const;
::rl::math::Real getDistancesMinimum(const ::std::size_t& i) const;
::rl::math::Real getResolution() const;
::rl::math::Real getStartAngle() const;
::rl::math::Real getStopAngle() const;
void open();
void reset();
#if 0
void setBaudRate(const BaudRate& baudRate);
void setOutputParameters(const ::std::uint16_t& startIndex, const ::std::uint16_t& stopIndex, const ::std::uint16_t& step, const ::std::uint16_t& type);
#endif
void start();
void step();
void stop();
protected:
private:
::std::uint8_t crc(const ::std::uint8_t* buf, const ::std::size_t& len) const;
const ::std::uint8_t& get(const ::std::uint8_t*& ptr) const;
::std::size_t recv(uint8_t* buf, const ::std::size_t& len);
void send(uint8_t* buf, const ::std::size_t& len);
void set(const ::std::uint8_t& value, ::std::uint8_t*& ptr, ::std::size_t& len) const;
BaudRate baudRate;
::std::array<::std::uint8_t, 1099> data;
BaudRate desired;
bool far1;
bool far2;
bool fn1Fn2;
bool near1;
bool near2;
::std::string password;
Serial serial;
::std::uint16_t startIndex;
::std::uint16_t stepSize;
::std::uint16_t stopIndex;
::std::uint16_t type;
};
}
}
#endif // RL_HAL_LEUZERS4_H
|
/*******************************************************************************
* Copyright (c) 2013, Patrick P. Putnam (putnampp@gmail.com)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those
* of the authors and should not be interpreted as representing official policies,
* either expressed or implied, of the FreeBSD Project.
******************************************************************************/
#ifndef CLOTHOOBJECT_H_
#define CLOTHOOBJECT_H_
#include "warped.h"
#include "SimulationObject.h"
#include <ostream>
using std::ostream;
typedef unsigned long objectid_t;
class ClothoObject : public SimulationObject {
public:
friend ostream & operator<<( ostream & out, const ClothoObject * co );
objectid_t getID() const;
void deallocateState( const State * state );
void reclaimEvent( const Event * event );
virtual void print( ostream & out ) const = 0;
virtual ~ClothoObject();
protected:
ClothoObject();
const objectid_t m_id;
private:
static objectid_t next_id;
};
#endif // CLOTHOOBJECT_H_
|
#pragma once
#include "stdafx.h"
#include "VirtualWifiCommandIn.h"
//¶ÔÖ÷½çÃæ·¢Ë͹ýÀ´µÄ×Ö·ûÁ÷½øÐзÖÎö
//½ÓÊÕ»º³åÇøÎªm_szcommand
class VirtualWifiAnalysis
{
private:
typedef VirtualWifiCommandIn::p_command_struct p_command_struct;
protected:
p_command_struct m_pcommandstruct;
bool get_config_bool_value(CONST_STR sz_c); //²ÎÊýΪCommand½á¹¹ÖеÄÊý¾Ý²¿·Ö
public:
void analysis();
void analysis(CONST_STR sz_c,int nrecv);
void analysis_flow(CONST_STR sz_c,int nrecv);
virtual void on_start_wifi()=0; //µ±½ÓÊÕµ½¿ªÆôÎÞÏßÍøÂçµÄÃüÁî
virtual void on_stop_wifi()=0; //µ±½ÓÊÕµ½¹Ø±ÕÎÞÏßÍøÂçµÄÃüÁî
virtual void on_config_autorun()=0; //µ±½ÓÊÕµ½µã»÷ÅäÖýçÃæ¿ª»úÆô¶¯Ïî
virtual void on_refresh_share_net()=0;
virtual void on_config_auto_start_wifi()=0;
virtual void on_config_eventballoontip()=0;
virtual void on_get_client_list()=0;
virtual void on_closebutton_down()=0;
virtual void on_config_provincememory()=0;
virtual void on_config_flow_monitor()=0;
virtual void on_flow_reset_pos()=0;
VirtualWifiAnalysis(void);
~VirtualWifiAnalysis(void);
};
|
#ifndef GNOME_GADU_UI_STATUS_H
#define GNOME_GADU_UI_STATUS_H 1
#include <glade/glade.h>
#include "gnomegadu_protocol.h"
GladeXML *gladexml_userlist_status_desc;
const gchar *gnomegadu_ui_status_get_icon_name(GnomeGaduProtocolStatus status);
#endif
|
/*************************************************************************************************\
LogisticsScreen.h : Interface for the LogisticsScreen component.
//---------------------------------------------------------------------------//
// Copyright (C) Microsoft Corporation. All rights reserved. //
//===========================================================================//
\*************************************************************************************************/
#pragma once
#ifndef LOGISTICSSCREEN_H
#define LOGISTICSSCREEN_H
#include "mechgui/asystem.h"
class FitIniFile;
namespace mechgui
{
class aObject;
class aRect;
class aText;
class aAnimButton;
class aButton;
class aEdit;
class aAnimObject;
} // namespace mechgui
namespace mechgui
{
/**************************************************************************************************
CLASS DESCRIPTION
LogisticsScreen:
**************************************************************************************************/
class LogisticsScreen : public aObject
{
enum Status
{
RUNNING = 0,
NEXT = 1,
PREVIOUS = 2,
DONE = 3,
PAUSED = 4,
UP,
DOWN,
YES,
NO,
MAINMENU,
RESTART,
MULTIPLAYERRESTART,
SKIPONENEXT,
SKIPONEPREVIOUS,
FADEDOWN,
FADEUP,
READYTOLOAD,
GOTOSPLASH
};
public:
LogisticsScreen(void);
virtual ~LogisticsScreen(void);
LogisticsScreen(const LogisticsScreen& src);
LogisticsScreen& operator=(const LogisticsScreen& src);
protected:
void init(FitIniFile& file, const std::wstring_view& staticName, const std::wstring_view& textName, const std::wstring_view& rectName, const std::wstring_view& buttonName,
const std::wstring_view& editName = "Edit", const std::wstring_view& animObjectName = "AnimObject", uint32_t neverFlush = 0);
virtual void update(void);
virtual void render(void);
virtual void begin(void);
virtual void end(void) {}
virtual void render(int32_t xOffset, int32_t yOffset);
int32_t getStatus(void);
aButton* getButton(int32_t who);
aRect* getRect(int32_t who);
virtual void moveTo(int32_t xPos, int32_t yPos);
virtual void move(int32_t xPos, int32_t yPos);
bool inside(int32_t x, int32_t y);
void beginFadeIn(float fNewTime)
{
fadeInTime = fNewTime;
fadeOutTime = fadeTime = 0.f;
}
void beginFadeOut(float fNewTime)
{
fadeInTime = 0.f;
fadeOutTime = fNewTime;
fadeTime = 0.f;
}
void clear(void); // remove everything
protected:
aObject* statics;
aRect* rects;
int32_t rectCount;
int32_t staticCount;
aText* textObjects;
int32_t textCount;
aAnimButton* buttons;
int32_t buttonCount;
aEdit* edits;
int32_t editCount;
aAnimObject* animObjects;
int32_t animObjectsCount;
float fadeInTime;
float fadeOutTime;
float fadeTime;
protected:
int32_t status;
int32_t fadeOutMaxcolour;
int32_t helpTextArrayID;
private:
void copyData(const LogisticsScreen&);
void destroy(void);
};
} // namespace mechgui
#endif // end of file ( LogisticsScreen.h )
|
// Copyright 2018-present 650 Industries. All rights reserved.
#import <ABI43_0_0ExpoModulesCore/ABI43_0_0EXExportedModule.h>
#import <ABI43_0_0ExpoModulesCore/ABI43_0_0EXEventEmitter.h>
#import <ABI43_0_0ExpoModulesCore/ABI43_0_0EXModuleRegistryConsumer.h>
#import <ABI43_0_0EXNotifications/ABI43_0_0EXPushTokenListener.h>
@interface ABI43_0_0EXPushTokenModule : ABI43_0_0EXExportedModule <ABI43_0_0EXEventEmitter, ABI43_0_0EXModuleRegistryConsumer, ABI43_0_0EXPushTokenListener>
@end
|
#ifndef THREADING_H
#define THREADING_H
#define THREAD_STACK_SIZE 0x80000
#define TIMER_HZ 32000
#define TIMER_LOAD_VALUE 1
int init_threading();
void cleanup_threading();
void wait_threads();
void run_thread(void(*thread_func)(unsigned, void*), void* userdata);
void thread_sleep(unsigned ms);
#endif |
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef QUICHE_QUIC_TEST_TOOLS_QUIC_CRYPTO_SERVER_CONFIG_PEER_H_
#define QUICHE_QUIC_TEST_TOOLS_QUIC_CRYPTO_SERVER_CONFIG_PEER_H_
#include "absl/strings/string_view.h"
#include "quic/core/crypto/quic_crypto_server_config.h"
namespace quic {
namespace test {
// Peer for accessing otherwise private members of a QuicCryptoServerConfig.
class QuicCryptoServerConfigPeer {
public:
explicit QuicCryptoServerConfigPeer(QuicCryptoServerConfig* server_config)
: server_config_(server_config) {}
// Returns the primary config.
quiche::QuicheReferenceCountedPointer<QuicCryptoServerConfig::Config>
GetPrimaryConfig();
// Returns the config associated with |config_id|.
quiche::QuicheReferenceCountedPointer<QuicCryptoServerConfig::Config>
GetConfig(std::string config_id);
// Returns a pointer to the ProofSource object.
ProofSource* GetProofSource() const;
// Reset the proof_source_ member.
void ResetProofSource(std::unique_ptr<ProofSource> proof_source);
// Generates a new valid source address token.
std::string NewSourceAddressToken(
std::string config_id,
SourceAddressTokens previous_tokens,
const QuicIpAddress& ip,
QuicRandom* rand,
QuicWallTime now,
CachedNetworkParameters* cached_network_params);
// Attempts to validate the tokens in |srct|.
HandshakeFailureReason ValidateSourceAddressTokens(
std::string config_id, absl::string_view srct, const QuicIpAddress& ip,
QuicWallTime now, CachedNetworkParameters* cached_network_params);
// Attempts to validate the single source address token in |token|.
HandshakeFailureReason ValidateSingleSourceAddressToken(
absl::string_view token,
const QuicIpAddress& ip,
QuicWallTime now);
// CheckConfigs compares the state of the Configs in |server_config_| to the
// description given as arguments.
// The first of each pair is the server config ID of a Config. The second is a
// boolean describing whether the config is the primary. For example:
// CheckConfigs(std::vector<std::pair<ServerConfigID, bool>>()); // checks
// that no Configs are loaded.
//
// // Checks that exactly three Configs are loaded with the given IDs and
// // status.
// CheckConfigs(
// {{"id1", false},
// {"id2", true},
// {"id3", false}});
void CheckConfigs(
std::vector<std::pair<ServerConfigID, bool>> expected_ids_and_status);
// ConfigsDebug returns a std::string that contains debugging information
// about the set of Configs loaded in |server_config_| and their status.
std::string ConfigsDebug()
QUIC_SHARED_LOCKS_REQUIRED(server_config_->configs_lock_);
void SelectNewPrimaryConfig(int seconds);
static std::string CompressChain(
QuicCompressedCertsCache* compressed_certs_cache,
const quiche::QuicheReferenceCountedPointer<ProofSource::Chain>& chain,
const std::string& client_cached_cert_hashes);
uint32_t source_address_token_future_secs();
uint32_t source_address_token_lifetime_secs();
private:
QuicCryptoServerConfig* server_config_;
};
} // namespace test
} // namespace quic
#endif // QUICHE_QUIC_TEST_TOOLS_QUIC_CRYPTO_SERVER_CONFIG_PEER_H_
|
#include "KMotionDef.h"
int CheckDoneFH(int ch)
{
return CheckDone(ch) && CS0_StoppingState==0;
}
main()
{
DefineCoordSystem(0,1,2,-1);
MoveRel(0,300000);
MoveRel(1,300000);
while (!CheckDoneFH(0) && !CheckDoneFH(1)) ;
printf("Done\n");
DefineCoordSystem(0,1,2,-1);
}
|
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_ACCELERATED_WIDGET_MAC_CA_TRANSACTION_OBSERVER_H_
#define UI_ACCELERATED_WIDGET_MAC_CA_TRANSACTION_OBSERVER_H_
#include <set>
#include "base/callback.h"
#include "base/macros.h"
#include "base/no_destructor.h"
#include "base/observer_list.h"
#include "base/time/time.h"
#include "ui/accelerated_widget_mac/accelerated_widget_mac_export.h"
namespace ui {
// CATransactionCoordinator is an interface to undocumented macOS APIs which
// run callbacks at different stages of committing a CATransaction to the
// window server. There is no guarantee that it will call registered observers
// at all.
//
// - Pre-commit: After all outstanding CATransactions have committed and after
// layout, but before the new layer tree has been sent to the window server.
// Safe to block here waiting for drawing/layout in other processes (but
// you're on the main thread, so be reasonable).
//
// - Post-commit: After the new layer tree has been sent to the server but
// before the transaction has been finalized. In post-commit, the screen area
// occupied by the window and its shadow are frozen, so it's important to
// block as briefly as possible (well under a frame) or else artifacts will
// be visible around affected windows if screen content is changing behind
// them (think resizing a browser window while a video plays in a second
// window behind it). This is a great place to call -[CATransaction commit]
// (or otherwise flush pending changes to the screen) in other processes,
// because their updates will appear atomically.
//
// It has been observed that committing a CATransaction in the GPU process
// which changes which IOSurfaces are assigned to layers' contents is *faster*
// if done during the browser's post-commit phase vs. its pre-commit phase.
class ACCELERATED_WIDGET_MAC_EXPORT CATransactionCoordinator {
public:
class PreCommitObserver {
public:
virtual bool ShouldWaitInPreCommit() = 0;
virtual base::TimeDelta PreCommitTimeout() = 0;
};
// PostCommitObserver sub-classes must communicate with the IO thread. The
// CATransactionCoordinator will retain registered observers to ensure that
// they are not deleted while registered.
class PostCommitObserver
: public base::RefCountedThreadSafe<PostCommitObserver> {
public:
virtual void OnActivateForTransaction() = 0;
virtual void OnEnterPostCommit() = 0;
virtual bool ShouldWaitInPostCommit() = 0;
protected:
virtual ~PostCommitObserver() {}
private:
friend class base::RefCountedThreadSafe<PostCommitObserver>;
};
static CATransactionCoordinator& Get();
CATransactionCoordinator(const CATransactionCoordinator&) = delete;
CATransactionCoordinator& operator=(const CATransactionCoordinator&) = delete;
void Synchronize();
void DisableForTesting() { disabled_for_testing_ = true; }
void AddPreCommitObserver(PreCommitObserver*);
void RemovePreCommitObserver(PreCommitObserver*);
void AddPostCommitObserver(scoped_refptr<PostCommitObserver>);
void RemovePostCommitObserver(scoped_refptr<PostCommitObserver>);
private:
friend class base::NoDestructor<CATransactionCoordinator>;
CATransactionCoordinator();
~CATransactionCoordinator();
void SynchronizeImpl();
void PreCommitHandler();
void PostCommitHandler();
bool active_ = false;
bool disabled_for_testing_ = false;
base::ObserverList<PreCommitObserver>::Unchecked pre_commit_observers_;
std::set<scoped_refptr<PostCommitObserver>> post_commit_observers_;
};
} // namespace ui
#endif // UI_ACCELERATED_WIDGET_MAC_CA_TRANSACTION_OBSERVER_H_
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE127_Buffer_Underread__malloc_char_cpy_34.c
Label Definition File: CWE127_Buffer_Underread__malloc.label.xml
Template File: sources-sink-34.tmpl.c
*/
/*
* @description
* CWE: 127 Buffer Under-read
* BadSource: Set data pointer to before the allocated memory buffer
* GoodSource: Set data pointer to the allocated memory buffer
* Sinks: cpy
* BadSink : Copy data to string using strcpy
* Flow Variant: 34 Data flow: use of a union containing two methods of accessing the same data (within the same function)
*
* */
#include "std_testcase.h"
#include <wchar.h>
typedef union
{
char * unionFirst;
char * unionSecond;
} CWE127_Buffer_Underread__malloc_char_cpy_34_unionType;
#ifndef OMITBAD
void CWE127_Buffer_Underread__malloc_char_cpy_34_bad()
{
char * data;
CWE127_Buffer_Underread__malloc_char_cpy_34_unionType myUnion;
data = NULL;
{
char * dataBuffer = (char *)malloc(100*sizeof(char));
if (dataBuffer == NULL) {exit(-1);}
memset(dataBuffer, 'A', 100-1);
dataBuffer[100-1] = '\0';
/* FLAW: Set data pointer to before the allocated memory buffer */
data = dataBuffer - 8;
}
myUnion.unionFirst = data;
{
char * data = myUnion.unionSecond;
{
char dest[100*2];
memset(dest, 'C', 100*2-1); /* fill with 'C's */
dest[100*2-1] = '\0'; /* null terminate */
/* POTENTIAL FLAW: Possibly copy from a memory location located before the source buffer */
strcpy(dest, data);
printLine(dest);
/* INCIDENTAL CWE-401: Memory Leak - data may not point to location
* returned by malloc() so can't safely call free() on it */
}
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B() uses the GoodSource with the BadSink */
static void goodG2B()
{
char * data;
CWE127_Buffer_Underread__malloc_char_cpy_34_unionType myUnion;
data = NULL;
{
char * dataBuffer = (char *)malloc(100*sizeof(char));
if (dataBuffer == NULL) {exit(-1);}
memset(dataBuffer, 'A', 100-1);
dataBuffer[100-1] = '\0';
/* FIX: Set data pointer to the allocated memory buffer */
data = dataBuffer;
}
myUnion.unionFirst = data;
{
char * data = myUnion.unionSecond;
{
char dest[100*2];
memset(dest, 'C', 100*2-1); /* fill with 'C's */
dest[100*2-1] = '\0'; /* null terminate */
/* POTENTIAL FLAW: Possibly copy from a memory location located before the source buffer */
strcpy(dest, data);
printLine(dest);
/* INCIDENTAL CWE-401: Memory Leak - data may not point to location
* returned by malloc() so can't safely call free() on it */
}
}
}
void CWE127_Buffer_Underread__malloc_char_cpy_34_good()
{
goodG2B();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
* its own for testing or for building a binary to use in testing binary
* analysis tools. It is not used when compiling all the testcases as one
* application, which is how source code analysis tools are tested.
*/
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE127_Buffer_Underread__malloc_char_cpy_34_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE127_Buffer_Underread__malloc_char_cpy_34_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE124_Buffer_Underwrite__malloc_wchar_t_memcpy_63a.c
Label Definition File: CWE124_Buffer_Underwrite__malloc.label.xml
Template File: sources-sink-63a.tmpl.c
*/
/*
* @description
* CWE: 124 Buffer Underwrite
* BadSource: Set data pointer to before the allocated memory buffer
* GoodSource: Set data pointer to the allocated memory buffer
* Sinks: memcpy
* BadSink : Copy string to data using memcpy
* Flow Variant: 63 Data flow: pointer to data passed from one function to another in different source files
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifndef OMITBAD
/* bad function declaration */
void CWE124_Buffer_Underwrite__malloc_wchar_t_memcpy_63b_badSink(wchar_t * * dataPtr);
void CWE124_Buffer_Underwrite__malloc_wchar_t_memcpy_63_bad()
{
wchar_t * data;
data = NULL;
{
wchar_t * dataBuffer = (wchar_t *)malloc(100*sizeof(wchar_t));
if (dataBuffer == NULL) {exit(-1);}
wmemset(dataBuffer, L'A', 100-1);
dataBuffer[100-1] = L'\0';
/* FLAW: Set data pointer to before the allocated memory buffer */
data = dataBuffer - 8;
}
CWE124_Buffer_Underwrite__malloc_wchar_t_memcpy_63b_badSink(&data);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void CWE124_Buffer_Underwrite__malloc_wchar_t_memcpy_63b_goodG2BSink(wchar_t * * data);
static void goodG2B()
{
wchar_t * data;
data = NULL;
{
wchar_t * dataBuffer = (wchar_t *)malloc(100*sizeof(wchar_t));
if (dataBuffer == NULL) {exit(-1);}
wmemset(dataBuffer, L'A', 100-1);
dataBuffer[100-1] = L'\0';
/* FIX: Set data pointer to the allocated memory buffer */
data = dataBuffer;
}
CWE124_Buffer_Underwrite__malloc_wchar_t_memcpy_63b_goodG2BSink(&data);
}
void CWE124_Buffer_Underwrite__malloc_wchar_t_memcpy_63_good()
{
goodG2B();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
* its own for testing or for building a binary to use in testing binary
* analysis tools. It is not used when compiling all the testcases as one
* application, which is how source code analysis tools are tested.
*/
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE124_Buffer_Underwrite__malloc_wchar_t_memcpy_63_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE124_Buffer_Underwrite__malloc_wchar_t_memcpy_63_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
//
// Copyright RIME Developers
// Distributed under the BSD License
//
// simplistic sentence-making
//
// 2011-10-06 GONG Chen <chen.sst@gmail.com>
//
#ifndef RIME_POET_H_
#define RIME_POET_H_
#include <rime/common.h>
#include <rime/translation.h>
#include <rime/gear/translator_commons.h>
#include <rime/gear/contextual_translation.h>
namespace rime {
using WordGraph = map<int, map<int, DictEntryList>>;
class Grammar;
class Language;
struct Line;
class Poet {
public:
// Line "less", used to compare composed line of the same input range.
using Compare = function<bool (const Line&, const Line&)>;
static bool CompareWeight(const Line& one, const Line& other);
static bool LeftAssociateCompare(const Line& one, const Line& other);
Poet(const Language* language, Config* config,
Compare compare = CompareWeight);
~Poet();
an<Sentence> MakeSentence(const WordGraph& graph,
size_t total_length,
const string& preceding_text);
template <class TranslatorT>
an<Translation> ContextualWeighted(an<Translation> translation,
const string& input,
size_t start,
TranslatorT* translator) {
if (!translator->contextual_suggestions() || !grammar_) {
return translation;
}
auto preceding_text = translator->GetPrecedingText(start);
if (preceding_text.empty()) {
return translation;
}
return New<ContextualTranslation>(
translation, input, preceding_text, grammar_.get());
}
private:
template <class Strategy>
an<Sentence> MakeSentenceWithStrategy(const WordGraph& graph,
size_t total_length,
const string& preceding_text);
const Language* language_;
the<Grammar> grammar_;
Compare compare_;
};
} // namespace rime
#endif // RIME_POET_H_
|
// -*- C++ -*-
#ifndef _writer_writer_h_
#define _writer_writer_h_
#include "iroha/writer_api.h"
namespace iroha {
namespace writer {
class Writer : public WriterAPI {
public:
Writer(const IDesign *design);
virtual bool Write(const string &fn) override;
virtual bool SetLanguage(const string &lang) override;
virtual void OutputShellModule(bool b, bool self_contained,
bool vcd) override;
virtual void SetOutputConfig(const string &root,
const string &flavor,
const string &marker,
bool debug) override;
// For debug dump.
static void WriteDumpHeader(ostream &os);
static void WriteDumpFooter(ostream &os);
static void DumpTable(const ITable *table, ostream &os);
private:
static string ShellModuleName(const string &fn);
const IDesign *design_;
string language_;
bool output_shell_module_;
bool output_self_contained_;
bool output_vcd_;
string output_marker_;
string flavor_;
bool debug_;
string root_dir_;
};
} // namespace writer
} // namespace iroha
#endif // _writer_writer_h_
|
//
// ROKOInstaBotFontScheme.h
// ROKOMobi
//
// Created by Alexander Zakatnov on 31/08/2017.
// Copyright © 2017 ROKO Labs. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "IBScheme.h"
#import "IBUISchemeEnums.h"
@interface IBConversationFontScheme : IBScheme
@property (nullable, nonatomic, strong) NSString* family;
@property (nullable, nonatomic, strong) NSString* color;
@property (nullable, nonatomic, strong) NSNumber* size;
@property (assign, nonatomic) IBFontStyle style;
@end
|
/*=========================================================================
Program: Visualization Toolkit
Module: vtkTypedArray.h
-------------------------------------------------------------------------
Copyright 2008 Sandia Corporation.
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
the U.S. Government retains certain rights in this software.
-------------------------------------------------------------------------
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 vtkTypedArray - Provides a type-specific interface to N-way arrays
//
// .SECTION Description
// vtkTypedArray provides an interface for retrieving and updating data in an
// arbitrary-dimension array. It derives from vtkArray and is templated on the
// type of value stored in the array.
//
// Methods are provided for retrieving and updating array values based either
// on their array coordinates, or on a 1-dimensional integer index. The latter
// approach can be used to iterate over the values in an array in arbitrary order,
// which is useful when writing filters that operate efficiently on sparse arrays
// and arrays that can have any number of dimensions.
//
// Special overloaded methods provide simple access for arrays with one, two, or
// three dimensions.
//
// .SECTION See Also
// vtkArray, vtkDenseArray, vtkSparseArray
//
// .SECTION Thanks
// Developed by Timothy M. Shead (tshead@sandia.gov) at Sandia National Laboratories.
#ifndef vtkTypedArray_h
#define vtkTypedArray_h
#include "vtkArray.h"
class vtkArrayCoordinates;
template<typename T>
class vtkTypedArray : public vtkArray
{
public:
vtkTemplateTypeMacro(vtkTypedArray<T>, vtkArray)
typedef typename vtkArray::CoordinateT CoordinateT;
typedef typename vtkArray::SizeT SizeT;
using vtkArray::GetVariantValue;
using vtkArray::SetVariantValue;
void PrintSelf(ostream &os, vtkIndent indent);
// vtkArray API
virtual vtkVariant GetVariantValue(const vtkArrayCoordinates& coordinates);
virtual vtkVariant GetVariantValueN(const SizeT n);
virtual void SetVariantValue(const vtkArrayCoordinates& coordinates, const vtkVariant& value);
virtual void SetVariantValueN(const SizeT n, const vtkVariant& value);
virtual void CopyValue(vtkArray* source, const vtkArrayCoordinates& source_coordinates, const vtkArrayCoordinates& target_coordinates);
virtual void CopyValue(vtkArray* source, const SizeT source_index, const vtkArrayCoordinates& target_coordinates);
virtual void CopyValue(vtkArray* source, const vtkArrayCoordinates& source_coordinates, const SizeT target_index);
// Description:
// Returns the value stored in the array at the given coordinates.
// Note that the number of dimensions in the supplied coordinates must
// match the number of dimensions in the array.
virtual const T& GetValue(CoordinateT i) = 0;
virtual const T& GetValue(CoordinateT i, CoordinateT j) = 0;
virtual const T& GetValue(CoordinateT i, CoordinateT j, CoordinateT k) = 0;
virtual const T& GetValue(const vtkArrayCoordinates& coordinates) = 0;
// Description:
// Returns the n-th value stored in the array, where n is in the
// range [0, GetNonNullSize()). This is useful for efficiently
// visiting every value in the array. Note that the order in which
// values are visited is undefined, but is guaranteed to match the
// order used by vtkArray::GetCoordinatesN().
virtual const T& GetValueN(const SizeT n) = 0;
// Description:
// Overwrites the value stored in the array at the given coordinates.
// Note that the number of dimensions in the supplied coordinates must
// match the number of dimensions in the array.
virtual void SetValue(CoordinateT i, const T& value) = 0;
virtual void SetValue(CoordinateT i, CoordinateT j, const T& value) = 0;
virtual void SetValue(CoordinateT i, CoordinateT j, CoordinateT k, const T& value) = 0;
virtual void SetValue(const vtkArrayCoordinates& coordinates, const T& value) = 0;
// Description:
// Overwrites the n-th value stored in the array, where n is in the
// range [0, GetNonNullSize()). This is useful for efficiently
// visiting every value in the array. Note that the order in which
// values are visited is undefined, but is guaranteed to match the
// order used by vtkArray::GetCoordinatesN().
virtual void SetValueN(const SizeT n, const T& value) = 0;
protected:
vtkTypedArray() {}
~vtkTypedArray() {}
private:
vtkTypedArray(const vtkTypedArray&) VTK_DELETE_FUNCTION;
void operator=(const vtkTypedArray&) VTK_DELETE_FUNCTION;
};
#include "vtkTypedArray.txx"
#endif
// VTK-HeaderTest-Exclude: vtkTypedArray.h
|
#ifndef _SVG_COLORS_H_
#define _SVG_COLORS_H_
#include <GraphicsDefs.h>
#include <String.h>
#include "SVGDefs.h"
fill_t HandleAttributeValue(const BString *value, target_t target, in_state_s current_state, rgb_color &color, BString &gradient);
bool GetColorFromString(const BString *value, rgb_color &result);
bool ExtractGradientName(const BString *value, BString &result);
#endif |
/* Copyright (c) 1990 by Carrick Sean Casey. */
/* For copying and distribution information, see the file COPYING. */
#include <config.h>
#include "../protocol.h"
#ifdef HAVE_TCL_H
#include <tcl.h>
#endif
#ifdef HAVE_TCL8_0_TCL_H
#include <tcl8.0/tcl.h>
#endif
#ifdef HAVE_TCL8_1_TCL_H
#include <tcl8.1/tcl.h>
#endif
#ifdef HAVE_TCL8_2_TCL_H
#include <tcl8.2/tcl.h>
#endif
#ifdef HAVE_TCL8_3_TCL_H
#include <tcl8.3/tcl.h>
#endif
#ifdef HAVE_TCL8_4_TCL_H
#include <tcl8.4/tcl.h>
#endif
#ifdef HAVE_TCL8_5_TCL_H
#include <tcl8.5/tcl.h>
#endif
#include <stdio.h>
#include <sys/param.h>
#include "color.h"
#ifdef NEED_CTYPE
#include <ctype.h>
#endif
// char *malloc();
/* command usage information */
typedef struct Usage {
char name[9];
char type;
char args[128];
char usage[128];
struct Usage *prev, *next;
} USAGE;
/* special global variables */
typedef struct {
char cmdchar; /* character to prefix a command */
int verifyquit; /* verify a quit always */
int pauseonshell; /* make user hit ret on shell return */
int interactive; /* nonzero if interactive session */
int pagesize; /* lines per page */
int phistory; /* */
int bufferlines; /* lines in the review buffer */
int groupblanks; /* print a blank before each group */
char *logfile; /* name of session log file */
int restricted; /* nonzero if in restricted mode */
char *timedisplay; /* how time is displayed */
int beeps; /* whether beeps are audible */
char *editmode; /* input editing mode */
int tabreply; /* should replies go into the tab history? */
int cute; /* cute messages when a blank line is entered */
int autodel; /* automatically delete nicks from the tab
history that produce a "not logged on" error */
char *personalto; /* 'permanent' personal message recipient */
int logreplay; /* should replays go into the log by default? */
char *alert; /* alert mode */
int autoregister; /* prompt for password when [=Register=] msg
received? */
char *idle;
int reusepvalue; /* toggles use of saved DH p value */
} GLOBS;
/* info on the user's tty */
typedef struct {
char erase; /* tty erase char */
char kill; /* tty kill char */
char redraw; /* tty reprint line char */
char werase; /* tty word erase char */
int rows; /* tty word erase char */
int cols; /* tty word erase char */
} TTYINFO;
/* a linked list of strings */
typedef struct Strlist {
struct Strlist *next, *prev;
char str[1];
} STRLIST;
/* misc */
#define CMDCHAR '/' /* default char for prefixing commands */
#define PROMPTKAR '>'
#define PERMCMDCHAR '\\' /* like above, but can't be changed */
#define GICB_DEFAULT_NOIDLE "She blinded me with science."
/* putline flags */
#define PL_SCR 01 /* text may go to screen */
#define PL_LOG 02 /* text may go to session log */
#define PL_BUF 04 /* text may go to review buffer */
#define PL_GLOG 010
#define PL_SL (PL_SCR|PL_LOG)
#define PL_ALL (PL_SCR|PL_LOG|PL_BUF)
/* useful defs for modules using TCL code */
#define TARGLIST clientData, interp, argc, argv
#define TARGDEFS char *clientData; Tcl_Interp *interp; int argc; char *argv[];
#define TRET interp->result
#define TRETURNERR(x) { if (TRET) { strcpy(TRET, (x)); } return(TCL_ERROR); }
/* include function prototypes if ANSI compiler */
/* otherwise, include file that shows return type for each function */
#if defined __STDC__ || defined __GNUC__
#include "protos.h"
#else
#include "funcs.h"
#endif
#define MAX_HOSTLEN 256
#define MAX_PASSLEN 256
#define PERSONALSL ".icbservrc"
struct server
{
char name[MAX_HOSTLEN], host[MAX_HOSTLEN];
int port;
};
|
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import "ABI10_0_0RCTEventEmitter.h"
@interface ABI10_0_0RCTAppState : ABI10_0_0RCTEventEmitter
@end
|
// 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_TEST_WEBRTC_AUDIO_DEVICE_TEST_H_
#define CONTENT_TEST_WEBRTC_AUDIO_DEVICE_TEST_H_
#pragma once
#include <string>
#include "base/file_path.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop.h"
#include "content/browser/renderer_host/media/mock_media_observer.h"
#include "content/renderer/mock_content_renderer_client.h"
#include "ipc/ipc_channel.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/webrtc/common_types.h"
class AudioInputRendererHost;
class AudioManager;
class AudioRendererHost;
class RenderThreadImpl;
class WebRTCMockRenderProcess;
namespace base {
namespace win {
class ScopedCOMInitializer;
}
}
namespace content {
class ContentRendererClient;
class ResourceContext;
class TestBrowserThread;
}
namespace media_stream {
class MediaStreamManager;
}
namespace net {
class URLRequestContext;
}
namespace webrtc {
class VoENetwork;
}
// Scoped class for WebRTC interfaces. Fetches the wrapped interface
// in the constructor via WebRTC's GetInterface mechanism and then releases
// the reference in the destructor.
template<typename T>
class ScopedWebRTCPtr {
public:
template<typename Engine>
explicit ScopedWebRTCPtr(Engine* e)
: ptr_(T::GetInterface(e)) {}
explicit ScopedWebRTCPtr(T* p) : ptr_(p) {}
~ScopedWebRTCPtr() { reset(); }
T* operator->() const { return ptr_; }
T* get() const { return ptr_; }
// Releases the current pointer.
void reset() {
if (ptr_) {
ptr_->Release();
ptr_ = NULL;
}
}
bool valid() const { return ptr_ != NULL; }
private:
T* ptr_;
};
// Wrapper to automatically calling T::Delete in the destructor.
// This is useful for some WebRTC objects that have their own Create/Delete
// methods and we can't use our our scoped_* classes.
template <typename T>
class WebRTCAutoDelete {
public:
WebRTCAutoDelete() : ptr_(NULL) {}
explicit WebRTCAutoDelete(T* ptr) : ptr_(ptr) {}
~WebRTCAutoDelete() { reset(); }
void reset() {
if (ptr_) {
T::Delete(ptr_);
ptr_ = NULL;
}
}
T* operator->() { return ptr_; }
T* get() const { return ptr_; }
bool valid() const { return ptr_ != NULL; }
protected:
T* ptr_;
};
// Individual tests can provide an implementation (or mock) of this interface
// when the audio code queries for hardware capabilities on the IO thread.
class AudioUtilInterface {
public:
virtual ~AudioUtilInterface() {}
virtual double GetAudioHardwareSampleRate() = 0;
virtual double GetAudioInputHardwareSampleRate() = 0;
virtual uint32 GetAudioInputHardwareChannelCount() = 0;
};
// Implemented and defined in the cc file.
class ReplaceContentClientRenderer;
class WebRTCAudioDeviceTest
: public ::testing::Test,
public IPC::Channel::Listener {
public:
WebRTCAudioDeviceTest();
virtual ~WebRTCAudioDeviceTest();
virtual void SetUp() OVERRIDE;
virtual void TearDown() OVERRIDE;
// Sends an IPC message to the IO thread channel.
bool Send(IPC::Message* message);
void SetAudioUtilCallback(AudioUtilInterface* callback);
protected:
void InitializeIOThread(const char* thread_name);
void UninitializeIOThread();
void CreateChannel(const char* name);
void DestroyChannel();
void OnGetHardwareSampleRate(double* sample_rate);
void OnGetHardwareInputSampleRate(double* sample_rate);
void OnGetHardwareInputChannelCount(uint32* channels);
// IPC::Channel::Listener implementation.
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
// Posts a final task to the IO message loop and waits for completion.
void WaitForIOThreadCompletion();
void WaitForAudioManagerCompletion();
void WaitForMessageLoopCompletion(base::MessageLoopProxy* loop);
// Convenience getter for gmock.
MockMediaObserver& media_observer() const {
return *media_observer_.get();
}
std::string GetTestDataPath(const FilePath::StringType& file_name);
scoped_ptr<ReplaceContentClientRenderer> saved_content_renderer_;
MessageLoopForUI message_loop_;
content::MockContentRendererClient mock_content_renderer_client_;
RenderThreadImpl* render_thread_; // Owned by mock_process_.
scoped_ptr<WebRTCMockRenderProcess> mock_process_;
scoped_ptr<MockMediaObserver> media_observer_;
scoped_ptr<media_stream::MediaStreamManager> media_stream_manager_;
scoped_refptr<AudioManager> audio_manager_;
scoped_ptr<content::ResourceContext> resource_context_;
scoped_refptr<net::URLRequestContext> test_request_context_;
scoped_ptr<IPC::Channel> channel_;
scoped_refptr<AudioRendererHost> audio_render_host_;
scoped_refptr<AudioInputRendererHost> audio_input_renderer_host_;
AudioUtilInterface* audio_util_callback_; // Weak reference.
// Initialized on the main test thread that we mark as the UI thread.
scoped_ptr<content::TestBrowserThread> ui_thread_;
// Initialized on our IO thread to satisfy BrowserThread::IO checks.
scoped_ptr<content::TestBrowserThread> io_thread_;
// COM initialization on the IO thread for Windows.
scoped_ptr<base::win::ScopedCOMInitializer> initialize_com_;
};
// A very basic implementation of webrtc::Transport that acts as a transport
// but just forwards all calls to a local webrtc::VoENetwork implementation.
// Ownership of the VoENetwork object lies outside the class.
class WebRTCTransportImpl : public webrtc::Transport {
public:
explicit WebRTCTransportImpl(webrtc::VoENetwork* network);
virtual ~WebRTCTransportImpl();
virtual int SendPacket(int channel, const void* data, int len) OVERRIDE;
virtual int SendRTCPPacket(int channel, const void* data, int len) OVERRIDE;
private:
webrtc::VoENetwork* network_;
};
#endif // CONTENT_TEST_WEBRTC_AUDIO_DEVICE_TEST_H_
|
/* $Source: /var/local/cvs/gasnet/gm-conduit/gasnet_core.h,v $
* $Date: 2010/08/08 07:55:32 $
* $Revision: 1.29 $
* Description: GASNet GM conduit Implementation
* Copyright 2002, Christian Bell <csbell@cs.berkeley.edu>
* Copyright 2002, Dan Bonachea <bonachea@cs.berkeley.edu>
* Terms of use are as specified in license.txt
*/
#ifndef _IN_GASNET_H
#error This file is not meant to be included directly- clients should include gasnet.h
#endif
#ifndef _GASNET_CORE_H
#define _GASNET_CORE_H
#include <gasnet_core_help.h>
GASNETI_BEGIN_EXTERNC
/* ------------------------------------------------------------------------------------ */
/*
Initialization
==============
*/
/* gasnet_init not inlined or renamed because we use redef-name trick on
it to ensure proper version linkage */
extern int gasnet_init(int *argc, char ***argv);
extern int gasnetc_attach(gasnet_handlerentry_t *table, int numentries,
uintptr_t segsize, uintptr_t minheapoffset);
#define gasnet_attach gasnetc_attach
extern void gasnetc_exit(int exitcode) GASNETI_NORETURN;
#define gasnet_exit gasnetc_exit
/* ------------------------------------------------------------------------------------ */
/*
No-interrupt sections
=====================
*/
/* conduit may or may not need this based on whether interrupts are used for running handlers */
#if GASNETC_USE_INTERRUPTS
extern void gasnetc_hold_interrupts(void);
extern void gasnetc_resume_interrupts(void);
#define gasnet_hold_interrupts gasnetc_hold_interrupts
#define gasnet_resume_interrupts gasnetc_resume_interrupts
#else
#define gasnet_hold_interrupts()
#define gasnet_resume_interrupts()
#endif
/* ------------------------------------------------------------------------------------ */
/*
Handler-safe locks
==================
*/
typedef struct _gasnet_hsl_t {
gasneti_mutex_t lock;
#if GASNETI_STATS_OR_TRACE
gasneti_tick_t acquiretime;
#endif
#if GASNETC_USE_INTERRUPTS
/* more state may be required for conduits using interrupts */
#error interrupts not implemented
#endif
} gasnet_hsl_t GASNETI_THREAD_TYPEDEF;
#if GASNETI_STATS_OR_TRACE
#define GASNETC_LOCK_STAT_INIT ,0
#else
#define GASNETC_LOCK_STAT_INIT
#endif
#if GASNETC_USE_INTERRUPTS
#error interrupts not implemented
#define GASNETC_LOCK_INTERRUPT_INIT
#else
#define GASNETC_LOCK_INTERRUPT_INIT
#endif
#define GASNET_HSL_INITIALIZER { \
GASNETI_MUTEX_INITIALIZER \
GASNETC_LOCK_STAT_INIT \
GASNETC_LOCK_INTERRUPT_INIT \
}
/* decide whether we have "real" HSL's */
#if GASNETI_THREADS || GASNETC_USE_INTERRUPTS || /* need for safety */ \
GASNET_DEBUG || GASNETI_STATS_OR_TRACE /* or debug/tracing */
#ifdef GASNETC_NULL_HSL
#error bad defn of GASNETC_NULL_HSL
#endif
#else
#define GASNETC_NULL_HSL 1
#endif
#if GASNETC_NULL_HSL
/* HSL's unnecessary - compile away to nothing */
#define gasnet_hsl_init(hsl)
#define gasnet_hsl_destroy(hsl)
#define gasnet_hsl_lock(hsl)
#define gasnet_hsl_unlock(hsl)
#define gasnet_hsl_trylock(hsl) GASNET_OK
#else
extern void gasnetc_hsl_init (gasnet_hsl_t *hsl);
extern void gasnetc_hsl_destroy(gasnet_hsl_t *hsl);
extern void gasnetc_hsl_lock (gasnet_hsl_t *hsl);
extern void gasnetc_hsl_unlock (gasnet_hsl_t *hsl);
extern int gasnetc_hsl_trylock(gasnet_hsl_t *hsl) GASNETI_WARN_UNUSED_RESULT;
#define gasnet_hsl_init gasnetc_hsl_init
#define gasnet_hsl_destroy gasnetc_hsl_destroy
#define gasnet_hsl_lock gasnetc_hsl_lock
#define gasnet_hsl_unlock gasnetc_hsl_unlock
#define gasnet_hsl_trylock gasnetc_hsl_trylock
#endif
/* ------------------------------------------------------------------------------------ */
/*
Active Message Size Limits
==========================
*/
#define gasnet_AMMaxArgs() ((size_t) GASNETC_AM_MAX_ARGS)
#define gasnet_AMMaxMedium() ((size_t) GASNETC_AM_MEDIUM_MAX)
#define gasnet_AMMaxLongRequest() ((size_t) GASNETC_AM_LONG_REQUEST_MAX)
#define gasnet_AMMaxLongReply() ((size_t) GASNETC_AM_LONG_REPLY_MAX)
/* ------------------------------------------------------------------------------------ */
/*
Misc. Active Message Functions
==============================
*/
extern int gasnetc_AMGetMsgSource(gasnet_token_t token, gasnet_node_t *srcindex);
extern int gasnetc_AMPoll(void);
#define gasnet_AMGetMsgSource gasnetc_AMGetMsgSource
#define GASNET_BLOCKUNTIL(cond) gasneti_polluntil(cond)
/* ------------------------------------------------------------------------------------ */
GASNETI_END_EXTERNC
#endif
#include <gasnet_ammacros.h>
|
/*
BLIS
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2014, The University of Texas
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of The University of Texas nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "bli_packm_cntl.h"
#include "bli_packm_check.h"
#include "bli_packm_init.h"
#include "bli_packm_int.h"
#include "bli_packm_part.h"
#include "bli_packm_unb_var1.h"
#include "bli_packm_blk_var2.h"
#include "bli_packm_blk_var3.h"
#include "bli_packm_cxk.h"
|
// Copyright © 2021 650 Industries. All rights reserved.
#import <ABI42_0_0EXUpdates/ABI42_0_0EXUpdatesLoaderSelectionPolicy.h>
NS_ASSUME_NONNULL_BEGIN
/**
* An ABI42_0_0EXUpdatesLoaderSelectionPolicy which decides whether or not to load an update, taking filters into
* account. Returns true (should load the update) if we don't have an existing newer update that
* matches the given manifest filters.
*/
@interface ABI42_0_0EXUpdatesLoaderSelectionPolicyFilterAware : NSObject <ABI42_0_0EXUpdatesLoaderSelectionPolicy>
@end
NS_ASSUME_NONNULL_END
|
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include <fs.h>
#ifdef FS
extern fsystem fsd;
extern filedesc oft[NUM_FD];
int fopen(char *path, int flags)
{
if (!fs_initialized())
{
printf("fopen: file system is not initialized. use mkfs().\n");
return SYSERR;
}
int fd;
for (fd = 0; fd < NUM_FD; fd++)
if (oft[fd].state == O_CLOSED)
break;
if (fd >= NUM_FD)
{
printf("fopen: Can't open file, reached file descriptor limit (%d). "
"Close some files first.\n", NUM_FD);
return SYSERR;
}
directory parent_dir;
if (get_parent_directory(&fsd.root_dir, path, &parent_dir) == SYSERR)
{
printf("fopen: Can't get parent directory of %s\n.", path);
return SYSERR;
}
// now that we have parent directory, drop slashes and search the file in
// directory
char *filename = strrchr(path, '/');
if (filename == NULL)
filename = path;
else
filename++; // skip '/'
inode file_inode;
if (get_file_inode(&parent_dir, filename, &file_inode, INODE_TYPE_FILE) == SYSERR)
{
printf("fopen: Can't get file inode: %s\n", filename);
return SYSERR;
}
// Make sure the file is not already open
int i;
for (i = 0; i < NUM_FD; i++)
if (oft[i].state != O_CLOSED && oft[i].in.inode_idx == file_inode.inode_idx)
{
printf("fopen: Can't open the file, it is already open.\n");
return SYSERR;
}
oft[fd].in = file_inode;
oft[fd].state = flags;
oft[fd].cursor = 0;
return fd;
}
#endif /* FS */
|
#ifndef QuietModemKitPrivate_h
#define QuietModemKitPrivate_h
#import "QMFrameReceiver.h"
#import "QMNetworkInterfaceConfig.h"
#import "QMReceiverConfig.h"
#import "QMSocket.h"
#import "QMSocketAddress.h"
#import "QMTransmitterConfig.h"
#include "quiet.h"
@interface QMTransmitterConfig ()
@property quiet_encoder_options *opt;
@end
@interface QMReceiverConfig ()
@property quiet_decoder_options *opt;
@end
@interface QMFrameReceiver ()
- (void)onReceive:(NSData *)frame;
@end
@interface QMNetworkInterfaceConfig ()
@property(copy) QMTransmitterConfig *txConf;
@property(copy) QMReceiverConfig *rxConf;
@end
@interface QMSocketAddress ()
@property uint32_t ip;
@property NSUInteger port;
@end
@interface QMSocket ()
@property int lwip_fd;
+ (void)updateLastError;
@end
#endif /* QuietModemKitPrivate_h */
|
// build configuration options
// uncomment/comment to enable/disable support for a device,
// radio, or interface
#include "build_opts.h"
/* By default all devices and interfaces are defined in
src/lib/include/build_opts.h. You can check this file for
the list of possible build options.
To disable a build option, use #undef
Example:
#undef MICA2_ACCEL
#undef CC2420
#undef MAXSTREAM
will disable the accelerometer, the cc2420 radio, and the maxstream
radio drivers.
An exception is changing CC1000 from CSMA to another protocol, where
another must be defined. Ex:
#undef CC1000_CSMA
#define CC1000_TDMA
*/
#undef AVR_RSSI
#undef MICA2_ACCEL
#undef MICA2_BATTERY
#undef MICA2_HUMIDITY
#undef MICA2_ID
#undef MICA2_LIGHT_TEMP
#undef MICA2_MAGNET
#undef MICA2_MIC
#undef MICA2_SOUNDER
#undef MICA2_ULTRASOUND
#undef MICA2_GPS
#undef LOOPBACK
#undef CC1000
#undef CC1000_CSMA
// #undef CC2420
#undef MAXSTREAM
#undef XMOS_RADIO
#define CC2420
#define GET_RSSI
#define CTP_PLUS
#define KEEP_CTP_HEADER
#define CTP_PLUS_DATA_DEBUG
#define CTP_PLUS_ROUTING_DEBUG
// #define CTP_PLUS_DEBUGt
// #define CTP_PLUS_DEBUGa
// #define CTP_PLUS_DEBUG
#define TRANSPORT_DEBUG
#define CROSS_LAYER
#define ENABLE_AUTOACK
#define ENABLE_RETRANSMIT
#define PAR_SENSOR_ENABLE
// For i2c driver:
#define USE_MUTEX
// #define NEED_RAW_MODE
|
/*
* Copyright 2010 The Native Client Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can
* be found in the LICENSE file.
*/
#ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_URL_RESPONSE_INFO_H_
#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_URL_RESPONSE_INFO_H_
#include "native_client/src/include/nacl_macros.h"
#include "ppapi/c/ppb_url_response_info.h"
namespace ppapi_proxy {
// Implements the plugin (i.e., .nexe) side of the PPB_URLResponseInfo
// interface.
class PluginURLResponseInfo {
public:
static const PPB_URLResponseInfo* GetInterface();
private:
NACL_DISALLOW_COPY_AND_ASSIGN(PluginURLResponseInfo);
};
} // namespace ppapi_proxy
#endif // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_URL_RESPONSE_INFO_H_
|
/*
* utils.c
*/
#include "utils.h"
/*
* bin2hexstring(): convert binary input into a string of hex digits.
* Caller needs to free returned memory.
*/
char *bin2hexstring(const uint8_t *data, size_t length)
{
size_t k;
char *outstring, *p;
outstring = (char *) malloc(2 *length + 1);
p = outstring;
for (k = 0; k < length; k++) {
snprintf(p, 3, "%02x", (unsigned int) *(data+k));
p += 2;
}
return outstring;
}
/*
* bindata2hexstring(): convert a getdns bindata input into a string of
* hex digits.
*/
char *bindata2hexstring(getdns_bindata *b)
{
return bin2hexstring(b->data, b->size);
}
|
/**
\file ExternalInputStimulus.h
\brief Declares the external input stimulus class.
**/
#pragma once
namespace AnimatSim
{
namespace ExternalStimuli
{
class ANIMAT_PORT ExternalInputStimulus : public ExternalStimulus
{
protected:
/// GUID ID of the target node to enable.
std::string m_strTargetNodeID;
/// The post-fix equation that controls the input values to the node.
std::string m_strInputEquation;
/// Pointer to the post-fix evaluator.
CStdPostFixEval *m_lpEval;
/// The current input value that will be applied to the node.
float m_fltInput;
public:
ExternalInputStimulus();
virtual ~ExternalInputStimulus();
static ExternalInputStimulus *CastToDerived(AnimatBase *lpBase) {return static_cast<ExternalInputStimulus*>(lpBase);}
virtual std::string Type();
virtual std::string TargetNodeID();
virtual void TargetNodeID(std::string strID);
virtual float Input();
virtual void Input(float fltVal);
virtual std::string InputEquation();
virtual void InputEquation(std::string strVal);
virtual void Load(CStdXml &oXml);
virtual void Activate();
virtual void Initialize();
virtual void StepSimulation();
virtual void Deactivate();
virtual float *GetDataPointer(const std::string &strDataType);
virtual bool SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError = true);
virtual void QueryProperties(CStdPtrArray<TypeProperty> &aryProperties);
};
} //ExternalStimuli
} //VortexAnimatSim
|
/* ===-- ctzti2.c - Implement __ctzti2 -------------------------------------===
*
* The LLVM Compiler Infrastructure
*
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
* ===----------------------------------------------------------------------===
*
* This file implements __ctzti2 for the compiler_rt library.
*
* ===----------------------------------------------------------------------===
*/
#include "int_lib.h"
#ifdef CRT_HAS_128BIT
/* Returns: the number of trailing 0-bits */
/* Precondition: a != 0 */
si_int
__ctzti2(ti_int a)
{
twords x;
x.all = a;
const di_int f = -(x.s.low == 0);
return __builtin_ctzll((x.s.high & f) | (x.s.low & ~f)) +
((si_int)f & ((si_int)(sizeof(di_int) * CHAR_BIT)));
}
#endif /* CRT_HAS_128BIT */
|
/* ----------------------------------------------------------------------------
* GTSAM Copyright 2010, Georgia Tech Research Corporation,
* Atlanta, Georgia 30332-0415
* All Rights Reserved
* Authors: Frank Dellaert, et al. (see THANKS for the full author list)
* See LICENSE for the license information
* -------------------------------------------------------------------------- */
/**
* @file Argument.h
* @brief arguments to constructors and methods
* @author Frank Dellaert
* @author Andrew Melim
* @author Richard Roberts
**/
#pragma once
#include <string>
#include <vector>
#include "FileWriter.h"
namespace wrap {
/// Argument class
struct Argument {
bool is_const, is_ref, is_ptr;
std::string type;
std::string name;
std::vector<std::string> namespaces;
Argument() :
is_const(false), is_ref(false), is_ptr(false) {
}
/// return MATLAB class for use in isa(x,class)
std::string matlabClass(const std::string& delim = "") const;
/// adds namespaces to type
std::string qualifiedType(const std::string& delim = "") const;
/// MATLAB code generation, MATLAB to C++
void matlab_unwrap(FileWriter& file, const std::string& matlabName) const;
};
/// Argument list is just a container with Arguments
struct ArgumentList: public std::vector<Argument> {
/// create a comma-separated string listing all argument types (not used)
std::string types() const;
/// create a short "signature" string
std::string signature() const;
/// create a comma-separated string listing all argument names, used in m-files
std::string names() const;
// MATLAB code generation:
/**
* emit code to unwrap arguments
* @param file output stream
* @param start initial index for input array, set to 1 for method
*/
void matlab_unwrap(FileWriter& file, int start = 0) const; // MATLAB to C++
};
} // \namespace wrap
|
/*
This file is part of the implementation for the technical paper
Field-Aligned Online Surface Reconstruction
Nico Schertler, Marco Tarini, Wenzel Jakob, Misha Kazhdan, Stefan Gumhold, Daniele Panozzo
ACM TOG 36, 4, July 2017 (Proceedings of SIGGRAPH 2017)
Use of this source code is granted via a BSD-style license, which can be found
in License.txt in the repository root.
@author Nico Schertler
*/
#pragma once
#include "osr/Data.h"
namespace osr
{
//Responsible for running the program in batch mode
class BatchSession
{
public:
//Parses the given command line arguments and sets up all required states.
void parseCommandLineArguments(int argc, char *argv[]);
//Runs the program with the previously defined state.
void run();
private:
Data data;
std::string inputFile;
std::string outputFile;
bool triangulate = false;
float scaleMultiplier = 1.0f;
};
} |
/*
* Copyright (c) 2000 Benno Rice
* 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 Benno Rice ``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 REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD: src/sys/boot/ofw/libofw/ofw_time.c,v 1.3 2001/10/07 13:27:27 benno Exp $
*/
#include <stand.h>
#include "openfirm.h"
time_t
time(time_t *tloc)
{
int secs;
secs = OF_milliseconds() / 1000;
if (tloc)
*tloc = secs;
return secs;
}
int
getsecs()
{
time_t n = 0;
time(&n);
return n;
}
void
delay(int usecs)
{
int msecs, start;
msecs = usecs / 1000;
start = OF_milliseconds();
while (OF_milliseconds() - start < msecs);
}
|
#ifndef COMMON_SB_H
#define COMMON_SB_H
#ifndef DYNAMIC_ARCH
#define SBDOT_K sbdot_k
#define SBSTOBF16_K sbstobf16_k
#define SBDTOBF16_K sbdtobf16_k
#define SBF16TOS_K sbf16tos_k
#define DBF16TOD_K dbf16tod_k
#define SBGEMV_N_K sbgemv_n
#define SBGEMV_T_K sbgemv_t
#define SBGEMM_ONCOPY sbgemm_oncopy
#define SBGEMM_OTCOPY sbgemm_otcopy
#if SBGEMM_DEFAULT_UNROLL_M == SBGEMM_DEFAULT_UNROLL_N
#define SBGEMM_INCOPY sbgemm_oncopy
#define SBGEMM_ITCOPY sbgemm_otcopy
#else
#define SBGEMM_INCOPY sbgemm_incopy
#define SBGEMM_ITCOPY sbgemm_itcopy
#endif
#define SBGEMM_BETA sbgemm_beta
#define SBGEMM_KERNEL sbgemm_kernel
#define SBGEMM_SMALL_MATRIX_PERMIT sbgemm_small_matrix_permit
#else
#define SBDOT_K gotoblas -> sbdot_k
#define SBSTOBF16_K gotoblas -> sbstobf16_k
#define SBDTOBF16_K gotoblas -> sbdtobf16_k
#define SBF16TOS_K gotoblas -> sbf16tos_k
#define DBF16TOD_K gotoblas -> dbf16tod_k
#define SBGEMV_N_K gotoblas -> sbgemv_n
#define SBGEMV_T_K gotoblas -> sbgemv_t
#define SBGEMM_ONCOPY gotoblas -> sbgemm_oncopy
#define SBGEMM_OTCOPY gotoblas -> sbgemm_otcopy
#define SBGEMM_INCOPY gotoblas -> sbgemm_incopy
#define SBGEMM_ITCOPY gotoblas -> sbgemm_itcopy
#define SBGEMM_BETA gotoblas -> sbgemm_beta
#define SBGEMM_KERNEL gotoblas -> sbgemm_kernel
#define SBGEMM_SMALL_MATRIX_PERMIT gotoblas -> sbgemm_small_matrix_permit
#endif
#define SBGEMM_SMALL_KERNEL_NN FUNC_OFFSET(sbgemm_small_kernel_nn)
#define SBGEMM_SMALL_KERNEL_NT FUNC_OFFSET(sbgemm_small_kernel_nt)
#define SBGEMM_SMALL_KERNEL_TN FUNC_OFFSET(sbgemm_small_kernel_tn)
#define SBGEMM_SMALL_KERNEL_TT FUNC_OFFSET(sbgemm_small_kernel_tt)
#define SBGEMM_SMALL_KERNEL_B0_NN FUNC_OFFSET(sbgemm_small_kernel_b0_nn)
#define SBGEMM_SMALL_KERNEL_B0_NT FUNC_OFFSET(sbgemm_small_kernel_b0_nt)
#define SBGEMM_SMALL_KERNEL_B0_TN FUNC_OFFSET(sbgemm_small_kernel_b0_tn)
#define SBGEMM_SMALL_KERNEL_B0_TT FUNC_OFFSET(sbgemm_small_kernel_b0_tt)
#define SBGEMM_NN sbgemm_nn
#define SBGEMM_CN sbgemm_tn
#define SBGEMM_TN sbgemm_tn
#define SBGEMM_NC sbgemm_nt
#define SBGEMM_NT sbgemm_nt
#define SBGEMM_CC sbgemm_tt
#define SBGEMM_CT sbgemm_tt
#define SBGEMM_TC sbgemm_tt
#define SBGEMM_TT sbgemm_tt
#define SBGEMM_NR sbgemm_nn
#define SBGEMM_TR sbgemm_tn
#define SBGEMM_CR sbgemm_tn
#define SBGEMM_RN sbgemm_nn
#define SBGEMM_RT sbgemm_nt
#define SBGEMM_RC sbgemm_nt
#define SBGEMM_RR sbgemm_nn
#define SBGEMM_THREAD_NN sbgemm_thread_nn
#define SBGEMM_THREAD_CN sbgemm_thread_tn
#define SBGEMM_THREAD_TN sbgemm_thread_tn
#define SBGEMM_THREAD_NC sbgemm_thread_nt
#define SBGEMM_THREAD_NT sbgemm_thread_nt
#define SBGEMM_THREAD_CC sbgemm_thread_tt
#define SBGEMM_THREAD_CT sbgemm_thread_tt
#define SBGEMM_THREAD_TC sbgemm_thread_tt
#define SBGEMM_THREAD_TT sbgemm_thread_tt
#define SBGEMM_THREAD_NR sbgemm_thread_nn
#define SBGEMM_THREAD_TR sbgemm_thread_tn
#define SBGEMM_THREAD_CR sbgemm_thread_tn
#define SBGEMM_THREAD_RN sbgemm_thread_nn
#define SBGEMM_THREAD_RT sbgemm_thread_nt
#define SBGEMM_THREAD_RC sbgemm_thread_nt
#define SBGEMM_THREAD_RR sbgemm_thread_nn
#endif
|
/*****************************************************************************
Copyright (c) 2011, Intel Corp.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************
* Contents: Native middle-level C interface to LAPACK function dpbequ
* Author: Intel Corporation
* Generated November, 2011
*****************************************************************************/
#include "lapacke.h"
#include "lapacke_utils.h"
lapack_int LAPACKE_dpbequ_work( int matrix_order, char uplo, lapack_int n,
lapack_int kd, const double* ab,
lapack_int ldab, double* s, double* scond,
double* amax )
{
lapack_int info = 0;
if( matrix_order == LAPACK_COL_MAJOR ) {
/* Call LAPACK function and adjust info */
LAPACK_dpbequ( &uplo, &n, &kd, ab, &ldab, s, scond, amax, &info );
if( info < 0 ) {
info = info - 1;
}
} else if( matrix_order == LAPACK_ROW_MAJOR ) {
lapack_int ldab_t = MAX(1,kd+1);
double* ab_t = NULL;
/* Check leading dimension(s) */
if( ldab < n ) {
info = -6;
LAPACKE_xerbla( "LAPACKE_dpbequ_work", info );
return info;
}
/* Allocate memory for temporary array(s) */
ab_t = (double*)LAPACKE_malloc( sizeof(double) * ldab_t * MAX(1,n) );
if( ab_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_0;
}
/* Transpose input matrices */
LAPACKE_dpb_trans( matrix_order, uplo, n, kd, ab, ldab, ab_t, ldab_t );
/* Call LAPACK function and adjust info */
LAPACK_dpbequ( &uplo, &n, &kd, ab_t, &ldab_t, s, scond, amax, &info );
if( info < 0 ) {
info = info - 1;
}
/* Release memory and exit */
LAPACKE_free( ab_t );
exit_level_0:
if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
LAPACKE_xerbla( "LAPACKE_dpbequ_work", info );
}
} else {
info = -1;
LAPACKE_xerbla( "LAPACKE_dpbequ_work", info );
}
return info;
}
|
/***
* Copyright (c) 2013, Dan Hasting
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the organization nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
***/
#ifndef GLOBAL_H
#define GLOBAL_H
#include <QObject>
#include <QSettings>
const QString AppName = "CEN64-Qt";
const QString AppNameLower = "cen64-qt";
const QString ParentName = "CEN64";
const QString ParentNameLower = "cen64";
const QString Copyright = "CEN64 Copyright (c) 2013, Tyler J. Stachecki";
const QString Website = "http://www.cen64.com/";
const QString GitHub = "https://github.com/dh4/cen64-qt";
const QString TheGamesDBAPIKey = "750dbe45c2f1c63dd3a730b0ef0923ec448b543a908fbe3e2bccada4341df2f5";
#ifdef Q_OS_WIN
#define SETTINGS QSettings(AppNameLower+".ini", QSettings::IniFormat)
#else
#define SETTINGS QSettings(ParentNameLower, AppNameLower)
#endif
#endif // GLOBAL_H
|
// Copyright (c) 2006-2009 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 BAR_TOOLBAR_CLD_I18N_ENCODINGS_COMPACT_LANG_DET_WIN_CLD_COMMANDLINEFLAGS_H_
#define BAR_TOOLBAR_CLD_I18N_ENCODINGS_COMPACT_LANG_DET_WIN_CLD_COMMANDLINEFLAGS_H_
#if !defined(CLD_WINDOWS)
#include "base/commandlineflags.h"
#else
#undef DEFINE_bool
#define DEFINE_bool(name, default_value, comment) \
const bool FLAGS_##name = default_value;
#undef DEFINE_int32
#define DEFINE_int32(name, default_value, comment) \
const int32 FLAGS_##name = default_value;
#undef DECLARE_bool
#define DECLARE_bool(name) extern const bool FLAGS_##name;
#undef DECLARE_int32
#define DECLARE_int32(name) extern int32 FLAGS_##name;
#endif
#endif // BAR_TOOLBAR_CLD_I18N_ENCODINGS_COMPACT_LANG_DET_WIN_CLD_COMMANDLINEFLAGS_H_
|
//=============================================================================================================
/**
* @file fiff_raw_dir.h
* @author Lorenz Esch <lesch@mgh.harvard.edu>;
* Matti Hamalainen <msh@nmr.mgh.harvard.edu>;
* Christoph Dinh <chdinh@nmr.mgh.harvard.edu>
* @since 0.1.0
* @date July, 2012
*
* @section LICENSE
*
* Copyright (C) 2012, Lorenz Esch, Matti Hamalainen, Christoph Dinh. 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 MNE-CPP authors 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.
*
*
* @brief FiffRawDir class declaration.
*
*/
#ifndef FIFF_RAW_DIR_H
#define FIFF_RAW_DIR_H
//=============================================================================================================
// INCLUDES
//=============================================================================================================
#include "fiff_global.h"
#include "fiff_types.h"
#include "fiff_dir_entry.h"
//=============================================================================================================
// QT INCLUDES
//=============================================================================================================
#include <QSharedPointer>
//=============================================================================================================
// DEFINE NAMESPACE FIFFLIB
//=============================================================================================================
namespace FIFFLIB
{
//=============================================================================================================
/**
* Special fiff diretory entry for raw data. ToDo: derive this of FiffDirEntry.
*
*
* @brief Raw Directory entry
*/
class FIFFSHARED_EXPORT FiffRawDir {
public:
typedef QSharedPointer<FiffRawDir> SPtr; /**< Shared pointer type for FiffRawDir. */
typedef QSharedPointer<const FiffRawDir> ConstSPtr; /**< Const shared pointer type for FiffRawDir. */
//=========================================================================================================
/**
* Default constructor
*/
FiffRawDir();
//=========================================================================================================
/**
* Copy constructor.
*
* @param[in] p_FiffRawDir Raw directory entry which should be copied
*/
FiffRawDir(const FiffRawDir &p_FiffRawDir);
//=========================================================================================================
/**
* Destroys the raw Directory entry.
*/
~FiffRawDir();
public:
FiffDirEntry::SPtr ent; /**< Directory entry description */
fiff_int_t first; /**< first sample */
fiff_int_t last; /**< last sample */
fiff_int_t nsamp; /**< Number of samples */
};
} // NAMESPACE
#endif // FIFF_RAW_DIR_H
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_SIGNIN_CORE_COMMON_SIGNIN_PREF_NAMES_H_
#define COMPONENTS_SIGNIN_CORE_COMMON_SIGNIN_PREF_NAMES_H_
namespace prefs {
extern const char kGoogleServicesLastUsername[];
extern const char kGoogleServicesUserAccountId[];
extern const char kGoogleServicesUsername[];
extern const char kSigninAllowed[];
} // namespace prefs
#endif // COMPONENTS_SIGNIN_CORE_COMMON_SIGNIN_PREF_NAMES_H_
|
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#ifndef _FWL_LISTBOX_IMP_H
#define _FWL_LISTBOX_IMP_H
#include <memory>
class CFWL_WidgetImp;
class CFWL_WidgetImpProperties;
class CFWL_WidgetImpDelegate;
class CFWL_ScrollBarImp;
class IFWL_Widget;
class CFWL_ListBoxImp;
class CFWL_ListBoxImpDelegate;
class CFWL_ListBoxImp : public CFWL_WidgetImp {
public:
CFWL_ListBoxImp(const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter);
~CFWL_ListBoxImp();
virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const;
virtual FX_DWORD GetClassID() const;
virtual FWL_ERR Initialize();
virtual FWL_ERR Finalize();
virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE);
virtual FWL_ERR Update();
virtual FX_DWORD HitTest(FX_FLOAT fx, FX_FLOAT fy);
virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix = NULL);
virtual FWL_ERR SetThemeProvider(IFWL_ThemeProvider* pThemeProvider);
virtual int32_t CountSelItems();
virtual FWL_HLISTITEM GetSelItem(int32_t nIndexSel);
virtual int32_t GetSelIndex(int32_t nIndex);
virtual FWL_ERR SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect = TRUE);
virtual FWL_ERR GetItemText(FWL_HLISTITEM hItem, CFX_WideString& wsText);
virtual FWL_ERR GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert = TRUE);
virtual FWL_ERR* Sort(IFWL_ListBoxCompare* pCom);
protected:
FWL_HLISTITEM GetItem(FWL_HLISTITEM hItem, FX_DWORD dwKeyCode);
void SetSelection(FWL_HLISTITEM hStart,
FWL_HLISTITEM hEnd,
FX_BOOL bSelected);
void SetSelectionDirect(FWL_HLISTITEM hItem, FX_BOOL bSelect);
FX_BOOL IsItemSelected(FWL_HLISTITEM hItem);
void ClearSelection();
void SelectAll();
FWL_HLISTITEM GetFocusedItem();
void SetFocusItem(FWL_HLISTITEM hItem);
FWL_HLISTITEM GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy);
FX_BOOL GetItemCheckRect(FWL_HLISTITEM hItem, CFX_RectF& rtCheck);
FX_BOOL SetItemChecked(FWL_HLISTITEM hItem, FX_BOOL bChecked);
FX_BOOL GetItemChecked(FWL_HLISTITEM hItem);
FX_BOOL ScrollToVisible(FWL_HLISTITEM hItem);
void DrawBkground(CFX_Graphics* pGraphics,
IFWL_ThemeProvider* pTheme,
const CFX_Matrix* pMatrix = NULL);
void DrawItems(CFX_Graphics* pGraphics,
IFWL_ThemeProvider* pTheme,
const CFX_Matrix* pMatrix = NULL);
void DrawItem(CFX_Graphics* pGraphics,
IFWL_ThemeProvider* pTheme,
FWL_HLISTITEM hItem,
int32_t Index,
const CFX_RectF& rtItem,
const CFX_Matrix* pMatrix = NULL);
void DrawStatic(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme);
CFX_SizeF CalcSize(FX_BOOL bAutoSize = FALSE);
void GetItemSize(CFX_SizeF& size,
FWL_HLISTITEM hItem,
FX_FLOAT fWidth,
FX_FLOAT fHeight,
FX_BOOL bAutoSize = FALSE);
FX_FLOAT GetMaxTextWidth();
FX_FLOAT GetScrollWidth();
FX_FLOAT GetItemHeigt();
void InitScrollBar(FX_BOOL bVert = TRUE);
void SortItem();
FX_BOOL IsShowScrollBar(FX_BOOL bVert);
void ProcessSelChanged();
protected:
CFX_RectF m_rtClient;
CFX_RectF m_rtStatic;
CFX_RectF m_rtConent;
std::unique_ptr<IFWL_ScrollBar> m_pHorzScrollBar;
std::unique_ptr<IFWL_ScrollBar> m_pVertScrollBar;
FX_DWORD m_dwTTOStyles;
int32_t m_iTTOAligns;
FWL_HLISTITEM m_hAnchor;
FX_FLOAT m_fItemHeight;
FX_FLOAT m_fScorllBarWidth;
FX_BOOL m_bLButtonDown;
IFWL_ThemeProvider* m_pScrollBarTP;
friend class CFWL_ListBoxImpDelegate;
};
class CFWL_ListBoxImpDelegate : public CFWL_WidgetImpDelegate {
public:
CFWL_ListBoxImpDelegate(CFWL_ListBoxImp* pOwner);
int32_t OnProcessMessage(CFWL_Message* pMessage) override;
FWL_ERR OnProcessEvent(CFWL_Event* pEvent) override;
FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix = NULL) override;
protected:
void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE);
void OnLButtonDown(CFWL_MsgMouse* pMsg);
void OnLButtonUp(CFWL_MsgMouse* pMsg);
void OnMouseWheel(CFWL_MsgMouseWheel* pMsg);
void OnKeyDown(CFWL_MsgKey* pMsg);
void OnVK(FWL_HLISTITEM hItem, FX_BOOL bShift, FX_BOOL bCtrl);
FX_BOOL OnScroll(IFWL_ScrollBar* pScrollBar, FX_DWORD dwCode, FX_FLOAT fPos);
void DispatchSelChangedEv();
CFWL_ListBoxImp* m_pOwner;
};
#endif
|
#ifndef BINARY_IO_H
#define BINARY_IO_H
/// COMPONENT
#include <csapex_math/model/matrix.h>
#include <csapex_math/model/vector.h>
/// PROJECT
#include <csapex/serialization/serialization_buffer.h>
namespace csapex
{
SerializationBuffer& operator<<(SerializationBuffer& data, const math::linear::Vector& vector);
const SerializationBuffer& operator>>(const SerializationBuffer& data, math::linear::Vector& vector);
SerializationBuffer& operator<<(SerializationBuffer& data, const math::linear::Matrix& matrix);
const SerializationBuffer& operator>>(const SerializationBuffer& data, math::linear::Matrix& matrix);
} // namespace csapex
#endif // BINARY_IO_H
|
/*
* Copyright (c) 2011-2015, Thomas Bischof
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the Massachusetts Institute of Technology 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 RANGE_H_
#define RANGE_H_
#include <stdio.h>
typedef struct {
int yielded;
unsigned int start;
unsigned int stop;
unsigned int value;
} range_t;
typedef struct {
unsigned int dimensions;
range_t **ranges;
} ranges_t;
range_t *range_alloc(void);
void range_init(range_t *range);
void range_set_stop(range_t *range, unsigned int const stop);
void range_set_start(range_t *range, unsigned int const start);
int range_next(range_t *range);
void range_free(range_t **range);
ranges_t *ranges_alloc(unsigned int const dimensions);
void ranges_init(ranges_t *ranges);
void ranges_free(ranges_t **ranges);
int ranges_set_start(ranges_t *ranges, unsigned int const dimension,
unsigned int const start);
void ranges_set_starts(ranges_t *ranges, unsigned int const start);
int ranges_set_stop(ranges_t *ranges, unsigned int const dimension,
unsigned int const stop);
void ranges_set_stops(ranges_t *ranges, unsigned int const stop);
int ranges_next(ranges_t *ranges);
int ranges_fprintf(FILE *stream_out, ranges_t const *ranges);
#endif
|
/*============================================================================
gossimon - Gossip based resource usage monitoring for Linux clusters
Copyright 2003-2010 Amnon Barak
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#ifndef __PARSE_EXTERNAL_INFO
#define __PARSE_EXTERNAL_INFO
// Clusters and users which use the current machine
#include <Mapper.h>
#define MAX_USING_UIDS_PER_CLUSTER (5)
#define MAX_USING_CLUSTERS (5)
// Local usage will be listed under this cluster
#define LOCAL_CLUSTER_NAME "local-use"
// Processes from machines which does not belong to any partner
// will be listed under the unknown cluster
#define UNKNOWN_CLUSTER_NAME "unknown"
// Non mosix usage will be counted to the user nobody
#define NON_MOSIX_PROC_USER "nobody"
typedef struct _used_by {
char clusterName[MAPPER_MAX_CLUSTER_NAME];
int uidNum;
int uid[MAX_USING_UIDS_PER_CLUSTER];
} used_by_entry_t;
typedef enum {
UB_STAT_INIT = 0,
UB_STAT_LOCAL_USE,
UB_STAT_GRID_USE,
UB_STAT_FREE,
UB_STAT_ERROR,
} node_usage_status_t;
// Return the usage information from the given string.
// arr should have size places in it.
// Retrun value: status of usage
// 1 on success
// size contain the number of valid entries in arr
node_usage_status_t getUsageInfo(char *str, used_by_entry_t *arr, int *size);
int writeUsageInfo(node_usage_status_t stat, used_by_entry_t *arr,
int arrSize, char *buff);
char *usageStatusStr(node_usage_status_t st);
node_usage_status_t strToUsageStatus(char *str);
#endif
|
/***************************************************************************
Copyright (c) 2021, The OpenBLAS Project
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
3. Neither the name of the OpenBLAS project nor the names of
its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE 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 OPENBLAS PROJECT OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#include "common.h"
#include <memory.h>
extern void sbgemm_scal_operation(BLASLONG M, BLASLONG N, float beta, float *C, BLASLONG ldc);
extern void sbgemm_zero_operation(BLASLONG M, BLASLONG N, float *C, BLASLONG ldc);
extern void sbgemm_blocking_kernel_nn_alpha(blasint M, blasint N, blasint K, float alpha, bfloat16 *A, blasint lda, bfloat16 *B, blasint ldb, float *C, blasint ldc, bfloat16 * block_A, bfloat16 * block_B);
extern void sbgemm_blocking_kernel_nn_one(blasint M, blasint N, blasint K, float alpha, bfloat16 *A, blasint lda, bfloat16 *B, blasint ldb, float *C, blasint ldc, bfloat16 * block_A, bfloat16 * block_B);
extern void sbgemm_blocking_kernel_nt_alpha(blasint M, blasint N, blasint K, float alpha, bfloat16 *A, blasint lda, bfloat16 *B, blasint ldb, float *C, blasint ldc, bfloat16 * block_A, bfloat16 * block_B);
extern void sbgemm_blocking_kernel_nt_one(blasint M, blasint N, blasint K, float alpha, bfloat16 *A, blasint lda, bfloat16 *B, blasint ldb, float *C, blasint ldc, bfloat16 * block_A, bfloat16 * block_B);
extern void sbgemm_blocking_kernel_tn_alpha(blasint M, blasint N, blasint K, float alpha, bfloat16 *A, blasint lda, bfloat16 *B, blasint ldb, float *C, blasint ldc, bfloat16 * block_A, bfloat16 * block_B);
extern void sbgemm_blocking_kernel_tn_one(blasint M, blasint N, blasint K, float alpha, bfloat16 *A, blasint lda, bfloat16 *B, blasint ldb, float *C, blasint ldc, bfloat16 * block_A, bfloat16 * block_B);
extern void sbgemm_blocking_kernel_tt_alpha(blasint M, blasint N, blasint K, float alpha, bfloat16 *A, blasint lda, bfloat16 *B, blasint ldb, float *C, blasint ldc, bfloat16 * block_A, bfloat16 * block_B);
extern void sbgemm_blocking_kernel_tt_one(blasint M, blasint N, blasint K, float alpha, bfloat16 *A, blasint lda, bfloat16 *B, blasint ldb, float *C, blasint ldc, bfloat16 * block_A, bfloat16 * block_B);
#if defined(TRANS_NN)
#define SBGEMM_BLOCKING_KERNEL_ONE sbgemm_blocking_kernel_nn_one
#define SBGEMM_BLOCKING_KERNEL_ALPHA sbgemm_blocking_kernel_nn_alpha
#elif defined(TRANS_NT)
#define SBGEMM_BLOCKING_KERNEL_ONE sbgemm_blocking_kernel_nt_one
#define SBGEMM_BLOCKING_KERNEL_ALPHA sbgemm_blocking_kernel_nt_alpha
#elif defined(TRANS_TN)
#define SBGEMM_BLOCKING_KERNEL_ONE sbgemm_blocking_kernel_tn_one
#define SBGEMM_BLOCKING_KERNEL_ALPHA sbgemm_blocking_kernel_tn_alpha
#elif defined(TRANS_TT)
#define SBGEMM_BLOCKING_KERNEL_ONE sbgemm_blocking_kernel_tt_one
#define SBGEMM_BLOCKING_KERNEL_ALPHA sbgemm_blocking_kernel_tt_alpha
#endif
#define BF16_BLOCK_THRES_K 1024
// If we want to adjust this to be bigger, need to change COL_MAJOR_INCOPY_KERNEL_Kx32 kernel to be bigger also
#define BF16_BLOCK_THRES_M 32
#define BF16_BLOCK_THRES_N 1024
#define MALLOC_ALIGN64(ptr, size, raw_ptr) \
raw_ptr = malloc((size) + 63); \
ptr = (bfloat16 *)(((uintptr_t) raw_ptr + 63) & ~(uintptr_t)63)
#if defined(B0)
int CNAME(BLASLONG M, BLASLONG N, BLASLONG K, IFLOAT * A, BLASLONG lda, FLOAT alpha, IFLOAT * B, BLASLONG ldb, FLOAT * C, BLASLONG ldc)
#else
int CNAME(BLASLONG M, BLASLONG N, BLASLONG K, IFLOAT * A, BLASLONG lda, FLOAT alpha, IFLOAT * B, BLASLONG ldb, FLOAT beta, FLOAT * C, BLASLONG ldc)
#endif
{
bfloat16 * block_A;
bfloat16 * block_B;
void* raw_ptrA;
void* raw_ptrB;
MALLOC_ALIGN64(block_A, sizeof(bfloat16) * BF16_BLOCK_THRES_K * BF16_BLOCK_THRES_M, raw_ptrA);
MALLOC_ALIGN64(block_B, sizeof(bfloat16) * BF16_BLOCK_THRES_N * BF16_BLOCK_THRES_K, raw_ptrB);
#if defined(B0)
sbgemm_zero_operation(M, N, C, ldc);
#else
sbgemm_scal_operation(M, N, beta, C, ldc);
#endif
if (alpha == ONE) {
SBGEMM_BLOCKING_KERNEL_ONE(M, N, K, alpha, A, lda, B, ldb, C, ldc, block_A, block_B);
} else {
SBGEMM_BLOCKING_KERNEL_ALPHA(M, N, K, alpha, A, lda, B, ldb, C, ldc, block_A, block_B);
}
free(raw_ptrA);
free(raw_ptrB);
return 0;
}
|
/* Copyright (c) 2014, Prithvi Raj Narendra
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @addtogroup peripheral-drivers
* @{
*
* @defgroup led-driver LED Driver
* LED Driver for the PCA1000 board to initialize, switch on, switch off and toggle LEDs
* @{
*
* @file
* This file contains the LED Driver for the PCA1000 board
* @author
* Prithvi
*/
#ifndef LEDS_H_
#define LEDS_H_
#include "board.h"
#include "nrf_gpio.h"
/**@brief Function to initialize the LEDS in the PCA10000 board
*/
static __INLINE void leds_init(void){
nrf_gpio_cfg_output(LED_RGB_RED);
nrf_gpio_pin_set(LED_RGB_RED);
nrf_gpio_cfg_output(LED_RGB_GREEN);
nrf_gpio_pin_set(LED_RGB_GREEN);
nrf_gpio_cfg_output(LED_RGB_BLUE);
nrf_gpio_pin_set(LED_RGB_BLUE);
}
/**
* Turn a specific LED on
* @param led The pin number of the LED to turn on
*/
static __INLINE void leds_on(uint32_t led){
nrf_gpio_pin_clear(led);
}
/**
* Turn a specific LED of
* @param led The pin number of the LED to turn off
*/
static __INLINE void leds_off(uint32_t led){
nrf_gpio_pin_set(led);
}
/**
* Toggle a specific LED
* @param led The pin number of the LED to toggle
*/
static __INLINE void leds_toggle(uint32_t led){
nrf_gpio_pin_toggle(led);
}
#endif /* LEDS_H_ */
/**
* @}
* @}
*/
|
// Version: $Id$
//
//
// Commentary:
//
//
// Change Log:
//
//
// Code:
#pragma once
#include <dtkComposerSupportExport.h>
#include "dtkComposerNodeLeafData.h"
class dtkComposerNodeDataPrivate;
// /////////////////////////////////////////////////////////////////
// dtkComposerNodeData interface
// /////////////////////////////////////////////////////////////////
class DTKCOMPOSERSUPPORT_EXPORT dtkComposerNodeData : public dtkComposerNodeLeafData
{
public:
dtkComposerNodeData(void);
~dtkComposerNodeData(void);
public:
bool isAbstractData(void) const;
QString abstractDataType(void) const;
public:
void run(void);
public:
QString type(void);
QString titleHint(void);
public:
QString inputLabelHint(int);
QString outputLabelHint(int);
private:
dtkComposerNodeDataPrivate *d;
};
//
// dtkComposerNodeData.h ends here
|
/*
* Copyright (c) 2005-2017 National Technology & Engineering Solutions
* of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
* NTESS, the U.S. Government retains certain rights in this software.
*
* 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 NTESS 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.
*
*/
#include "structs.h" // for orthlink, orthlink_float
void sorthog(double * vec, /* vector to be orthogonalized */
int n, /* length of the columns of orth */
struct orthlink **solist, /* set of vecs to orth. against */
int ngood /* number of vecs in solist */
)
{
double alpha;
double *dir;
double dot();
void scadd();
int i;
for (i = 1; i <= ngood; i++) {
dir = (solist[i])->vec;
alpha = -dot(vec, 1, n, dir) / dot(dir, 1, n, dir);
scadd(vec, 1, n, alpha, dir);
}
}
void sorthog_float(float * vec, /* vector to be orthogonalized */
int n, /* length of the columns of orth */
struct orthlink_float **solist, /* set of vecs to orth. against */
int ngood /* number of vecs in solist */
)
{
float alpha;
float *dir;
double dot_float();
void scadd_float();
int i;
for (i = 1; i <= ngood; i++) {
dir = (solist[i])->vec;
alpha = -dot_float(vec, 1, n, dir) / dot_float(dir, 1, n, dir);
scadd_float(vec, 1, n, alpha, dir);
}
}
|
/*
* cblas_zgeru.c
* The program is a C interface to zgeru.
*
* Keita Teranishi 5/20/98
*
*/
#include "cblapack.h"
void cblas_zgeru(const enum CBLAS_ORDER order, const integer M, const integer N,
const void *alpha, const void *X, const integer incX,
const void *Y, const integer incY, void *A, const integer lda)
{
#define F77_M M
#define F77_N N
#define F77_incX incX
#define F77_incY incY
#define F77_lda lda
extern integer CBLAS_CallFromC;
extern integer RowMajorStrg;
RowMajorStrg = 0;
CBLAS_CallFromC = 1;
if (order == CblasColMajor)
{
zgeru_( &F77_M, &F77_N, alpha, X, &F77_incX, Y, &F77_incY, A,
&F77_lda);
}
else if (order == CblasRowMajor)
{
RowMajorStrg = 1;
zgeru_( &F77_N, &F77_M, alpha, Y, &F77_incY, X, &F77_incX, A,
&F77_lda);
}
else cblas_xerbla(1, "cblas_zgeru", "Illegal Order setting, %d\n", order);
CBLAS_CallFromC = 0;
RowMajorStrg = 0;
return;
}
|
/******************************************************************************
This source file is part of the MoleQueue project.
Copyright 2012 Kitware, Inc.
This source code is released under the New BSD License, (the "License").
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
******************************************************************************/
#ifndef MOLEQUEUE_ZEROMQCONNECTIONLISTENERFACTORY_H
#define MOLEQUEUE_ZEROMQCONNECTIONLISTENERFACTORY_H
#include <molequeue/servercore/connectionlistenerfactory.h>
namespace MoleQueue
{
/// @brief A ConnectionListenerFactory subclass using ZeroMQ.
class ZeroMqConnectionListenerFactory: public QObject,
public MoleQueue::ConnectionListenerFactory
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.openchemistry.molequeue.ConnectionListenerFactory")
Q_INTERFACES(MoleQueue::ConnectionListenerFactory)
public:
ZeroMqConnectionListenerFactory();
ConnectionListener *createConnectionListener(QObject *parentObject = 0,
const QString &connectionString = "MoleQueue");
};
} // namespace MoleQueue
#endif // MOLEQUEUE_ZEROMQCONNECTIONLISTENERFACTORY_H
|
//===- MLIRContext.h - MLIR Global Context Class ----------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef MLIR_IR_MLIRCONTEXT_H
#define MLIR_IR_MLIRCONTEXT_H
#include "mlir/Support/LLVM.h"
#include <functional>
#include <memory>
#include <vector>
namespace mlir {
class AbstractOperation;
class DiagnosticEngine;
class Dialect;
class InFlightDiagnostic;
class Location;
class MLIRContextImpl;
class StorageUniquer;
/// MLIRContext is the top-level object for a collection of MLIR modules. It
/// holds immortal uniqued objects like types, and the tables used to unique
/// them.
///
/// MLIRContext gets a redundant "MLIR" prefix because otherwise it ends up with
/// a very generic name ("Context") and because it is uncommon for clients to
/// interact with it.
///
class MLIRContext {
public:
explicit MLIRContext();
~MLIRContext();
/// Return information about all registered IR dialects.
std::vector<Dialect *> getRegisteredDialects();
/// Get a registered IR dialect with the given namespace. If an exact match is
/// not found, then return nullptr.
Dialect *getRegisteredDialect(StringRef name);
/// Get a registered IR dialect for the given derived dialect type. The
/// derived type must provide a static 'getDialectNamespace' method.
template <typename T> T *getRegisteredDialect() {
return static_cast<T *>(getRegisteredDialect(T::getDialectNamespace()));
}
/// Return true if we allow to create operation for unregistered dialects.
bool allowsUnregisteredDialects();
/// Enables creating operations in unregistered dialects.
void allowUnregisteredDialects(bool allow = true);
/// Return true if multi-threading is enabled by the context.
bool isMultithreadingEnabled();
/// Set the flag specifying if multi-threading is disabled by the context.
void disableMultithreading(bool disable = true);
void enableMultithreading(bool enable = true) {
disableMultithreading(!enable);
}
/// Return true if we should attach the operation to diagnostics emitted via
/// Operation::emit.
bool shouldPrintOpOnDiagnostic();
/// Set the flag specifying if we should attach the operation to diagnostics
/// emitted via Operation::emit.
void printOpOnDiagnostic(bool enable);
/// Return true if we should attach the current stacktrace to diagnostics when
/// emitted.
bool shouldPrintStackTraceOnDiagnostic();
/// Set the flag specifying if we should attach the current stacktrace when
/// emitting diagnostics.
void printStackTraceOnDiagnostic(bool enable);
/// Return information about all registered operations. This isn't very
/// efficient: typically you should ask the operations about their properties
/// directly.
std::vector<AbstractOperation *> getRegisteredOperations();
// This is effectively private given that only MLIRContext.cpp can see the
// MLIRContextImpl type.
MLIRContextImpl &getImpl() { return *impl; }
/// Returns the diagnostic engine for this context.
DiagnosticEngine &getDiagEngine();
/// Returns the storage uniquer used for creating affine constructs.
StorageUniquer &getAffineUniquer();
/// Returns the storage uniquer used for constructing type storage instances.
/// This should not be used directly.
StorageUniquer &getTypeUniquer();
/// Returns the storage uniquer used for constructing attribute storage
/// instances. This should not be used directly.
StorageUniquer &getAttributeUniquer();
private:
const std::unique_ptr<MLIRContextImpl> impl;
MLIRContext(const MLIRContext &) = delete;
void operator=(const MLIRContext &) = delete;
};
//===----------------------------------------------------------------------===//
// MLIRContext CommandLine Options
//===----------------------------------------------------------------------===//
/// Register a set of useful command-line options that can be used to configure
/// various flags within the MLIRContext. These flags are used when constructing
/// an MLIR context for initialization.
void registerMLIRContextCLOptions();
} // end namespace mlir
#endif // MLIR_IR_MLIRCONTEXT_H
|
//
// PGPreparedQuery.h
// PGCocoa
//
// Created by Aaron Burghardt on 8/30/08.
// Copyright 2008. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import <PGCocoa/PGQueryParameters.h>
@class PGConnection;
@class PGResult;
@interface PGPreparedQuery : NSObject
{
PGConnection *_connection;
NSString *_query;
NSString *_name;
// NSMutableArray *_params;
BOOL _allocated; // indicator for status of the prepared query
}
/** Convenience creator using initWithName:query:types:connection:.
@param name the name of prepared query
@param sql the SQL statement
@param paramTypes array of parameter types as NSNumbers
@param conn the connection to use
@return Returns an initialized instance or nil if an error occurred.
*/
+ (PGPreparedQuery *)queryWithName:(NSString *)name sql:(NSString *)sql types:(NSArray *)paramTypes connection:(PGConnection *)conn;
/**
*/
+ (PGPreparedQuery *)queryWithName:(NSString *)name sql:(NSString *)sql types:(PGQueryParameterType *)paramTypes count:(NSUInteger)numParams connection:(PGConnection *)conn;
/** Initialize a prepared query
@param name the name of prepared query
@param sql the SQL statement
@param paramTypes array of parameter types as NSNumbers
@param conn the connection to use
*/
- (id)initWithName:(NSString *)name query:(NSString *)query types:(NSArray *)paramTypes connection:(PGConnection *)conn;
/** The designated initializer.
* @discussion The types may be NULL or may contain fewer elements than the number of placeholders
in the query. Parameters not specified will be inferred or may be cast in the
query statement.
* @param name the prepared name, which must be unique per connection. A single unnamed
* query can be specified by passing nil or @"".
* @param query the SQL statement
* @param types a C-array of parameter type constants
* @param count the number of parameters in the array of types
* @param conn the connection to use
* @return the initialized instance on success; nil on error. If nil is return, the error
* can be retrieved from the connection object.
*/
- (id)initWithName:(NSString *)name query:(NSString *)query types:(PGQueryParameterType *)types count:(NSUInteger)numTypes connection:(PGConnection *)conn;
/** Execute the prepared query with the given values.
* @param values the values to bind to be bound to query parameters
* @return A result object is always returned.
*/
- (PGResult *)executeWithValues:(NSArray *)values;
/** Deallocates the prepared query on the server. This is invoked if needed when the
* instance is dealloc'ed.
*/
- (void)deallocate;
@end
|
/*
* Copyright (c) 2001 Wind River Systems
* Copyright (c) 2001
* Bill Paul <wpaul@bsdi.com>. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Bill Paul.
* 4. Neither the name of the author nor the names of any co-contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY Bill Paul 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 Bill Paul OR THE VOICES IN HIS HEAD
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD: src/sys/dev/mii/nsgphyreg.h,v 1.3 2002/04/29 11:57:28 phk Exp $
*/
#ifndef _DEV_MII_NSGPHYREG_H_
#define _DEV_MII_NSGPHYREG_H_
/*
* NatSemi DP83891 registers
*/
#define NSGPHY_MII_STRAPOPT 0x10 /* Strap options */
#define NSGPHY_STRAPOPT_PHYADDR 0xF800 /* PHY address */
#define NSGPHY_STRAPOPT_COMPAT 0x0400 /* Broadcom compat mode */
#define NSGPHY_STRAPOPT_MMSE 0x0200 /* Manual master/slave enable */
#define NSGPHY_STRAPOPT_ANEG 0x0100 /* Autoneg enable */
#define NSGPHY_STRAPOPT_MMSV 0x0080 /* Manual master/slave setting */
#define NSGPHY_STRAPOPT_1000HDX 0x0010 /* Advertise 1000 half-duplex */
#define NSGPHY_STRAPOPT_1000FDX 0x0008 /* Advertise 1000 full-duplex */
#define NSGPHY_STRAPOPT_100_ADV 0x0004 /* Advertise 100 full/half-duplex */
#define NSGPHY_STRAPOPT_SPEED1 0x0002 /* speed selection */
#define NSGPHY_STRAPOPT_SPEED0 0x0001 /* speed selection */
#define NSGPHY_STRAPOPT_SPDSEL (NSGPHY_STRAPOPT_SPEED1|NSGPHY_STRAPOPT_SPEED0)
#define NSGPHY_MII_PHYSUP 0x11 /* PHY support/current status */
#define PHY_SUP_SPEED1 0x0010 /* speed bit 1 */
#define PHY_SUP_SPEED0 0x0008 /* speed bit 1 */
#define NSGPHY_PHYSUP_SPEED1 0x0010 /* speed status */
#define NSGPHY_PHYSUP_SPEED0 0x0008 /* speed status */
#define NSGPHY_PHYSUP_SPDSTS (NSGPHY_PHYSUP_SPEED1|NSGPHY_PHYSUP_SPEED0)
#define NSGPHY_PHYSUP_LNKSTS 0x0004 /* link status */
#define PHY_SUP_LINK 0x0004 /* link status */
#define PHY_SUP_DUPLEX 0x0002 /* 1 == full-duplex */
#define NSGPHY_PHYSUP_DUPSTS 0x0002 /* duplex status 1 == full */
#define NSGPHY_PHYSUP_10BT 0x0001 /* 10baseT resolved */
#define NSGPHY_SPDSTS_1000 0x0010
#define NSGPHY_SPDSTS_100 0x0008
#define NSGPHY_SPDSTS_10 0x0000
#endif /* _DEV_NSGPHY_MIIREG_H_ */
|
// Copyright (c) 2006-2009 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_COMMON_TRANSPORT_DIB_H_
#define CHROME_COMMON_TRANSPORT_DIB_H_
#include "base/basictypes.h"
#if defined(OS_WIN) || defined(OS_MACOSX) || defined(CHROMIUM_CAPSICUM)
#include "base/shared_memory.h"
#endif
#if defined(OS_WIN)
#include <windows.h>
#elif defined(USE_X11)
#include "chrome/common/x11_util.h"
#endif
namespace gfx {
class Size;
}
namespace skia {
class PlatformCanvas;
}
// -----------------------------------------------------------------------------
// A TransportDIB is a block of memory that is used to transport pixels
// between processes: from the renderer process to the browser, and
// between renderer and plugin processes.
// -----------------------------------------------------------------------------
class TransportDIB {
public:
~TransportDIB();
// Two typedefs are defined. A Handle is the type which can be sent over
// the wire so that the remote side can map the transport DIB. The Id typedef
// is sufficient to identify the transport DIB when you know that the remote
// side already may have it mapped.
#if defined(OS_WIN)
typedef HANDLE Handle;
// On Windows, the Id type includes a sequence number (epoch) to solve an ABA
// issue:
// 1) Process A creates a transport DIB with HANDLE=1 and sends to B.
// 2) Process B maps the transport DIB and caches 1 -> DIB.
// 3) Process A closes the transport DIB and creates a new one. The new DIB
// is also assigned HANDLE=1.
// 4) Process A sends the Handle to B, but B incorrectly believes that it
// already has it cached.
struct HandleAndSequenceNum {
HandleAndSequenceNum()
: handle(NULL),
sequence_num(0) {
}
HandleAndSequenceNum(HANDLE h, uint32 seq_num)
: handle(h),
sequence_num(seq_num) {
}
bool operator< (const HandleAndSequenceNum& other) const {
// Use the lexicographic order on the tuple <handle, sequence_num>.
if (other.handle != handle)
return other.handle < handle;
return other.sequence_num < sequence_num;
}
HANDLE handle;
uint32 sequence_num;
};
typedef HandleAndSequenceNum Id;
// Returns a default, invalid handle, that is meant to indicate a missing
// Transport DIB.
static Handle DefaultHandleValue() { return NULL; }
#elif defined(OS_MACOSX) || defined(CHROMIUM_CAPSICUM)
typedef base::SharedMemoryHandle Handle;
// On Mac, the inode number of the backing file is used as an id.
typedef base::SharedMemoryId Id;
// Returns a default, invalid handle, that is meant to indicate a missing
// Transport DIB.
static Handle DefaultHandleValue() { return Handle(); }
#elif defined(USE_X11)
typedef int Handle; // These two ints are SysV IPC shared memory keys
typedef int Id;
// Returns a default, invalid handle, that is meant to indicate a missing
// Transport DIB.
static Handle DefaultHandleValue() { return -1; }
#endif
// Create a new TransportDIB
// size: the minimum size, in bytes
// epoch: Windows only: a global counter. See comment above.
// returns: NULL on failure
static TransportDIB* Create(size_t size, uint32 sequence_num);
// Map the referenced transport DIB. Returns NULL on failure.
static TransportDIB* Map(Handle transport_dib);
// Returns true if the handle is valid.
static bool is_valid(Handle dib);
// Returns a canvas using the memory of this TransportDIB. The returned
// pointer will be owned by the caller. The bitmap will be of the given size,
// which should fit inside this memory.
skia::PlatformCanvas* GetPlatformCanvas(int w, int h);
// Return a pointer to the shared memory
void* memory() const;
// Return the maximum size of the shared memory. This is not the amount of
// data which is valid, you have to know that via other means, this is simply
// the maximum amount that /could/ be valid.
size_t size() const { return size_; }
// Return the identifier which can be used to refer to this shared memory
// on the wire.
Id id() const;
// Return a handle to the underlying shared memory. This can be sent over the
// wire to give this transport DIB to another process.
Handle handle() const;
#if defined(USE_X11)
// Map the shared memory into the X server and return an id for the shared
// segment.
XID MapToX(Display* connection);
#endif
private:
TransportDIB();
#if defined(OS_WIN) || defined(OS_MACOSX) || defined(CHROMIUM_CAPSICUM)
explicit TransportDIB(base::SharedMemoryHandle dib);
base::SharedMemory shared_memory_;
uint32 sequence_num_;
#elif defined(USE_X11)
int key_; // SysV shared memory id
void* address_; // mapped address
XSharedMemoryId x_shm_; // X id for the shared segment
Display* display_; // connection to the X server
#endif
size_t size_; // length, in bytes
DISALLOW_COPY_AND_ASSIGN(TransportDIB);
};
class MessageLoop;
#endif // CHROME_COMMON_TRANSPORT_DIB_H_
|
//
// RXTexture.h
// rivenx
//
// Created by Jean-Francois Roy on 08/08/2009.
// Copyright 2005-2012 MacStorm. All rights reserved.
//
#import "Base/RXBase.h"
#import "Rendering/RXRendering.h"
#import "Engine/RXStack.h"
@interface RXTexture : NSObject {
@public
GLuint texture;
GLenum target;
rx_size_t size;
@protected
BOOL _delete_when_done;
}
+ (RXTexture*)newStandardTextureWithTarget:(GLenum)target size:(rx_size_t)s context:(CGLContextObj)cgl_ctx lock:(BOOL)lock;
- (id)initWithID:(GLuint)texid target:(GLenum)t size:(rx_size_t)s deleteWhenDone:(BOOL)dwd;
- (void)bindWithContext:(CGLContextObj)cgl_ctx lock:(BOOL)lock;
- (void)updateWithBitmap:(uint16_t)tbmp_id archive:(MHKArchive*)archive;
- (void)updateWithBitmap:(uint16_t)tbmp_id stack:(RXStack*)stack;
@end
|
// Filename: muParserCartGridFunction.h
// Created on 24 Aug 2007 by Boyce Griffith
//
// Copyright (c) 2002-2013, Boyce Griffith
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// * Neither the name of New York University nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
#ifndef included_muParserCartGridFunction
#define included_muParserCartGridFunction
/////////////////////////////// INCLUDES /////////////////////////////////////
#include <stddef.h>
#include <map>
#include <string>
#include <vector>
#include "CartesianGridGeometry.h"
#include "PatchLevel.h"
#include "blitz/tinyvec2.h"
#include "ibtk/CartGridFunction.h"
#include "ibtk/muParser.h"
#include "tbox/Pointer.h"
namespace SAMRAI {
namespace hier {
template <int DIM> class Patch;
template <int DIM> class Variable;
} // namespace hier
namespace tbox {
class Database;
} // namespace tbox
} // namespace SAMRAI
/////////////////////////////// CLASS DEFINITION /////////////////////////////
namespace IBTK
{
/*!
* \brief Class muParserCartGridFunction is an implementation of the strategy
* class CartGridFunction that allows for the run-time specification of
* (possibly spatially- and temporally-varying) functions which are used to set
* double precision values on standard SAMRAI SAMRAI::hier::PatchData objects.
*/
class muParserCartGridFunction
: public CartGridFunction
{
public:
/*!
* \brief Constructor.
*/
muParserCartGridFunction(
const std::string& object_name,
SAMRAI::tbox::Pointer<SAMRAI::tbox::Database> input_db,
SAMRAI::tbox::Pointer<SAMRAI::geom::CartesianGridGeometry<NDIM> > grid_geom);
/*!
* \brief Empty destructor.
*/
~muParserCartGridFunction();
/*!
* \name Methods to set patch interior data.
*/
//\{
/*!
* \brief Indicates whether the concrete CartGridFunction object is
* time-dependent.
*/
bool
isTimeDependent() const;
/*!
* \brief Virtual function to evaluate the function on the patch interior.
*/
void
setDataOnPatch(
int data_idx,
SAMRAI::tbox::Pointer<SAMRAI::hier::Variable<NDIM> > var,
SAMRAI::tbox::Pointer<SAMRAI::hier::Patch<NDIM> > patch,
double data_time,
bool initial_time=false,
SAMRAI::tbox::Pointer<SAMRAI::hier::PatchLevel<NDIM> > level=SAMRAI::tbox::Pointer<SAMRAI::hier::PatchLevel<NDIM> >(NULL));
//\}
private:
/*!
* \brief Default constructor.
*
* \note This constructor is not implemented and should not be
* used.
*/
muParserCartGridFunction();
/*!
* \brief Copy constructor.
*
* \note This constructor is not implemented and should not be used.
*
* \param from The value to copy to this object.
*/
muParserCartGridFunction(
const muParserCartGridFunction& from);
/*!
* \brief Assignment operator.
*
* \note This operator is not implemented and should not be used.
*
* \param that The value to assign to this object.
*
* \return A reference to this object.
*/
muParserCartGridFunction&
operator=(
const muParserCartGridFunction& that);
/*!
* The Cartesian grid geometry object provides the extents of the
* computational domain.
*/
SAMRAI::tbox::Pointer<SAMRAI::geom::CartesianGridGeometry<NDIM> > d_grid_geom;
/*!
* User-provided constants specified in the input file.
*/
std::map<std::string,double> d_constants;
/*!
* The strings providing the data-setting functions which are evaluated by the
* mu::Parser objects.
*/
std::vector<std::string> d_function_strings;
/*!
* The mu::Parser objects which evaluate the data-setting functions.
*/
std::vector<mu::Parser> d_parsers;
/*!
* Time and position variables.
*/
double d_parser_time;
blitz::TinyVector<double,NDIM> d_parser_posn;
};
}// namespace IBTK
//////////////////////////////////////////////////////////////////////////////
#endif //#ifndef included_muParserCartGridFunction
|
/*============================================================================
Copyright (c) German Cancer Research Center (DKFZ)
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.
- All advertising materials mentioning features or use of this software must
display the following acknowledgement:
"This product includes software developed by the German Cancer Research
Center (DKFZ)."
- Neither the name of the German Cancer Research Center (DKFZ) 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 GERMAN CANCER RESEARCH CENTER (DKFZ) 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 GERMAN
CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
============================================================================*/
/**@file
* this function calculates the variance of all greyvalues
* in an image
*/
/** this function calculates the variance of all greyvalues
* in an image
*
* @param pic pointer to the image
* @param &max result variable: mean greyvalue
*
* @return mitkIpFuncERROR - if an error occured
* @return mitkIpFuncOK - if no error occures
*
* AUTHOR & DATE
*/
/* include-files */
#include "mitkIpFuncP.h"
mitkIpFloat8_t mitkIpFuncVar ( mitkIpPicDescriptor *pic );
#ifndef DOXYGEN_IGNORE
/* definition of extreme value macro */
#define MEAN_2( type, pic, mean, mean_2 ) \
{ \
mitkIpUInt4_t i, no_elem; \
\
mean_2 = 0.; \
\
no_elem = _mitkIpPicElements ( pic ); \
for ( i = 0; i < no_elem; i++ ) \
{ \
mean_2 = ( ( ( type * ) pic->data ) [i] - mean ) * \
( ( ( type * ) pic->data ) [i] - mean ) + \
mean_2; \
} \
}
/* ========================================================== */
/*
** function picVar : calculates the mean value (mean)
** of an image (pic)
*/
/* ========================================================== */
mitkIpFloat8_t mitkIpFuncVar ( mitkIpPicDescriptor *pic )
{
mitkIpFloat8_t var;
mitkIpFloat8_t mean;
mitkIpFloat8_t mean_2;
/* check image data */
if ( _mitkIpFuncError ( pic ) != mitkIpFuncOK ) return ( mitkIpFuncERROR );
if ( _mitkIpPicElements ( pic ) == 1 )
var = 0;
else
{
/* calculate mean value */
mean = mitkIpFuncMean ( pic );
mitkIpPicFORALL_2( MEAN_2, pic, mean, mean_2 );
var = mean_2 / ( mitkIpFloat8_t ) ( _mitkIpPicElements ( pic ) - 1 );
}
return( var );
}
#endif
|
#ifndef __ENGPAR_DIFFUSIVE_INPUT_H__
#define __ENGPAR_DIFFUSIVE_INPUT_H__
#include <ngraph.h>
#include <engpar_input.h>
namespace engpar {
class DiffusiveInput : public Input {
public:
DiffusiveInput(agi::Ngraph*);
void addPriority(int type, double tolerance);
void balanceGhosts(bool enable);
/** \brief The order of graph entities to be balanced
*
* -1 represents graph vertices, 0-MAX_TYPES represent edge_types
*/
std::vector<int> priorities;
/** \brief The imbalance tolerance for each priority
*
* tolerances must be given in the same order as in the priorities vector
*/
std::vector<double> tolerances;
/** \brief The maximum iterations for all load balancing */
int maxIterations;
/** \brief The maximum iterations of load balancing foreach graph entity type
*
* defaults to 100
*/
int maxIterationsPerType;
/** \brief The percent of difference in weight to send in each iteration
*
* defaults to .1
*/
double step_factor;
/** \brief Whether or not to run a global weight balancer to aid in diffusive load balancing
*
* defaults to false
*/
bool runPartWeightBalancer;
/** \brief The edge type used for determining part boundaries
*
* defaults to 0
*/
int sides_edge_type;
/** \brief The edge type used for creating cavities for selection
*
* defaults to 0
*/
int selection_edge_type;
/** \brief If ghosts should be accounted for in the weight of a part
*
* defaults to false
*/
bool countGhosts;
/** \brief If the distance based iteration queue should be used.
*
* defaults to false (for now)
*/
bool useDistanceQueue;
/** \brief Whether to use the push bfs or pull bfs.
*
* defaults to false
*/
bool bfsPush;
/** \brief The minimum number of edge connections that define connectivity.
*
* defaults to 1
*/
int minConnectivity;
/** \brief The dimension used to count connectivity.
*
* defaults to 0
*/
agi::etype connectivityType;
/** \brief The max ratio of allowed cut growth for a given cavity (degrees of on part cavity / degrees of off part cavity)
*
* defaults to 0 (values less than or equal to 0 ignore this operation)
*/
double limitEdgeCutGrowth;
};
}
#endif
|
//////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2016, Image Engine Design Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above
// copyright notice, this list of conditions and the following
// disclaimer.
//
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided with
// the distribution.
//
// * Neither the name of John Haddon nor the names of
// any other contributors to this software may be used to endorse or
// promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////
#ifndef GAFFERIMAGEBINDINGS_UVWARPBINDING_H
#define GAFFERIMAGEBINDINGS_UVWARPBINDING_H
namespace GafferImageBindings
{
void bindUVWarp();
}; // namespace GafferImageBindings
#endif // GAFFERIMAGEBINDINGS_UVWARPBINDING_H
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_VARIATIONS_ACTIVE_FIELD_TRIALS_H_
#define COMPONENTS_VARIATIONS_ACTIVE_FIELD_TRIALS_H_
#include <stdint.h>
#include <string>
#include "base/metrics/field_trial.h"
#include "base/strings/string_piece.h"
namespace variations {
// The Unique ID of a trial and its active group, where the name and group
// identifiers are hashes of the trial and group name strings.
struct ActiveGroupId {
uint32_t name;
uint32_t group;
};
// Returns an ActiveGroupId struct for the given trial and group names.
ActiveGroupId MakeActiveGroupId(base::StringPiece trial_name,
base::StringPiece group_name);
// We need to supply a Compare class for templates since ActiveGroupId is a
// user-defined type.
struct ActiveGroupIdCompare {
bool operator() (const ActiveGroupId& lhs, const ActiveGroupId& rhs) const {
// The group and name fields are just SHA-1 Hashes, so we just need to treat
// them as IDs and do a less-than comparison. We test group first, since
// name is more likely to collide.
if (lhs.group != rhs.group)
return lhs.group < rhs.group;
return lhs.name < rhs.name;
}
};
// Fills the supplied vector |name_group_ids| (which must be empty when called)
// with unique ActiveGroupIds for each Field Trial that has a chosen group.
// Field Trials for which a group has not been chosen yet are NOT returned in
// this list. Field trial names are suffixed with |suffix| before hashing is
// executed.
void GetFieldTrialActiveGroupIds(base::StringPiece suffix,
std::vector<ActiveGroupId>* name_group_ids);
// Fills the supplied vector |output| (which must be empty when called) with
// unique string representations of ActiveGroupIds for each Field Trial that
// has a chosen group. The strings are formatted as "<TrialName>-<GroupName>",
// with the names as hex strings. Field Trials for which a group has not been
// chosen yet are NOT returned in this list. Field trial names are suffixed with
// |suffix| before hashing is executed.
void GetFieldTrialActiveGroupIdsAsStrings(base::StringPiece suffix,
std::vector<std::string>* output);
// TODO(rkaplow): Support suffixing for synthetic trials.
// Fills the supplied vector |output| (which must be empty when called) with
// unique string representations of ActiveGroupIds for each Syntehtic Trial
// group. The strings are formatted as "<TrialName>-<GroupName>",
// with the names as hex strings. Synthetic Field Trials for which a group
// which hasn't been chosen yet are NOT returned in this list.
void GetSyntheticTrialGroupIdsAsString(std::vector<std::string>* output);
// Sets the version of the seed that the current set of FieldTrials was
// generated from.
// TODO(crbug/507665): Move this to field_trials_provider once it moves
// into components/variations
void SetSeedVersion(const std::string& seed_version);
// Gets the version of the seed that the current set of FieldTrials was
// generated from.
// TODO(crbug/507665): Move this to field_trials_provider once it moves
// into components/variations
const std::string& GetSeedVersion();
// Expose some functions for testing. These functions just wrap functionality
// that is implemented above.
namespace testing {
void TestGetFieldTrialActiveGroupIds(
base::StringPiece suffix,
const base::FieldTrial::ActiveGroups& active_groups,
std::vector<ActiveGroupId>* name_group_ids);
} // namespace testing
} // namespace variations
#endif // COMPONENTS_VARIATIONS_ACTIVE_FIELD_TRIALS_H_
|
// RUN: jlang-cc -fsyntax-only -verify %s
#include <stddef.h>
typedef void (*hookfunc)(void *arg);
hookfunc hook;
void clear_hook() {
hook = NULL;
}
|
/*---------------------------------------------------------------------------
(c) 2004 Scorpio Software
19 Wittama Drive
Glenmore Park
Sydney NSW 2745
Australia
-----------------------------------------------------------------------------
$Workfile:: $
$Revision:: $
$Date:: $
$Author:: $
---------------------------------------------------------------------------*/
//---------------------------------------------------------------------------
#ifndef fVic20MultiColorPaletteH
#define fVic20MultiColorPaletteH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ComCtrls.hpp>
#include <ImgList.hpp>
#include <ToolWin.hpp>
#include <ExtCtrls.hpp>
#include <Buttons.hpp>
#include <Graphics.hpp>
//---------------------------------------------------------------------------
#include "..\ZXImageInterface.h"
#include "ZXVic20MultiColorPalette.h"
//---------------------------------------------------------------------------
namespace Scorpio
{
//using namespace ImageEditor;
namespace Vic20Palette
{
//---------------------------------------------------------------------------
class TfrmVic20MultiColorPalette : public TForm
{
__published: // IDE-managed Components
TPanel *panPalette;
TLabel *lblPalette;
TImage *imgLogo;
TLabel *lblResetPalette;
TLabel *lblVicBackground;
TLabel *lblVicBorder;
TLabel *lblVicCharacter;
TLabel *lblVicAuxiliary;
TPanel *panVicBackground;
TPanel *panVicBorder;
TPanel *panVicCharacter;
TPanel *panVicAuxiliary;
void __fastcall lblVicBackgroundClick(TObject *Sender);
void __fastcall panVicBackgroundClick(TObject *Sender);
void __fastcall lblResetPaletteClick(TObject *Sender);
private: // User declarations
ZXVic20MultiColorPalette m_Palette;
ZXImageInterface m_ImageEditor;
TZX_HPLUGIN m_PluginHandle;
void __fastcall OnUpdatePaletteGUI(void);
public: // User declarations
__fastcall TfrmVic20MultiColorPalette(TComponent* Owner);
HRESULT __fastcall Initialize(TZX_HPLUGIN PluginHandle, HINSTANCE hParentInstance);
HRESULT __fastcall Release(void);
HRESULT __fastcall GetPalette(ZXPalette*& Palette);
void __fastcall RefreshPanels(void);
};
//---------------------------------------------------------------------------
}
}
//---------------------------------------------------------------------------
extern PACKAGE Scorpio::Vic20Palette::TfrmVic20MultiColorPalette *frmVic20MultiColorPalette;
//---------------------------------------------------------------------------
#endif
|
/**
* Copyright (C) Mellanox Technologies Ltd. 2001-2015. ALL RIGHTS RESERVED.
* Copyright (c) UT-Battelle, LLC. 2014-2015. ALL RIGHTS RESERVED.
*
* See file LICENSE for terms.
*/
#ifndef UCT_KNEM_PD_H_
#define UCT_KNEM_PD_H_
#include <ucs/config/types.h>
#include <ucs/debug/memtrack.h>
#include <ucs/type/status.h>
#include <uct/tl/context.h>
extern uct_pd_component_t uct_knem_pd_component;
ucs_status_t uct_knem_pd_query(uct_pd_h pd, uct_pd_attr_t *pd_attr);
/**
* @brief KNEM PD descriptor
*/
typedef struct uct_knem_pd {
struct uct_pd super; /**< Domain info */
int knem_fd; /**< File descriptor for /dev/knem */
} uct_knem_pd_t;
/**
* @brief KNEM packed and remote key
*/
typedef struct uct_knem_key {
uint64_t cookie; /**< knem cookie */
uintptr_t address; /**< base addr for the registration */
} uct_knem_key_t;
#endif
|
//******************************************************************************
//
// Simple MIDI Library / SMMsgTransmitter
//
// メッセージ転送クラス
//
// Copyright (C) 2010-2012 WADA Masashi. All Rights Reserved.
//
//******************************************************************************
#import "SMMsgQueue.h"
//******************************************************************************
// パラメータ定義
//******************************************************************************
//メッセージ種別
#define SM_MSG_PLAY_STATUS (0x00)
#define SM_MSG_TIME (0x01)
#define SM_MSG_TEMPO (0x02)
#define SM_MSG_BAR (0x03)
#define SM_MSG_BEAT (0x04)
#define SM_MSG_NOTE_OFF (0x10)
#define SM_MSG_NOTE_ON (0x11)
#define SM_MSG_PITCHBEND (0x12)
#define SM_MSG_SKIP_START (0x13)
#define SM_MSG_SKIP_END (0x14)
#define SM_MSG_ALL_NOTE_OFF (0x15)
//演奏状態
#define SM_PLAYSTATUS_STOP (0x00)
#define SM_PLAYSTATUS_PLAY (0x01)
#define SM_PLAYSTATUS_PAUSE (0x02)
//スキップ方向
#define SM_SKIP_BACK (0x00)
#define SM_SKIP_FORWARD (0x01)
//******************************************************************************
// メッセージ転送クラス
//******************************************************************************
class SMMsgTransmitter
{
public:
//コンストラクタ/デストラクタ
SMMsgTransmitter(void);
virtual ~SMMsgTransmitter(void);
//初期化
int Initialize(SMMsgQueue* pMsgQueue);
//演奏状態
int PostPlayStatus(unsigned long playStatus);
//演奏時間通知
// 実時間(playTimeSec)は3byte(0x00FFFFFF)までの制限あり
int PostPlayTime(unsigned long playTimeMSec, unsigned long tickTime);
//テンポ通知
int PostTempo(unsigned long bpm);
//小節番号通知:1から開始
int PostBar(unsigned long barNo);
//拍子記号通知
// 分母は最大65535まで渡せるが
// MIDIの仕様では分子255/分母2の255乗まで表現できる
int PostBeat(unsigned short numerator, unsigned short denominator);
//ノートON通知
int PostNoteOn(
unsigned char portNo,
unsigned char chNo,
unsigned char noteNo,
unsigned char verocity
);
//ノートOFF通知
int PostNoteOff(
unsigned char portNo,
unsigned char chNo,
unsigned char noteNo
);
//ピッチベンド通知
int PostPitchBend(
unsigned char portNo,
unsigned char chNo,
short pitchBendValue,
unsigned char pitchBendSensitivity
);
//スキップ開始
int PostSkipStart(unsigned long skipDirection);
//スキップ終了
int PostSkipEnd(unsigned long notesCount);
//オールノートOFF
int PostAllNoteOff(
unsigned char portNo,
unsigned char chNo
);
private:
SMMsgQueue* m_pMsgQueue;
unsigned long m_MsgId;
int _Post(
unsigned char msg,
unsigned long param1, //3byteまで
unsigned long param2 //4byteまで
);
//代入とコピーコンストラクタの禁止
void operator=(const SMMsgTransmitter&);
SMMsgTransmitter(const SMMsgTransmitter&);
};
|
/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
#include "memcached.h"
#include "jenkins_hash.h"
#include "murmur3_hash.h"
/*²âÊÔ*/
int hash_init(enum hashfunc_type type) {
switch(type) {
case JENKINS_HASH:
hash = jenkins_hash;
settings.hash_algorithm = "jenkins";
break;
case MURMUR3_HASH:
hash = MurmurHash3_x86_32;
settings.hash_algorithm = "murmur3";
break;
default:
return -1;
}
return 0;
}
|
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_UI_SETTINGS_AUTOFILL_AUTOFILL_CONSTANTS_H_
#define IOS_CHROME_BROWSER_UI_SETTINGS_AUTOFILL_AUTOFILL_CONSTANTS_H_
#import <Foundation/Foundation.h>
extern NSString* const kAutofillProfileEditTableViewId;
extern NSString* const kAutofillProfileTableViewID;
extern NSString* const kAutofillPaymentMethodsToolbarId;
extern NSString* const kAutofillCreditCardTableViewId;
extern NSString* const kAutofillCreditCardSwitchViewId;
extern NSString* const kSettingsAddPaymentMethodButtonId;
#endif // IOS_CHROME_BROWSER_UI_SETTINGS_AUTOFILL_AUTOFILL_CONSTANTS_H_
|
// =======================================================================================
// BoundingBox
// =======================================================================================
///---------------------------------------------------------------------------------------
/// \brief Used for culling
///
/// # BoundingBox
/// Detailed description.....
/// Created on: 17-02-2013
///---------------------------------------------------------------------------------------
#pragma once
#include <Component.h>
#include <AglOBB.h>
class BoundingBox : public Component
{
public:
BoundingBox(AglOBB p_box): Component(ComponentType::BoundingBox)
{
box = p_box;
}
virtual ~BoundingBox()
{
}
AglOBB box;
}; |
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSSOM_CSS_RESOURCE_VALUE_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSSOM_CSS_RESOURCE_VALUE_H_
#include "base/macros.h"
#include "third_party/blink/renderer/core/css/cssom/css_style_value.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource.h"
namespace blink {
class CORE_EXPORT CSSResourceValue : public CSSStyleValue {
public:
~CSSResourceValue() override = default;
const String state() const {
switch (Status()) {
case ResourceStatus::kNotStarted:
return "unloaded";
case ResourceStatus::kPending:
return "loading";
case ResourceStatus::kCached:
return "loaded";
case ResourceStatus::kLoadError:
case ResourceStatus::kDecodeError:
return "error";
default:
NOTREACHED();
return "";
}
}
void Trace(Visitor* visitor) override { CSSStyleValue::Trace(visitor); }
protected:
CSSResourceValue() = default;
virtual ResourceStatus Status() const = 0;
private:
DISALLOW_COPY_AND_ASSIGN(CSSResourceValue);
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSSOM_CSS_RESOURCE_VALUE_H_
|
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_GL_INIT_OZONE_UTIL_H_
#define UI_GL_INIT_OZONE_UTIL_H_
#include "base/macros.h"
#include "ui/gl/gl_implementation.h"
#include "ui/ozone/public/gl_ozone.h"
#include "ui/ozone/public/ozone_platform.h"
#include "ui/ozone/public/surface_factory_ozone.h"
namespace gl {
namespace init {
inline ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() {
return ui::OzonePlatform::GetInstance()->GetSurfaceFactoryOzone();
}
// Returns true if there is an GLOzone for the specified GL implementation.
inline bool HasGLOzone(GLImplementation impl) {
return GetSurfaceFactoryOzone() && GetSurfaceFactoryOzone()->GetGLOzone(impl);
}
// Returns true if there is an GLOzone for the set GL implementation.
inline bool HasGLOzone() {
return HasGLOzone(GetGLImplementation());
}
// Returns the GLOzone for the specified GL implementation or null if none
// exists.
inline ui::GLOzone* GetGLOzone(GLImplementation impl) {
return GetSurfaceFactoryOzone()->GetGLOzone(impl);
}
// Returns the GLOzone for the set GL implementation or null if none exists.
inline ui::GLOzone* GetGLOzone() {
return GetGLOzone(GetGLImplementation());
}
} // namespace init
} // namespace gl
#endif // UI_GL_INIT_OZONE_UTIL_H_
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.