text stringlengths 4 6.14k |
|---|
/*
* Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* 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 DFGArgumentPosition_h
#define DFGArgumentPosition_h
#include "DFGDoubleFormatState.h"
#include "DFGVariableAccessData.h"
#include "DFGVariableAccessDataDump.h"
#include "SpeculatedType.h"
namespace JSC { namespace DFG {
class ArgumentPosition {
public:
ArgumentPosition()
: m_prediction(SpecNone)
, m_doubleFormatState(EmptyDoubleFormatState)
, m_isProfitableToUnbox(false)
, m_shouldNeverUnbox(false)
{
}
void addVariable(VariableAccessData* variable)
{
m_variables.append(variable);
}
VariableAccessData* someVariable() const
{
if (m_variables.isEmpty())
return 0;
return m_variables[0]->find();
}
FlushFormat flushFormat() const
{
if (VariableAccessData* variable = someVariable())
return variable->flushFormat();
return DeadFlush;
}
bool mergeShouldNeverUnbox(bool shouldNeverUnbox)
{
return checkAndSet(m_shouldNeverUnbox, m_shouldNeverUnbox | shouldNeverUnbox);
}
bool mergeArgumentPredictionAwareness()
{
bool changed = false;
for (unsigned i = 0; i < m_variables.size(); ++i) {
VariableAccessData* variable = m_variables[i]->find();
changed |= mergeSpeculation(m_prediction, variable->argumentAwarePrediction());
changed |= mergeDoubleFormatState(m_doubleFormatState, variable->doubleFormatState());
changed |= mergeShouldNeverUnbox(variable->shouldNeverUnbox());
}
if (!changed)
return false;
changed = false;
for (unsigned i = 0; i < m_variables.size(); ++i) {
VariableAccessData* variable = m_variables[i]->find();
changed |= variable->mergeArgumentAwarePrediction(m_prediction);
changed |= variable->mergeDoubleFormatState(m_doubleFormatState);
changed |= variable->mergeShouldNeverUnbox(m_shouldNeverUnbox);
}
return changed;
}
bool mergeArgumentUnboxingAwareness()
{
bool changed = false;
for (unsigned i = 0; i < m_variables.size(); ++i) {
VariableAccessData* variable = m_variables[i]->find();
changed |= checkAndSet(m_isProfitableToUnbox, m_isProfitableToUnbox | variable->isProfitableToUnbox());
}
if (!changed)
return false;
changed = false;
for (unsigned i = 0; i < m_variables.size(); ++i) {
VariableAccessData* variable = m_variables[i]->find();
changed |= variable->mergeIsProfitableToUnbox(m_isProfitableToUnbox);
}
return changed;
}
bool shouldUnboxIfPossible() const { return m_isProfitableToUnbox && !m_shouldNeverUnbox; }
SpeculatedType prediction() const { return m_prediction; }
DoubleFormatState doubleFormatState() const { return m_doubleFormatState; }
bool shouldUseDoubleFormat() const
{
return doubleFormatState() == UsingDoubleFormat && shouldUnboxIfPossible();
}
void dump(PrintStream& out, Graph* graph)
{
for (unsigned i = 0; i < m_variables.size(); ++i) {
VariableAccessData* variable = m_variables[i]->find();
int operand = variable->operand();
if (i)
out.print(" ");
if (operandIsArgument(operand))
out.print("arg", operandToArgument(operand), "(", VariableAccessDataDump(*graph, variable), ")");
else
out.print("r", operand, "(", VariableAccessDataDump(*graph, variable), ")");
}
out.print("\n");
}
private:
SpeculatedType m_prediction;
DoubleFormatState m_doubleFormatState;
bool m_isProfitableToUnbox;
bool m_shouldNeverUnbox;
Vector<VariableAccessData*, 2> m_variables;
};
} } // namespace JSC::DFG
#endif // DFGArgumentPosition_h
|
/*
* $Id: _default_types.h,v 1.3 2012/10/16 18:45:23 corinna Exp $
*/
#ifndef _MACHINE__DEFAULT_TYPES_H
#define _MACHINE__DEFAULT_TYPES_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* Guess on types by examining *_MIN / *_MAX defines.
*/
/* GCC >= 3.3.0 has __<val>__ implicitly defined. */
#define __EXP(x) __##x##__
#if __EXP(SCHAR_MAX) == 0x7f
typedef signed char __int8_t;
typedef unsigned char __uint8_t;
#define ___int8_t_defined 1
#endif
#if __EXP(INT_MAX) == 0x7fff
typedef signed int __int16_t;
typedef unsigned int __uint16_t;
#define ___int16_t_defined 1
#elif __EXP(SHRT_MAX) == 0x7fff
typedef signed short __int16_t;
typedef unsigned short __uint16_t;
#define ___int16_t_defined 1
#elif __EXP(SCHAR_MAX) == 0x7fff
typedef signed char __int16_t;
typedef unsigned char __uint16_t;
#define ___int16_t_defined 1
#endif
#if ___int16_t_defined
typedef __int16_t __int_least16_t;
typedef __uint16_t __uint_least16_t;
#define ___int_least16_t_defined 1
#if !___int8_t_defined
typedef __int16_t __int_least8_t;
typedef __uint16_t __uint_least8_t;
#define ___int_least8_t_defined 1
#endif
#endif
#if __EXP(INT_MAX) == 0x7fffffffL
typedef signed int __int32_t;
typedef unsigned int __uint32_t;
#define ___int32_t_defined 1
#elif __EXP(LONG_MAX) == 0x7fffffffL
typedef signed long __int32_t;
typedef unsigned long __uint32_t;
#define ___int32_t_defined 1
#elif __EXP(SHRT_MAX) == 0x7fffffffL
typedef signed short __int32_t;
typedef unsigned short __uint32_t;
#define ___int32_t_defined 1
#elif __EXP(SCHAR_MAX) == 0x7fffffffL
typedef signed char __int32_t;
typedef unsigned char __uint32_t;
#define ___int32_t_defined 1
#endif
#if ___int32_t_defined
typedef __int32_t __int_least32_t;
typedef __uint32_t __uint_least32_t;
#define ___int_least32_t_defined 1
#if !___int8_t_defined
typedef __int32_t __int_least8_t;
typedef __uint32_t __uint_least8_t;
#define ___int_least8_t_defined 1
#endif
#if !___int16_t_defined
typedef __int32_t __int_least16_t;
typedef __uint32_t __uint_least16_t;
#define ___int_least16_t_defined 1
#endif
#endif
#if __EXP(LONG_MAX) > 0x7fffffff
typedef signed long __int64_t;
typedef unsigned long __uint64_t;
#define ___int64_t_defined 1
/* GCC has __LONG_LONG_MAX__ */
#elif defined(__LONG_LONG_MAX__) && (__LONG_LONG_MAX__ > 0x7fffffff)
typedef signed long long __int64_t;
typedef unsigned long long __uint64_t;
#define ___int64_t_defined 1
/* POSIX mandates LLONG_MAX in <limits.h> */
#elif defined(LLONG_MAX) && (LLONG_MAX > 0x7fffffff)
typedef signed long long __int64_t;
typedef unsigned long long __uint64_t;
#define ___int64_t_defined 1
#elif __EXP(INT_MAX) > 0x7fffffff
typedef signed int __int64_t;
typedef unsigned int __uint64_t;
#define ___int64_t_defined 1
#endif
#undef __EXP
#ifdef __cplusplus
}
#endif
#endif /* _MACHINE__DEFAULT_TYPES_H */
|
#ifndef APPLICATIONCONTROLLER_H
#define APPLICATIONCONTROLLER_H
#include <TActionController>
#include "applicationhelper.h"
class T_CONTROLLER_EXPORT ApplicationController : public TActionController
{
Q_OBJECT
public:
Q_INVOKABLE
ApplicationController();
virtual ~ApplicationController();
public slots:
void staticInitialize();
void staticRelease();
protected:
virtual bool preFilter() override;
virtual void postFilter() override;
QString recentAccessPath() const;
};
#endif // APPLICATIONCONTROLLER_H
|
/* $NetBSD: svr4_ulimit.h,v 1.3 1998/09/04 19:54:41 christos Exp $ */
/*-
* Copyright (c) 1994 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Christos Zoulas.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _SVR4_ULIMIT_H_
#define _SVR4_ULIMIT_H_
#define SVR4_GFILLIM 1
#define SVR4_SFILLIM 2
#define SVR4_GMEMLIM 3
#define SVR4_GDESLIM 4
#define SVR4_GTXTOFF 64
#endif /* !_SVR4_ULIMIT_H_ */
|
//
// Created by Gabriel Handford on 3/1/09.
// Copyright 2009-2013. All rights reserved.
// Created by John Boiles on 10/20/11.
// Copyright (c) 2011. All rights reserved
// Modified by Felix Schulze on 2/11/13.
// Copyright 2013. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// ABI9_0_0EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#import <UIKit/UIKit.h>
@interface UIImage (Diff)
- (UIImage *)diffWithImage:(UIImage *)image;
@end
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_COMMON_VIEW_MESSAGES_ENUMS_H_
#define CONTENT_COMMON_VIEW_MESSAGES_ENUMS_H_
struct ViewHostMsg_AccEvent {
enum Value {
// The active descendant of a node has changed.
ACTIVE_DESCENDANT_CHANGED,
// An alert appeared.
ALERT,
// The node checked state has changed.
CHECK_STATE_CHANGED,
// The node tree structure has changed.
CHILDREN_CHANGED,
// The node in focus has changed.
FOCUS_CHANGED,
// Page layout has completed.
LAYOUT_COMPLETE,
// Content within a part of the page marked as a live region changed.
LIVE_REGION_CHANGED,
// The document node has loaded.
LOAD_COMPLETE,
// A menu list value changed.
MENU_LIST_VALUE_CHANGED,
// An object was shown.
OBJECT_SHOW,
// An object was hidden.
OBJECT_HIDE,
// The number of rows in a grid or tree control changed.
ROW_COUNT_CHANGED,
// A row in a grid or tree control was collapsed.
ROW_COLLAPSED,
// A row in a grid or tree control was expanded.
ROW_EXPANDED,
// The document was scrolled to an anchor node.
SCROLLED_TO_ANCHOR,
// One or more selected children of this node have changed.
SELECTED_CHILDREN_CHANGED,
// The text cursor or selection changed.
SELECTED_TEXT_CHANGED,
// Text was inserted in a node with text content.
TEXT_INSERTED,
// Text was removed in a node with text content.
TEXT_REMOVED,
// The node value has changed.
VALUE_CHANGED,
};
};
// Values that may be OR'd together to form the 'flags' parameter of a
// ViewHostMsg_UpdateRect_Params structure.
struct ViewHostMsg_UpdateRect_Flags {
enum {
IS_RESIZE_ACK = 1 << 0,
IS_RESTORE_ACK = 1 << 1,
IS_REPAINT_ACK = 1 << 2,
};
static bool is_resize_ack(int flags) {
return (flags & IS_RESIZE_ACK) != 0;
}
static bool is_restore_ack(int flags) {
return (flags & IS_RESTORE_ACK) != 0;
}
static bool is_repaint_ack(int flags) {
return (flags & IS_REPAINT_ACK) != 0;
}
};
struct ViewMsg_Navigate_Type {
public:
enum Value {
// Reload the page.
RELOAD,
// Reload the page, ignoring any cache entries.
RELOAD_IGNORING_CACHE,
// Reload the page using the original URL.
RELOAD_WITH_ORIGINAL_URL,
// The navigation is the result of session restore and should honor the
// page's cache policy while restoring form state. This is set to true if
// restoring a tab/session from the previous session and the previous
// session did not crash. If this is not set and the page was restored then
// the page's cache policy is ignored and we load from the cache.
RESTORE,
// Navigation type not categorized by the other types.
NORMAL
};
};
#endif // CONTENT_COMMON_VIEW_MESSAGES_ENUMS_H_
|
/*
* Copyright (c) 2014 Gerard Green
* All rights reserved
*
* Please see the file 'LICENSE' for further information
*/
#ifndef _SYS_SOCKET_H_INCLUDED
#define _SYS_SOCKET_H_INCLUDED
#include <sys/anvil_internal.h>
#if !defined (_Anvil_got_socklen_t)
typedef _Anvil_socklen_t socklen_t;
#define _Anvil_got_socklen_t
#endif
#define SOCK_DGRAM 1
#define SOCK_RAW 2
#define SOCK_SEQPACKET 3
#define SOCK_STREAM 4
#endif /* _SYS_SOCKET_H_INCLUDED */
|
/*
* Render system/context access header
*
* This file is part of the "ForkENGINE" (Copyright (c) 2014 by Lukas Hermanns)
* See "LICENSE.txt" for license information.
*/
#ifndef __FORK_RENDER_SYS_CTX_H__
#define __FORK_RENDER_SYS_CTX_H__
#include "Core/StaticConfig.h"
#include "Video/RenderSystem/RenderSystemException.h"
#include "Video/RenderSystem/RenderContextException.h"
static inline Fork::Video::RenderSystem* RenderSys()
{
#ifdef FORK_DEBUG
auto renderSystem = Fork::Video::RenderSystem::Active();
if (!renderSystem)
throw Fork::RenderSystemException("Render system required but none is active");
return renderSystem;
#else
return Fork::Video::RenderSystem::Active();
#endif
}
static inline Fork::Video::RenderContext* RenderCtx()
{
#ifdef FORK_DEBUG
auto renderContext = Fork::Video::RenderContext::Active();
if (!renderContext)
throw Fork::RenderContextException("Render context required but none is active");
return renderContext;
#else
return Fork::Video::RenderContext::Active();
#endif
}
#endif
// ======================== |
// Copyright 2017 The BerryDB 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 BERRYDB_INCLUDE_BERRYDB_CATALOG_H_
#define BERRYDB_INCLUDE_BERRYDB_CATALOG_H_
#include "berrydb/span.h"
#include "berrydb/types.h"
namespace berrydb {
class Space;
enum class Status : int;
/** A directory of other catalogs and key/value namespaces.
*
* A catalog is a key/value namespace, where the keys are byte sequences (C++
* std::strings) and the values are other catalogs or spaces, which hold user
* data.
*
* Catalogs are accessed and modified outside the transaction system. Each
* operation on a catalog implicitly executes in its own transaction. The user
* is responsible for avoiding data races.
*/
class Catalog {
/** Opens a catalog listed in this catalog.
*
* No other change operation (Create* / Delete*) may be issued concurrently
* on this catalog.
*
* @param name the name of the catalog to be opened
* @param result if the operation succeeds, receives a pointer to the opened
* catalog
* @return kNotFound if the catalog does not contain an entry with the
* given name; otherwise, most likely kSuccess or kIoError
*/
std::tuple<Status, Catalog*> OpenCatalog(span<const uint8_t> name);
/** Opens a (key/value name)space listed in this catalog.
*
* No other change operation (Create* / Delete*) may be issued concurrently
* on this catalog.
*
* @param name the name of the catalog to be opened
* @param result if the operation succeeds, receives a pointer to the opened
* space
* @return kNotFound if the catalog does not contain an entry with the
* given name; otherwise, most likely kSuccess or kIoError
*/
std::tuple<Status, Space*> OpenSpace(span<const uint8_t> name);
/** Releases the memory associated with the catalog.
*
* This must not be called during an operation, such as
* Transaction::CreateSpace(), that received the catalog as an argument.
* After the operation completes, the catalog can be released, even
* if the transaction is still alive.
*/
void Release();
private:
friend class CatalogImpl;
/**
* Create instances via Store::RootCatalog() and Catalog/Transaction methods.
*/
constexpr Catalog() noexcept = default;
/** Use Release() to destroy Catalog instances. */
~Catalog() noexcept = default;
};
} // namespace berrydb
#endif // BERRYDB_INCLUDE_BERRYDB_CATALOG_H_
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE78_OS_Command_Injection__wchar_t_connect_socket_system_42.c
Label Definition File: CWE78_OS_Command_Injection.one_string.label.xml
Template File: sources-sink-42.tmpl.c
*/
/*
* @description
* CWE: 78 OS Command Injection
* BadSource: connect_socket Read data using a connect socket (client side)
* GoodSource: Fixed string
* Sink: system
* BadSink : Execute command in data using system()
* Flow Variant: 42 Data flow: data returned from one function to another in the same source file
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifdef _WIN32
#define FULL_COMMAND L"dir "
#else
#include <unistd.h>
#define FULL_COMMAND L"ls "
#endif
#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#include <direct.h>
#pragma comment(lib, "ws2_32") /* include ws2_32.lib when linking */
#define CLOSE_SOCKET closesocket
#else /* NOT _WIN32 */
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#define INVALID_SOCKET -1
#define SOCKET_ERROR -1
#define CLOSE_SOCKET close
#define SOCKET int
#endif
#define TCP_PORT 27015
#define IP_ADDRESS "127.0.0.1"
#ifdef _WIN32
#define SYSTEM _wsystem
#else /* NOT _WIN32 */
#define SYSTEM system
#endif
#ifndef OMITBAD
static wchar_t * badSource(wchar_t * data)
{
{
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
wchar_t *replace;
SOCKET connectSocket = INVALID_SOCKET;
size_t dataLen = wcslen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
/* POTENTIAL FLAW: Read data using a connect socket */
connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (connectSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = inet_addr(IP_ADDRESS);
service.sin_port = htons(TCP_PORT);
if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed, make sure to recv one
* less char than is in the recv_buf in order to append a terminator */
/* Abort on error or the connection was closed */
recvResult = recv(connectSocket, (char *)(data + dataLen), sizeof(wchar_t) * (100 - dataLen - 1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[dataLen + recvResult / sizeof(wchar_t)] = L'\0';
/* Eliminate CRLF */
replace = wcschr(data, L'\r');
if (replace)
{
*replace = L'\0';
}
replace = wcschr(data, L'\n');
if (replace)
{
*replace = L'\0';
}
}
while (0);
if (connectSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(connectSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
}
return data;
}
void CWE78_OS_Command_Injection__wchar_t_connect_socket_system_42_bad()
{
wchar_t * data;
wchar_t data_buf[100] = FULL_COMMAND;
data = data_buf;
data = badSource(data);
/* POTENTIAL FLAW: Execute command in data possibly leading to command injection */
if (SYSTEM(data) != 0)
{
printLine("command execution failed!");
exit(1);
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
static wchar_t * goodG2BSource(wchar_t * data)
{
/* FIX: Append a fixed string to data (not user / external input) */
wcscat(data, L"*.*");
return data;
}
/* goodG2B uses the GoodSource with the BadSink */
static void goodG2B()
{
wchar_t * data;
wchar_t data_buf[100] = FULL_COMMAND;
data = data_buf;
data = goodG2BSource(data);
/* POTENTIAL FLAW: Execute command in data possibly leading to command injection */
if (SYSTEM(data) != 0)
{
printLine("command execution failed!");
exit(1);
}
}
void CWE78_OS_Command_Injection__wchar_t_connect_socket_system_42_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()...");
CWE78_OS_Command_Injection__wchar_t_connect_socket_system_42_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE78_OS_Command_Injection__wchar_t_connect_socket_system_42_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
/*
*
* Copyright 2015, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef GRPC_END2END_TEST_CLIENT_H
#define GRPC_END2END_TEST_CLIENT_H
#include <grpc_c/grpc_c.h>
void test_client_send_unary_rpc(GRPC_channel *channel, int repeat);
void test_client_send_client_streaming_rpc(GRPC_channel *channel, int repeat);
void test_client_send_server_streaming_rpc(GRPC_channel *channel, int repeat);
void test_client_send_bidi_streaming_rpc(GRPC_channel *channel, int repeat);
void test_client_send_async_unary_rpc(GRPC_channel *channel, int repeat);
#endif // GRPC_END2END_TEST_CLIENT_H
|
#include <stddef.h>
#include <assert.h>
#include "sun3_machine_types.h"
#include "sun3_data_regs.h"
void sun3_data_regs_write_unsigned_byte(sun3_data_regs *regs,
size_t reg,
sun3_unsigned_byte value)
{
assert(reg < sun3_data_regs_nregs);
regs->regs[reg]= (regs->regs[reg]&~0xff)|value;
}
void sun3_data_regs_write_unsigned_word(sun3_data_regs *regs,
size_t reg,
sun3_unsigned_word value)
{
assert(reg < sun3_data_regs_nregs);
regs->regs[reg]= (regs->regs[reg]&~0xffff)|value;
}
void sun3_data_regs_write_unsigned_long(sun3_data_regs *regs,
size_t reg,
sun3_unsigned_long value)
{
assert(reg < sun3_data_regs_nregs);
regs->regs[reg]= value;
}
void sun3_data_regs_write_signed_byte(sun3_data_regs *regs,
size_t reg,
sun3_signed_byte value)
{
assert(reg < sun3_data_regs_nregs);
regs->regs[reg]= (regs->regs[reg]&~0xff)|value;
}
void sun3_data_regs_write_signed_word(sun3_data_regs *regs,
size_t reg,
sun3_signed_word value)
{
assert(reg < sun3_data_regs_nregs);
regs->regs[reg]= (regs->regs[reg]&~0xffff)|value;
}
void sun3_data_regs_write_signed_long(sun3_data_regs *regs,
size_t reg,
sun3_signed_long value)
{
assert(reg < sun3_data_regs_nregs);
regs->regs[reg]= value;
}
sun3_unsigned_byte sun3_data_regs_read_unsigned_byte(sun3_data_regs * regs, size_t reg)
{
assert(reg < sun3_data_regs_nregs);
return (sun3_unsigned_byte)regs->regs[reg];
}
sun3_unsigned_word sun3_data_regs_read_unsigned_word(sun3_data_regs * regs, size_t reg)
{
assert(reg < sun3_data_regs_nregs);
return (sun3_unsigned_word)regs->regs[reg];
}
sun3_unsigned_long sun3_data_regs_read_unsigned_long(sun3_data_regs * regs, size_t reg)
{
assert(reg < sun3_data_regs_nregs);
return regs->regs[reg];
}
sun3_signed_byte sun3_data_regs_read_signed_byte(sun3_data_regs * regs, size_t reg)
{
return (sun3_signed_byte)sun3_data_regs_read_unsigned_byte(regs, reg);
}
sun3_signed_word sun3_data_regs_read_signed_word(sun3_data_regs * regs, size_t reg)
{
return (sun3_signed_word)sun3_data_regs_read_unsigned_word(regs, reg);
}
sun3_signed_long sun3_data_regs_read_signed_long(sun3_data_regs * regs, size_t reg)
{
return (sun3_signed_long)sun3_data_regs_read_unsigned_long(regs, reg);
}
|
/*
* FreeRTOS Kernel V10.1.1
* Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* http://www.FreeRTOS.org
* http://aws.amazon.com/freertos
*
* 1 tab == 4 spaces!
*/
/*-----------------------------------------------------------
* Normally, a demo application would define ParTest (parallel port test)
* functions to write to an LED. In this case, four '*' symbols that are
* output to the debug printf() port are used to simulate LED outputs.
*-----------------------------------------------------------*/
/* Standard includes. */
#include <stdio.h>
#include <string.h>
/* Library includes. */
#include "lpc43xx_i2c.h"
/* Kernel includes. */
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
/* Standard demo include. */
#include "partest.h"
/* The number of LED outputs. */
#define partstMAX_LEDS 4
/* Commands written to the PCA9502. */
#define partstIO_WRITE_COMMAND ( ( unsigned char ) ( 0x0BU << 3U ) )
#define partstIO_DIR_COMMAND ( ( unsigned char ) ( 0x0AU << 3U ) )
#define partstSLAVE_ADDRESS ( ( unsigned char ) ( 0x9AU >> 1U ) )
/* Just defines the length of the queue used to pass toggle commands to the I2C
gatekeeper task. */
#define partstLED_COMMAND_QUEUE_LENGTH ( 6 )
/*-----------------------------------------------------------*/
/*
* The LEDs are connected to an I2C port expander. Therefore, writing to an
* LED takes longer than might be expected if the LED was connected directly
* to a GPIO pin. As several tasks, and a timer, toggle LEDs, it is convenient
* to use a gatekeeper task to ensure access is both mutually exclusive and
* serialised. Tasks other than this gatekeeper task must not access the I2C
* port directly.
*/
static void prvI2CGateKeeperTask( void *pvParameters );
/* The queue used to communicate toggle commands with the I2C gatekeeper
task. */
static QueueHandle_t xI2CCommandQueue = NULL;
/*-----------------------------------------------------------*/
void vParTestInitialise( void )
{
unsigned char ucBuffer[ 2 ];
I2C_M_SETUP_Type xI2CMessage;
/* The LEDs are on an I2C IO expander. Initialise the I2C interface. */
I2C_Init( LPC_I2C0, 300000 );
I2C_Cmd( LPC_I2C0, ENABLE );
/* GPIO0-GPIO2 to output. */
ucBuffer[ 0 ] = partstIO_DIR_COMMAND;
ucBuffer[ 1 ] = 0x0f;
xI2CMessage.sl_addr7bit = partstSLAVE_ADDRESS;
xI2CMessage.tx_data = ucBuffer ;
xI2CMessage.tx_length = sizeof( ucBuffer );
xI2CMessage.rx_data = NULL;
xI2CMessage.rx_length = 0;
xI2CMessage.retransmissions_max = 3;
I2C_MasterTransferData( LPC_I2C0, &xI2CMessage, I2C_TRANSFER_POLLING );
/* Create the mutex used to guard access to the I2C bus. */
xI2CCommandQueue = xQueueCreate( partstLED_COMMAND_QUEUE_LENGTH, sizeof( unsigned char ) );
configASSERT( xI2CCommandQueue );
/* Create the I2C gatekeeper task itself. */
xTaskCreate( prvI2CGateKeeperTask, "I2C", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );
}
/*-----------------------------------------------------------*/
void vParTestToggleLED( unsigned long ulLED )
{
unsigned char ucLED = ( unsigned char ) ulLED;
/* Only the gatekeeper task will actually access the I2C port, so send the
toggle request to the gatekeeper task. A block time of zero is used as
this function is called by a software timer callback. */
xQueueSend( xI2CCommandQueue, &ucLED, 0UL );
}
/*-----------------------------------------------------------*/
static void prvI2CGateKeeperTask( void *pvParameters )
{
unsigned char ucBuffer[ 2 ], ucLED;
static unsigned char ucLEDState = 0xffU;
static I2C_M_SETUP_Type xI2CMessage; /* Static so it is not on the stack as this is called from task code. */
/* Just to remove compiler warnings. */
( void ) pvParameters;
for( ;; )
{
/* Wait for the next command. */
xQueueReceive( xI2CCommandQueue, &ucLED, portMAX_DELAY );
/* Only this task is allowed to touch the I2C port, so there is no need
for additional mutual exclusion. */
if( ucLED < partstMAX_LEDS )
{
/* Which bit is being manipulated? */
ucLED = 0x01 << ucLED;
/* Is the bit currently set or clear? */
if( ( ucLEDState & ucLED ) == 0U )
{
ucLEDState |= ucLED;
}
else
{
ucLEDState &= ~ucLED;
}
ucBuffer[ 0 ] = partstIO_WRITE_COMMAND;
ucBuffer[ 1 ] = ucLEDState;
xI2CMessage.sl_addr7bit = partstSLAVE_ADDRESS;
xI2CMessage.tx_data = ucBuffer ;
xI2CMessage.tx_length = sizeof( ucBuffer );
xI2CMessage.rx_data = NULL;
xI2CMessage.rx_length = 0;
xI2CMessage.retransmissions_max = 3;
I2C_MasterTransferData( LPC_I2C0, &xI2CMessage, I2C_TRANSFER_POLLING );
}
}
}
/*-----------------------------------------------------------*/
|
//=================================================================================================
/*!
// \file blaze/math/traits/TDVecSMatMultExprTrait.h
// \brief Header file for the TDVecSMatMultExprTrait class template
//
// Copyright (C) 2013 Klaus Iglberger - All Rights Reserved
//
// This file is part of the Blaze library. You can redistribute it and/or modify it under
// the terms of the New (Revised) BSD License. Redistribution and use in source and binary
// forms, with or without modification, are permitted provided that the following conditions
// are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other materials
// provided with the distribution.
// 3. Neither the names of the Blaze development group 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 _BLAZE_MATH_TRAITS_TDVECSMATMULTEXPRTRAIT_H_
#define _BLAZE_MATH_TRAITS_TDVECSMATMULTEXPRTRAIT_H_
//*************************************************************************************************
// Includes
//*************************************************************************************************
#include <blaze/math/expressions/Forward.h>
#include <blaze/math/typetraits/IsDenseVector.h>
#include <blaze/math/typetraits/IsRowMajorMatrix.h>
#include <blaze/math/typetraits/IsRowVector.h>
#include <blaze/math/typetraits/IsSparseMatrix.h>
#include <blaze/util/InvalidType.h>
#include <blaze/util/SelectType.h>
#include <blaze/util/typetraits/IsConst.h>
#include <blaze/util/typetraits/IsReference.h>
#include <blaze/util/typetraits/IsVolatile.h>
#include <blaze/util/typetraits/RemoveCV.h>
#include <blaze/util/typetraits/RemoveReference.h>
namespace blaze {
//=================================================================================================
//
// CLASS DEFINITION
//
//=================================================================================================
//*************************************************************************************************
/*!\brief Evaluation of the expression type of a dense vector/sparse matrix multiplication.
// \ingroup math_traits
//
// Via this type trait it is possible to evaluate the resulting expression type of a dense
// vector/sparse matrix multiplication. Given the transpose dense vector type \a VT and the
// row-major sparse matrix type \a MT, the nested type \a Type corresponds to the resulting
// expression type. In case either \a VT is not a transpose dense vector type or \a MT is
// not a row-major sparse matrix type, the resulting data type \a Type is set to \a INVALID_TYPE.
*/
template< typename VT // Type of the left-hand side transpose dense vector
, typename MT > // Type of the right-hand side row-major dense sparse
struct TDVecSMatMultExprTrait
{
private:
//**********************************************************************************************
/*! \cond BLAZE_INTERNAL */
enum { qualified = IsConst<VT>::value || IsVolatile<VT>::value || IsReference<VT>::value ||
IsConst<MT>::value || IsVolatile<MT>::value || IsReference<MT>::value };
/*! \endcond */
//**********************************************************************************************
//**********************************************************************************************
/*! \cond BLAZE_INTERNAL */
typedef SelectType< IsDenseVector<VT>::value && IsRowVector<VT>::value &&
IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value
, TDVecSMatMultExpr<VT,MT>, INVALID_TYPE > Tmp;
typedef typename RemoveReference< typename RemoveCV<VT>::Type >::Type Type1;
typedef typename RemoveReference< typename RemoveCV<MT>::Type >::Type Type2;
/*! \endcond */
//**********************************************************************************************
public:
//**********************************************************************************************
/*! \cond BLAZE_INTERNAL */
typedef typename SelectType< qualified, TDVecSMatMultExprTrait<Type1,Type2>, Tmp >::Type::Type Type;
/*! \endcond */
//**********************************************************************************************
};
//*************************************************************************************************
} // namespace blaze
#endif
|
/*
* FreeRTOS Kernel V10.1.1
* Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* http://www.FreeRTOS.org
* http://aws.amazon.com/freertos
*
* 1 tab == 4 spaces!
*/
#ifndef STATIC_ALLOCATION_H
#define STATIC_ALLOCATION_H
void vStartStaticallyAllocatedTasks( void );
BaseType_t xAreStaticAllocationTasksStillRunning( void );
#endif /* STATIC_ALLOCATION_H */
|
/* file: $RCSfile: v3dot.c,v $
** rcsid: $Id: v3dot.c 261 2007-10-19 19:07:02Z laidler $
** Copyright Jeffrey W Percival
** *******************************************************************
** Space Astronomy Laboratory
** University of Wisconsin
** 1150 University Avenue
** Madison, WI 53706 USA
** *******************************************************************
** Do not use this software without attribution.
** Do not remove or alter any of the lines above.
** *******************************************************************
*/
/*
** *******************************************************************
** $RCSfile: v3dot.c,v $ - 3-vector dot product
** *******************************************************************
*/
#include "vec.h"
double
v3dot(V3 v1, V3 v2)
{
double x = 0;
if (v3GetType(v1) == SPHERICAL) {
v1 = v3s2c(v1);
}
if (v3GetType(v2) == SPHERICAL) {
v2 = v3s2c(v2);
}
x += v3GetX(v1) * v3GetX(v2);
x += v3GetY(v1) * v3GetY(v2);
x += v3GetZ(v1) * v3GetZ(v2);
return(x);
}
|
/* zptsv.f -- translated by f2c (version 20061008).
You must link the resulting object file with libf2c:
on Microsoft Windows system, link with libf2c.lib;
on Linux or Unix systems, link with .../path/to/libf2c.a -lm
or, if you install libf2c.a in a standard place, with -lf2c -lm
-- in that order, at the end of the command line, as in
cc *.o -lf2c -lm
Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
http://www.netlib.org/f2c/libf2c.zip
*/
#include "f2c.h"
#include "blaswrap.h"
/* Subroutine */ int zptsv_(integer *n, integer *nrhs, doublereal *d__,
doublecomplex *e, doublecomplex *b, integer *ldb, integer *info)
{
/* System generated locals */
integer b_dim1, b_offset, i__1;
/* Local variables */
/* -- LAPACK routine (version 3.2) -- */
/* November 2006 */
/* Purpose */
/* ======= */
/* ZPTSV computes the solution to a complex system of linear equations */
/* A*X = B, where A is an N-by-N Hermitian positive definite tridiagonal */
/* matrix, and X and B are N-by-NRHS matrices. */
/* A is factored as A = L*D*L**H, and the factored form of A is then */
/* used to solve the system of equations. */
/* Arguments */
/* ========= */
/* N (input) INTEGER */
/* The order of the matrix A. N >= 0. */
/* NRHS (input) INTEGER */
/* The number of right hand sides, i.e., the number of columns */
/* of the matrix B. NRHS >= 0. */
/* D (input/output) DOUBLE PRECISION array, dimension (N) */
/* On entry, the n diagonal elements of the tridiagonal matrix */
/* A. On exit, the n diagonal elements of the diagonal matrix */
/* D from the factorization A = L*D*L**H. */
/* E (input/output) COMPLEX*16 array, dimension (N-1) */
/* On entry, the (n-1) subdiagonal elements of the tridiagonal */
/* matrix A. On exit, the (n-1) subdiagonal elements of the */
/* unit bidiagonal factor L from the L*D*L**H factorization of */
/* A. E can also be regarded as the superdiagonal of the unit */
/* bidiagonal factor U from the U**H*D*U factorization of A. */
/* B (input/output) COMPLEX*16 array, dimension (LDB,N) */
/* On entry, the N-by-NRHS right hand side matrix B. */
/* On exit, if INFO = 0, the N-by-NRHS solution matrix X. */
/* LDB (input) INTEGER */
/* The leading dimension of the array B. LDB >= max(1,N). */
/* INFO (output) INTEGER */
/* = 0: successful exit */
/* < 0: if INFO = -i, the i-th argument had an illegal value */
/* > 0: if INFO = i, the leading minor of order i is not */
/* positive definite, and the solution has not been */
/* computed. The factorization has not been completed */
/* unless i = N. */
/* ===================================================================== */
/* Test the input parameters. */
/* Parameter adjustments */
--d__;
--e;
b_dim1 = *ldb;
b_offset = 1 + b_dim1;
b -= b_offset;
/* Function Body */
*info = 0;
if (*n < 0) {
*info = -1;
} else if (*nrhs < 0) {
*info = -2;
} else if (*ldb < max(1,*n)) {
*info = -6;
}
if (*info != 0) {
i__1 = -(*info);
xerbla_("ZPTSV ", &i__1);
return 0;
}
/* Compute the L*D*L' (or U'*D*U) factorization of A. */
zpttrf_(n, &d__[1], &e[1], info);
if (*info == 0) {
/* Solve the system A*X = B, overwriting B with X. */
zpttrs_("Lower", n, nrhs, &d__[1], &e[1], &b[b_offset], ldb, info);
}
return 0;
/* End of ZPTSV */
} /* zptsv_ */
|
// clang-format off
ksNew (128,
keyNew (PREFIX,
KEY_META, "comment/#1/start", "",
KEY_META, "comment/#1/space", "0",
KEY_META, "comment/#2/", " Comment on second-to-last line",
KEY_META, "comment/#2/start", "#",
KEY_META, "comment/#2/space", "0",
KEY_META, "comment/#3/", " Comment on last (non-empty) line",
KEY_META, "comment/#3/start", "#",
KEY_META, "comment/#3/space", "0",
KEY_META, "comment/#4/start", "",
KEY_META, "comment/#4/space", "0",
KEY_END),
keyNew (PREFIX "/a",
KEY_VALUE, "3",
KEY_META, "type", "long_long",
KEY_META, "order", "0",
KEY_META, "comment/#0", " Inline comment after keypair",
KEY_META, "comment/#0/start", "#",
KEY_META, "comment/#0/space", "3",
KEY_META, "comment/#1", " Comment on first line",
KEY_META, "comment/#1/start", "#",
KEY_META, "comment/#1/space", "0",
KEY_META, "comment/#2/start", "",
KEY_META, "comment/#2/space", "0",
KEY_END),
keyNew (PREFIX "/array",
KEY_META, "array", "#2",
KEY_META, "order", "1",
KEY_META, "comment/#0", " Inline comment after array",
KEY_META, "comment/#0/start", "#",
KEY_META, "comment/#0/space", "3",
KEY_META, "comment/#1/start", "",
KEY_META, "comment/#1/space", "0",
KEY_META, "comment/#2", " Comment #1 on full line",
KEY_META, "comment/#2/start", "#",
KEY_META, "comment/#2/space", "0",
KEY_META, "comment/#3", " Comment #2 on full line",
KEY_META, "comment/#3/start", "#",
KEY_META, "comment/#3/space", "0",
KEY_META, "comment/#4/start", "",
KEY_META, "comment/#4/space", "0",
KEY_END),
keyNew (PREFIX "/array/#0",
KEY_VALUE, "1",
KEY_META, "type", "long_long",
KEY_META, "comment/#0", " Comment after first value of array",
KEY_META, "comment/#0/start", "#",
KEY_META, "comment/#0/space", "2",
KEY_META, "comment/#1", " Comment directly after array opening brackets, before first value",
KEY_META, "comment/#1/start", "#",
KEY_META, "comment/#1/space", "3",
KEY_END),
keyNew (PREFIX "/array/#1",
KEY_VALUE, "2",
KEY_META, "type", "long_long",
KEY_META, "comment/#0", " Comment after second value of array",
KEY_META, "comment/#0/start", "#",
KEY_META, "comment/#0/space", "2",
KEY_END),
keyNew (PREFIX "/array/#2",
KEY_VALUE, "3",
KEY_META, "type", "long_long",
KEY_META, "comment/#0", " Comment after last value of array",
KEY_META, "comment/#0/start", "#",
KEY_META, "comment/#0/space", "3",
KEY_END),
keyNew (PREFIX "/table",
KEY_META, "tomltype", "simpletable",
KEY_META, "order", "2",
KEY_META, "comment/#0", " Comment after table",
KEY_META, "comment/#0/start", "#",
KEY_META, "comment/#0/space", "1",
KEY_META, "comment/#1/start", "",
KEY_META, "comment/#1/space", "0",
KEY_END),
keyNew (PREFIX "/table_array",
KEY_META, "array", "#0",
KEY_META, "tomltype", "tablearray",
KEY_META, "order", "3",
KEY_END),
keyNew (PREFIX "/table_array/#0",
KEY_META, "comment/#0", " Comment after table array",
KEY_META, "comment/#0/start", "#",
KEY_META, "comment/#0/space", "1",
KEY_META, "comment/#1/start", "",
KEY_META, "comment/#1/space", "0",
KEY_END),
KS_END)
|
/*============================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center (DKFZ)
All rights reserved.
Use of this source code is governed by a 3-clause BSD license that can be
found in the LICENSE file.
============================================================================*/
#ifndef IMAGESLICESELECTOR_H_HEADER_INCLUDED_C1E4BE7B
#define IMAGESLICESELECTOR_H_HEADER_INCLUDED_C1E4BE7B
#include "mitkSubImageSelector.h"
#include <MitkCoreExports.h>
namespace mitk
{
//##Documentation
//## @brief Provides access to a slice of the input image
//##
//## If the input is generated by a ProcessObject, only the required data is
//## requested.
//## @ingroup Process
class MITKCORE_EXPORT ImageSliceSelector : public SubImageSelector
{
public:
mitkClassMacro(ImageSliceSelector, SubImageSelector);
itkFactorylessNewMacro(Self) itkCloneMacro(Self)
itkGetConstMacro(SliceNr, int);
itkSetMacro(SliceNr, int);
itkGetConstMacro(TimeNr, int);
itkSetMacro(TimeNr, int);
itkGetConstMacro(ChannelNr, int);
itkSetMacro(ChannelNr, int);
protected:
void GenerateOutputInformation() override;
void GenerateInputRequestedRegion() override;
void GenerateData() override;
ImageSliceSelector();
~ImageSliceSelector() override;
int m_SliceNr;
int m_TimeNr;
int m_ChannelNr;
};
} // namespace mitk
#endif /* IMAGESLICESELECTOR_H_HEADER_INCLUDED_C1E4BE7B */
|
/*
* Copyright (c) 2012-2017, RISE SICS AB
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 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.
*
* Author: Nicolas Tsiftes <nvt@acm.org>
*/
#ifndef VM_BYTECODE_H
#define VM_BYTECODE_H
#include <stdint.h>
/* The header consists of two bytes for the file ID and a byte for the
bytecode version. */
#define VM_HEADER_SIZE 3
#define VM_FILE_ID1 94
#define VM_FILE_ID2 181
#define VM_BYTECODE_VERSION 1
#define VM_TOKEN_ATOM 0
#define VM_TOKEN_FORM 1
#define VM_FORM_INLINE 0
#define VM_FORM_LAMBDA 1
#define VM_FORM_REF 2
#define VM_ATOM_MASK 0x7
#define VM_LOCAL_SYMBOL_OFFSET 128
#endif /* !VM_BYTECODE_H */
|
#pragma once
#include "defs.h"
// Standard irq aggregators
// One or more level and/or edge-triggered sources.
// Level output. Sometimes also pulse-output, in which case an `eoi'
// register will be nearby, normally immediately before or after it.
//
// multiple outputs are achieved by
// Irqd4<T>[n]
// or
// Irqd4<T[n]>
// (varies)
// old version
template< typename T >
struct Irqd {
using TR = T;
using TW = T volatile;
union {
TR pending; //r-
TW clear; //-c edge-triggered sources only
};
T enabled; //rw
};
// old version with wakeup-enable
template< typename T >
struct Irqdw : public Irqd<T> {
T wakeup; //rw
};
// highlander version
template< typename T >
struct Irqd4 {
using TR = T;
using TW = T volatile;
union {
TR pending; //r-
TW set; //-s edge-triggered sources only, for debug
};
union {
TW clear; //-c edge-triggered sources only
TR active; //r- = pending & enabled
};
union {
TR enabled; //r-
TW enable; //-s
};
TW disable; //-c
};
// highlander version with wakeup-enable
template< typename T >
struct Irqd4w : public Irqd4<T> {
T wakeup; //rw
};
// dma version (no status, only enables)
template< typename T >
struct Dmad4 {
using TR = T;
using TW = T volatile;
union {
TR enabled; //r-
TW enable; //-s
};
TW disable; //-c
};
// dma version with wakeup-enable
template< typename T >
struct Dmad4w : public Dmad4<T> {
T wakeup; //rw
};
|
#include <math.h>
typedef double number;
inline int imax(int i, int j);
inline number nabs(number x);
int rootscan(number* coeff, int n);
|
// 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 CHROME_BROWSER_UI_SERIAL_SERIAL_CHOOSER_H_
#define CHROME_BROWSER_UI_SERIAL_SERIAL_CHOOSER_H_
#include "base/callback_helpers.h"
#include "base/macros.h"
#include "content/public/browser/serial_chooser.h"
// Owns a serial port chooser dialog and closes it when destroyed.
class SerialChooser : public content::SerialChooser {
public:
explicit SerialChooser(base::OnceClosure close_closure);
SerialChooser(const SerialChooser&) = delete;
SerialChooser& operator=(const SerialChooser&) = delete;
~SerialChooser() override = default;
private:
base::ScopedClosureRunner closure_runner_;
};
#endif // CHROME_BROWSER_UI_SERIAL_SERIAL_CHOOSER_H_
|
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROMEOS_SERVICES_LIBASSISTANT_AUDIO_AUDIO_MEDIA_DATA_SOURCE_H_
#define CHROMEOS_SERVICES_LIBASSISTANT_AUDIO_AUDIO_MEDIA_DATA_SOURCE_H_
#include <vector>
#include "base/macros.h"
#include "base/memory/scoped_refptr.h"
#include "base/task/single_thread_task_runner.h"
#include "chromeos/services/assistant/public/mojom/assistant_audio_decoder.mojom.h"
#include "libassistant/shared/public/platform_audio_output.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver.h"
namespace chromeos {
namespace libassistant {
// Class to provide media data source for audio stream decoder.
// Internally it will read media data from |delegate_|.
class AudioMediaDataSource
: public chromeos::assistant::mojom::AssistantMediaDataSource {
public:
explicit AudioMediaDataSource(
mojo::PendingReceiver<
chromeos::assistant::mojom::AssistantMediaDataSource> receiver);
AudioMediaDataSource(const AudioMediaDataSource&) = delete;
AudioMediaDataSource& operator=(const AudioMediaDataSource&) = delete;
~AudioMediaDataSource() override;
// chromeos::assistant::mojom::MediaDataSource implementation.
// Must be called after |set_delegate()|.
// The caller must wait for callback to finish before issuing the next read.
void Read(uint32_t size, ReadCallback callback) override;
void set_delegate(assistant_client::AudioOutput::Delegate* delegate) {
delegate_ = delegate;
}
private:
void OnFillBuffer(int bytes_filled);
mojo::Receiver<AssistantMediaDataSource> receiver_;
// The callback from |delegate_| runs on a different sequence, so this
// sequence checker prevents the other methods from being called on the wrong
// sequence.
SEQUENCE_CHECKER(sequence_checker_);
scoped_refptr<base::SequencedTaskRunner> task_runner_;
assistant_client::AudioOutput::Delegate* delegate_ = nullptr;
std::vector<uint8_t> source_buffer_;
ReadCallback read_callback_;
base::WeakPtrFactory<AudioMediaDataSource> weak_factory_;
};
} // namespace libassistant
} // namespace chromeos
#endif // CHROMEOS_SERVICES_LIBASSISTANT_AUDIO_AUDIO_MEDIA_DATA_SOURCE_H_
|
//
// Licensed under the terms in License.txt
//
// Copyright 2010 Allen Ding. All rights reserved.
//
#import "KiwiConfiguration.h"
// This category is solely meant to coax Xcode into exposing the method names below during autocompletion.
// There is no implementation and this class definition must come before the macro definitions below.
@interface NSObject (KiwiVerifierMacroNames)
- (void)should;
- (void)shouldNot;
- (void)shouldBeNil DEPRECATED_ATTRIBUTE;
- (void)shouldNotBeNil DEPRECATED_ATTRIBUTE;
- (void)shouldEventually;
- (void)shouldNotEventually;
- (void)shouldEventuallyBeforeTimingOutAfter;
- (void)shouldNotEventuallyBeforeTimingOutAfter;
- (void)shouldAfterWait;
- (void)shouldNotAfterWait;
- (void)shouldAfterWaitOf;
- (void)shouldNotAfterWaitOf;
@end
#pragma mark - Support Macros
#define KW_THIS_CALLSITE [KWCallSite callSiteWithFilename:@__FILE__ lineNumber:__LINE__]
#define KW_ADD_EXIST_VERIFIER(expectationType) [KWSpec addExistVerifierWithExpectationType:expectationType callSite:KW_THIS_CALLSITE]
#define KW_ADD_MATCH_VERIFIER(expectationType) [KWSpec addMatchVerifierWithExpectationType:expectationType callSite:KW_THIS_CALLSITE]
#define KW_ADD_ASYNC_VERIFIER(expectationType, timeOut, wait) [KWSpec addAsyncVerifierWithExpectationType:expectationType callSite:KW_THIS_CALLSITE timeout:timeOut shouldWait:wait]
#pragma mark - Keywords
#ifndef KIWI_DISABLE_MATCHERS
// Kiwi macros used in specs for verifying expectations.
#define should attachToVerifier:KW_ADD_MATCH_VERIFIER(KWExpectationTypeShould)
#define shouldNot attachToVerifier:KW_ADD_MATCH_VERIFIER(KWExpectationTypeShouldNot)
#define shouldBeNil attachToVerifier:KW_ADD_EXIST_VERIFIER(KWExpectationTypeShouldNot)
#define shouldNotBeNil attachToVerifier:KW_ADD_EXIST_VERIFIER(KWExpectationTypeShould)
#define shouldEventually attachToVerifier:KW_ADD_ASYNC_VERIFIER(KWExpectationTypeShould, kKW_DEFAULT_PROBE_TIMEOUT, NO)
#define shouldNotEventually attachToVerifier:KW_ADD_ASYNC_VERIFIER(KWExpectationTypeShouldNot, kKW_DEFAULT_PROBE_TIMEOUT, NO)
#define shouldEventuallyBeforeTimingOutAfter(timeout) attachToVerifier:KW_ADD_ASYNC_VERIFIER(KWExpectationTypeShould, timeout, NO)
#define shouldNotEventuallyBeforeTimingOutAfter(timeout) attachToVerifier:KW_ADD_ASYNC_VERIFIER(KWExpectationTypeShouldNot, timeout, NO)
#define shouldAfterWait attachToVerifier:KW_ADD_ASYNC_VERIFIER(KWExpectationTypeShould, kKW_DEFAULT_PROBE_TIMEOUT, YES)
#define shouldNotAfterWait attachToVerifier:KW_ADD_ASYNC_VERIFIER(KWExpectationTypeShouldNot, kKW_DEFAULT_PROBE_TIMEOUT, YES)
#define shouldAfterWaitOf(timeout) attachToVerifier:KW_ADD_ASYNC_VERIFIER(KWExpectationTypeShould, timeout, YES)
#define shouldNotAfterWaitOf(timeout) attachToVerifier:KW_ADD_ASYNC_VERIFIER(KWExpectationTypeShouldNot, timeout, YES)
#define beNil beNil:[KWNilMatcher verifyNilSubject]
#define beNonNil beNonNil:[KWNilMatcher verifyNonNilSubject]
// used to wrap a pointer to an object that will change in the future (used with shouldEventually)
#define expectFutureValue(futureValue) [KWFutureObject futureObjectWithBlock:^{ return futureValue; }]
// `fail` triggers a failure report when called
#define fail(message, ...) [[[KWExampleSuiteBuilder sharedExampleSuiteBuilder] currentExample] reportFailure:[KWFailure failureWithCallSite:KW_THIS_CALLSITE format:message, ##__VA_ARGS__]]
// used for message patterns to allow matching any value
#define any() [KWAny any]
#endif
// If a gcc compatible compiler is available, use the statement and
// declarations in expression extension to provide a convenient catch-all macro
// to create KWValues.
#if defined(__GNUC__)
#define theValue(expr) \
({ \
__typeof__(expr) kiwiReservedPrefix_lVar = expr; \
[KWValue valueWithBytes:&kiwiReservedPrefix_lVar objCType:@encode(__typeof__(expr))]; \
})
#endif // #if defined(__GNUC__)
// Allows for comparision of pointer values in expectations
#define thePointerValue(expr) [NSValue valueWithPointer:(expr)]
// Example group declarations.
#define SPEC_BEGIN(name) \
\
@interface name : KWSpec \
\
@end \
\
@implementation name \
\
+ (NSString *)file { return @__FILE__; } \
\
+ (void)buildExampleGroups { \
[super buildExampleGroups]; \
\
id _kw_test_case_class = self; \
{ \
/* The shadow `self` must be declared inside a new scope to avoid compiler warnings. */ \
/* The receiving class object delegates unrecognized selectors to the current example. */ \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wshadow\"") \
__unused name *self = _kw_test_case_class; \
_Pragma("clang diagnostic pop")
#define SPEC_END \
} \
} \
\
@end
// Test suite configuration declaration
#define CONFIG_START \
@interface KWSuiteConfiguration : KWSuiteConfigurationBase \
\
@end \
\
@implementation KWSuiteConfiguration \
\
- (void)configureSuite {
#define CONFIG_END \
} \
\
@end
// Used to ensure that shared examples are registered before any
// examples are evaluated. The name parameter is not used except
// to define a category. Therefore, it must be unique.
#define SHARED_EXAMPLES_BEGIN(name) \
\
@interface KWSharedExample (name) \
\
@end \
\
@implementation KWSharedExample (name) \
\
+ (void)load { \
#define SHARED_EXAMPLES_END \
} \
\
@end \
|
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import "ABI40_0_0ARTNodeManager.h"
@interface ABI40_0_0ARTGroupManager : ABI40_0_0ARTNodeManager
@end
|
#ifndef HOMEBREW_BROWSER_UI_H_
#define HOMEBREW_BROWSER_UI_H_
#include <array>
#include <vector>
#include <string>
#include <3ds.h>
namespace homebrew_browser {
enum class SelectedCategory {
kNone = 0,
kGames,
kMedia,
kEmulators,
kTools,
kMisc
};
enum class ListingTitleDisplay {
kHidden = 0,
kVisible
};
struct ListingMetadata {
ListingTitleDisplay displayed;
u8 const* icon;
std::string title;
std::string description;
std::string author;
bool owned;
};
enum class ListingScrollbarDisplay {
kHidden = 0,
kVisible
};
struct ListingScrollbar {
ListingScrollbarDisplay displayed;
s32 percentage;
bool active;
};
enum class ListingSortOrder {
kAlphanumericAscending = 0,
kAlphanumericDescending
};
struct ListingDrawState {
SelectedCategory category;
// Icons/titles/descriptions
std::array<ListingMetadata, 3> visible_titles;
// Selected title
u32 selected_title;
// scrollbar location, whether it's displayed
ListingScrollbar scrollbar;
// sort state
ListingSortOrder sort_order;
};
struct UIElement {
u8 const* const image;
s32 const x;
s32 const y;
};
#define EXPAND_UI_AS_ENUM(a, b, c, d) a,
#define EXPAND_UI_AS_STD_ARRAY(a, b, c, d) {b, c, d},
#define EXPAND_UI_AS_STRUCT(a, b, c, d) u8 a;
#define LISTING_UI_ELEMENTS(ELEMENT) \
ELEMENT(kGamesDark, category_games_normal_bin, 4, 6) \
ELEMENT(kGamesLight, category_games_selected_bin, 4, 6) \
ELEMENT(kMediaDark, category_media_normal_bin, 4, 48) \
ELEMENT(kMediaLight, category_media_selected_bin, 4, 48) \
ELEMENT(kEmulatorsDark, category_emulators_normal_bin, 4, 90) \
ELEMENT(kEmulatorsLight, category_emulators_selected_bin, 4, 90) \
ELEMENT(kToolsDark, category_tools_normal_bin, 4, 132) \
ELEMENT(kToolsLight, category_tools_selected_bin, 4, 132) \
ELEMENT(kMiscDark, category_misc_normal_bin, 4, 174) \
ELEMENT(kMiscLight, category_misc_selected_bin, 4, 174) \
ELEMENT(kTopRowLight, row_base_bin, 51, 3) \
ELEMENT(kMiddleRowLight, row_base_bin, 51, 74) \
ELEMENT(kBottomRowLight, row_base_bin, 51, 145) \
ELEMENT(kTopRowDark, row_selected_bin, 51, 3) \
ELEMENT(kMiddleRowDark, row_selected_bin, 51, 74) \
ELEMENT(kBottomRowDark, row_selected_bin, 51, 145) \
ELEMENT(kUIBar, ui_bar_bin, 0, 216) \
ELEMENT(kSortReversed, sort_reversed_bin, 265, 218) \
ELEMENT(kScrollBar, scrollbar_bin, 304, 3) \
ELEMENT(kScrollBarActive, scrollbar_active_bin, 304, 3) \
ELEMENT(kTopOwnedIcon, owned_icon_bin, 287, 6) \
ELEMENT(kMiddleOwnedIcon, owned_icon_bin, 287, 77) \
ELEMENT(kBottomOwnedIcon, owned_icon_bin, 287, 148) \
ELEMENT(kDownloadWindow, download_window_bin, 32, 32) \
ELEMENT(kProgressBarEmpty, progress_bar_empty_bin, 85, 146) \
ELEMENT(kProgressBarFull, progress_bar_full_bin, 85, 146)
enum class ListingUIElements {
LISTING_UI_ELEMENTS(EXPAND_UI_AS_ENUM)
};
struct ListingUIElementSize {
LISTING_UI_ELEMENTS(EXPAND_UI_AS_STRUCT)
};
extern std::array<UIElement, sizeof(ListingUIElementSize)> const g_listing_ui_elements;
void draw_full_ui_from_state(ListingDrawState const& state);
void redraw_full_ui();
void draw_ui_element(u8* framebuffer, ListingUIElements const element);
} // namespace homebrew_browser
#endif // HOMEBREW_BROWSER_UI_H_
|
/**************************************************************************
***
*** Copyright (c) 1995-2000 Regents of the University of California,
*** Andrew E. Caldwell, Andrew B. Kahng and Igor L. Markov
*** Copyright (c) 2000-2007 Regents of the University of Michigan,
*** Saurabh N. Adya, Jarrod A. Roy, David A. Papa and
*** Igor L. Markov
***
*** Contact author(s): abk@cs.ucsd.edu, imarkov@umich.edu
*** Original Affiliation: UCLA, Computer Science Department,
*** Los Angeles, CA 90095-1596 USA
***
*** Permission is hereby granted, free of charge, to any person obtaining
*** a copy of this software and associated documentation files (the
*** "Software"), to deal in the Software without restriction, including
*** without limitation
*** the rights to use, copy, modify, merge, publish, distribute, sublicense,
*** and/or sell copies of the Software, and to permit persons to whom the
*** Software is furnished to do so, subject to the following conditions:
***
*** The above copyright notice and this permission notice shall be included
*** in all copies or substantial portions of the Software.
***
*** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
*** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
*** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
*** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
*** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
*** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
*** THE USE OR OTHER DEALINGS IN THE SOFTWARE.
***
***
***************************************************************************/
#ifndef ORDERING
#define ORDERING
#include <vector>
#include <algorithm>
class ordering {
std::vector<int> index_to_loc;
std::vector<int> loc_to_index;
public:
ordering(int size) : index_to_loc(size), loc_to_index(size) {}
unsigned size(void) const { return index_to_loc.size(); }
int loc(int loc) const { return loc_to_index[loc]; }
int idx(int idx) const { return index_to_loc[idx]; }
void iotafy(void) {
for (unsigned i = 0; i < index_to_loc.size(); i++) {
loc_to_index[i] = i;
index_to_loc[i] = i;
}
}
void set(int loc, int idx) {
abkassert(loc >= 0 && idx >= 0 && unsigned(loc) < index_to_loc.size() && unsigned(idx) < index_to_loc.size(), "Dave's error message goes here");
index_to_loc[idx] = loc;
loc_to_index[loc] = idx;
}
};
#endif
|
#ifndef STM32_FREERTOS_INIT_H__
#define STM32_FREERTOS_INIT_H__
#include <stdint.h>
void init_relocate(void);
void init_libc(void);
int main(void);
#endif // STM32_FREERTOS_INIT_H__
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE191_Integer_Underflow__int_fscanf_postdec_05.c
Label Definition File: CWE191_Integer_Underflow__int.label.xml
Template File: sources-sinks-05.tmpl.c
*/
/*
* @description
* CWE: 191 Integer Underflow
* BadSource: fscanf Read data from the console using fscanf()
* GoodSource: Set data to a small, non-zero number (negative two)
* Sinks: decrement
* GoodSink: Ensure there will not be an underflow before decrementing data
* BadSink : Decrement data, which can cause an Underflow
* Flow Variant: 05 Control flow: if(staticTrue) and if(staticFalse)
*
* */
#include "std_testcase.h"
/* The two variables below are not defined as "const", but are never
assigned any other value, so a tool should be able to identify that
reads of these will always return their initialized values. */
static int staticTrue = 1; /* true */
static int staticFalse = 0; /* false */
#ifndef OMITBAD
void CWE191_Integer_Underflow__int_fscanf_postdec_05_bad()
{
int data;
/* Initialize data */
data = 0;
if(staticTrue)
{
/* POTENTIAL FLAW: Read data from the console using fscanf() */
fscanf(stdin, "%d", &data);
}
if(staticTrue)
{
{
/* POTENTIAL FLAW: Decrementing data could cause an underflow */
data--;
int result = data;
printIntLine(result);
}
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodB2G1() - use badsource and goodsink by changing the second staticTrue to staticFalse */
static void goodB2G1()
{
int data;
/* Initialize data */
data = 0;
if(staticTrue)
{
/* POTENTIAL FLAW: Read data from the console using fscanf() */
fscanf(stdin, "%d", &data);
}
if(staticFalse)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
/* FIX: Add a check to prevent an underflow from occurring */
if (data > INT_MIN)
{
data--;
int result = data;
printIntLine(result);
}
else
{
printLine("data value is too large to perform arithmetic safely.");
}
}
}
/* goodB2G2() - use badsource and goodsink by reversing the blocks in the second if */
static void goodB2G2()
{
int data;
/* Initialize data */
data = 0;
if(staticTrue)
{
/* POTENTIAL FLAW: Read data from the console using fscanf() */
fscanf(stdin, "%d", &data);
}
if(staticTrue)
{
/* FIX: Add a check to prevent an underflow from occurring */
if (data > INT_MIN)
{
data--;
int result = data;
printIntLine(result);
}
else
{
printLine("data value is too large to perform arithmetic safely.");
}
}
}
/* goodG2B1() - use goodsource and badsink by changing the first staticTrue to staticFalse */
static void goodG2B1()
{
int data;
/* Initialize data */
data = 0;
if(staticFalse)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
/* FIX: Use a small, non-zero value that will not cause an integer underflow in the sinks */
data = -2;
}
if(staticTrue)
{
{
/* POTENTIAL FLAW: Decrementing data could cause an underflow */
data--;
int result = data;
printIntLine(result);
}
}
}
/* goodG2B2() - use goodsource and badsink by reversing the blocks in the first if */
static void goodG2B2()
{
int data;
/* Initialize data */
data = 0;
if(staticTrue)
{
/* FIX: Use a small, non-zero value that will not cause an integer underflow in the sinks */
data = -2;
}
if(staticTrue)
{
{
/* POTENTIAL FLAW: Decrementing data could cause an underflow */
data--;
int result = data;
printIntLine(result);
}
}
}
void CWE191_Integer_Underflow__int_fscanf_postdec_05_good()
{
goodB2G1();
goodB2G2();
goodG2B1();
goodG2B2();
}
#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()...");
CWE191_Integer_Underflow__int_fscanf_postdec_05_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE191_Integer_Underflow__int_fscanf_postdec_05_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
#include <stdio.h>
#include <stdlib.h>
#include "FAT.h"
extern FAT root;
extern FAT cwd;
int main(void) {
initializeFileSystem();
/*// explorePath
char * str = calloc(1, 50);
strcpy(str, "home/patonn/descargas");
unsigned char hasEnded = 0;
char buff[255] = {0};
do {
str = explorePath(str, buff, &hasEnded);
printf("str: %s\n", str);
printf("buff: %s\n", buff);
} while(!hasEnded);
strcpy(str, "mnt");
do {
str = explorePath(str, buff, &hasEnded);
printf("str: %s\n", str);
printf("buff: %s\n", buff);
} while(!hasEnded);
printf("\n-----------------------------------------\n");
//validateName
printf("%d ", validateName(str));
printf("%d ", validateName("holis"));
printf("%d \n", validateName(""));
printf("\n-----------------------------------------\n");
*/
//agregado y borrado
addFileEntry("pepe", root);
addFileEntry("pepe2", cwd);
addDirEntry("pepeDir", root);
printf("%s\n", ((File)(root->firstFile->entry))->name);
printf("%s\n", ((File)(cwd->lastFile->entry))->name);
addFileEntry("pepe3", root);
printf("%s\n", ((File)(cwd->lastFile->entry))->name);
printf("%s\n", ((File)(root->firstDir->entry))->name);
printf("FileCount: %d\n", cwd->fileCount);
deleteFile("", root);
printf("FileCount: %d (nothing deleted)\n", cwd->fileCount);
deleteFile("pepe", root);
printf("FileCount: %d (pepe deleted)\n", cwd->fileCount);
addFileEntry("pepe4", root);
printf("FileCount: %d (pepe4 added)\n", cwd->fileCount);
deleteFile("pepe4", root);
printf("FileCount: %d (pepe4 deleted)\n", cwd->fileCount);
addDirEntry("pepeDir2", root);
printf("\n-----------------------------------------\n");
//navegacion
printf("en root:\n");
ls();
printf("\n");
printf("en pepeDir:\n");
cd("/pepeDir");
addFileEntry("pepe5", cwd);
addDirEntry("pepeDir3", cwd);
ls();
printf("\n");
printf("en root de nuevo:\n");
cd("..");
cd(".."); // haciendo .. en root
ls();
char buff[50] = {0};
File f = (File)findFileOrDir("pepeDir/pepe0", buff, FALSE);
printf("%s\n", (f != NULL) ? f->name : "Null");
f = (File)findFileOrDir("pepeDir/pepe5", buff, FALSE);
printf("%s\n", (f != NULL) ? f->name : "Null");
cd("..");
printf("\n-----------------------------------------\n");
// open, close, read, write
int open1 = open("pepeDir/pepe5", "w");
close(open1);
open1 = open("pepeDir/pepe5", "w");
char * hello = "Hello world!";
int status = write(hello, 14, 1, open1);
close(open1);
open1 = open("pepeDir/pepe5", "r");
char buffer[MAX_FILE_SIZE] = {0};
status = read(buffer, 7, 2, open1);
printf("Read: %s\n", buffer);
printf("pepe5 info: \n");
getFileDetails("pepeDir/pepe5");
close(open1);
open1 = open("pepeDir/pepe5", "w");
status = write("", 7, 2, open1);
close(open1);
open1 = open("/pepeDir/pepe5", "r");
status = read(buffer, 7, 2, open1);
printf("Despues del 2do read: %s\n", buffer);
printf("Creando cosas en pepeDir/pepeDir3\n");
touch("/pepeDir/pepeDir3/holis");
mkdir("/pepeDir/pepeDir3/holisDir");
touch("/pepeDir/pepeDir3/holis2");
mkdir("/pepeDir/pepeDir3/holisDir2");
cd("/pepeDir/");
printf("Eliminando pepeDir3, desde pepeDir\n");
rm("/pepeDir/pepeDir3", TRUE);
ls();
printf("\n-----------------------------------------\n");
// borrado
cd("/");
rm("pepeDir", TRUE);
ls();
if(cwd == root)
printf("No cambio el directorio porque pepeDir ya no existe.\n");
return 0;
}
|
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MEDIA_BLINK_RESOURCE_MULTIBUFFER_DATA_PROVIDER_H_
#define MEDIA_BLINK_RESOURCE_MULTIBUFFER_DATA_PROVIDER_H_
#include <stdint.h>
#include <memory>
#include <string>
#include "base/callback.h"
#include "base/memory/weak_ptr.h"
#include "media/blink/media_blink_export.h"
#include "media/blink/multibuffer.h"
#include "media/blink/url_index.h"
#include "third_party/blink/public/platform/web_url_request.h"
#include "third_party/blink/public/web/web_associated_url_loader_client.h"
#include "third_party/blink/public/web/web_frame.h"
#include "url/gurl.h"
namespace blink {
class WebAssociatedURLLoader;
} // namespace blink
namespace media {
class MEDIA_BLINK_EXPORT ResourceMultiBufferDataProvider
: public MultiBuffer::DataProvider,
public blink::WebAssociatedURLLoaderClient {
public:
// NUmber of times we'll retry if the connection fails.
enum { kMaxRetries = 30 };
ResourceMultiBufferDataProvider(UrlData* url_data,
MultiBufferBlockId pos,
bool is_client_audio_element);
~ResourceMultiBufferDataProvider() override;
// Virtual for testing purposes.
virtual void Start();
// MultiBuffer::DataProvider implementation
MultiBufferBlockId Tell() const override;
bool Available() const override;
int64_t AvailableBytes() const override;
scoped_refptr<DataBuffer> Read() override;
void SetDeferred(bool defer) override;
// blink::WebAssociatedURLLoaderClient implementation.
bool WillFollowRedirect(
const blink::WebURL& new_url,
const blink::WebURLResponse& redirect_response) override;
void DidSendData(uint64_t bytesSent, uint64_t totalBytesToBeSent) override;
void DidReceiveResponse(const blink::WebURLResponse& response) override;
void DidDownloadData(uint64_t data_length) override;
void DidReceiveData(const char* data, int data_length) override;
void DidReceiveCachedMetadata(const char* data, int dataLength) override;
void DidFinishLoading() override;
void DidFail(const blink::WebURLError&) override;
// Use protected instead of private for testing purposes.
protected:
friend class MultibufferDataSourceTest;
friend class ResourceMultiBufferDataProviderTest;
friend class MockBufferedDataSource;
// Callback used when we're asked to fetch data after the end of the file.
void Terminate();
// Parse a Content-Range header into its component pieces and return true if
// each of the expected elements was found & parsed correctly.
// |*instance_size| may be set to kPositionNotSpecified if the range ends in
// "/*".
// NOTE: only public for testing! This is an implementation detail of
// VerifyPartialResponse (a private method).
static bool ParseContentRange(const std::string& content_range_str,
int64_t* first_byte_position,
int64_t* last_byte_position,
int64_t* instance_size);
int64_t byte_pos() const;
int64_t block_size() const;
// If we have made a range request, verify the response from the server.
bool VerifyPartialResponse(const blink::WebURLResponse& response,
const scoped_refptr<UrlData>& url_data);
// Current Position.
MultiBufferBlockId pos_;
// This is where we actually get read data from.
// We don't need (or want) a scoped_refptr for this one, because
// we are owned by it. Note that we may change this when we encounter
// a redirect because we actually change ownership.
UrlData* url_data_;
// Temporary storage for incoming data.
std::list<scoped_refptr<DataBuffer>> fifo_;
// How many retries have we done at the current position.
int retries_;
// Copy of url_data_->cors_mode()
// const to make it obvious that redirects cannot change it.
const UrlData::CorsMode cors_mode_;
// The origin for the initial request.
// const to make it obvious that redirects cannot change it.
const GURL origin_;
// Keeps track of an active WebAssociatedURLLoader.
// Only valid while loading resource.
std::unique_ptr<blink::WebAssociatedURLLoader> active_loader_;
// When we encounter a redirect, this is the source of the redirect.
GURL redirects_to_;
// If the server tries to gives us more bytes than we want, this how
// many bytes we need to discard before we get to the right place.
uint64_t bytes_to_discard_ = 0;
// Is the client an audio element?
bool is_client_audio_element_ = false;
base::WeakPtrFactory<ResourceMultiBufferDataProvider> weak_factory_{this};
};
} // namespace media
#endif // MEDIA_BLINK_RESOURCE_MULTIBUFFER_DATA_PROVIDER_H_
|
#ifndef UPLOAD_FILE_PROCESSING_FILE_SCRUBBING_TASK_H
#define UPLOAD_FILE_PROCESSING_FILE_SCRUBBING_TASK_H
#include <tbb/task.h>
#include "async_reader.h"
namespace upload { // TODO: remove or replace
class CharBuffer;
class AbstractFile {
public:
AbstractFile(const std::string &path,
const size_t size) :
path_(path), size_(size) {}
const std::string& path() const { return path_; }
size_t size() const { return size_; }
private:
const std::string path_;
const size_t size_;
};
template <class FileT>
class AbstractFileScrubbingTask : public tbb::task {
public:
AbstractFileScrubbingTask(FileT *file,
CharBuffer *buffer,
const bool is_last_piece,
AbstractReader *reader = NULL) :
file_(file), buffer_(buffer), reader_(reader), is_last_(is_last_piece),
next_(NULL) {}
FileT* file() { return file_; }
CharBuffer* buffer() { return buffer_; }
const FileT* file() const { return file_; }
const CharBuffer* buffer() const { return buffer_; }
bool IsLast() const { return is_last_; }
/** Associate the FileScrubbingTask with its successor */
void SetNext(tbb::task *next) {
next->increment_ref_count();
next_ = next;
}
protected:
tbb::task* Finalize() {
reader_->ReleaseBuffer(buffer_);
if (is_last_) {
reader_->FinalizedFile(file_);
}
return Next();
}
/**
* Decide if the next FileScrubbingTask can be directly returned for pro-
* cessing in TBB
*/
tbb::task* Next() {
return (next_ != NULL && next_->decrement_ref_count() == 0)
? next_
: NULL;
}
private:
FileT *file_; ///< the associated file that is to be processed
CharBuffer *buffer_; ///< the CharBuffer containing the current data Block
AbstractReader *reader_; ///< the Reader that is responsible for the given data Block
const bool is_last_; ///< defines if we have the last piece
tbb::task *next_; ///< the next FileScrubbingTask
///< (if NULL, no more data will come after this FileScrubbingTask)
};
}
#endif /* UPLOAD_FILE_PROCESSING_FILE_SCRUBBING_TASK_H */
|
#include "hwcap_impl.h"
#include "libc.h"
#include "starboard/cpu_features.h"
size_t __hwcap;
// Set __hwcap bitmask by Starboard CPU features API.
void init_musl_hwcap() {
SbCPUFeatures features;
if (SbCPUFeaturesGet(&features)) {
__hwcap = features.hwcap;
} else {
__hwcap = 0;
}
}
|
#ifndef MODULELOADER_H
#define MODULELOADER_H
void loadModules(void * payloadStart, void ** moduleTargetAddress);
void mapModulesLogical(void* physical );
void testPageFault();
#endif |
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_KIOSK_ENABLE_SCREEN_HANDLER_H_
#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_KIOSK_ENABLE_SCREEN_HANDLER_H_
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/ash/app_mode/kiosk_app_manager.h"
#include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
namespace ash {
class KioskEnableScreen;
}
namespace chromeos {
// Interface between enable kiosk screen and its representation.
// Note, do not forget to call OnViewDestroyed in the dtor.
class KioskEnableScreenView {
public:
constexpr static StaticOobeScreenId kScreenId{"kiosk-enable"};
virtual ~KioskEnableScreenView() {}
virtual void Show() = 0;
virtual void SetScreen(ash::KioskEnableScreen* screen) = 0;
virtual void ShowKioskEnabled(bool success) = 0;
};
// WebUI implementation of KioskEnableScreenActor.
class KioskEnableScreenHandler : public KioskEnableScreenView,
public BaseScreenHandler {
public:
using TView = KioskEnableScreenView;
explicit KioskEnableScreenHandler(JSCallsContainer* js_calls_container);
KioskEnableScreenHandler(const KioskEnableScreenHandler&) = delete;
KioskEnableScreenHandler& operator=(const KioskEnableScreenHandler&) = delete;
~KioskEnableScreenHandler() override;
// KioskEnableScreenView:
void Show() override;
void SetScreen(ash::KioskEnableScreen* screen) override;
void ShowKioskEnabled(bool success) override;
// BaseScreenHandler implementation:
void DeclareLocalizedValues(
::login::LocalizedValuesBuilder* builder) override;
void Initialize() override;
private:
ash::KioskEnableScreen* screen_ = nullptr;
// Keeps whether screen should be shown right after initialization.
bool show_on_init_ = false;
};
} // namespace chromeos
// TODO(https://crbug.com/1164001): remove after the //chrome/browser/chromeos
// source migration is finished.
namespace ash {
using ::chromeos::KioskEnableScreenHandler;
using ::chromeos::KioskEnableScreenView;
}
#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_KIOSK_ENABLE_SCREEN_HANDLER_H_
|
// Copyright(C) 1999-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.
#ifndef IOSS_Ioss_Tri3_h
#define IOSS_Ioss_Tri3_h
#include <Ioss_CodeTypes.h> // for IntVector
#include <Ioss_ElementTopology.h> // for ElementTopology
// STL Includes
namespace Ioss {
class Tri3 : public Ioss::ElementTopology
{
public:
static constexpr auto name = "tri3";
static void factory();
~Tri3() override;
ElementShape shape() const override { return ElementShape::TRI; }
int spatial_dimension() const override;
int parametric_dimension() const override;
bool is_element() const override { return true; }
int order() const override;
int number_corner_nodes() const override;
int number_nodes() const override;
int number_edges() const override;
int number_faces() const override;
int number_nodes_edge(int edge = 0) const override;
int number_nodes_face(int face = 0) const override;
int number_edges_face(int face = 0) const override;
Ioss::IntVector edge_connectivity(int edge_number) const override;
Ioss::IntVector face_connectivity(int face_number) const override;
Ioss::IntVector element_connectivity() const override;
Ioss::ElementTopology *face_type(int face_number = 0) const override;
Ioss::ElementTopology *edge_type(int edge_number = 0) const override;
protected:
Tri3();
private:
static Tri3 instance_;
Tri3(const Tri3 &) = delete;
};
} // namespace Ioss
#endif
|
/******************************************************************************
* Copyright (C) 2016-2019, Cris Cecka. All rights reserved.
* Copyright (C) 2016-2019, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the NVIDIA 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 NVIDIA CORPORATION BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/
#pragma once
#include <blam/detail/config.h>
#include <blam/adl/detail/customization_point.h>
BLAM_CUSTOMIZATION_POINT(dot)
BLAM_CUSTOMIZATION_POINT(dotu)
BLAM_CUSTOMIZATION_POINT(dotc)
namespace blam
{
// Backend entry point
template <typename ExecutionPolicy,
typename VX, typename VY, typename R>
void
generic(blam::dot_t, const ExecutionPolicy& exec,
int n,
const VX* x, int incX,
const VY* y, int incY,
R& result) = delete;
// Backend entry point
template <typename ExecutionPolicy,
typename VX, typename VY, typename R>
void
generic(blam::dotc_t, const ExecutionPolicy& exec,
int n,
const VX* x, int incX,
const VY* y, int incY,
R& result) = delete;
// Backend entry point
template <typename ExecutionPolicy,
typename VX, typename VY, typename R>
void
generic(blam::dotu_t, const ExecutionPolicy& exec,
int n,
const VX* x, int incX,
const VY* y, int incY,
R& result) = delete;
// incX,incY -> 1,1
template <typename ExecutionPolicy,
typename VX, typename VY, typename R>
auto
generic(blam::dot_t, const ExecutionPolicy& exec,
int n,
const VX* x,
const VY* y,
R& result)
BLAM_DECLTYPE_AUTO_RETURN
(
blam::dot(exec, n, x, 1, y, 1, result)
)
// incX,incY -> 1,1
template <typename ExecutionPolicy,
typename VX, typename VY, typename R>
auto
generic(blam::dotc_t, const ExecutionPolicy& exec,
int n,
const VX* x,
const VY* y,
R& result)
BLAM_DECLTYPE_AUTO_RETURN
(
blam::dotc(exec, n, x, 1, y, 1, result)
)
// incX,incY -> 1,1
template <typename ExecutionPolicy,
typename VX, typename VY, typename R>
auto
generic(blam::dotu_t, const ExecutionPolicy& exec,
int n,
const VX* x,
const VY* y,
R& result)
BLAM_DECLTYPE_AUTO_RETURN
(
blam::dotu(exec, n, x, 1, y, 1, result)
)
// sdot -> sdotu
template <typename ExecutionPolicy,
typename R>
auto
generic(blam::dot_t, const ExecutionPolicy& exec,
int n,
const float* x, int incX,
const float* y, int incY,
R& result)
BLAM_DECLTYPE_AUTO_RETURN
(
blam::dotu(exec, n, x, incX, y, incY, result)
)
// ddot -> ddotu
template <typename ExecutionPolicy,
typename R>
auto
generic(blam::dot_t, const ExecutionPolicy& exec,
int n,
const double* x, int incX,
const double* y, int incY,
R& result)
BLAM_DECLTYPE_AUTO_RETURN
(
blam::dotu(exec, n, x, incX, y, incY, result)
)
// cdot -> cdotc
template <typename ExecutionPolicy,
typename R>
auto
generic(blam::dot_t, const ExecutionPolicy& exec,
int n,
const ComplexFloat* x, int incX,
const ComplexFloat* y, int incY,
R& result)
BLAM_DECLTYPE_AUTO_RETURN
(
blam::dotc(exec, n, x, incX, y, incY, result)
)
// zdot -> zdotc
template <typename ExecutionPolicy,
typename R>
auto
generic(blam::dot_t, const ExecutionPolicy& exec,
int n,
const ComplexDouble* x, int incX,
const ComplexDouble* y, int incY,
R& result)
BLAM_DECLTYPE_AUTO_RETURN
(
blam::dotc(exec, n, x, incX, y, incY, result)
)
} // end namespace blam
|
/*
* Restriction.h
*
* Created on: Mar 5, 2013
* Author: kristof
*/
#ifndef PEANOCLAW_INTERSUBGRIDCOMMUNICATION_RESTRICTION_H_
#define PEANOCLAW_INTERSUBGRIDCOMMUNICATION_RESTRICTION_H_
#include "peano/utils/Globals.h"
#include "tarch/logging/Log.h"
#include "tarch/la/Vector.h"
namespace peanoclaw {
class Patch;
namespace geometry {
class Region;
}
namespace interSubgridCommunication {
class Restriction;
}
}
namespace peanoclaw {
namespace interSubgridCommunication {
/**
* Returns the region of the region where the two given patches overlap.
*/
inline double calculateOverlappingRegion(
const tarch::la::Vector<DIMENSIONS, double>& position1,
const tarch::la::Vector<DIMENSIONS, double>& size1,
const tarch::la::Vector<DIMENSIONS, double>& position2,
const tarch::la::Vector<DIMENSIONS, double>& size2
) {
double region = 1.0;
for(int d = 0; d < DIMENSIONS; d++) {
double overlappingInterval =
std::min(position1(d)+size1(d), position2(d)+size2(d))
- std::max(position1(d), position2(d));
region *= overlappingInterval;
region = std::max(region, 0.0);
}
return region;
}
}
}
class peanoclaw::interSubgridCommunication::Restriction {
public:
virtual ~Restriction(){}
/**
* Restricts data from a fine patch to a coarse patch.
* Returns the number of restricted cells.
*/
virtual int restrictSolution (
peanoclaw::Patch& source,
peanoclaw::Patch& destination,
bool restrictOnlyOverlappedRegions
) = 0;
/**
* Finalizes a restriction.
*/
virtual void postProcessRestriction(
peanoclaw::Patch& destination,
bool restrictOnlyOverlappedRegions
) const = 0;
};
#endif /* PEANOCLAW_INTERSUBGRIDCOMMUNICATION_RESTRICTION_H_ */
|
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_ARC_VIDEO_ACCELERATOR_PROTECTED_BUFFER_MANAGER_H_
#define COMPONENTS_ARC_VIDEO_ACCELERATOR_PROTECTED_BUFFER_MANAGER_H_
#include <map>
#include <memory>
#include <set>
#include "base/files/scoped_file.h"
#include "base/memory/platform_shared_memory_region.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/synchronization/lock.h"
#include "base/thread_annotations.h"
#include "mojo/public/cpp/system/platform_handle.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/gpu_memory_buffer.h"
#include "ui/gfx/native_pixmap.h"
namespace arc {
class ProtectedBufferAllocator;
class ProtectedBufferManager
: public base::RefCountedThreadSafe<ProtectedBufferManager> {
public:
ProtectedBufferManager();
// Creates ProtectedBufferAllocatorImpl and return it as
// unique_ptr<ProtectedBufferAllocator>.
// The created PBA would call the function |protected_buffer_manager|.
static std::unique_ptr<ProtectedBufferAllocator>
CreateProtectedBufferAllocator(
scoped_refptr<ProtectedBufferManager> protected_buffer_manager);
// Return a duplicated PlatformSharedMemoryRegion associated with the
// |dummy_fd|, if one exists, or an invalid handle otherwise. The client is
// responsible for closing the handle after use.
base::subtle::PlatformSharedMemoryRegion GetProtectedSharedMemoryRegionFor(
base::ScopedFD dummy_fd);
// Return a duplicated NativePixmapHandle associated with the |dummy_fd|,
// if one exists, or an empty handle otherwise.
// The client is responsible for closing the handle after use.
gfx::NativePixmapHandle GetProtectedNativePixmapHandleFor(
base::ScopedFD dummy_fd);
// Return a protected NativePixmap for a dummy |handle|, if one exists, or
// nullptr otherwise.
scoped_refptr<gfx::NativePixmap> GetProtectedNativePixmapFor(
const gfx::NativePixmapHandle& handle);
private:
// Used internally to maintain the association between the dummy handle and
// the underlying buffer.
class ProtectedBuffer;
class ProtectedSharedMemory;
class ProtectedNativePixmap;
class ProtectedBufferAllocatorImpl;
// Be friend with ProtectedBufferAllocatorImpl so that private functions can
// be called in ProtectedBufferAllocatorImpl.
friend class ProtectedBufferAllocatorImpl;
friend class base::RefCountedThreadSafe<ProtectedBufferManager>;
// Destructor must be private for base::RefCounted class.
~ProtectedBufferManager();
// Returns whether the number of active protected buffer allocators is less
// than the predetermined threshold (kMaxConcurrentProtectedBufferAllocators).
// This also returns current available allocator id through |allocator_id|.
bool GetAllocatorId(uint64_t* const allocator_id);
// Allocates a ProtectedSharedMemory buffer of |size| bytes, to be referred to
// via |dummy_fd| as the dummy handle.
// |allocator_id| is the allocator id of the caller.
// Returns whether allocation is successful.
bool AllocateProtectedSharedMemory(uint64_t allocator_id,
base::ScopedFD dummy_fd,
size_t size);
// Allocates a ProtectedNativePixmap of |format| and |size|, to be referred to
// via |dummy_fd| as the dummy handle.
// |allocator_id| is the allocator id of the caller.
// Returns whether allocation is successful.
bool AllocateProtectedNativePixmap(uint64_t allocator_id,
base::ScopedFD dummy_fd,
gfx::BufferFormat format,
const gfx::Size& size);
// Releases reference to ProtectedSharedMemory or ProtectedNativePixmap
// referred via |dummy_fd|. |allocator_id| is the allocator id of the caller.
void ReleaseProtectedBuffer(uint64_t allocator_id, base::ScopedFD dummy_fd);
// Releases all the references of protected buffers which is allocated by PBA
// whose allocator id is |allocator_id|.
void ReleaseAllProtectedBuffers(uint64_t allocator_id);
// Imports the |dummy_fd| as a NativePixmap. This returns a unique |id|,
// which is guaranteed to be the same for all future imports of any fd
// referring to the buffer to which |dummy_fd| refers to, regardless of
// whether it is the same fd as the original one, or not, for the lifetime
// of the buffer.
//
// This allows us to have an unambiguous mapping from any fd referring to
// the same memory buffer to the same unique id.
//
// Returns nullptr on failure, in which case the returned id is not valid.
scoped_refptr<gfx::NativePixmap> ImportDummyFd(base::ScopedFD dummy_fd,
uint32_t* id) const;
// Removes an entry for given |id| from buffer_map_.
void RemoveEntry(uint32_t id) EXCLUSIVE_LOCKS_REQUIRED(buffer_map_lock_);
// Returns whether a protected buffer whose unique id is |id| can be
// allocated by PBA whose allocator id is |allocator_id|.
bool CanAllocateFor(uint64_t allocator_id, uint32_t id)
EXCLUSIVE_LOCKS_REQUIRED(buffer_map_lock_);
// A map of unique ids to the ProtectedBuffers associated with them.
using ProtectedBufferMap =
std::map<uint32_t, std::unique_ptr<ProtectedBuffer>>;
ProtectedBufferMap buffer_map_ GUARDED_BY(buffer_map_lock_);
// A map of allocator ids to the unique ids of ProtectedBuffers allocated by
// the allocator with the allocator id. The size is equal to the number of
// active protected buffer allocators.
std::map<uint64_t, std::set<uint32_t>> allocator_to_buffers_map_
GUARDED_BY(buffer_map_lock_);
uint64_t next_protected_buffer_allocator_id_ GUARDED_BY(buffer_map_lock_);
base::Lock buffer_map_lock_;
DISALLOW_COPY_AND_ASSIGN(ProtectedBufferManager);
};
} // namespace arc
#endif // COMPONENTS_ARC_VIDEO_ACCELERATOR_PROTECTED_BUFFER_MANAGER_H_
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_BASE_UI_BASE_TYPES_H_
#define UI_BASE_UI_BASE_TYPES_H_
#include "ui/base/ui_base_export.h"
namespace ui {
class Event;
// Window "show" state.
enum WindowShowState {
// A default un-set state.
SHOW_STATE_DEFAULT = 0,
SHOW_STATE_NORMAL = 1,
SHOW_STATE_MINIMIZED = 2,
SHOW_STATE_MAXIMIZED = 3,
SHOW_STATE_INACTIVE = 4, // Views only, not persisted.
SHOW_STATE_FULLSCREEN = 5,
SHOW_STATE_END = 6 // The end of show state enum.
};
// Dialog button identifiers used to specify which buttons to show the user.
enum DialogButton {
DIALOG_BUTTON_NONE = 0,
DIALOG_BUTTON_OK = 1,
DIALOG_BUTTON_CANCEL = 2,
DIALOG_BUTTON_LAST = DIALOG_BUTTON_CANCEL,
};
// Specifies the type of modality applied to a window. Different modal
// treatments may be handled differently by the window manager.
enum ModalType {
MODAL_TYPE_NONE = 0, // Window is not modal.
MODAL_TYPE_WINDOW = 1, // Window is modal to its transient parent.
MODAL_TYPE_CHILD = 2, // Window is modal to a child of its transient parent.
MODAL_TYPE_SYSTEM = 3 // Window is modal to all other windows.
};
// The class of window and its overall z-order. Not all platforms provide this
// level of z-order granularity. For such platforms, which only provide a
// distinction between "normal" and "always on top" windows, any of the values
// here that aren't |kNormal| are treated equally as "always on top".
enum class ZOrderLevel {
// The default level for windows.
kNormal = 0,
// A "floating" window z-ordered above other normal windows.
//
// Note this is the traditional _desktop_ concept of a "floating window".
// Android has a concept of "freeform window mode" in which apps are presented
// in separate "floating" windows that can be moved and resized by the user.
// That's not what this is.
kFloatingWindow,
// UI elements are used to annotate positions on the screen, and thus must
// appear above floating windows.
kFloatingUIElement,
// There have been horrific security decisions that have been made on the web
// platform that are now expected behavior and cannot easily be changed. The
// only way to mitigate problems with these decisions is to inform the user by
// presenting them with a message that they are in a state that they might not
// expect, and this message must be presented in a UI that cannot be
// interfered with or covered up. Thus this level for Security UI that must be
// Z-ordered in front of everything else. Note that this is useful in
// situations where window modality (as in ModalType) cannot or should not be
// used.
kSecuritySurface,
};
// TODO(varunjain): Remove MENU_SOURCE_NONE (crbug.com/250964)
// A Java counterpart will be generated for this enum.
// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.ui.base
// These are used in histograms, do not remove/renumber entries. Only add at the
// end just before MENU_SOURCE_TYPE_LAST. Also remember to update the
// MenuSourceType enum listing in tools/metrics/histograms/enums.xml.
enum MenuSourceType {
MENU_SOURCE_NONE = 0,
MENU_SOURCE_MOUSE = 1,
MENU_SOURCE_KEYBOARD = 2,
MENU_SOURCE_TOUCH = 3,
MENU_SOURCE_TOUCH_EDIT_MENU = 4,
MENU_SOURCE_LONG_PRESS = 5,
MENU_SOURCE_LONG_TAP = 6,
MENU_SOURCE_TOUCH_HANDLE = 7,
MENU_SOURCE_STYLUS = 8,
MENU_SOURCE_ADJUST_SELECTION = 9,
MENU_SOURCE_ADJUST_SELECTION_RESET = 10,
MENU_SOURCE_TYPE_LAST = MENU_SOURCE_ADJUST_SELECTION_RESET
};
UI_BASE_EXPORT MenuSourceType GetMenuSourceTypeForEvent(const ui::Event& event);
} // namespace ui
#endif // UI_BASE_UI_BASE_TYPES_H_
|
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file scissorAttrib.h
* @author drose
* @date 2008-07-29
*/
#ifndef SCISSORATTRIB_H
#define SCISSORATTRIB_H
#include "pandabase.h"
#include "renderAttrib.h"
#include "luse.h"
class FactoryParams;
/**
* This restricts rendering to within a rectangular region of the scene,
* without otherwise affecting the viewport or lens properties. Geometry that
* falls outside the scissor region is not rendered. It is akin to the OpenGL
* glScissor() function.
*
* The ScissorAttrib always specifies its region relative to its enclosing
* DisplayRegion, in screen space, and performs no culling.
*
* See ScissorEffect if you wish to define a region relative to 2-D or 3-D
* coordinates in the scene graph, with culling.
*/
class EXPCL_PANDA_PGRAPH ScissorAttrib : public RenderAttrib {
private:
ScissorAttrib(const LVecBase4 &frame);
PUBLISHED:
static CPT(RenderAttrib) make_off();
INLINE static CPT(RenderAttrib) make(PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top);
static CPT(RenderAttrib) make(const LVecBase4 &frame);
static CPT(RenderAttrib) make_default();
INLINE bool is_off() const;
INLINE const LVecBase4 &get_frame() const;
public:
virtual void output(ostream &out) const;
protected:
virtual int compare_to_impl(const RenderAttrib *other) const;
virtual size_t get_hash_impl() const;
virtual CPT(RenderAttrib) compose_impl(const RenderAttrib *other) const;
private:
LVecBase4 _frame;
bool _off;
static CPT(RenderAttrib) _off_attrib;
PUBLISHED:
static int get_class_slot() {
return _attrib_slot;
}
virtual int get_slot() const {
return get_class_slot();
}
public:
static void register_with_read_factory();
virtual void write_datagram(BamWriter *manager, Datagram &dg);
protected:
static TypedWritable *make_from_bam(const FactoryParams ¶ms);
void fillin(DatagramIterator &scan, BamReader *manager);
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
RenderAttrib::init_type();
register_type(_type_handle, "ScissorAttrib",
RenderAttrib::get_class_type());
ScissorAttrib *attrib = new ScissorAttrib(LVecBase4(0, 1, 0, 1));
attrib->_off = true;
_attrib_slot = register_slot(_type_handle, 100, attrib);
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
static int _attrib_slot;
};
#include "scissorAttrib.I"
#endif
|
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_CHROMEOS_POLICY_DISPLAY_RESOLUTION_HANDLER_H_
#define CHROME_BROWSER_CHROMEOS_POLICY_DISPLAY_RESOLUTION_HANDLER_H_
#include <memory>
#include <set>
#include <string>
#include <vector>
#include "ash/public/mojom/cros_display_config.mojom-forward.h"
#include "chrome/browser/chromeos/policy/display_settings_handler.h"
namespace policy {
// Implements DeviceDisplayResolution device policy.
//
// Whenever there is a change in the display configration, any new display will
// be resized according to the policy (only if the policy is enabled and the
// display supports specified resolution and scale factor).
//
// Whenever there is a change in |kDeviceDisplayResolution| setting from
// CrosSettings, the new policy is reapplied to all displays.
//
// If the specified resolution or scale factor is not supported by some display,
// the resolution won't change.
//
// Once resolution or scale factor for some display was set by this policy it
// won't be reapplied until next reboot or policy change (i.e. user can manually
// override the settings for that display via settings page).
class DisplayResolutionHandler : public DisplaySettingsPolicyHandler {
public:
DisplayResolutionHandler();
~DisplayResolutionHandler() override;
// DisplaySettingsPolicyHandler
const char* SettingName() override;
void OnSettingUpdate() override;
void ApplyChanges(
ash::mojom::CrosDisplayConfigController* cros_display_config,
const std::vector<ash::mojom::DisplayUnitInfoPtr>& info_list) override;
private:
struct InternalDisplaySettings;
struct ExternalDisplaySettings;
bool policy_enabled_ = false;
bool recommended_ = false;
std::unique_ptr<ExternalDisplaySettings> external_display_settings_;
std::unique_ptr<InternalDisplaySettings> internal_display_settings_;
std::set<std::string> resized_display_ids_;
DISALLOW_COPY_AND_ASSIGN(DisplayResolutionHandler);
};
} // namespace policy
#endif // CHROME_BROWSER_CHROMEOS_POLICY_DISPLAY_RESOLUTION_HANDLER_H_
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#pragma once
#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_DEFAULT_USER_IMAGES_H_
#define CHROME_BROWSER_CHROMEOS_LOGIN_DEFAULT_USER_IMAGES_H_
#include <cstddef> // for size_t
#include <string>
namespace chromeos {
// Returns path to default user image with specified index.
// The path is used in Local State to distinguish default images.
std::string GetDefaultImagePath(int index);
// Checks if given path is one of the default ones. If it is, returns true
// and its index through |image_id|. If not, returns false.
bool IsDefaultImagePath(const std::string& path, int* image_id);
// Resource IDs of default user images.
extern const int kDefaultImageResources[];
// Number of default images.
extern const int kDefaultImagesCount;
} // namespace chromeos
#endif // CHROME_BROWSER_CHROMEOS_LOGIN_DEFAULT_USER_IMAGES_H_
|
/*
* Copyright (C) 2003 Lars Knoll (knoll@kde.org)
* Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights
* reserved.
* Copyright (C) 2008 Eric Seidel <eric@webkit.org>
* Copyright (C) 2009 - 2010 Torch Mobile (Beijing) Co. Ltd. All rights
* reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_MARKUP_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_MARKUP_H_
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
// Helper functions for converting from CSSValues to text.
namespace blink {
// Common serializing methods. See:
// https://drafts.csswg.org/cssom/#common-serializing-idioms
void SerializeIdentifier(const String& identifier,
StringBuilder& append_to,
bool skip_start_checks = false);
void SerializeString(const String&, StringBuilder& append_to);
String SerializeString(const String&);
String SerializeURI(const String&);
String SerializeFontFamily(const String&);
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_MARKUP_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 IOS_CHROME_BROWSER_UI_HISTORY_IOS_BROWSING_HISTORY_DRIVER_H_
#define IOS_CHROME_BROWSER_UI_HISTORY_IOS_BROWSING_HISTORY_DRIVER_H_
#include <vector>
#include "base/memory/weak_ptr.h"
#include "components/history/core/browser/browsing_history_driver.h"
#include "components/history/core/browser/browsing_history_service.h"
#include "url/gurl.h"
class ChromeBrowserState;
namespace history {
class HistoryService;
}
@protocol HistoryConsumer;
// A simple implementation of BrowsingHistoryServiceHandler that delegates to
// objective-c object HistoryConsumer for most actions.
class IOSBrowsingHistoryDriver : public history::BrowsingHistoryDriver {
public:
IOSBrowsingHistoryDriver(ChromeBrowserState* browser_state,
id<HistoryConsumer> consumer);
IOSBrowsingHistoryDriver(const IOSBrowsingHistoryDriver&) = delete;
IOSBrowsingHistoryDriver& operator=(const IOSBrowsingHistoryDriver&) = delete;
~IOSBrowsingHistoryDriver() override;
private:
// history::BrowsingHistoryDriver implementation.
void OnQueryComplete(
const std::vector<history::BrowsingHistoryService::HistoryEntry>& results,
const history::BrowsingHistoryService::QueryResultsInfo&
query_results_info,
base::OnceClosure continuation_closure) override;
void OnRemoveVisitsComplete() override;
void OnRemoveVisitsFailed() override;
void OnRemoveVisits(
const std::vector<history::ExpireHistoryArgs>& expire_list) override;
void HistoryDeleted() override;
void HasOtherFormsOfBrowsingHistory(bool has_other_forms,
bool has_synced_results) override;
bool AllowHistoryDeletions() override;
bool ShouldHideWebHistoryUrl(const GURL& url) override;
history::WebHistoryService* GetWebHistoryService() override;
void ShouldShowNoticeAboutOtherFormsOfBrowsingHistory(
const syncer::SyncService* sync_service,
history::WebHistoryService* history_service,
base::OnceCallback<void(bool)> callback) override;
// The current browser state.
ChromeBrowserState* browser_state_; // weak
// Consumer for IOSBrowsingHistoryDriver. Serves as client for HistoryService.
__weak id<HistoryConsumer> consumer_;
};
#endif // IOS_CHROME_BROWSER_UI_HISTORY_IOS_BROWSING_HISTORY_DRIVER_H_
|
/*-
* Copyright (c) 2014 Ruslan Bukin <br@bsdpad.com>
* All rights reserved.
*
* This software was developed by SRI International and the University of
* Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
* ("CTSRD"), as part of the DARPA CRASH research programme.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#define PIO_DATA 0x00
#define PIO_DIR 0x04
#define PIO_OUT(n) (1 << n)
#define PIO_OUT_ALL 0xffffffff
#define PIO_INT_MASK 0x08
#define PIO_UNMASK(n) (1 << n)
#define PIO_UNMASK_ALL 0xffffffff
#define PIO_EDGECAPT 0x0c
#define PIO_OUTSET 0x10
#define PIO_OUTCLR 0x14
|
/* $OpenBSD: version.h,v 1.76 2016/02/23 09:14:34 djm Exp $ */
/* $FreeBSD$ */
#define SSH_VERSION "OpenSSH_7.2"
#define SSH_PORTABLE "p2"
#define SSH_RELEASE SSH_VERSION SSH_PORTABLE
#define SSH_VERSION_FREEBSD "FreeBSD-20160310"
#ifdef WITH_OPENSSL
#define OPENSSL_VERSION SSLeay_version(SSLEAY_VERSION)
#else
#define OPENSSL_VERSION "without OpenSSL"
#endif
|
/*
* The Yices SMT Solver. Copyright 2015 SRI International.
*
* This program may only be used subject to the noncommercial end user
* license agreement which is downloadable along with this program.
*/
#ifndef MCSAT_VALUE_H_
#define MCSAT_VALUE_H_
#include <stdbool.h>
#include <poly/value.h>
#include "terms/rationals.h"
#include "model/concrete_values.h"
typedef enum {
/** No value */
VALUE_NONE,
/** Boolean value */
VALUE_BOOLEAN,
/** A rational */
VALUE_RATIONAL,
/** A value from the libpoly library */
VALUE_LIBPOLY
} mcsat_value_type_t;
typedef struct value_s {
mcsat_value_type_t type;
union {
bool b;
rational_t q;
lp_value_t lp_value;
};
} mcsat_value_t;
/** Predefined none value for convenience */
extern const mcsat_value_t mcsat_value_none;
/** Predefined true value for convenience */
extern const mcsat_value_t mcsat_value_true;
/** Predefined false value for convenience */
extern const mcsat_value_t mcsat_value_false;
/** Construct a default value (VALUE_NONE) */
void mcsat_value_construct_default(mcsat_value_t *value);
/** Construct a boolean */
void mcsat_value_construct_bool(mcsat_value_t *value, bool b);
/** Construct a rational */
void mcsat_value_construct_rational(mcsat_value_t *value, const rational_t *q);
/** Construct a value from the libpoly value */
void mcsat_value_construct_lp_value(mcsat_value_t *value, const lp_value_t *lp_value);
/** Construct a copy */
void mcsat_value_construct_copy(mcsat_value_t *value, const mcsat_value_t *from);
/** Destruct the value (removes any data and sets back to VALUE_NONE) */
void mcsat_value_destruct(mcsat_value_t *value);
/** Assign a value */
void mcsat_value_assign(mcsat_value_t *value, const mcsat_value_t *from);
/** Check two values for equalities */
bool mcsat_value_eq(const mcsat_value_t *v1, const mcsat_value_t *v2);
/** Get a hash of the value */
uint32_t mcsat_value_hash(const mcsat_value_t *v);
/** Print the value */
void mcsat_value_print(const mcsat_value_t *value, FILE *out);
/** Convert a basic value to yices model value. Types is passed in to enforce a type (e.g. for UF) */
value_t mcsat_value_to_value(mcsat_value_t *value, type_table_t *types, type_t type, value_table_t *vtbl);
/** Returns true if the value is 0 */
bool mcsat_value_is_zero(const mcsat_value_t *value);
/** Returns true if the value is true */
bool mcsat_value_is_true(const mcsat_value_t *value);
/** Returns true if the value is false */
bool mcsat_value_is_false(const mcsat_value_t *value);
#endif /* MCSAT_VALUE_H_ */
|
#ifndef ANET_TCPCONNECTION_H_
#define ANET_TCPCONNECTION_H_
#include <anet/databuffer.h>
#include <anet/connection.h>
namespace anet {
class DataBuffer;
class Socket;
class IPacketStreamer;
class IServerAdapter;
class TCPConnection : public Connection {
friend class TCPCONNECTIONTF;
public:
TCPConnection(Socket *socket, IPacketStreamer *streamer, IServerAdapter *serverAdapter);
~TCPConnection();
/*
* д³öÊý¾Ý
*
* @return ÊÇ·ñ³É¹¦
*/
bool writeData();
/*
* ¶ÁÈëÊý¾Ý
*
* @return ¶ÁÈëÊý¾Ý
*/
bool readData();
/*
* ÉèÖÃдÍêÊÇ·ñÖ÷¶¯¹Ø±Õ
*/
void setWriteFinishClose(bool v) {
_writeFinishClose = v;
}
/*
* Çå¿ÕoutputµÄbuffer
*/
void clearOutputBuffer() {
_output.clear();
}
/*
* Çå¿ÕoutputµÄbuffer
*/
void clearInputBuffer() {
_input.clear();
}
private:
DataBuffer _output; // Êä³öµÄbuffer
DataBuffer _input; // ¶ÁÈëµÄbuffer
PacketHeader _packetHeader; // ¶ÁÈëµÄpacket header
bool _gotHeader; // packet headerÒѾȡ¹ý
bool _writeFinishClose; // дÍê¶Ï¿ª
};
}
#endif /*TCPCONNECTION_H_*/
|
#include <stdlib.h>
#include <string.h>
#include "audio/audio.h"
#include "audio/sink.h"
#include "audio/sinks/openal_sink.h"
#include "utils/log.h"
audio_sink *_global_sink = NULL;
struct sink_info_t {
int (*sink_init_fn)(audio_sink *sink);
const char* name;
} sinks[] = {
#ifdef USE_OPENAL
{openal_sink_init, "openal"},
#endif // USE_OPENAL
#ifdef USE_SDLAUDIO
{sdl_sink_init, "sdl"},
#endif // USE_SDLAUDIO
{0, 0}
};
int audio_get_sink_count() {
int count = 0;
int sink_id = 0;
while(sinks[sink_id++].name != 0) {
count++;
}
return count;
}
const char* audio_get_sink_name(int sink_id) {
// Get sink
if(sink_id < 0 || sink_id >= audio_get_sink_count()) {
return NULL;
}
return sinks[sink_id].name;
}
const char* audio_get_first_sink_name() {
if(audio_get_sink_count() > 0) {
return sinks[0].name;
}
return NULL;
}
int audio_is_sink_available(const char* sink_name) {
for(int i = 0; i < audio_get_sink_count(); i++) {
if(strcmp(sink_name, sinks[i].name) == 0) {
return 1;
}
}
return 0;
}
void audio_render() {
if(_global_sink != NULL) {
sink_render(_global_sink);
}
}
int audio_init(const char* sink_name) {
struct sink_info_t si;
int found = 0;
// If null sink given, disable audio
if(sink_name == NULL) {
INFO("Audio sink NOT initialized; audio not available.");
return 0;
}
// Find requested sink
for(int i = 0; i < audio_get_sink_count(); i++) {
if(strcmp(sink_name, sinks[i].name) == 0) {
si = sinks[i];
found = 1;
}
}
if(!found) {
PERROR("Requested audio sink was not found!");
return 1;
}
// Inform user
INFO("Using audio sink '%s'.", si.name);
// Init sink
_global_sink = malloc(sizeof(audio_sink));
sink_init(_global_sink);
if(si.sink_init_fn(_global_sink) != 0) {
free(_global_sink);
_global_sink = NULL;
return 1;
}
// Success
INFO("Audio system initialized.");
return 0;
}
void audio_close() {
if(_global_sink != NULL) {
sink_free(_global_sink);
free(_global_sink);
_global_sink = NULL;
INFO("Audio system closed.");
}
}
audio_sink* audio_get_sink() {
return _global_sink;
}
|
/* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_cos_f32.c
* Description: Fast cosine calculation for floating-point values
*
* $Date: 27. January 2017
* $Revision: V.1.5.1
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2017 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* 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
*
* 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 "arm_math.h"
#include "arm_common_tables.h"
/**
* @ingroup groupFastMath
*/
/**
* @defgroup cos Cosine
*
* Computes the trigonometric cosine function using a combination of table lookup
* and linear interpolation. There are separate functions for
* Q15, Q31, and floating-point data types.
* The input to the floating-point version is in radians and in the range [0 2*pi) while the
* fixed-point Q15 and Q31 have a scaled input with the range
* [0 +0.9999] mapping to [0 2*pi). The fixed-point range is chosen so that a
* value of 2*pi wraps around to 0.
*
* The implementation is based on table lookup using 256 values together with linear interpolation.
* The steps used are:
* -# Calculation of the nearest integer table index
* -# Compute the fractional portion (fract) of the table index.
* -# The final result equals <code>(1.0f-fract)*a + fract*b;</code>
*
* where
* <pre>
* b=Table[index+0];
* c=Table[index+1];
* </pre>
*/
/**
* @addtogroup cos
* @{
*/
/**
* @brief Fast approximation to the trigonometric cosine function for floating-point data.
* @param[in] x input value in radians.
* @return cos(x).
*/
float32_t arm_cos_f32(
float32_t x)
{
float32_t cosVal, fract, in; /* Temporary variables for input, output */
uint16_t index; /* Index variable */
float32_t a, b; /* Two nearest output values */
int32_t n;
float32_t findex;
/* input x is in radians */
/* Scale the input to [0 1] range from [0 2*PI] , divide input by 2*pi, add 0.25 (pi/2) to read sine table */
in = x * 0.159154943092f + 0.25f;
/* Calculation of floor value of input */
n = (int32_t) in;
/* Make negative values towards -infinity */
if (in < 0.0f)
{
n--;
}
/* Map input value to [0 1] */
in = in - (float32_t) n;
/* Calculation of index of the table */
findex = (float32_t) FAST_MATH_TABLE_SIZE * in;
index = ((uint16_t)findex) & 0x1ff;
/* fractional value calculation */
fract = findex - (float32_t) index;
/* Read two nearest values of input value from the cos table */
a = sinTable_f32[index];
b = sinTable_f32[index+1];
/* Linear interpolation process */
cosVal = (1.0f-fract)*a + fract*b;
/* Return the output value */
return (cosVal);
}
/**
* @} end of cos group
*/
|
#ifndef __CHARCONV_H
#define __CHARCONV_H
/*
* some basic macros.
*/
#define is_digit(x) ((((x) >= '0') && ((x) <= '9')) ? 1 : 0)
#define is_lowercase(x) ((((x) >= 'a') && ((x) <= 'z')) ? 1 : 0)
#define is_uppercase(x) ((((x) >= 'A') && ((x) <= 'Z')) ? 1 : 0)
#define is_blank(x) (((x) == ' ') ? 1 : 0)
#define to_uppercase(x) ((is_lowercase(x)) ? ((x) - 'a' + 'A') : (x))
#define to_lowercase(x) ((is_uppercase(x)) ? ((x) + 'a' - 'A') : (x))
#define to_decimal(x) ((x) - '0')
#define to_ascii(x) ((((x) >= 0) && ((x) <= 9)) ? ((x) + '0') : -1)
#define ASCIINULL (char) '\0'
#define NDIG 80
#define NULLADDR ((char *) 0L)
#define MAXSIGDIG 14 /* maximum significant digits */
#define MAXDIG 60 /* maximum digits for F format */
#define MAXEXPDIG 2 /* maximum digits in exponent, E format */
#define MAXLONGDIG 10 /* maximum digits in long integer */
#define GOODCONV 1L
#define BADCONV 2L
#define BADFORMAT 4L
extern long a2l();
extern char *l2a();
extern double a2d();
extern char *d2a();
extern long char_a2l();
extern long char_l2a();
extern long char_a2d();
extern long char_d2a_e();
extern long char_d2a_f();
#endif
|
//
// IASKAppSettingsViewController.h
// http://www.inappsettingskit.com
//
// Copyright (c) 2009:
// Luc Vandal, Edovia Inc., http://www.edovia.com
// Ortwin Gentz, FutureTap GmbH, http://www.futuretap.com
// All rights reserved.
//
// It is appreciated but not required that you give credit to Luc Vandal and Ortwin Gentz,
// as the original authors of this code. You can give credit in a blog post, a tweet or on
// a info page of your app. Also, the original authors appreciate letting them know if you use this code.
//
// This code is licensed under the BSD license that is available at: http://www.opensource.org/licenses/bsd-license.php
//
#import <UIKit/UIKit.h>
#import <MessageUI/MessageUI.h>
#import "IASKSettingsStore.h"
#import "IASKViewController.h"
#import "IASKSpecifier.h"
@class IASKSettingsReader;
@class IASKAppSettingsViewController;
@protocol IASKSettingsDelegate
- (void)settingsViewControllerDidEnd:(IASKAppSettingsViewController*)sender;
@optional
#pragma mark - UITableView header customization
- (CGFloat) settingsViewController:(id<IASKViewController>)settingsViewController
tableView:(UITableView *)tableView
heightForHeaderForSection:(NSInteger)section;
- (UIView *) settingsViewController:(id<IASKViewController>)settingsViewController
tableView:(UITableView *)tableView
viewForHeaderForSection:(NSInteger)section;
#pragma mark - UITableView cell customization
- (CGFloat)tableView:(UITableView*)tableView heightForSpecifier:(IASKSpecifier*)specifier;
- (UITableViewCell*)tableView:(UITableView*)tableView cellForSpecifier:(IASKSpecifier*)specifier;
#pragma mark - mail composing customization
- (NSString*) settingsViewController:(id<IASKViewController>)settingsViewController
mailComposeBodyForSpecifier:(IASKSpecifier*) specifier;
- (UIViewController<MFMailComposeViewControllerDelegate>*) settingsViewController:(id<IASKViewController>)settingsViewController
viewControllerForMailComposeViewForSpecifier:(IASKSpecifier*) specifier;
- (void) settingsViewController:(id<IASKViewController>) settingsViewController
mailComposeController:(MFMailComposeViewController*)controller
didFinishWithResult:(MFMailComposeResult)result
error:(NSError*)error;
#pragma mark - Custom MultiValues
- (NSArray*)settingsViewController:(IASKAppSettingsViewController*)sender valuesForSpecifier:(IASKSpecifier*)specifier;
- (NSArray*)settingsViewController:(IASKAppSettingsViewController*)sender titlesForSpecifier:(IASKSpecifier*)specifier;
#pragma mark - respond to button taps
- (void)settingsViewController:(IASKAppSettingsViewController*)sender buttonTappedForKey:(NSString*)key __attribute__((deprecated)); // use the method below with specifier instead
- (void)settingsViewController:(IASKAppSettingsViewController*)sender buttonTappedForSpecifier:(IASKSpecifier*)specifier;
- (void)settingsViewController:(IASKAppSettingsViewController*)sender tableView:(UITableView *)tableView didSelectCustomViewSpecifier:(IASKSpecifier*)specifier;
@end
@interface IASKAppSettingsViewController : UITableViewController <IASKViewController, UITextFieldDelegate, MFMailComposeViewControllerDelegate>
@property (nonatomic, assign) IBOutlet id delegate;
@property (nonatomic, copy) NSString *file;
@property (nonatomic, assign) BOOL showCreditsFooter;
@property (nonatomic, assign) IBInspectable BOOL showDoneButton;
@property (nonatomic, retain) NSSet *hiddenKeys;
@property (nonatomic) IBInspectable BOOL neverShowPrivacySettings;
- (void)synchronizeSettings;
- (IBAction)dismiss:(id)sender;
- (void)setHiddenKeys:(NSSet*)hiddenKeys animated:(BOOL)animated;
@end
|
//////////////////////////////////////////////////////////////////////////
// SideCarFunctions.h
//
// Copyright (C) 2015 Microsoft Corp. All Rights Reserved
//////////////////////////////////////////////////////////////////////////
#pragma once
typedef ::XTools::SideCar*(*SideCarEntryPointFunc)();
typedef void(*LogFunc)(::XTools::LogSeverity severity, const char* file, int line, const char* message);
typedef void(*LogFuncSetter)(LogFunc);
typedef ::XTools::ProfileManagerPtr(*ProfilerFunc)();
typedef void(*ProfileFuncSetter)(ProfilerFunc);
// Implement this function in your SideCar dll, and have it return a new instance of your
// custom implementation of SideCar. Although this passes a naked pointer, the returned object
// will immediately be wrapped in a ref_ptr<SideCar>, so that it will be automatically deleted
// when no longer needed
extern "C" XTDLLEXPORT XTools::SideCar* CreateSideCar();
extern "C" XTDLLEXPORT void SetLogFunction(LogFunc func);
extern "C" XTDLLEXPORT void SetProfileFunc(ProfilerFunc func);
|
#ifndef CURSORCHANGENOTIFIER_H
#define CURSORCHANGENOTIFIER_H
#include <QObject>
#include "pointerchangesink.h"
class QCursor;
class CursorChangeNotifierPrivate;
/**
* The CursorChangeNotifier class notifies when mouse cursor's style should
* be changed.
*
* RDP server passes the currently shown mouse cursor's style over network when
* ever the style changes. This class receives those updates and emits the
* changed cursor style so that it can be applied in the widget.
*/
class CursorChangeNotifier : public QObject, public PointerChangeSink {
Q_OBJECT
public:
CursorChangeNotifier(QObject *parent = 0);
~CursorChangeNotifier();
/**
* Implemented from PointerChangeSink.
*/
virtual int getPointerStructSize() const;
/**
* Implemented from PointerChangeSink.
*/
virtual void addPointer(rdpPointer* pointer);
/**
* Implemented from PointerChangeSink.
*/
virtual void removePointer(rdpPointer* pointer);
/**
* Implemented from PointerChangeSink.
*/
virtual void changePointer(rdpPointer* pointer);
signals:
/**
* This signal is emitted when current mouse cursor style changes.
*/
void cursorChanged(const QCursor &cursor);
private slots:
void onPointerChanged(int index);
private:
Q_DECLARE_PRIVATE(CursorChangeNotifier)
CursorChangeNotifierPrivate* const d_ptr;
};
#endif // CURSORCHANGENOTIFIER_H
|
//
// Flow.h
// Flow
//
// The MIT License (MIT)
// Copyright (c) 2014 Oliver Letterer, Sparrow-Labs
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#import <Flow/FLWTouchGesture.h>
#import <Flow/FLWTutorialController.h>
#import <Flow/FLWTapGesture.h>
#import <Flow/FLWSwipeGesture.h>
#import <Flow/FLWCompoundGesture.h>
|
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "UnrealEd.h"
#include "PythonEditorCustomization.generated.h"
USTRUCT()
struct FTextCustomization
{
GENERATED_USTRUCT_BODY()
FTextCustomization()
: Font("")
, Color(0.0f, 0.0f, 0.0f, 1.0f)
{
}
UPROPERTY(EditAnywhere, Category=Text)
FString Font;
UPROPERTY(EditAnywhere, Category=Text)
FLinearColor Color;
};
USTRUCT()
struct FControlCustomization
{
GENERATED_USTRUCT_BODY()
FControlCustomization()
: Color(0.0f, 0.0f, 0.0f, 1.0f)
{
}
UPROPERTY(EditAnywhere, Category=Controls)
FLinearColor Color;
};
UCLASS(Config=Editor)
class UPythonEditorCustomization : public UObject
{
GENERATED_UCLASS_BODY()
static const FControlCustomization& GetControl(const FName& ControlCustomizationName);
static const FTextCustomization& GetText(const FName& TextCustomizationName);
private:
UPROPERTY(EditAnywhere, EditFixedSize, Category=Controls)
TArray<FControlCustomization> Controls;
UPROPERTY(EditAnywhere, EditFixedSize, Category=Text)
TArray<FTextCustomization> Text;
}; |
/**
* \file
* \brief Echo server
*/
/*
* Copyright (c) 2007, 2008, 2009, ETH Zurich.
* All rights reserved.
*
* This file is distributed under the terms in the attached LICENSE file.
* If you do not find this file, copies can be found by writing to:
* ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
*/
#include <barrelfish/barrelfish.h>
#include <stdio.h>
#include <assert.h>
#include <lwip/netif.h>
#include <lwip/dhcp.h>
#include <netif/etharp.h>
#include <lwip/init.h>
#include <lwip/tcp.h>
#include <netif/bfeth.h>
#include <trace/trace.h>
#include <trace_definitions/trace_defs.h>
#include "echoserver.h"
extern void idc_print_statistics(void);
extern void idc_print_cardinfo(void);
extern uint64_t minbase, maxbase;
#if TRACE_ONLY_SUB_NNET
static size_t n64b = 0;
#endif
static void echo_server_close(struct tcp_pcb *tpcb)
{
tcp_arg(tpcb, NULL);
tcp_close(tpcb);
}
static void echo_server_err(void *arg, err_t err)
{
printf("echo_server_err! %p %d\n", arg, err);
}
static err_t echo_server_recv(void *arg, struct tcp_pcb *tpcb, struct pbuf *p,
err_t err)
{
int r;
if (p == NULL) {
// close the connection
echo_server_close(tpcb);
return ERR_OK;
}
#if TRACE_ONLY_SUB_NNET
trace_event(TRACE_SUBSYS_NNET, TRACE_EVENT_NNET_RXAPPRCV,
0);
#endif // TRACE_ONLY_SUB_NNET
/* don't send an immediate ack here, do it later with the data */
tpcb->flags |= TF_ACK_DELAY;
assert(p->next == 0);
/*if ((p->tot_len > 2) && (p->tot_len < 200)) {
if (strncmp(p->payload, "stat", 4) == 0) {
idc_print_statistics();
}
if (strncmp(p->payload, "cardinfo", 8) == 0) {
idc_print_cardinfo();
}
if (strncmp(p->payload, "lwipinfo", 8) == 0) {
printf("echoserver's memory affinity: [0x%lx, 0x%lx]\n",
minbase, maxbase);
}
}*/
#if TRACE_ONLY_SUB_NNET
if (p->tot_len == 64) {
n64b++;
if (n64b == 5) {
trace_control(TRACE_EVENT(TRACE_SUBSYS_NNET,
TRACE_EVENT_NNET_START, 0),
TRACE_EVENT(TRACE_SUBSYS_NNET,
TRACE_EVENT_NNET_STOP, 0), 0);
trace_event(TRACE_SUBSYS_NNET, TRACE_EVENT_NNET_START, 0);
} else if (n64b == 8) {
trace_event(TRACE_SUBSYS_NNET, TRACE_EVENT_NNET_STOP, 0);
char* trbuf = malloc(4096*4096);
size_t length = trace_dump(trbuf, 4096*4096, NULL);
printf("%s\n", trbuf);
printf("length of buffer %zu\n", length);
free(trbuf);
}
}
trace_event(TRACE_SUBSYS_NNET, TRACE_EVENT_NNET_TXAPPSNT, 0);
#endif
//XXX: can we do that without needing to copy it??
r = tcp_write(tpcb, p->payload, p->len, TCP_WRITE_FLAG_COPY);
assert(r == ERR_OK);
#if TRACE_ONLY_SUB_NNET
trace_event(TRACE_SUBSYS_NNET, TRACE_EVENT_NNET_TX_TCP_WRITE, 0);
#endif
// make sure data gets sent immediately
r = tcp_output(tpcb);
assert(r == ERR_OK);
#if TRACE_ONLY_SUB_NNET
trace_event(TRACE_SUBSYS_NNET, TRACE_EVENT_NNET_TX_TCP_OUTPUT, 0);
#endif
tcp_recved(tpcb, p->len);
#if TRACE_ONLY_SUB_NNET
trace_event(TRACE_SUBSYS_NNET, TRACE_EVENT_NNET_TX_TCP_RECV, 0);
#endif
//now we can advertise a bigger window
pbuf_free(p);
#if TRACE_ONLY_SUB_NNET
trace_event(TRACE_SUBSYS_NNET, TRACE_EVENT_NNET_TX_TCP_FREE, 0);
#endif
return ERR_OK;
}
static err_t echo_server_sent(void *arg, struct tcp_pcb *tpcb, u16_t length)
{
return ERR_OK;
}
static err_t echo_server_accept(void *arg, struct tcp_pcb *tpcb, err_t err)
{
assert(err == ERR_OK);
tcp_recv(tpcb, echo_server_recv);
tcp_sent(tpcb, echo_server_sent);
tcp_err(tpcb, echo_server_err);
tcp_arg(tpcb, 0);
return ERR_OK;
}
int tcp_echo_server_init(void)
{
err_t r;
uint16_t bind_port = 7; //don't use htons() (don't know why...)
struct tcp_pcb *pcb = tcp_new();
if (pcb == NULL) {
return ERR_MEM;
}
r = tcp_bind(pcb, IP_ADDR_ANY, bind_port);
if(r != ERR_OK) {
return(r);
}
struct tcp_pcb *pcb2 = tcp_listen(pcb);
assert(pcb2 != NULL);
tcp_accept(pcb2, echo_server_accept);
printf("TCP echo_server_init(): bound.\n");
printf("TCP installed receive callback.\n");
return (0);
}
|
//
// KAZ_AppDelegate.h
// JoystickNode
//
// Created by Kevin Kazmierczak on 10/21/13.
// Copyright (c) 2013 Kevin Kazmierczak. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface KAZ_AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
//
// OAFavoriteItem.h
// OsmAnd
//
// Created by Anton Rogachevskiy on 07.11.14.
// Copyright (c) 2014 OsmAnd. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "OALocationPoint.h"
#include <OsmAndCore/IFavoriteLocation.h>
@interface OAFavoriteItem : NSObject<OALocationPoint>
@property std::shared_ptr<OsmAnd::IFavoriteLocation> favorite;
@property CGFloat direction;
@property NSString* distance;
@property double distanceMeters;
@end
|
/* GTK - The GIMP Toolkit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GTK_BGBOX_H__
#define __GTK_BGBOX_H__
#include <gdk/gdk.h>
#include <gtk/gtkbin.h>
#include "bg.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define GTK_TYPE_BGBOX (gtk_bgbox_get_type ())
#define GTK_BGBOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_BGBOX, GtkBgbox))
#define GTK_BGBOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_BGBOX, GtkBgboxClass))
#define GTK_IS_BGBOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_BGBOX))
#define GTK_IS_BGBOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_BGBOX))
#define GTK_BGBOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_BGBOX, GtkBgboxClass))
typedef struct _GtkBgbox GtkBgbox;
typedef struct _GtkBgboxClass GtkBgboxClass;
struct _GtkBgbox
{
GtkBin bin;
};
struct _GtkBgboxClass
{
GtkBinClass parent_class;
};
enum { BG_NONE, BG_STYLE, BG_ROOT, BG_INHERIT, BG_LAST };
GType gtk_bgbox_get_type (void) G_GNUC_CONST;
GtkWidget* gtk_bgbox_new (void);
void gtk_bgbox_set_background (GtkWidget *widget, int bg_type, guint32 tintcolor, gint alpha);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __GTK_BGBOX_H__ */
|
/*
Part of i2cp C library
Copyright (C) 2013 Oliver Queen <oliver@mail.i2p>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <stdlib.h>
#include <i2cp/stringmap.h>
#include <i2cp/logger.h>
#define COUNT 1000
static void _foreach_func(const char *key, void *value, void *opaque)
{
uint32_t *counter = (uint32_t *)opaque;
(*counter)++;
}
int main(int argc, char **argv)
{
int i;
uint32_t counter;
char key[64];
long value;
struct stringmap_t *sm = stringmap_new(100);
/* populate map */
for (i = 0; i < COUNT; i++)
{
sprintf(key, "%d", i);
stringmap_put(sm, key, (void *)(long)i);
}
/* random gets */
for (i = 0; i < 100; i++)
{
int r = rand() % COUNT;
sprintf(key, "%d", r);
value = (long)stringmap_get(sm, key);
if (r != value)
fatal(STRINGMAP, " %s(%d) != %d", key, r, value);
}
/* test foreach func */
counter = 0;
stringmap_foreach(sm, _foreach_func, (void *)&counter);
if (counter != COUNT)
fatal(STRINGMAP, " foreach %d != %d", COUNT, counter);
/* remove all but a single item */
for (i = 0; i < COUNT-1; i++)
{
sprintf(key, "%d", i);
stringmap_remove(sm, key);
}
/* verify last item */
sprintf(key, "%d", COUNT-1);
value = (long)stringmap_get(sm, key);
if (COUNT-1 != value)
fatal(STRINGMAP, " %s(%d) != %d", key, COUNT-1, value);
/* remove last */
stringmap_remove(sm, key);
stringmap_destroy(sm);
return 0;
}
|
#ifndef DEMO_H
#define DEMO_H
#include "image.h"
void demo(char *cfgfile, char *weightfile, float thresh, int cam_index, const char *filename, char **names, int classes, int frame_skip, char *prefix, int avg, float hier_thresh, int w, int h, int fps, int fullscreen);
#endif
|
#ifndef __DEBUG_H__
#define __DEBUG_H__
//---------------------------------------------------------------------------
// debug.h - Debug equates for messaging at different debug levels -
//---------------------------------------------------------------------------
// Version -
// 0.1 Original Version Jan 14, 2001 -
// -
// (c)2001 Mycal Labs, All Rights Reserved -
//---------------------------------------------------------------------------
#if defined(WEB_PROXY)
#define DEBUG_LV0 1
#else
//#define DEBUG_LV0 1
#endif
//#define DEBUG_LV1 1 /* general */
//#define DEBUG_LV2 1 /* files and yhash */
//#define DEBUG_LV3 1 /* packets */
//#define DEBUG_LV4 1 /* memory debug */
//#define DEBUG_LV5 1 /*rtt*/
//#define DEBUG_LV9 1 /*Misc temporary debug*/
//#define PACKET_RX_DEBUG 1
//#if DEBUG_LV1 || DEBUG_LV2 123
//#include <stdio.h>
//#endif
//
// Debug level 0 proxy application debug
//
#ifdef DEBUG_LV0
#define DEBUG0 yprintf
#else
#ifdef WIN32
#define DEBUG0
#else
#define DEBUG0(...) //
#endif
#endif
//
// Debug level 1 proxy application debug
//
#ifdef DEBUG_LV1
#define DEBUG1 yprintf
#else
#ifdef WIN32
#define DEBUG1
#else
#define DEBUG1(...) //
#endif
#endif
#ifdef DEBUG_LV2
#define DEBUG2 yprintf
#else
#ifdef WIN32
#define DEBUG2
#else
#define DEBUG2(...) //
#endif
#endif
#ifdef DEBUG_LV3
#define DEBUG3 yprintf
#else
#ifdef WIN32
#define DEBUG3
#else
#define DEBUG3(...) //
#endif
#endif
#ifdef DEBUG_LV4
#define DEBUG4 yprintf
#else
#ifdef WIN32
#define DEBUG4
#else
#define DEBUG4(...) //
#endif
#endif
// Debug level 5 is for RTT debugging
#ifdef DEBUG_LV5
#define DEBUG5 yprintf
#else
#ifdef WIN32
#define DEBUG5
#else
#define DEBUG5(...) //
#endif // //
#endif
// Debug level 9 is for testing specific things and is not set to one area.
#ifdef DEBUG_LV9
#define DEBUG9 yprintf
#else
#ifdef WIN32
#define DEBUG9
#else
#define DEBUG9(...) //
#endif // //
#endif
#endif
|
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface RNNLayoutManager : NSObject
+ (UIViewController *)findComponentForId:(NSString *)componentId;
@end
|
#import <UIKit/UIKit.h>
FOUNDATION_EXPORT double Pods_WTTagView_TestsVersionNumber;
FOUNDATION_EXPORT const unsigned char Pods_WTTagView_TestsVersionString[];
|
//******************************************************************************
//
// Copyright (c) 2015 Microsoft Corporation. All rights reserved.
//
// This code is licensed under the MIT License (MIT).
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
//******************************************************************************
#pragma once
#include "Starboard.h"
#include <utility>
#include <COMIncludes.h>
#include <wrl\client.h>
#include <wrl\wrappers\corewrappers.h>
#include <windows.foundation.h>
#include <windows.foundation.collections.h>
#include <COMIncludes_End.h>
namespace WRLHelpers {
namespace Private {
// Dispatcher class template declaration for generically working with WRL types
// Main issue is that ABI types will either be IFoo* or HSTRING or a few other
// value types. IFoo* and HSTRING have similar lifetime concerns but don't have a
// common type to work with them generically. This solves that by using a type that has a
// .Get() and .GetAddressOf() to get and assign to them.
template <typename T>
struct TypeTraits;
template <class Q>
struct TypeTraits<Q*> {
using type = Microsoft::WRL::ComPtr<Q>;
};
template <>
struct TypeTraits<HSTRING> {
using type = Microsoft::WRL::Wrappers::HString;
};
}
// Helps with iterating an iterable container (like a vector, map, etc.) Calls a functor on each
// element in the iterable range with the value it found.
template <typename T, typename Q>
HRESULT ForEach(ABI::Windows::Foundation::Collections::IIterable<T>* iterable, Q&& functor) {
boolean more;
Microsoft::WRL::ComPtr<ABI::Windows::Foundation::Collections::IIterator<T>> iter;
RETURN_IF_FAILED(iterable->First(&iter));
RETURN_IF_FAILED(iter->get_HasCurrent(&more));
while (more) {
boolean stop = false;
typename Private::TypeTraits<T>::type current;
RETURN_IF_FAILED(iter->get_Current(current.GetAddressOf()));
RETURN_IF_FAILED(functor(current.Get(), &stop));
if (stop) {
break;
}
RETURN_IF_FAILED(iter->MoveNext(&more));
}
return S_OK;
}
// Helps with iterating an IVector<T>. Calls a functor on each element with the value it found.
template <typename T, typename Q>
HRESULT ForEach(ABI::Windows::Foundation::Collections::IVector<T>* vector, Q&& functor) {
Microsoft::WRL::ComPtr<ABI::Windows::Foundation::Collections::IIterable<T>> iter;
RETURN_IF_FAILED(vector->QueryInterface(IID_PPV_ARGS(&iter)));
return ForEach(iter.Get(), std::forward<Q>(functor));
}
// Helps with iterating an IVectorView<T>. Calls a functor on each element with the value it found.
template <typename T, typename Q>
HRESULT ForEach(ABI::Windows::Foundation::Collections::IVectorView<T>* vector, Q&& functor) {
Microsoft::WRL::ComPtr<ABI::Windows::Foundation::Collections::IIterable<T>> iter;
RETURN_IF_FAILED(vector->QueryInterface(IID_PPV_ARGS(&iter)));
return ForEach(iter.Get(), std::forward<Q>(functor));
}
// Helps with iterating collections. Calls a functor on each element with the value it found.
// Required because the other overloads take M*, but ComPtr<M> has no implicit conversion to M*.
template <typename T, typename Q>
HRESULT ForEach(const Microsoft::WRL::ComPtr<T>& source, Q&& functor) {
return ForEach(source.Get(), functor);
}
// Helps with iterating an IPropertySet. Calls a functor on each element with the value it found.
template <typename Q>
HRESULT ForEach(ABI::Windows::Foundation::Collections::IPropertySet* propertySet, Q&& functor) {
Microsoft::WRL::ComPtr<ABI::Windows::Foundation::Collections::IIterable<
ABI::Windows::Foundation::Collections::IKeyValuePair<HSTRING, IInspectable*>*>> iter;
RETURN_IF_FAILED(propertySet->QueryInterface(IID_PPV_ARGS(&iter)));
return ForEach(iter.Get(), std::forward<Q>(functor));
}
// Helps with iterating an IMapView. Calls a functor on each element with the value it found.
template <typename K, typename V, typename Q>
HRESULT ForEach(ABI::Windows::Foundation::Collections::IMapView<K, V>* mapView, Q&& functor) {
Microsoft::WRL::ComPtr<ABI::Windows::Foundation::Collections::IIterable<ABI::Windows::Foundation::Collections::IKeyValuePair<K, V>*>>
iter;
RETURN_IF_FAILED(mapView->QueryInterface(IID_PPV_ARGS(&iter)));
return ForEach(iter.Get(), std::forward<Q>(functor));
}
// Helps with iterating an IMap. Calls a functor on each element with the value it found.
template <typename K, typename V, typename Q>
HRESULT ForEach(ABI::Windows::Foundation::Collections::IMap<K, V>* map, Q&& functor) {
Microsoft::WRL::ComPtr<ABI::Windows::Foundation::Collections::IIterable<ABI::Windows::Foundation::Collections::IKeyValuePair<K, V>*>>
iter;
RETURN_IF_FAILED(map->QueryInterface(IID_PPV_ARGS(&iter)));
return ForEach(iter.Get(), std::forward<Q>(functor));
}
} |
#ifndef _MATRIX2DCL_H
#define _MATRIX2DCL_H
#include "Matrix2D.h"
class Matrix2Dcl : virtual public Matrix2D
{
public:
Matrix2Dcl();
Matrix2Dcl(int line, int col);
void display();
void display(int n);
ValueType get(int line, int col);
void set(int line, int col, ValueType v);
Matrix2Dcl getColsBloc(int noCol, int nbCols);
void setColsBloc(int noCol, Matrix2Dcl v);
void setBloc(int noLine, int noCol, Matrix2Dcl v);
};
#endif
|
/*
** This source file is part of AGE
**
** For the latest info, see http://code.google.com/p/ascii-game-engine/
**
** Copyright (c) 2011 Tony & Tony's Toy Game Development Team
**
** Permission is hereby granted, free of charge, to any person obtaining a copy of
** this software and associated documentation files (the "Software"), to deal in
** the Software without restriction, including without limitation the rights to
** use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
** the Software, and to permit persons to whom the Software is furnished to do so,
** subject to the following conditions:
**
** The above copyright notice and this permission notice shall be included in all
** copies or substantial portions of the Software.
**
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
** FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
** IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef __AGE_CONTROLLER_H__
#define __AGE_CONTROLLER_H__
#include "../ageconfig.h"
#include "../common/agetype.h"
#include "../common/agelist.h"
#include "../common/agehashtable.h"
/**
* @brief object controlling functor
*
* @param[in] _obj - object to be controlled
* @param[in] _name - object name
* @param[in] _elapsedTime - elapsed time since last frame
* @param[in] _lparam - first param
* @param[in] _wparam - second param
* @param[in] _extra - extra data
* @return - execution status
*/
typedef s32 (* control_proc)(Ptr _obj, const Str _name, s32 _elapsedTime, u32 _lparam, u32 _wparam, Ptr _extra);
/**
* @brief set a controller of a canvas
*
* @param[in] _obj - canvas object
* @param[in] _proc - controller
*/
AGE_API void set_canvas_controller(Ptr _obj, control_proc _proc);
/**
* @brief get a controller of a canvas
*
* @param[in] _obj - canvas object
* @return controller
*/
AGE_API control_proc get_canvas_controller(Ptr _obj);
/**
* @brief set a controller of a sprite
*
* @param[in] _obj - sprite object
* @param[in] _proc - controller
*/
AGE_API void set_sprite_controller(Ptr _obj, control_proc _proc);
/**
* @brief get a controller of a sprite
*
* @param[in] _obj - sprite object
* @return controller
*/
AGE_API control_proc get_sprite_controller(Ptr _obj);
#endif /* __AGE_CONTROLLER_H__ */
|
// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
// Please see LICENSE.md in repository root for license information
// https://github.com/AtomicGameEngine/AtomicGameEngine
#ifdef USE_SPIDERMONKEY
#pragma once
#include "Object.h"
using namespace Atomic;
struct JSRuntime;
struct JSContext;
class JSAutoRequest;
class JSAutoCompartment;
namespace AtomicEditor
{
// Notes: SpiderMonkey Reflect API is giving some bad loc's, which seems to be an issue with the
// C++ generator not passing in tokens for some nodes (MemberExpression.property for example)
// probably should use http://esprima.org/
class JSSpiderMonkeyVM : public Object
{
OBJECT(JSSpiderMonkeyVM);
public:
/// Construct.
JSSpiderMonkeyVM(Context* context);
/// Destruct.
~JSSpiderMonkeyVM();
bool ExecuteFile(const String& path);
bool ParseJavascriptToJSON(const char* source, String& json);
bool ParseJavascriptToJSONWithSpiderMonkeyReflectAPI(const char* source, String& json);
private:
bool ReadZeroTerminatedSourceFile(const String& path, String& source);
// for access within duktape callbacks
static WeakPtr<JSSpiderMonkeyVM> instance_;
JSRuntime* runtime_;
JSContext* jscontext_;
JSAutoRequest* autorequest_;
JSAutoCompartment* autocompartment_;
};
}
#endif
|
/*
* File: HardwareProfile.h
* Author: andrew
*
* Created on 10 June 2014, 16:40
*/
#ifndef HARDWAREPROFILE_H
#define HARDWAREPROFILE_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif /* HARDWAREPROFILE_H */
// PIC to hardware pin mapping and control macros
#define pickerBus LATB
#define pickerBusTRIS TRISB
#define feederDir LATEbits.LATE3
#define feederStep LATEbits.LATE4
#define feederRelay LATDbits.LATD6
#define feederXHome PORTEbits.RE0
#define feederZHome PORTEbits.RE1
#define feederStepTRIS TRISEbits.TRISE4
#define feederDirTRIS TRISEbits.TRISE3
#define feederRelayTRIS TRISDbits.TRISD6
#define feederXHomeTRIS TRISEbits.TRISE0
#define feederZHomeTRIS TRISEbits.TRISE1
#define baseLED LATDbits.LATD1
#define headLED LATDbits.LATD2
#define baseLEDTRIS TRISDbits.TRISD1
#define headLEDTRIS TRISDbits.TRISD2
#define vibrationPin LATDbits.LATD0
#define vibrationTRIS TRISDbits.TRISD0
#define setVac1on LATDbits.LATD12 = 1; vac1running = 1;
#define setVac1off LATDbits.LATD12 = 0; vac1running = 0;
#define setVac2on LATDbits.LATD4 = 1; vac2running = 1;
#define setVac2off LATDbits.LATD4 = 0; vac2running = 0;
#define setVibrationon LATDbits.LATD0 = 1; vibrationrunning = 1;
#define setVibrationoff LATDbits.LATD0 = 0; vibrationrunning = 0;
/*******************************************************************/
/******** USB stack hardware selection options *********************/
/*******************************************************************/
//This section is the set of definitions required by the MCHPFSUSB
// framework. These definitions tell the firmware what mode it is
// running in, and where it can find the results to some information
// that the stack needs.
//These definitions are required by every application developed with
// this revision of the MCHPFSUSB framework. Please review each
// option carefully and determine which options are desired/required
// for your application.
//#define USE_SELF_POWER_SENSE_IO
#define tris_self_power TRISAbits.TRISA2 // Input
#define self_power 1
//#define USE_USB_BUS_SENSE_IO
#define tris_usb_bus_sense TRISBbits.TRISB5 // Input
#define USB_BUS_SENSE 1
// Device Vendor Indentifier (VID) (0x04D8 is Microchip's VID)
#define USB_VID 0x04D8
// Device Product Indentifier (PID) (0x0042)
#define USB_PID 0x0042
// Manufacturer string descriptor
#define MSDLENGTH 17
#define MSD 'A','B',' ','E','l','e','c','t','r','o','n','i','c','s',' ','U','K'
// Product String descriptor
#define PSDLENGTH 25
#define PSD 'P','i','c','k',' ','a','n','d',' ','P','l','a','c','e',' ','C','o','n','t','r','o','l','l','e','r'
// Device serial number string descriptor
#define DSNLENGTH 7
#define DSN 'V','e','r','_','3','.','0' |
//
// AKOscillatorBankAudioUnit.h
// AudioKit
//
// Created by Aurelius Prochazka, revision history on Github.
// Copyright © 2017 Aurelius Prochazka. All rights reserved.
//
#pragma once
#import "AKBankAudioUnit.h"
@interface AKOscillatorBankAudioUnit : AKBankAudioUnit
- (void)setupWaveform:(int)size;
- (void)setWaveformValue:(float)value atIndex:(UInt32)index;
- (void)startNote:(uint8_t)note velocity:(uint8_t)velocity;
- (void)startNote:(uint8_t)note velocity:(uint8_t)velocity frequency:(float)frequency;
- (void)stopNote:(uint8_t)note;
- (void)reset;
@end
|
// Copyright (c) 2005-2009 Jaroslav Gresula
//
// Distributed under the MIT license (See accompanying file
// LICENSE.txt or copy at http://jagpdf.org/LICENSE.txt)
//
#include <boost/shared_array.hpp>
#ifndef __SHAREDARRAY_H_JAG_1238__
#define __SHAREDARRAY_H_JAG_1238__
namespace jag
{
typedef std::pair<boost::shared_array</*const*/ Byte>,std::size_t> SharedArray;
} //namespace jag
#endif //__SHAREDARRAY_H_JAG_1238__
|
/*
The MIT License (MIT)
Copyright (c) 2016 Alexey Yegorov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
*/
#ifndef RENDERING_PASSES_PASS_TARGET_PLACEMENT_H_INCLUDED
#define RENDERING_PASSES_PASS_TARGET_PLACEMENT_H_INCLUDED
#include "math/types.h"
#include "utils/std/dependency_index.h"
#include "utils/std/enum.h"
#include "pass_slot.h"
#include "pass_target.h"
#include "pass_target_storage.h"
#include <vector>
namespace eps {
namespace rendering {
class pass_target_placement
{
public:
void initialize(size_t place_count);
void construct(const math::uvec2 & size,
const product_type & depth,
const product_type & stencil);
void register_target(size_t place, utils::unique<pass_target> target);
void register_dependency(size_t place, size_t dependency,
const pass_slot & input, const pass_slot & output);
utils::link<pass_target> get_target(size_t place) const;
size_t get_dependency(size_t place, const pass_slot & input) const;
size_t get_dependency_slot(size_t place, const pass_slot & input) const;
void clear_targets();
private:
using pass_target_links = std::vector<utils::link<pass_target>>;
using pass_target_dependencies = utils::dependency_index<utils::to_int(pass_slot::MAX), size_t, size_t(-1)>;
using pass_target_slots = utils::dependency_index<utils::to_int(pass_slot::MAX), size_t, 0>;
pass_target_storage storage_;
pass_target_links links_;
pass_target_dependencies dependencies_;
pass_target_slots slots_;
};
} /* rendering */
} /* eps */
#endif // RENDERING_PASSES_PASS_TARGET_PLACEMENT_H_INCLUDED
|
#ifndef _EGL_COMMON_H
#define _EGL_COMMON_H
#endif
#include <stdbool.h>
#include <wayland-client.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
extern EGLDisplay egl_display;
extern EGLConfig egl_config;
extern EGLContext egl_context;
extern PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC eglCreatePlatformWindowSurfaceEXT;
bool egl_init(struct wl_display *display);
void egl_finish(void);
|
// Copyright (c) 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE-CHROMIUM file.
#ifndef BROWSER_DEVTOOLS_MANAGER_DELEGATE_H_
#define BROWSER_DEVTOOLS_MANAGER_DELEGATE_H_
#include "base/macros.h"
#include "base/compiler_specific.h"
#include "content/browser/devtools/devtools_http_handler.h"
#include "content/public/browser/devtools_agent_host_observer.h"
#include "content/public/browser/devtools_manager_delegate.h"
namespace brightray {
class DevToolsManagerDelegate : public content::DevToolsManagerDelegate,
public content::DevToolsAgentHostObserver {
public:
static void StartHttpHandler();
static void StopHttpHandler();
DevToolsManagerDelegate();
virtual ~DevToolsManagerDelegate();
private:
// DevToolsManagerDelegate implementation.
void Inspect(content::DevToolsAgentHost* agent_host) override {}
bool HandleCommand(content::DevToolsAgentHost* agent_host,
content::DevToolsAgentHostClient* client,
base::DictionaryValue* command) override;
std::string GetTargetType(content::WebContents* web_contents) override {
return std::string();
}
std::string GetTargetTitle(content::WebContents* web_contents) override {
return std::string();
}
scoped_refptr<content::DevToolsAgentHost> CreateNewTarget(
const GURL& url) override {return nullptr;}
std::string GetDiscoveryPageHTML() override
{return std::string();}
bool HasBundledFrontendResources() override {return true;};
// content::DevToolsAgentHostObserver overrides.
void DevToolsAgentHostAttached(
content::DevToolsAgentHost* agent_host) override;
void DevToolsAgentHostDetached(
content::DevToolsAgentHost* agent_host) override;
DISALLOW_COPY_AND_ASSIGN(DevToolsManagerDelegate);
};
} // namespace brightray
#endif // BROWSER_DEVTOOLS_MANAGER_DELEGATE_H_
|
/* Auto generated file: with makeref.py . Docs go in src/ *.doc . */
#define DOC_PYGAMEMOVIE "pygame module for playback of mpeg video"
#define DOC_PYGAMEMOVIEMOVIE "Movie(filename) -> Movie\nMovie(object) -> Movie\nload an mpeg movie file"
#define DOC_MOVIEPLAY "play(loops=0) -> None\nstart playback of a movie"
#define DOC_MOVIESTOP "stop() -> None\nstop movie playback"
#define DOC_MOVIEPAUSE "pause() -> None\ntemporarily stop and resume playback"
#define DOC_MOVIESKIP "skip(seconds) -> None\nadvance the movie playback position"
#define DOC_MOVIEREWIND "rewind() -> None\nrestart the movie playback"
#define DOC_MOVIERENDERFRAME "render_frame(frame_number) -> frame_number\nset the current video frame"
#define DOC_MOVIEGETFRAME "get_frame() -> frame_number\nget the current video frame"
#define DOC_MOVIEGETTIME "get_time() -> seconds\nget the current vide playback time"
#define DOC_MOVIEGETBUSY "get_busy() -> bool\ncheck if the movie is currently playing"
#define DOC_MOVIEGETLENGTH "get_length() -> seconds\nthe total length of the movie in seconds"
#define DOC_MOVIEGETSIZE "get_size() -> (width, height)\nget the resolution of the video"
#define DOC_MOVIEHASVIDEO "has_video() -> bool\ncheck if the movie file contains video"
#define DOC_MOVIEHASAUDIO "has_audio() -> bool\ncheck if the movie file contains audio"
#define DOC_MOVIESETVOLUME "set_volume(value) -> None\nset the audio playback volume"
#define DOC_MOVIESETDISPLAY "set_display(Surface, rect=None) -> None\nset the video target Surface"
/* Docs in a comment... slightly easier to read. */
/*
pygame.movie
pygame module for playback of mpeg video
pygame.movie.Movie
Movie(filename) -> Movie
Movie(object) -> Movie
load an mpeg movie file
pygame.movie.Movie.play
play(loops=0) -> None
start playback of a movie
pygame.movie.Movie.stop
stop() -> None
stop movie playback
pygame.movie.Movie.pause
pause() -> None
temporarily stop and resume playback
pygame.movie.Movie.skip
skip(seconds) -> None
advance the movie playback position
pygame.movie.Movie.rewind
rewind() -> None
restart the movie playback
pygame.movie.Movie.render_frame
render_frame(frame_number) -> frame_number
set the current video frame
pygame.movie.Movie.get_frame
get_frame() -> frame_number
get the current video frame
pygame.movie.Movie.get_time
get_time() -> seconds
get the current vide playback time
pygame.movie.Movie.get_busy
get_busy() -> bool
check if the movie is currently playing
pygame.movie.Movie.get_length
get_length() -> seconds
the total length of the movie in seconds
pygame.movie.Movie.get_size
get_size() -> (width, height)
get the resolution of the video
pygame.movie.Movie.has_video
has_video() -> bool
check if the movie file contains video
pygame.movie.Movie.has_audio
has_audio() -> bool
check if the movie file contains audio
pygame.movie.Movie.set_volume
set_volume(value) -> None
set the audio playback volume
pygame.movie.Movie.set_display
set_display(Surface, rect=None) -> None
set the video target Surface
*/ |
//
// DVIBaseRefreshView.h
// DVIRefresh
//
// Created by apple on 15/7/31.
// Copyright (c) 2015年 戴维营教育. All rights reserved.
//
#import <UIKit/UIKit.h>
/*更新状态*/
typedef enum : NSUInteger {
DVIRefreshStateStopped, //静止状态
DVIRefreshStatePulling, //拖动状态
DVIRefreshStateWillTriggered, //即将刷新(到达阈值)
DVIRefreshStateTriggered, //触发状态
DVIRefreshStateAllLoaded, //全部数据被加载,用于上拉加载
} DVIRefreshState;
/*支持刷新和加载更多*/
typedef enum : NSUInteger {
DVIRefreshPositionHeader, //头部
DVIRefreshPositionFooter, //尾部
} DVIRefreshPosition;
/*期待支持水平滚动*/
typedef enum : NSUInteger {
DVIRefreshDirectionHorizontal, //水平
DVIRefreshDirectionVertical, //垂直
} DVIRefreshDirection;
UIKIT_EXTERN NSString * const DVIRefreshKeyPathContentOffset;
UIKIT_EXTERN NSString * const DVIRefreshKeyPathContentSize;
UIKIT_EXTERN const CGFloat DVIRefreshVerticalHeightDefault;
UIKIT_EXTERN const CGFloat DVIRefreshHorizontalWidthDefault;
/*触发刷新或加载事件*/
typedef void(^DVIRefreshTriggeredBlock)();
/*添加KVO观察者*/
#define DVIAddObserver(object, target, keyPath) [object addObserver:target forKeyPath:keyPath options:NSKeyValueObservingOptionInitial | NSKeyValueObservingOptionNew context:NULL]
/*移除KVO观察者*/
#define DVIRemoveObserver(object, target, keyPath) [object removeObserver:target forKeyPath:keyPath]
@class DVIBaseRefreshView;
#pragma mark - DVIRefreshDelegate
@protocol DVIRefreshDelegate <NSObject>
@optional
- (void)didRefreshTriggered:(DVIBaseRefreshView *)refreshView;
@end
@interface DVIBaseRefreshView : UIView
{
}
@property (nonatomic, assign, readonly) DVIRefreshState state;
@property (nonatomic, assign, readonly) DVIRefreshPosition position;
@property (nonatomic, assign, readonly) DVIRefreshDirection direction;
///*触发刷新所需要的最小偏移量,默认为headerView的高度或者footerView的宽度*/
//@property (nonatomic, assign) CGFloat refreshSize;
@property (nonatomic, weak) UIScrollView *scrollView;
/*更新时间*/
@property (nonatomic, copy, readonly) NSString *lastUpdateTime;
/*达到触发状态的百分比,用于简化透明度变化等动画*/
@property (nonatomic, assign, readonly) CGFloat percent;
/*使用Block触发刷新或加载*/
@property (nonatomic, copy) DVIRefreshTriggeredBlock triggeredBlock;
/*使用Target-Action触发刷新或加载*/
@property (nonatomic, weak) id target;
@property (nonatomic, assign) SEL action;
/*使用代理出发刷新或加载*/
@property (nonatomic, weak) id<DVIRefreshDelegate> delegate;
/*创建刷新视图多种方式*/
/*1. Block方式*/
+ (instancetype)refreshViewWithPosition:(DVIRefreshPosition)position direction:(DVIRefreshDirection)direction block:(DVIRefreshTriggeredBlock)block;
/*2. Target-Action方式*/
+ (instancetype)refreshViewWithPosition:(DVIRefreshPosition)position direction:(DVIRefreshDirection)direction target:(id)target action:(SEL)action;
/*3. 代理方式*/
+ (instancetype)refreshViewWithPosition:(DVIRefreshPosition)position direction:(DVIRefreshDirection)direction delegate:(id<DVIRefreshDelegate>)delegate;
/*UIScrollView动作*/
- (void)scrollViewDidScroll:(UIScrollView *)scrollView;
- (void)scrollViewDidChangedContentSize:(UIScrollView *)scrollView;
/*自定义刷新控件时必须要Override的方法,可以在里面根据控件的状态显示信息*/
- (void)update;
/*手动操作刷新开始和结束*/
- (void)beginRefresh;
- (void)endRefresh;
- (BOOL)isRefreshing;
- (void)allLoaded;
/*用来覆盖的时机,暂未实现,下一版本使用*/
- (void)didScroll;
- (void)willTrigger;
- (void)didTriggered;
- (void)didEndScroll;
@end
|
../../../FLEX/Classes/FLEXManager.h |
#ifndef UTIL_SIGNAL_HANDLER_H__
#define UTIL_SIGNAL_HANDLER_H__
#include <signal.h>
#include "Logger.h"
#include "exceptions.h"
namespace util {
class SignalHandler {
public:
static void init();
private:
static void handle_signal(int signal);
};
/**
* Callable to launch a thread with properly initialized signal handlers.
*/
struct ThreadLauncher {
ThreadLauncher(const boost::function0<void>& fun_) :
fun(fun_) {}
void operator()() {
SignalHandler::init();
fun();
}
const boost::function0<void>& fun;
};
} // namespace util
#endif // UTIL_SIGNAL_HANDLER_H__
|
//
// SYUIButton.h
//
// Created by Jairo Junior on 11/15/13.
// Copyright (c) 2013 SookApps. All rights reserved.
//
#import <UIKit/UIKit.h>
#define kCFUIButtonBorderColor [UIColor blackColor]
#define kCFUIButtonBackgroundColorForHighlightedState [UIColor colorWithWhite:1.0 alpha:0.4]
@interface CFUIButton : UIButton
- (id)initWithFrame:(CGRect)frame title:(NSString*)title;
+ (void)setBorderColor:(UIColor*)color;
- (void)setBorderColor:(UIColor*)color;
- (void)removeBorder;
- (void)setBorderWidth:(CGFloat)borderWidth;
- (void)setCornerRadius:(CGFloat)cornerRadius;
+ (void) setBackgroundColorForHighlightedState:(UIColor*)color;
- (void) setBackgroundColorForHighlightedState:(UIColor*)color;
@end
|
#pragma once
#include <glbinding/nogl.h>
#include <glbinding/gl/values.h>
namespace gl40ext
{
} // namespace gl40ext
|
#ifndef __MAD_CONFIG_H__
#define __MAD_CONFIG_H__
#include "MadArch.h"
/*
* MadThread
*/
#define MAD_THREAD_NUM_MAX (256)
#define MAD_IDLE_STK_SIZE (128) // byte
#define MAD_STATIST_STK_SIZE (96) // byte
/*
* madArchMemCpy, madArchMemSet based on DMA of hardward.
*/
#define MAD_CPY_MEM_BY_DMA
/*
* Print debug information
*/
#include <stdio.h>
extern int NL_Log_Init(void);
#define MAD_LOG_INIT() do { if(0 > NL_Log_Init()) while(1); } while(0)
#define MAD_LOG(...) printf(__VA_ARGS__)
/*
* Use hooks to expand MadOS
*/
#define MAD_USE_IDLE_HOOK 0
#if MAD_USE_IDLE_HOOK
#define MAD_IDLE_HOOK madIdleHook // Can NOT be blocked.
extern void MAD_IDLE_HOOK(void);
#endif /* MAD_USE_IDLE_HOOK */
#endif
|
#pragma once
#include <string>
namespace tw {
/* pencode: percent encode a string */
std::string pencode(const std::string &s, const std::string &ign = "");
/* noncegen: generate a random alphanumeric string */
std::string noncegen();
}
|
#ifndef FRAMEPERFORMANCE_H
#define FRAMEPERFORMANCE_H
#include "../eirVariable/VariableGroup.h"
class FrameStatistics;
#define FRAMEPERFORMANCE_GROUPVARIABLES(ITD) \
ITD(Frame_Seq, int, 0) \
ITD(ImageId, QString, "") \
ITD(Grab_Latency_msec, int, 0) \
ITD(Detect_Overhead_msec, int, 0) \
ITD(Detect_msec_perMP, int, 0) \
ITD(Face_Processing_msec, int, 0) \
ITD(Frame_Overhead_msec, int, 0) \
ITD(Total_Latency_msec, int, 0) \
ITD(Grab_Delta_msec, int, 0) \
ITD(Frame_Delta_msec, int, 0) \
ITD(Frame_Idle_msec, int, 0) \
class FramePerformance : public VariableGroup
{
public:
DECLARE_GROUPVARIABLES(FRAMEPERFORMANCE_GROUPVARIABLES);
FramePerformance(const QString & section=QString());
void calculate(FrameStatistics * stats,
const QString & imageId);
private:
static int seq;
int lastStartEms;
int lastGrabEms;
int lastCompleteEms;
};
#endif // FRAMEPERFORMANCE_H
|
#pragma once
namespace msdfgen {
/// Represents a signed distance and alignment, which together can be compared to uniquely determine the closest edge segment.
class SignedDistance {
public:
static const SignedDistance Infinite;
double distance;
double dot;
SignedDistance();
SignedDistance(double dist, double d);
friend bool operator<(SignedDistance a, SignedDistance b);
friend bool operator>(SignedDistance a, SignedDistance b);
friend bool operator<=(SignedDistance a, SignedDistance b);
friend bool operator>=(SignedDistance a, SignedDistance b);
};
}
|
#pragma once
#include <unordered_map>
#include "universal_struct.h"
namespace Engine
{
/*Container to hold abstract types of data/objects.
The"universal_struct" class is used to add new data/objects.
All keys are set to uppercase and max length is 10 characters.*/
class universal_map
{
public:
__engine_decl bool Insert(const std::string& key, const universal_struct& addon);
__engine_decl const universal_struct* At(const std::string& key)const;
__engine_decl const universal_struct* operator[](const std::string& key)const;
__engine_decl void Remove(const std::string& key);
__engine_decl void Clear();
__engine_decl std::vector<std::string> List();
private:
std::unordered_map<std::string, const universal_struct> m_internal_data;
};
}
|
#pragma once
namespace Kore {
class Reader;
namespace Graphics1 {
enum ImageCompression { ImageCompressionNone, ImageCompressionDXT5, ImageCompressionASTC, ImageCompressionPVRTC };
class Image {
public:
enum Format { RGBA32, Grey8, RGB24, RGBA128, RGBA64, A32, BGRA32, A16 };
static int sizeOf(Image::Format format);
Image(int width, int height, Format format, bool readable);
Image(int width, int height, int depth, Format format, bool readable);
Image(const char* filename, bool readable);
Image(Kore::Reader& reader, const char* format, bool readable);
Image(void* data, int width, int height, Format format, bool readable);
Image(void* data, int width, int height, int depth, Format format, bool readable);
virtual ~Image();
int at(int x, int y);
int width, height, depth;
Format format;
bool readable;
ImageCompression compression;
u8* data;
float* hdrData;
int dataSize;
unsigned internalFormat;
protected:
Image();
void init(Kore::Reader& reader, const char* format, bool readable);
};
}
}
|
#import <UIKit/UIKit.h>
@interface UIView (loadFromNib)
+ (id)loadNibName:(NSString *)nibName bundle:(NSBundle *)bundle owner:(id)owner;
+ (id)loadFromNib;
@end
|
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef BVH_TRIANGLE_MESH_SHAPE_H
#define BVH_TRIANGLE_MESH_SHAPE_H
#include "btTriangleMeshShape.h"
#include "btOptimizedBvh.h"
#include "LinearMath/btAlignedAllocator.h"
///The btBvhTriangleMeshShape is a static-triangle mesh shape with several optimizations, such as bounding volume hierarchy and cache friendly traversal for PlayStation 3 Cell SPU. It is recommended to enable useQuantizedAabbCompression for better memory usage.
///It takes a triangle mesh as input, for example a btTriangleMesh or btTriangleIndexVertexArray. The btBvhTriangleMeshShape class allows for triangle mesh deformations by a refit or partialRefit method.
///Instead of building the bounding volume hierarchy acceleration structure, it is also possible to serialize (save) and deserialize (load) the structure from disk.
///See Demos\ConcaveDemo\ConcavePhysicsDemo.cpp for an example.
ATTRIBUTE_ALIGNED16(class) btBvhTriangleMeshShape : public btTriangleMeshShape
{
btOptimizedBvh* m_bvh;
bool m_useQuantizedAabbCompression;
bool m_ownsBvh;
bool m_pad[11];////need padding due to alignment
public:
BT_DECLARE_ALIGNED_ALLOCATOR();
btBvhTriangleMeshShape() : btTriangleMeshShape(0),m_bvh(0),m_ownsBvh(false) {m_shapeType = TRIANGLE_MESH_SHAPE_PROXYTYPE;};
btBvhTriangleMeshShape(btStridingMeshInterface* meshInterface, bool useQuantizedAabbCompression, bool buildBvh = true);
///optionally pass in a larger bvh aabb, used for quantization. This allows for deformations within this aabb
btBvhTriangleMeshShape(btStridingMeshInterface* meshInterface, bool useQuantizedAabbCompression,const btVector3& bvhAabbMin,const btVector3& bvhAabbMax, bool buildBvh = true);
virtual ~btBvhTriangleMeshShape();
bool getOwnsBvh () const
{
return m_ownsBvh;
}
void performRaycast (btTriangleCallback* callback, const btVector3& raySource, const btVector3& rayTarget);
void performConvexcast (btTriangleCallback* callback, const btVector3& boxSource, const btVector3& boxTarget, const btVector3& boxMin, const btVector3& boxMax);
virtual void processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const;
void refitTree(const btVector3& aabbMin,const btVector3& aabbMax);
///for a fast incremental refit of parts of the tree. Note: the entire AABB of the tree will become more conservative, it never shrinks
void partialRefitTree(const btVector3& aabbMin,const btVector3& aabbMax);
//debugging
virtual const char* getName()const {return "BVHTRIANGLEMESH";}
virtual void setLocalScaling(const btVector3& scaling);
btOptimizedBvh* getOptimizedBvh()
{
return m_bvh;
}
void setOptimizedBvh(btOptimizedBvh* bvh, const btVector3& localScaling=btVector3(1,1,1));
void buildOptimizedBvh();
bool usesQuantizedAabbCompression() const
{
return m_useQuantizedAabbCompression;
}
//virtual int calculateSerializeBufferSize();
///fills the dataBuffer and returns the struct name (and 0 on failure)
//virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const;
};
#if 0
struct btBvhTriangleMeshShapeData
{
btTriangleMeshShapeData m_trimeshData;
//btOptimizedBvhData m_bvh;
char m_useQuantizedAabbCompression;
char m_ownsBvh;
};
SIMD_FORCE_INLINE int btBvhTriangleMeshShape::calculateSerializeBufferSize()
{
return sizeof(btBvhTriangleMeshShapeData);
}
#endif
#endif //BVH_TRIANGLE_MESH_SHAPE_H
|
//
// VTAcknowledgementViewController.h
//
// Copyright (c) 2013-2021 Vincent Tourraine (http://www.vtourraine.net)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#if __has_feature(modules)
@import UIKit;
#else
#import <UIKit/UIKit.h>
#endif
NS_ASSUME_NONNULL_BEGIN
/**
`VTAcknowledgementViewController` is a subclass of `UIViewController` that displays a single acknowledgement.
*/
@interface VTAcknowledgementViewController : UIViewController
/// The main text view.
@property (nonatomic, weak, nullable) UITextView *textView;
/**
Initializes an acknowledgement view controller with a title and a body text.
@param title The acknowledgement title.
@param text The acknowledgement body text.
@return A newly created `VTAcknowledgementViewController` instance.
*/
- (instancetype)initWithTitle:(NSString *)title text:(NSString *)text;
@end
NS_ASSUME_NONNULL_END
|
//
// SQTabBarController.h
// SQ565
//
// Created by zhangchong on 16/12/5.
// Copyright © 2016年 Online Community Of China. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface SQTabBarController : UITabBarController
@end
|
#define IBM_NOESSL
#define PARALLEL_OFF
#define NO_PRAGMA
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <time.h>
#ifdef PARALLEL
#include "mpi.h"
#else
#include "../typ_defs/mpi_f.h"
#endif
#include "../typ_defs/defines.h"
|
#include "cghdr.h"
static void agflatten_elist(Dict_t * d, Dtlink_t ** lptr, int flag)
{
dtrestore(d, *lptr);
dtmethod(d, flag? Dtlist : Dtoset);
*lptr = dtextract(d);
}
void agflatten_edges(Agraph_t * g, Agnode_t * n, int flag)
{
Agsubnode_t *sn;
Dtlink_t **tmp;
sn = agsubrep(g,n);
tmp = &(sn->out_seq); /* avoiding - "dereferencing type-punned pointer will break strict-aliasing rules" */
agflatten_elist(g->e_seq, tmp, flag);
tmp = &(sn->in_seq);
agflatten_elist(g->e_seq, tmp, flag);
}
void agflatten(Agraph_t * g, int flag)
{
Agnode_t *n;
if (flag) {
if (g->desc.flatlock == FALSE) {
dtmethod(g->n_seq,Dtlist);
for (n = agfstnode(g); n; n = agnxtnode(g,n))
agflatten_edges(g, n, flag);
g->desc.flatlock = TRUE;
}
} else {
if (g->desc.flatlock) {
dtmethod(g->n_seq,Dtoset);
for (n = agfstnode(g); n; n = agnxtnode(g,n))
agflatten_edges(g, n, flag);
g->desc.flatlock = FALSE;
}
}
}
void agnotflat(Agraph_t * g)
{
if (g->desc.flatlock)
agerr(AGERR, "flat lock broken");
}
|
/*
* Copyright (c) 2006-2009 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this
* file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
/*!
* @header IOBDBlockStorageDevice
* @abstract
* This header contains the IOBDBlockStorageDevice class definition.
*/
#ifndef _IOBDBLOCKSTORAGEDEVICE_H
#define _IOBDBLOCKSTORAGEDEVICE_H
#include <IOKit/storage/IOBDTypes.h>
/*!
* @defined kIOBDBlockStorageDeviceClass
* @abstract
* kIOBDBlockStorageDeviceClass is the name of the IOBDBlockStorageDevice class.
* @discussion
* kIOBDBlockStorageDeviceClass is the name of the IOBDBlockStorageDevice class.
*/
#define kIOBDBlockStorageDeviceClass "IOBDBlockStorageDevice"
#ifdef KERNEL
#ifdef __cplusplus
/*
* Kernel
*/
#include <IOKit/storage/IODVDBlockStorageDevice.h>
/* Property used for matching, so the generic driver gets the nub it wants. */
#define kIOBlockStorageDeviceTypeBD "BD"
/*!
* @class
* IOBDBlockStorageDevice
* @abstract
* The IOBDBlockStorageDevice class is a generic BD block storage device
* abstraction.
* @discussion
* This class is the protocol for generic BD functionality, independent of
* the physical connection protocol (e.g. SCSI, ATA, USB).
*
* The APIs are the union of CD APIs, DVD APIs, and all
* necessary new low-level BD APIs.
*
* A subclass implements relay methods that translate our requests into
* calls to a protocol- and device-specific provider.
*/
class IOBDBlockStorageDevice : public IODVDBlockStorageDevice
{
OSDeclareAbstractStructors(IOBDBlockStorageDevice)
protected:
struct ExpansionData { /* */ };
ExpansionData * _expansionData;
public:
/*!
* @function init
* @discussion
* Initialize this object's minimal state.
* @param properties
* Substitute property table for this object (optional).
* @result
* Returns true on success, false otherwise.
*/
virtual bool init(OSDictionary * properties);
/*!
* @function readDiscStructure
* @discussion
* Issue an MMC READ DISC STRUCTURE command.
* @param buffer
* Buffer for the data transfer. The size of the buffer implies the size of
* the data transfer.
* @param format
* As documented by MMC.
* @param address
* As documented by MMC.
* @param layer
* As documented by MMC.
* @param grantID
* As documented by MMC.
* @param type
* As documented by MMC.
* @result
* Returns the status of the data transfer.
*/
virtual IOReturn readDiscStructure( IOMemoryDescriptor * buffer,
UInt8 format,
UInt32 address,
UInt8 layer,
UInt8 grantID,
UInt8 type ) = 0;
/*!
* @function splitTrack
* @discussion
* Issue an MMC RESERVE TRACK command with the ARSV bit.
* @param address
* As documented by MMC.
* @result
* Returns the status of the operation.
*/
virtual IOReturn splitTrack(UInt32 address) = 0;
OSMetaClassDeclareReservedUnused(IOBDBlockStorageDevice, 0);
OSMetaClassDeclareReservedUnused(IOBDBlockStorageDevice, 1);
OSMetaClassDeclareReservedUnused(IOBDBlockStorageDevice, 2);
OSMetaClassDeclareReservedUnused(IOBDBlockStorageDevice, 3);
OSMetaClassDeclareReservedUnused(IOBDBlockStorageDevice, 4);
OSMetaClassDeclareReservedUnused(IOBDBlockStorageDevice, 5);
OSMetaClassDeclareReservedUnused(IOBDBlockStorageDevice, 6);
OSMetaClassDeclareReservedUnused(IOBDBlockStorageDevice, 7);
OSMetaClassDeclareReservedUnused(IOBDBlockStorageDevice, 8);
OSMetaClassDeclareReservedUnused(IOBDBlockStorageDevice, 9);
OSMetaClassDeclareReservedUnused(IOBDBlockStorageDevice, 10);
OSMetaClassDeclareReservedUnused(IOBDBlockStorageDevice, 11);
OSMetaClassDeclareReservedUnused(IOBDBlockStorageDevice, 12);
OSMetaClassDeclareReservedUnused(IOBDBlockStorageDevice, 13);
OSMetaClassDeclareReservedUnused(IOBDBlockStorageDevice, 14);
OSMetaClassDeclareReservedUnused(IOBDBlockStorageDevice, 15);
};
#endif /* __cplusplus */
#endif /* KERNEL */
#endif /* !_IOBDBLOCKSTORAGEDEVICE_H */
|
/***************************************************************************
ui_text.h
Functions used to retrieve text used by MAME, to aid in
translation.
Copyright (c) 1996-2006, Nicola Salmoria and the MAME Team.
Visit http://mamedev.org for licensing and usage restrictions.
***************************************************************************/
#ifndef __UI_TEXT_H__
#define __UI_TEXT_H__
#include "mamecore.h"
/* Important: this must match the default_text list in ui_text.c! */
enum
{
UI_mame = 0,
/* copyright stuff */
UI_copyright1,
UI_copyright2,
UI_copyright3,
/* misc menu stuff */
UI_returntomain,
UI_returntoprior,
UI_anykey,
UI_on,
UI_off,
UI_NA,
UI_OK,
UI_INVALID,
UI_none,
UI_cpu,
UI_address,
UI_value,
UI_sound,
UI_sound_lc, /* lower-case version */
UI_stereo,
UI_vectorgame,
UI_screenres,
UI_text,
UI_volume,
UI_relative,
UI_allchannels,
UI_brightness,
UI_gamma,
UI_vectorflicker,
UI_vectorintensity,
UI_overclock,
UI_allcpus,
UI_historymissing,
/* special characters */
UI_leftarrow,
UI_rightarrow,
UI_uparrow,
UI_downarrow,
UI_lefthilight,
UI_righthilight,
/* warnings */
UI_knownproblems,
UI_imperfectcolors,
UI_wrongcolors,
UI_imperfectgraphics,
UI_imperfectsound,
UI_nosound,
UI_nococktail,
UI_brokengame,
UI_brokenprotection,
UI_workingclones,
UI_incorrectroms,
UI_typeok,
/* main menu */
UI_inputgeneral,
UI_dipswitches,
UI_analogcontrols,
UI_calibrate,
UI_bookkeeping,
UI_inputspecific,
UI_gameinfo,
UI_history,
UI_resetgame,
UI_returntogame,
UI_cheat,
UI_memorycard,
/* input stuff */
UI_keyjoyspeed,
UI_centerspeed,
UI_reverse,
UI_sensitivity,
/* input groups */
UI_uigroup,
UI_p1group,
UI_p2group,
UI_p3group,
UI_p4group,
UI_p5group,
UI_p6group,
UI_p7group,
UI_p8group,
UI_othergroup,
UI_returntogroup,
/* stats */
UI_totaltime,
UI_tickets,
UI_coin,
UI_locked,
/* memory card */
UI_selectcard,
UI_loadcard,
UI_ejectcard,
UI_createcard,
UI_loadfailed,
UI_loadok,
UI_cardejected,
UI_cardcreated,
UI_cardcreatedfailed,
UI_cardcreatedfailed2,
/* cheat stuff */
UI_enablecheat,
UI_addeditcheat,
UI_startcheat,
UI_continuesearch,
UI_viewresults,
UI_restoreresults,
UI_memorywatch,
UI_generalhelp,
UI_options,
UI_reloaddatabase,
UI_watchpoint,
UI_disabled,
UI_cheats,
UI_watchpoints,
UI_moreinfo,
UI_moreinfoheader,
UI_cheatname,
UI_cheatdescription,
UI_cheatactivationkey,
UI_code,
UI_max,
UI_set,
UI_conflict_found,
UI_no_help_available,
/* watchpoint stuff */
UI_watchlength,
UI_watchdisplaytype,
UI_watchlabeltype,
UI_watchlabel,
UI_watchx,
UI_watchy,
UI_watch,
UI_hex,
UI_decimal,
UI_binary,
/* search stuff */
UI_search_lives,
UI_search_timers,
UI_search_energy,
UI_search_status,
UI_search_slow,
UI_search_speed,
UI_search_speed_fast,
UI_search_speed_medium,
UI_search_speed_slow,
UI_search_speed_veryslow,
UI_search_speed_allmemory,
UI_search_select_memory_areas,
UI_search_matches_found,
UI_search_noinit,
UI_search_nosave,
UI_search_done,
UI_search_OK,
UI_search_select_value,
UI_search_all_values_saved,
UI_search_one_match_found_added,
/* refresh rate */
UI_refresh_rate,
UI_decoding_gfx,
/* AdvanceMAME: Extra user interface commands */
UI_osd_1, /* Video */
UI_osd_2, /* Audio */
UI_osd_3, /* Autosave Config */
UI_last_mame_entry
};
#ifdef MESS
#include "mui_text.h"
#endif
struct _lang_struct
{
int version;
int multibyte; /* UNUSED: 1 if this is a multibyte font/language */
UINT8 *fontdata; /* pointer to the raw font data to be decoded */
UINT16 fontglyphs; /* total number of glyps in the external font - 1 */
char langname[255];
char fontname[255];
char author[255];
};
typedef struct _lang_struct lang_struct;
extern lang_struct lang;
int uistring_init (mame_file *language_file);
const char * ui_getstring (int string_num);
#endif /* __UI_TEXT_H__ */
|
/* crypto/o_str.h -*- mode:C; c-file-style: "eay" -*- */
/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
* project 2003.
*/
/* ====================================================================
* Copyright (c) 2003 The OpenSSL 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. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* licensing@OpenSSL.org.
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
* permission of the OpenSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED 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 OpenSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
* This product includes cryptographic software written by Eric Young
* (eay@cryptsoft.com). This product includes software written by Tim
* Hudson (tjh@cryptsoft.com).
*
*/
#ifndef HEADER_O_STR_H
#define HEADER_O_STR_H
#include <stddef.h> /* to get size_t */
int OPENSSL_strcasecmp(const char *str1, const char *str2);
int OPENSSL_strncasecmp(const char *str1, const char *str2, size_t n);
#endif
|
/* Copyright 2013 David Axmark
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.
*/
/*! \addtogroup NativeUILib
* @{
*/
/**
* @defgroup NativeUILib Native UI Library
* @{
*/
/**
* @file ListViewListener.h
* @author Bogdan Iusco
*
* \brief Listener for ListView events.
*/
#ifndef NATIVEUI_LIST_VIEW_LISTENER_H_
#define NATIVEUI_LIST_VIEW_LISTENER_H_
namespace NativeUI
{
// Forward declaration.
class ListView;
class ListViewItem;
class ListViewSection;
/**
* \brief Listener for ListView events.
*/
class ListViewListener
{
public:
/**
* This method is called when a list view item is clicked.
* @deprecated
* @param listView The list view object that generated the event.
* @param listViewItem The ListViewItem object that was clicked.
*/
virtual void listViewItemClicked(
ListView* listView,
ListViewItem* listViewItem) {};
/**
* This method is called when a list view item is clicked.
* @deprecated
* @param listView The list view object that generated the event.
* @param index The index on which the list view item is positioned.
*/
virtual void listViewItemClicked(
ListView* listView,
int index) {};
/**
* This method is called when a segmented/alphabetical list view item is clicked.
* @deprecated Use #listViewItemClicked instead.
* @param listView The list view object that generated the event.
* @param sectionIndex The index of the section that contains the selected item.
* @param itemIndex The index (within the parent section) of the list view item clicked.
*/
virtual void segmentedListViewItemClicked(
ListView* listView,
int sectionIndex,
int itemIndex) {};
/**
* This method is called when a segmented/alphabetical list view item is clicked.
* @deprecated Use #listViewItemClicked instead.
* @param listView The list view object that generated the event.
* @param listViewSection The ListViewSection object that contains the selected item.
* @param listViewItem The ListViewItem objet clicked.
*/
virtual void segmentedListViewItemClicked(
ListView* listView,
ListViewSection* listViewSection,
ListViewItem* listViewItem) {};
/**
* This method is called when an item's insert button is clicked.
* The list type must be segmented and in editing mode.
* Platform: iOS
* @deprecated Use #listViewItemInsert instead.
* @param listView The list view object that generated the event.
* @param listViewSection The ListViewSection object that contains the item.
* Will be null if list view type is default.
* @param listViewItem The item object whose insert button was clicked.
*/
virtual void segmentedListViewItemInsert(
ListView* listView,
ListViewSection* listViewSection,
ListViewItem* listViewItem) {};
/**
* This method is called when an item's delete button is clicked.
* The list type must be segmented and in editing mode.
* Platform: iOS
* @deprecated Use #listViewItemDelete instead.
* @param listView The list view object that generated the event.
* @param listViewSection The ListViewSection object that contains the item.
* Will be null if list view type is default.
* @param listViewItem The item object whose delete button was clicked.
*/
virtual void segmentedListViewItemDelete(
ListView* listView,
ListViewSection* listViewSection,
ListViewItem* listViewItem) {};
/**
* This method is called when a list view item is clicked.
* @param listView The list view object that generated the event.
* @param sectionIndex The index of the section that contains the selected item.
* Will be #MAW_RES_INVALID_INDEX for default type list views.
* @param itemIndex The index (within the parent section if the section is valid)
* of the list view item clicked.
*/
virtual void listViewItemClicked(
ListView *listView,
const int sectionIndex,
const int itemIndex) {};
/**
* This method is called when a list view item is clicked.
* @param listView The list view object that generated the event.
* @param listViewSection The section object that contains the selected item.
* Will be null for default type list views.
* @param listViewItem The item object that was clicked.
*/
virtual void listViewItemClicked(
ListView *listView,
ListViewSection *listViewSection,
ListViewItem *listViewItem) {};
/**
* This method is called when an item's insert button is clicked.
* The list view must be in editing mode.
* Platform: iOS
* @param listView The list view object that generated the event.
* @param listViewSection The section object that contains the item.
* Will be null for default type list views.
* @param listViewItem The item object whose insert button was clicked.
*/
virtual void listViewItemInsert(
ListView *listView,
ListViewSection *listViewSection,
ListViewItem *listViewItem) {};
/**
* This method is called when an item's delete button is clicked.
* The list view must be in editing mode.
* Platform: iOS
* @param listView The list view object that generated the event.
* @param listViewSection The section object that contains the item.
* Will be null for default type list views.
* @param listViewItem The item object whose delete button was clicked.
*/
virtual void listViewItemDelete(
ListView *listView,
ListViewSection *listViewSection,
ListViewItem *listViewItem) {};
};
} // namespace NativeUI
#endif /* NATIVEUI_LIST_VIEW_LISTENER_H_ */
/*! @} */
|
/*
* Copyright (c) 1996-1999 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
#if defined(LIBC_SCCS) && !defined(lint)
static const char rcsid[] = "$BINDId: inet_ntop.c,v 1.8 1999/10/13 16:39:28 vixie Exp $";
#endif /* LIBC_SCCS and not lint */
#ifdef USE_NEWLIB
#include <errno.h>
#endif
#include <mavsprintf.h>
#include <mastring.h>
#include "inet_ntop.h"
#define NS_IN6ADDRSZ 16 /*%< IPv6 T_AAAA */
#define NS_INT16SZ 2 /*%< #/bytes of data in a u_int16_t */
#define SPRINTF(x) ((size_t)sprintf x)
/*
* WARNING: Don't even consider trying to compile this on a system where
* sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
*/
/* const char *
* inet_ntop4(src, dst, size)
* format an IPv4 address
* return:
* `dst' (as a const)
* notes:
* (1) uses no statics
* (2) takes a u_char* not an in_addr as input
* author:
* Paul Vixie, 1996.
*/
const char* inet_ntop4(const byte* src, char* dst, size_t size)
{
static const char fmt[] = "%u.%u.%u.%u";
char tmp[sizeof "255.255.255.255"];
if (SPRINTF((tmp, fmt, src[0], src[1], src[2], src[3])) >= size) {
#ifdef USE_NEWLIB
errno = ENOSPC;
#endif
return (NULL);
}
return strcpy(dst, tmp);
}
/* const char *
* inet_ntop6(src, dst, size)
* convert IPv6 binary address into presentation (printable) format
* author:
* Paul Vixie, 1996.
*/
const char* inet_ntop6(const byte* src, char* dst, size_t size)
{
/*
* Note that int32_t and int16_t need only be "at least" large enough
* to contain a value of the specified size. On some systems, like
* Crays, there is no such thing as an integer variable with 16 bits.
* Keep this in mind if you think this function should have been coded
* to use pointer overlays. All the world's not a VAX.
*/
char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp;
struct { int base, len; } best, cur;
uint words[NS_IN6ADDRSZ / NS_INT16SZ];
int i;
/*
* Preprocess:
* Copy the input (bytewise) array into a wordwise array.
* Find the longest run of 0x00's in src[] for :: shorthanding.
*/
memset(words, '\0', sizeof words);
for (i = 0; i < NS_IN6ADDRSZ; i += 2)
words[i / 2] = (src[i] << 8) | src[i + 1];
best.base = -1;
cur.base = -1;
best.len = 0;
cur.len = 0;
for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) {
if (words[i] == 0) {
if (cur.base == -1)
cur.base = i, cur.len = 1;
else
cur.len++;
} else {
if (cur.base != -1) {
if (best.base == -1 || cur.len > best.len)
best = cur;
cur.base = -1;
}
}
}
if (cur.base != -1) {
if (best.base == -1 || cur.len > best.len)
best = cur;
}
if (best.base != -1 && best.len < 2)
best.base = -1;
/*
* Format the result.
*/
tp = tmp;
for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) {
/* Are we inside the best run of 0x00's? */
if (best.base != -1 && i >= best.base &&
i < (best.base + best.len)) {
if (i == best.base)
*tp++ = ':';
continue;
}
/* Are we following an initial run of 0x00s or any real hex? */
if (i != 0)
*tp++ = ':';
/* Is this address an encapsulated IPv4? */
if (i == 6 && best.base == 0 &&
(best.len == 6 || (best.len == 5 && words[5] == 0xffff))) {
if (!inet_ntop4(src+12, tp, sizeof tmp - (tp - tmp)))
return (NULL);
tp += strlen(tp);
break;
}
tp += SPRINTF((tp, "%x", words[i]));
}
/* Was it a trailing run of 0x00's? */
if (best.base != -1 && (best.base + best.len) ==
(NS_IN6ADDRSZ / NS_INT16SZ))
*tp++ = ':';
*tp++ = '\0';
/*
* Check for overflow, copy, and we're done.
*/
if ((size_t)(tp - tmp) > size) {
#ifdef USE_NEWLIB
errno = ENOSPC;
#endif
return (NULL);
}
return strcpy(dst, tmp);
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.