text stringlengths 4 6.14k |
|---|
#import "TTZBaseController.h"
@interface ABController : TTZBaseController
@property (weak, nonatomic) IBOutlet UILabel *tt;
@property (weak, nonatomic) IBOutlet UIImageView *icon;
@end
|
/*
* Copyright 2014-2015 Nippon Telegraph and Telephone Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <stdio.h>
#include <stdint.h>
#include <stdarg.h>
#include "confsys.h"
/* Write show command output to the socket. */
static void
show_write(struct event *event) {
struct clink *clink;
struct event_manager *em;
ssize_t nbytes;
/* Get arguments. */
clink = event_get_arg(event);
em = event_get_manager(event);
/* Clear write event since it is now executing ;-). */
clink->write_ev = NULL;
/* Write to the socket. */
nbytes = pbuf_list_write(clink->pbuf_list, clink->sock);
if (nbytes <= 0) {
clink_stop(clink);
return;
}
/* Decrement contents size. */
clink->pbuf_list->contents_size -= nbytes;
/* Buffer still remains. */
if (pbuf_list_first(clink->pbuf_list) != NULL) {
clink->write_ev = event_register_write(em, clink->sock, show_write, clink);
return;
}
/* All buffer is written, close clink now. */
if (clink->is_show) {
clink_stop(clink);
}
}
/* Print string to show connection. */
int
show(struct confsys *confsys, const char *format, ...) {
va_list args;
size_t available;
int to_be_written;
struct pbuf *pbuf;
struct clink *clink;
struct event_manager *em;
/* Get arguments. */
clink = confsys->clink;
/* clink check. */
if (clink->sock < 0) {
return 0;
}
/* Get event manager. */
em = clink->cserver->em;
/* Get last page to write. */
pbuf = pbuf_list_last(clink->pbuf_list);
if (pbuf == NULL) {
return -1;
}
/* Remaining writabe size. */
available = pbuf_writable_size(pbuf);
/* First attempt to write. */
va_start(args, format);
to_be_written = vsnprintf((char *)pbuf->putp, available, format, args);
va_end(args);
/* Couldn't write the string. */
if (to_be_written <= 0) {
return -1;
}
/* Write event on. */
if (clink->write_ev == NULL) {
clink->write_ev = event_register_write(em, clink->sock, show_write, clink);
}
/* All data is written, return here. */
if ((size_t)to_be_written < available) {
/* to be written does not include '\0'. So this is fine. */
pbuf->putp += to_be_written;
clink->pbuf_list->contents_size += to_be_written;
return to_be_written;
}
/* Current buffer is filled. Reduce avaiable size one for '\0' and
* add one to to_be_written. Here, availabe size is same as written
* size. */
available--;
to_be_written++;
/* Forward current buffer point. */
pbuf->putp += available;
/* Prepare additional buffer. */
pbuf = pbuf_alloc((size_t)to_be_written);
if (pbuf == NULL) {
return -1;
}
pbuf_list_add(clink->pbuf_list, pbuf);
/* Print all of data to the buffer. */
va_start(args, format);
vsnprintf((char *)pbuf->putp, (size_t)to_be_written, format, args);
va_end(args);
pbuf->getp += available;
/* Adjust to_be_written size for removing '\0'. */
to_be_written--;
pbuf->putp += to_be_written;
clink->pbuf_list->contents_size += to_be_written;
return to_be_written;
}
|
/*
* Copyright 2012 Samsung Electronics Co., Ltd
*
* Licensed under the Flora 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://floralicense.org/license/
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __MP_PLAYLIST_VIEW_H_
#define __MP_PLAYLIST_VIEW_H_
#include "music.h"
#include "mp-view-layout.h"
Evas_Object * mp_playlist_view_create(struct appdata *ad, mp_view_type_t type);
void mp_playlist_view_destroy(Evas_Object * playlist);
void mp_playlist_view_refresh(Evas_Object * playlist);
void mp_playlist_view_create_auto_playlist(struct appdata *ad, char *type);
bool mp_playlist_view_create_by_id(Evas_Object * obj, int p_id);
void mp_playlist_view_update_navibutton(mp_layout_data_t * layout_data);
bool mp_playlist_view_reset_rename_mode(struct appdata *ad);
void mp_playlist_view_create_playlist_button_cb(void *data, Evas_Object * obj, void *event_info);
void mp_playlist_view_create_new_cancel_cb(void *data, Evas_Object * obj, void *event_info);
void mp_playlist_view_create_new_done_cb(void *data, Evas_Object * obj, void *event_info);
void mp_playlist_view_rename_done_cb(void *data, Evas_Object * obj, void *event_info);
void mp_playlist_view_rename_cancel_cb(void *data, Evas_Object * obj, void *event_info);
void mp_playlist_view_add_button_cb(void *data, Evas_Object * obj, void *event_info);
#endif //__MP_PLAYLIST_VIEW_H_
|
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
#ifndef IMPALA_UTIL_PROC_UTIL_H
#define IMPALA_UTIL_PROC_UTIL_H
#include "common/logging.h"
#include "common/status.h"
namespace impala {
/// Utility methods to read interesting values from /proc.
/// TODO: Get stats for parent process.
/// Container struct for statistics read from the /proc filesystem for a thread.
struct ThreadStats {
int64_t user_ns;
int64_t kernel_ns;
int64_t iowait_ns;
/// Default constructor zeroes all members in case structure can't be filled by
/// GetThreadStats.
ThreadStats() : user_ns(0), kernel_ns(0), iowait_ns(0) { }
};
/// Populates ThreadStats object for a given thread by reading from
/// /proc/<pid>/task/<tid>/stats. Returns OK unless the file cannot be read or is in an
/// unrecognised format, or if the kernel version is not modern enough.
Status GetThreadStats(int64_t tid, ThreadStats* stats);
/// Runs a shell command. Returns false if there was any error (either failure to launch
/// or non-0 exit code), and true otherwise. *msg is set to an error message including the
/// OS error string, if any, and the first 1k of output if there was any error, or just
/// the first 1k of output otherwise.
/// If do_trim is 'true', all trailing whitespace is removed from the output.
bool RunShellProcess(const std::string& cmd, std::string* msg, bool do_trim=false);
}
#endif
|
//
// LGDiscoverHeaderView.h
// ifaxian
//
// Created by ming on 16/11/29.
// Copyright © 2016年 ming. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface LGDiscoverHeaderView : UIView
@end
|
//
// ACCyclingArgumentsViewController.h
// A-cyclist
//
// Created by tunny on 15/7/25.
// Copyright (c) 2015年 tunny. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "ACBaseViewController.h"
@class ACRouteModel;
@interface ACCyclingArgumentsViewController : ACBaseViewController
/** 路线对象 */
@property (nonatomic, strong) ACRouteModel *route;
@end
|
//
// AdouptAnimal.h
// Spread
//
// Created by 邱学伟 on 16/8/2.
// Copyright © 2016年 邱学伟. All rights reserved.
//
#import <Foundation/Foundation.h>
@class ContactInfo;
@interface AdouptAnimal : NSObject
/** 动物ID */
@property (nonatomic, strong) NSString *BID;
/** 照片数组 */
@property (nonatomic, strong) NSArray *imageArr;
/** 宠物昵称 */
@property (nonatomic, copy) NSString *animalName;
/** 宠物性别 */
@property (nonatomic, copy) NSString *animalSex;
/** 宠物种类(大类) */
@property (nonatomic, copy) NSString *animalType;
/** 宠物种类(小类) */
@property (nonatomic, copy) NSString *animalVariety;
/** 宠物年龄 */
@property (nonatomic, copy) NSString *animalAge;
/** 宠物介绍 */
@property (nonatomic, copy) NSString *animalIntroduction;
/** 宠物主人 */
@property (nonatomic, copy) NSString *animalHost;
/** 宠物主人头像 */
@property (nonatomic, copy) NSString *animalHostIocnURL;
/** 宠物发布时间 */
@property (nonatomic, copy) NSString *animalPublishDate;
/** 主人联系方式 */
@property (nonatomic, strong) ContactInfo *animalContactInfo;
/** 发布位置 */
@property (nonatomic, copy) NSString *animalAdress;
/** 发布位置经纬度(经度) */
@property (nonatomic, copy) NSString *animalAdressLongitude;
/** 发布位置经纬度(纬度) */
@property (nonatomic, copy) NSString *animalAdressLatitude;
/** 创建时间 */
@property (nonatomic, copy) NSString *animalCreatTime;
/** 标题 */
@property (nonatomic, copy) NSString *animalTitle;
@end
|
/*
Erbele - Based on Fraise 3.7.3 based on Smultron by Peter Borg
Current Maintainer (since 2016):
Andreas Bentele: abentele.github@icloud.com (https://github.com/abentele/Erbele)
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 <Cocoa/Cocoa.h>
#import "FRAProject.h"
@class FRAProject;
@interface FRAProject (ToolbarController)
- (IBAction)liveFindToolbarItemAction:(id)sender;
- (IBAction)functionToolbarItemAction:(id)sender;
- (void)prepareForLiveFind;
- (void)removeLiveFindSession;
- (NSSearchField *)liveFindSearchField;
- (NSToolbarItem *)liveFindToolbarItem;
- (NSToolbarItem *)functionToolbarItem;
- (void)updateLabelsInToolbar;
- (void)removeFunctionMenuFormRepresentation;
- (void)reinsertFunctionMenuFormRepresentation;
- (NSButton *)functionButton;
- (void)extraToolbarValidation;
@end
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#include "argv.h"
#include "clipboard.h"
#include "common/cursor.h"
#include "input.h"
#include "kubernetes.h"
#include "pipe.h"
#include "settings.h"
#include "terminal/terminal.h"
#include "user.h"
#include <guacamole/client.h>
#include <guacamole/protocol.h>
#include <guacamole/socket.h>
#include <guacamole/user.h>
#include <pthread.h>
#include <stdlib.h>
int guac_kubernetes_user_join_handler(guac_user* user, int argc, char** argv) {
guac_client* client = user->client;
guac_kubernetes_client* kubernetes_client =
(guac_kubernetes_client*) client->data;
/* Parse provided arguments */
guac_kubernetes_settings* settings = guac_kubernetes_parse_args(user,
argc, (const char**) argv);
/* Fail if settings cannot be parsed */
if (settings == NULL) {
guac_user_log(user, GUAC_LOG_INFO,
"Badly formatted client arguments.");
return 1;
}
/* Store settings at user level */
user->data = settings;
/* Connect to Kubernetes if owner */
if (user->owner) {
/* Store owner's settings at client level */
kubernetes_client->settings = settings;
/* Start client thread */
if (pthread_create(&(kubernetes_client->client_thread), NULL,
guac_kubernetes_client_thread, (void*) client)) {
guac_client_abort(client, GUAC_PROTOCOL_STATUS_SERVER_ERROR,
"Unable to start Kubernetes client thread");
return 1;
}
}
/* If not owner, synchronize with current display */
else {
guac_terminal_dup(kubernetes_client->term, user, user->socket);
guac_kubernetes_send_current_argv(user, kubernetes_client);
guac_socket_flush(user->socket);
}
/* Only handle events if not read-only */
if (!settings->read_only) {
/* General mouse/keyboard events */
user->key_handler = guac_kubernetes_user_key_handler;
user->mouse_handler = guac_kubernetes_user_mouse_handler;
/* Inbound (client to server) clipboard transfer */
if (!settings->disable_paste)
user->clipboard_handler = guac_kubernetes_clipboard_handler;
/* STDIN redirection */
user->pipe_handler = guac_kubernetes_pipe_handler;
/* Updates to connection parameters */
user->argv_handler = guac_kubernetes_argv_handler;
/* Display size change events */
user->size_handler = guac_kubernetes_user_size_handler;
}
return 0;
}
int guac_kubernetes_user_leave_handler(guac_user* user) {
guac_kubernetes_client* kubernetes_client =
(guac_kubernetes_client*) user->client->data;
/* Update shared cursor state */
guac_common_cursor_remove_user(kubernetes_client->term->cursor, user);
/* Free settings if not owner (owner settings will be freed with client) */
if (!user->owner) {
guac_kubernetes_settings* settings =
(guac_kubernetes_settings*) user->data;
guac_kubernetes_settings_free(settings);
}
return 0;
}
|
#import <UIKit/UIKit.h>
FOUNDATION_EXPORT double Pods_HelloWorldPlatformVersionNumber;
FOUNDATION_EXPORT const unsigned char Pods_HelloWorldPlatformVersionString[];
|
/*
* MAPI Default IMalloc implementation
*
* Copyright 2004 Jon Griffiths
*
* 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 St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#define COBJMACROS
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "winuser.h"
#include "winerror.h"
#include "winternl.h"
#include "objbase.h"
#include "shlwapi.h"
#include "mapiutil.h"
#include "util.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(mapi);
static const IMallocVtbl MAPI_IMalloc_vt;
typedef struct
{
IMalloc IMalloc_iface;
LONG lRef;
} MAPI_IMALLOC;
static MAPI_IMALLOC MAPI_IMalloc = { { &MAPI_IMalloc_vt }, 0 };
extern LONG MAPI_ObjectCount; /* In mapi32_main.c */
/*************************************************************************
* MAPIGetDefaultMalloc@0 (MAPI32.59)
*
* Get the default MAPI IMalloc interface.
*
* PARAMS
* None.
*
* RETURNS
* A pointer to the MAPI default allocator.
*/
LPMALLOC WINAPI MAPIGetDefaultMalloc(void)
{
TRACE("()\n");
if (mapiFunctions.MAPIGetDefaultMalloc)
return mapiFunctions.MAPIGetDefaultMalloc();
IMalloc_AddRef(&MAPI_IMalloc.IMalloc_iface);
return &MAPI_IMalloc.IMalloc_iface;
}
/**************************************************************************
* IMAPIMalloc_QueryInterface
*/
static HRESULT WINAPI IMAPIMalloc_fnQueryInterface(LPMALLOC iface, REFIID refiid,
LPVOID *ppvObj)
{
TRACE("(%s,%p)\n", debugstr_guid(refiid), ppvObj);
if (IsEqualIID(refiid, &IID_IUnknown) ||
IsEqualIID(refiid, &IID_IMalloc))
{
*ppvObj = &MAPI_IMalloc;
TRACE("Returning IMalloc (%p)\n", *ppvObj);
return S_OK;
}
TRACE("Returning E_NOINTERFACE\n");
return E_NOINTERFACE;
}
/**************************************************************************
* IMAPIMalloc_AddRef
*/
static ULONG WINAPI IMAPIMalloc_fnAddRef(LPMALLOC iface)
{
TRACE("(%p)\n", iface);
InterlockedIncrement(&MAPI_ObjectCount);
return 1u;
}
/**************************************************************************
* IMAPIMalloc_Release
*/
static ULONG WINAPI IMAPIMalloc_fnRelease(LPMALLOC iface)
{
TRACE("(%p)\n", iface);
InterlockedDecrement(&MAPI_ObjectCount);
return 1u;
}
/**************************************************************************
* IMAPIMalloc_Alloc
*/
static LPVOID WINAPI IMAPIMalloc_fnAlloc(LPMALLOC iface, DWORD cb)
{
TRACE("(%p)->(%d)\n", iface, cb);
return LocalAlloc(LMEM_FIXED, cb);
}
/**************************************************************************
* IMAPIMalloc_Realloc
*/
static LPVOID WINAPI IMAPIMalloc_fnRealloc(LPMALLOC iface, LPVOID pv, DWORD cb)
{
TRACE("(%p)->(%p, %d)\n", iface, pv, cb);
if (!pv)
return LocalAlloc(LMEM_FIXED, cb);
if (cb)
return LocalReAlloc(pv, cb, LMEM_MOVEABLE);
LocalFree(pv);
return NULL;
}
/**************************************************************************
* IMAPIMalloc_Free
*/
static void WINAPI IMAPIMalloc_fnFree(LPMALLOC iface, LPVOID pv)
{
TRACE("(%p)->(%p)\n", iface, pv);
LocalFree(pv);
}
/**************************************************************************
* IMAPIMalloc_GetSize
*/
static DWORD WINAPI IMAPIMalloc_fnGetSize(LPMALLOC iface, LPVOID pv)
{
TRACE("(%p)->(%p)\n", iface, pv);
return LocalSize(pv);
}
/**************************************************************************
* IMAPIMalloc_DidAlloc
*/
static INT WINAPI IMAPIMalloc_fnDidAlloc(LPMALLOC iface, LPVOID pv)
{
TRACE("(%p)->(%p)\n", iface, pv);
return -1;
}
/**************************************************************************
* IMAPIMalloc_HeapMinimize
*/
static void WINAPI IMAPIMalloc_fnHeapMinimize(LPMALLOC iface)
{
TRACE("(%p)\n", iface);
}
static const IMallocVtbl MAPI_IMalloc_vt =
{
IMAPIMalloc_fnQueryInterface,
IMAPIMalloc_fnAddRef,
IMAPIMalloc_fnRelease,
IMAPIMalloc_fnAlloc,
IMAPIMalloc_fnRealloc,
IMAPIMalloc_fnFree,
IMAPIMalloc_fnGetSize,
IMAPIMalloc_fnDidAlloc,
IMAPIMalloc_fnHeapMinimize
};
|
#ifndef _CORE_NUMBER_H_
#define _CORE_NUMBER_H_
#include "gbyte.h"
#include "gboolean.h"
#include "gcharacter.h"
#include "gsignedcharacter.h"
#include "gunsignedcharacter.h"
#include "gwidecharacter.h"
#include "gsmallinteger.h"
#include "gunsignedsmallinteger.h"
#include "gshortinteger.h"
#include "gunsignedshortinteger.h"
#include "ginteger.h"
#include "gunsignedinteger.h"
#include "glonginteger.h"
#include "gunsignedlonginteger.h"
#include "glonglonginteger.h"
#include "gunsignedlonglonginteger.h"
#include "gsinglefloat.h"
#include "gdoublefloat.h"
#include "glongdoublefloat.h"
namespace gsystem { // gsystem
#ifdef G_REAL_USE_FLOAT
typedef GFloat GReal;
#else // !G_REAL_USE_FLOAT
typedef GDouble GReal;
#endif // G_REAL_USE_FLOAT
} // namespace gsystem
#endif // _CORE_NUMBER_H_ |
#include "fd_pwm.h"
#include "fd_apollo.h"
const fd_pwm_module_t *fd_pwm_modules;
uint32_t fd_pwm_module_count;
const fd_pwm_channel_t *fd_pwm_channels;
uint32_t fd_pwm_channel_count;
void fd_pwm_initialize(const fd_pwm_module_t *modules __attribute__((unused)), uint32_t module_count __attribute__((unused)), const fd_pwm_channel_t *channels, uint32_t channel_count) {
fd_pwm_modules = modules;
fd_pwm_module_count = module_count;
fd_pwm_channels = channels;
fd_pwm_channel_count = channel_count;
for (uint32_t i = 0; i < fd_pwm_channel_count; ++i) {
const fd_pwm_channel_t *channel = &fd_pwm_channels[i];
if (channel->function != 0) {
const fd_pwm_module_t *module = channel->module;
uint32_t interrupt = 1u << (module->instance * 2 + channel->instance);
am_hal_ctimer_int_clear(interrupt);
am_hal_ctimer_int_enable(interrupt);
am_hal_ctimer_int_clear(interrupt << 8);
am_hal_ctimer_int_enable(interrupt << 8);
}
}
NVIC_SetPriority(CTIMER_IRQn, 0);
am_hal_interrupt_enable(AM_HAL_INTERRUPT_CTIMER);
am_hal_interrupt_master_enable();
}
void fd_pwm_module_enable(const fd_pwm_module_t *module __attribute__((unused))) {
}
void fd_pwm_module_disable(const fd_pwm_module_t *module __attribute__((unused))) {
}
void am_ctimer_isr(void) {
uint32_t status = am_hal_ctimer_int_status_get(false);
am_hal_ctimer_int_clear(status);
am_hal_ctimer_int_service(status);
for (uint32_t i = 0; i < fd_pwm_channel_count; ++i) {
const fd_pwm_channel_t *channel = &fd_pwm_channels[i];
if (channel->function != 0) {
const fd_pwm_module_t *module = channel->module;
uint32_t interrupt = 1u << (module->instance * 2 + channel->instance);
if (status & interrupt) {
channel->function(false);
}
if (status & (interrupt << 8)) {
channel->function(true);
}
}
}
}
#define AM_HAL_CTIMER_HFRC_12MHZ AM_REG_CTIMER_CTRL0_TMRA0CLK(0x1)
#define AM_HAL_CTIMER_LFRC_1KHZ AM_REG_CTIMER_CTRL0_TMRA0CLK(0xD)
void fd_pwm_channel_start(const fd_pwm_channel_t *channel, float duty_cycle) {
uint32_t timer_number = channel->module->instance;
uint32_t timer_segment = channel->instance == 0 ? AM_HAL_CTIMER_TIMERA : AM_HAL_CTIMER_TIMERB;
uint32_t top_count;
uint32_t control = AM_HAL_CTIMER_FN_PWM_REPEAT;
if (channel->function == 0) {
control |= AM_HAL_CTIMER_PIN_ENABLE;
} else {
control |= AM_REG_CTIMER_CTRL0_TMRA0IE0_M | AM_REG_CTIMER_CTRL0_TMRA0IE1_M;
}
if (channel->module->frequency >= 100) {
top_count = ((uint32_t)(12000000.0f / channel->module->frequency)) - 1;
control |= AM_HAL_CTIMER_HFRC_12MHZ;
} else {
top_count = ((uint32_t)(1024.0f / channel->module->frequency)) - 1;
control |= AM_HAL_CTIMER_LFRC_1KHZ;
}
am_hal_ctimer_config_single(timer_number, timer_segment, control);
uint32_t on_count = (uint32_t)(duty_cycle * (float)top_count);
am_hal_ctimer_period_set(timer_number, timer_segment, top_count, on_count);
am_hal_ctimer_start(timer_number, timer_segment);
}
#define TIMER_OFFSET (AM_REG_CTIMER_TMR1_O - AM_REG_CTIMER_TMR0_O)
bool fd_pwm_channel_is_running(const fd_pwm_channel_t *channel) {
uint32_t timer_number = channel->module->instance;
volatile uint32_t *pui32ConfigReg = (uint32_t *)(AM_REG_CTIMERn(0) + AM_REG_CTIMER_CTRL0_O + (timer_number * TIMER_OFFSET));
uint32_t value = AM_REGVAL(pui32ConfigReg);
uint32_t mask = channel->instance == 0 ? AM_REG_CTIMER_CTRL0_TMRA0EN_M : AM_REG_CTIMER_CTRL0_TMRB0EN_M;
return (value & mask) != 0;
}
void fd_pwm_channel_stop(const fd_pwm_channel_t *channel) {
uint32_t timer_number = channel->module->instance;
uint32_t timer_segment = channel->instance == 0 ? AM_HAL_CTIMER_TIMERA : AM_HAL_CTIMER_TIMERB;
am_hal_ctimer_clear(timer_number, timer_segment);
}
|
/* Copyright 2016 Jiang Chen <criver@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <condition_variable>
#include <functional>
#include <mutex>
#include <thread>
#include <queue>
#include <unistd.h>
#include <vector>
class ThreadPool {
public:
ThreadPool(int num_threads);
~ThreadPool();
void Enqueue(std::function<void()> f);
private:
// Function that will be invoked by our threads.
void Invoke();
void ShutDown();
std::vector<std::thread> thread_pool_;
// Queue to keep track of incoming tasks.
std::queue<std::function<void()>> tasks_;
std::mutex queue_mutex_;
std::condition_variable condition_;
// Indicates that pool needs to be shut down.
bool to_be_shutdown_ = false;
};
|
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2010 by TutorialUsingCommonJS, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*
* WARNING: This is generated code. Modify at your own risk and without support.
*/
#import "TiBase.h"
#ifdef USE_TI_FILESYSTEM
#import "TiFile.h"
@interface TiFilesystemBlobProxy : TiFile {
@private
NSURL *url;
NSData *data;
}
-(id)initWithURL:(NSURL*)url data:(NSData*)data;
@end
#endif |
#include "tommath_private.h"
#ifdef BN_MP_XOR_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision
* integer arithmetic as well as number theoretic functionality.
*
* The library was designed directly after the MPI library by
* Michael Fromberger but has been written from scratch with
* additional optimizations in place.
*
* The library is free for all purposes without any express
* guarantee it works.
*/
/* XOR two ints together */
int mp_xor(const mp_int *a, const mp_int *b, mp_int *c)
{
int res, ix, px;
mp_int t;
const mp_int *x;
if (a->used > b->used) {
if ((res = mp_init_copy(&t, a)) != MP_OKAY) {
return res;
}
px = b->used;
x = b;
} else {
if ((res = mp_init_copy(&t, b)) != MP_OKAY) {
return res;
}
px = a->used;
x = a;
}
for (ix = 0; ix < px; ix++) {
t.dp[ix] ^= x->dp[ix];
}
mp_clamp(&t);
mp_exch(c, &t);
mp_clear(&t);
return MP_OKAY;
}
#endif
/* ref: HEAD -> develop */
/* git commit: 8b9f98baa16b21e1612ac6746273febb74150a6f */
/* commit time: 2018-09-23 21:37:58 +0200 */
|
#include "Maths/Maths.h"
|
# include "jlib.h"
# ifndef NULL
# define NULL ((char *) 0)
# endif
extern halting;
extern curgroup, curwin;
extern Jprintf ();
extern char *getstring ();
ctrl1 ()
{
win0 ();
if (getchoice (1, " У0ио ", "Обнулить процессор и игнорировать остановы ?",
NULL, " Да ", " Нет ", NULL) == 0) {
send (0, 0363);
zero ();
halting = 1;
win0 ();
}
curwin = 0;
prmenu ();
}
ctrl2 ()
{
win0 ();
if (getchoice (1, " У0 ", "Обнулить процессор ?",
NULL, " Да ", " Нет ", NULL) == 0) {
zero ();
halting = 1;
win0 ();
}
curwin = 0;
prmenu ();
}
ctrl3 ()
{
win0 ();
if (getchoice (1, " ОР ", "Остановить процессор ?",
NULL, " Да ", " Нет ", NULL) == 0) {
stop ();
halting = 1;
win0 ();
}
curwin = 0;
prmenu ();
}
ctrl4 ()
{
win0 ();
if (getchoice (1, " АР ", "Пустить процессор ?",
NULL, " Да ", " Нет ", NULL) == 0) {
run ();
halting = 0;
win0 ();
}
curwin = 0;
prmenu ();
}
ctrl5 ()
{
win0 ();
if (getchoice (1, " ПктАр ", "Пустить процессор с команды на РКП ?",
NULL, " Да ", " Нет ", NULL) == 0) {
setcrp ();
run ();
halting = 0;
win0 ();
}
curwin = 0;
prmenu ();
}
ctrl6 ()
{
register char *p;
char a [40+1];
static long crp;
sprintf (a, "%08lx", crp);
p = getstring (8, a, " Пкт ", "Введите шестнадцатеричную команду");
if (p) {
sscanf (p, "%lx", &crp);
ptsendl (crp, 0371);
win0 ();
}
curwin = 0;
prmenu ();
}
ctrl7 ()
{
register char *p;
static char name [40+1];
p = getstring (40, name, " Загрузка ", "Введите имя файла");
if (! p)
goto ret;
strncpy (name, p, 40);
name [40] = 0;
Jmove (12, 10);
VClearLine ();
Jbold ();
if (loadfile (name, Jprintf) < 0)
error ("Не могу открыть '%s'", name);
Jnorm ();
ret:
curwin = 0;
prmenu ();
}
ctrl8 ()
{
notyet ();
}
|
/*
* Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#pragma once
#include <aws/iot/IoT_EXPORTS.h>
#include <aws/iot/IoTRequest.h>
namespace Aws
{
namespace IoT
{
namespace Model
{
/**
* <p>The input for the GetLoggingOptions operation.</p>
*/
class AWS_IOT_API GetLoggingOptionsRequest : public IoTRequest
{
public:
GetLoggingOptionsRequest();
Aws::String SerializePayload() const override;
};
} // namespace Model
} // namespace IoT
} // namespace Aws
|
//
// ICDControllerDocumentsTVC.h
// CloudantDashboard
//
// Created by Enrique de la Torre (dev) on 23/12/2014.
// Copyright (c) 2014 Enrique de la Torre. 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 "ICDControllerDocumentsDataProtocol.h"
@interface ICDControllerDocumentsTVC : UITableViewController
- (void)useData:(id<ICDControllerDocumentsDataProtocol>)data;
@end
|
#ifndef NETENCODER_H
#define NETENCODER_H
#include "blockcache.h"
#include "ack_received.h"
#include "ack.h"
#include "packet_sender.h"
#include "bw_msgs.h"
SendData encode_fragment(FragmentData * fragment);
/* MUST BE FREED */
/* ret is NULL if fragment is malformed */
FragmentData * decode_fragment(unsigned char * fragmentstring, ssize_t length);
SendData encode_ack(uint16_t seq);
SendData encode_bw(uint32_t bw);
/* MUST BE FREED */
AckReceived * decode_ack(unsigned char* ack, ssize_t length);
/* MUST BE FREED */
BWMsg * decode_bwmsg(unsigned char* bw_r, ssize_t length);
int get_fragment_size(FragmentData * fragment);
int validate_ack(unsigned char * blob, size_t l);
int validate_bw(unsigned char * blob, size_t l);
int validate_block(unsigned char * blob, size_t l);
void append_ack_cons(SendData *s, uint16_t cons);
void append_ack_ts(SendData *s, struct timeval *ts);
int get_header_size (void);
FragmentID get_fragment_id(unsigned char * fragmentstring, ssize_t length);
#endif
|
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM /builds/slave/rel-m-rel-xr-osx64-bld/build/dom/interfaces/svg/nsIDOMSVGElement.idl
*/
#ifndef __gen_nsIDOMSVGElement_h__
#define __gen_nsIDOMSVGElement_h__
#ifndef __gen_nsIDOMElement_h__
#include "nsIDOMElement.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
class nsIDOMSVGSVGElement; /* forward declaration */
/* starting interface: nsIDOMSVGElement */
#define NS_IDOMSVGELEMENT_IID_STR "c358d048-be72-4d39-93dc-0e85b8c9f07b"
#define NS_IDOMSVGELEMENT_IID \
{0xc358d048, 0xbe72, 0x4d39, \
{ 0x93, 0xdc, 0x0e, 0x85, 0xb8, 0xc9, 0xf0, 0x7b }}
class NS_NO_VTABLE NS_SCRIPTABLE nsIDOMSVGElement : public nsIDOMElement {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOMSVGELEMENT_IID)
/* attribute DOMString id; */
NS_SCRIPTABLE NS_IMETHOD GetId(nsAString & aId) = 0;
NS_SCRIPTABLE NS_IMETHOD SetId(const nsAString & aId) = 0;
/* readonly attribute nsIDOMSVGSVGElement ownerSVGElement; */
NS_SCRIPTABLE NS_IMETHOD GetOwnerSVGElement(nsIDOMSVGSVGElement * *aOwnerSVGElement) = 0;
/* readonly attribute nsIDOMSVGElement viewportElement; */
NS_SCRIPTABLE NS_IMETHOD GetViewportElement(nsIDOMSVGElement * *aViewportElement) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMSVGElement, NS_IDOMSVGELEMENT_IID)
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIDOMSVGELEMENT \
NS_SCRIPTABLE NS_IMETHOD GetId(nsAString & aId); \
NS_SCRIPTABLE NS_IMETHOD SetId(const nsAString & aId); \
NS_SCRIPTABLE NS_IMETHOD GetOwnerSVGElement(nsIDOMSVGSVGElement * *aOwnerSVGElement); \
NS_SCRIPTABLE NS_IMETHOD GetViewportElement(nsIDOMSVGElement * *aViewportElement);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIDOMSVGELEMENT(_to) \
NS_SCRIPTABLE NS_IMETHOD GetId(nsAString & aId) { return _to GetId(aId); } \
NS_SCRIPTABLE NS_IMETHOD SetId(const nsAString & aId) { return _to SetId(aId); } \
NS_SCRIPTABLE NS_IMETHOD GetOwnerSVGElement(nsIDOMSVGSVGElement * *aOwnerSVGElement) { return _to GetOwnerSVGElement(aOwnerSVGElement); } \
NS_SCRIPTABLE NS_IMETHOD GetViewportElement(nsIDOMSVGElement * *aViewportElement) { return _to GetViewportElement(aViewportElement); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIDOMSVGELEMENT(_to) \
NS_SCRIPTABLE NS_IMETHOD GetId(nsAString & aId) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetId(aId); } \
NS_SCRIPTABLE NS_IMETHOD SetId(const nsAString & aId) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetId(aId); } \
NS_SCRIPTABLE NS_IMETHOD GetOwnerSVGElement(nsIDOMSVGSVGElement * *aOwnerSVGElement) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetOwnerSVGElement(aOwnerSVGElement); } \
NS_SCRIPTABLE NS_IMETHOD GetViewportElement(nsIDOMSVGElement * *aViewportElement) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetViewportElement(aViewportElement); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsDOMSVGElement : public nsIDOMSVGElement
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMSVGELEMENT
nsDOMSVGElement();
private:
~nsDOMSVGElement();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsDOMSVGElement, nsIDOMSVGElement)
nsDOMSVGElement::nsDOMSVGElement()
{
/* member initializers and constructor code */
}
nsDOMSVGElement::~nsDOMSVGElement()
{
/* destructor code */
}
/* attribute DOMString id; */
NS_IMETHODIMP nsDOMSVGElement::GetId(nsAString & aId)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsDOMSVGElement::SetId(const nsAString & aId)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute nsIDOMSVGSVGElement ownerSVGElement; */
NS_IMETHODIMP nsDOMSVGElement::GetOwnerSVGElement(nsIDOMSVGSVGElement * *aOwnerSVGElement)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute nsIDOMSVGElement viewportElement; */
NS_IMETHODIMP nsDOMSVGElement::GetViewportElement(nsIDOMSVGElement * *aViewportElement)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsIDOMSVGElement_h__ */
|
#include <stdio.h>
int main() {
int a, b, c, d, e, f;
double x, y;
scanf("%i", &a);
scanf("%i", &b);
scanf("%i", &c);
scanf("%i", &d);
scanf("%i", &e);
scanf("%i", &f);
double divisor = a * e - b * d;
x = (c * e - b * f) / divisor;
y = (a * f - c * d) / divisor;
printf("O VALOR DE X E = %0.2f\n", x);
printf("O VALOR DE Y E = %0.2f\n", y);
return 0;
} |
/*
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#pragma once
#include <aws/sms/SMS_EXPORTS.h>
#include <aws/sms/SMSRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>
namespace Aws
{
namespace SMS
{
namespace Model
{
/**
*/
class AWS_SMS_API GetReplicationJobsRequest : public SMSRequest
{
public:
GetReplicationJobsRequest();
// Service request name is the Operation name which will send this request out,
// each operation should has unique request name, so that we can get operation's name from this request.
// Note: this is not true for response, multiple operations may have the same response name,
// so we can not get operation's name from response.
inline virtual const char* GetServiceRequestName() const override { return "GetReplicationJobs"; }
Aws::String SerializePayload() const override;
Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override;
inline const Aws::String& GetReplicationJobId() const{ return m_replicationJobId; }
inline void SetReplicationJobId(const Aws::String& value) { m_replicationJobIdHasBeenSet = true; m_replicationJobId = value; }
inline void SetReplicationJobId(Aws::String&& value) { m_replicationJobIdHasBeenSet = true; m_replicationJobId = std::move(value); }
inline void SetReplicationJobId(const char* value) { m_replicationJobIdHasBeenSet = true; m_replicationJobId.assign(value); }
inline GetReplicationJobsRequest& WithReplicationJobId(const Aws::String& value) { SetReplicationJobId(value); return *this;}
inline GetReplicationJobsRequest& WithReplicationJobId(Aws::String&& value) { SetReplicationJobId(std::move(value)); return *this;}
inline GetReplicationJobsRequest& WithReplicationJobId(const char* value) { SetReplicationJobId(value); return *this;}
inline const Aws::String& GetNextToken() const{ return m_nextToken; }
inline void SetNextToken(const Aws::String& value) { m_nextTokenHasBeenSet = true; m_nextToken = value; }
inline void SetNextToken(Aws::String&& value) { m_nextTokenHasBeenSet = true; m_nextToken = std::move(value); }
inline void SetNextToken(const char* value) { m_nextTokenHasBeenSet = true; m_nextToken.assign(value); }
inline GetReplicationJobsRequest& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;}
inline GetReplicationJobsRequest& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;}
inline GetReplicationJobsRequest& WithNextToken(const char* value) { SetNextToken(value); return *this;}
inline int GetMaxResults() const{ return m_maxResults; }
inline void SetMaxResults(int value) { m_maxResultsHasBeenSet = true; m_maxResults = value; }
inline GetReplicationJobsRequest& WithMaxResults(int value) { SetMaxResults(value); return *this;}
private:
Aws::String m_replicationJobId;
bool m_replicationJobIdHasBeenSet;
Aws::String m_nextToken;
bool m_nextTokenHasBeenSet;
int m_maxResults;
bool m_maxResultsHasBeenSet;
};
} // namespace Model
} // namespace SMS
} // namespace Aws
|
//
// ViewController.h
// LocomoteAMTestApp
//
// Created by Julian Goacher on 05/05/2017.
// Copyright © 2017 Locomote.sh. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@end
|
// ======================================================================== //
// Copyright 2009-2017 Intel Corporation //
// //
// Licensed under the Apache License, Version 2.0 (the "License"); //
// you may not use this file except in compliance with the License. //
// You may obtain a copy of the License at //
// //
// http://www.apache.org/licenses/LICENSE-2.0 //
// //
// Unless required by applicable law or agreed to in writing, software //
// distributed under the License is distributed on an "AS IS" BASIS, //
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
// See the License for the specific language governing permissions and //
// limitations under the License. //
// ======================================================================== //
#pragma once
#include "platform.h"
namespace embree
{
/*! Convenience class for handling file names and paths. */
class FileName
{
public:
/*! create an empty filename */
FileName ();
/*! create a valid filename from a string */
FileName (const char* filename);
/*! create a valid filename from a string */
FileName (const std::string& filename);
/*! returns path to home folder */
static FileName homeFolder();
/*! returns path to executable */
static FileName executableFolder();
/*! auto convert into a string */
operator std::string() const { return filename; }
/*! returns a string of the filename */
const std::string str() const { return filename; }
/*! returns a c-string of the filename */
const char* c_str() const { return filename.c_str(); }
/*! returns the path of a filename */
FileName path() const;
/*! returns the file of a filename */
std::string base() const;
/*! returns the base of a filename without extension */
std::string name() const;
/*! returns the file extension */
std::string ext() const;
/*! drops the file extension */
FileName dropExt() const;
/*! replaces the file extension */
FileName setExt(const std::string& ext = "") const;
/*! adds file extension */
FileName addExt(const std::string& ext = "") const;
/*! concatenates two filenames to this/other */
FileName operator +( const FileName& other ) const;
/*! concatenates two filenames to this/other */
FileName operator +( const std::string& other ) const;
/*! removes the base from a filename (if possible) */
FileName operator -( const FileName& base ) const;
/*! == operator */
friend bool operator==(const FileName& a, const FileName& b);
/*! != operator */
friend bool operator!=(const FileName& a, const FileName& b);
/*! output operator */
friend std::ostream& operator<<(std::ostream& cout, const FileName& filename);
private:
std::string filename;
};
}
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/core/client/AWSError.h>
#include <aws/core/client/CoreErrors.h>
#include <aws/migrationhubstrategy/MigrationHubStrategyRecommendations_EXPORTS.h>
namespace Aws
{
namespace MigrationHubStrategyRecommendations
{
enum class MigrationHubStrategyRecommendationsErrors
{
//From Core//
//////////////////////////////////////////////////////////////////////////////////////////
INCOMPLETE_SIGNATURE = 0,
INTERNAL_FAILURE = 1,
INVALID_ACTION = 2,
INVALID_CLIENT_TOKEN_ID = 3,
INVALID_PARAMETER_COMBINATION = 4,
INVALID_QUERY_PARAMETER = 5,
INVALID_PARAMETER_VALUE = 6,
MISSING_ACTION = 7, // SDK should never allow
MISSING_AUTHENTICATION_TOKEN = 8, // SDK should never allow
MISSING_PARAMETER = 9, // SDK should never allow
OPT_IN_REQUIRED = 10,
REQUEST_EXPIRED = 11,
SERVICE_UNAVAILABLE = 12,
THROTTLING = 13,
VALIDATION = 14,
ACCESS_DENIED = 15,
RESOURCE_NOT_FOUND = 16,
UNRECOGNIZED_CLIENT = 17,
MALFORMED_QUERY_STRING = 18,
SLOW_DOWN = 19,
REQUEST_TIME_TOO_SKEWED = 20,
INVALID_SIGNATURE = 21,
SIGNATURE_DOES_NOT_MATCH = 22,
INVALID_ACCESS_KEY_ID = 23,
REQUEST_TIMEOUT = 24,
NETWORK_CONNECTION = 99,
UNKNOWN = 100,
///////////////////////////////////////////////////////////////////////////////////////////
CONFLICT= static_cast<int>(Aws::Client::CoreErrors::SERVICE_EXTENSION_START_RANGE) + 1,
INTERNAL_SERVER,
SERVICE_LINKED_ROLE_LOCK_CLIENT,
SERVICE_QUOTA_EXCEEDED
};
class AWS_MIGRATIONHUBSTRATEGYRECOMMENDATIONS_API MigrationHubStrategyRecommendationsError : public Aws::Client::AWSError<MigrationHubStrategyRecommendationsErrors>
{
public:
MigrationHubStrategyRecommendationsError() {}
MigrationHubStrategyRecommendationsError(const Aws::Client::AWSError<Aws::Client::CoreErrors>& rhs) : Aws::Client::AWSError<MigrationHubStrategyRecommendationsErrors>(rhs) {}
MigrationHubStrategyRecommendationsError(Aws::Client::AWSError<Aws::Client::CoreErrors>&& rhs) : Aws::Client::AWSError<MigrationHubStrategyRecommendationsErrors>(rhs) {}
MigrationHubStrategyRecommendationsError(const Aws::Client::AWSError<MigrationHubStrategyRecommendationsErrors>& rhs) : Aws::Client::AWSError<MigrationHubStrategyRecommendationsErrors>(rhs) {}
MigrationHubStrategyRecommendationsError(Aws::Client::AWSError<MigrationHubStrategyRecommendationsErrors>&& rhs) : Aws::Client::AWSError<MigrationHubStrategyRecommendationsErrors>(rhs) {}
template <typename T>
T GetModeledError();
};
namespace MigrationHubStrategyRecommendationsErrorMapper
{
AWS_MIGRATIONHUBSTRATEGYRECOMMENDATIONS_API Aws::Client::AWSError<Aws::Client::CoreErrors> GetErrorForName(const char* errorName);
}
} // namespace MigrationHubStrategyRecommendations
} // namespace Aws
|
//
// VideoEngine.h
// SimpleIoc
//
// Created by qvod on 14/10/25.
// Copyright (c) 2014年 YF. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface VideoEngine : NSObject
-(void)Play;
@end
|
#ifndef _DEBUGGING_H_
#define _DEBUGGING_H_
#include <stdlib.h>
#include "settings.h"
#include "communicator.h"
// Macros to check parameters
#ifdef CHECK_PARAMETERS
#define CHECK_COUNT(C) (check_count(C))
#define CHECK_SOURCE(C,R) (check_source(C, R))
#define CHECK_DESTINATION(C,R) (check_destination(C, R))
void check_count(int count);
void check_source(communicator *c, int rank);
void check_destination(communicator *c, int rank);
#else
#define CHECK_COUNT(C)
#define CHECK_SOURCE(C,R)
#define CHECK_DESTINATION(C,R)
#endif
#endif
|
// Copyright 2011 Software Freedom Conservancy
// 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 WEBDRIVER_IE_GETELEMENTLOCATIONONCESCROLLEDINTOVIEWCOMMANDHANDLER_H_
#define WEBDRIVER_IE_GETELEMENTLOCATIONONCESCROLLEDINTOVIEWCOMMANDHANDLER_H_
#include "../Browser.h"
#include "../IECommandHandler.h"
#include "../IECommandExecutor.h"
#include "../Generated/atoms.h"
namespace webdriver {
class GetElementLocationOnceScrolledIntoViewCommandHandler : public IECommandHandler {
public:
GetElementLocationOnceScrolledIntoViewCommandHandler(void) {
}
virtual ~GetElementLocationOnceScrolledIntoViewCommandHandler(void) {
}
protected:
void ExecuteInternal(const IECommandExecutor& executor,
const LocatorMap& locator_parameters,
const ParametersMap& command_parameters,
Response* response) {
LocatorMap::const_iterator id_parameter_iterator = locator_parameters.find("id");
if (id_parameter_iterator == locator_parameters.end()) {
response->SetErrorResponse(400, "Missing parameter in URL: id");
return;
} else {
std::string element_id = id_parameter_iterator->second;
BrowserHandle browser_wrapper;
int status_code = executor.GetCurrentBrowser(&browser_wrapper);
if (status_code != SUCCESS) {
response->SetErrorResponse(status_code, "Unable to get browser");
return;
}
ElementHandle element_wrapper;
status_code = this->GetElement(executor, element_id, &element_wrapper);
if (status_code == SUCCESS) {
long x = 0, y = 0, width = 0, height = 0;
status_code = element_wrapper->GetLocationOnceScrolledIntoView(executor.scroll_behavior(),
&x,
&y,
&width,
&height);
if (status_code == SUCCESS) {
Json::Value response_value;
response_value["x"] = x;
response_value["y"] = y;
response->SetSuccessResponse(response_value);
return;
} else {
response->SetErrorResponse(status_code,
"Unable to get element location.");
return;
}
} else {
response->SetErrorResponse(status_code, "Element is no longer valid");
return;
}
}
}
};
} // namespace webdriver
#endif // WEBDRIVER_IE_GETELEMENTLOCATIONONCESCROLLEDINTOVIEWCOMMANDHANDLER_H_
|
//
// Copyright (C) 2013 OpenSim Ltd.
//
// 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
// 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, see <http://www.gnu.org/licenses/>.
//
#ifndef __INET_ANTENNABASE_H
#define __INET_ANTENNABASE_H
#include "inet/physicallayer/contract/IAntenna.h"
namespace inet {
namespace physicallayer {
class INET_API AntennaBase : public IAntenna, public cModule
{
protected:
IMobility *mobility;
protected:
virtual void initialize(int stage);
public:
AntennaBase();
virtual IMobility *getMobility() const { return mobility; }
};
} // namespace physicallayer
} // namespace inet
#endif // ifndef __INET_ANTENNABASE_H
|
/*
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#pragma once
#include <aws/greengrass/Greengrass_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>
namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;
namespace Utils
{
namespace Json
{
class JsonValue;
} // namespace Json
} // namespace Utils
namespace Greengrass
{
namespace Model
{
class AWS_GREENGRASS_API CreateGroupVersionResult
{
public:
CreateGroupVersionResult();
CreateGroupVersionResult(const AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
CreateGroupVersionResult& operator=(const AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
/**
* Arn of the version.
*/
inline const Aws::String& GetArn() const{ return m_arn; }
/**
* Arn of the version.
*/
inline void SetArn(const Aws::String& value) { m_arn = value; }
/**
* Arn of the version.
*/
inline void SetArn(Aws::String&& value) { m_arn = std::move(value); }
/**
* Arn of the version.
*/
inline void SetArn(const char* value) { m_arn.assign(value); }
/**
* Arn of the version.
*/
inline CreateGroupVersionResult& WithArn(const Aws::String& value) { SetArn(value); return *this;}
/**
* Arn of the version.
*/
inline CreateGroupVersionResult& WithArn(Aws::String&& value) { SetArn(std::move(value)); return *this;}
/**
* Arn of the version.
*/
inline CreateGroupVersionResult& WithArn(const char* value) { SetArn(value); return *this;}
/**
* Timestamp of when the version was created.
*/
inline const Aws::String& GetCreationTimestamp() const{ return m_creationTimestamp; }
/**
* Timestamp of when the version was created.
*/
inline void SetCreationTimestamp(const Aws::String& value) { m_creationTimestamp = value; }
/**
* Timestamp of when the version was created.
*/
inline void SetCreationTimestamp(Aws::String&& value) { m_creationTimestamp = std::move(value); }
/**
* Timestamp of when the version was created.
*/
inline void SetCreationTimestamp(const char* value) { m_creationTimestamp.assign(value); }
/**
* Timestamp of when the version was created.
*/
inline CreateGroupVersionResult& WithCreationTimestamp(const Aws::String& value) { SetCreationTimestamp(value); return *this;}
/**
* Timestamp of when the version was created.
*/
inline CreateGroupVersionResult& WithCreationTimestamp(Aws::String&& value) { SetCreationTimestamp(std::move(value)); return *this;}
/**
* Timestamp of when the version was created.
*/
inline CreateGroupVersionResult& WithCreationTimestamp(const char* value) { SetCreationTimestamp(value); return *this;}
/**
* Id of the resource container.
*/
inline const Aws::String& GetId() const{ return m_id; }
/**
* Id of the resource container.
*/
inline void SetId(const Aws::String& value) { m_id = value; }
/**
* Id of the resource container.
*/
inline void SetId(Aws::String&& value) { m_id = std::move(value); }
/**
* Id of the resource container.
*/
inline void SetId(const char* value) { m_id.assign(value); }
/**
* Id of the resource container.
*/
inline CreateGroupVersionResult& WithId(const Aws::String& value) { SetId(value); return *this;}
/**
* Id of the resource container.
*/
inline CreateGroupVersionResult& WithId(Aws::String&& value) { SetId(std::move(value)); return *this;}
/**
* Id of the resource container.
*/
inline CreateGroupVersionResult& WithId(const char* value) { SetId(value); return *this;}
/**
* Unique Id of a version.
*/
inline const Aws::String& GetVersion() const{ return m_version; }
/**
* Unique Id of a version.
*/
inline void SetVersion(const Aws::String& value) { m_version = value; }
/**
* Unique Id of a version.
*/
inline void SetVersion(Aws::String&& value) { m_version = std::move(value); }
/**
* Unique Id of a version.
*/
inline void SetVersion(const char* value) { m_version.assign(value); }
/**
* Unique Id of a version.
*/
inline CreateGroupVersionResult& WithVersion(const Aws::String& value) { SetVersion(value); return *this;}
/**
* Unique Id of a version.
*/
inline CreateGroupVersionResult& WithVersion(Aws::String&& value) { SetVersion(std::move(value)); return *this;}
/**
* Unique Id of a version.
*/
inline CreateGroupVersionResult& WithVersion(const char* value) { SetVersion(value); return *this;}
private:
Aws::String m_arn;
Aws::String m_creationTimestamp;
Aws::String m_id;
Aws::String m_version;
};
} // namespace Model
} // namespace Greengrass
} // namespace Aws
|
//
// SubSystemFour.h
//
//
// Created by GameRisker on 16/1/24.
//
//
#import <Foundation/Foundation.h>
@interface SubSystemFour : NSObject
- (void)MethodFour;
@end
|
/** @file
Copyright (C) 2012 - 2014 Damir Maar. All rights reserved.<BR>
Portions Copyright (C) 2015 - 2017, CupertinoNet. All rights reserved.<BR>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
**/
#include <Uefi.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/MiscMemoryLib.h>
#include <Library/VirtualMemoryLib.h>
#include "VirtualMemoryInternal.h"
#define VM_MEMORY_POOL_SIZE SIZE_2MB
STATIC VOID *mVmMemory = NULL;
STATIC UINTN mVmMemoryPages = 0;
STATIC UINTN mVmMemoryAvailablePages = 0;
BOOLEAN
VirtualMemoryConstructor (
VOID
)
{
if (mVmMemory == NULL) {
mVmMemoryAvailablePages = EFI_SIZE_TO_PAGES (VM_MEMORY_POOL_SIZE);
mVmMemory = AllocatePagesFromTop (
EfiBootServicesData,
mVmMemoryAvailablePages,
BASE_4GB
);
}
return (BOOLEAN)(mVmMemory != NULL);
}
VOID
VirtualMemoryDestructor (
VOID
)
{
if ((mVmMemory != NULL) && (mVmMemoryPages == mVmMemoryAvailablePages)) {
FreePages (mVmMemory, mVmMemoryPages);
mVmMemory = NULL;
DEBUG_CODE (
mVmMemoryPages = 0;
mVmMemoryAvailablePages = 0;
);
}
}
VOID *
VmInternalAllocatePages (
IN UINTN NumberOfPages
)
{
VOID *Memory;
UINTN FreeOffset;
ASSERT (mVmMemoryAvailablePages >= NumberOfPages);
Memory = NULL;
if (mVmMemoryAvailablePages >= NumberOfPages) {
FreeOffset = EFI_PAGES_TO_SIZE (mVmMemoryPages - mVmMemoryAvailablePages);
Memory = (VOID *)((UINTN)mVmMemory + FreeOffset);
mVmMemoryAvailablePages -= NumberOfPages;
}
return Memory;
}
BOOLEAN
VirtualMemoryMapVirtualPages (
IN VOID *PageTable,
IN EFI_VIRTUAL_ADDRESS VirtualAddress,
IN UINT64 NumberOfPages,
IN EFI_PHYSICAL_ADDRESS PhysicalAddress
)
{
BOOLEAN Result;
Result = TRUE;
while ((NumberOfPages > 0) && Result) {
Result = VmInternalMapVirtualPage (
PageTable,
VirtualAddress,
PhysicalAddress
);
VirtualAddress += EFI_PAGE_SIZE;
PhysicalAddress += EFI_PAGE_SIZE;
--NumberOfPages;
}
return Result;
}
|
/*=========================================================================
*
* 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 itkPathToChainCodePathFilter_h
#define itkPathToChainCodePathFilter_h
#include "itkPathToPathFilter.h"
#include "itkOffset.h"
//Templates require interfaces conforming to itkPath.h and itkChainCodePath.h
namespace itk
{
/** \class PathToChainCodePathFilter
* \brief Filter that produces a chain code version of a path.
*
* PathToChainCodePathFilter produces a chain code representation of a path.
* If MaximallyConnectedOn() is called, then the resulting chain code will be
* maximally connected (for example, 4-connected instead of 8-connected in 2D).
*
* \ingroup PathFilters
* \ingroup ITKPath
*/
template< typename TInputPath, typename TOutputChainCodePath >
class ITK_TEMPLATE_EXPORT PathToChainCodePathFilter:public
PathToPathFilter< TInputPath, TOutputChainCodePath >
{
public:
/** Standard class typedefs. */
typedef PathToChainCodePathFilter Self;
typedef PathToPathFilter< TInputPath, TOutputChainCodePath > 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(PathToChainCodePathFilter, PathToPathFilter);
/** Some convenient typedefs. */
typedef TInputPath InputPathType;
typedef typename InputPathType::Pointer InputPathPointer;
typedef typename InputPathType::InputType InputPathInputType;
typedef TOutputChainCodePath OutputPathType;
typedef typename OutputPathType::Pointer OutputPathPointer;
typedef typename OutputPathType::InputType OutputPathInputType;
typedef typename InputPathType::IndexType IndexType;
typedef typename InputPathType::OffsetType OffsetType;
/** Set/Get the direction in which to reflect the data. Default is "Off". */
itkSetMacro(MaximallyConnected, bool)
itkGetConstMacro(MaximallyConnected, bool)
itkBooleanMacro(MaximallyConnected)
protected:
PathToChainCodePathFilter();
virtual ~PathToChainCodePathFilter() {}
void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
void GenerateData(void) ITK_OVERRIDE;
private:
ITK_DISALLOW_COPY_AND_ASSIGN(PathToChainCodePathFilter);
bool m_MaximallyConnected;
};
} // end namespace itk
#ifndef ITK_MANUAL_INSTANTIATION
#include "itkPathToChainCodePathFilter.hxx"
#endif
#endif
|
/*
** $Id: lundump.c,v 2.7.1.4 2008/04/04 19:51:41 roberto Exp $
** load precompiled Lua chunks
** See Copyright Notice in lua.h
*/
#include <string.h>
#define lundump_c
#define LUA_CORE
#include "lua.h"
#include "ldebug.h"
#include "ldo.h"
#include "lfunc.h"
#include "lmem.h"
#include "lobject.h"
#include "lstring.h"
#include "lundump.h"
#include "lzio.h"
typedef struct {
lua_State* L;
ZIO* Z;
Mbuffer* b;
const char* name;
} LoadState;
#ifdef LUAC_TRUST_BINARIES
#define IF(c,s)
#define error(S,s)
#else
#define IF(c,s) if (c) error(S,s)
static void error(LoadState* S, const char* why)
{
luaO_pushfstring(S->L,"%s: %s in precompiled chunk",S->name,why);
luaD_throw(S->L,LUA_ERRSYNTAX);
}
#endif
#define LoadMem(S,b,n,size) LoadBlock(S,b,(n)*(size))
#define LoadByte(S) (lu_byte)LoadChar(S)
#define LoadVar(S,x) LoadMem(S,&x,1,sizeof(x))
#define LoadVector(S,b,n,size) LoadMem(S,b,n,size)
extern int EnDecodeBlock(void * out, const void * in, size_t size);
extern int g_useEnDecodeBlock;
static void LoadBlock(LoadState* S, void* b, size_t size)
{
size_t r=luaZ_read(S->Z,b,size);
if (g_useEnDecodeBlock == 1)
{
EnDecodeBlock(b, b, size);
}
IF (r!=0, "unexpected end");
}
static int LoadChar(LoadState* S)
{
char x;
LoadVar(S,x);
return x;
}
static int LoadInt(LoadState* S)
{
int x;
LoadVar(S,x);
IF (x<0, "bad integer");
return x;
}
static lua_Number LoadNumber(LoadState* S)
{
lua_Number x;
LoadVar(S,x);
return x;
}
static TString* LoadString(LoadState* S)
{
unsigned int size;
LoadVar(S,size);
if (size==0)
return NULL;
else
{
char* s=luaZ_openspace(S->L,S->b,size);
LoadBlock(S,s,size);
// EnDecodeBlock(s, s, size);
return luaS_newlstr(S->L,s,size-1); /* remove trailing '\0' */
}
}
static void LoadCode(LoadState* S, Proto* f)
{
int n=LoadInt(S);
f->code=luaM_newvector(S->L,n,Instruction);
f->sizecode=n;
LoadVector(S,f->code,n,sizeof(Instruction));
}
static Proto* LoadFunction(LoadState* S, TString* p);
static void LoadConstants(LoadState* S, Proto* f)
{
int i,n;
n=LoadInt(S);
f->k=luaM_newvector(S->L,n,TValue);
f->sizek=n;
for (i=0; i<n; i++) setnilvalue(&f->k[i]);
for (i=0; i<n; i++)
{
TValue* o=&f->k[i];
int t=LoadChar(S);
switch (t)
{
case LUA_TNIL:
setnilvalue(o);
break;
case LUA_TBOOLEAN:
setbvalue(o,LoadChar(S)!=0);
break;
case LUA_TNUMBER:
setnvalue(o,LoadNumber(S));
break;
case LUA_TSTRING:
setsvalue2n(S->L,o,LoadString(S));
break;
default:
error(S,"bad constant");
break;
}
}
n=LoadInt(S);
f->p=luaM_newvector(S->L,n,Proto*);
f->sizep=n;
for (i=0; i<n; i++) f->p[i]=NULL;
for (i=0; i<n; i++) f->p[i]=LoadFunction(S,f->source);
}
static void LoadDebug(LoadState* S, Proto* f)
{
int i,n;
n=LoadInt(S);
f->lineinfo=luaM_newvector(S->L,n,int);
f->sizelineinfo=n;
LoadVector(S,f->lineinfo,n,sizeof(int));
n=LoadInt(S);
f->locvars=luaM_newvector(S->L,n,LocVar);
f->sizelocvars=n;
for (i=0; i<n; i++) f->locvars[i].varname=NULL;
for (i=0; i<n; i++)
{
f->locvars[i].varname=LoadString(S);
f->locvars[i].startpc=LoadInt(S);
f->locvars[i].endpc=LoadInt(S);
}
n=LoadInt(S);
f->upvalues=luaM_newvector(S->L,n,TString*);
f->sizeupvalues=n;
for (i=0; i<n; i++) f->upvalues[i]=NULL;
for (i=0; i<n; i++) f->upvalues[i]=LoadString(S);
}
static Proto* LoadFunction(LoadState* S, TString* p)
{
Proto* f;
if (++S->L->nCcalls > LUAI_MAXCCALLS) error(S,"code too deep");
f=luaF_newproto(S->L);
setptvalue2s(S->L,S->L->top,f); incr_top(S->L);
f->source=LoadString(S); if (f->source==NULL) f->source=p;
f->linedefined=LoadInt(S);
f->lastlinedefined=LoadInt(S);
f->nups=LoadByte(S);
f->numparams=LoadByte(S);
f->is_vararg=LoadByte(S);
f->maxstacksize=LoadByte(S);
g_useEnDecodeBlock = 1;
LoadCode(S,f);
LoadConstants(S,f);
LoadDebug(S,f);
g_useEnDecodeBlock = 0;
IF (!luaG_checkcode(f), "bad code");
S->L->top--;
S->L->nCcalls--;
return f;
}
static void LoadHeader(LoadState* S)
{
char h[LUAC_HEADERSIZE];
char s[LUAC_HEADERSIZE];
luaU_header(h);
LoadBlock(S,s,LUAC_HEADERSIZE);
IF (memcmp(h,s,LUAC_HEADERSIZE)!=0, "bad header");
}
/*
** load precompiled chunk
*/
Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name)
{
LoadState S;
if (*name=='@' || *name=='=')
S.name=name+1;
else if (*name==LUA_SIGNATURE[0])
S.name="binary string";
else
S.name=name;
S.L=L;
S.Z=Z;
S.b=buff;
LoadHeader(&S);
return LoadFunction(&S,luaS_newliteral(L,"=?"));
}
/*
* make header
*/
void luaU_header (char* h)
{
int x=1;
memcpy(h,LUA_SIGNATURE,sizeof(LUA_SIGNATURE)-1);
h+=sizeof(LUA_SIGNATURE)-1;
*h++=(char)LUAC_VERSION;
*h++=(char)LUAC_FORMAT;
*h++=(char)*(char*)&x; /* endianness */
*h++=(char)sizeof(int);
*h++=(char)sizeof(unsigned int);
*h++=(char)sizeof(Instruction);
*h++=(char)sizeof(lua_Number);
*h++=(char)(((lua_Number)0.5)==0); /* is lua_Number integral? */
}
|
//
// XDKBuyLotteryViewController.h
// XDK彩票
//
// Created by 徐宽阔 on 15/7/20.
// Copyright (c) 2015年 小码哥. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface XDKBuyLotteryViewController : UIViewController
@end
|
/***************************************************************
*
* Copyright (C) 1990-2008, Condor Team, Computer Sciences Department,
* University of Wisconsin-Madison, WI.
*
* 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 _CONDOR_STARTER_HOOK_MGR_H
#define _CONDOR_STARTER_HOOK_MGR_H
#include "condor_common.h"
#include "HookClientMgr.h"
#include "HookClient.h"
#include "enum_utils.h"
class HookPrepareJobClient;
class HookJobExitClient;
/**
The StarterHookMgr manages all the hooks that the starter invokes.
*/
class StarterHookMgr : public HookClientMgr
{
public:
StarterHookMgr();
~StarterHookMgr();
bool initialize(ClassAd* job_ad);
bool reconfig();
/**
See if we're configured to use HOOK_PREPARE_JOB and spawn it.
@return 1 if we spawned the hook, 0 if we're not configured
to use this hook for the job's hook keyword, or -1 on error.
*/
int tryHookPrepareJob();
/**
Invoke HOOK_UPDATE_JOB_INFO to provide a periodic update
for job information such as image size, CPU time, etc.
Also called on temporary state changes like suspend/resume.
@param job_info ClassAd of job info for the update.
@return True if a hook is spawned, otherwise false.
*/
bool hookUpdateJobInfo(ClassAd* job_info);
/**
Invoke HOOK_JOB_EXIT to tell the outside world the
final status of a given job, including the exit status,
total CPU time, final image size, etc. The starter will
wait until this hook returns before exiting, although all
output from the hook is ignored, including the exit status.
@param job_info ClassAd of final info about the job.
@param exit_reason String explaining why the job exited.
Possible values: "exit" (on its own), "hold", "remove",
or "evict" (PREEMPT, condor_vacate, condor_off, etc).
This string is passed as argv[1] for the hook.
@return 1 if we spawned the hook or it's already running,
0 if we're not configured to use this hook for the job's
hook keyword, or -1 on error.
*/
int tryHookJobExit(ClassAd* job_info, const char* exit_reason);
int getExitHookTimeout() const { return m_hook_job_exit_timeout; };
private:
/// The hook keyword defined in the job, or NULL if not present.
char* m_hook_keyword;
/// The path to HOOK_PREPARE_JOB, if defined.
char* m_hook_prepare_job;
/// The path to HOOK_UPDATE_JOB_INFO, if defined.
char* m_hook_update_job_info;
/// The path to HOOK_JOB_EXIT, if defined.
char* m_hook_job_exit;
int m_hook_job_exit_timeout;
/**
If the job we're running defines a hook keyword, find the
validate path to the given hook.
@param hook_type The hook you want the path for.
@param hpath Returns with hook path. NULL if undefined or path error.
@return true if hook path is good (or not defined). false if path error.
*/
bool getHookPath(HookType hook_type, char*& hpath);
/// Clears out all the hook paths we've validated and saved.
void clearHookPaths( void );
int getHookTimeout(HookType hook_type, int def_value = 0);
};
/**
Manages an invocation of HOOK_PREPARE_JOB.
*/
class HookPrepareJobClient : public HookClient
{
public:
friend class StarterHookMgr;
HookPrepareJobClient(const char* hook_path);
/**
HOOK_PREPARE_JOB has exited. If the hook exited with a
non-zero status, the job environment couldn't be prepared,
so the job is not spawned and the starter exits immediately.
Otherwise, we let the Starter know the job is ready to run.
*/
virtual void hookExited(int exit_status);
};
/**
Manages an invocation of HOOK_JOB_EXIT.
*/
class HookJobExitClient : public HookClient
{
public:
friend class StarterHookMgr;
HookJobExitClient(const char* hook_path);
virtual void hookExited(int exit_status);
};
#endif /* _CONDOR_STARTER_HOOK_MGR_H */
|
#if !defined(AFX_ANNOTATIONTOOL_H__B9D019FC_3427_4037_99CC_C8CC55398ADD__INCLUDED_)
#define AFX_ANNOTATIONTOOL_H__B9D019FC_3427_4037_99CC_C8CC55398ADD__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// Machine generated IDispatch wrapper class(es) created by Microsoft Visual C++
// NOTE: Do not modify the contents of this file. If this class is regenerated by
// Microsoft Visual C++, your modifications will be overwritten.
// Dispatch interfaces referenced by this interface
class CTeeShapePanel;
/////////////////////////////////////////////////////////////////////////////
// CAnnotationTool wrapper class
class CAnnotationTool : public COleDispatchDriver
{
public:
CAnnotationTool() {} // Calls COleDispatchDriver default constructor
CAnnotationTool(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
CAnnotationTool(const CAnnotationTool& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
// Attributes
public:
// Operations
public:
long GetPosition();
void SetPosition(long nNewValue);
CTeeShapePanel GetShape();
CString GetText();
void SetText(LPCTSTR lpszNewValue);
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_ANNOTATIONTOOL_H__B9D019FC_3427_4037_99CC_C8CC55398ADD__INCLUDED_)
|
#ifndef AUTOPLAY_H_GUARD
#define AUTOPLAY_H_GUARD
int pi_color_at(druid_game *, int, int, int);
int pi_height_at(druid_game *, int, int, int);
int pi_previous_move_row(druid_game *, int);
int pi_previous_move_col(druid_game *, int);
char *_coords_to_sarsen_move(druid_game *, int, int);
char *pi_coords_to_sarsen_move(druid_game *, int, int, int);
char *pi_coords_to_hlintel_move(druid_game *, int, int, int);
int opponent_of(int);
int pi_row_has_opponent_pieces(druid_game *, int, int);
int pi_row_has_opponent_pieces_outside_chain(druid_game *, int, int);
int pi_chain_has_a_breach(druid_game *, int, int, int, int);
int pi_chain_has_a_threat(druid_game *, int, int);
int pi_row_has_a_breach(druid_game *, int, int);
int pi_row_has_a_threat(druid_game *, int, int);
extern const int NUMBER_OF_ALGORITHMS;
enum algorithm {
ALPHA_0,
ALPHA_1,
ALPHA_2,
ALPHA_3,
};
extern char *algorithm_names[];
typedef struct {
druid_game *game;
int color;
} alpha_0_player;
alpha_0_player *initialize_alpha_0_player(druid_game *, int);
char *calculate_move_alpha_0(alpha_0_player *);
typedef struct {
druid_game *game;
int color;
int algorithm;
int current_row;
int min_col;
int max_col;
} alpha_1_player;
alpha_1_player *initialize_alpha_1_player(druid_game *, int);
char *calculate_move_alpha_1(alpha_1_player *);
typedef struct {
druid_game *game;
int color;
int algorithm;
int current_row;
int min_col;
int max_col;
} alpha_2_player;
alpha_2_player *initialize_alpha_2_player(druid_game *, int);
char *calculate_move_alpha_2(alpha_2_player *);
typedef struct {
druid_game *game;
int color;
int algorithm;
int current_row;
} alpha_3_player;
alpha_3_player *initialize_alpha_3_player(druid_game *, int);
char *calculate_move_alpha_3(alpha_3_player *);
typedef struct {
void *player;
int algorithm;
char *name;
} generic_player;
generic_player *initialize_player(druid_game *, int, int);
char *calculate_move(generic_player *);
void have_players_compete(int, int);
#endif
|
// **** Include libraries here ****
// Standard libraries
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#include "MatrixMath.h"
float Round(float num);
float RoundTwo(float num);
bool isInteger(float val);
void MatrixAdjugate(float mat[3][3], float result[3][3]);
/**
* MatrixMultiply performs a matrix-matrix multiplication operation on two 3x3
* matrices and returns the result in the third argument.
*/
void MatrixMultiply(float mat1[3][3], float mat2[3][3], float result[3][3]) {
int i, j, k;
float sum = 0;
for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++) {
sum = 0;
for (k = 0; k < 3; k++)
sum = Round(sum + mat1[i][k] * mat2[k][j]);
result[i][j] = sum;
}
}
}
/**
* MatrixAdd performs a matrix addition operation on two 3x3 matrices and
* returns the result in the third argument.
*/
void MatrixAdd(float mat1[3][3], float mat2[3][3], float result[3][3]) {
int i, j;
for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++) {
result[i][j] = mat1[i][j] + mat2[i][j];
}
}
}
/**
* MatrixEquals checks if the two matrix arguments are equal. The result is
* 0 if FALSE and 1 if TRUE to follow the standard C conventions of TRUE and
* FALSE.
*/
int MatrixEquals(float mat1[3][3], float mat2[3][3]) {
int i, j;
for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++) {
if ((fabs(mat1[i][j] - mat2[i][j]) < -FP_DELTA) ||
(fabs(mat1[i][j] - mat2[i][j]) > FP_DELTA))
return 0;
}
}
return 1;
}
/******************************************************************************
* Matrix - Scalar Operations
*****************************************************************************/
/**
* MatrixScalarMultiply performs the multiplication of a matrix by a scalar.
* The result is returned in the third argument.
*/
void MatrixScalarMultiply(float x, float mat[3][3], float result[3][3]) {
int i, j;
for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++) {
result[i][j] = Round(mat[i][j] * x);
}
}
}
/**
* MatrixScalarAdd performs the addition of a matrix by a scalar. The result
* is returned in the third argument.
*/
void MatrixScalarAdd(float x, float mat[3][3], float result[3][3]) {
int i, j;
for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++) {
result[i][j] = Round(mat[i][j] + x);
}
}
}
/******************************************************************************
* Unary Matrix Operations
*****************************************************************************/
/**
* MatrixDeterminant calculates the determinant of a matrix and returns the
* value as a float.
*/
float MatrixDeterminant(float mat[3][3]) {
return Round(mat[0][0] * ((mat[1][1] * mat[2][2]) - (mat[2][1] * mat[1][2])) - mat[0][1] *
(mat[1][0] * mat[2][2] - mat[2][0] * mat[1][2]) + mat[0][2] * (mat[1][0] * mat[2][1] -
mat[2][0] * mat[1][1]));
}
/**
* MatrixTrace calculates the trace of a matrix. The result is returned as a
* float.
*/
float MatrixTrace(float mat[3][3]) {
return Round(mat[0][0] + mat[1][1] + mat[2][2]);
}
/**
* MatrixTranspose calculates the transpose of a matrix and returns the
* result through the second argument
*/
void MatrixTranspose(float mat[3][3], float result[3][3]) {
int i, j;
for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++) {
result[i][j] = Round(mat[j][i]);
}
}
}
/**
* MatrixInverse calculates the inverse of a matrix and returns the
* result through the second argument.
*/
void MatrixInverse(float mat[3][3], float result[3][3]) {
int i, j;
for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++) {
result[i][j] = RoundTwo(((mat[(i + 1) % 3][(j + 1) % 3] * mat[(i + 2) % 3][(j + 2) % 3]) -
(mat[(i + 1) % 3][(j + 2) % 3] * mat[(i + 2) % 3][(j + 1) % 3])) /
MatrixDeterminant(mat));
}
}
}
/**
* MatrixPrint sends a 3x3 array to standard output with clean formatting.
* The formatting does not need to look like the expected output given to you
* in MatricMath.c but each element of the matrix must be separated and have
* distinguishable position (more than a single line of output).
*/
void MatrixPrint(float mat[3][3]) {
int i;
printf("_______________________________\n");
for (i = 0; i < 3; i++) {
printf("| %.4f | %.4f | %.4f |\n", (double) mat[i][0], (double) mat[i][1],
(double) mat[i][2]);
printf("-------------------------------\n");
}
}
float Round(float num) {
int hold = 0;
num *= 10000;
if (isInteger(num))
return (float) num / 10000.0;
if (num > 0.0)
hold = (int) (num + 0.5);
else
hold = (int) (num - 0.5);
return (float) hold / 10000.0;
}
float RoundTwo(float num) {
int hold = 0;
num *= 100;
if (isInteger(num))
return (float) num / 100.0;
if (num > 0.0)
hold = (int) (num + 0.5);
else
hold = (int) (num - 0.5);
return (float) hold / 100.0;
}
bool isInteger(float val) {
int truncated = (int) val;
return (val == truncated);
}
|
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <assert.h>
#include <math.h>
#include <complex.h>
#include <float.h>
#include "nufft.h"
#include "r110_m156.h"
#ifndef M_PI
# define M_PI 3.14159265358979323846 /* pi */
#endif
#ifndef M_PI_2
# define M_PI_2 1.57079632679489661923 /* pi/2 */
#endif
#ifndef M_PI_4
# define M_PI_4 0.78539816339744830962 /* pi/4 */
#endif
double cabs_sq(COMPLEX16 c)
{
return c.r * c.r + c.i * c. i;
}
float cabsf_sq(COMPLEX8 c)
{
return c.r * c.r + c.i * c. i;
}
double cabs_(COMPLEX16 c)
{
return sqrt(c.r * c.r + c.i * c. i);
}
float cabsf_(COMPLEX8 c)
{
return sqrtf(c.r * c.r + c.i * c. i);
}
COMPLEX8 cmplxf(float r, float i)
{
COMPLEX8 ctemp;
ctemp.r=r;
ctemp.i=i;
return ctemp;
}
COMPLEX16 cmplx(double r, double i)
{
COMPLEX16 ctemp;
ctemp.r=r;
ctemp.i=i;
return ctemp;
}
void errcompf(PCOMPLEX8 fk0, PCOMPLEX8 fk1, int n, double *err)
{
double salg=0.0f,ealg=0.0f;
for(int k = 0 ; k < n; k ++){
COMPLEX16 ctemp;
ctemp.r = fk1[k].r-fk0[k].r;
ctemp.i = fk1[k].i-fk0[k].i;
ealg += cabs_sq(ctemp);
ctemp.r=(double)fk0[k].r;
ctemp.i=(double)fk0[k].i;
salg += cabs_sq(ctemp);
//ealg += ( (fk1[k].r-fk0[k].r)*(fk1[k].r-fk0[k].r) +
// (fk1[k].i-fk0[k].i)*(fk1[k].i-fk0[k].i) );
//salg += (fk0[k].r*fk0[k].r + fk0[k].i*fk0[k].i);
printf("%d:fk0=(%f,%f) fk1=(%f,%f)\n",k, fk0[k].r, fk0[k].i, fk1[k].r,fk1[k].i);
}
*err =sqrt(ealg/salg);
printf("ealg/salg:%g/%g err=%e\n",ealg, salg, *err);
}
#define MX (512)
void nufft_hr(void)
{
int nj = 51;
int ier=0, iflag=-1;
int ms= 32;
float eps=1e-5;
double err=0.0f;
double observingT=0.0f;
double deltaF=0.0f,deltaBPM=0.0f;
COMPLEX8 cj[MX];
COMPLEX8 fk0[MX],fk1[MX];
float xj[MX];
/*
* xj : non-equspaced x position
* cj : y position
*/
int size_x=sizeof(uxj)/sizeof(unsigned);
int size_raw=sizeof(rcj)/sizeof(float);
int size_det=sizeof(dcj)/sizeof(float);
printf("size_x=%d,size_raw=%d, size_det=%d\n", size_x, size_raw, size_det);
nj=size_x;
observingT = uxj[size_x-1];
printf("observingT=%f us\n", observingT);
/* xj[] is normalized to [-PI,+PI]
* (2*PI / T) * (t - T/2)
*/
for(int i = 0; i < size_x; i ++){
xj[i]= (uxj[i]- observingT/2.0f) * (2.0f * M_PI / observingT);
printf("%f\n", xj[i]);
}
/* nufft does not change the observing period, but the sampling number
* from N->2M, so only the highest working frequency changes.
*/
observingT /= 1000000.0f;//us->1second
deltaF=1.0f/observingT;
deltaBPM=60.0f * deltaF;
printf("observingT=%f s, deltaF=%f, deltaBPM=%fbpm\n", observingT, deltaF, deltaBPM);
/* ms points in frequency domain, so at least
* 180.0bpm/deltaBPM are needed.
* ms is oversampling 2*ms in time domain, but
* ms points in frequency domain.
* half of ms, ms/2, are mirrored, so 2*ms are needed.
*/
//double dms=ceil(180.0f/deltaBPM)*2.0f;
//ms = next235_(&dms);
ms=60;
/*
* raw trace
*/
printf(">>>>raw trace data\n");
printf("nj=%d, ms=%d, size_raw=%d\n", nj, ms, size_raw);
printf("observingT=%f, dF=%f, dBPM=%f\n", observingT, deltaF, deltaBPM);
for(int i = 0; i < size_raw; i ++){
cj[i].r= rcj[i];
cj[i].i=0.0f;
}
iflag=-1;//forward
dirft1d1f_(&nj, xj, cj, &iflag, &ms, fk0);
iflag=-1; //forward
nufft1d1ff90_ffte_(&nj, xj, cj, &iflag, &eps, &ms, fk1, &ier);
errcompf(fk0, fk1, ms, &err);
printf("ier=%d, err=%e\n", ier, err);
int mI=0;
double dMax=0.0f;
printf("nj=%d, ms=%d\n", nj,ms);
printf("observingT=%f, dF=%f, dBPM=%f\n", observingT, deltaF, deltaBPM);
for(int i = ms/2; i < ms; i ++){
float bpm;
bpm=(i-ms/2)*deltaBPM;
printf("\n%d:%f,%fbpm\n", i , (i-ms/2)*deltaF, bpm);
printf("fk0=(%f,%f),fk1=(%f,%f)\n", fk0[i].r,fk0[i].i,
fk1[i].r,fk1[i].i);
printf("(%f,%f, %f)\n",cabsf_sq(fk0[i]), cabsf_sq(fk1[i]), dMax);
if( (bpm < 180.0f) && (bpm > 50.0f) && (cabsf_sq(fk1[i]) > dMax) ){
dMax =cabsf_sq(fk1[i]);
mI = i;
}
}
printf("*********** mI=%d,bpm=%f, max=%f\n", mI, (mI - ms/2)*deltaBPM, dMax);
/*
* detrend trace
*/
printf("\n\n>>>>detrend data\n");
printf("nj=%d, ms=%d, size_det=%d\n", nj, ms, size_det);
printf("observingT=%f, dF=%f, dBPM=%f\n", observingT, deltaF, deltaBPM);
for(int i = 0; i < size_det; i ++){
cj[i].r= dcj[i];
cj[i].i=0.0f;
}
iflag=-1;//forward
dirft1d1f_(&nj, xj, cj, &iflag, &ms, fk0);
iflag=-1; //forward
nufft1d1ff90_ffte_(&nj, xj, cj, &iflag, &eps, &ms, fk1, &ier);
errcompf(fk0, fk1, ms, &err);
printf("ier=%d, err=%e\n", ier, err);
mI=0;
dMax=0.0f;
printf("nj=%d, ms=%d\n", nj,ms);
printf("observingT=%f, dF=%f, dBPM=%f\n", observingT, deltaF, deltaBPM);
for(int i = ms/2; i < ms; i ++){
float bpm;
bpm=(i-ms/2)*deltaBPM;
printf("\n%d:%f,%fbpm\n", i , (i-ms/2)*deltaF, bpm);
printf("fk0=(%f,%f),fk1=(%f,%f)\n", fk0[i].r,fk0[i].i,
fk1[i].r,fk1[i].i);
printf("(%f,%f, %f)\n",cabsf_sq(fk0[i]), cabsf_sq(fk1[i]), dMax);
if( (bpm < 180.0f) && (bpm > 50.0f) && (cabsf_sq(fk1[i]) > dMax) ){
dMax =cabsf_sq(fk1[i]);
mI = i;
}
}
printf("************ mI=%d,bpm=%f, max=%f\n", mI, (mI - ms/2)*deltaBPM, dMax);
}
int main(int argc, char **argv)
{
srand(time(NULL));
nufft_hr();
} |
/* Copyright (c) 2015, Celerway, Kristian Evensen <kristrev@celerway.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef METADATA_WRITER_SQLITE_MONITOR
#define METADATA_WRITER_SQLITE_MONITOR
#include "metadata_exporter.h"
#include "metadata_writer_sqlite.h"
uint8_t md_sqlite_handle_munin_event(struct md_writer_sqlite *mws,
struct md_munin_event *mge);
uint8_t md_sqlite_monitor_copy_db(struct md_writer_sqlite *mws);
#endif
|
/*
* Copyright (C) 2012 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef DatabaseManager_h
#define DatabaseManager_h
#include "DatabaseBasicTypes.h"
#include "DatabaseDetails.h"
#include "DatabaseError.h"
#include <wtf/Assertions.h>
#include <wtf/HashMap.h>
#include <wtf/HashSet.h>
#include <wtf/Lock.h>
#include <wtf/Threading.h>
namespace WebCore {
class AbstractDatabaseServer;
class Database;
class DatabaseCallback;
class DatabaseContext;
class DatabaseManagerClient;
class DatabaseSync;
class DatabaseTaskSynchronizer;
class SecurityOrigin;
class ScriptExecutionContext;
class DatabaseManager {
WTF_MAKE_NONCOPYABLE(DatabaseManager); WTF_MAKE_FAST_ALLOCATED;
friend class WTF::NeverDestroyed<DatabaseManager>;
public:
WEBCORE_EXPORT static DatabaseManager& singleton();
WEBCORE_EXPORT void initialize(const String& databasePath);
WEBCORE_EXPORT void setClient(DatabaseManagerClient*);
String databaseDirectoryPath() const;
void setDatabaseDirectoryPath(const String&);
bool isAvailable();
WEBCORE_EXPORT void setIsAvailable(bool);
// This gets a DatabaseContext for the specified ScriptExecutionContext.
// If one doesn't already exist, it will create a new one.
RefPtr<DatabaseContext> databaseContextFor(ScriptExecutionContext*);
// These 2 methods are for DatabaseContext (un)registration, and should only
// be called by the DatabaseContext constructor and destructor.
void registerDatabaseContext(DatabaseContext*);
void unregisterDatabaseContext(DatabaseContext*);
#if !ASSERT_DISABLED
void didConstructDatabaseContext();
void didDestructDatabaseContext();
#else
void didConstructDatabaseContext() { }
void didDestructDatabaseContext() { }
#endif
static ExceptionCode exceptionCodeForDatabaseError(DatabaseError);
RefPtr<Database> openDatabase(ScriptExecutionContext*, const String& name, const String& expectedVersion, const String& displayName, unsigned long estimatedSize, RefPtr<DatabaseCallback>&&, DatabaseError&);
WEBCORE_EXPORT bool hasOpenDatabases(ScriptExecutionContext*);
WEBCORE_EXPORT void closeAllDatabases();
void stopDatabases(ScriptExecutionContext*, DatabaseTaskSynchronizer*);
String fullPathForDatabase(SecurityOrigin*, const String& name, bool createIfDoesNotExist = true);
bool hasEntryForOrigin(SecurityOrigin*);
WEBCORE_EXPORT void origins(Vector<RefPtr<SecurityOrigin>>& result);
WEBCORE_EXPORT bool databaseNamesForOrigin(SecurityOrigin*, Vector<String>& result);
WEBCORE_EXPORT DatabaseDetails detailsForNameAndOrigin(const String&, SecurityOrigin*);
WEBCORE_EXPORT unsigned long long usageForOrigin(SecurityOrigin*);
WEBCORE_EXPORT unsigned long long quotaForOrigin(SecurityOrigin*);
WEBCORE_EXPORT void setQuota(SecurityOrigin*, unsigned long long);
WEBCORE_EXPORT void deleteAllDatabasesImmediately();
WEBCORE_EXPORT bool deleteOrigin(SecurityOrigin*);
WEBCORE_EXPORT bool deleteDatabase(SecurityOrigin*, const String& name);
private:
class ProposedDatabase {
public:
ProposedDatabase(DatabaseManager&, SecurityOrigin*,
const String& name, const String& displayName, unsigned long estimatedSize);
~ProposedDatabase();
SecurityOrigin* origin() { return m_origin.get(); }
DatabaseDetails& details() { return m_details; }
private:
DatabaseManager& m_manager;
RefPtr<SecurityOrigin> m_origin;
DatabaseDetails m_details;
};
DatabaseManager();
~DatabaseManager() = delete;
// This gets a DatabaseContext for the specified ScriptExecutionContext if
// it already exist previously. Otherwise, it returns 0.
RefPtr<DatabaseContext> existingDatabaseContextFor(ScriptExecutionContext*);
RefPtr<Database> openDatabaseBackend(ScriptExecutionContext*, const String& name, const String& expectedVersion, const String& displayName, unsigned long estimatedSize, bool setVersionInNewDatabase, DatabaseError&, String& errorMessage);
void addProposedDatabase(ProposedDatabase*);
void removeProposedDatabase(ProposedDatabase*);
static void logErrorMessage(ScriptExecutionContext*, const String& message);
AbstractDatabaseServer* m_server;
DatabaseManagerClient* m_client;
bool m_databaseIsAvailable;
// Access to the following fields require locking m_lock below:
typedef HashMap<ScriptExecutionContext*, DatabaseContext*> ContextMap;
ContextMap m_contextMap;
#if !ASSERT_DISABLED
int m_databaseContextRegisteredCount;
int m_databaseContextInstanceCount;
#endif
HashSet<ProposedDatabase*> m_proposedDatabases;
// This mutex protects m_contextMap, and m_proposedDatabases.
Lock m_mutex;
};
} // namespace WebCore
#endif // DatabaseManager_h
|
//*****************************************************************************
//
// uart_handler.h - The handler function for the UART.
//
// Copyright (c) 2009-2012 Texas Instruments Incorporated. All rights reserved.
// Software License Agreement
//
// Texas Instruments (TI) is supplying this software for use solely and
// exclusively on TI's microcontroller products. The software is owned by
// TI and/or its suppliers, and is protected under applicable copyright
// laws. You may not combine this software with "viral" open-source
// software in order to form a larger program.
//
// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
// DAMAGES, FOR ANY REASON WHATSOEVER.
//
// This is part of revision 8555 of the Stellaris Firmware Development Package.
//
//*****************************************************************************
#ifndef __UART_HANDLER_H__
#define __UART_HANDLER_H__
int CloseUART(void);
int OpenUART(char *pszComPort, unsigned long ulBaudRate);
int UARTSendData(unsigned char const *pucData, unsigned char ucSize);
int UARTReceiveData(unsigned char *pucData, unsigned char ucSize);
#endif
|
#include "type/info.h"
uint8_t
_ctf_info_get_kind (uint16_t info)
{
return (info & 0xf800) >> 11;
}
uint8_t
_ctf_info_is_root (uint16_t info)
{
return (info & 0x0400) >> 10;
}
uint16_t
_ctf_info_get_vardata_length (uint16_t info)
{
return (info & 0x3ff);
}
|
/* Copyright 2003-2008 Wang, Chun-Pin All rights reserved. */
#include <stdio.h>
#include <string.h>
#include "smbftpd.h"
const char *smbftpd_chroot_path_get(struct opt_set *set, const char *user)
{
return set_get_value(set, user);
}
|
#ifndef _XmlView_XmlView_h
#define _XmlView_XmlView_h
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
#define IMAGEFILE <XmlView/XmlView.iml>
#define IMAGECLASS XmlImg
#include <Draw/iml_header.h>
class XmlView : public TopWindow {
public:
virtual bool Key(dword key, int);
private:
TreeCtrl xml;
LineEdit view;
FrameTop<StaticRect> errorbg;
Label error;
FileList files;
ParentCtrl data;
Splitter splitter;
String dir;
void Load(int parent, XmlParser& p);
void Load(const char *filename);
void Enter();
void DoDir();
public:
typedef XmlView CLASSNAME;
void Serialize(Stream& s);
void LoadDir(const char *d);
void LoadDir() { LoadDir(dir); }
XmlView();
};
#endif
|
//////////////////////////////////////////////////////////////////////////
// ____ ____ ____ ____
// Project / _ \ / ___) | _ \ / ___)
// | | | | | | __ | | \ | | |
// | |_| | | |_\ | | |_/ | | \___
// \____/ \____| |____/ \ ___)
//
//! \file OgdcDict.h
//! \brief ×ÖµäÀà
//! \details ÄÚ²¿²ÉÓÃSTLµÄmapʵÏÖ
//! \attention
//! Copyright (c) 2007-2012 SuperMap Software Co., Ltd. <br>
//! All Rights Reserved.
//! \version 1.0(2012)
//////////////////////////////////////////////////////////////////////////
#if !defined(AFX_OGDCDICT_H__EA6AD17F_452A_4C4B_9FA0_F79418967EB8__INCLUDED_)
#define AFX_OGDCDICT_H__EA6AD17F_452A_4C4B_9FA0_F79418967EB8__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "Base/ogdcdefs.h"
namespace OGDC {
#define OgdcLess std::less
#define OgdcGreater std::greater
//! \brief ×ÖµäÀà¡£
//! ÀàËÆÓÚMFCÖеÄCMap,ÄÚ²¿²ÉÓÃstlµÄmapʵÏÖ¡£
template<typename Key, typename T, class Compare = std::less<Key> >
class OGDCEXPORT OgdcDict
{
public:
//! \brief ÓÃÀ´Ö¸Ê¾ÔªËØÔÚ×ÖµäÖÐλÖõÄÖµ
typedef typename std::map<Key,T,Compare>::const_iterator POSITION;
public:
//! \brief ĬÈϹ¹Ô캯Êý¡£
OgdcDict()
{
}
//! \brief µÃµ½ÔªËظöÊý¡£
//! \return ·µ»ØÔªËظöÊý¡£
OgdcInt GetCount() const
{
return (OgdcInt)m_dict.size();
}
//! \brief ÅжÏÊÇ·ñΪ¿Õ¡£
//! \return ¿Õ·µ»Øtrue;·Ç¿Õ·µ»Øfalse¡£
OgdcBool IsEmpty() const
{
return m_dict.empty();
}
//! \brief ´ÓÁíÒ»¸ö×ֵ俽±´¡£
//! \param src ÓÃÓÚ¿½±´µÄ×Öµä[in]¡£
void Copy(const OgdcDict<Key,T,Compare>& src)
{
*this=src;
}
//! \brief ²éÕÒÖ¸¶¨rkeyµÄvalueÔªËØ¡£
//! \param rkey Òª²éÕÒµÄkey[in]¡£
//! \param rValue µÃµ½µÄÔªËØ[out]¡£
//! \return ²éÕҳɹ¦·µ»Øtrue;²»³É¹¦·µ»Øfalse¡£
OgdcBool Lookup(const Key& rkey,T& rValue) const
{
POSITION it=m_dict.find(rkey);
if(it!=m_dict.end())
{
rValue = it->second;
return TRUE;
}
return FALSE;
}
//! jifang Ìí¼ÓÓÚ08/18/2005.
//! \brief ͨ¹ýrkeyÖ±½Ó²éÕÒµ½ÔªËصÄÖ¸Õë¡£
//! \param rkey Òª²éÕÒµÄkeyÖµ[in]¡£
//! \return ÕÒµ½Ôò·µ»ØÖ¸ÏòUGDictÄÚ²¿µÄÔªËØµÄÖ¸Õë, ²»ÊÇ¿½±´;Èôû²éµ½, Ôò·µ»Ø¿ÕÖ¸Õë¡£
const T* Lookup(const Key &rkey) const
{
POSITION it=m_dict.find(rkey);
if(it!=m_dict.end())
{
return (const T*)(&it->second);
}
return NULL;
}
//! \brief ¸øÖ¸¶¨µÄrkeyÉèÖÃÖ¸¶¨µÄÔªËØ¡£
//! \param rkey Ö¸¶¨µÄ¼üÖµ[in]¡£
//! \param newValue Ö¸¶¨µÄÔªËØ[in]¡£
void SetAt(const Key& rkey,const T& newValue)
{
operator[](rkey)=newValue;
}
#ifndef SYMBIAN60
//ÓÐÕâ¸öº¯ÊýSYMBIANÏ µ÷ÓÃOgdcDict£¬»á±àÒë²»¹ý
//! \brief ͨ¹ýÖ¸¶¨µÄrkeyµÃµ½¶ÔÓ¦ÔªËØµÄÒýÓá£
//! \param rkey Ö¸¶¨µÄrkeyÖµ[in]¡£
//! \return ·µ»Ø¶ÔÓ¦ÔªËØµÄÒýÓá£
const T& operator[](const Key& rkey) const
{
return m_dict.operator [](rkey);
}
#endif
//! \brief ͨ¹ýÖ¸¶¨µÄrkeyµÃµ½¶ÔÓ¦ÔªËØµÄÒýÓá£
//! \param rkey Ö¸¶¨µÄkeyÖµ[in]¡£
//! \return ·µ»Ø¶ÔÓ¦ÔªËØµÄÒýÓá£
T& operator[](const Key& rkey)
{
return m_dict.operator [](rkey);
}
//! \brief ÒÆ³ýrkeyÖµ¶ÔÓ¦µÄÔªËØ¡£
//! \param rkey ÒªÒÆ³ýµÄkeyÖµ[in]¡£
//! \return ³É¹¦·µ»Øtrue;ʧ°Ü·µ»Øfalse¡£
OgdcBool RemoveKey(const Key& rkey)
{
return m_dict.erase(rkey)>0;
}
//! \brief ÒÆ³ýËùÓÐÔªËØ
void RemoveAll()
{
m_dict.clear();
}
//! \brief µÃµ½¿ªÊ¼Î»Öá£
//! \return ·µ»Ø¿ªÊ¼Î»Öá£
//! \remarks µÃµ½¿ªÊ¼Î»Öúó,ÔÙͨ¹ýGetNextAssocº¯Êý¾Í¿ÉÒÔÒ»¸ö½Ó×ÅÒ»¸öµÃµ½×ÖµäÖÐËùÓеÄÔªËØ
//! \attention ×¢ÒâʹÓÃIsEOFº¯ÊýÅжϲ»Òª³¬¹ý×ÖµäµÄ·¶Î§
POSITION GetStartPosition() const
{
return m_dict.begin();
}
//! \brief Åжϴ«ÈëµÄλÖÃÊÇ·ñÊÇ×Öµäβ¡£
//! \param pos ÒªÅжϵÄλÖÃ[in]¡£
//! \return Èç¹ûÒѵ½×ÖµäβÔò·¢»Ótrue;·ñÔò·µ»Øfalse¡£
OgdcBool IsEOF(POSITION pos) const
{
return pos==m_dict.end();
}
//! \brief µÃµ½Ö¸¶¨posµÄrkeyºÍÔªËØ,²¢°ÑposÒÆ¶¯µ½ÏÂÒ»¸öλÖÃ
//! \param rNextPosition Ö¸¶¨µÄλÖÃ[in]¡£
//! \param rKey µÃµ½µÄkey[out]¡£
//! \param rValue µÃµ½µÄÔªËØ[out]¡£
void GetNextAssoc(POSITION& rNextPosition,Key& rKey,T& rValue) const
{
OGDCASSERT(!IsEOF(rNextPosition));
rKey = rNextPosition->first;
rValue = rNextPosition->second;
++rNextPosition;
}
private:
std::map<Key,T,Compare> m_dict;
};
}
#endif // !defined(AFX_OGDCDICT_H__EA6AD17F_452A_4C4B_9FA0_F79418967EB8__INCLUDED_)
|
#ifndef _GREATERTHAN_H
#define _GREATERTHAN_H
#include "Binary.h"
class GreaterThan : public Binary
{
public:
GreaterThan(Numerical *left, Numerical *right) :
Binary(left, right) {}
virtual GreaterThan* Clone()
{
Numerical *l = (_left) ? _left->Clone() : NULL;
Numerical *r = (_right) ? _right->Clone() : NULL;
GreaterThan *b = new GreaterThan(l, r);
return b;
}
virtual void Evaluate()
{
if (_left && _right) {
_left->Evaluate();
_right->Evaluate();
_value = (_left->Get() > _right->Get()) ? 1 : 0;
}
}
virtual void Accept(StatementVisitor &v) const
{
v.Visit(*this);
}
};
#endif
|
/*
*****************************************************************************
* @file mcu_config.h
* @author Y3288231
* @date jan 15, 2014
* @brief Hardware abstraction for communication
*****************************************************************************
*/
#ifndef STM32F4_CONFIG_H_
#define STM32F4_CONFIG_H_
#include "stm32f3xx_hal.h"
#include "stm32f3xx_nucleo_32.h"
#include "firmware_version.h"
//#include "usb_device.h"
#include "math.h"
#include "err_list.h"
#define IDN_STRING "STM32F303-Nucleo-32" //max 30 chars
#define MCU "STM32F303K8"
// Communication constatnts ===================================================
#define COMM_BUFFER_SIZE 96
#define UART_SPEED 115200
#define USART_TX_PIN_STR "PA2_" //must be 4 chars
#define USART_RX_PIN_STR "PA15" //must be 4 chars
#define USB_DP_PIN_STR "----" //must be 4 chars
#define USB_DM_PIN_STR "----" //must be 4 chars
// Scope constatnts ===================================================
#define MAX_SAMPLING_FREQ 5000000 //smps
#define MAX_ADC_CHANNELS 2
#define MAX_SCOPE_BUFF_SIZE 4000 //in bytes
#define SCOPE_BUFFER_MARGIN 50
#define SCOPE_CH1_PIN_STR "A2__" //must be 4 chars
#define SCOPE_CH2_PIN_STR "A3__" //must be 4 chars
#define SCOPE_CH3_PIN_STR "----" //must be 4 chars
#define SCOPE_CH4_PIN_STR "----" //must be 4 chars
#define SCOPE_VREF 3300
#define RANGE_1_LOW 0
#define RANGE_1_HI SCOPE_VREF
#define RANGE_2_LOW -SCOPE_VREF
#define RANGE_2_HI SCOPE_VREF*2
#define RANGE_3_LOW 0
#define RANGE_3_HI 0
#define RANGE_4_LOW 0
#define RANGE_4_HI 0
#define MAX_GENERATING_FREQ 2000000 //smps
#define MAX_DAC_CHANNELS 2
#define MAX_GENERATOR_BUFF_SIZE 800
#define DAC_DATA_DEPTH 12
#define GEN_VREF 3300
#define GEN_CH1_PIN_STR "A4__" //must be 4 chars
#define GEN_CH2_PIN_STR "A5__" //must be 4 chars
#endif /* STM32F4_CONFIG_H_ */
|
//
// BlipCommentView.h
// Blipboard
//
// Created by Aneil Mallavarapu on 11/25/12.
// Copyright (c) 2012 Blipboard. All rights reserved.
//
#import "BBImageView.h"
#import "Comment.h"
@class BBCommentView;
@protocol BlipCommentDelegate <NSObject>
-(void)blipCommentViewDeletePressed:(BBCommentView *)blipCommentView;
-(void)blipCommentViewAuthorPressed:(BBCommentView *)blipCommentView;
@end
@interface BBCommentView : UIView
@property (nonatomic,strong) Comment *comment;
@property (nonatomic,weak) id<BlipCommentDelegate> delegate;
@property (nonatomic,weak) IBOutlet BBImageView *authorPicture;
@property (nonatomic,weak) IBOutlet UILabel *authorName;
@property (nonatomic,weak) IBOutlet UITextView *text;
@property (nonatomic,weak) IBOutlet UILabel *createdTime;
@property (nonatomic,weak) IBOutlet UIButton *deleteButton;
+(BBCommentView *)commentViewWithComment:(Comment *)comment;
-(IBAction)authorPressed:(id)sender;
-(IBAction)leftSwipe:(id)sender;
-(IBAction)rightSwipe:(id)sender;
-(IBAction)deletePressed:(id)sender;
@end
|
/*
* Copyright 2014 Nutiteq Llc. All rights reserved.
* Copying and using this code is allowed only according
* to license terms, as given in https://www.nutiteq.com/license/
*/
#ifndef _NUTI_VT_TILELABELCULLER_H_
#define _NUTI_VT_TILELABELCULLER_H_
#include "TileLabel.h"
#include <array>
#include <vector>
#include <list>
#include <unordered_map>
#include <memory>
#include <mutex>
#include <cglib/vec.h>
#include <cglib/mat.h>
#include <cglib/bbox.h>
namespace Nuti { namespace VT {
class TileLabelCuller {
public:
explicit TileLabelCuller(std::shared_ptr<std::mutex> mutex, float scale);
void setViewState(const cglib::mat4x4<double>& projectionMatrix, const cglib::mat4x4<double>& cameraMatrix, float zoom, float aspectRatio, float resolution);
void process(const std::vector<std::shared_ptr<TileLabel>>& labelList);
private:
enum { GRID_RESOLUTION = 16 };
struct Record {
cglib::bbox2<float> bounds;
std::array<cglib::vec2<float>, 4> envelope;
std::shared_ptr<TileLabel> label;
Record() = default;
explicit Record(const cglib::bbox2<float>& bounds, const std::array<cglib::vec2<float>, 4>& envelope, std::shared_ptr<TileLabel> label) : bounds(bounds), envelope(envelope), label(std::move(label)) { }
};
void clearGrid();
bool testOverlap(const std::shared_ptr<TileLabel>& label);
static int getGridIndex(float x);
static cglib::mat4x4<double> calculateLocalViewMatrix(const cglib::mat4x4<double>& cameraMatrix);
cglib::mat4x4<float> _mvpMatrix;
TileLabel::ViewState _labelViewState;
float _resolution = 0;
std::vector<Record> _recordGrid[GRID_RESOLUTION][GRID_RESOLUTION];
const float _scale;
const std::shared_ptr<std::mutex> _mutex;
};
} }
#endif
|
#include "system.hpp"
#include "../support/platform.hpp"
//#include <stdexcept>
#include "stdio.h"
#include "stdlib.h"
#if GVL_WIN32 || GVL_WIN64
#include <windows.h>
#include <mmsystem.h>
#ifdef _MSC_VER
#pragma comment(lib, "winmm.lib")
#pragma comment(lib, "kernel32.lib")
#endif
uint32_t gvl_get_ticks()
{
static int setup = 0;
if(!setup)
{
TIMECAPS caps;
setup = 1;
if(timeGetDevCaps(&caps, sizeof(caps)) == TIMERR_NOERROR)
{
timeBeginPeriod(min(max(caps.wPeriodMin, 1), caps.wPeriodMax));
}
}
return (uint32_t)(timeGetTime());
}
uint64_t gvl_get_hires_ticks()
{
LARGE_INTEGER res;
QueryPerformanceCounter(&res);
return (uint64_t)res.QuadPart;
}
uint64_t gvl_hires_ticks_per_sec()
{
LARGE_INTEGER res;
QueryPerformanceFrequency(&res);
return (uint64_t)res.QuadPart;
}
void gvl_sleep(uint32_t ms)
{
Sleep((DWORD)ms);
}
#else // !(GVL_WIN32 || GVL_WIN64)
#include <unistd.h>
#if __APPLE__
// STUBBS
uint32_t gvl_get_ticks()
{
return 0;
}
uint64_t gvl_get_hires_ticks()
{
return 0;
}
uint64_t gvl_hires_ticks_per_sec()
{
return 1;
}
#elif defined(_POSIX_MONOTONIC_CLOCK)
#include <time.h>
uint32_t gvl_get_ticks()
{
struct timespec t;
int ret = clock_gettime(CLOCK_MONOTONIC, &t);
if(ret < 0)
{
fprintf(stderr, "clock_gettime failed");
exit(1);
}
return t.tv_sec * 1000 + t.tv_nsec / 1000000;
}
uint64_t gvl_get_hires_ticks()
{
struct timespec t;
int ret = clock_gettime(CLOCK_MONOTONIC, &t);
if(ret < 0)
{
fprintf(stderr, "clock_gettime failed");
exit(1);
}
return t.tv_sec * (uint64_t)(1000000000ull) + t.tv_nsec;
}
uint64_t gvl_hires_ticks_per_sec()
{
return (uint64_t)(1000000000ull);
}
#else // !defined(_POSIX_MONOTONIC_CLOCK)
uint32_t gvl_get_ticks()
{
//passert(false, "STUB");
return 0;
}
#endif // !defined(_POSIX_MONOTONIC_CLOCK)
#if GVL_LINUX
#include <time.h>
#include <errno.h>
void gvl_sleep(uint32_t ms)
{
struct timespec t, left;
t.tv_sec = ms / 1000;
t.tv_nsec = (ms % 1000) * 1000000;
while(nanosleep(&t, &left) == -1
&& errno == EINTR)
{
t = left;
}
}
#else // !GVL_LINUX
void gvl_sleep(uint32_t ms)
{
(void)ms;
//passert(false, "STUB");
}
#endif // !GVL_LINUX
#endif // !(GVL_WIN32 || GVL_WIN64)
|
/*************************************************************************
*
* Ver Date Name Description
* W 2006-11-24 AGY Created.
*
*************************************************************************/
// Local global variables
unsigned short utilcrc16;
unsigned char utilcrc8;
static short oddparity[16] = { 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0 };
static unsigned char dscrc_table[] = {
0, 94,188,226, 97, 63,221,131,194,156,126, 32,163,253, 31, 65,
157,195, 33,127,252,162, 64, 30, 95, 1,227,189, 62, 96,130,220,
35,125,159,193, 66, 28,254,160,225,191, 93, 3,128,222, 60, 98,
190,224, 2, 92,223,129, 99, 61,124, 34,192,158, 29, 67,161,255,
70, 24,250,164, 39,121,155,197,132,218, 56,102,229,187, 89, 7,
219,133,103, 57,186,228, 6, 88, 25, 71,165,251,120, 38,196,154,
101, 59,217,135, 4, 90,184,230,167,249, 27, 69,198,152,122, 36,
248,166, 68, 26,153,199, 37,123, 58,100,134,216, 91, 5,231,185,
140,210, 48,110,237,179, 81, 15, 78, 16,242,172, 47,113,147,205,
17, 79,173,243,112, 46,204,146,211,141,111, 49,178,236, 14, 80,
175,241, 19, 77,206,144,114, 44,109, 51,209,143, 12, 82,176,238,
50,108,142,208, 83, 13,239,177,240,174, 76, 18,145,207, 45,115,
202,148,118, 40,171,245, 23, 73, 8, 86,180,234,105, 55,213,139,
87, 9,235,181, 54,104,138,212,149,203, 41,119,244,170, 72, 22,
233,183, 85, 11,136,214, 52,106, 43,117,151,201, 74, 20,246,168,
116, 42,200,150, 21, 75,169,247,182,232, 10, 84,215,137,107, 53};
void setcrc16(void) {
//--------------------------------------------------------------------------
// Reset crc16 to the value passed in
//
// 'reset' - data to set crc16 to.
//
utilcrc16 = 0;
return;
}
void setcrc8(void) {
//--------------------------------------------------------------------------
// Reset crc8 to the value passed in
//
// 'portnum' - number 0 to MAX_PORTNUM-1. This number is provided to
// indicate the symbolic port number.
// 'reset' - data to set crc8 to
//
utilcrc8 = 0;
return;
}
unsigned short docrc16(unsigned short cdata) {
//--------------------------------------------------------------------------
// Calculate a new CRC16 from the input data short. Return the current
// CRC16 and also update the global variable CRC16.
//
// 'portnum' - number 0 to MAX_PORTNUM-1. This number is provided to
// indicate the symbolic port number.
// 'data' - data to perform a CRC16 on
//
// Returns: the current CRC16
//
cdata = (cdata ^ (utilcrc16 & 0xff)) & 0xff;
utilcrc16 >>= 8;
if (oddparity[cdata & 0xf] ^ oddparity[cdata >> 4])
utilcrc16^= 0xc001;
cdata <<= 6;
utilcrc16 ^= cdata;
cdata <<= 1;
utilcrc16 ^= cdata;
return utilcrc16;
}
unsigned char docrc8(unsigned char x) {
//--------------------------------------------------------------------------
// Update the Dallas Semiconductor One Wire CRC (utilcrc8) from the global
// variable utilcrc8 and the argument.
//
// 'portnum' - number 0 to MAX_PORTNUM-1. This number is provided to
// indicate the symbolic port number.
// 'x' - data byte to calculate the 8 bit crc from
//
// Returns: the updated utilcrc8.
//
utilcrc8 = dscrc_table[utilcrc8 ^ x];
return utilcrc8;
}
|
/* { dg-do run } */
/* PR rtl-optimization/34302 */
/* { dg-require-effective-target label_values } */
/* { dg-require-effective-target indirect_jumps } */
extern void abort (void);
struct S
{
int n1, n2, n3, n4;
};
__attribute__((noinline)) struct S
foo (int x, int y, int z)
{
if (x != 10 || y != 9 || z != 8)
abort ();
struct S s = { 1, 2, 3, 4 };
return s;
}
__attribute__((noinline)) void **
bar (void **u, int *v)
{
void **w = u;
int *s = v, x, y, z;
void **p, **q;
static void *l[] = { &&lab1, &&lab1, &&lab2, &&lab3, &&lab4 };
if (!u)
return l;
q = *w++;
goto *q;
lab2:
p = q;
q = *w++;
x = s[2];
y = s[1];
z = s[0];
s -= 1;
struct S r = foo (x, y, z);
s[3] = r.n1;
s[2] = r.n2;
s[1] = r.n3;
s[0] = r.n4;
goto *q;
lab3:
p = q;
q = *w++;
s += 1;
s[0] = 23;
lab1:
goto *q;
lab4:
return 0;
}
int
main (void)
{
void **u = bar ((void **) 0, (int *) 0);
void *t[] = { u[2], u[4] };
int s[] = { 7, 8, 9, 10, 11, 12 };
if (bar (t, &s[1]) != (void **) 0
|| s[0] != 4 || s[1] != 3 || s[2] != 2 || s[3] != 1
|| s[4] != 11 || s[5] != 12)
abort ();
return 0;
}
|
// ================================================================
// Copyright (c) 2001 John Kerl.
//
// This code and information is provided as is without warranty of
// any kind, either expressed or implied, including but not limited to
// the implied warranties of merchantability and/or fitness for a
// particular purpose.
//
// No restrictions are placed on copy or reuse of this code, as long
// as these paragraphs are included in the code.
// ================================================================
#ifndef CSUM_H
#define CSUM_H
typedef unsigned char int8u;
typedef unsigned short int16u;
typedef unsigned int32u;
typedef int int32s;
#define FILE_BUF_LEN 2048
#define CSUM_PRE 0
#define CSUM_PERI 1
#define CSUM_POST 2
#endif // CSUM_H
|
/** Copyright (c) 2015, Scality * All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ECLIB_ASYNC_DECODE_H
# define ECLIB_ASYNC_DECODE_H
# include <nan.h>
# include <liberasurecode/erasurecode.h>
# include <liberasurecode/erasurecode_helpers.h>
NAN_METHOD(EclDecode);
#endif /* ECLIB_ASYNC_DECODE_H */
|
/*
G35: An Arduino library for GE Color Effects G-35 holiday lights.
Copyright © 2011 The G35 Authors. Use, modification, and distribution are
subject to the BSD license as described in the accompanying LICENSE file.
Original version by Paul Martis (http://www.digitalmisery.com). See
README for complete attributions.
*/
#ifndef INCLUDE_MEOG35_ARDUINO_H
#define INCLUDE_MEOG35_ARDUINO_H
#include <Arduino.h>
#define color_t uint16_t
#define CHANNEL_MAX (0xF) // Each color channel is 4-bit
#define HUE_MAX ((CHANNEL_MAX + 1) * 6 - 1)
// Color is 12-bit (4-bit each R, G, B)
#define COLOR(r, g, b) ((r) + ((g) << 4) + ((b) << 8))
#define COLOR_WHITE COLOR(CHANNEL_MAX, CHANNEL_MAX, CHANNEL_MAX)
#define COLOR_BLACK COLOR(0, 0, 0)
#define COLOR_RED COLOR(CHANNEL_MAX, 0, 0)
#define COLOR_GREEN COLOR(0, CHANNEL_MAX, 0)
#define COLOR_BLUE COLOR(0, 0, CHANNEL_MAX)
#define COLOR_CYAN COLOR(0,CHANNEL_MAX, CHANNEL_MAX)
#define COLOR_MAGENTA COLOR(CHANNEL_MAX, 0,CHANNEL_MAX)
#define COLOR_YELLOW COLOR(CHANNEL_MAX,CHANNEL_MAX, 0)
#define COLOR_PURPLE COLOR(0xa, 0x3, 0xd)
#define COLOR_ORANGE COLOR(0xf, 0x1, 0x0)
#define COLOR_PALE_ORANGE COLOR(0x8, 0x1, 0x0)
#define COLOR_WARMWHITE COLOR(0xf, 0x7, 0x2)
#define COLOR_INDIGO COLOR(0x6, 0, 0xf)
#define COLOR_VIOLET COLOR(0x8, 0, 0xf)
// G35 is an abstract class representing a string of G35 lights of arbitrary
// length. LightPrograms talk to this interface.
class MEOG35
{
public:
MEOG35();
enum
{
// This is an abstraction leak. The choice was either to define a scaling
// function that mapped [0..255] to [0..0xcc], or just to leak a hardware
// detail through to this interface. We chose pragmatism.
MAX_INTENSITY = 0xcc
};
enum
{
RB_RED = 0,
RB_ORANGE,
RB_YELLOW,
RB_GREEN,
RB_BLUE,
RB_INDIGO,
RB_VIOLET
};
enum
{
RB_FIRST = RB_RED,
RB_LAST = RB_VIOLET,
RB_COUNT = RB_LAST + 1
};
virtual uint16_t get_light_count() = 0;
virtual uint16_t get_last_light()
{
return get_light_count() - 1;
}
virtual uint16_t get_halfway_point()
{
return get_light_count() / 2;
}
// One bulb's share of a second, in milliseconds
virtual uint8_t get_bulb_frame()
{
return 1000 / get_light_count();
}
// Turn on a specific LED with a color and brightness
virtual void set_color(uint8_t bulb, uint8_t intensity, color_t color) = 0;
// Like set_color, but doesn't explode with positions out of range
virtual bool set_color_if_in_range(uint8_t led, uint8_t intensity,
color_t color);
// Color data type
static color_t color(uint8_t r, uint8_t g, uint8_t b);
// Returns primary hue colors
static color_t color_hue(uint8_t h);
static color_t rainbow_color(uint16_t color);
// Given an int value, returns a "max" color (one with R/G/B each set to
// 0 or 255, except for black). The mapping is arbitary but deterministic.
static color_t max_color(uint16_t color);
// Make all LEDs the same color starting at specified beginning LED
virtual void fill_color(uint8_t begin, uint8_t count, uint8_t intensity,
color_t color);
virtual void fill_random_max(uint8_t begin, uint8_t count, uint8_t intensity);
virtual void fill_sequence(uint16_t sequence, uint8_t span_size,
uint8_t intensity,
color_t (*sequence_func)(uint16_t sequence));
virtual void fill_sequence(uint8_t begin, uint8_t count, uint16_t sequence,
uint8_t span_size, uint8_t intensity,
color_t (*sequence_func)(uint16_t sequence));
virtual void fill_sequence(uint8_t begin, uint8_t count, uint16_t sequence,
uint8_t span_size,
bool (*sequence_func)(uint16_t sequence,
color_t& color,
uint8_t& intensity));
virtual void broadcast_intensity(uint8_t intensity);
protected:
uint16_t light_count_;
virtual uint8_t get_broadcast_bulb() = 0;
};
#endif // INCLUDE_MEOG35_ARDUINO_H
|
/*
* Copyright (C) 2011 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 MutationRecord_h
#define MutationRecord_h
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
class CharacterData;
class ContainerNode;
class Element;
class Node;
class NodeList;
class QualifiedName;
class MutationRecord : public RefCounted<MutationRecord> {
public:
static Ref<MutationRecord> createChildList(ContainerNode& target, Ref<NodeList>&& added, Ref<NodeList>&& removed, RefPtr<Node>&& previousSibling, RefPtr<Node>&& nextSibling);
static Ref<MutationRecord> createAttributes(Element& target, const QualifiedName&, const AtomicString& oldValue);
static Ref<MutationRecord> createCharacterData(CharacterData& target, const String& oldValue);
static Ref<MutationRecord> createWithNullOldValue(MutationRecord&);
virtual ~MutationRecord();
virtual const AtomicString& type() = 0;
virtual Node* target() = 0;
virtual NodeList* addedNodes() = 0;
virtual NodeList* removedNodes() = 0;
virtual Node* previousSibling() { return 0; }
virtual Node* nextSibling() { return 0; }
virtual const AtomicString& attributeName() { return nullAtom; }
virtual const AtomicString& attributeNamespace() { return nullAtom; }
virtual String oldValue() { return String(); }
};
} // namespace WebCore
#endif // MutationRecord_h
|
/*
** Copyright (c) 2017, Xin YUAN, courses of Zhejiang University
** All rights reserved.
**
** This program is free software; you can redistribute it and/or
** modify it under the terms of the 2-Clause BSD License.
**
** Author contact information:
** yxxinyuan@zju.edu.cn
**
*/
/*
This file contains Won action functions.
*/
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
namespace GKC {
////////////////////////////////////////////////////////////////////////////////
//functions
// Do-Common action
inline CallResult _Create_WonDoCommonAction(ShareCom<IGrammarAction>& sp) throw()
{
CallResult cr;
_CREATE_COMPONENT_INSTANCE(WonDoCommonAction, IGrammarAction, sp, cr);
return cr;
}
////////////////////////////////////////////////////////////////////////////////
}
////////////////////////////////////////////////////////////////////////////////
|
/*
Copyright (c) 2013, William Magato
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) 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(S) OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the copyright holder(s) or contributors.
*/
#ifndef glibc_sysdeps_llamaos_malloc_sysdep_h
#define glibc_sysdeps_llamaos_malloc_sysdep_h
#include_next <malloc-sysdep.h>
#endif // glibc_sysdeps_llamaos_malloc_sysdep_h
|
#pragma once
#include <QAbstractTableModel>
#include "Executables.h"
#include <bearparser/core.h>
class InfoTableModel : public QAbstractTableModel
{
Q_OBJECT
signals:
void hookRequested(ExeHandler* exe);
public slots:
void modelChanged()
{
//>
this->beginResetModel();
this->endResetModel();
//<
}
public:
enum COLS
{
COL_NAME = 0,
COL_HOOKED,
COL_RAW_SIZE,
COL_VIRTUAL_SIZE,
COL_SECNUM,
COL_IMPNUM,
COUNT_COL
};
InfoTableModel(QObject *v_parent)
: QAbstractTableModel(v_parent), m_Exes(NULL) {}
virtual ~InfoTableModel() { }
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
int columnCount(const QModelIndex &parent) const { return COUNT_COL; }
int rowCount(const QModelIndex &parent) const { return countElements(); }
QVariant data(const QModelIndex &index, int role) const;
bool setData(const QModelIndex &, const QVariant &, int);
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const
{
//no index item pointer
return createIndex(row, column);
}
QModelIndex parent(const QModelIndex &index) const { return QModelIndex(); } // no parent
public slots:
void setExecutables(Executables *exes)
{
//>
this->beginResetModel();
if (this->m_Exes != NULL) {
//disconnect old
QObject::disconnect(this->m_Exes, SIGNAL(exeListChanged()), this, SLOT( onExeListChanged() ) );
}
this->m_Exes = exes;
if (this->m_Exes != NULL) {
QObject::connect(this->m_Exes, SIGNAL(exeListChanged()), this, SLOT( onExeListChanged() ) );
}
this->endResetModel();
//<
}
protected slots:
void onExeListChanged()
{
//>
this->beginResetModel();
this->endResetModel();
//<
}
protected:
Executables* m_Exes;
QVariant getDisplayData(int role, int attribute, ExeHandler *exeHndl) const;
int countElements() const { return (m_Exes == NULL)? 0: m_Exes->size(); }
};
|
/* wvWare
* Copyright (C) Caolan McNamara, Dom Lachowicz, and others
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "wv.h"
#include "wvinternal.h"
void
wvInitTBD(TBD *item) {
item->jc = 0;
item->tlc = 0;
item->reserved = 0;
}
void
wvCopyTBD(TBD *dest, TBD *src) {
memcpy(dest, src, sizeof(TBD));
}
void
wvGetTBD(TBD *item, wvStream *fd) {
wvGetTBD_internal(item, fd, NULL);
}
void
wvGetTBDFromBucket(TBD *item, U8 *pointer) {
wvGetTBD_internal(item, NULL, pointer);
}
void
wvGetTBD_internal(TBD *item, wvStream *fd, U8 *pointer) {
U8 temp8;
temp8 = dread_8ubit(fd, &pointer);
#ifdef PURIFY
wvInitTBD(item);
#endif
item->jc = temp8 & 0x07;
item->tlc = (temp8 & 0x38) >> 3;
item->reserved = (temp8 & 0xC0) >> 6;
}
|
#ifndef CV_ACCAR_PREPROC_H
#define CV_ACCAR_PREPROC_H
#include "../pipelineproc_fbo.h"
/**
* Class that implements simple preprocessing: Scaling + grayscale conversion
*/
class CvAccARPipelineProcPreproc : public CvAccARPipelineProcFBO {
public:
explicit CvAccARPipelineProcPreproc(CvAccARPipelineProcLevel lvl) : CvAccARPipelineProcFBO(lvl)
{ };
virtual void render();
virtual void bindShader(CvAccARShader *sh);
virtual void initWithFrameSize(int texW, int texH, int pyrDownFact = 1);
private:
GLint shParamAPos;
GLint shParamATexCoord;
GLfloat vertexBuf[CV_ACCAR_QUAD_VERTEX_BUFSIZE];
GLfloat texCoordBuf[CV_ACCAR_QUAD_TEX_BUFSIZE];
};
#endif
|
extern double ConservatoryVersionNumber;
extern const unsigned char ConservatoryVersionString[];
|
#ifndef _helix_stdint_h
#define _helix_stdint_h
#ifdef __cplusplus
extern "C" {
#endif
typedef signed char __int8_t;
typedef unsigned char __uint8_t;
typedef short __int16_t;
typedef unsigned short __uint16_t;
typedef int __int32_t;
typedef unsigned int __uint32_t;
typedef unsigned long long __uint64_t;
typedef __int8_t int8_t;
typedef __uint8_t uint8_t;
typedef __int16_t int16_t;
typedef __uint16_t uint16_t;
typedef __int32_t int32_t;
typedef __uint32_t uint32_t;
typedef __uint64_t uint64_t;
typedef unsigned long size_t;
#ifdef __cplusplus
}
#endif
#endif
|
/*
Copyright 2007 nVidia, 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.
*/
#pragma once
#ifndef _ZOH_H
#define _ZOH_H
#include "tile.h"
// UNUSED ZOH MODES are 0x13, 0x17, 0x1b, 0x1f
#define EXTERNAL_RELEASE 1 // define this if we're releasing this code externally
#define NREGIONS_TWO 2
#define NREGIONS_ONE 1
#define NCHANNELS 3
// Note: this code only reads OpenEXR files, which are only in F16 format.
// if unsigned is selected, the input is clamped to >= 0.
// if f16 is selected, the range is clamped to 0..0x7bff.
struct FltEndpts
{
nv::Vector3 A;
nv::Vector3 B;
};
struct IntEndpts
{
int A[NCHANNELS];
int B[NCHANNELS];
};
struct ComprEndpts
{
uint A[NCHANNELS];
uint B[NCHANNELS];
};
class ZOH
{
public:
static const int BLOCKSIZE=16;
static const int BITSIZE=128;
static Format FORMAT;
static void compress(const Tile &t, char *block);
static void decompress(const char *block, Tile &t);
static double compressone(const Tile &t, char *block);
static double compresstwo(const Tile &t, char *block);
static void decompressone(const char *block, Tile &t);
static void decompresstwo(const char *block, Tile &t);
static double refinetwo(const Tile &tile, int shapeindex_best, const FltEndpts endpts[NREGIONS_TWO], char *block);
static double roughtwo(const Tile &tile, int shape, FltEndpts endpts[NREGIONS_TWO]);
static double refineone(const Tile &tile, int shapeindex_best, const FltEndpts endpts[NREGIONS_ONE], char *block);
static double roughone(const Tile &tile, int shape, FltEndpts endpts[NREGIONS_ONE]);
static bool isone(const char *block);
};
#endif // _ZOH_H
|
/*********************************************************************************
*
* Inviwo - Interactive Visualization Workshop
*
* Copyright (c) 2015-2016 Inviwo Foundation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*********************************************************************************/
#ifndef IVW_LIC2D_H
#define IVW_LIC2D_H
#include <modules/vectorfieldvisualizationgl/vectorfieldvisualizationglmoduledefine.h>
#include <inviwo/core/common/inviwo.h>
#include <inviwo/core/processors/processor.h>
#include <inviwo/core/ports/imageport.h>
#include <inviwo/core/properties/ordinalproperty.h>
#include <inviwo/core/properties/boolproperty.h>
#include <modules/opengl/shader/shader.h>
namespace inviwo {
/** \docpage{<classIdentifier>, LIC2D}
* Explanation of how to use the processor.
*
* ### Inports
* * __<Inport1>__ <description>.
*
* ### Outports
* * __<Outport1>__ <description>.
*
* ### Properties
* * __<Prop1>__ <description>.
* * __<Prop2>__ <description>
*/
/**
* \class LIC2D
*
* \brief <brief description>
*
* <Detailed description from a developer prespective>
*/
class IVW_MODULE_VECTORFIELDVISUALIZATIONGL_API LIC2D : public Processor {
public:
virtual const ProcessorInfo getProcessorInfo() const override;
static const ProcessorInfo processorInfo_;
LIC2D();
virtual ~LIC2D(){}
virtual void process() override;
protected:
ImageInport vectorField_;
ImageInport noiseTexture_;
ImageOutport LIC2D_;
IntProperty samples_;
FloatProperty stepLength_;
BoolProperty normalizeVectors_;
BoolProperty intensityMapping_;
Shader shader_;
private:
};
} // namespace
#endif // IVW_LIC2D_H
|
// ----------------------------------------------------------------------------
/*
* Copyright (c) 2007 Fabian Greif, Roboterclub Aachen e.V.
* 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 REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: mcp2515_set_mode.c 6837 2008-11-16 19:05:15Z fabian $
*/
// ----------------------------------------------------------------------------
#include "mcp2515_private.h"
#ifdef SUPPORT_FOR_MCP2515__
// ----------------------------------------------------------------------------
void mcp2515_set_mode(can_mode_t mode)
{
uint8_t reg = 0;
if (mode == LISTEN_ONLY_MODE) {
reg = (1<<REQOP1)|(1<<REQOP0);
}
else if (mode == LOOPBACK_MODE) {
reg = (1<<REQOP1);
}
// set the new mode
mcp2515_bit_modify(CANCTRL, (1<<REQOP2)|(1<<REQOP1)|(1<<REQOP0), reg);
while ((mcp2515_read_register(CANSTAT) & 0xe0) != reg) {
// wait for the new mode to become active
}
}
#endif // SUPPORT_FOR_MCP2515__
|
/*
* Copyright (C) 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CryptoAlgorithmRsaKeyGenParams_h
#define CryptoAlgorithmRsaKeyGenParams_h
#include "CryptoAlgorithmParameters.h"
#include <wtf/Vector.h>
#if ENABLE(SUBTLE_CRYPTO)
namespace WebCore {
class CryptoAlgorithmRsaKeyGenParams final : public CryptoAlgorithmParameters {
public:
CryptoAlgorithmRsaKeyGenParams()
: hasHash(false)
{
}
// The length, in bits, of the RSA modulus.
unsigned modulusLength;
// The RSA public exponent, encoded as BigInteger.
Vector<uint8_t> publicExponent;
// The hash algorith identifier
bool hasHash;
CryptoAlgorithmIdentifier hash;
Class parametersClass() const override { return Class::RsaKeyGenParams; }
};
} // namespace WebCore
SPECIALIZE_TYPE_TRAITS_CRYPTO_ALGORITHM_PARAMETERS(RsaKeyGenParams)
#endif // ENABLE(SUBTLE_CRYPTO)
#endif // CryptoAlgorithmRsaKeyGenParams_h
|
//
// Created by zts on 17-3-3.
//
#ifndef SSDB_T_CURSOR_H
#define SSDB_T_CURSOR_H
#include <util/thread.h>
#include <map>
struct RedisCursor
{
std::string element;
time_t ts;
uint64_t cursor;
RedisCursor() :
ts(0), cursor(0)
{
}
};
typedef std::map<uint64_t, RedisCursor> RedisCursorTable;
class RedisCursorService {
public:
uint64_t GetNewRedisCursor(const std::string& element);
int FindElementByRedisCursor(const std::string& cursor, std::string& element);
void ClearExpireRedisCursor();
void ClearAllCursor();
private:
const int scan_cursor_expire_after = 60 * 1000;
RedisCursorTable m_redis_cursor_table;
SpinMutexLock mutex;
};
#endif //SSDB_T_CURSOR_H
|
/*
* Copyright 2008-2017 Katherine Flavel
*
* See LICENCE for the full copyright terms.
*/
#include <assert.h>
#include <stddef.h>
#include <fsm/fsm.h>
#include <fsm/walk.h>
#include <adt/set.h>
#include <adt/stateset.h>
#include <adt/edgeset.h>
#include "../internal.h"
int
fsm_walk_states(const struct fsm *fsm, void *opaque,
int (*callback)(const struct fsm *, fsm_state_t, void *))
{
fsm_state_t i;
assert(fsm != NULL);
assert(callback != NULL);
for (i = 0; i < fsm->statecount; i++) {
if (!callback(fsm, i, opaque)) {
return 0;
}
}
return 1;
}
int
fsm_walk_edges(const struct fsm *fsm, void *opaque,
int (*callback_literal)(const struct fsm *, fsm_state_t, fsm_state_t, char c, void *),
int (*callback_epsilon)(const struct fsm *, fsm_state_t, fsm_state_t, void *))
{
fsm_state_t i;
assert(fsm != NULL);
assert(callback_literal != NULL);
assert(callback_epsilon != NULL);
for (i = 0; i < fsm->statecount; i++) {
struct fsm_edge e;
struct edge_iter ei;
for (edge_set_reset(fsm->states[i].edges, &ei); edge_set_next(&ei, &e); ) {
if (!callback_literal(fsm, i, e.state, e.symbol, opaque)) {
return 0;
}
}
{
struct state_iter di;
fsm_state_t dst;
for (state_set_reset(fsm->states[i].epsilons, &di); state_set_next(&di, &dst); ) {
if (!callback_epsilon(fsm, i, dst, opaque)) {
return 0;
}
}
}
}
return 1;
}
|
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#ifndef FWL_THREADIMP_H_
#define FWL_THREADIMP_H_
#include "xfa/include/fwl/core/fwl_thread.h" // For FWL_HTHREAD.
class CFWL_NoteDriver;
class IFWL_NoteDriver;
class CFWL_ThreadImp {
public:
virtual ~CFWL_ThreadImp() {}
IFWL_Thread* GetInterface() const { return m_pIface; }
virtual FWL_ERR Run(FWL_HTHREAD hThread);
protected:
CFWL_ThreadImp(IFWL_Thread* pIface) : m_pIface(pIface) {}
private:
IFWL_Thread* const m_pIface;
};
class CFWL_NoteThreadImp : public CFWL_ThreadImp {
public:
CFWL_NoteThreadImp(IFWL_NoteThread* pIface);
virtual ~CFWL_NoteThreadImp();
FWL_ERR Run(FWL_HTHREAD hThread) override;
virtual IFWL_NoteDriver* GetNoteDriver();
protected:
CFWL_NoteDriver* const m_pNoteDriver;
};
#endif // FWL_THREADIMP_H_
|
//-*- Mode: C++ -*-
// ************************************************************************
// This file is property of and copyright by the ALICE HLT Project *
// ALICE Experiment at CERN, All rights reserved. *
// See cxx source for full Copyright notice *
// *
//*************************************************************************
#ifndef ALIHLTTPCCASLICEOUTCLUSTER_H
#define ALIHLTTPCCASLICEOUTCLUSTER_H
#include "AliHLTTPCCADef.h"
#ifdef HLTCA_STANDALONE
#include "AliHLTTPCRootTypes.h"
#endif
/**
* @class AliHLTTPCCASliceOutCluster
* AliHLTTPCCASliceOutCluster class contains clusters which are assigned to slice tracks.
* It is used to send the data from TPC slice trackers to the GlobalMerger
*/
class AliHLTTPCCASliceOutCluster
{
public:
GPUh() void Set( UInt_t id, UInt_t row, float x, float y, float z ){
UInt_t rowtype;
//if( row<64 ) rowtype = 0;
//else if( row<128 ) rowtype = (UInt_t(2)<<30);
//else rowtype = (1<<30);
//fId = id|rowtype;
if( row<64 ) rowtype = 0;
else if( row<128 ) rowtype = 2;
else rowtype = 1;
fRowType = rowtype;
fId = id;
fX = x; fY = y; fZ = z;
}
GPUh() float GetX() const {return fX;}
GPUh() float GetY() const {return fY;}
GPUh() float GetZ() const {return fZ;}
GPUh() UInt_t GetId() const {return fId; } //fId & 0x3FFFFFFF;}
GPUh() UInt_t GetRowType() const {return fRowType; }//fId>>30;}
private:
UInt_t fId; // Id ( slice, patch, cluster )
UInt_t fRowType; // row type
Float_t fX;// coordinates
Float_t fY;// coordinates
Float_t fZ;// coordinates
};
#endif
|
/* -----------------------------------------------------------------
* Programmer(s): Cody J. Balos @ LLNL
* -----------------------------------------------------------------
* SUNDIALS Copyright Start
* Copyright (c) 2002-2021, Lawrence Livermore National Security
* and Southern Methodist University.
* All rights reserved.
*
* See the top-level LICENSE and NOTICE files for details.
*
* SPDX-License-Identifier: BSD-3-Clause
* SUNDIALS Copyright End
* -----------------------------------------------------------------
* SUNDIALS context class. A context object holds data that all
* SUNDIALS objects in a simulation share. It is thread-safe provided
* that each thread has its own context object.
* ----------------------------------------------------------------*/
#ifndef _SUNDIALS_CONTEXT_H
#define _SUNDIALS_CONTEXT_H
#include "sundials/sundials_types.h"
#include "sundials/sundials_profiler.h"
#ifdef __cplusplus /* wrapper to enable C++ usage */
extern "C" {
#endif
typedef struct _SUNContext *SUNContext;
SUNDIALS_EXPORT int SUNContext_Create(void* comm, SUNContext* ctx);
SUNDIALS_EXPORT int SUNContext_GetProfiler(SUNContext sunctx, SUNProfiler* profiler);
SUNDIALS_EXPORT int SUNContext_SetProfiler(SUNContext sunctx, SUNProfiler profiler);
SUNDIALS_EXPORT int SUNContext_Free(SUNContext* ctx);
#ifdef __cplusplus
}
namespace sundials
{
class Context
{
public:
Context(void* comm = NULL)
{
SUNContext_Create(comm, &sunctx_);
}
operator SUNContext() { return sunctx_; }
~Context()
{
SUNContext_Free(&sunctx_);
}
private:
SUNContext sunctx_;
};
} /* namespace sundials */
#endif
#endif
|
#ifndef _INPUTCOMMANDS_H_
#define _INPUTCOMMANDS_H_
#include "InputEvent.h"
class InputCommandReceiver;
class InputCommand
{
public:
virtual ~InputCommand();
virtual void execute(InputCommandReceiver* listener) = 0;
};
namespace InputCommands
{
struct InputData
{
/*InputData(const InputData& copy)
{
*this = copy;
}*/
InputData(InputEventType t, bool s = false, bool c = false, bool a = false) :
type(t), shift(s), ctrl(c), alt(a)
{}
InputData() :
type(INPUT_UNKNOWN), shift(false), ctrl(false), alt(false)
{}
friend bool operator<(const InputData& lhs, const InputData& rhs)
{
if(lhs.type != rhs.type)
return lhs.type < rhs.type;
else if(lhs.shift != rhs.shift)
return lhs.shift < rhs.shift;
else if(lhs.ctrl != rhs.ctrl)
return lhs.ctrl < rhs.ctrl;
else if(lhs.alt != rhs.alt)
return lhs.alt < rhs.alt;
else
return false;
}
friend bool operator==(const InputData& lhs, const InputData& rhs)
{
return
(lhs.type == rhs.type) &&
(lhs.shift == rhs.shift) &&
(lhs.ctrl == rhs.ctrl) &&
(lhs.alt == rhs.alt);
}
InputEventType type;
bool shift;
bool ctrl;
bool alt;
};
class InputActive : public InputCommand
{
public:
void execute(InputCommandReceiver* listener);
InputData input;
};
class InputActivated : public InputCommand
{
public:
void execute(InputCommandReceiver* listener);
InputData input;
};
class InputUnactivated : public InputCommand
{
public:
void execute(InputCommandReceiver* listener);
InputData input;
};
}
#endif |
/* Copyright (C) 2013 Upi Tamminen
* See the COPYRIGHT file for more information */
#include <stdint.h>
#include "inc/LPC17xx.h"
#include "config.h"
#include "hdr/hdr_sc.h"
inline void led_init(void)
{
/* LED2 is at 0.22 */
LPC_PINCON->PINSEL0 &= ~(3<<18);
LPC_GPIO0->FIODIR |= (1<<9);
}
inline void led_on(void)
{
LPC_GPIO0->FIOSET |= (1<<9);
}
inline void led_off(void)
{
LPC_GPIO0->FIOCLR |= (1<<9);
}
inline void led_toggle(void)
{
LPC_GPIO0->FIOPIN ^= (1<<9);
}
/* vim: set sw=4 et: */
|
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include <better/mutex.h>
#include <memory>
#include <react/renderer/components/root/RootComponentDescriptor.h>
#include <react/renderer/components/root/RootShadowNode.h>
#include <react/renderer/core/LayoutConstraints.h>
#include <react/renderer/core/ReactPrimitives.h>
#include <react/renderer/core/ShadowNode.h>
#include <react/renderer/mounting/MountingCoordinator.h>
#include <react/renderer/mounting/ShadowTreeDelegate.h>
#include <react/renderer/mounting/ShadowTreeRevision.h>
#include "MountingOverrideDelegate.h"
namespace facebook {
namespace react {
using ShadowTreeCommitTransaction = std::function<RootShadowNode::Unshared(
RootShadowNode::Shared const &oldRootShadowNode)>;
/*
* Represents the shadow tree and its lifecycle.
*/
class ShadowTree final {
public:
enum class CommitStatus {
Succeeded,
Failed,
Cancelled,
};
/*
* Creates a new shadow tree instance.
*/
ShadowTree(
SurfaceId surfaceId,
LayoutConstraints const &layoutConstraints,
LayoutContext const &layoutContext,
RootComponentDescriptor const &rootComponentDescriptor,
ShadowTreeDelegate const &delegate,
std::weak_ptr<MountingOverrideDelegate const> mountingOverrideDelegate,
bool enableReparentingDetection = false);
~ShadowTree();
/*
* Returns the `SurfaceId` associated with the shadow tree.
*/
SurfaceId getSurfaceId() const;
/*
* Performs commit calling `transaction` function with a `oldRootShadowNode`
* and expecting a `newRootShadowNode` as a return value.
* The `transaction` function can cancel commit returning `nullptr`.
*/
CommitStatus tryCommit(
ShadowTreeCommitTransaction transaction,
bool enableStateReconciliation = false) const;
/*
* Calls `tryCommit` in a loop until it finishes successfully.
*/
CommitStatus commit(
ShadowTreeCommitTransaction transaction,
bool enableStateReconciliation = false) const;
/*
* Commit an empty tree (a new `RootShadowNode` with no children).
*/
void commitEmptyTree() const;
/**
* Forces the ShadowTree to ping its delegate that an update is available.
* Useful for animations on Android.
* @return
*/
void notifyDelegatesOfUpdates() const;
MountingCoordinator::Shared getMountingCoordinator() const;
/*
* Temporary.
* Do not use.
*/
void setEnableReparentingDetection(bool value) {
enableReparentingDetection_ = value;
}
private:
RootShadowNode::Unshared cloneRootShadowNode(
RootShadowNode::Shared const &oldRootShadowNode,
LayoutConstraints const &layoutConstraints,
LayoutContext const &layoutContext) const;
void emitLayoutEvents(
std::vector<LayoutableShadowNode const *> &affectedLayoutableNodes) const;
SurfaceId const surfaceId_;
ShadowTreeDelegate const &delegate_;
mutable better::shared_mutex commitMutex_;
mutable RootShadowNode::Shared
rootShadowNode_; // Protected by `commitMutex_`.
mutable ShadowTreeRevision::Number revisionNumber_{
0}; // Protected by `commitMutex_`.
MountingCoordinator::Shared mountingCoordinator_;
bool enableReparentingDetection_{false};
};
} // namespace react
} // namespace facebook
|
// Copyright 2016-present 650 Industries. All rights reserved.
#import <ABI42_0_0UMCore/ABI42_0_0UMViewManager.h>
#import <ABI42_0_0UMCore/ABI42_0_0UMModuleRegistryConsumer.h>
@interface ABI42_0_0EXBlurViewManager : ABI42_0_0UMViewManager <ABI42_0_0UMModuleRegistryConsumer>
@end
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE457_Use_of_Uninitialized_Variable__double_array_malloc_no_init_64a.c
Label Definition File: CWE457_Use_of_Uninitialized_Variable.c_array.label.xml
Template File: sources-sinks-64a.tmpl.c
*/
/*
* @description
* CWE: 457 Use of Uninitialized Variable
* BadSource: no_init Don't initialize data
* GoodSource: Initialize data
* Sinks: use
* GoodSink: Initialize then use data
* BadSink : Use data
* Flow Variant: 64 Data flow: void pointer to data passed from one function to another in different source files
*
* */
#include "std_testcase.h"
#ifndef OMITBAD
/* bad function declaration */
void CWE457_Use_of_Uninitialized_Variable__double_array_malloc_no_init_64b_badSink(void * dataVoidPtr);
void CWE457_Use_of_Uninitialized_Variable__double_array_malloc_no_init_64_bad()
{
double * data;
data = (double *)malloc(10*sizeof(double));
if (data == NULL) {exit(-1);}
/* POTENTIAL FLAW: Don't initialize data */
; /* empty statement needed for some flow variants */
CWE457_Use_of_Uninitialized_Variable__double_array_malloc_no_init_64b_badSink(&data);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void CWE457_Use_of_Uninitialized_Variable__double_array_malloc_no_init_64b_goodG2BSink(void * dataVoidPtr);
static void goodG2B()
{
double * data;
data = (double *)malloc(10*sizeof(double));
if (data == NULL) {exit(-1);}
/* FIX: Completely initialize data */
{
int i;
for(i=0; i<10; i++)
{
data[i] = (double)i;
}
}
CWE457_Use_of_Uninitialized_Variable__double_array_malloc_no_init_64b_goodG2BSink(&data);
}
/* goodB2G uses the BadSource with the GoodSink */
void CWE457_Use_of_Uninitialized_Variable__double_array_malloc_no_init_64b_goodB2GSink(void * dataVoidPtr);
static void goodB2G()
{
double * data;
data = (double *)malloc(10*sizeof(double));
if (data == NULL) {exit(-1);}
/* POTENTIAL FLAW: Don't initialize data */
; /* empty statement needed for some flow variants */
CWE457_Use_of_Uninitialized_Variable__double_array_malloc_no_init_64b_goodB2GSink(&data);
}
void CWE457_Use_of_Uninitialized_Variable__double_array_malloc_no_init_64_good()
{
goodG2B();
goodB2G();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
its own for testing or for building a binary to use in testing binary
analysis tools. It is not used when compiling all the testcases as one
application, which is how source code analysis tools are tested. */
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE457_Use_of_Uninitialized_Variable__double_array_malloc_no_init_64_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE457_Use_of_Uninitialized_Variable__double_array_malloc_no_init_64_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
// Filename: cppExtensionType.h
// Created by: drose (21Oct99)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
#ifndef CPPEXTENSIONTYPE_H
#define CPPEXTENSIONTYPE_H
#include "dtoolbase.h"
#include "cppType.h"
#include "cppInstance.h"
class CPPScope;
class CPPIdentifier;
///////////////////////////////////////////////////////////////////
// Class : CPPExtensionType
// Description : Base class of enum, class, struct, and union types.
// An instance of the base class (instead of one of
// the specializations) is used for forward references.
////////////////////////////////////////////////////////////////////
class CPPExtensionType : public CPPType {
public:
enum Type {
T_enum,
T_class,
T_struct,
T_union,
};
CPPExtensionType(Type type, CPPIdentifier *ident, CPPScope *current_scope,
const CPPFile &file);
virtual string get_simple_name() const;
virtual string get_local_name(CPPScope *scope = NULL) const;
virtual string get_fully_scoped_name() const;
virtual bool is_incomplete() const;
virtual bool is_tbd() const;
virtual bool is_trivial() const;
virtual CPPDeclaration *substitute_decl(SubstDecl &subst,
CPPScope *current_scope,
CPPScope *global_scope);
virtual CPPType *resolve_type(CPPScope *current_scope,
CPPScope *global_scope);
virtual bool is_equivalent(const CPPType &other) const;
virtual void output(ostream &out, int indent_level, CPPScope *scope,
bool complete) const;
virtual SubType get_subtype() const;
virtual CPPExtensionType *as_extension_type();
Type _type;
CPPIdentifier *_ident;
CPPExpression *_alignment;
};
ostream &operator << (ostream &out, CPPExtensionType::Type type);
#endif
|
// Copyright (c) 2010-2015, Shane Jarych
// 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 lib65oh2 nor the names of its contributors may be used
// to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef INDEXEDINDIRECTFETCHPOLICY_H
#define INDEXEDINDIRECTFETCHPOLICY_H
#include "Core.h"
#include "MemoryController.h"
#include "OperandFetchPolicy.h"
#include "CPUTypes.h"
#include "BitUtils.h"
/**
* @class IndexedIndirectFetchPolicy
* @brief A FetchPolicy implementation for indexed indirect addressing
*
* @tparam FetchedDataType The type of the data fetched
*
* @author Shane Jarych
*/
template <class FetchedDataType>
class IndexedIndirectFetchPolicy
: public OperandFetchPolicy<data8_t>
{
public:
IndexedIndirectFetchPolicy()
: OperandFetchPolicy<data8_t>()
{
}
/**
* @brief Using the operand as an offset to the operand, fetches the data
* using indexed indirect addressing.
*
* @param[in] core The Core reference for obtaining cpu values
* @param[in] memory The MemoryController reference for obtaining data
* @param[out] fetchedData The fetched data
* @return The number of cycles to perform the operation
*/
int fetch(Core& core, MemoryController& memory, FetchedDataType** fetchedData)
{
// fetch the 8bit operand
const data8_t* operand = fetchOperand(core, memory);
addr16_t calcAddr = 0;
const addr8_t lowAddr = *operand + core.getX();
const addr8_t lowAddrData = *memory.get(lowAddr);
BitUtils::setAddr8(calcAddr, lowAddrData, BitUtils::LOW);
BitUtils::setAddr8(calcAddr, *memory.get(lowAddr + 1), BitUtils::HIGH);
*fetchedData = memory.get(calcAddr);
return 0;
}
};
#endif // INDEXEDINDIRECTFETCHPOLICY_H
|
// RXConvolution.h
// Created by Rob Rix on 2013-03-12.
// Copyright (c) 2013 Rob Rix. All rights reserved.
#import <RXCollections/RXTraversal.h>
typedef id(^RXConvolutionBlock)(NSUInteger count, id const objects[count], bool *stop);
typedef id(*RXConvolutionFunction)(NSUInteger count, id const objects[count], bool *stop);
/**
id<RXTraversal> RXConvolveWith(id<NSFastEnumeration> sequences, RXConvolutionBlock block)
id<RXTraversal> RXConvolveWithF(id<NSFastEnumeration> sequences, RXConvolutionFunction function)
Traverses the elements of the sequences in lockstep, producing the result of the block (called with the count and an array of the corresponding elements of each sequence) for each one.
RXZipWith is a synonym for RXConvolveWith.
RXZipWithF is a synonym for RXConvolveWithF.
*/
extern id<RXTraversal> RXConvolveWith(id<NSObject, NSFastEnumeration> sequences, RXConvolutionBlock block);
extern id<RXTraversal> RXConvolveWithF(id<NSObject, NSFastEnumeration> sequences, RXConvolutionFunction function);
extern id (* const RXZipWith)(id<NSObject, NSFastEnumeration>, RXConvolutionBlock);
extern id (* const RXZipWithF)(id<NSObject, NSFastEnumeration>, RXConvolutionFunction);
/**
id<RXTraversal> RXConvolve(id<NSFastEnumeration> sequences)
Traverses the elements of the sequences in lockstep, producing a tuple for each one.
RXZip is a synonym for this function.
*/
extern id<RXTraversal> RXConvolve(id<NSObject, NSFastEnumeration> sequences);
extern id (* const RXZip)(id<NSObject, NSFastEnumeration>);
|
/*
* Copyright (C) 2011 Google Inc. All rights reserved.
* Copyright (C) 2012 Motorola Mobility Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef DOMURL_h
#define DOMURL_h
#include "bindings/core/v8/ScriptWrappable.h"
#include "core/CoreExport.h"
#include "core/dom/DOMURLUtils.h"
#include "platform/heap/Handle.h"
#include "platform/weborigin/KURL.h"
#include "wtf/Forward.h"
namespace blink {
class Blob;
class ExceptionState;
class ExecutionContext;
class URLRegistrable;
class DOMURL final : public RefCountedWillBeGarbageCollectedFinalized<DOMURL>, public ScriptWrappable, public DOMURLUtils {
DEFINE_WRAPPERTYPEINFO();
public:
static PassRefPtrWillBeRawPtr<DOMURL> create(const String& url, ExceptionState& exceptionState)
{
return adoptRefWillBeNoop(new DOMURL(url, blankURL(), exceptionState));
}
static PassRefPtrWillBeRawPtr<DOMURL> create(const String& url, const String& base, ExceptionState& exceptionState)
{
return adoptRefWillBeNoop(new DOMURL(url, KURL(KURL(), base), exceptionState));
}
static PassRefPtrWillBeRawPtr<DOMURL> create(const String& url, PassRefPtrWillBeRawPtr<DOMURL> base, ExceptionState& exceptionState)
{
ASSERT(base);
return adoptRefWillBeNoop(new DOMURL(url, base->m_url, exceptionState));
}
static String createObjectURL(ExecutionContext*, Blob*, ExceptionState&);
static void revokeObjectURL(ExecutionContext*, const String&);
CORE_EXPORT static String createPublicURL(ExecutionContext*, URLRegistrable*, const String& uuid = String());
static void revokeObjectUUID(ExecutionContext*, const String&);
virtual KURL url() const override { return m_url; }
virtual void setURL(const KURL& url) override { m_url = url; }
virtual String input() const override { return m_input; }
virtual void setInput(const String&) override;
DEFINE_INLINE_TRACE() { }
private:
DOMURL(const String& url, const KURL& base, ExceptionState&);
KURL m_url;
String m_input;
};
} // namespace blink
#endif // DOMURL_h
|
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: releng/9.3/sys/dev/drm2/radeon/r100_track.h 254885 2013-08-25 19:37:15Z dumbbell $");
#define R100_TRACK_MAX_TEXTURE 3
#define R200_TRACK_MAX_TEXTURE 6
#define R300_TRACK_MAX_TEXTURE 16
#define R100_MAX_CB 1
#define R300_MAX_CB 4
/*
* CS functions
*/
struct r100_cs_track_cb {
struct radeon_bo *robj;
unsigned pitch;
unsigned cpp;
unsigned offset;
};
struct r100_cs_track_array {
struct radeon_bo *robj;
unsigned esize;
};
struct r100_cs_cube_info {
struct radeon_bo *robj;
unsigned offset;
unsigned width;
unsigned height;
};
#define R100_TRACK_COMP_NONE 0
#define R100_TRACK_COMP_DXT1 1
#define R100_TRACK_COMP_DXT35 2
struct r100_cs_track_texture {
struct radeon_bo *robj;
struct r100_cs_cube_info cube_info[5]; /* info for 5 non-primary faces */
unsigned pitch;
unsigned width;
unsigned height;
unsigned num_levels;
unsigned cpp;
unsigned tex_coord_type;
unsigned txdepth;
unsigned width_11;
unsigned height_11;
bool use_pitch;
bool enabled;
bool lookup_disable;
bool roundup_w;
bool roundup_h;
unsigned compress_format;
};
struct r100_cs_track {
unsigned num_cb;
unsigned num_texture;
unsigned maxy;
unsigned vtx_size;
unsigned vap_vf_cntl;
unsigned vap_alt_nverts;
unsigned immd_dwords;
unsigned num_arrays;
unsigned max_indx;
unsigned color_channel_mask;
struct r100_cs_track_array arrays[16];
struct r100_cs_track_cb cb[R300_MAX_CB];
struct r100_cs_track_cb zb;
struct r100_cs_track_cb aa;
struct r100_cs_track_texture textures[R300_TRACK_MAX_TEXTURE];
bool z_enabled;
bool separate_cube;
bool zb_cb_clear;
bool blend_read_enable;
bool cb_dirty;
bool zb_dirty;
bool tex_dirty;
bool aa_dirty;
bool aaresolve;
};
int r100_cs_track_check(struct radeon_device *rdev, struct r100_cs_track *track);
void r100_cs_track_clear(struct radeon_device *rdev, struct r100_cs_track *track);
int r100_cs_packet_next_reloc(struct radeon_cs_parser *p,
struct radeon_cs_reloc **cs_reloc);
void r100_cs_dump_packet(struct radeon_cs_parser *p,
struct radeon_cs_packet *pkt);
int r100_cs_packet_parse_vline(struct radeon_cs_parser *p);
int r200_packet0_check(struct radeon_cs_parser *p,
struct radeon_cs_packet *pkt,
unsigned idx, unsigned reg);
int r100_reloc_pitch_offset(struct radeon_cs_parser *p,
struct radeon_cs_packet *pkt,
unsigned idx,
unsigned reg);
int r100_packet3_load_vbpntr(struct radeon_cs_parser *p,
struct radeon_cs_packet *pkt,
int idx);
|
//
// MPAdConfigurationFactory.h
// MoPub
//
// Copyright (c) 2013 MoPub. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "MPAdConfiguration.h"
@interface MPAdConfigurationFactory : NSObject
+ (NSMutableDictionary *)defaultNativeProperties;
+ (MPAdConfiguration *)defaultNativeAdConfiguration;
+ (MPAdConfiguration *)defaultNativeAdConfigurationWithCustomEventClassName:(NSString *)eventClassName;
+ (MPAdConfiguration *)defaultNativeAdConfigurationWithHeaders:(NSDictionary *)dictionary
properties:(NSDictionary *)properties;
+ (NSMutableDictionary *)defaultBannerHeaders;
+ (MPAdConfiguration *)defaultBannerConfiguration;
+ (MPAdConfiguration *)defaultBannerConfigurationWithNetworkType:(NSString *)type;
+ (MPAdConfiguration *)defaultBannerConfigurationWithCustomEventClassName:(NSString *)eventClassName;
+ (MPAdConfiguration *)defaultBannerConfigurationWithHeaders:(NSDictionary *)dictionary
HTMLString:(NSString *)HTMLString;
+ (NSMutableDictionary *)defaultInterstitialHeaders;
+ (MPAdConfiguration *)defaultInterstitialConfiguration;
+ (MPAdConfiguration *)defaultMRAIDInterstitialConfiguration;
+ (MPAdConfiguration *)defaultFakeInterstitialConfiguration;
+ (MPAdConfiguration *)defaultInterstitialConfigurationWithNetworkType:(NSString *)type;
+ (MPAdConfiguration *)defaultChartboostInterstitialConfigurationWithLocation:(NSString *)location;
+ (MPAdConfiguration *)defaultInterstitialConfigurationWithCustomEventClassName:(NSString *)eventClassName;
+ (MPAdConfiguration *)defaultInterstitialConfigurationWithHeaders:(NSDictionary *)dictionary
HTMLString:(NSString *)HTMLString;
@end
|
/*
* Copyright (c) 2016, SRCH2
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the SRCH2 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 SRCH2 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 __WRAPPER_QUERYOPTIMIZER_H__
#define __WRAPPER_QUERYOPTIMIZER_H__
#include "instantsearch/Constants.h"
#include "operation/HistogramManager.h"
#include "physical_plan/PhysicalPlan.h"
#include "instantsearch/LogicalPlan.h"
using namespace std;
namespace srch2 {
namespace instantsearch {
class QueryEvaluatorInternal;
/*
* This class is responsible of doing two tasks :
* 1. Translating LogicalPlan and building PhysicalPlan from it
* 2. Applying rules on PhysicalPlan and optimizing it
*
* The physical plan built by this class is then executed to procduce the result set.
*/
class QueryOptimizer {
public:
QueryOptimizer(QueryEvaluatorInternal * queryEvaluator);
/*
* 1. Find the search type based on searchType coming from wrapper layer and
* ---- post processing needs.
* 2. Prepare the ranker object in and put it in PhysicalPlan. (Note that because of
* ---- heuristics which will be chosen later, searchType and ranker might change in later steps)
* // TODO : write other steps.
*
* 2. this function builds PhysicalPlan and optimizes it
* ---- 2.1. Builds the Physical plan by mapping each Logical operator to a/multiple Physical operator(s)
* and makes sure inputs and outputs of operators are consistent.
* ---- 2.2. Applies optimization rules on the physical plan
*/
void buildAndOptimizePhysicalPlan(PhysicalPlan & physicalPlan, LogicalPlan * logicalPlan, unsigned planOffset);
private:
/*
* This function maps LogicalPlan nodes to Physical nodes and builds a very first
* version of the PhysicalPlan. This plan will optimizer in next steps.
*/
void buildPhysicalPlanFirstVersion(PhysicalPlan & physicalPlan, unsigned planOffset);
void chooseSearchTypeOfPhysicalPlan(PhysicalPlan & physicalPlan);
void buildIncompleteTreeOptions(vector<PhysicalPlanOptimizationNode *> & treeOptions);
void buildIncompleteSubTreeOptions(LogicalPlanNode * root, vector<PhysicalPlanOptimizationNode *> & treeOptions);
void buildIncompleteSubTreeOptionsAndOr(LogicalPlanNode * root, vector<PhysicalPlanOptimizationNode *> & treeOptions);
void buildIncompleteSubTreeOptionsNot(LogicalPlanNode * root, vector<PhysicalPlanOptimizationNode *> & treeOptions);
void buildIncompleteSubTreeOptionsTerm(LogicalPlanNode * root, vector<PhysicalPlanOptimizationNode *> & treeOptions);
void buildIncompleteSubTreeOptionsPhrase(LogicalPlanNode * root, vector<PhysicalPlanOptimizationNode *> & treeOptions);
void buildIncompleteSubTreeOptionsGeo(LogicalPlanNode * root, vector<PhysicalPlanOptimizationNode *> & treeOptions);
void injectRequiredSortOperators(vector<PhysicalPlanOptimizationNode *> & treeOptions);
void injectRequiredSortOperators(PhysicalPlanOptimizationNode * root);
void injectSortOperatorsForFeedback(PhysicalPlanOptimizationNode **root,
PhysicalPlanOptimizationNode *node, unsigned childOffset);
bool isNodeFeedbackCapable(PhysicalPlanOptimizationNode *node);
bool isLogicalPlanBoosted(PhysicalPlanOptimizationNode *node);
PhysicalPlanOptimizationNode * findTheMinimumCostTree(vector<PhysicalPlanOptimizationNode *> & treeOptions, PhysicalPlan & physicalPlan, unsigned planOffset);
PhysicalPlanNode * buildPhysicalPlanFirstVersionFromTreeStructure(PhysicalPlanOptimizationNode * chosenTree);
/*
* this function applies optimization rules (funtions starting with Rule_) on the plan one by one
*/
void applyOptimizationRulesOnThePlan(PhysicalPlan & physicalPlan);
/*
* An example of an optimization rule function.
*/
void Rule_1(PhysicalPlan & physicalPlan);
QueryEvaluatorInternal * queryEvaluator;
LogicalPlan * logicalPlan;
};
}
}
#endif //__WRAPPER_QUERYOPTIMIZER_H__
|
/*
* Copyright (c) 2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
#pragma once
#include <proxygen/lib/http/session/HTTPTransaction.h>
namespace proxygen {
class HTTPErrorPage;
class CodecErrorResponseHandler:
public HTTPTransaction::Handler {
public:
explicit CodecErrorResponseHandler(ErrorCode statusCode);
// HTTPTransaction::Handler methods
void setTransaction(HTTPTransaction* txn) noexcept override;
void detachTransaction() noexcept override;
void onHeadersComplete(std::unique_ptr<HTTPMessage> msg) noexcept override;
void onBody(std::unique_ptr<folly::IOBuf> chain) noexcept override;
void onTrailers(std::unique_ptr<HTTPHeaders> trailers) noexcept override;
void onEOM() noexcept override;
void onUpgrade(UpgradeProtocol protocol) noexcept override;
void onError(const HTTPException& error) noexcept override;
// These are no-ops since the error response is already in memory
void onEgressPaused() noexcept override {};
void onEgressResumed() noexcept override {};
private:
~CodecErrorResponseHandler();
HTTPTransaction* txn_;
};
} // proxygen
|
#ifndef WATCHDOG_H
#define WATCHDOG_H
#include <avr/wdt.h>
#include "timer1.h"
#include <util/atomic.h>
#include "io_config.h"
class watchdog {
uint8_t serial_counter;
uint8_t i2c_counter;
uint8_t saved_mcusr;
static watchdog data;
public:
static void setup(bool initial)
{
if (initial) {
data.saved_mcusr = MCUSR;
MCUSR = 0;
}
timer1::setup();
timer1::reset_timer(~io_watchdog_timer);
timer1::overflow_irq_en(true);
data.serial_counter = 0;
data.i2c_counter = 0;
if (initial)
wdt_enable(WDTO_4S);
}
static void serial_progress()
{
ATOMIC_BLOCK(ATOMIC_FORCEON) {
data.serial_counter = 0;
}
}
static void i2c_progress()
{
ATOMIC_BLOCK(ATOMIC_FORCEON) {
data.i2c_counter = 0;
}
}
static void progress()
{
wdt_reset();
}
static bool was_intended_reset()
{
return !(data.saved_mcusr & (1<<WDRF));
}
static void irq();
};
#endif
|
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_SHARING_SHARED_CLIPBOARD_SHARED_CLIPBOARD_MESSAGE_HANDLER_ANDROID_H_
#define CHROME_BROWSER_SHARING_SHARED_CLIPBOARD_SHARED_CLIPBOARD_MESSAGE_HANDLER_ANDROID_H_
#include "base/macros.h"
#include "chrome/browser/sharing/shared_clipboard/shared_clipboard_message_handler.h"
class SharingDeviceSource;
class SharedClipboardMessageHandlerAndroid
: public SharedClipboardMessageHandler {
public:
explicit SharedClipboardMessageHandlerAndroid(
SharingDeviceSource* device_source);
SharedClipboardMessageHandlerAndroid(
const SharedClipboardMessageHandlerAndroid&) = delete;
SharedClipboardMessageHandlerAndroid& operator=(
const SharedClipboardMessageHandlerAndroid&) = delete;
~SharedClipboardMessageHandlerAndroid() override;
private:
// SharedClipboardMessageHandler implementation.
void ShowNotification(const std::string& device_name) override;
};
#endif // CHROME_BROWSER_SHARING_SHARED_CLIPBOARD_SHARED_CLIPBOARD_MESSAGE_HANDLER_ANDROID_H_
|
// Copyright (c) 2017 Mirants Lu. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// saber/saber/util/thread.h
#ifndef BUBBLEFS_UTILS_SABER_THREAD_H_
#define BUBBLEFS_UTILS_SABER_THREAD_H_
#include <pthread.h>
#include <stdint.h>
namespace bubblefs {
namespace mysaber {
namespace CurrentThread {
extern __thread uint64_t cached_tid;
extern uint64_t Tid();
} // namespace CurrentThread
class Thread {
public:
Thread();
~Thread();
void Start(void* (*function)(void*), void* arg);
void Join();
bool Started() const { return started_; }
pthread_t gettid() const { return thread_; }
private:
void PthreadCall(const char* label, int result);
bool started_;
bool joined_;
pthread_t thread_;
// No copying allowed
Thread(const Thread&);
void operator=(const Thread&);
};
} // namespace mysaber
} // namespace bubblefs
#endif // BUBBLEFS_UTILS_SABER_THREAD_H_ |
#pragma once
#include <blitzml/base/common.h>
#include <blitzml/base/solver.h>
#include <blitzml/base/logger.h>
#include <blitzml/smooth_loss/smooth_loss.h>
#include <vector>
namespace BlitzML {
class SparseLinearSolver : public Solver {
public:
SparseLinearSolver() : loss_function(NULL) { }
virtual ~SparseLinearSolver() {
delete_loss_function();
}
value_t compute_max_l1_penalty(const Dataset *data, const Parameters *params);
protected:
std::vector<value_t> omega;
std::vector<value_t> inv_lipschitz_cache;
std::vector<value_t> col_means_cache;
std::vector<const Column*> A_cols;
std::vector<value_t> ATx;
std::vector<value_t> Delta_omega;
std::vector<value_t> Delta_Aomega;
std::vector<value_t> inv_newton_2nd_derivative_cache;
std::vector<value_t> col_ip_newton_2nd_derivative_cache;
std::vector<value_t> ATy;
std::vector<value_t> ATz;
std::vector<value_t> z;
std::vector<value_t> Aomega;
std::vector<value_t> newton_2nd_derivatives;
std::vector<index_t> screen_indices_map;
SmoothLoss* loss_function;
value_t l1_penalty;
value_t sum_x;
value_t sum_newton_2nd_derivatives;
value_t Delta_bias;
value_t kappa_x;
value_t kappa_z;
value_t bias;
value_t max_inv_lipschitz_cache;
value_t change2;
index_t num_examples;
static const int MAX_BACKTRACK_STEPS = 25;
bool z_match_y;
bool z_match_x;
bool use_bias;
// objective values:
virtual value_t compute_dual_obj() const;
virtual value_t compute_primal_obj_x() const;
virtual value_t compute_primal_obj_y() const;
virtual void update_subproblem_obj_vals();
// subproblem:
void solve_subproblem();
virtual value_t update_coordinates_in_working_set();
value_t update_feature(index_t working_set_ind);
virtual void perform_backtracking();
void set_initial_subproblem_z();
void update_z();
value_t norm_diff_sq_z_initial_x(const SubproblemState& initial_state) const;
virtual void scale_Delta_Aomega_by_2nd_derivatives();
virtual void unscale_Delta_Aomega_by_2nd_derivatives();
virtual void setup_proximal_newton_problem();
void set_max_and_min_num_cd_itr(int &max_num_cd_itr, int &min_num_cd_itr) const;
void update_kappa_x();
value_t compute_cd_threshold() const;
virtual void update_bias(int max_newton_itr=5);
virtual void update_bias_subproblem();
value_t perform_newton_update_on_bias();
value_t compute_backtracking_step_size_derivative(value_t step_size) const;
void update_x(value_t step_size=0.);
virtual void update_newton_2nd_derivatives(value_t epsilon_to_add=0.);
void setup_subproblem_no_working_sets();
// y updates:
value_t compute_alpha();
void update_non_working_set_gradients();
value_t compute_alpha_for_feature(index_t j) const;
void update_y();
// working set:
unsigned short compute_priority_value(index_t i) const;
size_t size_of_component(index_t i) const;
// screening:
void screen_components();
bool mark_components_to_screen(std::vector<bool>& should_screen) const;
void apply_screening_result(const std::vector<bool>& should_screen);
// initialization:
index_t initial_problem_size() const;
void initialize(value_t *result);
value_t strong_convexity_constant() const;
void deserialize_parameters();
void set_data_dimensions();
virtual void initialize_blitz_variables(value_t* initial_conditions);
void initialize_model(value_t* initial_conditions);
void compute_Aomega();
void cache_feature_info();
void initialize_proximal_newton_variables();
// misc:
void log_variables(Logger &logger) const;
void fill_result(value_t *result) const;
void delete_loss_function();
};
} // namespace BlitzML
|
// SDLSetDisplayLayout.h
//
#import "SDLRPCRequest.h"
@class SDLPredefinedLayout;
/**
* Used to set an alternate display layout. If not sent, default screen for
* given platform will be shown
*
* Since SmartDeviceLink 2.0
*/
@interface SDLSetDisplayLayout : SDLRPCRequest {
}
/**
* @abstract Constructs a new SDLSetDisplayLayout object
*/
- (instancetype)init;
/**
* @abstract Constructs a new SDLSetDisplayLayout object indicated by the NSMutableDictionary
* parameter
* @param dict The dictionary to use
*/
- (instancetype)initWithDictionary:(NSMutableDictionary *)dict;
- (instancetype)initWithPredefinedLayout:(SDLPredefinedLayout *)predefinedLayout;
- (instancetype)initWithLayout:(NSString *)displayLayout;
/**
* @abstract A display layout. Predefined or dynamically created screen layout.
* Currently only predefined screen layouts are defined. Predefined layouts
* include: "ONSCREEN_PRESETS" Custom screen containing app-defined onscreen
* presets. Currently defined for GEN2
*/
@property (strong) NSString *displayLayout;
@end
|
/* $OpenBSD$ */
/*
* Copyright (c) 2014 Miodrag Vallat.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND 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.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <err.h>
#include <openssl/bn.h>
#include <openssl/crypto.h>
#include <openssl/dh.h>
#include <openssl/err.h>
#include <openssl/rand.h>
/*
* Test for proper bn_mul_mont behaviour when operands are of vastly different
* sizes.
*/
int
main(int argc, char *argv[])
{
DH *dh;
unsigned char *key, r[32 + 16 * 8];
size_t privsz;
RAND_bytes(r, sizeof r);
for (privsz = 32; privsz <= sizeof(r); privsz += 8) {
dh = DH_new();
if (dh == NULL)
goto err;
if (DH_generate_parameters_ex(dh, 32, DH_GENERATOR_2,
NULL) == 0)
goto err;
/* force private key to be much larger than public one */
dh->priv_key = BN_bin2bn(r, privsz, NULL);
if (dh->priv_key == NULL)
goto err;
if (DH_generate_key(dh) == 0)
goto err;
key = malloc(DH_size(dh));
if (key == NULL)
err(1, "malloc");
if (DH_compute_key(key, dh->pub_key, dh) == -1)
goto err;
free(key);
DH_free(dh);
}
return 0;
err:
ERR_print_errors_fp(stderr);
return 1;
}
|
/*
* AbstractStreamProvider.h
*
* Copyright (C) 2019 by Universitaet Stuttgart (VIS).
* Alle Rechte vorbehalten.
*/
#pragma once
#include "mmcore/CallerSlot.h"
#include "mmcore/job/AbstractTickJob.h"
#include <iostream>
namespace megamol {
namespace core {
/**
* Provides a stream.
*
* @author Alexander Straub
*/
class MEGAMOLCORE_API AbstractStreamProvider : public job::AbstractTickJob {
public:
/**
* Constructor
*/
AbstractStreamProvider();
/**
* Destructor
*/
~AbstractStreamProvider();
protected:
/**
* Callback function providing the stream.
*
* @return Stream
*/
virtual std::iostream& GetStream() = 0;
/**
* Implementation of 'Create'.
*
* @return 'true' on success, 'false' otherwise.
*/
virtual bool create() override;
/**
* Implementation of 'Release'.
*/
virtual void release() override;
/**
* Starts the job.
*
* @return true if the job has been successfully started.
*/
virtual bool run() override;
private:
/** Input slot */
CallerSlot inputSlot;
};
} // namespace core
} // namespace megamol
|
// 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 QUICHE_SPDY_CORE_HPACK_HPACK_CONSTANTS_H_
#define QUICHE_SPDY_CORE_HPACK_HPACK_CONSTANTS_H_
#include <cstddef>
#include <cstdint>
#include <vector>
#include "net/third_party/quiche/src/spdy/platform/api/spdy_export.h"
#include "starboard/types.h"
// All section references below are to
// https://httpwg.org/specs/rfc7540.html and
// https://httpwg.org/specs/rfc7541.html.
namespace spdy {
// An HpackPrefix signifies |bits| stored in the top |bit_size| bits
// of an octet.
struct HpackPrefix {
uint8_t bits;
size_t bit_size;
};
// Represents a symbol and its Huffman code (stored in most-significant bits).
struct HpackHuffmanSymbol {
uint32_t code;
uint8_t length;
uint16_t id;
};
// An entry in the static table. Must be a POD in order to avoid static
// initializers, i.e. no user-defined constructors or destructors.
struct HpackStaticEntry {
#if defined(STARBOARD)
// Some C++11 compiler need to invoke copy-constructor on this class
// when bracket-initializing a std::vector<HpackStaticEntry>, so we
// have to drop the const qualifier to enable that.
const char* name;
size_t name_len;
const char* value;
size_t value_len;
#else
const char* const name;
const size_t name_len;
const char* const value;
const size_t value_len;
#endif
};
class HpackHuffmanTable;
class HpackStaticTable;
// RFC 7540, 6.5.2: Initial value for SETTINGS_HEADER_TABLE_SIZE.
const uint32_t kDefaultHeaderTableSizeSetting = 4096;
// RFC 7541, 5.2: Flag for a string literal that is stored unmodified (i.e.,
// without Huffman encoding).
const HpackPrefix kStringLiteralIdentityEncoded = {0x0, 1};
// RFC 7541, 5.2: Flag for a Huffman-coded string literal.
const HpackPrefix kStringLiteralHuffmanEncoded = {0x1, 1};
// RFC 7541, 6.1: Opcode for an indexed header field.
const HpackPrefix kIndexedOpcode = {0b1, 1};
// RFC 7541, 6.2.1: Opcode for a literal header field with incremental indexing.
const HpackPrefix kLiteralIncrementalIndexOpcode = {0b01, 2};
// RFC 7541, 6.2.2: Opcode for a literal header field without indexing.
const HpackPrefix kLiteralNoIndexOpcode = {0b0000, 4};
// RFC 7541, 6.2.3: Opcode for a literal header field which is never indexed.
// Currently unused.
// const HpackPrefix kLiteralNeverIndexOpcode = {0b0001, 4};
// RFC 7541, 6.3: Opcode for maximum header table size update. Begins a
// varint-encoded table size with a 5-bit prefix.
const HpackPrefix kHeaderTableSizeUpdateOpcode = {0b001, 3};
// RFC 7541, Appendix B: Huffman Code.
SPDY_EXPORT_PRIVATE const std::vector<HpackHuffmanSymbol>&
HpackHuffmanCodeVector();
// RFC 7541, Appendix A: Static Table Definition.
SPDY_EXPORT_PRIVATE const std::vector<HpackStaticEntry>&
HpackStaticTableVector();
// Returns a HpackHuffmanTable instance initialized with |kHpackHuffmanCode|.
// The instance is read-only, has static lifetime, and is safe to share amoung
// threads. This function is thread-safe.
SPDY_EXPORT_PRIVATE const HpackHuffmanTable& ObtainHpackHuffmanTable();
// Returns a HpackStaticTable instance initialized with |kHpackStaticTable|.
// The instance is read-only, has static lifetime, and is safe to share amoung
// threads. This function is thread-safe.
SPDY_EXPORT_PRIVATE const HpackStaticTable& ObtainHpackStaticTable();
// RFC 7541, 8.1.2.1: Pseudo-headers start with a colon.
const char kPseudoHeaderPrefix = ':';
} // namespace spdy
#endif // QUICHE_SPDY_CORE_HPACK_HPACK_CONSTANTS_H_
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE401_Memory_Leak__char_realloc_68a.c
Label Definition File: CWE401_Memory_Leak.c.label.xml
Template File: sources-sinks-68a.tmpl.c
*/
/*
* @description
* CWE: 401 Memory Leak
* BadSource: realloc Allocate data using realloc()
* GoodSource: Allocate data on the stack
* Sinks:
* GoodSink: call free() on data
* BadSink : no deallocation of data
* Flow Variant: 68 Data flow: data passed as a global variable from one function to another in different source files
*
* */
#include "std_testcase.h"
#include <wchar.h>
char * CWE401_Memory_Leak__char_realloc_68_badData;
char * CWE401_Memory_Leak__char_realloc_68_goodG2BData;
char * CWE401_Memory_Leak__char_realloc_68_goodB2GData;
#ifndef OMITBAD
/* bad function declaration */
void CWE401_Memory_Leak__char_realloc_68b_badSink();
void CWE401_Memory_Leak__char_realloc_68_bad()
{
char * data;
data = NULL;
/* POTENTIAL FLAW: Allocate memory on the heap */
data = (char *)realloc(data, 100*sizeof(char));
if (data == NULL) {exit(-1);}
/* Initialize and make use of data */
strcpy(data, "A String");
printLine(data);
CWE401_Memory_Leak__char_realloc_68_badData = data;
CWE401_Memory_Leak__char_realloc_68b_badSink();
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* good function declarations */
void CWE401_Memory_Leak__char_realloc_68b_goodG2BSink();
void CWE401_Memory_Leak__char_realloc_68b_goodB2GSink();
/* goodG2B uses the GoodSource with the BadSink */
static void goodG2B()
{
char * data;
data = NULL;
/* FIX: Use memory allocated on the stack with ALLOCA */
data = (char *)ALLOCA(100*sizeof(char));
/* Initialize and make use of data */
strcpy(data, "A String");
printLine(data);
CWE401_Memory_Leak__char_realloc_68_goodG2BData = data;
CWE401_Memory_Leak__char_realloc_68b_goodG2BSink();
}
/* goodB2G uses the BadSource with the GoodSink */
static void goodB2G()
{
char * data;
data = NULL;
/* POTENTIAL FLAW: Allocate memory on the heap */
data = (char *)realloc(data, 100*sizeof(char));
if (data == NULL) {exit(-1);}
/* Initialize and make use of data */
strcpy(data, "A String");
printLine(data);
CWE401_Memory_Leak__char_realloc_68_goodB2GData = data;
CWE401_Memory_Leak__char_realloc_68b_goodB2GSink();
}
void CWE401_Memory_Leak__char_realloc_68_good()
{
goodG2B();
goodB2G();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
its own for testing or for building a binary to use in testing binary
analysis tools. It is not used when compiling all the testcases as one
application, which is how source code analysis tools are tested. */
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE401_Memory_Leak__char_realloc_68_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE401_Memory_Leak__char_realloc_68_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE78_OS_Command_Injection__wchar_t_connect_socket_system_16.c
Label Definition File: CWE78_OS_Command_Injection.one_string.label.xml
Template File: sources-sink-16.tmpl.c
*/
/*
* @description
* CWE: 78 OS Command Injection
* BadSource: connect_socket Read data using a connect socket (client side)
* GoodSource: Fixed string
* Sink: system
* BadSink : Execute command in data using system()
* Flow Variant: 16 Control flow: while(1)
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifdef _WIN32
#define FULL_COMMAND L"dir "
#else
#include <unistd.h>
#define FULL_COMMAND L"ls "
#endif
#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#include <direct.h>
#pragma comment(lib, "ws2_32") /* include ws2_32.lib when linking */
#define CLOSE_SOCKET closesocket
#else /* NOT _WIN32 */
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#define INVALID_SOCKET -1
#define SOCKET_ERROR -1
#define CLOSE_SOCKET close
#define SOCKET int
#endif
#define TCP_PORT 27015
#define IP_ADDRESS "127.0.0.1"
#ifdef _WIN32
#define SYSTEM _wsystem
#else /* NOT _WIN32 */
#define SYSTEM system
#endif
#ifndef OMITBAD
void CWE78_OS_Command_Injection__wchar_t_connect_socket_system_16_bad()
{
wchar_t * data;
wchar_t data_buf[100] = FULL_COMMAND;
data = data_buf;
while(1)
{
{
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
wchar_t *replace;
SOCKET connectSocket = INVALID_SOCKET;
size_t dataLen = wcslen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
/* POTENTIAL FLAW: Read data using a connect socket */
connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (connectSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = inet_addr(IP_ADDRESS);
service.sin_port = htons(TCP_PORT);
if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed, make sure to recv one
* less char than is in the recv_buf in order to append a terminator */
/* Abort on error or the connection was closed */
recvResult = recv(connectSocket, (char *)(data + dataLen), sizeof(wchar_t) * (100 - dataLen - 1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[dataLen + recvResult / sizeof(wchar_t)] = L'\0';
/* Eliminate CRLF */
replace = wcschr(data, L'\r');
if (replace)
{
*replace = L'\0';
}
replace = wcschr(data, L'\n');
if (replace)
{
*replace = L'\0';
}
}
while (0);
if (connectSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(connectSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
}
break;
}
/* POTENTIAL FLAW: Execute command in data possibly leading to command injection */
if (SYSTEM(data) != 0)
{
printLine("command execution failed!");
exit(1);
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B() - use goodsource and badsink by changing the conditions on the while statements */
static void goodG2B()
{
wchar_t * data;
wchar_t data_buf[100] = FULL_COMMAND;
data = data_buf;
while(1)
{
/* FIX: Append a fixed string to data (not user / external input) */
wcscat(data, L"*.*");
break;
}
/* POTENTIAL FLAW: Execute command in data possibly leading to command injection */
if (SYSTEM(data) != 0)
{
printLine("command execution failed!");
exit(1);
}
}
void CWE78_OS_Command_Injection__wchar_t_connect_socket_system_16_good()
{
goodG2B();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
* its own for testing or for building a binary to use in testing binary
* analysis tools. It is not used when compiling all the testcases as one
* application, which is how source code analysis tools are tested.
*/
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE78_OS_Command_Injection__wchar_t_connect_socket_system_16_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE78_OS_Command_Injection__wchar_t_connect_socket_system_16_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
/*
* $Id: math_cbrtf.c,v 1.3 2006-01-08 12:04:23 obarthel Exp $
*
* :ts=4
*
* Portable ISO 'C' (1994) runtime library for the Amiga computer
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
* 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.
*
* - Neither the name of Olaf Barthel nor the names of 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.
*
*
* PowerPC math library based in part on work by Sun Microsystems
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
*
*
* Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
*/
#ifndef _MATH_HEADERS_H
#include "math_headers.h"
#endif /* _MATH_HEADERS_H */
/****************************************************************************/
#if defined(FLOATING_POINT_SUPPORT)
/****************************************************************************/
static const ULONG
B1 = 709958130, /* B1 = (84+2/3-0.03306235651)*2**23 */
B2 = 642849266; /* B2 = (76+2/3-0.03306235651)*2**23 */
static const float
C = 5.4285717010e-01, /* 19/35 = 0x3f0af8b0 */
D = -7.0530611277e-01, /* -864/1225 = 0xbf348ef1 */
E = 1.4142856598e+00, /* 99/70 = 0x3fb50750 */
F = 1.6071428061e+00, /* 45/28 = 0x3fcdb6db */
G = 3.5714286566e-01; /* 5/14 = 0x3eb6db6e */
float
cbrtf(float x)
{
LONG hx;
float r,s,t;
ULONG sign;
ULONG high;
GET_FLOAT_WORD(hx,x);
sign=hx&0x80000000U; /* sign= sign(x) */
hx ^=sign;
if(hx>=0x7f800000) return(x+x); /* cbrt(NaN,INF) is itself */
if(hx==0)
return(x); /* cbrt(0) is itself */
SET_FLOAT_WORD(x,hx); /* x <- |x| */
/* rough cbrt to 5 bits */
if(hx<0x00800000) /* subnormal number */
{SET_FLOAT_WORD(t,0x4b800000); /* set t= 2**24 */
t*=x; GET_FLOAT_WORD(high,t); SET_FLOAT_WORD(t,high/3+B2);
}
else
SET_FLOAT_WORD(t,hx/3+B1);
/* new cbrt to 23 bits */
r=t*t/x;
s=C+r*t;
t*=G+F/(s+E+D/s);
/* retore the sign bit */
GET_FLOAT_WORD(high,t);
SET_FLOAT_WORD(t,high|sign);
return(t);
}
/****************************************************************************/
#endif /* FLOATING_POINT_SUPPORT */
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.