text
stringlengths 4
6.14k
|
|---|
/* **********************************************************
* Copyright (c) 2008 VMware, 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 VMware, 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 VMWARE, 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.
*/
int doubler(int num)
{
return num*2;
}
int main (void)
{
int i = 4;
int j = doubler(i);
printf("The whole is greater than the sum of parts: ");
printf("%d + %d = %d\n", i, i, j);
if (j == i*2)
printf(" - apparently not!\n");
}
|
/*
* @f ccnl-pdu.h
*
* Copyright (C) 2013, Christian Mehlis, Freie University Berlin
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR 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.
*/
int dehead(unsigned char **buf, int *len, int *num, int *typ);
int mkHeader(unsigned char *buf, unsigned int num, unsigned int tt);
int mkBlob(unsigned char *out, unsigned int num, unsigned int tt, char *cp, int cnt);
int mkStrBlob(unsigned char *out, unsigned int num, unsigned int tt, char *str);
int mkBinaryInt(unsigned char *out, unsigned int num, unsigned int tt,
unsigned int val, int bytes);
int unmkBinaryInt(unsigned char **data, int *datalen, unsigned int *result,
unsigned char *width);
int mkInterest(char **namecomp, unsigned int *nonce, unsigned char *out);
int mkContent(char **namecomp, char *data, int datalen, unsigned char *out);
|
/**********************************************************************
* Copyright (C) 2010 Signove Tecnologia Corporation.
* All rights reserved.
* Contact: Signove Tecnologia Corporation (contact@signove.com)
*
* $LICENSE_TEXT:BEGIN$
* 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 and appearing
* in the file LICENSE included in the packaging of this file; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* $LICENSE_TEXT:END$
*
* testfsm.c
*
* Created on: Jun 22, 2010
* Author: fabricio.silva
**********************************************************************/
#ifdef TEST_ENABLED
#include "testfsm.h"
#include "Basic.h"
#include <stdio.h>
#include "src/communication/communication.h"
#include "src/communication/context_manager.h"
#include "src/communication/fsm.h"
void testfsm_action1(Context *ctx, fsm_events evt, FSMEventData *data);
void testfsm_action2(Context *ctx, fsm_events evt, FSMEventData *data);
void testfsm_action3(Context *ctx, fsm_events evt, FSMEventData *data);
int test_fsm_init_suite(void)
{
return 0;
}
int test_fsm_finish_suite(void)
{
return 0;
}
void testfsm_add_suite()
{
CU_pSuite suite = CU_add_suite("FSM Test Suite", test_fsm_init_suite,
test_fsm_finish_suite);
/* Add tests here - Start */
CU_add_test(suite, "test_fsm", test_fsm);
/* Add tests here - End */
}
void test_fsm()
{
// Create connection context which include the state machine
ContextId cid = {1, 99};
Context *ctx = context_create(cid, MANAGER_CONTEXT);
FSM *fsm = ctx->fsm;
// Initialize FSM
FsmTransitionRule transition_table[] = { { 0, 1, 1, &testfsm_action1 },
{ 1, 2, 2, &testfsm_action2 }, {
2, 3, 0,
&testfsm_action3
}
};
fsm_init(fsm, 0, transition_table, sizeof(transition_table)
/ sizeof(struct FsmTransitionRule));
CU_ASSERT_EQUAL(fsm->transition_table_size, 3);
// Process inputs
fsm_process_evt(ctx, 1, NULL);
CU_ASSERT_EQUAL(fsm->state, 1);
fsm_process_evt(ctx, 2, NULL);
CU_ASSERT_EQUAL(fsm->state, 2);
fsm_process_evt(ctx, 3, NULL);
CU_ASSERT_EQUAL(fsm->state, 0);
fsm_set_manager_state_table(fsm);
CU_ASSERT_EQUAL(fsm->state, fsm_state_disconnected);
context_remove(cid);
}
void testfsm_action1(Context *ctx, fsm_events evt, FSMEventData *data)
{
printf("\n Transition Action 1 %d - fsm state %d\n", evt,
ctx->fsm->state);
}
void testfsm_action2(Context *ctx, fsm_events evt, FSMEventData *data)
{
printf("\n Transition Action 2 %d - fsm state %d\n", evt,
ctx->fsm->state);
}
void testfsm_action3(Context *ctx, fsm_events evt, FSMEventData *data)
{
printf("\n Transition Action 3 %d - fsm state %d\n", evt,
ctx->fsm->state);
}
#endif
|
/*
* Legal Notice
*
* This document and associated source code (the "Work") is a part of a
* benchmark specification maintained by the TPC.
*
* The TPC reserves all right, title, and interest to the Work as provided
* under U.S. and international laws, including without limitation all patent
* and trademark rights therein.
*
* No Warranty
*
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
* WITH REGARD TO THE WORK.
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
*
* Contributors:
* Gradient Systems
*/
#include "config.h"
#include "porting.h"
#include <stdio.h>
#include "genrand.h"
#include "s_promotion.h"
#include "w_promotion.h"
#include "print.h"
#include "columns.h"
#include "build_support.h"
#include "tables.h"
#include "misc.h"
#include "parallel.h"
#include "date.h"
#include "permute.h"
#include "scaling.h"
#include "tdef_functions.h"
#include "scd.h"
#include "r_params.h"
extern struct W_PROMOTION_TBL g_w_promotion;
/*
* Routine:
* Purpose:
* Algorithm:
* Data Structures:
*
* Params:
* Returns:
* Called By:
* Calls:
* Assumptions:
* Side Effects:
* TODO: None
*/
int
mk_s_promotion (void* row, ds_key_t index)
{
static int bInit = 0;
static int *pPermutation;
ds_key_t kIndex;
if (!bInit)
{
pPermutation = makePermutation(NULL, (int)getIDCount(PROMOTION), S_PROMOTION_ID);
bInit = 1;
}
kIndex = getPermutationEntry(pPermutation, (int)index);
mk_w_promotion(NULL, kIndex);
row_stop(PROMOTION);
return(0);
}
/*
* Routine:
* Purpose:
* Algorithm:
* Data Structures:
*
* Params:
* Returns:
* Called By:
* Calls:
* Assumptions:
* Side Effects:
* TODO: None
*/
int
pr_s_promotion(void *pSrc)
{
struct W_PROMOTION_TBL *r;
if (pSrc == NULL)
r = &g_w_promotion;
else
r = pSrc;
print_start(S_PROMOTION);
print_varchar(P_PROMO_ID, r->p_promo_id, 1);
print_varchar(P_PROMO_NAME, &r->p_promo_name[0], 1);
print_date(P_START_DATE_ID, r->p_start_date_id, 1);
print_date(P_START_DATE_ID, r->p_end_date_id, 1);
print_decimal(P_COST, &r->p_cost, 1);
print_integer(P_RESPONSE_TARGET, r->p_response_target, 1);
print_boolean(P_CHANNEL_DMAIL, r->p_channel_dmail, 1);
print_boolean(P_CHANNEL_EMAIL, r->p_channel_email, 1);
print_boolean(P_CHANNEL_CATALOG, r->p_channel_catalog, 1);
print_boolean(P_CHANNEL_TV, r->p_channel_tv, 1);
print_boolean(P_CHANNEL_RADIO, r->p_channel_radio, 1);
print_boolean(P_CHANNEL_PRESS, r->p_channel_press, 1);
print_boolean(P_CHANNEL_EVENT, r->p_channel_event, 1);
print_boolean(P_CHANNEL_DEMO, r->p_channel_demo, 1);
print_varchar(P_CHANNEL_DETAILS, &r->p_channel_details[0], 1);
print_varchar(P_PURPOSE, r->p_purpose, 1);
print_boolean(P_DISCOUNT_ACTIVE, r->p_discount_active, 0);
print_end(S_PROMOTION);
return(0);
}
/*
* Routine:
* Purpose:
* Algorithm:
* Data Structures:
*
* Params:
* Returns:
* Called By:
* Calls:
* Assumptions:
* Side Effects:
* TODO: None
*/
int
ld_s_promotion(void *pSrc)
{
struct W_PROMOTION_TBL *r;
if (pSrc == NULL)
r = &g_w_promotion;
else
r = pSrc;
return(0);
}
int
vld_s_promotion(int nTable, ds_key_t kRow, int *Permutation)
{
static int bInit = 0;
static int *pPermutation;
ds_key_t kIndex;
table_func_t *pTF = getTdefFunctionsByNumber(PROMOTION);
if (!bInit)
{
pPermutation =
makePermutation(NULL, (int)getIDCount(PROMOTION), S_PROMOTION_ID);
bInit = 1;
}
kIndex = getPermutationEntry(pPermutation, (int)kRow);
row_skip(PROMOTION, kRow - 1);
pTF->builder(NULL, kIndex);
row_stop(PROMOTION);
return(0);
}
|
//
// LDKKeyValueView.h
// LDCore
//
// Created by Bryan Nagle on 9/25/14.
// Copyright (c) 2014 Liquid Analytics. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface LDKKeyValueView : UIView
@property (nonatomic, strong) NSArray *keyValuePairs;
@property (nonatomic, assign) UIEdgeInsets labelInsets;
@property (nonatomic, assign) UIEdgeInsets pairInsets;
@property (nonatomic, assign) UIEdgeInsets contentInsets;
@property (nonatomic, strong) UIColor *valueUnderlineColor;
@property (nonatomic, assign) float valueUnderlineWidth;
@property (nonatomic, assign) NSUInteger numberOfColumns;
@property (nonatomic, strong) UIFont *keyFont;
@property (nonatomic, strong) UIFont *valueFont;
@property (nonatomic, strong) UIView *headerView;
@property (nonatomic, assign) BOOL editable;
@property (nonatomic, copy) void (^labelWasTapped)(UILabel *label, NSDictionary *pair);
- (void)sizeToFit;
@end
|
/*=========================================================================
*
* Copyright NumFOCUS
*
* 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.txt
*
* 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.
*
*=========================================================================*/
/**
* itkSingletonMacro.h defines macros that are used to declare and define
* global variables across ITK with a global map that is used to synchronize
* this variables across multiple instantiations of ITK if necessary.
* Note: this is rarely necessary.
*/
#ifndef itkSingletonMacro_h
#define itkSingletonMacro_h
#define itkInitGlobalsMacro(VarName) \
{ \
static auto * staticGlobals = Get##VarName##Pointer(); \
(void)staticGlobals; \
} \
ITK_MACROEND_NOOP_STATEMENT
#define itkGetGlobalDeclarationMacro(Type, VarName) static Type * Get##VarName##Pointer()
#define itkGetGlobalSimpleMacro(Class, Type, Name) itkGetGlobalInitializeMacro(Class, Type, Name, Class, (void)0)
#define itkGetGlobalValueMacro(Class, Type, Name, Value) \
itkGetGlobalInitializeMacro(Class, Type, Name, Name, *m_##Name = Value)
#define itkGetGlobalInitializeMacro(Class, Type, VarName, SingletonName, Init) \
Type * Class::Get##VarName##Pointer() \
{ \
if (m_##VarName == nullptr) \
{ \
static auto setLambda = [](void * a) { \
delete m_##VarName; \
m_##VarName = static_cast<Type *>(a); \
}; \
static auto deleteLambda = []() { \
delete m_##VarName; \
m_##VarName = nullptr; \
}; \
auto * old_instance = SingletonIndex::GetInstance()->GetGlobalInstance<Type>(#SingletonName); \
m_##VarName = Singleton<Type>(#SingletonName, setLambda, deleteLambda); \
if (old_instance == nullptr) \
{ \
Init; \
} \
} \
return m_##VarName; \
} \
ITK_MACROEND_NOOP_STATEMENT
#endif
|
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MBED_SPISLAVE_H
#define MBED_SPISLAVE_H
#include "platform/platform.h"
#if defined (DEVICE_SPISLAVE) || defined(DOXYGEN_ONLY)
#include "hal/spi_api.h"
namespace mbed {
/** \addtogroup drivers */
/** A SPI slave, used for communicating with a SPI Master device
*
* The default format is set to 8-bits, mode 0, and a clock frequency of 1MHz
*
* @note Synchronization level: Not protected
*
* Example:
* @code
* // Reply to a SPI master as slave
*
* #include "mbed.h"
*
* SPISlave device(p5, p6, p7, p8); // mosi, miso, sclk, ssel
*
* int main() {
* device.reply(0x00); // Prime SPI with first reply
* while(1) {
* if(device.receive()) {
* int v = device.read(); // Read byte from master
* v = (v + 1) % 0x100; // Add one to it, modulo 256
* device.reply(v); // Make this the next reply
* }
* }
* }
* @endcode
* @ingroup drivers
*/
class SPISlave {
public:
/** Create a SPI slave connected to the specified pins
*
* mosi or miso can be specfied as NC if not used
*
* @param mosi SPI Master Out, Slave In pin
* @param miso SPI Master In, Slave Out pin
* @param sclk SPI Clock pin
* @param ssel SPI chip select pin
*/
SPISlave(PinName mosi, PinName miso, PinName sclk, PinName ssel);
/** Configure the data transmission format
*
* @param bits Number of bits per SPI frame (4 - 16)
* @param mode Clock polarity and phase mode (0 - 3)
*
* @code
* mode | POL PHA
* -----+--------
* 0 | 0 0
* 1 | 0 1
* 2 | 1 0
* 3 | 1 1
* @endcode
*/
void format(int bits, int mode = 0);
/** Set the spi bus clock frequency
*
* @param hz SCLK frequency in hz (default = 1MHz)
*/
void frequency(int hz = 1000000);
/** Polls the SPI to see if data has been received
*
* @returns
* 0 if no data,
* 1 otherwise
*/
int receive(void);
/** Retrieve data from receive buffer as slave
*
* @returns
* the data in the receive buffer
*/
int read(void);
/** Fill the transmission buffer with the value to be written out
* as slave on the next received message from the master.
*
* @param value the data to be transmitted next
*/
void reply(int value);
protected:
spi_t _spi;
int _bits;
int _mode;
int _hz;
};
} // namespace mbed
#endif
#endif
|
//
// ObjectTable.h
// LDCore
//
// Created by Bryan Nagle on 9/14/13.
// Copyright (c) 2013 Liquid Analytics. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "LDCArrayCollection.h"
@interface LDCObjectTable : LDCArrayCollection
- (NSInteger)numberOfSections;
- (NSInteger)numberOfRowsForSection:(NSInteger)section;
- (NSString *)sectionKeyForSection:(NSInteger)section;
- (NSInteger)sectionForSectionKey:(NSString *)sectionKey;
- (void)addSectionKey:(NSString *)key;
- (void)addSectionKeys:(NSArray *)keys;
- (void)dataForIndexPath:(NSIndexPath *)indexPath block:(void (^)(NSString *sectionKey, id object))block;
- (void)removeDataForIndexPath:(NSIndexPath *)indexPath;
@end
|
/****************************************************************************
*
* Copyright 2021 Samsung Electronics All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*
****************************************************************************/
/****************************************************************************
* arch/arm/src/armv8-m/up_busfault.c
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <tinyara/config.h>
#undef CONFIG_DEBUG
#undef CONFIG_DEBUG_ERROR
#define CONFIG_DEBUG 1
#define CONFIG_DEBUG_ERROR 1
#include <assert.h>
#include <debug.h>
#include <arch/irq.h>
#ifdef CONFIG_SYSTEM_REBOOT_REASON
#include <tinyara/reboot_reason.h>
#include <arch/reboot_reason.h>
#endif
#include "up_arch.h"
#include "nvic.h"
#include "up_internal.h"
extern uint32_t system_exception_location;
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#define BFARVALID 0x00008000
#define LSPERR 0x00002000
#define STKERR 0x00001000
#define UNSTKERR 0x00000800
#define IMPRECISERR 0x00000400
#define PRECISERR 0x00000200
#define IBUSERR 0x00000100
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Public Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_busfault
*
* Description:
* This is Bus Fault exception handler.
*
****************************************************************************/
int up_busfault(int irq, FAR void *context, FAR void *arg)
{
(void)irqsave();
uint32_t *regs = (uint32_t *)context;
uint32_t cfsr = getreg32(NVIC_CFAULTS);
uint32_t bfar = getreg32(NVIC_BFAULT_ADDR);
system_exception_location = regs[REG_R15];
lldbg("PANIC!!! Bus fault occurred while executing instruction at address : 0x%08x\n", regs[REG_R15]);
lldbg("CFAULTS: 0x%08x\n", cfsr);
if (cfsr & BFARVALID) {
lldbg("Fault occurred while accessing address (BFAR) : 0x%08x\n", bfar);
} else {
lldbg("Unable to determine fault address.\n");
}
if (cfsr & PRECISERR) {
lldbg("Precise data access error occurred.\n");
} else if (cfsr & IMPRECISERR) {
lldbg("Imprecise data access error occurred.\n");
} else if (cfsr & STKERR) {
lldbg("Error while stacking registers during exception entry.\n");
} else if (cfsr & UNSTKERR) {
lldbg("Error while unstacking registers during exception return.\n");
} else if (cfsr & LSPERR) {
lldbg("Error occurred during lazy state preservation of Floating Point unit registers.\n");
} else if (cfsr & IBUSERR) {
lldbg("Error on an instruction prefetch.\n");
}
#ifdef CONFIG_SYSTEM_REBOOT_REASON
if (cfsr & IBUSERR) {
up_reboot_reason_write(REBOOT_SYSTEM_PREFETCHABORT);
} else {
up_reboot_reason_write(REBOOT_SYSTEM_DATAABORT);
}
#endif
PANIC();
return 0;
}
|
//
// LDCLoginCommunitySelectionViewController.h
// LiquidDecisions
//
// Created by Eric Johnson on 3/28/13.
// Copyright (c) 2013 Liquid Analytics. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface LDCLoginCommunitySelectionViewController : UIViewController <UITableViewDataSource, UITableViewDelegate>
@end
|
//===----------------------------------------------------------------------===//
//
// Peloton
//
// column_stats_catalog.h
//
// Identification: src/include/catalog/column_stats_catalog.h
//
// Copyright (c) 2015-17, Carnegie Mellon University Database Group
//
//===----------------------------------------------------------------------===//
//===----------------------------------------------------------------------===//
// pg_column_stats
//
// Schema: (column offset: column_name)
// 0: database_id (pkey)
// 1: table_id (pkey)
// 2: column_id (pkey)
// 3: num_rows
// 4: cardinality
// 5: frac_null
// 6: most_common_vals
// 7: most_common_freqs
// 8: histogram_bounds
//
// Indexes: (index offset: indexed columns)
// 0: name & database_oid (unique & primary key)
//
//===----------------------------------------------------------------------===//
#pragma once
#include <map>
#include "catalog/abstract_catalog.h"
#define COLUMN_STATS_CATALOG_NAME "pg_column_stats"
namespace peloton {
namespace optimizer {
class ColumnStats;
}
namespace catalog {
class ColumnStatsCatalog : public AbstractCatalog {
public:
~ColumnStatsCatalog();
// Global Singleton
static ColumnStatsCatalog *GetInstance(
concurrency::TransactionContext *txn = nullptr);
//===--------------------------------------------------------------------===//
// write Related API
//===--------------------------------------------------------------------===//
bool InsertColumnStats(oid_t database_id, oid_t table_id, oid_t column_id,
int num_rows, double cardinality, double frac_null,
std::string most_common_vals,
std::string most_common_freqs,
std::string histogram_bounds, std::string column_name,
bool has_index, type::AbstractPool *pool,
concurrency::TransactionContext *txn);
bool DeleteColumnStats(oid_t database_id, oid_t table_id, oid_t column_id,
concurrency::TransactionContext *txn);
//===--------------------------------------------------------------------===//
// Read-only Related API
//===--------------------------------------------------------------------===//
std::unique_ptr<std::vector<type::Value>> GetColumnStats(
oid_t database_id, oid_t table_id, oid_t column_id,
concurrency::TransactionContext *txn);
size_t GetTableStats(
oid_t database_id, oid_t table_id, concurrency::TransactionContext *txn,
std::map<oid_t, std::unique_ptr<std::vector<type::Value>>> &
column_stats_map);
// TODO: add more if needed
enum ColumnId {
DATABASE_ID = 0,
TABLE_ID = 1,
COLUMN_ID = 2,
NUM_ROWS = 3,
CARDINALITY = 4,
FRAC_NULL = 5,
MOST_COMMON_VALS = 6,
MOST_COMMON_FREQS = 7,
HISTOGRAM_BOUNDS = 8,
COLUMN_NAME = 9,
HAS_INDEX = 10,
// Add new columns here in creation order
};
enum ColumnStatsOffset {
NUM_ROWS_OFF = 0,
CARDINALITY_OFF = 1,
FRAC_NULL_OFF = 2,
COMMON_VALS_OFF = 3,
COMMON_FREQS_OFF = 4,
HIST_BOUNDS_OFF = 5,
COLUMN_NAME_OFF = 6,
HAS_INDEX_OFF = 7,
};
private:
ColumnStatsCatalog(concurrency::TransactionContext *txn);
enum IndexId {
SECONDARY_KEY_0 = 0,
SECONDARY_KEY_1 = 1,
// Add new indexes here in creation order
};
};
} // namespace catalog
} // namespace peloton
|
/*
* Copyright (c) 2019 Piotr Mienkowski
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "test_gpio_api.h"
void test_main(void)
{
ztest_test_suite(gpio_api_1pin_test,
ztest_unit_test(test_gpio_pin_configure_push_pull),
ztest_unit_test(test_gpio_pin_configure_single_ended),
ztest_unit_test(test_gpio_pin_set_get_raw),
ztest_unit_test(test_gpio_pin_set_get),
ztest_unit_test(test_gpio_pin_set_get_active_high),
ztest_unit_test(test_gpio_pin_set_get_active_low),
ztest_unit_test(test_gpio_pin_toggle),
ztest_unit_test(test_gpio_port_set_masked_get_raw),
ztest_unit_test(test_gpio_port_set_masked_get),
ztest_unit_test(test_gpio_port_set_masked_get_active_high),
ztest_unit_test(test_gpio_port_set_masked_get_active_low),
ztest_unit_test(test_gpio_port_set_bits_clear_bits_raw),
ztest_unit_test(test_gpio_port_set_bits_clear_bits),
ztest_unit_test(test_gpio_port_set_clr_bits_raw),
ztest_unit_test(test_gpio_port_set_clr_bits),
ztest_unit_test(test_gpio_port_toggle),
ztest_unit_test(test_gpio_int_edge_rising),
ztest_unit_test(test_gpio_int_edge_falling),
ztest_unit_test(test_gpio_int_edge_both),
ztest_unit_test(test_gpio_int_edge_to_active),
ztest_unit_test(test_gpio_int_edge_to_inactive),
ztest_unit_test(test_gpio_int_level_high),
ztest_unit_test(test_gpio_int_level_low),
ztest_unit_test(test_gpio_int_level_active),
ztest_unit_test(test_gpio_int_level_inactive),
ztest_unit_test(test_gpio_pin_toggle_visual));
ztest_run_test_suite(gpio_api_1pin_test);
}
|
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _LIBSPARSE_DEFS_H_
#ifndef __unused
#define __unused __attribute__((__unused__))
#endif
#endif /* _LIBSPARSE_DEFS_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 COMPONENTS_WEB_RESTRICTIONS_BROWSER_WEB_RESTRICTIONS_MOJO_IMPLEMENTATION_H_
#define COMPONENTS_WEB_RESTRICTIONS_BROWSER_WEB_RESTRICTIONS_MOJO_IMPLEMENTATION_H_
#include <string>
#include "base/macros.h"
#include "components/web_restrictions/interfaces/web_restrictions.mojom.h"
namespace web_restrictions {
class WebRestrictionsClient;
class WebRestrictionsMojoImplementation : public mojom::WebRestrictions {
public:
explicit WebRestrictionsMojoImplementation(WebRestrictionsClient* client);
~WebRestrictionsMojoImplementation() override;
static void Create(WebRestrictionsClient* client,
mojo::InterfaceRequest<mojom::WebRestrictions> request);
private:
void GetResult(const std::string& url,
const GetResultCallback& callback) override;
void RequestPermission(const std::string& url,
const RequestPermissionCallback& callback) override;
WebRestrictionsClient* web_restrictions_client_;
};
} // namespace web_restrictions
#endif // COMPONENTS_WEB_RESTRICTIONS_BROWSER_WEB_RESTRICTIONS_MOJO_IMPLEMENTATION_H_
|
#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/highgui/highgui_c.h"
#include <stdio.h>
static void help(void)
{
printf("\nThis program creates an image to demonstrate the use of the \"c\" contour\n"
"functions: cvFindContours() and cvApproxPoly() along with the storage\n"
"functions cvCreateMemStorage() and cvDrawContours().\n"
"It also shows the use of a trackbar to control contour retrieval.\n"
"\n"
"Usage :\n"
"./contours\n");
}
#define w 500
int levels = 3;
CvSeq* contours = 0;
static void on_trackbar(int pos)
{
IplImage* cnt_img = cvCreateImage( cvSize(w,w), 8, 3 );
CvSeq* _contours = contours;
int _levels = levels - 3;
(void)pos;
if( _levels <= 0 ) // get to the nearest face to make it look more funny
_contours = _contours->h_next->h_next->h_next;
cvZero( cnt_img );
cvDrawContours( cnt_img, _contours, CV_RGB(255,0,0), CV_RGB(0,255,0), _levels, 3, CV_AA, cvPoint(0,0) );
cvShowImage( "contours", cnt_img );
cvReleaseImage( &cnt_img );
}
static void findCComp( IplImage* img )
{
int x, y, cidx = 1;
IplImage* mask = cvCreateImage( cvSize(img->width+2, img->height+2), 8, 1 );
cvZero(mask);
cvRectangle( mask, cvPoint(0, 0), cvPoint(mask->width-1, mask->height-1),
cvScalarAll(1), 1, 8, 0 );
for( y = 0; y < img->height; y++ )
for( x = 0; x < img->width; x++ )
{
if( CV_IMAGE_ELEM(mask, uchar, y+1, x+1) != 0 )
continue;
cvFloodFill(img, cvPoint(x,y), cvScalarAll(cidx),
cvScalarAll(0), cvScalarAll(0), 0, 4, mask);
cidx++;
}
}
int main(int argc, char* argv[])
{
int i, j;
CvMemStorage* storage = cvCreateMemStorage(0);
IplImage* img = cvCreateImage( cvSize(w,w), 8, 1 );
IplImage* img32f = cvCreateImage( cvSize(w,w), IPL_DEPTH_32F, 1 );
IplImage* img32s = cvCreateImage( cvSize(w,w), IPL_DEPTH_32S, 1 );
IplImage* img3 = cvCreateImage( cvSize(w,w), 8, 3 );
(void)argc; (void)argv;
help();
cvZero( img );
for( i=0; i < 6; i++ )
{
int dx = (i%2)*250 - 30;
int dy = (i/2)*150;
CvScalar white = cvRealScalar(255);
CvScalar black = cvRealScalar(0);
if( i == 0 )
{
for( j = 0; j <= 10; j++ )
{
double angle = (j+5)*CV_PI/21;
cvLine(img, cvPoint(cvRound(dx+100+j*10-80*cos(angle)),
cvRound(dy+100-90*sin(angle))),
cvPoint(cvRound(dx+100+j*10-30*cos(angle)),
cvRound(dy+100-30*sin(angle))), white, 3, 8, 0);
}
}
cvEllipse( img, cvPoint(dx+150, dy+100), cvSize(100,70), 0, 0, 360, white, -1, 8, 0 );
cvEllipse( img, cvPoint(dx+115, dy+70), cvSize(30,20), 0, 0, 360, black, -1, 8, 0 );
cvEllipse( img, cvPoint(dx+185, dy+70), cvSize(30,20), 0, 0, 360, black, -1, 8, 0 );
cvEllipse( img, cvPoint(dx+115, dy+70), cvSize(15,15), 0, 0, 360, white, -1, 8, 0 );
cvEllipse( img, cvPoint(dx+185, dy+70), cvSize(15,15), 0, 0, 360, white, -1, 8, 0 );
cvEllipse( img, cvPoint(dx+115, dy+70), cvSize(5,5), 0, 0, 360, black, -1, 8, 0 );
cvEllipse( img, cvPoint(dx+185, dy+70), cvSize(5,5), 0, 0, 360, black, -1, 8, 0 );
cvEllipse( img, cvPoint(dx+150, dy+100), cvSize(10,5), 0, 0, 360, black, -1, 8, 0 );
cvEllipse( img, cvPoint(dx+150, dy+150), cvSize(40,10), 0, 0, 360, black, -1, 8, 0 );
cvEllipse( img, cvPoint(dx+27, dy+100), cvSize(20,35), 0, 0, 360, white, -1, 8, 0 );
cvEllipse( img, cvPoint(dx+273, dy+100), cvSize(20,35), 0, 0, 360, white, -1, 8, 0 );
}
cvNamedWindow( "image", 1 );
cvShowImage( "image", img );
cvConvert( img, img32f );
findCComp( img32f );
cvConvert( img32f, img32s );
cvFindContours( img32s, storage, &contours, sizeof(CvContour),
CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE, cvPoint(0,0) );
//cvFindContours( img, storage, &contours, sizeof(CvContour),
// CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, cvPoint(0,0) );
{
const char* attrs[] = {"recursive", "1", 0};
cvSave("contours.xml", contours, 0, 0, cvAttrList(attrs, 0));
contours = (CvSeq*)cvLoad("contours.xml", storage, 0, 0);
}
// comment this out if you do not want approximation
contours = cvApproxPoly( contours, sizeof(CvContour), storage, CV_POLY_APPROX_DP, 3, 1 );
cvNamedWindow( "contours", 1 );
cvCreateTrackbar( "levels+3", "contours", &levels, 7, on_trackbar );
{
CvRNG rng = cvRNG(-1);
CvSeq* tcontours = contours;
cvCvtColor( img, img3, CV_GRAY2BGR );
while( tcontours->h_next )
tcontours = tcontours->h_next;
for( ; tcontours != 0; tcontours = tcontours->h_prev )
{
CvScalar color;
color.val[0] = cvRandInt(&rng) % 256;
color.val[1] = cvRandInt(&rng) % 256;
color.val[2] = cvRandInt(&rng) % 256;
color.val[3] = cvRandInt(&rng) % 256;
cvDrawContours(img3, tcontours, color, color, 0, -1, 8, cvPoint(0,0));
if( tcontours->v_next )
{
color.val[0] = cvRandInt(&rng) % 256;
color.val[1] = cvRandInt(&rng) % 256;
color.val[2] = cvRandInt(&rng) % 256;
color.val[3] = cvRandInt(&rng) % 256;
cvDrawContours(img3, tcontours->v_next, color, color, 1, -1, 8, cvPoint(0,0));
}
}
}
cvShowImage( "colored", img3 );
on_trackbar(0);
cvWaitKey(0);
cvReleaseMemStorage( &storage );
cvReleaseImage( &img );
cvReleaseImage( &img32f );
cvReleaseImage( &img32s );
cvReleaseImage( &img3 );
return 0;
}
#ifdef _EiC
main(1,"");
#endif
|
/*
BLIS
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2014, The University of Texas at Austin
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of The University of Texas at Austin 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.
*/
//
// Prototype BLAS-to-BLIS interfaces.
//
#undef GENTPROT
#define GENTPROT( ftype, ch, blasname ) \
\
void PASTEF77(ch,blasname)( \
f77_int* n, \
ftype* x, f77_int* incx, \
ftype* y, f77_int* incy \
);
#ifdef BLIS_ENABLE_BLAS2BLIS
INSERT_GENTPROT_BLAS( copy )
#endif
|
/*
* Copyright (C) 2010 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 TextInputType_h
#define TextInputType_h
#include "core/html/forms/BaseTextInputType.h"
namespace blink {
class TextInputType final : public BaseTextInputType {
public:
static InputType* create(HTMLInputElement&);
private:
TextInputType(HTMLInputElement& element) : BaseTextInputType(element) { }
void countUsage() override;
const AtomicString& formControlType() const override;
bool supportsInputModeAttribute() const override;
const AtomicString& defaultAutocapitalize() const override;
};
} // namespace blink
#endif // TextInputType_h
|
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef StyleVariableData_h
#define StyleVariableData_h
#include "core/css/CSSVariableData.h"
#include "wtf/Forward.h"
#include "wtf/HashMap.h"
#include "wtf/RefCounted.h"
#include "wtf/text/AtomicStringHash.h"
namespace blink {
class StyleVariableData : public RefCounted<StyleVariableData> {
public:
static PassRefPtr<StyleVariableData> create() { return adoptRef(new StyleVariableData()); }
PassRefPtr<StyleVariableData> copy() { return adoptRef(new StyleVariableData(*this)); }
bool operator==(const StyleVariableData& other) const;
bool operator!=(const StyleVariableData& other) const { return !(*this == other); }
void setVariable(const AtomicString& name, PassRefPtr<CSSVariableData> value) { m_data.set(name, value); }
CSSVariableData* getVariable(const AtomicString& name) const;
void removeVariable(const AtomicString& name) { return setVariable(name, nullptr); }
// This map will contain null pointers if variables are invalid due to
// cycles or referencing invalid variables without using a fallback.
// Note that this method is slow as a new map is constructed.
std::unique_ptr<HashMap<AtomicString, RefPtr<CSSVariableData>>> getVariables() const;
private:
StyleVariableData()
: m_root(nullptr)
{ }
StyleVariableData(StyleVariableData& other);
friend class CSSVariableResolver;
HashMap<AtomicString, RefPtr<CSSVariableData>> m_data;
RefPtr<StyleVariableData> m_root;
};
} // namespace blink
#endif // StyleVariableData_h
|
/*****************************************************************************
Copyright (c) 2014, Intel Corp.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************
* Contents: Native middle-level C interface to LAPACK function ssycon_3
* Author: Intel Corporation
* Generated December 2016
*****************************************************************************/
#include "lapacke_utils.h"
lapack_int LAPACKE_ssycon_3_work( int matrix_layout, char uplo, lapack_int n,
const float* a, lapack_int lda,
const float* e, const lapack_int* ipiv, float anorm,
float* rcond, float* work, lapack_int* iwork )
{
lapack_int info = 0;
if( matrix_layout == LAPACK_COL_MAJOR ) {
/* Call LAPACK function and adjust info */
LAPACK_ssycon_3( &uplo, &n, a, &lda, e, ipiv, &anorm, rcond, work, iwork,
&info );
if( info < 0 ) {
info = info - 1;
}
} else if( matrix_layout == LAPACK_ROW_MAJOR ) {
lapack_int lda_t = MAX(1,n);
float* a_t = NULL;
/* Check leading dimension(s) */
if( lda < n ) {
info = -5;
LAPACKE_xerbla( "LAPACKE_ssycon_3_work", info );
return info;
}
/* Allocate memory for temporary array(s) */
a_t = (float*)LAPACKE_malloc( sizeof(float) * lda_t * MAX(1,n) );
if( a_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_0;
}
/* Transpose input matrices */
LAPACKE_ssy_trans( matrix_layout, uplo, n, a, lda, a_t, lda_t );
/* Call LAPACK function and adjust info */
LAPACK_ssycon_3( &uplo, &n, a_t, &lda_t, e, ipiv, &anorm, rcond, work, iwork,
&info );
if( info < 0 ) {
info = info - 1;
}
/* Release memory and exit */
LAPACKE_free( a_t );
exit_level_0:
if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
LAPACKE_xerbla( "LAPACKE_ssycon_3_work", info );
}
} else {
info = -1;
LAPACKE_xerbla( "LAPACKE_ssycon_3_work", info );
}
return info;
}
|
// 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 WEBKIT_DOM_STORAGE_DOM_STORAGE_TYPES_H_
#define WEBKIT_DOM_STORAGE_DOM_STORAGE_TYPES_H_
#pragma once
#include <map>
#include "base/basictypes.h"
#include "base/nullable_string16.h"
#include "base/string16.h"
namespace dom_storage {
// The quota for each storage area. Suggested by the spec.
const size_t kPerAreaQuota = 5 * 1024 * 1024;
// Value to indicate the localstorage namespace vs non-zero
// values for sessionstorage namespaces.
const int64 kLocalStorageNamespaceId = 0;
const int64 kInvalidSessionStorageNamespaceId = kLocalStorageNamespaceId;
// Value to indicate an area that not be opened.
const int kInvalidAreaId = -1;
typedef std::map<string16, NullableString16> ValuesMap;
} // namespace dom_storage
#endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_TYPES_H_
|
/*
* Copyright (c) 2014 The Native Client Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include <alloca.h>
#include <stdint.h>
void __pnacl_start(uint32_t *info);
static int count_envs(char **envp) {
int count = 0;
for (; *envp != NULL; envp++)
count++;
return count;
}
void __pnacl_start_linux_c(uint32_t *stack) {
/*
* The Linux/ELF startup parameters in |stack| is:
* [0] argc, count of argv[] pointers
* [1] argv[0..argc] pointers, argv[argc] being NULL
* [1+argc+1] envp[0..envc] pointers, envp[envc] being NULL
* [1+argc+envc+2] auxv[] pairs
*/
int argc = stack[0];
char **argv = (char **) (stack + 1);
char **envp = argv + argc + 1; /* + 1 for the NULL terminator */
int envc = count_envs(envp);
/* cleanup + envc + argc + argv + NULL + envp + NULL + empty auxv */
int num_entries = 1 + 1 + 1 + argc + 1 + envc + 1 + 2;
uint32_t *info = (uint32_t *) alloca(sizeof(uint32_t) * num_entries);
int i = 0;
int j;
info[i++] = 0; /* cleanup_func pointer */
info[i++] = envc; /* envc */
info[i++] = argc; /* argc */
for (j = 0; j < argc; j++)
info[i++] = (uint32_t) argv[j];
info[i++] = 0; /* argv terminator */
for (j = 0; j < envc; j++)
info[i++] = (uint32_t) envp[j];
info[i++] = 0; /* env terminator */
info[i++] = 0; /* empty auxv type (AT_NULL) */
info[i++] = 0; /* empty auxv value */
__pnacl_start(info);
}
|
// Tencent is pleased to support the open source community by making RapidJSON available.
//
// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved.
//
// Licensed under the MIT License (the "License"); you may not use this file except
// in compliance with the License. You may obtain a copy of the License at
//
// http://opensource.org/licenses/MIT
//
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.
#ifndef RAPIDJSON_INTERNAL_SWAP_H_
#define RAPIDJSON_INTERNAL_SWAP_H_
#include "../rapidjson.h"
#if defined(__clang__)
RAPIDJSON_DIAG_PUSH
RAPIDJSON_DIAG_OFF(c++98-compat)
#endif
RAPIDJSON_NAMESPACE_BEGIN
namespace internal
{
//! Custom swap() to avoid dependency on C++ <algorithm> header
/*! \tparam T Type of the arguments to swap, should be instantiated with primitive C++ types only.
\note This has the same semantics as std::swap().
*/
template <typename T>
inline void Swap(T& a, T& b) RAPIDJSON_NOEXCEPT
{ T tmp = a;
a = b;
b = tmp;
}
} // namespace internal
RAPIDJSON_NAMESPACE_END
#if defined(__clang__)
RAPIDJSON_DIAG_POP
#endif
#endif // RAPIDJSON_INTERNAL_SWAP_H_
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef REMOTING_PROTOCOL_CLIENT_VIDEO_DISPATCHER_H_
#define REMOTING_PROTOCOL_CLIENT_VIDEO_DISPATCHER_H_
#include <list>
#include "base/compiler_specific.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "remoting/base/constants.h"
#include "remoting/protocol/channel_dispatcher_base.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
namespace remoting {
namespace protocol {
class ClientStub;
class VideoStub;
class ClientVideoDispatcher : public ChannelDispatcherBase {
public:
ClientVideoDispatcher(VideoStub* video_stub, ClientStub* client_stub);
ClientVideoDispatcher(const ClientVideoDispatcher&) = delete;
ClientVideoDispatcher& operator=(const ClientVideoDispatcher&) = delete;
~ClientVideoDispatcher() override;
private:
struct PendingFrame;
typedef std::list<PendingFrame> PendingFramesList;
void OnIncomingMessage(std::unique_ptr<CompoundBuffer> message) override;
// Callback for VideoStub::ProcessVideoPacket().
void OnPacketDone(PendingFramesList::iterator pending_frame);
PendingFramesList pending_frames_;
raw_ptr<VideoStub> video_stub_;
raw_ptr<ClientStub> client_stub_;
webrtc::DesktopSize screen_size_;
webrtc::DesktopVector screen_dpi_ =
webrtc::DesktopVector(kDefaultDpi, kDefaultDpi);
base::WeakPtrFactory<ClientVideoDispatcher> weak_factory_{this};
};
} // namespace protocol
} // namespace remoting
#endif // REMOTING_PROTOCOL_CLIENT_VIDEO_DISPATCHER_H_
|
// Copyright (c) 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 WEBKIT_COMMON_GPU_TEST_CONTEXT_PROVIDER_FACTORY_H_
#define WEBKIT_COMMON_GPU_TEST_CONTEXT_PROVIDER_FACTORY_H_
#include "base/memory/ref_counted.h"
#include "webkit/common/gpu/webkit_gpu_export.h"
namespace cc {
class ContextProvider;
}
namespace webkit {
namespace gpu {
class ContextProviderInProcess;
class WEBKIT_GPU_EXPORT TestContextProviderFactory {
public:
// The returned pointer is static and should not be deleted by the caller.
static TestContextProviderFactory* GetInstance();
scoped_refptr<cc::ContextProvider> OffscreenContextProviderForMainThread();
scoped_refptr<cc::ContextProvider>
OffscreenContextProviderForCompositorThread();
private:
TestContextProviderFactory();
~TestContextProviderFactory();
scoped_refptr<webkit::gpu::ContextProviderInProcess> main_thread_;
scoped_refptr<webkit::gpu::ContextProviderInProcess> compositor_thread_;
DISALLOW_COPY_AND_ASSIGN(TestContextProviderFactory);
};
} // namespace gpu
} // namespace webkit
#endif // WEBKIT_COMMON_GPU_TEST_CONTEXT_PROVIDER_FACTORY_H_
|
/*************************************************************************/
/* joints_2d.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* 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 JOINTS_2D_H
#define JOINTS_2D_H
#include "node_2d.h"
class PhysicsBody2D;
class Joint2D : public Node2D {
GDCLASS(Joint2D, Node2D);
RID joint;
RID ba, bb;
NodePath a;
NodePath b;
real_t bias;
bool exclude_from_collision;
protected:
void _update_joint(bool p_only_free = false);
void _notification(int p_what);
virtual RID _configure_joint(PhysicsBody2D *body_a, PhysicsBody2D *body_b) = 0;
static void _bind_methods();
public:
void set_node_a(const NodePath &p_node_a);
NodePath get_node_a() const;
void set_node_b(const NodePath &p_node_b);
NodePath get_node_b() const;
void set_bias(real_t p_bias);
real_t get_bias() const;
void set_exclude_nodes_from_collision(bool p_enable);
bool get_exclude_nodes_from_collision() const;
RID get_joint() const { return joint; }
Joint2D();
};
class PinJoint2D : public Joint2D {
GDCLASS(PinJoint2D, Joint2D);
real_t softness;
protected:
void _notification(int p_what);
virtual RID _configure_joint(PhysicsBody2D *body_a, PhysicsBody2D *body_b);
static void _bind_methods();
public:
void set_softness(real_t p_softness);
real_t get_softness() const;
PinJoint2D();
};
class GrooveJoint2D : public Joint2D {
GDCLASS(GrooveJoint2D, Joint2D);
real_t length;
real_t initial_offset;
protected:
void _notification(int p_what);
virtual RID _configure_joint(PhysicsBody2D *body_a, PhysicsBody2D *body_b);
static void _bind_methods();
public:
void set_length(real_t p_length);
real_t get_length() const;
void set_initial_offset(real_t p_initial_offset);
real_t get_initial_offset() const;
GrooveJoint2D();
};
class DampedSpringJoint2D : public Joint2D {
GDCLASS(DampedSpringJoint2D, Joint2D);
real_t stiffness;
real_t damping;
real_t rest_length;
real_t length;
protected:
void _notification(int p_what);
virtual RID _configure_joint(PhysicsBody2D *body_a, PhysicsBody2D *body_b);
static void _bind_methods();
public:
void set_length(real_t p_length);
real_t get_length() const;
void set_rest_length(real_t p_rest_length);
real_t get_rest_length() const;
void set_damping(real_t p_damping);
real_t get_damping() const;
void set_stiffness(real_t p_stiffness);
real_t get_stiffness() const;
DampedSpringJoint2D();
};
#endif // JOINTS_2D_H
|
#ifndef TRANSFORM_3D_H
#define TRANSFORM_3D_H
#include <QVector3D>
#include <QQuaternion>
#include <QMatrix4x4>
class Transform3D
{
public:
// Constants
static const QVector3D LocalForward;
static const QVector3D LocalUp;
static const QVector3D LocalRight;
// Constructors
Transform3D();
// Transform (Add / Scale)
void translate( const QVector3D& dt );
void translate( float dx, float dy, float dz );
void scale( const QVector3D& ds );
void scale( float dx, float dy, float dz );
void scale( float factor );
void rotate( const QQuaternion& dr );
void rotate( float angle, const QVector3D& axis );
void rotate( float angle, float ax, float ay, float az );
// Transform Mutators
void setTranslation( const QVector3D& t );
void setTranslation( float x, float y, float z );
void setScale( const QVector3D& s );
void setScale( float x, float y, float z );
void setScale( float k );
void setRotation( const QQuaternion& r );
void setRotation( float angle, const QVector3D& axis );
void setRotation( float angle, float ax, float ay, float az );
// Accessors
const QVector3D& translation() const;
const QVector3D& scale() const;
const QQuaternion& rotation() const;
const QMatrix4x4& toMatrix();
// Query
QVector3D forward() const;
QVector3D up() const;
QVector3D right() const;
private:
QVector3D m_translation;
QVector3D m_scale;
QQuaternion m_rotation;
QMatrix4x4 m_world;
};
#ifndef QT_DEBUG_TRANSFORM_STREAM
QDebug operator<<( QDebug dbg, const Transform3D& transform );
#endif
#endif // TRANSFORM_3D_H
|
/***************************************************************************
qgsquerybuilder.h - query builder
--------------------------------------
Date : 2004-11-19
Copyright : (C) 2004 by Gary E.Sherman
Email : sherman at mrcc.com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSQUERYBUILDER_H
#define QGSQUERYBUILDER_H
#include <map>
#include <vector>
#include <QStandardItemModel>
#include <QStandardItem>
#include <QModelIndex>
#include "ui_qgsquerybuilderbase.h"
#include "qgisgui.h"
#include "qgsfield.h"
#include "qgscontexthelp.h"
class QgsVectorLayer;
/*!
* \class QgsQueryBuilder
* \brief Query Builder for layers.
*
* The query builder allows interactive creation of a SQL for limiting the
* features displayed in a database layer. The fields in the table are
* displayed and sample values (or all values) can be viewed to aid in
* constructing the query. A test function returns the number of features that
* will be returned.
*
*/
class GUI_EXPORT QgsQueryBuilder : public QDialog, private Ui::QgsQueryBuilderBase
{
Q_OBJECT
public:
/** This constructor is used when the query builder is called from the
* vector layer properties dialog
* @param layer existing vector layer
* @param parent Parent widget
* @param fl dialog flags
*/
QgsQueryBuilder( QgsVectorLayer *layer, QWidget *parent = 0,
Qt::WindowFlags fl = QgisGui::ModalDialogFlags );
~QgsQueryBuilder();
void showEvent( QShowEvent *event ) override;
public slots:
void accept() override;
void reject() override;
void clear();
void on_btnEqual_clicked();
void on_btnLessThan_clicked();
void on_btnGreaterThan_clicked();
void on_btnPct_clicked();
void on_btnIn_clicked();
void on_btnNotIn_clicked();
void on_btnLike_clicked();
void on_btnILike_clicked();
QString sql();
void setSql( QString sqlStatement );
void on_lstFields_clicked( const QModelIndex &index );
void on_lstFields_doubleClicked( const QModelIndex &index );
void on_lstValues_doubleClicked( const QModelIndex &index );
void on_btnLessEqual_clicked();
void on_btnGreaterEqual_clicked();
void on_btnNotEqual_clicked();
void on_btnAnd_clicked();
void on_btnNot_clicked();
void on_btnOr_clicked();
void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }
/** Test the constructed sql statement to see if the database likes it.
* The number of rows that would be returned is displayed in a message box.
* The test uses a "select count(*) from ..." query to test the SQL
* statement.
*/
void test();
/*!
* Get all distinct values for the field. Values are inserted
* into the value list box
*/
void on_btnGetAllValues_clicked();
/*!
* Get sample distinct values for the selected field. The sample size is
* limited to an arbitrary value (currently set to 25). The values
* are inserted into the values list box.
*/
void on_btnSampleValues_clicked();
void setDatasourceDescription( QString uri );
private:
/*!
* Populate the field list for the selected table
*/
void populateFields();
/*!
* Setup models for listviews
*/
void setupGuiViews();
void setupLstFieldsModel();
void fillValues( int idx, int limit );
// private members
//! Model for fields ListView
QStandardItemModel *mModelFields;
//! Model for values ListView
QStandardItemModel *mModelValues;
//! Previous field row to delete model
int mPreviousFieldRow;
//! vector layer
QgsVectorLayer *mLayer;
//! original subset string
QString mOrigSubsetString;
};
#endif //QGSQUERYBUILDER_H
|
#ifndef __SMC91X_H__
#define __SMC91X_H__
#define SMC91X_USE_8BIT (1 << 0)
#define SMC91X_USE_16BIT (1 << 1)
#define SMC91X_USE_32BIT (1 << 2)
struct smc91x_platdata {
unsigned long flags;
unsigned long irq_flags; /* IRQF_... */
};
#endif /* __SMC91X_H__ */
|
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2013-2014 Sage Electronic Engineering, LLC.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <types.h>
#include <string.h>
#include <console/console.h>
#include <bootstate.h>
#include <cbmem.h>
#include <device/device.h>
#include <southbridge_pci_devs.h>
#include <fsp_util.h>
#include "../chip.h"
#include <reset.h>
#ifdef __PRE_RAM__
#if IS_ENABLED(CONFIG_SOUTHBRIDGE_INTEL_FSP_I89XX)
static void GetUpdDefaultFromFsp (FSP_INFO_HEADER *FspInfo, UPD_DATA_REGION *UpdData)
{
VPD_DATA_REGION *VpdDataRgnPtr;
UPD_DATA_REGION *UpdDataRgnPtr;
VpdDataRgnPtr = (VPD_DATA_REGION *)(UINT32)(FspInfo->CfgRegionOffset + FspInfo->ImageBase);
UpdDataRgnPtr = (UPD_DATA_REGION *)(UINT32)(VpdDataRgnPtr->PcdUpdRegionOffset + FspInfo->ImageBase);
memcpy((void*)UpdData, (void*)UpdDataRgnPtr, sizeof(UPD_DATA_REGION));
}
static void ConfigureDefaultUpdData(UPD_DATA_REGION *UpdData)
{
UpdData->HTEnable = TRUE;
UpdData->TurboEnable = FALSE;
UpdData->MemoryDownEnable = FALSE;
UpdData->FastBootEnable = CONFIG_ENABLE_FSP_FAST_BOOT;
}
#else /* IS_ENABLED(CONFIG_SOUTHBRIDGE_INTEL_FSP_I89XX) */
const PLATFORM_CONFIG DefaultPlatformConfig = {
TRUE, /* Hyperthreading */
FALSE, /* Turbo Mode */
FALSE, /* Memory Down */
#if IS_ENABLED(CONFIG_ENABLE_FSP_FAST_BOOT)
TRUE, /* Fast Boot */
#else
FALSE, /* Fast Boot */
#endif /* CONFIG_ENABLE_FSP_FAST_BOOT */
};
#endif /* IS_ENABLED(CONFIG_SOUTHBRIDGE_INTEL_FSP_I89XX) */
/*
*
* Call the FSP to do memory init. The FSP doesn't return to this function.
* The FSP returns to the romstage_main_continue().
*
*/
void chipset_fsp_early_init(FSP_INIT_PARAMS *FspInitParams,
FSP_INFO_HEADER *fsp_ptr)
{
FSP_INIT_RT_BUFFER *pFspRtBuffer = FspInitParams->RtBufferPtr;
#if IS_ENABLED(CONFIG_SOUTHBRIDGE_INTEL_FSP_I89XX)
UPD_DATA_REGION *fsp_upd_data = pFspRtBuffer->Common.UpdDataRgnPtr;
#else
MEM_CONFIG MemoryConfig;
memset((void*)&MemoryConfig, 0, sizeof(MEM_CONFIG));
#endif
FspInitParams->NvsBufferPtr = NULL;
#if IS_ENABLED(CONFIG_SOUTHBRIDGE_INTEL_FSP_I89XX)
/* Initialize the UPD Data */
GetUpdDefaultFromFsp (fsp_ptr, fsp_upd_data);
ConfigureDefaultUpdData(fsp_upd_data);
#else
pFspRtBuffer->Platform.MemoryConfig = &MemoryConfig;
pFspRtBuffer->PlatformConfiguration.PlatformConfig = &DefaultPlatformConfig;
#endif
#if IS_ENABLED(CONFIG_ENABLE_FSP_FAST_BOOT)
/* Find the fastboot cache that was saved in the ROM */
FspInitParams->NvsBufferPtr = find_and_set_fastboot_cache();
#endif
pFspRtBuffer->Common.BootMode = 0;
}
/* The FSP returns here after the fsp_early_init call */
void ChipsetFspReturnPoint(EFI_STATUS Status,
VOID *HobListPtr)
{
*(void **)CBMEM_FSP_HOB_PTR = HobListPtr;
if (Status == 0xFFFFFFFF) {
hard_reset();
}
romstage_main_continue(Status, HobListPtr);
}
#endif /* __PRE_RAM__ */
|
/*****************************************************************************
* timer.c: simple threaded timer
*****************************************************************************
* Copyright (C) 2009-2012 Rémi Denis-Courmont
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdnoreturn.h>
#include <stdlib.h>
#include <errno.h>
#include <assert.h>
#include <vlc_common.h>
#include <vlc_atomic.h>
/*
* POSIX timers are essentially unusable from a library: there provide no safe
* way to ensure that a timer has no pending/ongoing iteration. Furthermore,
* they typically require one thread per timer plus one thread per iteration,
* which is inefficient and overkill (unless you need multiple iteration
* of the same timer concurrently).
* Thus, this is a generic manual implementation of timers using a thread.
*/
struct vlc_timer
{
vlc_thread_t thread;
vlc_cond_t reschedule;
vlc_mutex_t lock;
void (*func) (void *);
void *data;
mtime_t value, interval;
atomic_uint overruns;
};
noreturn static void *vlc_timer_thread (void *data)
{
struct vlc_timer *timer = data;
vlc_mutex_lock (&timer->lock);
mutex_cleanup_push (&timer->lock);
for (;;)
{
while (timer->value == 0)
{
assert(timer->interval == 0);
vlc_cond_wait (&timer->reschedule, &timer->lock);
}
if (timer->interval != 0)
{
mtime_t now = mdate();
if (now > timer->value)
{ /* Update overrun counter */
unsigned misses = (now - timer->value) / timer->interval;
timer->value += misses * timer->interval;
assert(timer->value <= now);
atomic_fetch_add_explicit(&timer->overruns, misses,
memory_order_relaxed);
}
}
mtime_t value = timer->value;
if (vlc_cond_timedwait(&timer->reschedule, &timer->lock, value) == 0)
continue;
if (likely(timer->value <= value))
{
timer->value += timer->interval; /* rearm */
if (timer->interval == 0)
timer->value = 0; /* disarm */
}
vlc_mutex_unlock (&timer->lock);
int canc = vlc_savecancel ();
timer->func (timer->data);
vlc_restorecancel (canc);
vlc_mutex_lock (&timer->lock);
}
vlc_cleanup_pop ();
vlc_assert_unreachable ();
}
int vlc_timer_create (vlc_timer_t *id, void (*func) (void *), void *data)
{
struct vlc_timer *timer = malloc (sizeof (*timer));
if (unlikely(timer == NULL))
return ENOMEM;
vlc_mutex_init (&timer->lock);
vlc_cond_init (&timer->reschedule);
assert (func);
timer->func = func;
timer->data = data;
timer->value = 0;
timer->interval = 0;
atomic_init(&timer->overruns, 0);
if (vlc_clone (&timer->thread, vlc_timer_thread, timer,
VLC_THREAD_PRIORITY_INPUT))
{
vlc_cond_destroy (&timer->reschedule);
vlc_mutex_destroy (&timer->lock);
free (timer);
return ENOMEM;
}
*id = timer;
return 0;
}
void vlc_timer_destroy (vlc_timer_t timer)
{
vlc_cancel (timer->thread);
vlc_join (timer->thread, NULL);
vlc_cond_destroy (&timer->reschedule);
vlc_mutex_destroy (&timer->lock);
free (timer);
}
void vlc_timer_schedule (vlc_timer_t timer, bool absolute,
mtime_t value, mtime_t interval)
{
if (value == 0)
interval = 0;
else
if (!absolute)
value += mdate();
vlc_mutex_lock (&timer->lock);
timer->value = value;
timer->interval = interval;
vlc_cond_signal (&timer->reschedule);
vlc_mutex_unlock (&timer->lock);
}
unsigned vlc_timer_getoverrun (vlc_timer_t timer)
{
return atomic_exchange_explicit (&timer->overruns, 0,
memory_order_relaxed);
}
|
#ifndef _SYS_SEM_H
#define _SYS_SEM_H
#include <sys/ipc.h>
__BEGIN_DECLS
/* semop flags */
#define SEM_UNDO 0x1000 /* undo the operation on exit */
/* semctl Command Definitions. */
#define GETPID 11 /* get sempid */
#define GETVAL 12 /* get semval */
#define GETALL 13 /* get all semval's */
#define GETNCNT 14 /* get semncnt */
#define GETZCNT 15 /* get semzcnt */
#define SETVAL 16 /* set semval */
#define SETALL 17 /* set all semval's */
/* ipcs ctl cmds */
#define SEM_STAT 18
#define SEM_INFO 19
struct semid_ds {
struct ipc_perm sem_perm; /* permissions .. see ipc.h */
time_t sem_otime; /* last semop time */
time_t sem_ctime; /* last change time */
struct sem *sem_base; /* ptr to first semaphore in array */
struct sem_queue *sem_pending; /* pending operations to be processed */
struct sem_queue **sem_pending_last; /* last pending operation */
struct sem_undo *undo; /* undo requests on this array */
uint16_t sem_nsems; /* no. of semaphores in array */
};
/* semop system calls takes an array of these. */
struct sembuf {
uint16_t sem_num; /* semaphore index in array */
int16_t sem_op; /* semaphore operation */
int16_t sem_flg; /* operation flags */
};
/* please complain to the glibc goons for the following misbehaviour */
#if 0
/* arg for semctl system calls. */
union semun {
int val; /* value for SETVAL */
struct semid_ds *buf; /* buffer for IPC_STAT & IPC_SET */
unsigned short *array; /* array for GETALL & SETALL */
struct seminfo *__buf; /* buffer for IPC_INFO */
void *__pad;
};
#endif
#define _SEM_SEMUN_UNDEFINED
struct seminfo {
int32_t semmap;
int32_t semmni;
int32_t semmns;
int32_t semmnu;
int32_t semmsl;
int32_t semopm;
int32_t semume;
int32_t semusz;
int32_t semvmx;
int32_t semaem;
};
#define SEMMNI 128 /* <= IPCMNI max # of semaphore identifiers */
#define SEMMSL 250 /* <= 8 000 max num of semaphores per id */
#define SEMMNS (SEMMNI*SEMMSL) /* <= INT_MAX max # of semaphores in system */
#define SEMOPM 32 /* <= 1 000 max num of ops per semop call */
#define SEMVMX 32767 /* <= 32767 semaphore maximum value */
extern int semget( key_t key, int nsems, int semflg) __THROW;
/* The prototype really is:
* extern int semctl(int semid, int semnum, int cmd, union semun arg) __THROW;
* glibc bug compatibility forces us to write it like this: */
extern int semctl(int semid, int semnum, int cmd, ...) __THROW;
extern int semop(int semid, struct sembuf *sops, unsigned nsops) __THROW;
__END_DECLS
#endif
|
/* This file is part of the KDE project
Copyright 2007 Stefan Nikolaus <stefan.nikolaus@kdemail.net>
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 CALLIGRA_SHEETS_AUTO_FORMAT_COMMAND
#define CALLIGRA_SHEETS_AUTO_FORMAT_COMMAND
#include "AbstractRegionCommand.h"
#include <QList>
namespace Calligra
{
namespace Sheets
{
class Style;
/**
* \ingroup Commands
* \brief Formats a cell range using a pre-defined style for the table layout.
*/
class AutoFormatCommand : public AbstractRegionCommand
{
public:
/**
* Constructor.
*/
AutoFormatCommand();
/**
* Destructor.
*/
virtual ~AutoFormatCommand();
void setStyles(const QList<Style>& styles);
protected:
virtual bool process(Element* element);
virtual bool preProcessing();
virtual bool mainProcessing();
private:
QList<Style> m_styles;
};
} // namespace Sheets
} // namespace Calligra
#endif // CALLIGRA_SHEETS_AUTO_FORMAT_COMMAND
|
#ifndef NET_SNMP_SESSION_API_H
#define NET_SNMP_SESSION_API_H
/**
* Library API routines concerned with specifying and using SNMP "sessions"
* including sending and receiving requests.
*/
#include <net-snmp/types.h>
/*
* For the initial release, this will just refer to the
* relevant UCD header files.
* In due course, the routines relevant to this area of the
* API will be identified, and listed here directly.
*
* But for the time being, this header file is a placeholder,
* to allow application writers to adopt the new header file names.
*/
#include <net-snmp/library/snmp_api.h>
#include <net-snmp/library/snmp_client.h>
#include <net-snmp/library/asn1.h>
#include <net-snmp/library/callback.h>
#include <net-snmp/library/snmp_transport.h>
#ifdef SNMP_TRANSPORT_CALLBACK_DOMAIN
#include <net-snmp/library/snmpCallbackDomain.h>
#endif
#ifdef SNMP_TRANSPORT_UNIX_DOMAIN
#include <net-snmp/library/snmpUnixDomain.h>
#endif
#ifdef SNMP_TRANSPORT_UDP_DOMAIN
#include <net-snmp/library/snmpUDPDomain.h>
#endif
#ifdef SNMP_TRANSPORT_TCP_DOMAIN
#include <net-snmp/library/snmpTCPDomain.h>
#endif
#ifdef SNMP_TRANSPORT_UDPIPV6_DOMAIN
#include <net-snmp/library/snmpUDPIPv6Domain.h>
#endif
#ifdef SNMP_TRANSPORT_TCPIPV6_DOMAIN
#include <net-snmp/library/snmpTCPIPv6Domain.h>
#endif
#ifdef SNMP_TRANSPORT_IPX_DOMAIN
#include <net-snmp/library/snmpIPXDomain.h>
#endif
#ifdef SNMP_TRANSPORT_AAL5PVC_DOMAIN
#include <net-snmp/library/snmpAAL5PVCDomain.h>
#endif
#include <net-snmp/library/ucd_compat.h>
#endif /* NET_SNMP_SESSION_API_H */
|
#ifndef MPLAYER_GL_OSD_H
#define MPLAYER_GL_OSD_H
#include <stdbool.h>
#include <inttypes.h>
#include "utils.h"
#include "sub/osd.h"
struct mpgl_osd *mpgl_osd_init(GL *gl, struct mp_log *log, struct osd_state *osd);
void mpgl_osd_destroy(struct mpgl_osd *ctx);
void mpgl_osd_set_options(struct mpgl_osd *ctx, bool pbo);
void mpgl_osd_generate(struct mpgl_osd *ctx, struct mp_osd_res res, double pts,
int stereo_mode, int draw_flags);
void mpgl_osd_resize(struct mpgl_osd *ctx, struct mp_osd_res res, int stereo_mode);
enum sub_bitmap_format mpgl_osd_get_part_format(struct mpgl_osd *ctx, int index);
struct gl_vao *mpgl_osd_get_vao(struct mpgl_osd *ctx);
void mpgl_osd_draw_part(struct mpgl_osd *ctx, int vp_w, int vp_h, int index);
int64_t mpgl_get_change_counter(struct mpgl_osd *ctx);
#endif
|
/*****************************************************************************
*
* PROJECT: Multi Theft Auto v1.0
* LICENSE: See LICENSE in the top level directory
* FILE: sdk/gui/CGUITab.h
* PURPOSE: Tab widget interface
*
* Multi Theft Auto is available from http://www.multitheftauto.com/
*
*****************************************************************************/
#ifndef __CGUITAB_H
#define __CGUITAB_H
#include "CGUIElement.h"
class CGUITab : public CGUIElement
{
public:
virtual ~CGUITab ( void ) {};
virtual void SetCaption ( const char* szCaption ) = 0;
};
#endif
|
/* print.h
* Definitions for printing packet analysis trees.
*
* Gilbert Ramirez <gram@alumni.rice.edu>
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef __PRINT_H__
#define __PRINT_H__
#include <stdio.h>
#include <epan/epan.h>
#include <epan/packet.h>
#include <epan/print_stream.h>
#include <epan/packet-range.h>
#include "ws_symbol_export.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* print output format */
typedef enum {
PR_FMT_TEXT, /* plain text */
PR_FMT_PS /* postscript */
} print_format_e;
/* print_range, enum which frames should be printed */
typedef enum {
print_range_selected_only, /* selected frame(s) only (currently only one) */
print_range_marked_only, /* marked frames only */
print_range_all_displayed, /* all frames currently displayed */
print_range_all_captured /* all frames in capture */
} print_range_e;
/* print_dissections, enum how the dissections should be printed */
typedef enum {
print_dissections_none, /* no dissections at all */
print_dissections_collapsed, /* no dissection details */
print_dissections_as_displayed, /* details as displayed */
print_dissections_expanded /* all dissection details */
} print_dissections_e;
typedef struct {
print_stream_t *stream; /* the stream to which we're printing */
print_format_e format; /* plain text or PostScript */
gboolean to_file; /* TRUE if we're printing to a file */
char *file; /* file output pathname */
char *cmd; /* print command string (not win32) */
packet_range_t range;
gboolean print_summary; /* TRUE if we should print summary line. */
gboolean print_col_headings; /* TRUE if we should print column headings */
print_dissections_e print_dissections;
gboolean print_hex; /* TRUE if we should print hex data;
* FALSE if we should print only if not dissected. */
gboolean print_formfeed; /* TRUE if a formfeed should be printed before
* each new packet */
} print_args_t;
typedef enum {
FORMAT_CSV, /* CSV */
FORMAT_JSON, /* JSON */
FORMAT_EK, /* JSON bulk insert to Elasticsearch */
FORMAT_XML, /* PDML output */
} fields_format;
/*
* Print user selected list of fields
*/
struct _output_fields;
typedef struct _output_fields output_fields_t;
WS_DLL_PUBLIC output_fields_t* output_fields_new(void);
WS_DLL_PUBLIC void output_fields_free(output_fields_t* info);
WS_DLL_PUBLIC void output_fields_add(output_fields_t* info, const gchar* field);
WS_DLL_PUBLIC GSList * output_fields_valid(output_fields_t* info);
WS_DLL_PUBLIC gsize output_fields_num_fields(output_fields_t* info);
WS_DLL_PUBLIC gboolean output_fields_set_option(output_fields_t* info, gchar* option);
WS_DLL_PUBLIC void output_fields_list_options(FILE *fh);
WS_DLL_PUBLIC gboolean output_fields_has_cols(output_fields_t* info);
/*
* Higher-level packet-printing code.
*/
WS_DLL_PUBLIC gboolean proto_tree_print(print_args_t *print_args,
epan_dissect_t *edt,
GHashTable *output_only_tables,
print_stream_t *stream);
WS_DLL_PUBLIC gboolean print_hex_data(print_stream_t *stream, epan_dissect_t *edt);
WS_DLL_PUBLIC void write_pdml_preamble(FILE *fh, const gchar* filename);
WS_DLL_PUBLIC void write_pdml_proto_tree(output_fields_t* fields, gchar **protocolfilter, epan_dissect_t *edt, FILE *fh);
WS_DLL_PUBLIC void write_pdml_finale(FILE *fh);
WS_DLL_PUBLIC void write_json_preamble(FILE *fh);
WS_DLL_PUBLIC void write_json_proto_tree(output_fields_t* fields, print_args_t *print_args, gchar **protocolfilter, epan_dissect_t *edt, FILE *fh);
WS_DLL_PUBLIC void write_json_finale(FILE *fh);
WS_DLL_PUBLIC void write_ek_proto_tree(output_fields_t* fields, print_args_t *print_args, gchar **protocolfilter, epan_dissect_t *edt, FILE *fh);
WS_DLL_PUBLIC void write_psml_preamble(column_info *cinfo, FILE *fh);
WS_DLL_PUBLIC void write_psml_columns(epan_dissect_t *edt, FILE *fh);
WS_DLL_PUBLIC void write_psml_finale(FILE *fh);
WS_DLL_PUBLIC void write_csv_column_titles(column_info *cinfo, FILE *fh);
WS_DLL_PUBLIC void write_csv_columns(epan_dissect_t *edt, FILE *fh);
WS_DLL_PUBLIC void write_carrays_hex_data(guint32 num, FILE *fh, epan_dissect_t *edt);
WS_DLL_PUBLIC void write_fields_preamble(output_fields_t* fields, FILE *fh);
WS_DLL_PUBLIC void write_fields_proto_tree(output_fields_t* fields, epan_dissect_t *edt, column_info *cinfo, FILE *fh);
WS_DLL_PUBLIC void write_fields_finale(output_fields_t* fields, FILE *fh);
WS_DLL_PUBLIC gchar* get_node_field_value(field_info* fi, epan_dissect_t* edt);
extern void print_cache_field_handles(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* print.h */
|
/*****************************************************************************
*
* PROJECT: Multi Theft Auto v1.0
* (Shared logic for modifications)
* LICENSE: See LICENSE in the top level directory
* FILE: mods/shared_logic/CClientModelRequestManager.h
* PURPOSE: Entity model streaming manager class
*
*****************************************************************************/
class CClientModelRequestManager;
#pragma once
#include "CClientCommon.h"
#include "CClientEntity.h"
#include <list>
struct SClientModelRequest
{
CModelInfo* pModel;
CClientEntity* pEntity;
CElapsedTime requestTimer;
};
class CClientModelRequestManager
{
friend class CClientManager;
public:
CClientModelRequestManager();
~CClientModelRequestManager();
bool IsLoaded(unsigned short usModelID);
bool IsRequested(CModelInfo* pModelInfo);
bool HasRequested(CClientEntity* pRequester);
CModelInfo* GetRequestedModelInfo(CClientEntity* pRequester);
bool RequestBlocking(unsigned short usModelID, const char* szTag);
bool Request(unsigned short usModelID, CClientEntity* pRequester);
void Cancel(CClientEntity* pRequester, bool bAllowQueue);
private:
void DoPulse();
bool GetRequestEntry(CClientEntity* pRequester, std::list<SClientModelRequest*>::iterator& iter);
bool m_bDoingPulse;
std::list<SClientModelRequest*> m_Requests;
std::list<CClientEntity*> m_CancelQueue;
};
|
/* -*- C++ -*- */
#ifndef _COALESCEHEAP_H_
#define _COALESCEHEAP_H_
/*
Heap Layers: An Extensible Memory Allocation Infrastructure
Copyright (C) 2000-2003 by Emery Berger
http://www.cs.umass.edu/~emery
emery@cs.umass.edu
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <assert.h>
#include "heaplayers.h"
/**
* @class CoalesceHeap
* @brief Applies splitting and coalescing.
* @see CoalesceableHeap
* @see RequireCoalesceable
*/
namespace HL {
template <class super>
class CoalesceHeap : public super {
public:
inline void * malloc (const size_t sz)
{
void * ptr = super::malloc (sz);
if (ptr != NULL) {
super::markInUse (ptr);
void * splitPiece = split (ptr, sz);
if (splitPiece != NULL) {
super::markFree (splitPiece);
super::free (splitPiece);
}
}
return ptr;
}
inline void free (void * ptr)
{
// Try to coalesce this object with its predecessor & successor.
if ((super::getNext(super::getPrev(ptr)) != ptr) || (super::getPrev(super::getNext(ptr)) != ptr)) {
// We're done with this object.
super::free (ptr);
return;
}
assert (super::getPrev(super::getNext(ptr)) == ptr);
// Try to coalesce with the previous object..
void * prev = super::getPrev(ptr);
void * next = super::getNext (ptr);
assert (prev != ptr);
if (super::isPrevFree(ptr)) {
assert (super::isFree(prev));
super::remove (prev);
coalesce (prev, ptr);
ptr = prev;
}
if (super::isFree(next)) {
super::remove (next);
coalesce (ptr, next);
}
super::markFree (ptr);
// We're done with this object.
super::free (ptr);
}
private:
// Combine the first object with the second.
inline static void coalesce (void * first, const void * second) {
// A few sanity checks first.
assert (super::getNext(first) == second);
assert (super::getPrev(second) == first);
// Now coalesce.
size_t newSize = ((size_t) second - (size_t) first) + super::getSize(second);
super::setSize (first, newSize);
setPrevSize (super::getNext(first), newSize);
}
// Split an object if it is big enough.
inline static void * split (void * obj, const size_t requestedSize) {
assert (super::getSize(obj) >= requestedSize);
// We split aggressively (for now; this could be a parameter).
const size_t actualSize = super::getSize(obj);
if (actualSize - requestedSize >= sizeof(typename super::Header) + sizeof(double)) {
// Split the object.
super::setSize(obj, requestedSize);
void * splitPiece = (char *) obj + requestedSize + sizeof(typename super::Header);
super::makeObject ((void *) super::getHeader(splitPiece),
requestedSize,
actualSize - requestedSize - sizeof(typename super::Header));
assert (!super::isFree(splitPiece));
// Now that we have a new successor (splitPiece), we need to
// mark obj as in use.
(super::getHeader(splitPiece))->markPrevInUse();
assert (super::getSize(splitPiece) >= sizeof(double));
assert (super::getSize(obj) >= requestedSize);
return splitPiece;
} else {
return NULL;
}
}
};
};
#endif
|
/*
* This file is part of Cleanflight.
*
* Cleanflight 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.
*
* Cleanflight 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 Cleanflight. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
uint8_t mpu6500SpiDetect(void);
void mpu6500SpiAccInit(accDev_t *acc);
void mpu6500SpiGyroInit(gyroDev_t *gyro);
bool mpu6500SpiAccDetect(accDev_t *acc);
bool mpu6500SpiGyroDetect(gyroDev_t *gyro);
bool mpu6500WriteRegister(uint8_t reg, uint8_t data);
bool mpu6500ReadRegister(uint8_t reg, uint8_t length, uint8_t *data);
|
/****************************************************************/
/* MOOSE - Multiphysics Object Oriented Simulation Environment */
/* */
/* All contents are licensed under LGPL V2.1 */
/* See LICENSE for full restrictions */
/****************************************************************/
#ifndef COMPOSITEEIGENSTRAIN_H
#define COMPOSITEEIGENSTRAIN_H
#include "ComputeEigenstrainBase.h"
#include "CompositeTensorBase.h"
#include "RankTwoTensor.h"
/**
* CompositeEigenstrain provides a simple RankTwoTensor type
* MaterialProperty that can be used as an Eigenstrain tensor in a mechanics simulation.
* This tensor is computes as a weighted sum of base Eigenstrain tensors where each weight
* can be a scalar material property that may depend on simulation variables.
* The generic logic that computes a weighted sum of tensors is located in the
* templated base class CompositeTensorBase.
*/
class CompositeEigenstrain : public CompositeTensorBase<RankTwoTensor, ComputeEigenstrainBase>
{
public:
CompositeEigenstrain(const InputParameters & parameters);
protected:
virtual void computeQpEigenstrain();
const std::string _M_name;
};
template<>
InputParameters validParams<CompositeEigenstrain>();
#endif //COMPOSITEEIGENSTRAIN_H
|
#include <db.h>
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include "pvfs2-test-config.h"
int main(int argc, char *argv[])
{
DB *db;
DBC *db_c;
DBT key, data;
int ret;
db_recno_t offset = 0;
char *fname = NULL;
if (argc != 2 && argc != 3)
{
fprintf(stderr, "Usage: %s <db file> {offset}\n", argv[0]);
exit(1);
}
fname = strdup(argv[1]);
if (argc == 3)
{
offset = atoi(argv[2]);
}
if ((ret = db_create(&db, NULL, 0)) != 0)
{
fprintf(stderr, "db_create: %s\n", db_strerror(ret));
exit(1);
}
if ((ret = db->set_flags(db, DB_RECNUM)) != 0)
{
fprintf(stderr, "db->set_flags: %s\n", db_strerror(ret));
exit(1);
}
db->set_errfile(db, stderr);
db->set_errpfx(db, "pvfs2");
#if 0
/* open the database */
if ((ret = db->open(db,
NULL, fname, NULL, DB_UNKNOWN,
#ifdef HAVE_DB_DIRTY_READ
DB_DIRTY_READ,
#endif
0)) != 0)
{
fprintf(stderr, "db->open: %s\n", db_strerror(ret));
exit(1);
}
#endif
if ((ret = db->cursor(db, NULL, &db_c, 0)) != 0)
{
fprintf(stderr, "db->cursor: %s\n", db_strerror(ret));
exit(1);
}
memset(&key, 0, sizeof(key));
memset(&data, 0, sizeof(data));
if (offset)
{
key.data = (char *) malloc(16);
key.size = key.ulen = 16;
key.flags |= DB_DBT_USERMEM;
*(int32_t*) key.data = offset;
data.flags |= DB_DBT_MALLOC;
if ((ret = db_c->c_get(db_c, &key, &data, DB_SET_RECNO)) != 0)
{
fprintf(stderr, "db_c->c_get: could not position cursor: %s\n", db_strerror(ret));
exit(1);
}
free(data.data);
free(key.data);
memset(&key, 0, sizeof(key));
memset(&data, 0, sizeof(data));
}
for (;;)
{
key.flags |= DB_DBT_MALLOC;
data.flags |= DB_DBT_MALLOC;
ret = db_c->c_get(db_c, &key, &data, DB_NEXT);
if (ret == DB_NOTFOUND)
{
break;
}
else if (ret != 0)
{
fprintf(stderr, "db_c->c_get: %s\n", db_strerror(ret));
break;
}
fprintf(stderr, "key: %s\n", (char *) key.data);
if (key.data)
free(key.data);
if (data.data)
free(data.data);
}
db->close(db, 0);
return 0;
}
|
/*=========================================================================
*
* Copyright Insight Software Consortium
*
* 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.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#ifndef itkFullToHalfHermitianImageFilter_h
#define itkFullToHalfHermitianImageFilter_h
#include "itkImageToImageFilter.h"
#include "itkSimpleDataObjectDecorator.h"
namespace itk
{
/** \class FullToHalfHermitianImageFilter
*
* \brief Reduces the size of a full complex image produced from a
* forward discrete Fourier transform of a real image to only the
* non-redundant half of the image.
*
* In particular, this filter reduces the size of the image in the
* first dimension to \f$\lfloor N/2 \rfloor + 1 \f$.
*
* \ingroup FourierTransform
*
* \sa HalfToFullHermitianImageFilter
* \sa ForwardFFTImageFilter
* \sa InverseFFTImageFilter
* \sa RealToHalfHermitianForwardFFTImageFilter
* \sa HalfHermitianToRealInverseFFTImageFilter
* \ingroup ITKFFT
*/
template< typename TInputImage >
class FullToHalfHermitianImageFilter :
public ImageToImageFilter< TInputImage, TInputImage >
{
public:
/** Standard class typedefs. */
typedef TInputImage InputImageType;
typedef typename InputImageType::PixelType InputImagePixelType;
typedef typename InputImageType::IndexType InputImageIndexType;
typedef typename InputImageType::IndexValueType InputImageIndexValueType;
typedef typename InputImageType::SizeType InputImageSizeType;
typedef typename InputImageType::SizeValueType InputImageSizeValueType;
typedef typename InputImageType::RegionType InputImageRegionType;
typedef TInputImage OutputImageType;
typedef typename OutputImageType::PixelType OutputImagePixelType;
typedef typename OutputImageType::IndexType OutputImageIndexType;
typedef typename OutputImageType::IndexValueType OutputImageIndexValueType;
typedef typename OutputImageType::SizeType OutputImageSizeType;
typedef typename OutputImageType::SizeValueType OutputImageSizeValueType;
typedef typename OutputImageType::RegionType OutputImageRegionType;
typedef FullToHalfHermitianImageFilter Self;
typedef ImageToImageFilter< TInputImage, TInputImage > Superclass;
typedef SmartPointer< Self > Pointer;
typedef SmartPointer< const Self > ConstPointer;
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** Run-time type information (and related methods). */
itkTypeMacro(FullToHalfHermitianImageFilter,
ImageToImageFilter);
/** Extract the dimensionality of the input and output images. */
itkStaticConstMacro(ImageDimension, unsigned int,
TInputImage::ImageDimension);
/** Get whether the actual X dimension of the image is odd or not in the full
* representation */
itkGetDecoratedOutputMacro(ActualXDimensionIsOdd, bool);
protected:
FullToHalfHermitianImageFilter();
~FullToHalfHermitianImageFilter() {}
void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread,
ThreadIdType threadId) ITK_OVERRIDE;
/** The output is a different size from the input. */
virtual void GenerateOutputInformation() ITK_OVERRIDE;
/** This class requires the entire input. */
virtual void GenerateInputRequestedRegion() ITK_OVERRIDE;
itkSetDecoratedOutputMacro(ActualXDimensionIsOdd, bool);
private:
FullToHalfHermitianImageFilter(const Self &); // purposely not implemented
void operator=(const Self &); // purposely not implemented
};
} // end namespace itk
#ifndef ITK_MANUAL_INSTANTIATION
#include "itkFullToHalfHermitianImageFilter.hxx"
#endif
#endif // itkFullToHalfHermitianImageFilter_h
|
/*=========================================================================
*
* Copyright NumFOCUS
*
* 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.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#ifndef itkScalarImageToCooccurrenceListSampleFilter_h
#define itkScalarImageToCooccurrenceListSampleFilter_h
#include <typeinfo>
#include "itkImageToListSampleFilter.h"
#include "itkSmartPointer.h"
#include "itkImageRegionIterator.h"
#include "itkShapedNeighborhoodIterator.h"
#include "itkNeighborhoodAlgorithm.h"
#include "itkConstantBoundaryCondition.h"
#include "itkFixedArray.h"
#include <vector>
#include <algorithm>
#include <iostream>
namespace itk
{
namespace Statistics
{
/**
*\class ScalarImageToCooccurrenceListSampleFilter
* \brief Converts pixel data into a list of pairs in order to compute a cooccurrence Histogram.
*
* This class is intended to be used in combination with the ListToHistogramFilter class.
*
* \author Glenn Pierce
*
* \ingroup Statistics
* \ingroup ITKStatistics
*/
template <typename TImage>
class ITK_TEMPLATE_EXPORT ScalarImageToCooccurrenceListSampleFilter : public ProcessObject
{
public:
ITK_DISALLOW_COPY_AND_MOVE(ScalarImageToCooccurrenceListSampleFilter);
using ImageType = TImage;
using MeasurementVectorType = FixedArray<typename TImage::PixelType, 2>;
using SampleType = itk::Statistics::ListSample<MeasurementVectorType>;
using MeasurementVectorSizeType = typename SampleType::MeasurementVectorSizeType;
/** Standard class type aliases */
using Self = ScalarImageToCooccurrenceListSampleFilter;
using Superclass = ProcessObject;
using Pointer = SmartPointer<Self>;
using ConstPointer = SmartPointer<const Self>;
/** Neighborhood iterator type. */
using ShapedNeighborhoodIteratorType = itk::ShapedNeighborhoodIterator<TImage, ConstantBoundaryCondition<TImage>>;
/** Offset type used for Neighborhoods */
using OffsetType = typename ShapedNeighborhoodIteratorType::OffsetType;
using OffsetTable = std::vector<OffsetType>;
void
UseNeighbor(const OffsetType & offset);
/** Method to set/get the image */
using Superclass::SetInput;
void
SetInput(const ImageType * image);
const ImageType *
GetInput() const;
/** method to get the List sample */
const SampleType *
GetOutput() const;
/** Run-time type information (and related methods). */
itkTypeMacro(ScalarImageToCooccurrenceListSampleFilter, ProcessObject);
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** the number of components in a measurement vector */
static constexpr unsigned int MeasurementVectorSize = 2;
/** Image dimension. */
static constexpr unsigned int ImageDimension = TImage::ImageDimension;
protected:
ScalarImageToCooccurrenceListSampleFilter();
~ScalarImageToCooccurrenceListSampleFilter() override = default;
void
PrintSelf(std::ostream & os, Indent indent) const override;
using DataObjectPointer = DataObject::Pointer;
using DataObjectPointerArraySizeType = ProcessObject::DataObjectPointerArraySizeType;
using Superclass::MakeOutput;
DataObjectPointer
MakeOutput(DataObjectPointerArraySizeType idx) override;
/** This method causes the filter to generate its output. */
void
GenerateData() override;
private:
OffsetTable m_OffsetTable;
}; // end of class ScalarImageToListSampleFilter
} // end of namespace Statistics
} // end of namespace itk
#ifndef ITK_MANUAL_INSTANTIATION
# include "itkScalarImageToCooccurrenceListSampleFilter.hxx"
#endif
#endif
|
#ifndef _INCLUDED_ASW_ALIEN_SHARED_H
#define _INCLUDED_ASW_ALIEN_SHARED_H
#ifdef _WIN32
#pragma once
#endif
#if defined( CLIENT_DLL )
#define CASW_Alien C_ASW_Alien
#endif
#endif // _INCLUDED_ASW_ALIEN_SHARED_H
|
/*
* Copyright 2014-2016 CyberVision, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef Kaa_NotificationProcessor_h
#define Kaa_NotificationProcessor_h
#import <Foundation/Foundation.h>
#import "EndpointGen.h"
/**
* Used to process notifications.
*/
@protocol NotificationProcessor
/**
* Called on topics' list update.
*
* @param topics The new topics array. <Topic>
* @see Topic
*/
- (void)topicsListUpdated:(NSArray *)topics;
/**
* Called when new notifications arrived.
*
* @param notifications The list of new notifications.
* @see Notification
*/
- (void)notificationsReceived:(NSArray *)notifications;
@end
#endif
|
//
// ATLConversationQueryDataSource.h
// Atlas
//
// Created by Kevin Coleman on 2/4/15.
// Copyright (c) 2015 Layer. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#import <UIKit/UIKit.h>
@import LayerKit;
extern NSInteger const ATLNumberOfSectionsBeforeFirstMessageSection;
/**
@abstract The `ATLConversationDataSource` manages an `LYRQueryController` object whose data is displayed in an
`ATLConversationViewController`. The `ATLConversationDataSource` also provides convenience methods for the translation
of index objects between an `LYRQueryController` and an `ATLConversationViewController`.
@discussion The `ATLConversationViewController` reserves the section at index 0 for a "Loading Messages" indicator if
one is needed during pagination. The index translation methods provided by the `ATLConversationDataSource` account for
this offset.
*/
@interface ATLConversationDataSource : NSObject
///---------------------------------------
/// @name Initializing a Data Source
///---------------------------------------
/**
@abstract Creates and returns an `ATLConversationDataSource` object.
@param layerClient An `LYRClient` object used to initialize the `queryController` property.
@param query An `LYRQuery` object used as the query for the `queryController` property.
@return An `ATLConversationDataSource` object.
*/
+ (instancetype)dataSourceWithLayerClient:(LYRClient *)layerClient query:(LYRQuery *)query;
/**
@abstract The `LYRQueryController` object managing data displayed in the `ATLConversationViewController`.
@discussion The `queryController` is hydrated with messages belonging to the `LYRConversation` object
supplied in the designated initializer.
*/
@property (nonatomic, readonly) LYRQueryController *queryController;
///---------------------------------------
/// @name Pagination
///---------------------------------------
/**
@abstract Asks the receiver if its `queryController` has more messages to display than are currently displayed on screen.
@return `YES` if there are more messages to display.
*/
- (BOOL)moreMessagesAvailable;
/**
@abstract Expands the pagination window of the `queryController` by the `paginationWindow` property if
more messages are available for display.
*/
- (void)expandPaginationWindow;
/**
@abstract Returns `YES` if the data source is currently in the process of expanding its pagination window.
*/
@property (nonatomic, readonly, getter=isExpandingPaginationWindow) BOOL expandingPaginationWindow;
///---------------------------------------
/// @name Index Translation Methods
///---------------------------------------
/**
@abstract Converts an `ATLConversationViewController` index path into an `LYRQueryController` index path.
*/
- (NSIndexPath *)queryControllerIndexPathForCollectionViewIndexPath:(NSIndexPath *)collectionViewIndexPath;
/**
@abstract Converts an `LYRQueryController` index path into an `ATLConversationViewController` index path.
*/
- (NSIndexPath *)collectionViewIndexPathForQueryControllerIndexPath:(NSIndexPath *)collectionViewIndexPath;
/**
@abstract Converts an `LYRQueryController` row into an `ATLConversationViewController` section.
@discussion The `ATLConversationViewController` displays one `LYRMessage` object for each section.
*/
- (NSInteger)collectionViewSectionForQueryControllerRow:(NSInteger)queryControllerRow;
/**
@abstract Fetches the `LYRMessage` object corresponding to an `ATLConversationViewController` index path.
*/
- (LYRMessage *)messageAtCollectionViewIndexPath:(NSIndexPath *)collectionViewIndexPath;
/**
@abstract Fetches the `LYRMessage` object corresponding to an `ATLConversationViewController` section.
*/
- (LYRMessage *)messageAtCollectionViewSection:(NSInteger)collectionViewSection;
@end
|
/**
* @file
* @brief
*
* @date 25.07.2013
* @author Andrey Gazukin
*/
#ifndef __LINUX_TIMER_H_
#define __LINUX_TIMER_H_
#include <kernel/time/timer.h>
#endif /* TIMER_H_ */
|
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
/******************************************************************
iLBC Speech Coder ANSI-C Source Code
WebRtcIlbcfix_CompCorr.c
******************************************************************/
#include "modules/audio_coding/codecs/ilbc/comp_corr.h"
#include "modules/audio_coding/codecs/ilbc/defines.h"
/*----------------------------------------------------------------*
* Compute cross correlation and pitch gain for pitch prediction
* of last subframe at given lag.
*---------------------------------------------------------------*/
void WebRtcIlbcfix_CompCorr(
int32_t *corr, /* (o) cross correlation */
int32_t *ener, /* (o) energy */
int16_t *buffer, /* (i) signal buffer */
size_t lag, /* (i) pitch lag */
size_t bLen, /* (i) length of buffer */
size_t sRange, /* (i) correlation search length */
int16_t scale /* (i) number of rightshifts to use */
){
int16_t *w16ptr;
w16ptr=&buffer[bLen-sRange-lag];
/* Calculate correlation and energy */
(*corr)=WebRtcSpl_DotProductWithScale(&buffer[bLen-sRange], w16ptr, sRange, scale);
(*ener)=WebRtcSpl_DotProductWithScale(w16ptr, w16ptr, sRange, scale);
/* For zero energy set the energy to 0 in order to avoid potential
problems for coming divisions */
if (*ener == 0) {
*corr = 0;
*ener = 1;
}
}
|
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_FEATURES_SUPERVISED_USER_FEATURES_H_
#define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_FEATURES_SUPERVISED_USER_FEATURES_H_
#include "base/feature_list.h"
namespace supervised_users {
extern const base::Feature kWebFilterInterstitialRefresh;
extern const base::Feature kLocalWebApprovals;
// Returns whether refreshed version of the website filter interstitial is
// enabled.
bool IsWebFilterInterstitialRefreshEnabled();
// Returns whether local parent approvals on Family Link user's device are
// enabled.
// Local web approvals are only available when refreshed version of web
// filter interstitial is enabled.
bool IsLocalWebApprovalsEnabled();
} // namespace supervised_users
#endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_FEATURES_SUPERVISED_USER_FEATURES_H_
|
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Stub implementation of the race detector API.
// +build !race
#include "runtime.h"
uintptr
runtime·raceinit(void)
{
return 0;
}
void
runtime·racefini(void)
{
}
void
runtime·racemapshadow(void *addr, uintptr size)
{
USED(addr);
USED(size);
}
void
runtime·racewritepc(void *addr, void *callpc, void *pc)
{
USED(addr);
USED(callpc);
USED(pc);
}
void
runtime·racereadpc(void *addr, void *callpc, void *pc)
{
USED(addr);
USED(callpc);
USED(pc);
}
void
runtime·racewriterangepc(void *addr, uintptr sz, uintptr step, void *callpc, void *pc)
{
USED(addr);
USED(sz);
USED(step);
USED(callpc);
USED(pc);
}
void
runtime·racereadrangepc(void *addr, uintptr sz, uintptr step, void *callpc, void *pc)
{
USED(addr);
USED(sz);
USED(step);
USED(callpc);
USED(pc);
}
void
runtime·raceacquire(void *addr)
{
USED(addr);
}
void
runtime·raceacquireg(G *gp, void *addr)
{
USED(gp);
USED(addr);
}
void
runtime·racerelease(void *addr)
{
USED(addr);
}
void
runtime·racereleaseg(G *gp, void *addr)
{
USED(gp);
USED(addr);
}
void
runtime·racereleasemerge(void *addr)
{
USED(addr);
}
void
runtime·racereleasemergeg(G *gp, void *addr)
{
USED(gp);
USED(addr);
}
void
runtime·racefingo(void)
{
}
void
runtime·racemalloc(void *p, uintptr sz, void *pc)
{
USED(p);
USED(sz);
USED(pc);
}
void
runtime·racefree(void *p)
{
USED(p);
}
uintptr
runtime·racegostart(void *pc)
{
USED(pc);
return 0;
}
void
runtime·racegoend(void)
{
}
|
//===---- llvm/Support/DebugLoc.h - Debug Location Information --*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines a number of light weight data structures used
// to describe and track debug location information.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_SUPPORT_DEBUGLOC_H
#define LLVM_SUPPORT_DEBUGLOC_H
namespace llvm {
template <typename T> struct DenseMapInfo;
class MDNode;
class LLVMContext;
/// DebugLoc - Debug location id. This is carried by Instruction, SDNode,
/// and MachineInstr to compactly encode file/line/scope information for an
/// operation.
class DebugLoc {
friend struct DenseMapInfo<DebugLoc>;
/// getEmptyKey() - A private constructor that returns an unknown that is
/// not equal to the tombstone key or DebugLoc().
static DebugLoc getEmptyKey() {
DebugLoc DL;
DL.LineCol = 1;
return DL;
}
/// getTombstoneKey() - A private constructor that returns an unknown that
/// is not equal to the empty key or DebugLoc().
static DebugLoc getTombstoneKey() {
DebugLoc DL;
DL.LineCol = 2;
return DL;
}
/// LineCol - This 32-bit value encodes the line and column number for the
/// location, encoded as 24-bits for line and 8 bits for col. A value of 0
/// for either means unknown.
unsigned LineCol;
/// ScopeIdx - This is an opaque ID# for Scope/InlinedAt information,
/// decoded by LLVMContext. 0 is unknown.
int ScopeIdx;
public:
DebugLoc() : LineCol(0), ScopeIdx(0) {} // Defaults to unknown.
/// get - Get a new DebugLoc that corresponds to the specified line/col
/// scope/inline location.
static DebugLoc get(unsigned Line, unsigned Col,
MDNode *Scope, MDNode *InlinedAt = 0);
/// getFromDILocation - Translate the DILocation quad into a DebugLoc.
static DebugLoc getFromDILocation(MDNode *N);
/// getFromDILexicalBlock - Translate the DILexicalBlock into a DebugLoc.
static DebugLoc getFromDILexicalBlock(MDNode *N);
/// isUnknown - Return true if this is an unknown location.
bool isUnknown() const { return ScopeIdx == 0; }
unsigned getLine() const {
return (LineCol << 8) >> 8; // Mask out column.
}
unsigned getCol() const {
return LineCol >> 24;
}
/// getScope - This returns the scope pointer for this DebugLoc, or null if
/// invalid.
MDNode *getScope(const LLVMContext &Ctx) const;
/// getInlinedAt - This returns the InlinedAt pointer for this DebugLoc, or
/// null if invalid or not present.
MDNode *getInlinedAt(const LLVMContext &Ctx) const;
/// getScopeAndInlinedAt - Return both the Scope and the InlinedAt values.
void getScopeAndInlinedAt(MDNode *&Scope, MDNode *&IA,
const LLVMContext &Ctx) const;
/// getAsMDNode - This method converts the compressed DebugLoc node into a
/// DILocation compatible MDNode.
MDNode *getAsMDNode(const LLVMContext &Ctx) const;
bool operator==(const DebugLoc &DL) const {
return LineCol == DL.LineCol && ScopeIdx == DL.ScopeIdx;
}
bool operator!=(const DebugLoc &DL) const { return !(*this == DL); }
void dump(const LLVMContext &Ctx) const;
};
template <>
struct DenseMapInfo<DebugLoc> {
static DebugLoc getEmptyKey() { return DebugLoc::getEmptyKey(); }
static DebugLoc getTombstoneKey() { return DebugLoc::getTombstoneKey(); }
static unsigned getHashValue(const DebugLoc &Key);
static bool isEqual(DebugLoc LHS, DebugLoc RHS) { return LHS == RHS; }
};
} // end namespace llvm
#endif /* LLVM_SUPPORT_DEBUGLOC_H */
|
/*
* Generated by class-dump 3.3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.
*/
#import <Foundation/NSObject.h>
@class DVTStackBacktrace, IDEFileReference;
@interface IDEFileTextSettings : NSObject
{
IDEFileReference *_fileReference;
unsigned long long _textEncoding;
long long _tabWidth;
long long _indentWidth;
unsigned long long _lineEndings;
BOOL _usesTabs;
BOOL _wrapsLines;
}
+ (void)initialize;
@property BOOL wrapsLines; // @synthesize wrapsLines=_wrapsLines;
@property long long indentWidth; // @synthesize indentWidth=_indentWidth;
@property long long tabWidth; // @synthesize tabWidth=_tabWidth;
@property BOOL usesTabs; // @synthesize usesTabs=_usesTabs;
@property unsigned long long textEncoding; // @synthesize textEncoding=_textEncoding;
@property unsigned long long lineEndings; // @synthesize lineEndings=_lineEndings;
@property(retain, nonatomic) IDEFileReference *fileReference; // @synthesize fileReference=_fileReference;
- (id)description;
- (void)updateWrapLines;
- (void)updateIndentWidth;
- (void)updateTabWidth;
- (void)updateUsesTabs;
- (void)updateTextEncoding;
- (void)updateLineEndings;
- (id)_textPreferences;
- (void)primitiveInvalidate;
- (void)_clearFileReferenceObservations;
- (id)init;
- (void)unregisterObserversWithSourceTextView:(id)arg1 textStorage:(id)arg2;
- (void)registerObserversWithSourceTextView:(id)arg1 textStorage:(id)arg2;
// Remaining properties
@property(retain) DVTStackBacktrace *creationBacktrace;
@property(readonly) DVTStackBacktrace *invalidationBacktrace;
@property(readonly, nonatomic, getter=isValid) BOOL valid;
@end
|
/*
The MIT License (MIT)
Copyright (c) 2013 Clover Studio Ltd. 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.
*/
#import <Foundation/Foundation.h>
@interface NSString (Extensions)
///@method isWhiteSpacesString
///checks if the string is consisted of whitespaces only
///@return YES if the string is whitespaces
-(BOOL) isWhiteSpacesString;
///@method isValidEmail
///checks if the string is of form x@y.(2 or 3 letters)
///@return YES
-(BOOL) isValidEmail;
@end
|
//#include <stdio.h>
//#include <string.h>
//#include <stdlib.h>
#include "stdio.h"
#include "cog.h"
#define CNT _CNT
#define CLKFREQ _CLKFREQ
unsigned int fibo (unsigned int n)
{
if (n < 2)
{
return (n);
}
else
{
return fibo(n - 1) + fibo(n - 2);
}
}
extern unsigned int clock(void);
void main (int argc, char* argv[])
{
int n;
int result;
unsigned int startTime;
unsigned int endTime;
unsigned int executionTime;
unsigned int rawTime;
printf("hello, world!\r\n");
for (n = 0; n <= 26; n++)
{
printf("fibo(%02d) = ", n);
startTime = clock();
result = fibo(n);
endTime = clock();
rawTime = endTime - startTime;
executionTime = rawTime / (CLKFREQ / 1000);
printf ("%06d (%05ums) (%u ticks)\n", result, executionTime, rawTime);
}
}
|
// Copyright (c) 2013 GitHub, Inc.
// Copyright (c) 2012 Intel Corp. All rights reserved.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ATOM_COMMON_API_ATOM_API_ID_WEAK_MAP_H_
#define ATOM_COMMON_API_ATOM_API_ID_WEAK_MAP_H_
#include <map>
#include <vector>
#include "base/basictypes.h"
#include "native_mate/scoped_persistent.h"
#include "native_mate/wrappable.h"
namespace atom {
namespace api {
// Like ES6's WeakMap, but the key is Integer and the value is Weak Pointer.
class IDWeakMap : public mate::Wrappable {
public:
IDWeakMap();
static void BuildPrototype(v8::Isolate* isolate,
v8::Handle<v8::ObjectTemplate> prototype);
private:
virtual ~IDWeakMap();
int32_t Add(v8::Isolate* isolate, v8::Handle<v8::Object> object);
v8::Handle<v8::Value> Get(v8::Isolate* isolate, int32_t key);
bool Has(int32_t key) const;
std::vector<int32_t> Keys() const;
void Remove(int32_t key);
int GetNextID();
static void WeakCallback(
const v8::WeakCallbackData<v8::Object, IDWeakMap>& data);
int32_t next_id_;
typedef scoped_refptr<mate::RefCountedPersistent<v8::Object> >
RefCountedV8Object;
std::map<int32_t, RefCountedV8Object> map_;
DISALLOW_COPY_AND_ASSIGN(IDWeakMap);
};
} // namespace api
} // namespace atom
#endif // ATOM_COMMON_API_ATOM_API_ID_WEAK_MAP_H_
|
/*
* Copyright (C) 2012 Tobias Brunner
* Copyright (C) 2005-2006 Martin Willi
* Copyright (C) 2005 Jan Hutter
* Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* 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.
*/
/**
* @defgroup eap_payload eap_payload
* @{ @ingroup payloads
*/
#ifndef EAP_PAYLOAD_H_
#define EAP_PAYLOAD_H_
typedef struct eap_payload_t eap_payload_t;
#include <library.h>
#include <eap/eap.h>
#include <encoding/payloads/payload.h>
/**
* Class representing an IKEv2 EAP payload.
*
* The EAP payload format is described in RFC section 3.16.
*/
struct eap_payload_t {
/**
* The payload_t interface.
*/
payload_t payload_interface;
/**
* Set the contained EAP data.
*
* This contains the FULL EAP message starting with "code".
* Chunk gets cloned.
*
* @param message EAP data
*/
void (*set_data) (eap_payload_t *this, chunk_t data);
/**
* Get the contained EAP data.
*
* This contains the FULL EAP message starting with "code".
*
* @return EAP data (pointer to internal data)
*/
chunk_t (*get_data) (eap_payload_t *this);
/**
* Get the EAP code.
*
* @return EAP message as chunk_t
*/
eap_code_t (*get_code) (eap_payload_t *this);
/**
* Get the EAP identifier.
*
* @return unique identifier
*/
u_int8_t (*get_identifier) (eap_payload_t *this);
/**
* Get the EAP method type.
*
* @param vendor pointer receiving vendor identifier
* @return EAP method type, vendor specific if vendor != 0
*/
eap_type_t (*get_type) (eap_payload_t *this, u_int32_t *vendor);
/**
* Enumerate the EAP method types contained in an EAP-Nak (i.e. get_type()
* returns EAP_NAK).
*
* @return enumerator over (eap_type_t type, u_int32_t vendor)
*/
enumerator_t* (*get_types) (eap_payload_t *this);
/**
* Check if the EAP method type is encoded in the Expanded Type format.
*
* @return TRUE if in Expanded Type format
*/
bool (*is_expanded) (eap_payload_t *this);
/**
* Destroys an eap_payload_t object.
*/
void (*destroy) (eap_payload_t *this);
};
/**
* Creates an empty eap_payload_t object.
*
* @return eap_payload_t object
*/
eap_payload_t *eap_payload_create(void);
/**
* Creates an eap_payload_t object with data.
*
* @param data data, gets cloned
* @return eap_payload_t object
*/
eap_payload_t *eap_payload_create_data(chunk_t data);
/**
* Creates an eap_payload_t object with data, owning the data.
*
* @param data data on heap, gets owned and freed
* @return eap_payload_t object
*/
eap_payload_t *eap_payload_create_data_own(chunk_t data);
/**
* Creates an eap_payload_t object with a code.
*
* Could should be either EAP_SUCCESS/EAP_FAILURE, use
* constructor above otherwise.
*
* @param code EAP status code
* @param identifier EAP identifier to use in payload
* @return eap_payload_t object
*/
eap_payload_t *eap_payload_create_code(eap_code_t code, u_int8_t identifier);
/**
* Creates an eap_payload_t EAP_RESPONSE containing an EAP_NAK.
*
* @param identifier EAP identifier to use in payload
* @param type preferred auth type, 0 to send all supported types
* @param vendor vendor identifier for auth type, 0 for default
* @param expanded TRUE to send an expanded Nak
* @return eap_payload_t object
*/
eap_payload_t *eap_payload_create_nak(u_int8_t identifier, eap_type_t type,
u_int32_t vendor, bool expanded);
#endif /** EAP_PAYLOAD_H_ @}*/
|
/*
* linux/kernel/irq/pm.c
*
* Copyright (C) 2009 Rafael J. Wysocki <rjw@sisk.pl>, Novell Inc.
*
* This file contains power management functions related to interrupts.
*/
#include <linux/irq.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/suspend.h>
#include <linux/syscore_ops.h>
#include "internals.h"
bool irq_pm_check_wakeup(struct irq_desc *desc)
{
if (irqd_is_wakeup_armed(&desc->irq_data)) {
irqd_clear(&desc->irq_data, IRQD_WAKEUP_ARMED);
desc->istate |= IRQS_SUSPENDED | IRQS_PENDING;
desc->depth++;
irq_disable(desc);
pm_system_irq_wakeup(irq_desc_get_irq(desc));
return true;
}
return false;
}
/*
* Called from __setup_irq() with desc->lock held after @action has
* been installed in the action chain.
*/
void irq_pm_install_action(struct irq_desc *desc, struct irqaction *action)
{
desc->nr_actions++;
if (action->flags & IRQF_FORCE_RESUME)
desc->force_resume_depth++;
WARN_ON_ONCE(desc->force_resume_depth &&
desc->force_resume_depth != desc->nr_actions);
if (action->flags & IRQF_NO_SUSPEND)
desc->no_suspend_depth++;
else if (action->flags & IRQF_COND_SUSPEND)
desc->cond_suspend_depth++;
WARN_ON_ONCE(desc->no_suspend_depth &&
(desc->no_suspend_depth +
desc->cond_suspend_depth) != desc->nr_actions);
}
/*
* Called from __free_irq() with desc->lock held after @action has
* been removed from the action chain.
*/
void irq_pm_remove_action(struct irq_desc *desc, struct irqaction *action)
{
desc->nr_actions--;
if (action->flags & IRQF_FORCE_RESUME)
desc->force_resume_depth--;
if (action->flags & IRQF_NO_SUSPEND)
desc->no_suspend_depth--;
else if (action->flags & IRQF_COND_SUSPEND)
desc->cond_suspend_depth--;
}
static bool suspend_device_irq(struct irq_desc *desc)
{
if (!desc->action || desc->no_suspend_depth)
return false;
if (irqd_is_wakeup_set(&desc->irq_data)) {
irqd_set(&desc->irq_data, IRQD_WAKEUP_ARMED);
/*
* We return true here to force the caller to issue
* synchronize_irq(). We need to make sure that the
* IRQD_WAKEUP_ARMED is visible before we return from
* suspend_device_irqs().
*/
return true;
}
desc->istate |= IRQS_SUSPENDED;
__disable_irq(desc);
/*
* Hardware which has no wakeup source configuration facility
* requires that the non wakeup interrupts are masked at the
* chip level. The chip implementation indicates that with
* IRQCHIP_MASK_ON_SUSPEND.
*/
if (irq_desc_get_chip(desc)->flags & IRQCHIP_MASK_ON_SUSPEND)
mask_irq(desc);
return true;
}
/**
* suspend_device_irqs - disable all currently enabled interrupt lines
*
* During system-wide suspend or hibernation device drivers need to be
* prevented from receiving interrupts and this function is provided
* for this purpose.
*
* So we disable all interrupts and mark them IRQS_SUSPENDED except
* for those which are unused, those which are marked as not
* suspendable via an interrupt request with the flag IRQF_NO_SUSPEND
* set and those which are marked as active wakeup sources.
*
* The active wakeup sources are handled by the flow handler entry
* code which checks for the IRQD_WAKEUP_ARMED flag, suspends the
* interrupt and notifies the pm core about the wakeup.
*/
void suspend_device_irqs(void)
{
struct irq_desc *desc;
int irq;
for_each_irq_desc(irq, desc) {
unsigned long flags;
bool sync;
if (irq_settings_is_nested_thread(desc))
continue;
raw_spin_lock_irqsave(&desc->lock, flags);
sync = suspend_device_irq(desc);
raw_spin_unlock_irqrestore(&desc->lock, flags);
if (sync)
synchronize_irq(irq);
}
}
EXPORT_SYMBOL_GPL(suspend_device_irqs);
static void resume_irq(struct irq_desc *desc)
{
irqd_clear(&desc->irq_data, IRQD_WAKEUP_ARMED);
if (desc->istate & IRQS_SUSPENDED)
goto resume;
/* Force resume the interrupt? */
if (!desc->force_resume_depth)
return;
/* Pretend that it got disabled ! */
desc->depth++;
resume:
desc->istate &= ~IRQS_SUSPENDED;
__enable_irq(desc);
}
static void resume_irqs(bool want_early)
{
struct irq_desc *desc;
int irq;
for_each_irq_desc(irq, desc) {
unsigned long flags;
bool is_early = desc->action &&
desc->action->flags & IRQF_EARLY_RESUME;
if (!is_early && want_early)
continue;
if (irq_settings_is_nested_thread(desc))
continue;
raw_spin_lock_irqsave(&desc->lock, flags);
resume_irq(desc);
raw_spin_unlock_irqrestore(&desc->lock, flags);
}
}
/**
* irq_pm_syscore_ops - enable interrupt lines early
*
* Enable all interrupt lines with %IRQF_EARLY_RESUME set.
*/
static void irq_pm_syscore_resume(void)
{
resume_irqs(true);
}
static struct syscore_ops irq_pm_syscore_ops = {
.resume = irq_pm_syscore_resume,
};
static int __init irq_pm_init_ops(void)
{
register_syscore_ops(&irq_pm_syscore_ops);
return 0;
}
device_initcall(irq_pm_init_ops);
/**
* resume_device_irqs - enable interrupt lines disabled by suspend_device_irqs()
*
* Enable all non-%IRQF_EARLY_RESUME interrupt lines previously
* disabled by suspend_device_irqs() that have the IRQS_SUSPENDED flag
* set as well as those with %IRQF_FORCE_RESUME.
*/
void resume_device_irqs(void)
{
resume_irqs(false);
}
EXPORT_SYMBOL_GPL(resume_device_irqs);
|
/*
* $Id: cu3088.c,v 1.35 2005/03/30 19:28:52 richtera Exp $
*
* CTC / LCS ccw_device driver
*
* Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, IBM Corporation
* Author(s): Arnd Bergmann <arndb@de.ibm.com>
* Cornelia Huck <cohuck@de.ibm.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include <linux/init.h>
#include <linux/module.h>
#include <linux/err.h>
#include <asm/ccwdev.h>
#include <asm/ccwgroup.h>
#include "cu3088.h"
const char *cu3088_type[] = {
"not a channel",
"CTC/A",
"ESCON channel",
"FICON channel",
"P390 LCS card",
"OSA LCS card",
"CLAW channel device",
"unknown channel type",
"unsupported channel type",
};
/* static definitions */
static struct ccw_device_id cu3088_ids[] = {
{ CCW_DEVICE(0x3088, 0x08), .driver_info = channel_type_parallel },
{ CCW_DEVICE(0x3088, 0x1f), .driver_info = channel_type_escon },
{ CCW_DEVICE(0x3088, 0x1e), .driver_info = channel_type_ficon },
{ CCW_DEVICE(0x3088, 0x01), .driver_info = channel_type_p390 },
{ CCW_DEVICE(0x3088, 0x60), .driver_info = channel_type_osa2 },
{ CCW_DEVICE(0x3088, 0x61), .driver_info = channel_type_claw },
{ /* end of list */ }
};
static struct ccw_driver cu3088_driver;
struct device *cu3088_root_dev;
static ssize_t
group_write(struct device_driver *drv, const char *buf, size_t count)
{
const char *start, *end;
char bus_ids[2][BUS_ID_SIZE], *argv[2];
int i;
int ret;
struct ccwgroup_driver *cdrv;
cdrv = to_ccwgroupdrv(drv);
if (!cdrv)
return -EINVAL;
start = buf;
for (i=0; i<2; i++) {
static const char delim[] = {',', '\n'};
int len;
if (!(end = strchr(start, delim[i])))
return count;
len = min_t(ptrdiff_t, BUS_ID_SIZE, end - start + 1);
strlcpy (bus_ids[i], start, len);
argv[i] = bus_ids[i];
start = end + 1;
}
ret = ccwgroup_create(cu3088_root_dev, cdrv->driver_id,
&cu3088_driver, 2, argv);
return (ret == 0) ? count : ret;
}
static DRIVER_ATTR(group, 0200, NULL, group_write);
/* Register-unregister for ctc&lcs */
int
register_cu3088_discipline(struct ccwgroup_driver *dcp)
{
int rc;
if (!dcp)
return -EINVAL;
/* Register discipline.*/
rc = ccwgroup_driver_register(dcp);
if (rc)
return rc;
rc = driver_create_file(&dcp->driver, &driver_attr_group);
if (rc)
ccwgroup_driver_unregister(dcp);
return rc;
}
void
unregister_cu3088_discipline(struct ccwgroup_driver *dcp)
{
if (!dcp)
return;
driver_remove_file(&dcp->driver, &driver_attr_group);
ccwgroup_driver_unregister(dcp);
}
static struct ccw_driver cu3088_driver = {
.owner = THIS_MODULE,
.ids = cu3088_ids,
.name = "cu3088",
.probe = ccwgroup_probe_ccwdev,
.remove = ccwgroup_remove_ccwdev,
};
/* module setup */
static int __init
cu3088_init (void)
{
int rc;
cu3088_root_dev = s390_root_dev_register("cu3088");
if (IS_ERR(cu3088_root_dev))
return PTR_ERR(cu3088_root_dev);
rc = ccw_driver_register(&cu3088_driver);
if (rc)
s390_root_dev_unregister(cu3088_root_dev);
return rc;
}
static void __exit
cu3088_exit (void)
{
ccw_driver_unregister(&cu3088_driver);
s390_root_dev_unregister(cu3088_root_dev);
}
MODULE_DEVICE_TABLE(ccw,cu3088_ids);
MODULE_AUTHOR("Arnd Bergmann <arndb@de.ibm.com>");
MODULE_LICENSE("GPL");
module_init(cu3088_init);
module_exit(cu3088_exit);
EXPORT_SYMBOL_GPL(cu3088_type);
EXPORT_SYMBOL_GPL(register_cu3088_discipline);
EXPORT_SYMBOL_GPL(unregister_cu3088_discipline);
|
/*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org)
*/
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/pci.h>
#include <asm/titan_dep.h>
extern struct pci_ops titan_pci_ops;
static struct resource py_mem_resource = {
.start = 0xe0000000UL,
.end = 0xe3ffffffUL,
.name = "Titan PCI MEM",
.flags = IORESOURCE_MEM
};
/*
*/
#define TITAN_IO_SIZE 0x0000ffffUL
#define TITAN_IO_BASE 0xe8000000UL
static struct resource py_io_resource = {
.start = 0x00001000UL,
.end = TITAN_IO_SIZE - 1,
.name = "Titan IO MEM",
.flags = IORESOURCE_IO,
};
static struct pci_controller py_controller = {
.pci_ops = &titan_pci_ops,
.mem_resource = &py_mem_resource,
.mem_offset = 0x00000000UL,
.io_resource = &py_io_resource,
.io_offset = 0x00000000UL
};
static char ioremap_failed[] __initdata = "Could not ioremap I/O port range";
static int __init pmc_yosemite_setup(void)
{
unsigned long io_v_base;
io_v_base = (unsigned long) ioremap(TITAN_IO_BASE, TITAN_IO_SIZE);
if (!io_v_base)
panic(ioremap_failed);
set_io_port_base(io_v_base);
py_controller.io_map_base = io_v_base;
TITAN_WRITE(RM9000x2_OCD_LKM7, TITAN_READ(RM9000x2_OCD_LKM7) | 1);
ioport_resource.end = TITAN_IO_SIZE - 1;
register_pci_controller(&py_controller);
return 0;
}
arch_initcall(pmc_yosemite_setup);
|
/**
* @file
* @author pavel.iqx
* @date 2014
* @copyright GNU General Public License v2
*/
#ifndef _MEMCHECKSETTINGS_H_
#define _MEMCHECKSETTINGS_H_
#include "cl_config.h"
//////////////////////////////////////////////////////////////
// default settings values
//////////////////////////////////////////////////////////////
#define CONFIG_ITEM_NAME_VALGRIND "Valgrind"
#define VALGRIND_BINARY "/usr/bin/valgrind"
#define VALGRIND_OUTPUT_IN_PRIVATE_FOLDER true
#define VALGRIND_OUTPUT_FILE ""
#define VALGRIND_MANDATORY_OPTIONS "--tool=memcheck --xml=yes --fullpath-after= --gen-suppressions=all"
#define VALGRIND_OUTPUT_FILE_OPTION "--xml-file"
#define VALGRIND_SUPPRESSION_FILE_OPTION "--suppressions"
#define VALGRIND_OPTIONS "--leak-check=yes --track-origins=yes"
#define VALGRIND_SUPP_FILE_IN_PRIVATE_FOLDER true
#define CONFIG_ITEM_NAME_MEMCHECK "MemCheck"
#define RESULT_PAGE_SIZE 50
#define RESULT_PAGE_SIZE_MAX 200
#define OMIT_NONWORKSPACE false
#define OMIT_DUPLICATIONS false
#define OMIT_SUPPRESSED true
#define MEMCHECK_CONFIG_FILE "memcheck.conf"
/////////////////////////////////////////////////////////////////
class ValgrindSettings: public clConfigItem
{
public:
ValgrindSettings();
virtual ~ ValgrindSettings() {
}
virtual void FromJSON(const JSONElement & json);
virtual JSONElement ToJSON() const;
private:
wxString m_binary;
bool m_outputInPrivateFolder;
wxString m_outputFile;
wxString m_mandatoryOptions;
wxString m_outputFileOption;
wxString m_suppressionFileOption;
wxString m_options;
bool m_suppFileInPrivateFolder;
wxArrayString m_suppFiles;
public:
void SetBinary(const wxString & binary) {
m_binary = binary;
}
const wxString & GetBinary() const {
return m_binary;
}
void SetOutputInPrivateFolder(bool outputInPrivateFolder) {
m_outputInPrivateFolder = outputInPrivateFolder;
}
bool GetOutputInPrivateFolder() const {
return m_outputInPrivateFolder;
}
void SetOutputFile(const wxString & outputFile) {
m_outputFile = outputFile;
}
const wxString & GetOutputFile() const {
return m_outputFile;
}
// void SetMandatoryOptions(const wxString & mandatoryOptions) {
// m_mandatoryOptions = mandatoryOptions;
// }
const wxString & GetMandatoryOptions() const {
//return wxString::Format(m_mandatoryOptions, m_outputFile);
return m_mandatoryOptions;
}
void SetOutputFileOption(const wxString& outputFileOption) {
m_outputFileOption = outputFileOption;
}
const wxString& GetOutputFileOption() const {
return m_outputFileOption;
}
void SetSuppressionFileOption(const wxString& suppressionFileOption) {
m_suppressionFileOption = suppressionFileOption;
}
const wxString& GetSuppressionFileOption() const {
return m_suppressionFileOption;
}
void SetOptions(const wxString& options) {
m_options = options;
}
const wxString & GetOptions() const {
return m_options;
}
void SetSuppFileInPrivateFolder(bool suppFileInPrivateFolder) {
m_suppFileInPrivateFolder = suppFileInPrivateFolder;
}
bool GetSuppFileInPrivateFolder() const {
return m_suppFileInPrivateFolder;
}
void SetSuppFiles(const wxArrayString& suppFiles) {
m_suppFiles = suppFiles;
}
const wxArrayString& GetSuppFiles() const {
return m_suppFiles;
}
};
class MemCheckSettings: public clConfigItem
{
public:
MemCheckSettings();
virtual ~ MemCheckSettings() {
}
virtual void FromJSON(const JSONElement & json);
virtual JSONElement ToJSON() const;
private:
wxString m_engine;
wxArrayString m_availableEngines;
size_t m_result_page_size;
size_t m_result_page_size_max;
bool m_omitNonWorkspace;
bool m_omitDuplications;
bool m_omitSuppressed;
/**
* @brief place for particular subsetting nodes
*
* May be remake to list of several processor settings.
*/
ValgrindSettings m_valgrindSettings;
public:
void SetEngine(const wxString & engine) {
m_engine = engine;
}
const wxString & GetEngine() const {
return m_engine;
}
// void SetAvailableEngines(const wxArrayString & availableEngines) {
// m_availableEngines = availableEngines;
// }
const wxArrayString & GetAvailableEngines() const {
return m_availableEngines;
}
void SetResultPageSize(size_t result_page_size) {
m_result_page_size = result_page_size;
}
size_t GetResultPageSize() const {
return m_result_page_size;
}
// void SetResultPageSizeMax(size_t result_page_size_max) {
// m_result_page_size_max = result_page_size_max;
// }
size_t GetResultPageSizeMax() const {
return m_result_page_size_max;
}
void SetOmitNonWorkspace(bool omitNonWorkspace) {
m_omitNonWorkspace = omitNonWorkspace;
}
bool GetOmitNonWorkspace() const {
return m_omitNonWorkspace;
}
void SetOmitDuplications(bool omitDuplications) {
m_omitDuplications = omitDuplications;
}
bool GetOmitDuplications() const {
return m_omitDuplications;
}
void SetOmitSuppressed(bool omitSuppressed) {
m_omitSuppressed = omitSuppressed;
}
bool GetOmitSuppressed() const {
return m_omitSuppressed;
}
/**
* @brief place for particular handlers of subsetting nodes
*/
ValgrindSettings & GetValgrindSettings() {
return m_valgrindSettings;
}
void SavaToConfig() {
clConfig conf(MEMCHECK_CONFIG_FILE);
conf.WriteItem(this);
}
void LoadFromConfig() {
clConfig conf(MEMCHECK_CONFIG_FILE);
conf.ReadItem(this);
}
};
#endif
|
#ifndef MONITOR_H
#define MONITOR_H
#include "qemu-common.h"
#include "qapi/qmp/qdict.h"
#include "block/block.h"
#include "qemu/readline.h"
extern Monitor *cur_mon;
/* flags for monitor_init */
#define MONITOR_IS_DEFAULT 0x01
#define MONITOR_USE_READLINE 0x02
#define MONITOR_USE_CONTROL 0x04
#define MONITOR_USE_PRETTY 0x08
bool monitor_cur_is_qmp(void);
void monitor_init(CharDriverState *chr, int flags);
int monitor_suspend(Monitor *mon);
void monitor_resume(Monitor *mon);
int monitor_read_bdrv_key_start(Monitor *mon, BlockDriverState *bs,
BlockCompletionFunc *completion_cb,
void *opaque);
int monitor_read_block_device_key(Monitor *mon, const char *device,
BlockCompletionFunc *completion_cb,
void *opaque);
int monitor_get_fd(Monitor *mon, const char *fdname, Error **errp);
int monitor_fd_param(Monitor *mon, const char *fdname, Error **errp);
void monitor_vprintf(Monitor *mon, const char *fmt, va_list ap)
GCC_FMT_ATTR(2, 0);
void monitor_printf(Monitor *mon, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
int monitor_fprintf(FILE *stream, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
void monitor_flush(Monitor *mon);
int monitor_set_cpu(int cpu_index);
int monitor_get_cpu_index(void);
void monitor_read_command(Monitor *mon, int show_prompt);
int monitor_read_password(Monitor *mon, ReadLineFunc *readline_func,
void *opaque);
void object_add(const char *type, const char *id, const QDict *qdict,
Visitor *v, Error **errp);
AddfdInfo *monitor_fdset_add_fd(int fd, bool has_fdset_id, int64_t fdset_id,
bool has_opaque, const char *opaque,
Error **errp);
int monitor_fdset_get_fd(int64_t fdset_id, int flags);
int monitor_fdset_dup_fd_add(int64_t fdset_id, int dup_fd);
void monitor_fdset_dup_fd_remove(int dup_fd);
int monitor_fdset_dup_fd_find(int dup_fd);
#endif /* !MONITOR_H */
|
/*
STB6100 Silicon Tuner
Copyright (C) Manu Abraham (abraham.manu@gmail.com)
Copyright (C) ST Microelectronics
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __STB_6100_REG_H
#define __STB_6100_REG_H
#include <linux/dvb/frontend.h>
#include "dvb_frontend.h"
#define STB6100_LD 0x00
#define STB6100_LD_LOCK (1 << 0)
#define STB6100_VCO 0x01
#define STB6100_VCO_OSCH (0x01 << 7)
#define STB6100_VCO_OSCH_SHIFT 7
#define STB6100_VCO_OCK (0x03 << 5)
#define STB6100_VCO_OCK_SHIFT 5
#define STB6100_VCO_ODIV (0x01 << 4)
#define STB6100_VCO_ODIV_SHIFT 4
#define STB6100_VCO_OSM (0x0f << 0)
#define STB6100_NI 0x02
#define STB6100_NF_LSB 0x03
#define STB6100_K 0x04
#define STB6100_K_PSD2 (0x01 << 2)
#define STB6100_K_PSD2_SHIFT 2
#define STB6100_K_NF_MSB (0x03 << 0)
#define STB6100_G 0x05
#define STB6100_G_G (0x0f << 0)
#define STB6100_G_GCT (0x07 << 5)
#define STB6100_F 0x06
#define STB6100_F_F (0x1f << 0)
#define STB6100_DLB 0x07
#define STB6100_TEST1 0x08
#define STB6100_FCCK 0x09
#define STB6100_FCCK_FCCK (0x01 << 6)
#define STB6100_LPEN 0x0a
#define STB6100_LPEN_LPEN (0x01 << 4)
#define STB6100_LPEN_SYNP (0x01 << 5)
#define STB6100_LPEN_OSCP (0x01 << 6)
#define STB6100_LPEN_BEN (0x01 << 7)
#define STB6100_TEST3 0x0b
#define STB6100_NUMREGS 0x0c
#define INRANGE(val, x, y) (((x <= val) && (val <= y)) || \
((y <= val) && (val <= x)) ? 1 : 0)
#define CHKRANGE(val, x, y) (((val >= x) && (val < y)) ? 1 : 0)
struct stb6100_config {
u8 tuner_address;
u32 refclock;
};
struct stb6100_state {
struct i2c_adapter *i2c;
const struct stb6100_config *config;
struct dvb_tuner_ops ops;
struct dvb_frontend *frontend;
struct tuner_state status;
u32 frequency;
u32 srate;
u32 bandwidth;
u32 reference;
};
#if defined(CONFIG_DVB_STB6100) || (defined(CONFIG_DVB_STB6100_MODULE) && defined(MODULE))
extern struct dvb_frontend *stb6100_attach(struct dvb_frontend *fe,
const struct stb6100_config *config,
struct i2c_adapter *i2c);
#else
static inline struct dvb_frontend *stb6100_attach(struct dvb_frontend *fe,
const struct stb6100_config *config,
struct i2c_adapter *i2c)
{
printk(KERN_WARNING "%s: Driver disabled by Kconfig\n", __func__);
return NULL;
}
#endif //
#endif
|
/*
* Simulator of microcontrollers (glob.h)
*
* Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
*
* To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
*
*/
/* This file is part of microcontroller simulator: ucsim.
UCSIM is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
UCSIM 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 UCSIM; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
/*@1@*/
#ifndef GLOB_HEADER
#define GLOB_HEADER
#include "stypes.h"
extern struct dis_entry disass_hc08[];
extern struct dis_entry disass_hc08_9e[];
#endif
/* End of hc08.src/glob.h */
|
/*
* Support for SuperH MigoR Quarter VGA LCD Panel
*
* Copyright (C) 2008 Magnus Damm
*
* Based on lcd_powertip.c from Kenati Technologies Pvt Ltd.
* Copyright (c) 2007 Ujjwal Pande <ujjwal@kenati.com>,
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/fb.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/gpio.h>
#include <video/sh_mobile_lcdc.h>
#include <cpu/sh7722.h>
#include <mach/migor.h>
/*
*/
static void reset_lcd_module(void)
{
gpio_set_value(GPIO_PTH2, 0);
mdelay(2);
gpio_set_value(GPIO_PTH2, 1);
mdelay(1);
}
/* */
static unsigned long adjust_reg18(unsigned short data)
{
unsigned long tmp1, tmp2;
tmp1 = (data<<1 | 0x00000001) & 0x000001FF;
tmp2 = (data<<2 | 0x00000200) & 0x0003FE00;
return tmp1 | tmp2;
}
static void write_reg(void *sys_ops_handle,
struct sh_mobile_lcdc_sys_bus_ops *sys_ops,
unsigned short reg, unsigned short data)
{
sys_ops->write_index(sys_ops_handle, adjust_reg18(reg << 8 | data));
}
static void write_reg16(void *sys_ops_handle,
struct sh_mobile_lcdc_sys_bus_ops *sys_ops,
unsigned short reg, unsigned short data)
{
sys_ops->write_index(sys_ops_handle, adjust_reg18(reg));
sys_ops->write_data(sys_ops_handle, adjust_reg18(data));
}
static unsigned long read_reg16(void *sys_ops_handle,
struct sh_mobile_lcdc_sys_bus_ops *sys_ops,
unsigned short reg)
{
unsigned long data;
sys_ops->write_index(sys_ops_handle, adjust_reg18(reg));
data = sys_ops->read_data(sys_ops_handle);
return ((data >> 1) & 0xff) | ((data >> 2) & 0xff00);
}
static void migor_lcd_qvga_seq(void *sys_ops_handle,
struct sh_mobile_lcdc_sys_bus_ops *sys_ops,
unsigned short const *data, int no_data)
{
int i;
for (i = 0; i < no_data; i += 2)
write_reg16(sys_ops_handle, sys_ops, data[i], data[i + 1]);
}
static const unsigned short sync_data[] = {
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static const unsigned short magic0_data[] = {
0x0060, 0x2700, 0x0008, 0x0808, 0x0090, 0x001A, 0x0007, 0x0001,
0x0017, 0x0001, 0x0019, 0x0000, 0x0010, 0x17B0, 0x0011, 0x0116,
0x0012, 0x0198, 0x0013, 0x1400, 0x0029, 0x000C, 0x0012, 0x01B8,
};
static const unsigned short magic1_data[] = {
0x0030, 0x0307, 0x0031, 0x0303, 0x0032, 0x0603, 0x0033, 0x0202,
0x0034, 0x0202, 0x0035, 0x0202, 0x0036, 0x1F1F, 0x0037, 0x0303,
0x0038, 0x0303, 0x0039, 0x0603, 0x003A, 0x0202, 0x003B, 0x0102,
0x003C, 0x0204, 0x003D, 0x0000, 0x0001, 0x0100, 0x0002, 0x0300,
0x0003, 0x5028, 0x0020, 0x00ef, 0x0021, 0x0000, 0x0004, 0x0000,
0x0009, 0x0000, 0x000A, 0x0008, 0x000C, 0x0000, 0x000D, 0x0000,
0x0015, 0x8000,
};
static const unsigned short magic2_data[] = {
0x0061, 0x0001, 0x0092, 0x0100, 0x0093, 0x0001, 0x0007, 0x0021,
};
static const unsigned short magic3_data[] = {
0x0010, 0x16B0, 0x0011, 0x0111, 0x0007, 0x0061,
};
int migor_lcd_qvga_setup(void *sohandle, struct sh_mobile_lcdc_sys_bus_ops *so)
{
unsigned long xres = 320;
unsigned long yres = 240;
int k;
reset_lcd_module();
migor_lcd_qvga_seq(sohandle, so, sync_data, ARRAY_SIZE(sync_data));
if (read_reg16(sohandle, so, 0) != 0x1505)
return -ENODEV;
pr_info("Migo-R QVGA LCD Module detected.\n");
migor_lcd_qvga_seq(sohandle, so, sync_data, ARRAY_SIZE(sync_data));
write_reg16(sohandle, so, 0x00A4, 0x0001);
mdelay(10);
migor_lcd_qvga_seq(sohandle, so, magic0_data, ARRAY_SIZE(magic0_data));
mdelay(100);
migor_lcd_qvga_seq(sohandle, so, magic1_data, ARRAY_SIZE(magic1_data));
write_reg16(sohandle, so, 0x0050, 0xef - (yres - 1));
write_reg16(sohandle, so, 0x0051, 0x00ef);
write_reg16(sohandle, so, 0x0052, 0x0000);
write_reg16(sohandle, so, 0x0053, xres - 1);
migor_lcd_qvga_seq(sohandle, so, magic2_data, ARRAY_SIZE(magic2_data));
mdelay(10);
migor_lcd_qvga_seq(sohandle, so, magic3_data, ARRAY_SIZE(magic3_data));
mdelay(40);
/* */
write_reg16(sohandle, so, 0x0020, 0x0000); /* */
write_reg16(sohandle, so, 0x0021, 0x0000); /* */
for (k = 0; k < (xres * 256); k++) /* */
write_reg16(sohandle, so, 0x0022, 0x0000);
write_reg16(sohandle, so, 0x0020, 0x0000); /* */
write_reg16(sohandle, so, 0x0021, 0x0000); /* */
write_reg16(sohandle, so, 0x0007, 0x0173);
mdelay(40);
/* */
write_reg(sohandle, so, 0x00, 0x22);
mdelay(100);
return 0;
}
|
/**
* @defgroup leon2_rasta Rasta Handler
* @ingroup sparc_leon2
*
* @file
* @ingroup leon2_rasta
* @brief Handles Rasta
*/
/*
* COPYRIGHT (c) 2007.
* Aeroflex Gaisler AB.
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.org/license/LICENSE.
*
*/
#ifndef __RASTA_H__
#define __RASTA_H__
#include <bsp.h>
#include <grcan.h>
#include <b1553brm_rasta.h>
#include <grspw.h>
#ifdef __cplusplus
extern "C" {
#endif
extern int rasta_register(void);
/* Address of PCI bus on RASTA local AMBA bus */
#define RASTA_PCI_BASE 0xe0000000
/* Address of SRAM on RASTA local AMBA bus */
#define RASTA_LOCAL_SRAM 0x40000000
#define UART0_IRQNO 2
#define UART1_IRQNO 3
#define GRCAN_IRQNO 7
#define SPW0_IRQNO 10
#define SPW1_IRQNO 11
#define SPW2_IRQNO 12
#define BRM_IRQNO 13
#define GRCAN_IRQ (3<<GRCAN_IRQNO)
#define SPW0_IRQ (1<<SPW0_IRQNO)
#define SPW1_IRQ (1<<SPW1_IRQNO)
#define SPW2_IRQ (1<<SPW2_IRQNO)
#define SPW_IRQ (7<<SPW0_IRQNO)
#define BRM_IRQ (1<<BRM_IRQNO)
#define UART0_IRQ (1<<UART0_IRQNO)
#define UART1_IRQ (1<<UART1_IRQNO)
/*
* The following defines the bits in the UART Control Registers.
*
*/
#define LEON_REG_UART_CONTROL_RTD 0x000000FF /* RX/TX data */
/*
* The following defines the bits in the LEON UART Status Registers.
*/
#define LEON_REG_UART_STATUS_DR 0x00000001 /* Data Ready */
#define LEON_REG_UART_STATUS_TSE 0x00000002 /* TX Send Register Empty */
#define LEON_REG_UART_STATUS_THE 0x00000004 /* TX Hold Register Empty */
#define LEON_REG_UART_STATUS_BR 0x00000008 /* Break Error */
#define LEON_REG_UART_STATUS_OE 0x00000010 /* RX Overrun Error */
#define LEON_REG_UART_STATUS_PE 0x00000020 /* RX Parity Error */
#define LEON_REG_UART_STATUS_FE 0x00000040 /* RX Framing Error */
#define LEON_REG_UART_STATUS_ERR 0x00000078 /* Error Mask */
/*
* The following defines the bits in the LEON UART Status Registers.
*/
#define LEON_REG_UART_CTRL_RE 0x00000001 /* Receiver enable */
#define LEON_REG_UART_CTRL_TE 0x00000002 /* Transmitter enable */
#define LEON_REG_UART_CTRL_RI 0x00000004 /* Receiver interrupt enable */
#define LEON_REG_UART_CTRL_TI 0x00000008 /* Transmitter interrupt enable */
#define LEON_REG_UART_CTRL_PS 0x00000010 /* Parity select */
#define LEON_REG_UART_CTRL_PE 0x00000020 /* Parity enable */
#define LEON_REG_UART_CTRL_FL 0x00000040 /* Flow control enable */
#define LEON_REG_UART_CTRL_LB 0x00000080 /* Loop Back enable */
#define UART_SET_SCALER 0
#define UART_SET_CTRL 1
#define UART_GET_STAT 2
#define UART_CLR_STAT 3
struct uart_reg {
volatile unsigned int data; /* 0x00 */
volatile unsigned int status; /* 0x04 */
volatile unsigned int ctrl; /* 0x08 */
volatile unsigned int scaler; /* 0x0C */
};
void uart_register(unsigned int baseaddr);
rtems_device_driver uart_initialize(rtems_device_major_number major,
rtems_device_minor_number minor, void *arg);
rtems_device_driver uart_open(rtems_device_major_number major,
rtems_device_minor_number minor, void *arg);
rtems_device_driver uart_close(rtems_device_major_number major,
rtems_device_minor_number minor, void *arg);
rtems_device_driver uart_read(rtems_device_major_number major,
rtems_device_minor_number minor, void *arg);
rtems_device_driver uart_write(rtems_device_major_number major,
rtems_device_minor_number minor, void *arg);
rtems_device_driver uart_control(rtems_device_major_number major,
rtems_device_minor_number minor, void *arg);
struct gpio_reg {
volatile unsigned int in_data; /* 0x00 */
volatile unsigned int out_data; /* 0x04 */
volatile unsigned int dir; /* 0x08 */
volatile unsigned int imask; /* 0x0C */
volatile unsigned int ipol; /* 0x10 */
volatile unsigned int iedge; /* 0x14 */
};
extern struct gpio_reg *gpio0, *gpio1;
#ifdef __cplusplus
}
#endif
#endif
|
/*
* Suspend support specific for i386/x86-64.
*
* Distribute under GPLv2
*
* Copyright (c) 2007 Rafael J. Wysocki <rjw@sisk.pl>
* Copyright (c) 2002 Pavel Machek <pavel@ucw.cz>
* Copyright (c) 2001 Patrick Mochel <mochel@osdl.org>
*/
#include <linux/suspend.h>
#include <linux/export.h>
#include <linux/smp.h>
#include <asm/pgtable.h>
#include <asm/proto.h>
#include <asm/mtrr.h>
#include <asm/page.h>
#include <asm/mce.h>
#include <asm/xcr.h>
#include <asm/suspend.h>
#include <asm/debugreg.h>
#include <asm/fpu-internal.h> /* */
#ifdef CONFIG_X86_32
static struct saved_context saved_context;
unsigned long saved_context_ebx;
unsigned long saved_context_esp, saved_context_ebp;
unsigned long saved_context_esi, saved_context_edi;
unsigned long saved_context_eflags;
#else
/* */
struct saved_context saved_context;
#endif
/*
*/
static void __save_processor_state(struct saved_context *ctxt)
{
#ifdef CONFIG_X86_32
mtrr_save_fixed_ranges(NULL);
#endif
kernel_fpu_begin();
/*
*/
#ifdef CONFIG_X86_32
store_gdt(&ctxt->gdt);
store_idt(&ctxt->idt);
#else
/* */
store_gdt((struct desc_ptr *)&ctxt->gdt_limit);
store_idt((struct desc_ptr *)&ctxt->idt_limit);
#endif
store_tr(ctxt->tr);
/* */
/*
*/
#ifdef CONFIG_X86_32
savesegment(es, ctxt->es);
savesegment(fs, ctxt->fs);
savesegment(gs, ctxt->gs);
savesegment(ss, ctxt->ss);
#else
/* */
asm volatile ("movw %%ds, %0" : "=m" (ctxt->ds));
asm volatile ("movw %%es, %0" : "=m" (ctxt->es));
asm volatile ("movw %%fs, %0" : "=m" (ctxt->fs));
asm volatile ("movw %%gs, %0" : "=m" (ctxt->gs));
asm volatile ("movw %%ss, %0" : "=m" (ctxt->ss));
rdmsrl(MSR_FS_BASE, ctxt->fs_base);
rdmsrl(MSR_GS_BASE, ctxt->gs_base);
rdmsrl(MSR_KERNEL_GS_BASE, ctxt->gs_kernel_base);
mtrr_save_fixed_ranges(NULL);
rdmsrl(MSR_EFER, ctxt->efer);
#endif
/*
*/
ctxt->cr0 = read_cr0();
ctxt->cr2 = read_cr2();
ctxt->cr3 = read_cr3();
#ifdef CONFIG_X86_32
ctxt->cr4 = read_cr4_safe();
#else
/* */
ctxt->cr4 = read_cr4();
ctxt->cr8 = read_cr8();
#endif
ctxt->misc_enable_saved = !rdmsrl_safe(MSR_IA32_MISC_ENABLE,
&ctxt->misc_enable);
}
/* */
void save_processor_state(void)
{
__save_processor_state(&saved_context);
x86_platform.save_sched_clock_state();
}
#ifdef CONFIG_X86_32
EXPORT_SYMBOL(save_processor_state);
#endif
static void do_fpu_end(void)
{
/*
*/
kernel_fpu_end();
}
static void fix_processor_context(void)
{
int cpu = smp_processor_id();
struct tss_struct *t = &per_cpu(init_tss, cpu);
set_tss_desc(cpu, t); /*
*/
#ifdef CONFIG_X86_64
get_cpu_gdt_table(cpu)[GDT_ENTRY_TSS].type = 9;
syscall_init(); /* */
#endif
load_TR_desc(); /* */
load_LDT(¤t->active_mm->context); /* */
}
/*
*/
static void __restore_processor_state(struct saved_context *ctxt)
{
if (ctxt->misc_enable_saved)
wrmsrl(MSR_IA32_MISC_ENABLE, ctxt->misc_enable);
/*
*/
/* */
#ifdef CONFIG_X86_32
if (ctxt->cr4)
write_cr4(ctxt->cr4);
#else
/* */
wrmsrl(MSR_EFER, ctxt->efer);
write_cr8(ctxt->cr8);
write_cr4(ctxt->cr4);
#endif
write_cr3(ctxt->cr3);
write_cr2(ctxt->cr2);
write_cr0(ctxt->cr0);
/*
*/
#ifdef CONFIG_X86_32
load_gdt(&ctxt->gdt);
load_idt(&ctxt->idt);
#else
/* */
load_gdt((const struct desc_ptr *)&ctxt->gdt_limit);
load_idt((const struct desc_ptr *)&ctxt->idt_limit);
#endif
/*
*/
#ifdef CONFIG_X86_32
loadsegment(es, ctxt->es);
loadsegment(fs, ctxt->fs);
loadsegment(gs, ctxt->gs);
loadsegment(ss, ctxt->ss);
/*
*/
if (boot_cpu_has(X86_FEATURE_SEP))
enable_sep_cpu();
#else
/* */
asm volatile ("movw %0, %%ds" :: "r" (ctxt->ds));
asm volatile ("movw %0, %%es" :: "r" (ctxt->es));
asm volatile ("movw %0, %%fs" :: "r" (ctxt->fs));
load_gs_index(ctxt->gs);
asm volatile ("movw %0, %%ss" :: "r" (ctxt->ss));
wrmsrl(MSR_FS_BASE, ctxt->fs_base);
wrmsrl(MSR_GS_BASE, ctxt->gs_base);
wrmsrl(MSR_KERNEL_GS_BASE, ctxt->gs_kernel_base);
#endif
/*
*/
if (cpu_has_xsave)
xsetbv(XCR_XFEATURE_ENABLED_MASK, pcntxt_mask);
fix_processor_context();
do_fpu_end();
x86_platform.restore_sched_clock_state();
mtrr_bp_restore();
}
/* */
void restore_processor_state(void)
{
__restore_processor_state(&saved_context);
}
#ifdef CONFIG_X86_32
EXPORT_SYMBOL(restore_processor_state);
#endif
|
############################################################################
# Make.config.h
#
# Copyright (C) 2008 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# 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 NuttX 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.
#
############################################################################
#
# Directories
#
PASCAL = ${shell pwd}
include $(PASCAL)/Make.config
include $(PASCAL)/Make.defs
INCDIR = $(PASCAL)/include
CONFIGH = $(INCDIR)/config.h
CONFIGS = CONFIG_DEBUG CONFIG_TRACE CONFIG_INSN16 CONFIG_INSN32
# ----------------------------------------------------------------------
# Objects and targets
all: config.h
.PHONY: all config.h $(CONFIGS) header trailer clean
$(CONFIGS):
@if [ "$($@)" = "y" ] ; then \
echo "#define $@ 1" >>$(CONFIGH) ; \
else \
echo "#undef $@" >>$(CONFIGH) ; \
fi
header:
@$(RM) $(INCDIR)/config.h
@echo "/* config.h: Autogenerated -- Do not edit. */" >$(CONFIGH)
@echo "" >>$(CONFIGH)
@echo "#ifndef __CONFIG_H" >>$(CONFIGH)
@echo "#define __CONFIG_H 1" >>$(CONFIGH)
@echo "" >>$(CONFIGH)
trailer:
@echo "" >>$(CONFIGH)
@echo "#endif /* __CONFIG_H */" >>$(CONFIGH)
$(CONFIGH): Make.config header $(CONFIGS) trailer
config.h: $(CONFIGH)
clean:
$(RM) $(INCDIR)/config.h
|
/*
* dhcpcd - DHCP client daemon
* Copyright (c) 2006-2009 Roy Marples <roy@marples.name>
* All rights reserved
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/types.h>
#include <sys/socket.h>
#include <errno.h>
#include <signal.h>
#include <string.h>
#include <syslog.h>
#include <unistd.h>
#include "common.h"
#include "signals.h"
static int signal_pipe[2];
static const int handle_sigs[] = {
SIGALRM,
SIGHUP,
SIGINT,
SIGPIPE,
SIGTERM,
SIGUSR1,
};
static void
signal_handler(int sig)
{
int serrno = errno;
if (write(signal_pipe[1], &sig, sizeof(sig)) != sizeof(sig))
syslog(LOG_ERR, "failed to write signal %d: %m", sig);
/* Restore errno */
errno = serrno;
}
/* Read a signal from the signal pipe. Returns 0 if there is
* no signal, -1 on error (and sets errno appropriately), and
* your signal on success */
int
signal_read(void)
{
int sig = -1;
char buf[16];
ssize_t bytes;
memset(buf, 0, sizeof(buf));
bytes = read(signal_pipe[0], buf, sizeof(buf));
if (bytes >= 0 && (size_t)bytes >= sizeof(sig))
memcpy(&sig, buf, sizeof(sig));
return sig;
}
/* Call this before doing anything else. Sets up the socket pair
* and installs the signal handler */
int
signal_init(void)
{
if (pipe(signal_pipe) == -1)
return -1;
/* Don't block on read */
if (set_nonblock(signal_pipe[0]) == -1)
return -1;
/* Stop any scripts from inheriting us */
if (set_cloexec(signal_pipe[0]) == -1)
return -1;
if (set_cloexec(signal_pipe[1]) == -1)
return -1;
return signal_pipe[0];
}
static int
signal_handle(void (*func)(int))
{
unsigned int i;
struct sigaction sa;
memset(&sa, 0, sizeof(sa));
sa.sa_handler = func;
sigemptyset(&sa.sa_mask);
for (i = 0; i < sizeof(handle_sigs) / sizeof(handle_sigs[0]); i++)
if (sigaction(handle_sigs[i], &sa, NULL) == -1)
return -1;
return 0;
}
int
signal_setup(void)
{
return signal_handle(signal_handler);
}
int
signal_reset(void)
{
return signal_handle(SIG_DFL);
}
|
#define _XOPEN_SOURCE 500
#include <stdlib.h>
#include "zdtmtst.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/wait.h>
#include <termios.h>
#include <sys/ioctl.h>
const char *test_doc = "Check a controlling terminal, if a proper fd belongs to another session leader";
const char *test_author = "Andrey Vagin <avagin@openvz.org>";
int main(int argc, char ** argv)
{
int fdm, fds, exit_code = 1, status;
task_waiter_t t;
char *slavename;
pid_t sid_b, sid_a, pid;
int pfd[2];
test_init(argc, argv);
task_waiter_init(&t);
if (pipe(pfd) == -1) {
pr_perror("pipe");
return 1;
}
fdm = open("/dev/ptmx", O_RDWR);
if (fdm == -1) {
pr_perror("Can't open a master pseudoterminal");
return 1;
}
grantpt(fdm);
unlockpt(fdm);
slavename = ptsname(fdm);
pid = test_fork();
if (pid == 0) {
if (setsid() == -1) {
pr_perror("setsid");
return 1;
}
close(pfd[0]);
/* set up a controlling terminal */
fds = open(slavename, O_RDWR | O_NOCTTY);
if (fds == -1) {
pr_perror("Can't open a slave pseudoterminal %s", slavename);
return 1;
}
ioctl(fds, TIOCSCTTY, 1);
pid = test_fork();
if (pid == 0) {
if (setsid() == -1) {
pr_perror("setsid");
return 1;
}
close(pfd[1]);
task_waiter_complete(&t, 1);
test_waitsig();
exit(0);
}
close(fds);
close(pfd[1]);
task_waiter_wait4(&t, 1);
task_waiter_complete(&t, 0);
test_waitsig();
kill(pid, SIGTERM);
wait(&status);
exit(status);
}
close(pfd[1]);
if (read(pfd[0], &sid_a, 1) != 0) {
pr_perror("read");
goto out;
}
if (ioctl(fdm, TIOCGSID, &sid_b) == -1) {
pr_perror("The tty is not a controlling");
goto out;
}
task_waiter_wait4(&t, 0);
test_daemon();
test_waitsig();
if (ioctl(fdm, TIOCGSID, &sid_a) == -1) {
fail("The tty is not a controlling");
goto out;
}
if (sid_b != sid_a) {
fail("The tty is controlling for someone else");
goto out;
}
exit_code = 0;
out:
kill(pid, SIGTERM);
wait(&status);
if (status == 0 && exit_code == 0)
pass();
return exit_code;
}
|
/**************************************************************************/
/* */
/* OCaml */
/* */
/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
/* */
/* Copyright 1996 Institut National de Recherche en Informatique et */
/* en Automatique. */
/* */
/* All rights reserved. This file is distributed under the terms of */
/* the GNU Lesser General Public License version 2.1, with the */
/* special exception on linking described in the file LICENSE. */
/* */
/**************************************************************************/
#define CAML_INTERNALS
/* Print an uncaught exception and abort */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "caml/backtrace.h"
#include "caml/callback.h"
#include "caml/debugger.h"
#include "caml/fail.h"
#include "caml/misc.h"
#include "caml/mlvalues.h"
#include "caml/printexc.h"
#include "caml/memory.h"
#include "caml/memprof.h"
struct stringbuf {
char * ptr;
char * end;
char data[256];
};
static void add_char(struct stringbuf *buf, char c)
{
if (buf->ptr < buf->end) *(buf->ptr++) = c;
}
static void add_string(struct stringbuf *buf, const char *s)
{
size_t len = strlen(s);
if (buf->ptr + len > buf->end) len = buf->end - buf->ptr;
if (len > 0) memmove(buf->ptr, s, len);
buf->ptr += len;
}
CAMLexport char * caml_format_exception(value exn)
{
mlsize_t start, i;
value bucket, v;
struct stringbuf buf;
char intbuf[64];
char * res;
buf.ptr = buf.data;
buf.end = buf.data + sizeof(buf.data) - 1;
if (Tag_val(exn) == 0) {
add_string(&buf, String_val(Field(Field(exn, 0), 0)));
/* Check for exceptions in the style of Match_failure and Assert_failure */
if (Wosize_val(exn) == 2 &&
Is_block(Field(exn, 1)) &&
Tag_val(Field(exn, 1)) == 0 &&
caml_is_special_exception(Field(exn, 0))) {
bucket = Field(exn, 1);
start = 0;
} else {
bucket = exn;
start = 1;
}
add_char(&buf, '(');
for (i = start; i < Wosize_val(bucket); i++) {
if (i > start) add_string(&buf, ", ");
v = Field(bucket, i);
if (Is_long(v)) {
snprintf(intbuf, sizeof(intbuf),
"%" ARCH_INTNAT_PRINTF_FORMAT "d", Long_val(v));
add_string(&buf, intbuf);
} else if (Tag_val(v) == String_tag) {
add_char(&buf, '"');
add_string(&buf, String_val(v));
add_char(&buf, '"');
} else {
add_char(&buf, '_');
}
}
add_char(&buf, ')');
} else
add_string(&buf, String_val(Field(exn, 0)));
*buf.ptr = 0; /* Terminate string */
i = buf.ptr - buf.data + 1;
res = caml_stat_alloc_noexc(i);
if (res == NULL) return NULL;
memmove(res, buf.data, i);
return res;
}
#ifdef NATIVE_CODE
# define DEBUGGER_IN_USE 0
#else
# define DEBUGGER_IN_USE caml_debugger_in_use
#endif
/* Default C implementation in case the OCaml one is not registered. */
static void default_fatal_uncaught_exception(value exn)
{
char * msg;
const value * at_exit;
int saved_backtrace_active, saved_backtrace_pos;
/* Build a string representation of the exception */
msg = caml_format_exception(exn);
/* Perform "at_exit" processing, ignoring all exceptions that may
be triggered by this */
saved_backtrace_active = Caml_state->backtrace_active;
saved_backtrace_pos = Caml_state->backtrace_pos;
Caml_state->backtrace_active = 0;
at_exit = caml_named_value("Pervasives.do_at_exit");
if (at_exit != NULL) caml_callback_exn(*at_exit, Val_unit);
Caml_state->backtrace_active = saved_backtrace_active;
Caml_state->backtrace_pos = saved_backtrace_pos;
/* Display the uncaught exception */
fprintf(stderr, "Fatal error: exception %s\n", msg);
caml_stat_free(msg);
/* Display the backtrace if available */
if (Caml_state->backtrace_active && !DEBUGGER_IN_USE)
caml_print_exception_backtrace();
}
int caml_abort_on_uncaught_exn = 0; /* see afl.c */
void caml_fatal_uncaught_exception(value exn)
{
const value *handle_uncaught_exception;
handle_uncaught_exception =
caml_named_value("Printexc.handle_uncaught_exception");
/* If the callback allocates, memprof could be called. In this case,
memprof's callback could raise an exception while
[handle_uncaught_exception] is running, so that the printing of
the exception fails. */
caml_memprof_set_suspended(1);
if (handle_uncaught_exception != NULL)
/* [Printexc.handle_uncaught_exception] does not raise exception. */
caml_callback2(*handle_uncaught_exception, exn, Val_bool(DEBUGGER_IN_USE));
else
default_fatal_uncaught_exception(exn);
/* Terminate the process */
if (caml_abort_on_uncaught_exn) {
abort();
} else {
exit(2);
}
}
|
#include <dsverifier.h>
digital_system controller = {
.b = { -2.7056 , 4.9189 , -2.9898 , 0.60746 },
.b_uncertainty = { 0.015 , 0.015 , 0.015 , 0.015 },
.b_size = 4,
.a = { 1 , -0.24695 , -0.80001 , 0.35681 },
.a_uncertainty = { 0.015 , 0.015 , 0.015 , 0.015 },
.a_size = 4,
.sample_time = 5.000000e-01
};
implementation impl = {
.int_bits = 8,
.frac_bits = 8,
.max = 1.000000,
.min = -1.000000
};
digital_system plant = {
.b = { 0 , 0.33528 , -0.55879 },
.b_uncertainty = { 0.015 , 0.015 , 0.015 },
.b_size = 3,
.a = { 1 , -1.8906 , 0.7788 },
.a_size = 3,
.a_uncertainty = { 0.015 , 0.015 , 0.015 }
};
|
/* Parse tree node interface */
#ifndef Py_NODE_H
#define Py_NODE_H
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _node {
short n_type;
char *n_str;
int n_lineno;
int n_col_offset;
int n_nchildren;
struct _node *n_child;
} node;
PyAPI_FUNC(node *) PyNode_New(int type);
PyAPI_FUNC(int) PyNode_AddChild(node *n, int type,
char *str, int lineno, int col_offset);
PyAPI_FUNC(void) PyNode_Free(node *n);
PyAPI_FUNC(Py_ssize_t) _PyNode_SizeOf(node *n);
/* Node access functions */
#define NCH(n) ((n)->n_nchildren)
#define CHILD(n, i) (&(n)->n_child[i])
#define RCHILD(n, i) (CHILD(n, NCH(n) + i))
#define TYPE(n) ((n)->n_type)
#define STR(n) ((n)->n_str)
/* Assert that the type of a node is what we expect */
#define REQ(n, type) assert(TYPE(n) == (type))
PyAPI_FUNC(void) PyNode_ListTree(node *);
#ifdef __cplusplus
}
#endif
#endif /* !Py_NODE_H */
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/**
Author:
Eric D Vaughan
**/
#ifndef nsGridRowGroupLayout_h___
#define nsGridRowGroupLayout_h___
#include "nsGridRowLayout.h"
/**
* The nsIBoxLayout implementation for nsGridRowGroupFrame.
*/
class nsGridRowGroupLayout : public nsGridRowLayout
{
public:
friend already_AddRefed<nsIBoxLayout> NS_NewGridRowGroupLayout();
virtual nsGridRowGroupLayout* CastToRowGroupLayout() { return this; }
virtual nsSize GetMinSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState);
virtual nsSize GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState);
virtual nsSize GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState);
virtual void CountRowsColumns(nsIBox* aBox, PRInt32& aRowCount, PRInt32& aComputedColumnCount);
virtual void DirtyRows(nsIBox* aBox, nsBoxLayoutState& aState);
virtual PRInt32 BuildRows(nsIBox* aBox, nsGridRow* aRows);
virtual nsMargin GetTotalMargin(nsIBox* aBox, PRBool aIsHorizontal);
virtual PRInt32 GetRowCount() { return mRowCount; }
virtual Type GetType() { return eRowGroup; }
protected:
nsGridRowGroupLayout();
virtual ~nsGridRowGroupLayout();
virtual void ChildAddedOrRemoved(nsIBox* aBox, nsBoxLayoutState& aState);
static void AddWidth(nsSize& aSize, nscoord aSize2, PRBool aIsHorizontal);
private:
nsGridRow* mRowColumn;
PRInt32 mRowCount;
};
#endif
|
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "sleep_api.h"
#include "cmsis.h"
#include "fsl_smc.h"
#include "fsl_clock_config.h"
extern bool serial_check_tx_ongoing();
void hal_sleep(void)
{
SMC_SetPowerModeProtection(SMC, kSMC_AllowPowerModeAll);
SMC_SetPowerModeWait(SMC);
}
void hal_deepsleep(void)
{
#if (defined(FSL_FEATURE_SOC_MCG_COUNT) && FSL_FEATURE_SOC_MCG_COUNT)
#if (defined(FSL_FEATURE_MCG_HAS_PLL) && FSL_FEATURE_MCG_HAS_PLL)
smc_power_state_t original_power_state;
original_power_state = SMC_GetPowerModeState(SMC);
#endif // FSL_FEATURE_MCG_HAS_PLL
#endif // FSL_FEATURE_SOC_MCG_COUNT
/* Check if any of the UART's is transmitting data */
if (serial_check_tx_ongoing()) {
return;
}
SMC_SetPowerModeProtection(SMC, kSMC_AllowPowerModeAll);
SMC_PreEnterStopModes();
SMC_SetPowerModeVlps(SMC);
SMC_PostExitStopModes();
#if (defined(FSL_FEATURE_SOC_MCG_COUNT) && FSL_FEATURE_SOC_MCG_COUNT)
#if (defined(FSL_FEATURE_MCG_HAS_PLL) && FSL_FEATURE_MCG_HAS_PLL)
/*
* If enter stop modes when MCG in PEE mode, then after wakeup, the MCG is in PBE mode,
* need to enter PEE mode manually.
*/
if (original_power_state == kSMC_PowerStateRun) {
/* Wait for PLL lock. */
while (!(kMCG_Pll0LockFlag & CLOCK_GetStatusFlags()))
{
}
CLOCK_SetPeeMode();
}
#endif // FSL_FEATURE_MCG_HAS_PLL
#endif // FSL_FEATURE_SOC_MCG_COUNT
}
|
/**
* FreeRDP: A Remote Desktop Protocol Client
* Clipboard Virtual Channel Types
*
* Copyright 2011 Vic Lee
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __CLIPRDR_PLUGIN
#define __CLIPRDR_PLUGIN
/**
* Event Types
*/
#define RDP_EVENT_TYPE_CB_MONITOR_READY 1
#define RDP_EVENT_TYPE_CB_FORMAT_LIST 2
#define RDP_EVENT_TYPE_CB_DATA_REQUEST 3
#define RDP_EVENT_TYPE_CB_DATA_RESPONSE 4
/**
* Clipboard Formats
*/
#define CB_FORMAT_RAW 0x0000
#define CB_FORMAT_TEXT 0x0001
#define CB_FORMAT_DIB 0x0008
#define CB_FORMAT_UNICODETEXT 0x000D
#define CB_FORMAT_HTML 0xD010
#define CB_FORMAT_PNG 0xD011
#define CB_FORMAT_JPEG 0xD012
#define CB_FORMAT_GIF 0xD013
/**
* Clipboard Events
*/
typedef RDP_EVENT RDP_CB_MONITOR_READY_EVENT;
struct _RDP_CB_FORMAT_LIST_EVENT
{
RDP_EVENT event;
uint32* formats;
uint16 num_formats;
uint8* raw_format_data;
uint32 raw_format_data_size;
};
typedef struct _RDP_CB_FORMAT_LIST_EVENT RDP_CB_FORMAT_LIST_EVENT;
struct _RDP_CB_DATA_REQUEST_EVENT
{
RDP_EVENT event;
uint32 format;
};
typedef struct _RDP_CB_DATA_REQUEST_EVENT RDP_CB_DATA_REQUEST_EVENT;
struct _RDP_CB_DATA_RESPONSE_EVENT
{
RDP_EVENT event;
uint8* data;
uint32 size;
};
typedef struct _RDP_CB_DATA_RESPONSE_EVENT RDP_CB_DATA_RESPONSE_EVENT;
#endif /* __CLIPRDR_PLUGIN */
|
// $Id: ThreadPool.h 3045 2010-04-05 13:07:29Z hieuhoang1972 $
/***********************************************************************
Moses - factored phrase-based language decoder
Copyright (C) 2009 University of Edinburgh
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
***********************************************************************/
#ifndef moses_ThreadPool_h
#define moses_ThreadPool_h
#include <iostream>
#include <queue>
#include <vector>
#include <boost/shared_ptr.hpp>
#ifdef WITH_THREADS
#include <boost/bind.hpp>
#include <boost/thread.hpp>
#endif
#ifdef BOOST_HAS_PTHREADS
#include <pthread.h>
#endif
//#include "Util.h"
/**
* Classes to implement a ThreadPool.
**/
namespace Moses
{
/** A task to be executed by the ThreadPool
*/
class Task
{
public:
virtual void Run() = 0;
virtual ~Task() {}
};
#ifdef WITH_THREADS
class ThreadPool
{
public:
/**
* Construct a thread pool of a fixed size.
**/
explicit ThreadPool(size_t numThreads);
~ThreadPool() {
Stop();
}
/**
* Add a job to the threadpool.
**/
void Submit(boost::shared_ptr<Task> task);
/**
* Wait until all queued jobs have completed, and shut down
* the ThreadPool.
**/
void Stop(bool processRemainingJobs = false);
/**
* Set maximum number of queued threads (otherwise Submit blocks)
**/
void SetQueueLimit( size_t limit ) {
m_queueLimit = limit;
}
private:
/**
* The main loop executed by each thread.
**/
void Execute();
std::queue<boost::shared_ptr<Task> > m_tasks;
boost::thread_group m_threads;
boost::mutex m_mutex;
boost::condition_variable m_threadNeeded;
boost::condition_variable m_threadAvailable;
bool m_stopped;
bool m_stopping;
size_t m_queueLimit;
};
class TestTask : public Task
{
public:
TestTask(int id) : m_id(id) {}
virtual void Run() {
#ifdef BOOST_HAS_PTHREADS
pthread_t tid = pthread_self();
#else
typedef void * pthread_t;
pthread_t tid = 0;
#endif
std::cerr << "Executing " << m_id << " in thread id " << tid << std::endl;
}
virtual ~TestTask() {}
private:
int m_id;
};
#endif //WITH_THREADS
} // namespace Moses
#endif // moses_ThreadPool_h
|
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_WEBUI_FIRMWARE_UPDATE_UI_URL_CONSTANTS_H_
#define ASH_WEBUI_FIRMWARE_UPDATE_UI_URL_CONSTANTS_H_
namespace ash {
extern const char kChromeUIFirmwareUpdateAppHost[];
extern const char kChromeUIFirmwareUpdateAppURL[];
} // namespace ash
#endif // ASH_WEBUI_FIRMWARE_UPDATE_UI_URL_CONSTANTS_H_
|
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_SAFE_BROWSING_SETTINGS_RESET_PROMPT_DEFAULT_SETTINGS_FETCHER_H_
#define CHROME_BROWSER_SAFE_BROWSING_SETTINGS_RESET_PROMPT_DEFAULT_SETTINGS_FETCHER_H_
#include <memory>
#include "base/callback.h"
class BrandcodedDefaultSettings;
class BrandcodeConfigFetcher;
namespace safe_browsing {
// Class that fetches default settings to be used for the settings reset
// prompt. The static |FetchDefaultSettings()| function will create and manage
// the lifetime of |DefaultSettingsFetcher| instances.
class DefaultSettingsFetcher {
public:
using SettingsCallback =
base::OnceCallback<void(std::unique_ptr<BrandcodedDefaultSettings>)>;
// Fetches default settings and passes the corresponding
// |BrandcodedDefaultSettings| object to |callback| on the UI thread. This
// function must be called on the UI thread as well.
//
// If fetching of default settings on the network fails, a default-constructed
// BrandcodedDefaultSettings object will be passed to |callback|.
static void FetchDefaultSettings(SettingsCallback callback);
// Allows tests to specify the default settings that were fetched in
// |fetched_settings|. Passing nullptr as |fetched_settings| corresponds to
// the case when fetching default settings over the network fails.
static void FetchDefaultSettingsForTesting(
SettingsCallback callback,
std::unique_ptr<BrandcodedDefaultSettings> fetched_settings);
private:
// Instances of |DefaultSettingsFetcher| own themselves and will delete
// themselves once default settings have been fetched and |callback| has been
// posted on the UI thread.
//
// The main reason for this design is that |BrandcodeConfigFetcher| takes a
// callback and initiates the fetching process in its constructor, and we need
// to hold on to the instance of the fetcher until settings have been
// fetched. This design saves us from having to explicitly manage global
// |BrandcodeConfigFetcher| instances.
explicit DefaultSettingsFetcher(SettingsCallback callback);
~DefaultSettingsFetcher();
// Starts the process of fetching default settings and will ensure that
// |PostCallbackAndDeleteSelf| is called once settings have been fetched.
void Start();
void OnSettingsFetched();
// Posts a call to |callback_| on the UI thread, passing to it
// |default_settings|, and deletes |this|.
void PostCallbackAndDeleteSelf(
std::unique_ptr<BrandcodedDefaultSettings> default_settings);
std::unique_ptr<BrandcodeConfigFetcher> config_fetcher_;
SettingsCallback callback_;
};
} // namespace safe_browsing
#endif // CHROME_BROWSER_SAFE_BROWSING_SETTINGS_RESET_PROMPT_DEFAULT_SETTINGS_FETCHER_H_
|
/*
* Copyright (C) 2013 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 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 GOOGLE 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 GOOGLE 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 THIRD_PARTY_BLINK_RENDERER_MODULES_PEERCONNECTION_RTC_DTMF_SENDER_H_
#define THIRD_PARTY_BLINK_RENDERER_MODULES_PEERCONNECTION_RTC_DTMF_SENDER_H_
#include <memory>
#include "third_party/blink/renderer/core/execution_context/execution_context_lifecycle_observer.h"
#include "third_party/blink/renderer/modules/event_target_modules.h"
#include "third_party/blink/renderer/platform/heap/prefinalizer.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_dtmf_sender_handler.h"
#include "third_party/blink/renderer/platform/timer.h"
namespace blink {
class ExceptionState;
class RtcDtmfSenderHandler;
class RTCDTMFSender final : public EventTargetWithInlineData,
public RtcDtmfSenderHandler::Client,
public ExecutionContextLifecycleObserver {
DEFINE_WRAPPERTYPEINFO();
USING_PRE_FINALIZER(RTCDTMFSender, Dispose);
public:
static RTCDTMFSender* Create(ExecutionContext*,
std::unique_ptr<RtcDtmfSenderHandler>);
RTCDTMFSender(ExecutionContext*, std::unique_ptr<RtcDtmfSenderHandler>);
~RTCDTMFSender() override;
bool canInsertDTMF() const;
String toneBuffer() const;
void insertDTMF(const String& tones, ExceptionState&);
void insertDTMF(const String& tones, int duration, ExceptionState&);
void insertDTMF(const String& tones,
int duration,
int inter_tone_gap,
ExceptionState&);
DEFINE_ATTRIBUTE_EVENT_LISTENER(tonechange, kTonechange)
// EventTarget
const AtomicString& InterfaceName() const override;
ExecutionContext* GetExecutionContext() const override;
// ExecutionContextLifecycleObserver
void ContextDestroyed() override;
void Trace(Visitor*) const override;
private:
void Dispose();
// RtcDtmfSenderHandler::Client
void PlayoutTask();
void DidPlayTone(const String&) override;
std::unique_ptr<RtcDtmfSenderHandler> handler_;
bool stopped_;
String tone_buffer_;
int duration_;
int inter_tone_gap_;
bool playout_task_is_scheduled_ = false;
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_PEERCONNECTION_RTC_DTMF_SENDER_H_
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MEDIA_FORMATS_MPEG_ADTS_STREAM_PARSER_H_
#define MEDIA_FORMATS_MPEG_ADTS_STREAM_PARSER_H_
#include <stdint.h>
#include "media/base/media_export.h"
#include "media/formats/mpeg/mpeg_audio_stream_parser_base.h"
namespace media {
class MEDIA_EXPORT ADTSStreamParser : public MPEGAudioStreamParserBase {
public:
ADTSStreamParser();
ADTSStreamParser(const ADTSStreamParser&) = delete;
ADTSStreamParser& operator=(const ADTSStreamParser&) = delete;
~ADTSStreamParser() override;
// MPEGAudioStreamParserBase overrides.
int ParseFrameHeader(const uint8_t* data,
int size,
int* frame_size,
int* sample_rate,
ChannelLayout* channel_layout,
int* sample_count,
bool* metadata_frame,
std::vector<uint8_t>* extra_data) override;
private:
size_t adts_parse_error_limit_ = 0;
};
} // namespace media
#endif // MEDIA_FORMATS_MPEG_ADTS_STREAM_PARSER_H_
|
// 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 CHROMECAST_UI_MEDIA_OVERLAY_H_
#define CHROMECAST_UI_MEDIA_OVERLAY_H_
#include <string>
namespace chromecast {
// MediaOverlay is responsible for displaying information to the user about
// media playback, such as the volume level, and notifications about volume
// control limitations.
class MediaOverlay {
public:
class Controller {
public:
// Notifies the controller that the media is rendering in surround-sound.
virtual void SetSurroundSoundInUse(bool in_use) = 0;
};
virtual ~MediaOverlay() = default;
virtual void SetController(Controller* controller) = 0;
// Displays a brief toast to the user.
virtual void ShowMessage(const std::u16string& message) = 0;
// Shows the volume bar for a given |volume|.
virtual void ShowVolumeBar(float volume) = 0;
};
} // namespace chromecast
#endif // CHROMECAST_UI_MEDIA_OVERLAY_H_
|
// Copyright 2020 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_AUTOFILL_PAYMENTS_SAVE_PAYMENT_ICON_CONTROLLER_H_
#define CHROME_BROWSER_UI_AUTOFILL_PAYMENTS_SAVE_PAYMENT_ICON_CONTROLLER_H_
#include <string>
#include "content/public/browser/web_contents.h"
namespace autofill {
class AutofillBubbleBase;
// The controller for SavePaymentIconView.
class SavePaymentIconController {
public:
virtual ~SavePaymentIconController() = default;
// Returns a reference to the SavePaymentIconController associated with the
// given |web_contents|. If controller does not exist, this will create the
// controller from the |web_contents| then return the reference.
static SavePaymentIconController* GetOrCreate(
content::WebContents* web_contents);
// Returns a reference to the SavePaymentIconController associated with the
// given |web_contents|. If controller does not exist, this will return
// nullptr.
static SavePaymentIconController* Get(content::WebContents* web_contents);
// Once the animation ends, it shows a new bubble if needed.
virtual void OnAnimationEnded() = 0;
// Returns true iff upload save failed and the failure badge on the icon
// should be shown.
virtual bool ShouldShowSaveFailureBadge() const = 0;
// Returns true iff the payment saved animation should be shown.
virtual bool ShouldShowCardSavedLabelAnimation() const = 0;
// Returns true iff upload save is in progress and the saving animation should
// be shown.
virtual bool ShouldShowSavingCardAnimation() const = 0;
// Returns true iff the payment icon is visible.
virtual bool IsIconVisible() const = 0;
// Returns the currently active save card bubble view. Can be nullptr if no
// bubble is visible.
virtual AutofillBubbleBase* GetSaveBubbleView() const = 0;
// Returns the tooltip message for the save payment icon.
virtual std::u16string GetSavePaymentIconTooltipText() const = 0;
};
} // namespace autofill
#endif // CHROME_BROWSER_UI_AUTOFILL_PAYMENTS_SAVE_PAYMENT_ICON_CONTROLLER_H_
|
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2012 Torus Knot Software Ltd
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 __OGRE_POSE_H
#define __OGRE_POSE_H
#include "OgrePrerequisites.h"
#include "OgreString.h"
#include "OgreHardwareVertexBuffer.h"
#include "OgreVector3.h"
#include "OgreIteratorWrappers.h"
namespace Ogre {
/** \addtogroup Core
* @{
*/
/** \addtogroup Animation
* @{
*/
/** A pose is a linked set of vertex offsets applying to one set of vertex
data.
@remarks
The target index referred to by the pose has a meaning set by the user
of this class; but for example when used by Mesh it refers to either the
Mesh shared geometry (0) or a SubMesh dedicated geometry (1+).
Pose instances can be referred to by keyframes in VertexAnimationTrack in
order to animate based on blending poses together.
*/
class _OgreExport Pose : public AnimationAlloc
{
public:
/** Constructor
@param target The target vertexdata index (0 for shared, 1+ for
dedicated at the submesh index + 1)
@param name Optional name
*/
Pose(ushort target, const String& name = StringUtil::BLANK);
virtual ~Pose();
/// Return the name of the pose (may be blank)
const String& getName(void) const { return mName; }
/// Return the target geometry index of the pose
ushort getTarget(void) const { return mTarget; }
/// A collection of vertex offsets based on the vertex index
typedef map<size_t, Vector3>::type VertexOffsetMap;
/// An iterator over the vertex offsets
typedef MapIterator<VertexOffsetMap> VertexOffsetIterator;
/// An iterator over the vertex offsets
typedef ConstMapIterator<VertexOffsetMap> ConstVertexOffsetIterator;
/// A collection of normals based on the vertex index
typedef map<size_t, Vector3>::type NormalsMap;
/// An iterator over the vertex offsets
typedef MapIterator<NormalsMap> NormalsIterator;
/// An iterator over the vertex offsets
typedef ConstMapIterator<NormalsMap> ConstNormalsIterator;
/// Return whether the pose vertices include normals
bool getIncludesNormals() const { return !mNormalsMap.empty(); }
/** Adds an offset to a vertex for this pose.
@param index The vertex index
@param offset The position offset for this pose
*/
void addVertex(size_t index, const Vector3& offset);
/** Adds an offset to a vertex and a new normal for this pose.
@param index The vertex index
@param offset The position offset for this pose
*/
void addVertex(size_t index, const Vector3& offset, const Vector3& normal);
/** Remove a vertex offset. */
void removeVertex(size_t index);
/** Clear all vertices. */
void clearVertices(void);
/** Gets an iterator over all the vertex offsets. */
ConstVertexOffsetIterator getVertexOffsetIterator(void) const;
/** Gets an iterator over all the vertex offsets. */
VertexOffsetIterator getVertexOffsetIterator(void);
/** Gets a const reference to the vertex offsets. */
const VertexOffsetMap& getVertexOffsets(void) const { return mVertexOffsetMap; }
/** Gets an iterator over all the vertex offsets. */
ConstNormalsIterator getNormalsIterator(void) const;
/** Gets an iterator over all the vertex offsets. */
NormalsIterator getNormalsIterator(void);
/** Gets a const reference to the vertex offsets. */
const NormalsMap& getNormals(void) const { return mNormalsMap; }
/** Get a hardware vertex buffer version of the vertex offsets. */
const HardwareVertexBufferSharedPtr& _getHardwareVertexBuffer(const VertexData* origData) const;
/** Clone this pose and create another one configured exactly the same
way (only really useful for cloning holders of this class).
*/
Pose* clone(void) const;
protected:
/// Target geometry index
ushort mTarget;
/// Optional name
String mName;
/// Primary storage, sparse vertex use
VertexOffsetMap mVertexOffsetMap;
/// Primary storage, sparse vertex use
NormalsMap mNormalsMap;
/// Derived hardware buffer, covers all vertices
mutable HardwareVertexBufferSharedPtr mBuffer;
};
typedef vector<Pose*>::type PoseList;
/** @} */
/** @} */
}
#endif
|
/*
+------------------------------------------------------------------------+
| Zephir Language |
+------------------------------------------------------------------------+
| Copyright (c) 2011-2015 Zephir Team (http://www.zephir-lang.com) |
+------------------------------------------------------------------------+
| This source file is subject to the New BSD License that is bundled |
| with this package in the file docs/LICENSE.txt. |
| |
| If you did not receive a copy of the license and are unable to |
| obtain it through the world-wide-web, please send an email |
| to license@zephir-lang.com so we can send you a copy immediately. |
+------------------------------------------------------------------------+
| Authors: Andres Gutierrez <andres@zephir-lang.com> |
| Eduar Carvajal <eduar@zephir-lang.com> |
| Vladimir Kolesnikov <vladimir@extrememember.com> |
+------------------------------------------------------------------------+
*/
#ifndef ZEPHIR_RELEASE
#if defined(linux) || defined(DARWIN) || defined(__APPLE__)
#include <execinfo.h>
#include <Zend/zend.h>
#include <ext/standard/php_smart_string.h>
#else
#endif
#endif /* ZEPHIR_RELEASE */
|
/*
* Copyright (C) 2008-2018 TrinityCore <https://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef Scenario_h__
#define Scenario_h__
#include "CriteriaHandler.h"
#include <unordered_set>
struct ScenarioData;
struct ScenarioStepEntry;
namespace WorldPackets
{
namespace Achievement
{
struct CriteriaProgress;
}
namespace Scenario
{
struct BonusObjectiveData;
class ScenarioState;
}
}
enum ScenarioStepState
{
SCENARIO_STEP_INVALID = 0,
SCENARIO_STEP_NOT_STARTED = 1,
SCENARIO_STEP_IN_PROGRESS = 2,
SCENARIO_STEP_DONE = 3
};
class TC_GAME_API Scenario : public CriteriaHandler
{
public:
Scenario(ScenarioData const* scenarioData);
~Scenario();
void Reset() override;
void SetStep(ScenarioStepEntry const* step);
virtual void CompleteStep(ScenarioStepEntry const* step);
virtual void CompleteScenario();
virtual void OnPlayerEnter(Player* player);
virtual void OnPlayerExit(Player* player);
virtual void Update(uint32 /*diff*/) { }
bool IsComplete();
void SetStepState(ScenarioStepEntry const* step, ScenarioStepState state) { _stepStates[step] = state; }
ScenarioStepState GetStepState(ScenarioStepEntry const* step);
ScenarioStepEntry const* GetStep() const { return _currentstep; }
ScenarioStepEntry const* GetFirstStep() const;
void SendScenarioState(Player* player);
void SendBootPlayer(Player* player);
protected:
GuidUnorderedSet _players;
void SendCriteriaUpdate(Criteria const* criteria, CriteriaProgress const* progress, uint32 timeElapsed, bool timedCompleted) const override;
void SendCriteriaProgressRemoved(uint32 /*criteriaId*/) override { }
bool CanUpdateCriteriaTree(Criteria const* criteria, CriteriaTree const* tree, Player* referencePlayer) const override;
bool CanCompleteCriteriaTree(CriteriaTree const* tree) override;
void CompletedCriteriaTree(CriteriaTree const* tree, Player* referencePlayer) override;
void AfterCriteriaTreeUpdate(CriteriaTree const* /*tree*/, Player* /*referencePlayer*/) override { }
void SendPacket(WorldPacket const* data) const override;
void SendAllData(Player const* /*receiver*/) const override { }
void BuildScenarioState(WorldPackets::Scenario::ScenarioState* scenarioState);
std::vector<WorldPackets::Scenario::BonusObjectiveData> GetBonusObjectivesData();
std::vector<WorldPackets::Achievement::CriteriaProgress> GetCriteriasProgress();
CriteriaList const& GetCriteriaByType(CriteriaTypes type) const override;
ScenarioData const* _data;
private:
ScenarioStepEntry const* _currentstep;
std::map<ScenarioStepEntry const*, ScenarioStepState> _stepStates;
};
#endif // Scenario_h__
|
#pragma once
/*
* Copyright (C) 2005-2013 Team XBMC
* http://xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, 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 XBMC; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
#include "utils/StdString.h"
#include "storage/IStorageProvider.h"
class CDarwinStorageProvider : public IStorageProvider
{
public:
CDarwinStorageProvider();
virtual ~CDarwinStorageProvider() { }
virtual void Initialize() { }
virtual void Stop() { }
virtual void GetLocalDrives(VECSOURCES &localDrives);
virtual void GetRemovableDrives(VECSOURCES &removableDrives);
virtual std::vector<CStdString> GetDiskUsage(void);
virtual bool Eject(CStdString mountpath);
virtual bool PumpDriveChangeEvents(IStorageEventsCallback *callback);
static void SetEvent(void);
private:
static bool m_event;
};
|
#include <stdbool.h>
#define BUFFER_SIZE 8192
typedef struct StatsConnection{
char *ip;
char *port;
int sock;
} StatsConnection;
bool statsd_connect(void);
bool send_command(char *command);
bool statsd_set(char *key, char *value);
bool statsd_gauge(char *key, char *value);
bool statsd_count(char *key, char *value);
bool statsd_timing(char *key, int value);
bool statsd_init(char *ip, char *port);
bool statsd_destroy(void);
|
/******************************************************
Copyright (c) 2017 Percona LLC and/or its affiliates.
Zlib compatible CRC-32 implementation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*******************************************************/
#ifdef __cplusplus
extern "C" {
#endif
void crc_init();
unsigned long crc32_iso3309(unsigned long crc, const unsigned char *buf, unsigned int len);
#ifdef __cplusplus
}
#endif
|
#ifndef _SCHED_SYSCTL_H
#define _SCHED_SYSCTL_H
#ifdef CONFIG_DETECT_HUNG_TASK
extern int sysctl_hung_task_check_count;
extern unsigned int sysctl_hung_task_panic;
extern unsigned long sysctl_hung_task_timeout_secs;
extern int sysctl_hung_task_warnings;
extern int proc_dohung_task_timeout_secs(struct ctl_table *table, int write,
void __user *buffer,
size_t *lenp, loff_t *ppos);
#else
/* Avoid need for ifdefs elsewhere in the code */
enum { sysctl_hung_task_timeout_secs = 0 };
#endif
/*
* Default maximum number of active map areas, this limits the number of vmas
* per mm struct. Users can overwrite this number by sysctl but there is a
* problem.
*
* When a program's coredump is generated as ELF format, a section is created
* per a vma. In ELF, the number of sections is represented in unsigned short.
* This means the number of sections should be smaller than 65535 at coredump.
* Because the kernel adds some informative sections to a image of program at
* generating coredump, we need some margin. The number of extra sections is
* 1-3 now and depends on arch. We use "5" as safe margin, here.
*
* ELF extended numbering allows more than 65535 sections, so 16-bit bound is
* not a hard limit any more. Although some userspace tools can be surprised by
* that.
*/
#define MAPCOUNT_ELF_CORE_MARGIN (5)
#define DEFAULT_MAX_MAP_COUNT (USHRT_MAX - MAPCOUNT_ELF_CORE_MARGIN)
extern int sysctl_max_map_count;
extern unsigned int sysctl_sched_latency;
extern unsigned int sysctl_sched_min_granularity;
extern unsigned int sysctl_sched_wakeup_granularity;
extern unsigned int sysctl_sched_child_runs_first;
extern unsigned int sysctl_sched_wake_to_idle;
extern unsigned int sysctl_sched_wakeup_load_threshold;
extern unsigned int sysctl_sched_window_stats_policy;
extern unsigned int sysctl_sched_account_wait_time;
extern unsigned int sysctl_sched_ravg_hist_size;
extern unsigned int sysctl_sched_cpu_high_irqload;
extern unsigned int sysctl_sched_freq_account_wait_time;
extern unsigned int sysctl_sched_migration_fixup;
extern unsigned int sysctl_sched_heavy_task_pct;
extern unsigned int sysctl_sched_enable_power_aware;
#if defined(CONFIG_SCHED_FREQ_INPUT) || defined(CONFIG_SCHED_HMP)
extern unsigned int sysctl_sched_init_task_load_pct;
#endif
#ifdef CONFIG_SCHED_FREQ_INPUT
extern int sysctl_sched_freq_inc_notify;
extern int sysctl_sched_freq_dec_notify;
#endif
#ifdef CONFIG_SCHED_HMP
extern unsigned int sysctl_sched_spill_nr_run;
extern unsigned int sysctl_sched_spill_load_pct;
extern unsigned int sysctl_sched_upmigrate_pct;
extern unsigned int sysctl_sched_downmigrate_pct;
extern int sysctl_sched_upmigrate_min_nice;
extern unsigned int sysctl_sched_powerband_limit_pct;
extern unsigned int sysctl_sched_boost;
extern unsigned int sysctl_early_detection_duration;
#ifdef CONFIG_SCHED_QHMP
extern unsigned int sysctl_sched_min_runtime;
extern unsigned int sysctl_sched_small_task_pct;
#else
extern unsigned int sysctl_sched_lowspill_freq;
extern unsigned int sysctl_sched_pack_freq;
extern unsigned int sysctl_sched_select_prev_cpu_us;
#if defined(CONFIG_SCHED_FREQ_INPUT)
extern unsigned int sysctl_sched_new_task_windows;
#endif
#endif
#else /* CONFIG_SCHED_HMP */
#define sysctl_sched_enable_hmp_task_placement 0
#endif /* CONFIG_SCHED_HMP */
enum sched_tunable_scaling {
SCHED_TUNABLESCALING_NONE,
SCHED_TUNABLESCALING_LOG,
SCHED_TUNABLESCALING_LINEAR,
SCHED_TUNABLESCALING_END,
};
extern enum sched_tunable_scaling sysctl_sched_tunable_scaling;
extern unsigned int sysctl_numa_balancing_scan_delay;
extern unsigned int sysctl_numa_balancing_scan_period_min;
extern unsigned int sysctl_numa_balancing_scan_period_max;
extern unsigned int sysctl_numa_balancing_scan_size;
#ifdef CONFIG_SCHED_DEBUG
extern unsigned int sysctl_sched_migration_cost;
extern unsigned int sysctl_sched_nr_migrate;
extern unsigned int sysctl_sched_time_avg;
extern unsigned int sysctl_timer_migration;
extern unsigned int sysctl_sched_shares_window;
int sched_proc_update_handler(struct ctl_table *table, int write,
void __user *buffer, size_t *length,
loff_t *ppos);
#endif
extern int sched_migrate_notify_proc_handler(struct ctl_table *table,
int write, void __user *buffer, size_t *lenp, loff_t *ppos);
extern int sched_hmp_proc_update_handler(struct ctl_table *table,
int write, void __user *buffer, size_t *lenp, loff_t *ppos);
extern int sched_boost_handler(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp, loff_t *ppos);
extern int sched_window_update_handler(struct ctl_table *table,
int write, void __user *buffer, size_t *lenp, loff_t *ppos);
#ifdef CONFIG_SCHED_DEBUG
static inline unsigned int get_sysctl_timer_migration(void)
{
return sysctl_timer_migration;
}
#else
static inline unsigned int get_sysctl_timer_migration(void)
{
return 1;
}
#endif
/*
* control realtime throttling:
*
* /proc/sys/kernel/sched_rt_period_us
* /proc/sys/kernel/sched_rt_runtime_us
*/
extern unsigned int sysctl_sched_rt_period;
extern int sysctl_sched_rt_runtime;
#ifdef CONFIG_CFS_BANDWIDTH
extern unsigned int sysctl_sched_cfs_bandwidth_slice;
#endif
#ifdef CONFIG_SCHED_AUTOGROUP
extern unsigned int sysctl_sched_autogroup_enabled;
#endif
#ifdef CONFIG_SCHEDSTATS
extern unsigned int sysctl_sched_latency_panic_threshold;
extern unsigned int sysctl_sched_latency_warn_threshold;
extern int sched_max_latency_sysctl(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp,
loff_t *ppos);
#endif
extern int sched_rr_timeslice;
extern int sched_rr_handler(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp,
loff_t *ppos);
extern int sched_rt_handler(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp,
loff_t *ppos);
extern int sysctl_numa_balancing(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp,
loff_t *ppos);
#endif /* _SCHED_SYSCTL_H */
|
/**
* @file
*
* @brief IMFS Device Node Handlers
* @ingroup IMFS
*/
/*
* COPYRIGHT (c) 1989-2012.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.org/license/LICENSE.
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif
#include "imfs.h"
#include <rtems/deviceio.h>
int device_open(
rtems_libio_t *iop,
const char *pathname,
int oflag,
mode_t mode
)
{
const IMFS_device_t *device = IMFS_iop_to_device( iop );
return rtems_deviceio_open(
iop,
pathname,
oflag,
mode,
device->major,
device->minor
);
}
int device_close(
rtems_libio_t *iop
)
{
const IMFS_device_t *device = IMFS_iop_to_device( iop );
return rtems_deviceio_close(
iop,
device->major,
device->minor
);
}
ssize_t device_read(
rtems_libio_t *iop,
void *buffer,
size_t count
)
{
const IMFS_device_t *device = IMFS_iop_to_device( iop );
return rtems_deviceio_read(
iop,
buffer,
count,
device->major,
device->minor
);
}
ssize_t device_write(
rtems_libio_t *iop,
const void *buffer,
size_t count
)
{
const IMFS_device_t *device = IMFS_iop_to_device( iop );
return rtems_deviceio_write(
iop,
buffer,
count,
device->major,
device->minor
);
}
int device_ioctl(
rtems_libio_t *iop,
ioctl_command_t command,
void *buffer
)
{
const IMFS_device_t *device = IMFS_iop_to_device( iop );
return rtems_deviceio_control(
iop,
command,
buffer,
device->major,
device->minor
);
}
int device_ftruncate(
rtems_libio_t *iop,
off_t length
)
{
return 0;
}
|
#include "hex.ih"
int hex_smear(su3_tuple *m_field_out, hex_parameters const *params, su3_tuple *m_field_in)
{
static int initialized = 0;
static su3_tuple *gamma_buffer[3];
static su3_tuple *v_buffer[3];
if (!initialized)
{
/* Allocate consecutive memory for both of the buffers upon first instantiation */
/* Three times 4 buffers needed for compatibility purposes (similar signature to gauge_field...) */
for (int idx = 0; idx < 3; ++idx)
{
gamma_buffer[idx] = (su3_tuple*)malloc(sizeof(su3_tuple) * VOLUMEPLUSRAND + 1);
v_buffer[idx] = (su3_tuple*)malloc(sizeof(su3_tuple) * VOLUMEPLUSRAND + 1);
if ((gamma_buffer[idx] == (su3_tuple*)NULL) || (v_buffer[idx] == (su3_tuple*)NULL))
return -1;
#if (defined SSE || defined SSE2 || defined SSE3)
gamma_buffer[idx] = (su3_tuple*)(((unsigned long int)(gamma_buffer[idx]) + ALIGN_BASE) & ~ALIGN_BASE);
v_buffer[idx] = (su3_tuple*)(((unsigned long int)(v_buffer[idx]) + ALIGN_BASE) & ~ALIGN_BASE);
#endif
}
initialized = 1;
}
for (int iter = 0; iter < params->iterations; ++iter)
{
/* First level of contractions */
hyp_staples_exclude_two(gamma_buffer, m_field_in);
stout_exclude_two(v_buffer, params->alpha[2], gamma_buffer, m_field_in);
for (int idx = 0; idx < 3; ++idx)
generic_exchange(v_buffer[idx], sizeof(su3_tuple));
/* Second level of contractions */
hyp_staples_exclude_one(gamma_buffer, v_buffer);
stout_exclude_one(v_buffer, params->alpha[1], gamma_buffer, m_field_in);
for (int idx = 0; idx < 3; ++idx)
generic_exchange(v_buffer[idx], sizeof(su3_tuple));
/* Final level of contractions */
hyp_staples_exclude_none(gamma_buffer, v_buffer);
stout_exclude_none(m_field_out, params->alpha[0], gamma_buffer, m_field_in);
generic_exchange(m_field_out, sizeof(su3_tuple));
m_field_in = m_field_out; /* Prepare for next iteration */
}
return 0;
}
|
#pragma once
#include "DomoticzHardware.h"
#include <iostream>
#include "hardwaretypes.h"
class CEcoDevices : public CDomoticzHardwareBase
{
public:
CEcoDevices(const int ID, const std::string IPAddress, const unsigned short usIPPort);
~CEcoDevices(void);
bool WriteToHardware(const char *pdata, const unsigned char length);
private:
bool Login();
void Logout();
std::string m_szIPAddress;
unsigned short m_usIPPort;
bool m_stoprequested;
boost::shared_ptr<boost::thread> m_thread;
P1Power m_p1power;
time_t m_lastSharedSendElectra;
unsigned long m_lastelectrausage;
void Init();
bool StartHardware();
bool StopHardware();
void Do_Work();
void GetMeterDetails();
};
|
/*
* Copyright 2017 Google
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#import <Foundation/Foundation.h>
#import "GoogleUtilities/Network/Private/GULNetworkConstants.h"
#import "GoogleUtilities/Network/Private/GULNetworkLoggerProtocol.h"
#import "GoogleUtilities/Network/Private/GULNetworkURLSession.h"
/// Delegate protocol for GULNetwork events.
@protocol GULNetworkReachabilityDelegate
/// Tells the delegate to handle events when the network reachability changes to connected or not
/// connected.
- (void)reachabilityDidChange;
@end
/// The Network component that provides network status and handles network requests and responses.
/// This is not thread safe.
///
/// NOTE:
/// User must add FIRAnalytics handleEventsForBackgroundURLSessionID:completionHandler to the
/// AppDelegate application:handleEventsForBackgroundURLSession:completionHandler:
@interface GULNetwork : NSObject
/// Indicates if network connectivity is available.
@property(nonatomic, readonly, getter=isNetworkConnected) BOOL networkConnected;
/// Indicates if there are any uploads in progress.
@property(nonatomic, readonly, getter=hasUploadInProgress) BOOL uploadInProgress;
/// An optional delegate that can be used in the event when network reachability changes.
@property(nonatomic, weak) id<GULNetworkReachabilityDelegate> reachabilityDelegate;
/// An optional delegate that can be used to log messages, warnings or errors that occur in the
/// network operations.
@property(nonatomic, weak) id<GULNetworkLoggerDelegate> loggerDelegate;
/// Indicates whether the logger should display debug messages.
@property(nonatomic, assign) BOOL isDebugModeEnabled;
/// The time interval in seconds for the network request to timeout.
@property(nonatomic, assign) NSTimeInterval timeoutInterval;
/// Initializes with the default reachability host.
- (instancetype)init;
/// Initializes with a custom reachability host.
- (instancetype)initWithReachabilityHost:(NSString *)reachabilityHost;
/// Handles events when background session with the given ID has finished.
+ (void)handleEventsForBackgroundURLSessionID:(NSString *)sessionID
completionHandler:(GULNetworkSystemCompletionHandler)completionHandler;
/// Compresses and sends a POST request with the provided data to the URL. The session will be
/// background session if usingBackgroundSession is YES. Otherwise, the POST session is default
/// session. Returns a session ID or nil if an error occurs.
- (NSString *)postURL:(NSURL *)url
payload:(NSData *)payload
queue:(dispatch_queue_t)queue
usingBackgroundSession:(BOOL)usingBackgroundSession
completionHandler:(GULNetworkCompletionHandler)handler;
/// Sends a GET request with the provided data to the URL. The session will be background session
/// if usingBackgroundSession is YES. Otherwise, the GET session is default session. Returns a
/// session ID or nil if an error occurs.
- (NSString *)getURL:(NSURL *)url
headers:(NSDictionary *)headers
queue:(dispatch_queue_t)queue
usingBackgroundSession:(BOOL)usingBackgroundSession
completionHandler:(GULNetworkCompletionHandler)handler;
@end
|
/*
* TeBkRestController.h
*
* Created on: 11-Mar-2015
* Author: sumeetc
*/
#ifndef TEBKRESTCONTROLLER_H_
#define TEBKRESTCONTROLLER_H_
#include "TeBkWorld.h"
#include "vector"
#include "CastUtil.h"
#include "TeBkMessage.h"
#include "DataSourceManager.h"
#include <stdlib.h>
#pragma @RestController path="/"
class TeBkRestController {
public:
#pragma @GET path="/json" statusCode="200" ocontentType="application/json"
TeBkMessage json();
#pragma @GET path="/db" statusCode="200" ocontentType="application/json"
TeBkWorld db();
#pragma @GET path="/queries" statusCode="200" ocontentType="application/json"
std::vector<TeBkWorld> queries(
#pragma @QueryParam name="queries"
std::string queries);
#pragma @GET path="/updates" statusCode="200" ocontentType="application/json"
std::vector<TeBkWorld> updates(
#pragma @QueryParam name="queries"
std::string queries);
#pragma @GET path="/plaintext" statusCode="200" ocontentType="text/plain"
std::string plaintext();
virtual ~TeBkRestController();
};
#endif /* TEBKRESTCONTROLLER_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 IOS_CHROME_BROWSER_UI_SETTINGS_CLEAR_BROWSING_DATA_CLEAR_BROWSING_DATA_MANAGER_H_
#define IOS_CHROME_BROWSER_UI_SETTINGS_CLEAR_BROWSING_DATA_CLEAR_BROWSING_DATA_MANAGER_H_
#include "components/browsing_data/core/counters/browsing_data_counter.h"
#import "ios/chrome/browser/ui/list_model/list_model.h"
class Browser;
class BrowsingDataRemover;
enum class BrowsingDataRemoveMask;
class ChromeBrowserState;
@class ActionSheetCoordinator;
@class BrowsingDataCounterWrapperProducer;
@protocol ClearBrowsingDataConsumer;
@protocol CollectionViewFooterLinkDelegate;
// Clear Browswing Data Section Identifiers.
enum ClearBrowsingDataSectionIdentifier {
// Section holding types of data that can be cleared.
SectionIdentifierDataTypes = kSectionIdentifierEnumZero,
// Section for informational footnote about user's Google Account data.
SectionIdentifierGoogleAccount,
// Section for footnote about synced data being cleared & site settings
// remaining.
SectionIdentifierSavedSiteData,
// Section containing cell displaying time range to remove data.
SectionIdentifierTimeRange,
};
// Clear Browsing Data Item Types.
enum ClearBrowsingDataItemType {
// Item representing browsing history data.
ItemTypeDataTypeBrowsingHistory = kItemTypeEnumZero,
// Item representing cookies and site data.
ItemTypeDataTypeCookiesSiteData,
// Items representing cached data.
ItemTypeDataTypeCache,
// Items representing saved passwords.
ItemTypeDataTypeSavedPasswords,
// Items representing autofill data.
ItemTypeDataTypeAutofill,
// Footer noting account will not be signed out.
ItemTypeFooterGoogleAccount,
// Footer noting user will not be signed out of chrome and other forms of
// browsing history will still be available.
ItemTypeFooterGoogleAccountAndMyActivity,
// Footer noting site settings will remain.
ItemTypeFooterSavedSiteData,
// Footer noting data will be cleared on all devices except for saved
// settings.
ItemTypeFooterClearSyncAndSavedSiteData,
// Item showing time range to remove data and allowing user to edit time
// range.
ItemTypeTimeRange,
// Footer noting user will not be signed out of chrome and how to delete
// search history based on set default search engine (DSE).
ItemTypeFooterGoogleAccountDSEBased,
};
// Manager that serves as the bulk of the logic for
// ClearBrowsingDataConsumer.
@interface ClearBrowsingDataManager : NSObject
// The manager's consumer.
@property(nonatomic, weak) id<ClearBrowsingDataConsumer> consumer;
// Default init method. |browserState| can't be nil.
- (instancetype)initWithBrowserState:(ChromeBrowserState*)browserState;
// Designated initializer to allow dependency injection (in tests).
- (instancetype)initWithBrowserState:(ChromeBrowserState*)browserState
browsingDataRemover:(BrowsingDataRemover*)remover
browsingDataCounterWrapperProducer:
(BrowsingDataCounterWrapperProducer*)producer NS_DESIGNATED_INITIALIZER;
- (instancetype)init NS_UNAVAILABLE;
// Fills |model| with appropriate sections and items.
- (void)loadModel:(ListModel*)model;
// Restarts browsing data counters, which in turn updates UI, with those data
// types specified by |mask|.
- (void)restartCounters:(BrowsingDataRemoveMask)mask;
// Returns a ActionSheetCoordinator that has action block to clear data of type
// |dataTypeMaskToRemove|.
- (ActionSheetCoordinator*)
actionSheetCoordinatorWithDataTypesToRemove:
(BrowsingDataRemoveMask)dataTypeMaskToRemove
baseViewController:
(UIViewController*)baseViewController
browser:(Browser*)browser
sourceBarButtonItem:
(UIBarButtonItem*)sourceBarButtonItem;
// Get the text to be displayed by a counter from the given |result|
- (NSString*)counterTextFromResult:
(const browsing_data::BrowsingDataCounter::Result&)result;
@end
#endif // IOS_CHROME_BROWSER_UI_SETTINGS_CLEAR_BROWSING_DATA_CLEAR_BROWSING_DATA_MANAGER_H_
|
// 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 COMPONENTS_METRICS_STRUCTURED_RECORDER_H_
#define COMPONENTS_METRICS_STRUCTURED_RECORDER_H_
#include "base/callback_list.h"
#include "base/memory/scoped_refptr.h"
#include "base/no_destructor.h"
#include "base/observer_list.h"
#include "base/observer_list_types.h"
#include "base/task/sequenced_task_runner.h"
#include "components/metrics/structured/event.h"
#include "components/metrics/structured/event_base.h"
#include "components/metrics/structured/structured_metrics_client.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
namespace base {
class FilePath;
}
namespace metrics {
namespace structured {
// Recorder is a singleton to help communicate with the
// StructuredMetricsProvider. It serves three purposes:
// 1. Begin the initialization of the StructuredMetricsProvider (see class
// comment for more details).
// 2. Add an event for the StructuredMetricsProvider to record.
// 3. Retrieving information about project's key, specifically the day it was
// last rotated.
//
// The StructuredMetricsProvider is owned by the MetricsService, but it needs to
// be accessible to any part of the codebase, via an EventBase subclass, to
// record events. The StructuredMetricsProvider registers itself as an observer
// of this singleton when recording is enabled, and calls to Record (for
// recording) or ProfileAdded (for initialization) are then forwarded to it.
//
// Recorder is embedded within StructuredMetricsClient for Ash Chrome and should
// only be used in Ash Chrome.
class Recorder : public StructuredMetricsClient::RecordingDelegate {
public:
class RecorderImpl : public base::CheckedObserver {
public:
// Called on a call to Record.
virtual void OnRecord(const EventBase& event) = 0;
// Called on a call to ProfileAdded.
virtual void OnProfileAdded(const base::FilePath& profile_path) = 0;
// Called on a call to OnReportingStateChanged.
virtual void OnReportingStateChanged(bool enabled) = 0;
// Called on a call to LastKeyRotation.
virtual absl::optional<int> LastKeyRotation(uint64_t project_name_hash) = 0;
};
static Recorder* GetInstance();
// RecordingDelegate:
void RecordEvent(Event&& event) override;
void Record(EventBase&& event) override;
bool IsReadyToRecord() const override;
// Notifies the StructuredMetricsProvider that a profile has been added with
// path |profile_path|. The first call to ProfileAdded initializes the
// provider using the keys stored in |profile_path|, so care should be taken
// to ensure the first call provides a |profile_path| suitable for metrics
// collection.
// TODO(crbug.com/1016655): When structured metrics expands beyond Chrome OS,
// investigate whether initialization can be simplified for Chrome.
void ProfileAdded(const base::FilePath& profile_path);
// Returns when the key for |project_name_hash| was last rotated, in days
// since epoch. Returns nullopt if the information is not available.
absl::optional<int> LastKeyRotation(uint64_t project_name_hash);
// Notifies observers that metrics reporting has been enabled or disabled.
void OnReportingStateChanged(bool enabled);
void SetUiTaskRunner(
const scoped_refptr<base::SequencedTaskRunner> ui_task_runner);
void AddObserver(RecorderImpl* observer);
void RemoveObserver(RecorderImpl* observer);
private:
friend class base::NoDestructor<Recorder>;
Recorder();
~Recorder() override;
Recorder(const Recorder&) = delete;
Recorder& operator=(const Recorder&) = delete;
scoped_refptr<base::SequencedTaskRunner> ui_task_runner_;
base::ObserverList<RecorderImpl> observers_;
};
} // namespace structured
} // namespace metrics
#endif // COMPONENTS_METRICS_STRUCTURED_RECORDER_H_
|
/****************************************************************************
Copyright (c) 2010 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#import <Foundation/Foundation.h>
#import "CCAccelerometerDelegate.h"
#import <UIKit/UIKit.h>
@interface AccelerometerDispatcher : NSObject<UIAccelerometerDelegate>
{
cocos2d::CCAccelerometerDelegate *delegate_;
cocos2d::CCAcceleration *acceleration_;
}
@property(readwrite) cocos2d::CCAccelerometerDelegate *delegate_;
@property(readwrite) cocos2d::CCAcceleration *acceleration_;
+ (id) sharedAccelerometerDispather;
- (id) init;
- (void) addDelegate: (cocos2d::CCAccelerometerDelegate *) delegate;
@end
|
#include "system.h"
#include <stdio.h>
#include "popt.h"
static int _debug = 0;
static int _verbose = 1;
static const char * dictfn = "/usr/share/dict/words";
static poptBits dictbits = NULL;
static struct {
unsigned total;
unsigned hits;
unsigned misses;
} e;
static int loadDict(const char * fn, poptBits * ap)
{
char b[BUFSIZ];
size_t nb = sizeof(b);
FILE * fp = fopen(fn, "r");
char * t, *te;
int nlines = -1;
if (fp == NULL || ferror(fp)) goto exit;
nlines = 0;
while ((t = fgets(b, nb, fp)) != NULL) {
while (*t && isspace(*t)) t++;
if (*t == '#') continue;
te = t + strlen(t);
while (te-- > t && isspace(*te)) *te = '\0';
if (*t == '\0') continue;
if (ap) {
if (_debug)
fprintf(stderr, "==> poptSaveBits(%p, \"%s\")\n", *ap, t);
(void) poptSaveBits(ap, 0, t);
}
nlines++;
}
exit:
if (fp) (void) fclose(fp);
return nlines;
}
static struct poptOption options[] = {
{ "debug", 'd', POPT_BIT_SET|POPT_ARGFLAG_TOGGLE, &_debug, 1,
"Set debugging.", NULL },
{ "verbose", 'v', POPT_BIT_SET|POPT_ARGFLAG_TOGGLE, &_verbose, 1,
"Set verbosity.", NULL },
POPT_AUTOALIAS
POPT_AUTOHELP
POPT_TABLEEND
};
int main(int argc, const char ** argv)
{
poptContext optCon = NULL;
const char ** av = NULL;
poptBits avbits = NULL;
int ec = 2; /* assume failure */
int rc;
#if defined(HAVE_MCHECK_H) && defined(HAVE_MTRACE)
mtrace(); /* Trace malloc only if MALLOC_TRACE=mtrace-output-file. */
#endif
/* XXX Scale the Bloom filters in popt. */
if ((rc = loadDict(dictfn, NULL)) <= 0)
goto exit;
_poptBitsK = 2;
_poptBitsM = 0;
_poptBitsN = _poptBitsK * rc;
optCon = poptGetContext("tdict", argc, argv, options, 0);
/* Read all the options (if any). */
while ((rc = poptGetNextOpt(optCon)) > 0) {
char * optArg = poptGetOptArg(optCon);
if (optArg) free(optArg);
switch (rc) {
default: goto exit; break;
}
}
if (rc < -1) {
fprintf(stderr, "tdict: %s: %s\n",
poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
poptStrerror(rc));
goto exit;
}
if ((rc = loadDict(dictfn, &dictbits)) <= 0)
goto exit;
av = poptGetArgs(optCon);
if ((rc = poptBitsArgs(optCon, &avbits)) != 0)
goto exit;
if (avbits) {
poptBits Ibits = NULL;
(void) poptBitsUnion(&Ibits, dictbits);
rc = poptBitsIntersect(&Ibits, avbits);
fprintf(stdout, "===== %s words are in %s\n", (rc ? "Some" : "No"), dictfn);
if (Ibits) free(Ibits);
}
if (av && avbits)
while (*av) {
rc = poptBitsChk(dictbits, *av);
if (rc < 0) goto exit;
e.total++;
if (rc > 0) {
if (_verbose)
fprintf(stdout, "%s:\tYES\n", *av);
e.hits++;
} else {
if (_verbose)
fprintf(stdout, "%s:\tNO\n", *av);
e.misses++;
}
av++;
}
ec = 0;
exit:
fprintf(stdout, "===== poptBits N:%u M:%u K:%u (%uKb) total(%u) = hits(%u) + misses(%u)\n",
_poptBitsN, _poptBitsM, _poptBitsK, (((_poptBitsM/8)+1)+1023)/1024, e.total, e.hits, e.misses);
if (avbits) free(avbits);
optCon = poptFreeContext(optCon);
#if defined(HAVE_MCHECK_H) && defined(HAVE_MTRACE)
muntrace(); /* Trace malloc only if MALLOC_TRACE=mtrace-output-file. */
#endif
return ec;
}
|
/* { dg-require-effective-target arm_v8_1m_mve_ok } */
/* { dg-add-options arm_v8_1m_mve } */
/* { dg-additional-options "-O2" } */
#include "arm_mve.h"
uint8x16_t
foo (uint8x16_t a, uint8_t b)
{
return vhsubq_n_u8 (a, b);
}
/* { dg-final { scan-assembler "vhsub.u8" } } */
uint8x16_t
foo1 (uint8x16_t a, uint8_t b)
{
return vhsubq (a, b);
}
/* { dg-final { scan-assembler "vhsub.u8" } } */
|
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
#pragma once
/***
This file is part of systemd.
Copyright 2011 Lennart Poettering
systemd is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd 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 systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include "journald-server.h"
void server_process_native_message(Server *s, const void *buffer, size_t buffer_size, struct ucred *ucred, struct timeval *tv, const char *label, size_t label_len);
void server_process_native_file(Server *s, int fd, struct ucred *ucred, struct timeval *tv, const char *label, size_t label_len);
int server_open_native_socket(Server*s);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.