text
stringlengths
4
6.14k
// // 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 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU 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_LINEARROTATINGMOBILITYBASE_H #define __INET_LINEARROTATINGMOBILITYBASE_H #include "inet/mobility/base/RotatingMobilityBase.h" namespace inet { class INET_API LinearRotatingMobilityBase : public RotatingMobilityBase { protected: /** @brief End position of current linear movement. */ EulerAngles targetOrientation; protected: virtual void initializeOrientation() override; virtual EulerAngles slerp(EulerAngles from, EulerAngles to, double delta); virtual void rotate() override; /** * @brief Should be redefined in subclasses. This method gets called * when targetOrientation and nextChange has been reached, and its task is * to set a new targetOrientation and nextChange. At the end of the movement * sequence, it should set nextChange to -1. */ virtual void setTargetOrientation() = 0; public: LinearRotatingMobilityBase(); }; } // namespace inet #endif /* LINEARROTATINGMOBILITYBASE_H_ */
/* * Copyright (c) 2016-2018, Arm Limited and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "nsconfig.h" #include <string.h> #include "ns_types.h" #include "fhss_api.h" #include "fhss_config.h" #include "net_fhss.h" #include "nsdynmemLIB.h" #include "Service_Libs/fhss/fhss.h" #include "Service_Libs/fhss/fhss_common.h" #include "Service_Libs/fhss/fhss_ws.h" #include "ns_trace.h" #define TRACE_GROUP "fhss" fhss_api_t *ns_fhss_create(const fhss_configuration_t *fhss_configuration, const fhss_timer_t *fhss_timer, fhss_statistics_t *fhss_statistics) { fhss_api_t *this = ns_dyn_mem_alloc(sizeof(fhss_api_t)); if (!this) { return NULL; } // Create FHSS object fhss_structure_t *fhss_struct = fhss_enable(this, fhss_configuration, fhss_timer, fhss_statistics); if (!fhss_struct) { tr_err("Failed to enable FHSS"); ns_dyn_mem_free(this); return NULL; } fhss_set_callbacks(fhss_struct); return this; } fhss_api_t *ns_fhss_ws_create(const fhss_ws_configuration_t *fhss_configuration, const fhss_timer_t *fhss_timer) { fhss_api_t *this = ns_dyn_mem_alloc(sizeof(fhss_api_t)); if (!this) { return NULL; } // Create FHSS object fhss_structure_t *fhss_struct = fhss_ws_enable(this, fhss_configuration, fhss_timer); if (!fhss_struct) { tr_err("Failed to enable FHSS"); ns_dyn_mem_free(this); return NULL; } fhss_ws_set_callbacks(fhss_struct); return this; } int ns_fhss_ws_set_parent(const fhss_api_t *fhss_api, const uint8_t eui64[8], const broadcast_timing_info_t *bc_timing_info) { fhss_structure_t *fhss_structure = fhss_get_object_with_api(fhss_api); if (!fhss_structure || !eui64 || !bc_timing_info) { return -1; } return fhss_ws_set_parent(fhss_structure, eui64, bc_timing_info); } int ns_fhss_ws_remove_parent(const fhss_api_t *fhss_api, const uint8_t eui64[8]) { fhss_structure_t *fhss_structure = fhss_get_object_with_api(fhss_api); if (!fhss_structure || !eui64) { return -1; } return fhss_ws_remove_parent(fhss_structure, eui64); } int ns_fhss_delete(fhss_api_t *fhss_api) { fhss_structure_t *fhss_structure = fhss_get_object_with_api(fhss_api); if (!fhss_structure) { return -1; } if (fhss_disable(fhss_structure)) { return -1; } ns_dyn_mem_free(fhss_api); return 0; } int ns_fhss_configuration_set(fhss_api_t *fhss_api, const fhss_synch_configuration_t *fhss_synch_configuration) { fhss_structure_t *fhss_structure = fhss_get_object_with_api(fhss_api); if (!fhss_structure) { return -1; } return fhss_set_synch_configuration(fhss_structure, fhss_synch_configuration); } int ns_fhss_set_neighbor_info_fp(const fhss_api_t *fhss_api, fhss_get_neighbor_info *get_neighbor_info) { fhss_structure_t *fhss_structure = fhss_get_object_with_api(fhss_api); if (!fhss_structure || !fhss_structure->ws) { return -1; } fhss_structure->ws->get_neighbor_info = get_neighbor_info; return 0; } const fhss_ws_configuration_t *ns_fhss_ws_configuration_get(const fhss_api_t *fhss_api) { fhss_structure_t *fhss_structure = fhss_get_object_with_api(fhss_api); if (!fhss_structure || !fhss_structure->ws) { return NULL; } return &fhss_structure->ws->fhss_configuration; } int ns_fhss_ws_configuration_set(const fhss_api_t *fhss_api, const fhss_ws_configuration_t *fhss_configuration) { fhss_structure_t *fhss_structure = fhss_get_object_with_api(fhss_api); if (!fhss_structure || !fhss_structure->ws) { return -1; } return fhss_ws_configuration_set(fhss_structure, fhss_configuration); } int ns_fhss_ws_set_hop_count(const fhss_api_t *fhss_api, const uint8_t hop_count) { fhss_structure_t *fhss_structure = fhss_get_object_with_api(fhss_api); if (!fhss_structure || !fhss_structure->ws) { return -1; } return fhss_ws_set_hop_count(fhss_structure, hop_count); }
// // NSArray+DVAPlistModelDatasource.h // // Created by Ricardo Casanova on 15/01/2016. // #import <Foundation/Foundation.h> #import "NSArray+DVATableViewModelDatasource.h" #import "NSArray+DVAPlistModelDatasource.h" /** Implements a datasource based on a plist file. */ @interface NSArray (DVAPlistModelDatasource) /** @author Pablo Romeu, 15-05-27 09:05:05 Initializes an NSArray with a plist creating a valid DVATableViewModelProtocol @param plist the plist @return an NSArray or nil @since 1.2.4 */ -(instancetype)initWithPlist:(NSString*)plist; @end
/* * Copyright (c) 2016 Intel Corporation. * * SPDX-License-Identifier: Apache-2.0 */ #include <errno.h> #include <device.h> #include <init.h> #include <drivers/ioapic.h> #include <counter.h> #include <power.h> #include <soc.h> #include <misc/util.h> #include "qm_aon_counters.h" #include "qm_isr.h" static void aonpt_int_callback(void *user_data); static counter_callback_t user_cb; struct aon_data { #ifdef CONFIG_AON_API_REENTRANCY struct k_sem sem; #endif #ifdef CONFIG_DEVICE_POWER_MANAGEMENT u32_t device_power_state; #endif }; #define AONPT_HAS_CONTEXT_DATA \ (CONFIG_AON_API_REENTRANCY || CONFIG_DEVICE_POWER_MANAGEMENT) #if AONPT_HAS_CONTEXT_DATA static struct aon_data aonpt_context; #define AONPT_CONTEXT (&aonpt_context) #else #define AONPT_CONTEXT (NULL) #endif #ifdef CONFIG_AON_API_REENTRANCY #define RP_GET(dev) (&((struct aon_data *)(dev->driver_data))->sem) #else #define RP_GET(dev) (NULL) #endif static int aon_timer_qmsi_start(struct device *dev) { qm_aonpt_config_t qmsi_cfg; int result = 0; user_cb = NULL; qmsi_cfg.callback = NULL; qmsi_cfg.int_en = false; /* AONPT is a countdown timer. So, set the initial value to * the maximum value. */ qmsi_cfg.count = 0xffffffff; qmsi_cfg.callback_data = NULL; if (IS_ENABLED(CONFIG_AON_API_REENTRANCY)) { k_sem_take(RP_GET(dev), K_FOREVER); } if (qm_aonpt_set_config(QM_AONC_0, &qmsi_cfg)) { result = -EIO; } if (IS_ENABLED(CONFIG_AON_API_REENTRANCY)) { k_sem_give(RP_GET(dev)); } return result; } static int aon_timer_qmsi_stop(struct device *dev) { qm_aonpt_config_t qmsi_cfg; qmsi_cfg.callback = NULL; qmsi_cfg.int_en = false; qmsi_cfg.count = 0; qmsi_cfg.callback_data = NULL; if (IS_ENABLED(CONFIG_AON_API_REENTRANCY)) { k_sem_take(RP_GET(dev), K_FOREVER); } qm_aonpt_set_config(QM_AONC_0, &qmsi_cfg); if (IS_ENABLED(CONFIG_AON_API_REENTRANCY)) { k_sem_give(RP_GET(dev)); } return 0; } static u32_t aon_timer_qmsi_read(struct device *dev) { u32_t value; qm_aonpt_get_value(QM_AONC_0, (uint32_t *)&value); return value; } static int aon_timer_qmsi_set_alarm(struct device *dev, counter_callback_t callback, u32_t count, void *user_data) { qm_aonpt_config_t qmsi_cfg; int result = 0; /* Check if timer has been started */ if (QM_AONC[QM_AONC_0]->aonpt_cfg == 0) { return -ENOTSUP; } user_cb = callback; qmsi_cfg.callback = aonpt_int_callback; qmsi_cfg.int_en = true; qmsi_cfg.count = count; qmsi_cfg.callback_data = user_data; if (IS_ENABLED(CONFIG_AON_API_REENTRANCY)) { k_sem_take(RP_GET(dev), K_FOREVER); } if (qm_aonpt_set_config(QM_AONC_0, &qmsi_cfg)) { user_cb = NULL; result = -EIO; } if (IS_ENABLED(CONFIG_AON_API_REENTRANCY)) { k_sem_give(RP_GET(dev)); } return result; } static u32_t aon_timer_qmsi_get_pending_int(struct device *dev) { return QM_AONC[QM_AONC_0]->aonpt_stat; } static const struct counter_driver_api aon_timer_qmsi_api = { .start = aon_timer_qmsi_start, .stop = aon_timer_qmsi_stop, .read = aon_timer_qmsi_read, .set_alarm = aon_timer_qmsi_set_alarm, .get_pending_int = aon_timer_qmsi_get_pending_int, }; #ifdef CONFIG_DEVICE_POWER_MANAGEMENT static qm_aonc_context_t aonc_ctx; static void aonpt_qmsi_set_power_state(struct device *dev, u32_t power_state) { struct aon_data *context = dev->driver_data; context->device_power_state = power_state; } static u32_t aonpt_qmsi_get_power_state(struct device *dev) { struct aon_data *context = dev->driver_data; return context->device_power_state; } static int aonpt_suspend_device(struct device *dev) { qm_aonpt_save_context(QM_AONC_0, &aonc_ctx); aonpt_qmsi_set_power_state(dev, DEVICE_PM_SUSPEND_STATE); return 0; } static int aonpt_resume_device_from_suspend(struct device *dev) { qm_aonpt_restore_context(QM_AONC_0, &aonc_ctx); aonpt_qmsi_set_power_state(dev, DEVICE_PM_ACTIVE_STATE); return 0; } /* * Implements the driver control management functionality * the *context may include IN data or/and OUT data */ static int aonpt_qmsi_device_ctrl(struct device *dev, u32_t ctrl_command, void *context) { if (ctrl_command == DEVICE_PM_SET_POWER_STATE) { if (*((u32_t *)context) == DEVICE_PM_SUSPEND_STATE) { return aonpt_suspend_device(dev); } else if (*((u32_t *)context) == DEVICE_PM_ACTIVE_STATE) { return aonpt_resume_device_from_suspend(dev); } } else if (ctrl_command == DEVICE_PM_GET_POWER_STATE) { *((u32_t *)context) = aonpt_qmsi_get_power_state(dev); return 0; } return 0; } #else #define aonpt_qmsi_set_power_state(...) #endif static int aon_timer_init(struct device *dev) { dev->driver_api = &aon_timer_qmsi_api; user_cb = NULL; IRQ_CONNECT(IRQ_GET_NUMBER(QM_IRQ_AONPT_0_INT), CONFIG_AON_TIMER_IRQ_PRI, qm_aonpt_0_isr, NULL, IOAPIC_EDGE | IOAPIC_HIGH); irq_enable(IRQ_GET_NUMBER(QM_IRQ_AONPT_0_INT)); QM_IR_UNMASK_INTERRUPTS(QM_INTERRUPT_ROUTER->aonpt_0_int_mask); if (IS_ENABLED(CONFIG_AON_API_REENTRANCY)) { k_sem_init(RP_GET(dev), 1, UINT_MAX); } aonpt_qmsi_set_power_state(dev, DEVICE_PM_ACTIVE_STATE); return 0; } DEVICE_DEFINE(aon_timer, CONFIG_AON_TIMER_QMSI_DEV_NAME, aon_timer_init, aonpt_qmsi_device_ctrl, AONPT_CONTEXT, NULL, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &aon_timer_qmsi_api); static void aonpt_int_callback(void *user_data) { if (user_cb) { (*user_cb)(DEVICE_GET(aon_timer), user_data); } }
/* * Copyright (C) 2005-2015 Christoph Rupp (chris@crupp.de). * * 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. */ /* * The configuration settings of a Database. * * @exception_safe nothrow * @thread_safe no */ #ifndef HAM_DB_CONFIG_H #define HAM_DB_CONFIG_H #include "0root/root.h" #include <ham/types.h> // Always verify that a file of level N does not include headers > N! #ifndef HAM_ROOT_H # error "root.h was not included" #endif namespace hamsterdb { struct DatabaseConfiguration { // Constructor initializes with default values DatabaseConfiguration() : db_name(0), flags(0), key_type(HAM_TYPE_BINARY), key_size(HAM_KEY_SIZE_UNLIMITED), record_size(HAM_RECORD_SIZE_UNLIMITED), key_compressor(0), record_compressor(0) { } // the database name uint16_t db_name; // the database flags uint32_t flags; // the key type int key_type; // the key size (if specified) size_t key_size; // the record size (if specified) size_t record_size; // the algorithm for key compression int key_compressor; // the algorithm for record compression int record_compressor; }; } // namespace hamsterdb #endif // HAM_DB_CONFIG_H
/* Test 9 setjmp with register variables. Author: Ceriel Jacobs */ #include <sys/types.h> #include <setjmp.h> #include <signal.h> int max_error = 4; #include "common.h" char *tmpa; int main(int argc, char *argv []); void test9a(void); void test9b(void); void test9c(void); void test9d(void); void test9e(void); void test9f(void); char *addr(void); void garbage(void); void level1(void); void level2(void); void dolev(void); void catch(int s); void hard(void); int main(argc, argv) int argc; char *argv[]; { jmp_buf envm; int i, j, m = 0xFFFF; start(9); if (argc == 2) m = atoi(argv[1]); for (j = 0; j < 100; j++) { if (m & 00001) test9a(); if (m & 00002) test9b(); if (m & 00004) test9c(); if (m & 00010) test9d(); if (m & 00020) test9e(); if (m & 00040) test9f(); } if (errct) quit(); i = 1; if (setjmp(envm) == 0) { i = 2; longjmp(envm, 1); } else { if (i == 2) { /* Correct */ } else if (i == 1) { printf("WARNING: The setjmp/longjmp of this machine restore register variables\n\ to the value they had at the time of the Setjmp\n"); } else { printf("Aha, I just found one last error\n"); return 1; } } quit(); return(-1); /* impossible */ } void test9a() { register int p; subtest = 1; p = 200; garbage(); if (p != 200) e(1); } void test9b() { register int p, q; subtest = 2; p = 200; q = 300; garbage(); if (p != 200) e(1); if (q != 300) e(2); } void test9c() { register int p, q, r; subtest = 3; p = 200; q = 300; r = 400; garbage(); if (p != 200) e(1); if (q != 300) e(2); if (r != 400) e(3); } char buf[512]; void test9d() { register char *p; subtest = 4; p = &buf[100]; garbage(); if (p != &buf[100]) e(1); } void test9e() { register char *p, *q; subtest = 5; p = &buf[100]; q = &buf[200]; garbage(); if (p != &buf[100]) e(1); if (q != &buf[200]) e(2); } void test9f() { register char *p, *q, *r; subtest = 6; p = &buf[100]; q = &buf[200]; r = &buf[300]; garbage(); if (p != &buf[100]) e(1); if (q != &buf[200]) e(2); if (r != &buf[300]) e(3); } jmp_buf env; /* return address of local variable. This way we can check that the stack is not polluted. */ char * addr() { char a, *ret; ret = &a; return(ret); } void garbage() { register int i, j, k; register char *p, *q, *r; char *a = NULL; p = &buf[300]; q = &buf[400]; r = &buf[500]; i = 10; j = 20; k = 30; switch (setjmp(env)) { case 0: a = addr(); #ifdef __GNUC__ /* * to defeat the smartness of the GNU C optimizer we pretend we * use 'a'. Otherwise the optimizer will not detect the looping * effectuated by setjmp/longjmp, so that it thinks it can get * rid of the assignment to 'a'. */ srand((unsigned)&a); #endif longjmp(env, 1); break; case 1: if (i != 10) e(11); if (j != 20) e(12); if (k != 30) e(13); if (p != &buf[300]) e(14); if (q != &buf[400]) e(15); if (r != &buf[500]) e(16); tmpa = addr(); if (a != tmpa) e(17); level1(); break; case 2: if (i != 10) e(21); if (j != 20) e(22); if (k != 30) e(23); if (p != &buf[300]) e(24); if (q != &buf[400]) e(25); if (r != &buf[500]) e(26); tmpa = addr(); if (a != tmpa) e(27); level2(); break; case 3: if (i != 10) e(31); if (j != 20) e(32); if (k != 30) e(33); if (p != &buf[300]) e(34); if (q != &buf[400]) e(35); if (r != &buf[500]) e(36); tmpa = addr(); if (a != tmpa) e(37); hard(); case 4: if (i != 10) e(41); if (j != 20) e(42); if (k != 30) e(43); if (p != &buf[300]) e(44); if (q != &buf[400]) e(45); if (r != &buf[500]) e(46); tmpa = addr(); if (a != tmpa) e(47); return; break; default: e(100); } e(200); } void level1() { register char *p; register int i; i = 1000; p = &buf[10]; i = 200; p = &buf[20]; #ifdef __GNUC__ /* * to defeat the smartness of the GNU C optimizer we pretend we * use 'a'. Otherwise the optimizer will not detect the looping * effectuated by setjmp/longjmp, so that it thinks it can get * rid of the assignment to 'a'. */ srand(i); srand((int)*p); #endif longjmp(env, 2); } void level2() { register char *p; register int i; i = 0200; p = &buf[2]; *p = i; dolev(); } void dolev() { register char *p; register int i; i = 010; p = &buf[3]; *p = i; longjmp(env, 3); } void catch(s) int s; { longjmp(env, 4); } void hard() { register char *p; signal(SIGHUP, catch); for (p = buf; p <= &buf[511]; p++) *p = 025; kill(getpid(), SIGHUP); }
#ifndef SGX_NETIF_UTIL_H #define SGX_NETIF_UTIL_H #include <struct/sgx_netif_struct.h> #include <proxy/sgx_netif_t.h> #ifdef __cplusplus extern "C" { #endif extern unsigned int sgx_wrapper_if_nametoindex(const char *ifname); extern char *sgx_wrapper_if_indextoname(unsigned int ifindex, char *ifname); extern struct if_nameindex *sgx_wrapper_if_nameindex(void); extern void sgx_wrapper_if_freenameindex(struct if_nameindex *ptr); #ifdef __cplusplus } #endif #define if_nametoindex(A) sgx_wrapper_if_nametoindex(A) #define if_indextoname(A, B) sgx_wrapper_if_indextoname(A, B) #define if_nameindex() sgx_wrapper_if_nameindex() #define if_freenameindex(A) sgx_wrapper_if_freenameindex(A) #endif
/** @file GUIDs used as HII FormSet and HII Package list GUID in IP4 IScsiDxe driver. Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License that accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php. THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #ifndef __IP4_ISCSI_CONFIG_HII_GUID_H__ #define __IP4_ISCSI_CONFIG_HII_GUID_H__ #define IP4_ISCSI_CONFIG_GUID \ { \ 0x6456ed61, 0x3579, 0x41c9, { 0x8a, 0x26, 0x0a, 0x0b, 0xd6, 0x2b, 0x78, 0xfc } \ } #define ISCSI_CHAP_AUTH_INFO_GUID \ { \ 0x786ec0ac, 0x65ae, 0x4d1b, {0xb1, 0x37, 0xd, 0x11, 0xa, 0x48, 0x37, 0x97} \ } extern EFI_GUID gIp4IScsiConfigGuid; extern EFI_GUID gIScsiCHAPAuthInfoGuid; #endif
// // KYSquare.h // QiPa // // Created by 欧阳凯 on 15/12/8. // Copyright © 2015年 kaylio. All rights reserved. // #import <Foundation/Foundation.h> @interface KYSquare : NSObject @property (nonatomic, copy) NSString *url; @property (nonatomic, copy) NSString *android; @property (nonatomic, copy) NSString *iphone; //@property (nonatomic, copy) NSString *ID; @property (nonatomic, copy) NSString *market; @property (nonatomic, copy) NSString *ipad; @property (nonatomic, copy) NSString *name; @property (nonatomic, copy) NSString *icon; @end
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // #import "UnityPLCrashReporter.h" @interface UnityPLCrashReporter (PrivateMethods) - (id)crashReportPath; - (id)queuedCrashReportDirectory; - (id)crashReportDirectory; - (_Bool)populateCrashReportDirectoryAndReturnError:(id *)arg1; - (int)mapToAsyncSymbolicationStrategy:(unsigned long long)arg1; - (void)dealloc; - (id)enableMachExceptionServerWithPreviousPortSet:(id *)arg1 callback:(CDUnknownFunctionPointerType)arg2 context:(void *)arg3 error:(id *)arg4; - (id)initWithBundle:(id)arg1 configuration:(id)arg2; - (id)initWithApplicationIdentifier:(id)arg1 appVersion:(id)arg2 configuration:(id)arg3; @end
/*******************************************ÉêÃ÷*************************************** ±¾Ç¶Èëʽ²Ù×÷ϵͳδ¾­ÊÚȨ£¬½ûÖ¹Ó¦ÓÃÓÚÈκÎÉÌÒµÓÃ; °æÈ¨ËùÓУ¬ÇÖȨ±Ø¾¿ http://www.trtos.com/ **************************************************************************************/ #include <Include.h> #include <..\USER\Prj_CXHeftSensor\ADC_Driver.h> volatile uint16 ADC_Value[ADC_BUFSize][ADC_CHN]; uint16 ADCBuffer[3]; static void ADC3_GPIO_Config(void) { GPIO_InitTypeDef GPIO_InitStructure; RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1, ENABLE); RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1 | RCC_APB2Periph_GPIOA, ENABLE); GPIO_InitStructure.GPIO_Pin =GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN; GPIO_Init(GPIOA, &GPIO_InitStructure); // PC1,ÊäÈëʱ²»ÓÃÉèÖÃËÙÂÊ } static void ADC3_Mode_Config() { ADC_InitTypeDef ADC_InitStructure; DMA_InitTypeDef DMA_InitStructure; ADC_DeInit(ADC1); //½«ÍâÉè ADC1 µÄÈ«²¿¼Ä´æÆ÷ÖØÉèΪȱʡֵ ADC_InitStructure.ADC_Mode = ADC_Mode_Independent; //ADC¹¤×÷ģʽ:ADC1ºÍADC2¹¤×÷ÔÚ¶ÀÁ¢Ä£Ê½ ADC_InitStructure.ADC_ScanConvMode =ENABLE; //Ä£Êýת»»¹¤×÷ÔÚɨÃèģʽ ADC_InitStructure.ADC_ContinuousConvMode = ENABLE; //Ä£Êýת»»¹¤×÷ÔÚÁ¬Ðø×ª»»Ä£Ê½ ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None; //Íⲿ´¥·¢×ª»»¹Ø±Õ ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right; //ADCÊý¾ÝÓÒ¶ÔÆë ADC_InitStructure.ADC_NbrOfChannel =ADC_CHN; //˳Ðò½øÐйæÔòת»»µÄADCͨµÀµÄÊýÄ¿ ADC_Init(ADC1, &ADC_InitStructure); //¸ù¾ÝADC_InitStructÖÐÖ¸¶¨µÄ²ÎÊý³õʼ»¯ÍâÉèADCxµÄ¼Ä´æÆ÷ ADC_RegularChannelConfig(ADC1, ADC_Channel_0, 1, ADC_SampleTime_239Cycles5); ADC_RegularChannelConfig(ADC1, ADC_Channel_1, 2, ADC_SampleTime_239Cycles5); ADC_RegularChannelConfig(ADC1, ADC_Channel_2, 3, ADC_SampleTime_239Cycles5); ADC_Cmd(ADC1, ENABLE); //ʹÄÜÖ¸¶¨µÄADC1 ADC_ResetCalibration(ADC1); //¸´Î»Ö¸¶¨µÄADC1µÄУ׼¼Ä´æÆ÷ while(ADC_GetResetCalibrationStatus(ADC1)); //»ñÈ¡ADC1¸´Î»Ð£×¼¼Ä´æÆ÷µÄ״̬,ÉèÖÃ״̬ÔòµÈ´ý ADC_StartCalibration(ADC1); //¿ªÊ¼Ö¸¶¨ADC1µÄУ׼״̬ while(ADC_GetCalibrationStatus(ADC1)); //»ñȡָ¶¨ADC1µÄУ׼³ÌÐò,ÉèÖÃ״̬ÔòµÈ´ý DMA_DeInit(DMA1_Channel1); //½«DMAµÄͨµÀ1¼Ä´æÆ÷ÖØÉèΪȱʡֵ DMA_InitStructure.DMA_PeripheralBaseAddr = (u32)&ADC1->DR; //DMAÍâÉèADC»ùµØÖ· DMA_InitStructure.DMA_MemoryBaseAddr = (u32)&ADC_Value; //DMAÄÚ´æ»ùµØÖ· DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralSRC; //ÄÚ´æ×÷ΪÊý¾Ý´«ÊäµÄÄ¿µÄµØ DMA_InitStructure.DMA_BufferSize = ADC_BUFSize*ADC_CHN; //DMAͨµÀµÄDMA»º´æµÄ´óС DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable; //ÍâÉèµØÖ·¼Ä´æÆ÷²»±ä DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable; //ÄÚ´æµØÖ·¼Ä´æÆ÷µÝÔö DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord; //Êý¾Ý¿í¶ÈΪ16λ DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord; //Êý¾Ý¿í¶ÈΪ16λ DMA_InitStructure.DMA_Mode = DMA_Mode_Circular; //¹¤×÷ÔÚÑ­»·»º´æÄ£Ê½ DMA_InitStructure.DMA_Priority = DMA_Priority_High; //DMAͨµÀ xÓµÓиßÓÅÏȼ¶ DMA_InitStructure.DMA_M2M = DMA_M2M_Disable; //DMAͨµÀxûÓÐÉèÖÃΪÄÚ´æµ½ÄÚ´æ´«Êä DMA_Init(DMA1_Channel1, &DMA_InitStructure); //¸ù¾ÝDMA_InitStructÖÐÖ¸¶¨µÄ²ÎÊý³õʼ»¯DMAµÄͨµÀ ADC_SoftwareStartConvCmd(ADC1, ENABLE); DMA_Cmd(DMA1_Channel1, ENABLE); DMA_ITConfig(DMA1_Channel1, DMA_IT_TC, ENABLE); ADC_DMACmd(ADC1, ENABLE); } void ADCForTankHand_Init() { ADC3_GPIO_Config(); ADC3_Mode_Config(); } uint16 ADCFormlx91204_ReadFitel(uint8 CH) { uint8 i; uint32 Pool=0; for(i=0;i<ADC_BUFSize;i++)Pool+=ADC_Value[i][CH]; return Pool/ADC_BUFSize; } void Task_ADCFitel(void *Tags) { uint8 i=0; ADCForTankHand_Init(); while(1) { ADCBuffer[i]=ADCFormlx91204_ReadFitel(i); if(i++>3)i=0; Tos_TaskDelay(100); } }
/* * Copyright (c) 2016 Intel Corporation * * Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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. * * This file is part of the Contiki operating system. */ #include <string.h> #include <stddef.h> #include "os/mynewt.h" #include "oic/port/mynewt/config.h" #include "oic/messaging/coap/transactions.h" #include "oic/messaging/coap/observe.h" #include "oic/oc_buffer.h" #ifdef OC_CLIENT #include "oic/oc_client_state.h" #endif /* OC_CLIENT */ #ifdef OC_SECURITY #include "security/oc_dtls.h" #endif #include "port/mynewt/adaptor.h" static struct os_mempool oc_transaction_memb; static uint8_t oc_transaction_area[OS_MEMPOOL_BYTES(COAP_MAX_OPEN_TRANSACTIONS, sizeof(coap_transaction_t))]; static SLIST_HEAD(, coap_transaction) oc_transaction_list; static void coap_transaction_retrans(struct os_event *ev); void coap_transaction_init(void) { os_mempool_init(&oc_transaction_memb, COAP_MAX_OPEN_TRANSACTIONS, sizeof(coap_transaction_t), oc_transaction_area, "coap_tran"); } coap_transaction_t * coap_new_transaction(uint16_t mid, oc_endpoint_t *endpoint) { coap_transaction_t *t; struct os_mbuf *m; t = os_memblock_get(&oc_transaction_memb); if (t) { m = oc_allocate_mbuf(endpoint); if (m) { t->mid = mid; t->retrans_counter = 0; t->m = m; os_callout_init(&t->retrans_timer, oc_evq_get(), coap_transaction_retrans, t); /* list itself makes sure same element is not added twice */ SLIST_INSERT_HEAD(&oc_transaction_list, t, next); } else { os_memblock_put(&oc_transaction_memb, t); t = NULL; } } return t; } /*---------------------------------------------------------------------------*/ void coap_send_transaction(coap_transaction_t *t) { bool confirmable = false; confirmable = (COAP_TYPE_CON == t->type) ? true : false; OC_LOG_DEBUG("Sending transaction %u\n", t->mid); if (confirmable) { if (t->retrans_counter < COAP_MAX_RETRANSMIT) { /* not timed out yet */ if (t->retrans_counter == 0) { t->retrans_tmo = COAP_RESPONSE_TIMEOUT_TICKS + (oc_random_rand() % (oc_clock_time_t)COAP_RESPONSE_TIMEOUT_BACKOFF_MASK); OC_LOG_DEBUG("Initial interval " OC_CLK_FMT "\n", t->retrans_tmo); } else { t->retrans_tmo <<= 1; /* double */ OC_LOG_DEBUG("Doubled " OC_CLK_FMT "\n", t->retrans_tmo); } os_callout_reset(&t->retrans_timer, t->retrans_tmo); coap_send_message(t->m, 1); t = NULL; } else { /* timed out */ OC_LOG_DEBUG("Timeout\n"); #ifdef OC_SERVER /* handle observers */ coap_remove_observer_by_client(OC_MBUF_ENDPOINT(t->m)); #endif /* OC_SERVER */ #ifdef OC_SECURITY if (OC_MBUF_ENDPOINT(t->m)->flags & SECURED) { oc_sec_dtls_close_init(OC_MBUF_ENDPOINT(t->m)); } #endif /* OC_SECURITY */ #ifdef OC_CLIENT oc_ri_remove_client_cb_by_mid(t->mid); #endif /* OC_CLIENT */ coap_clear_transaction(t); } } else { coap_send_message(t->m, 0); t->m = NULL; coap_clear_transaction(t); } } /*---------------------------------------------------------------------------*/ void coap_clear_transaction(coap_transaction_t *t) { struct coap_transaction *tmp; if (t) { os_callout_stop(&t->retrans_timer); os_mbuf_free_chain(t->m); /* * Transaction might not be in the list yet. */ SLIST_FOREACH(tmp, &oc_transaction_list, next) { if (t == tmp) { SLIST_REMOVE(&oc_transaction_list, t, coap_transaction, next); break; } } os_memblock_put(&oc_transaction_memb, t); } } coap_transaction_t * coap_get_transaction_by_mid(uint16_t mid) { coap_transaction_t *t; SLIST_FOREACH(t, &oc_transaction_list, next) { if (t->mid == mid) { return t; } } return NULL; } static void coap_transaction_retrans(struct os_event *ev) { coap_transaction_t *t = ev->ev_arg; ++(t->retrans_counter); OC_LOG_DEBUG("Retransmitting %u (%u)\n", t->mid, t->retrans_counter); coap_send_transaction(t); }
/* * Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ #import "../AmazonServiceRequestConfig.h" /** * Delete Policy Request * * \ingroup AutoScaling */ @interface AutoScalingDeletePolicyRequest:AmazonServiceRequestConfig { NSString *autoScalingGroupName; NSString *policyName; } /** * Default constructor for a new object. Callers should use the * property methods to initialize this object after creating it. */ -(id)init; /** * The name of the Auto Scaling group. * <p> * <b>Constraints:</b><br/> * <b>Length: </b>1 - 1600<br/> * <b>Pattern: </b>[\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*<br/> */ @property (nonatomic, retain) NSString *autoScalingGroupName; /** * The name or PolicyARN of the policy you want to delete. * <p> * <b>Constraints:</b><br/> * <b>Length: </b>1 - 1600<br/> * <b>Pattern: </b>[\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*<br/> */ @property (nonatomic, retain) NSString *policyName; /** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. */ -(NSString *)description; @end
/* * Copyright (C) 2011 Andrew Turner * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ /* * Provide an implementation of __aeabi_unwind_cpp_pr{0,1,2}. These are * required by libc but are implemented in libgcc_eh.a which we don't link * against. The libgcc_eh.a version will be called so we call abort to * check this. */ #include <sys/cdefs.h> __FBSDID("$FreeBSD: soc2013/dpl/head/lib/libc/arm/aeabi/aeabi_unwind_cpp.c 246856 2013-01-19 05:33:55Z andrew $"); #include <stdlib.h> void __aeabi_unwind_cpp_pr0(void) __hidden; void __aeabi_unwind_cpp_pr1(void) __hidden; void __aeabi_unwind_cpp_pr2(void) __hidden; void __aeabi_unwind_cpp_pr0(void) { abort(); } void __aeabi_unwind_cpp_pr1(void) { abort(); } void __aeabi_unwind_cpp_pr2(void) { abort(); }
/* $NetBSD: tmpfs_fifoops.c,v 1.5 2005/12/11 12:24:29 christos Exp $ */ /*- * Copyright (c) 2005 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation * by Julio M. Merino Vidal, developed as part of Google's Summer of Code * 2005 program. * * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ /* * tmpfs vnode interface for named pipes. */ #include <sys/cdefs.h> __FBSDID("$FreeBSD: soc2013/dpl/head/sys/fs/tmpfs/tmpfs_fifoops.c 182782 2008-09-03 18:53:48Z delphij $"); #include <sys/param.h> #include <sys/filedesc.h> #include <sys/proc.h> #include <sys/vnode.h> #include <vm/vm.h> #include <vm/vm_object.h> #include <fs/tmpfs/tmpfs.h> #include <fs/tmpfs/tmpfs_fifoops.h> #include <fs/tmpfs/tmpfs_vnops.h> /* --------------------------------------------------------------------- */ static int tmpfs_fifo_kqfilter(struct vop_kqfilter_args *ap) { struct vnode *vp; struct tmpfs_node *node; vp = ap->a_vp; node = VP_TO_TMPFS_NODE(vp); switch (ap->a_kn->kn_filter){ case EVFILT_READ: node->tn_status |= TMPFS_NODE_ACCESSED; break; case EVFILT_WRITE: node->tn_status |= TMPFS_NODE_MODIFIED; break; } return fifo_specops.vop_kqfilter(ap); } /* --------------------------------------------------------------------- */ static int tmpfs_fifo_close(struct vop_close_args *v) { struct tmpfs_node *node; node = VP_TO_TMPFS_NODE(v->a_vp); node->tn_status |= TMPFS_NODE_ACCESSED; tmpfs_update(v->a_vp); return fifo_specops.vop_close(v); } /* * vnode operations vector used for fifos stored in a tmpfs file system. */ struct vop_vector tmpfs_fifoop_entries = { .vop_default = &fifo_specops, .vop_close = tmpfs_fifo_close, .vop_reclaim = tmpfs_reclaim, .vop_access = tmpfs_access, .vop_getattr = tmpfs_getattr, .vop_setattr = tmpfs_setattr, .vop_kqfilter = tmpfs_fifo_kqfilter, };
//%LICENSE//////////////////////////////////////////////////////////////// // // Licensed to The Open Group (TOG) under one or more contributor license // agreements. Refer to the OpenPegasusNOTICE.txt file distributed with // this work for additional information regarding copyright ownership. // Each contributor licenses this file to you under the OpenPegasus Open // Source License; you may not use this file except in compliance with the // License. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), // to deal in the Software without restriction, including without limitation // the rights to use, copy, modify, merge, publish, distribute, sublicense, // and/or sell copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // ////////////////////////////////////////////////////////////////////////// // //%///////////////////////////////////////////////////////////////////////// #include "CIMFixtureBase.h" class UNIX_ConcreteJobFixture : public CIMFixtureBase { public: UNIX_ConcreteJobFixture(); ~UNIX_ConcreteJobFixture(); virtual void Run(); };
#ifndef TARANTOOL_STAT_H_INCLUDED #define TARANTOOL_STAT_H_INCLUDED /* * 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 <COPYRIGHT HOLDER> ``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 * <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 <stddef.h> #include <stdint.h> void stat_init(void); void stat_free(void); void stat_cleanup(int base, size_t max_idx); int stat_register(const char **name, size_t count); extern int stat_max_name_len; void stat_collect(int base, int name, int64_t value); typedef int (*stat_cb)(const char *name, int rps, int64_t total, void *cb_ctx); int stat_foreach(stat_cb cb, void *cb_ctx); #endif /* TARANTOOL_STAT_H_INCLUDED */
/*- * Copyright (c) 2008 Robert N. M. Watson * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD: soc2013/dpl/head/tools/tools/netrate/tcpp/tcpp_util.c 189666 2009-03-10 14:52:17Z rwatson $ */ #include <sys/types.h> #include <sys/endian.h> #include "tcpp.h" void tcpp_header_encode(struct tcpp_header *thp) { thp->th_magic = htobe32(thp->th_magic); thp->th_len = htobe64(thp->th_len); } void tcpp_header_decode(struct tcpp_header *thp) { thp->th_magic = be32toh(thp->th_magic); thp->th_len = be64toh(thp->th_len); }
#ifdef __cplusplus extern "C" { #endif #include "lua.h" #ifdef __cplusplus } #endif
/*! \file Copyright (c) 2003, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from U.S. Dept. of Energy) All rights reserved. The source code is distributed under BSD license, see the file License.txt at the top-level directory. */ /* * -- SuperLU routine (version 2.0) -- * Univ. of California Berkeley, Xerox Palo Alto Research Center, * and Lawrence Berkeley National Lab. * November 15, 1997 * */ #include "slu_cdefs.h" /* * Convert a full matrix into a sparse matrix format. */ int sp_cconvert(int m, int n, complex *A, int lda, int kl, int ku, complex *a, int *asub, int *xa, int *nnz) { int lasta = 0; int i, j, ilow, ihigh; int *row; complex *val; for (j = 0; j < n; ++j) { xa[j] = lasta; val = &a[xa[j]]; row = &asub[xa[j]]; ilow = SUPERLU_MAX(0, j - ku); ihigh = SUPERLU_MIN(n-1, j + kl); for (i = ilow; i <= ihigh; ++i) { val[i-ilow] = A[i + j*lda]; row[i-ilow] = i; } lasta += ihigh - ilow + 1; } xa[n] = *nnz = lasta; return 0; }
/*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #ifndef __TEST_MODEL_FACTORY_H #define __TEST_MODEL_FACTORY_H #include <mitkCommon.h> #include "mitkConcreteModelFactoryBase.h" #include "mitkTestModel.h" #include "MitkModelFitExports.h" namespace mitk { class MITKMODELFIT_EXPORT TestModelFactory : public ConcreteModelFactoryBase<TestModel> { public: mitkClassMacro(TestModelFactory, ConcreteModelFactoryBase<TestModel>); itkFactorylessNewMacro(Self); ParametersType GetDefaultInitialParameterization() const override; protected: ModelParameterizerBase::Pointer DoCreateParameterizer(const modelFit::ModelFitInfo* fit) const override; TestModelFactory(); ~TestModelFactory() override; private: //No copy constructor allowed TestModelFactory(const Self& source); void operator=(const Self&); //purposely not implemented }; } #endif //__LINEAR_TEST_MODEL_FACTORY_H
/* Copyright 2019 The Chromium OS Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "common.h" #include "led_onoff_states.h" #include "led_common.h" #include "gpio.h" #define LED_OFF_LVL 1 #define LED_ON_LVL 0 __override const int led_charge_lvl_1 = 5; __override const int led_charge_lvl_2 = 97; __override struct led_descriptor led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = { [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_RED, LED_INDEFINITE} }, [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} }, [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_GREEN, LED_INDEFINITE} }, [STATE_DISCHARGE_S0] = {{LED_OFF, LED_INDEFINITE} }, [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} }, [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} }, [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_RED, 1 * LED_ONE_SEC}, {LED_OFF, 1 * LED_ONE_SEC} }, [STATE_FACTORY_TEST] = {{EC_LED_COLOR_RED, 2 * LED_ONE_SEC}, {EC_LED_COLOR_GREEN, 2 * LED_ONE_SEC} }, }; __override const struct led_descriptor led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = { [PWR_LED_STATE_ON] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} }, [PWR_LED_STATE_SUSPEND_AC] = {{EC_LED_COLOR_WHITE, 3 * LED_ONE_SEC}, {LED_OFF, 0.5 * LED_ONE_SEC} }, [PWR_LED_STATE_SUSPEND_NO_AC] = {{LED_OFF, LED_INDEFINITE} }, [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} }, }; const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED, EC_LED_ID_POWER_LED }; const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids); __override void led_set_color_power(enum ec_led_colors color) { if (color == EC_LED_COLOR_WHITE) gpio_set_level(GPIO_POWER_LED_3_L, LED_ON_LVL); else /* LED_OFF and unsupported colors */ gpio_set_level(GPIO_POWER_LED_3_L, LED_OFF_LVL); } __override void led_set_color_battery(enum ec_led_colors color) { switch (color) { case EC_LED_COLOR_RED: gpio_set_level(GPIO_BAT_LED_1_L, LED_OFF_LVL); gpio_set_level(GPIO_BAT_LED_2_L, LED_ON_LVL); break; case EC_LED_COLOR_AMBER: gpio_set_level(GPIO_BAT_LED_1_L, LED_ON_LVL); gpio_set_level(GPIO_BAT_LED_2_L, LED_ON_LVL); break; case EC_LED_COLOR_GREEN: gpio_set_level(GPIO_BAT_LED_1_L, LED_ON_LVL); gpio_set_level(GPIO_BAT_LED_2_L, LED_OFF_LVL); break; default: /* LED_OFF and other unsupported colors */ gpio_set_level(GPIO_BAT_LED_1_L, LED_OFF_LVL); gpio_set_level(GPIO_BAT_LED_2_L, LED_OFF_LVL); break; } } void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range) { if (led_id == EC_LED_ID_BATTERY_LED) { brightness_range[EC_LED_COLOR_RED] = 1; brightness_range[EC_LED_COLOR_AMBER] = 1; brightness_range[EC_LED_COLOR_GREEN] = 1; } else if (led_id == EC_LED_ID_POWER_LED) { brightness_range[EC_LED_COLOR_WHITE] = 1; } } int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness) { if (led_id == EC_LED_ID_BATTERY_LED) { if (brightness[EC_LED_COLOR_RED] != 0) led_set_color_battery(EC_LED_COLOR_RED); else if (brightness[EC_LED_COLOR_AMBER] != 0) led_set_color_battery(EC_LED_COLOR_AMBER); else if (brightness[EC_LED_COLOR_GREEN] != 0) led_set_color_battery(EC_LED_COLOR_GREEN); else led_set_color_battery(LED_OFF); } else if (led_id == EC_LED_ID_POWER_LED) { if (brightness[EC_LED_COLOR_WHITE] != 0) led_set_color_power(EC_LED_COLOR_WHITE); else led_set_color_power(LED_OFF); } return EC_SUCCESS; }
/*========================================================================= Program: Visualization Toolkit Module: vtkCurvatures.h Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ // .NAME vtkCurvatures - compute curvatures (Gauss and mean) of a Polydata object // .SECTION Description // vtkCurvatures takes a polydata input and computes the curvature of the // mesh at each point. Four possible methods of computation are available : // // Gauss Curvature // discrete Gauss curvature (K) computation, // \f$K(vertex v) = 2*PI-\sum_{facet neighbs f of v} (angle_f at v)\f$ // The contribution of every facet is for the moment weighted by \f$Area(facet)/3\f$ // The units of Gaussian Curvature are \f$[1/m^2]\f$ // // Mean Curvature // \f$H(vertex v) = average over edges neighbs e of H(e)\f$ // \f$H(edge e) = length(e)*dihedral_angle(e)\f$ // NB: dihedral_angle is the ORIENTED angle between -PI and PI, // this means that the surface is assumed to be orientable // the computation creates the orientation // The units of Mean Curvature are [1/m] // // Maximum (\f$k_max\f$) and Minimum (\f$k_min\f$) Principal Curvatures // \f$k_max = H + sqrt(H^2 - K)\f$ // \f$k_min = H - sqrt(H^2 - K)\f$ // Excepting spherical and planar surfaces which have equal principal curvatures, // the curvature at a point on a surface varies with the direction one "sets off" // from the point. For all directions, the curvature will pass through two extrema: // a minimum (\f$k_min\f$) and a maximum (\f$k_max\f$) which occur at mutually orthogonal // directions to each other. // // NB. The sign of the Gauss curvature is a geometric ivariant, it should be +ve // when the surface looks like a sphere, -ve when it looks like a saddle, // however, the sign of the Mean curvature is not, it depends on the // convention for normals - This code assumes that normals point outwards (ie // from the surface of a sphere outwards). If a given mesh produces curvatures // of opposite senses then the flag InvertMeanCurvature can be set and the // Curvature reported by the Mean calculation will be inverted. // // .SECTION Thanks // Philip Batchelor philipp.batchelor@kcl.ac.uk for creating and contributing // the class and Andrew Maclean a.maclean@acfr.usyd.edu.au for cleanups and // fixes. Thanks also to Goodwin Lawlor for contributing patch to calculate // principal curvatures // // .SECTION See Also // #ifndef vtkCurvatures_h #define vtkCurvatures_h #include "vtkFiltersGeneralModule.h" // For export macro #include "vtkPolyDataAlgorithm.h" #define VTK_CURVATURE_GAUSS 0 #define VTK_CURVATURE_MEAN 1 #define VTK_CURVATURE_MAXIMUM 2 #define VTK_CURVATURE_MINIMUM 3 class VTKFILTERSGENERAL_EXPORT vtkCurvatures : public vtkPolyDataAlgorithm { public: vtkTypeMacro(vtkCurvatures,vtkPolyDataAlgorithm); void PrintSelf(ostream& os, vtkIndent indent); // Description: // Construct with curvature type set to Gauss static vtkCurvatures *New(); // Description: // Set/Get Curvature type // VTK_CURVATURE_GAUSS: Gaussian curvature, stored as // DataArray "Gauss_Curvature" // VTK_CURVATURE_MEAN : Mean curvature, stored as // DataArray "Mean_Curvature" vtkSetMacro(CurvatureType,int); vtkGetMacro(CurvatureType,int); void SetCurvatureTypeToGaussian() { this->SetCurvatureType(VTK_CURVATURE_GAUSS); } void SetCurvatureTypeToMean() { this->SetCurvatureType(VTK_CURVATURE_MEAN); } void SetCurvatureTypeToMaximum() { this->SetCurvatureType(VTK_CURVATURE_MAXIMUM); } void SetCurvatureTypeToMinimum() { this->SetCurvatureType(VTK_CURVATURE_MINIMUM); } // Description: // Set/Get the flag which inverts the mean curvature calculation for // meshes with inward pointing normals (default false) vtkSetMacro(InvertMeanCurvature,int); vtkGetMacro(InvertMeanCurvature,int); vtkBooleanMacro(InvertMeanCurvature,int); protected: vtkCurvatures(); // Usual data generation method int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); // Description: // discrete Gauss curvature (K) computation, // cf http://www-ipg.umds.ac.uk/p.batchelor/curvatures/curvatures.html void GetGaussCurvature(vtkPolyData *output); // discrete Mean curvature (H) computation, // cf http://www-ipg.umds.ac.uk/p.batchelor/curvatures/curvatures.html void GetMeanCurvature(vtkPolyData *output); //Description: // Maximum principal curvature \f$k_max = H + sqrt(H^2 -K)\f$ void GetMaximumCurvature(vtkPolyData *input, vtkPolyData *output); //Description: // Minimum principal curvature \f$k_min = H - sqrt(H^2 -K)\f$ void GetMinimumCurvature(vtkPolyData *input, vtkPolyData *output); // Vars int CurvatureType; int InvertMeanCurvature; private: vtkCurvatures(const vtkCurvatures&) VTK_DELETE_FUNCTION; void operator=(const vtkCurvatures&) VTK_DELETE_FUNCTION; }; #endif
#ifndef TRITONSORT_CPU_AFFINITY_SETTER_TEST_H #define TRITONSORT_CPU_AFFINITY_SETTER_TEST_H #include <set> #include <stdint.h> #include "third-party/googletest.h" class CPUAffinitySetterTest : public ::testing::Test { protected: // Assert that only the CPUs present in the cpus vector are set // in affinityMask void assertCPUsSet(cpu_set_t& affinityMask, uint64_t numCPUs, std::set<int>& cpus); }; #endif // TRITONSORT_CPU_AFFINITY_SETTER_TEST_H
/* $NetBSD: strlcat.c,v 1.4 2013/01/23 07:57:27 matt Exp $ */ /* $OpenBSD: strlcat.c,v 1.10 2003/04/12 21:56:39 millert Exp $ */ /* * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> * * 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 TODD C. MILLER DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL TODD C. MILLER 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. */ #ifdef _KERNEL #include <sys/libkern.h> #else #include <assert.h> #include <string.h> #endif /* * Appends src to string dst of size siz (unlike strncat, siz is the * full size of dst, not space left). At most siz-1 characters * will be copied. Always NUL terminates (unless siz <= strlen(dst)). * Returns strlen(src) + MIN(siz, strlen(initial dst)). * If retval >= siz, truncation occurred. */ size_t strlcat(char *dst, const char *src, size_t siz) { char *d = dst; const char *s = src; size_t n = siz; size_t dlen; _DIAGASSERT(dst != NULL); _DIAGASSERT(src != NULL); /* Find the end of dst and adjust bytes left but don't go past end */ while (n-- != 0 && *d != '\0') d++; dlen = d - dst; n = siz - dlen; if (n == 0) return (dlen + strlen(s)); while (*s != '\0') { if (n != 1) { *d++ = *s; n--; } s++; } *d = '\0'; return (dlen + (s - src)); /* count does not include NUL */ }
/* * Copyright 2021 Google LLC * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef skgpu_GraphicsPipelineDesc_DEFINED #define skgpu_GraphicsPipelineDesc_DEFINED #include "include/core/SkTypes.h" #include "experimental/graphite/src/Attribute.h" #include "experimental/graphite/src/DrawTypes.h" #include "include/core/SkSpan.h" #include "include/private/SkOpts_spi.h" #include "include/private/SkTArray.h" #include "include/private/SkUniquePaintParamsID.h" #include <array> namespace skgpu { class RenderStep; /** * GraphicsPipelineDesc represents the state needed to create a backend specific GraphicsPipeline, * minus the target-specific properties that can be inferred from the DrawPass and RenderPassTask. */ class GraphicsPipelineDesc { public: GraphicsPipelineDesc(); SkSpan<const uint32_t> asKey() const { return SkMakeSpan(fKey.data(), fKey.size()); } bool operator==(const GraphicsPipelineDesc& that) const { return this->fKey == that.fKey; } bool operator!=(const GraphicsPipelineDesc& other) const { return !(*this == other); } // Describes the geometric portion of the pipeline's program and the pipeline's fixed state // (except for renderpass-level state that will never change between draws). const RenderStep* renderStep() const { return fRenderStep; } // UniqueID of the required PaintParams SkUniquePaintParamsID paintParamsID() const { return fUniqueID; } void setProgram(const RenderStep* step, SkUniquePaintParamsID uniqueID) { SkASSERT(step); fRenderStep = step; fUniqueID = uniqueID; uintptr_t addr = reinterpret_cast<uintptr_t>(fRenderStep); memcpy(fKey.data(), &addr, sizeof(uintptr_t)); fKey[kWords - 1] = fUniqueID.asUInt(); } struct Hash { uint32_t operator()(const GraphicsPipelineDesc& desc) const { return SkOpts::hash_fn(desc.fKey.data(), desc.fKey.size() * sizeof(uint32_t), 0); } }; private: // The key is the RenderStep address and the uint32_t key from Combination static constexpr int kWords = sizeof(uintptr_t) / sizeof(uint32_t) + 1; static_assert(sizeof(uintptr_t) % sizeof(uint32_t) == 0); // TODO: I wonder if we could expose the "key" as just a char[] union over the renderstep and // paint combination? That would avoid extra size, but definitely locks GraphicsPipelineDesc // keys to the current process, which is probably okay since we can have something a with a more // stable hash used for the pre-compilation combos. std::array<uint32_t, kWords> fKey; // Each RenderStep defines a fixed set of attributes and rasterization state, as well as the // shader fragments that control the geometry and coverage calculations. The RenderStep's shader // is combined with the rest of the shader generated from the PaintParams. Because each // RenderStep is fixed, its pointer can be used as a proxy for everything that it specifies in // the GraphicsPipeline. const RenderStep* fRenderStep = nullptr; SkUniquePaintParamsID fUniqueID; }; } // namespace skgpu #endif // skgpu_GraphicsPipelineDesc_DEFINED
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE134_Uncontrolled_Format_String__wchar_t_console_vprintf_52b.c Label Definition File: CWE134_Uncontrolled_Format_String.vasinks.label.xml Template File: sources-vasinks-52b.tmpl.c */ /* * @description * CWE: 134 Uncontrolled Format String * BadSource: console Read input from the console * GoodSource: Copy a fixed string into data * Sinks: vprintf * GoodSink: vwprintf with a format string * BadSink : vwprintf without a format string * Flow Variant: 52 Data flow: data passed as an argument from one function to another to another in three different source files * * */ #include <stdarg.h> #include "std_testcase.h" #ifndef _WIN32 #include <wchar.h> #endif #ifndef OMITBAD /* bad function declaration */ void CWE134_Uncontrolled_Format_String__wchar_t_console_vprintf_52c_badSink(wchar_t * data); void CWE134_Uncontrolled_Format_String__wchar_t_console_vprintf_52b_badSink(wchar_t * data) { CWE134_Uncontrolled_Format_String__wchar_t_console_vprintf_52c_badSink(data); } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ void CWE134_Uncontrolled_Format_String__wchar_t_console_vprintf_52c_goodG2BSink(wchar_t * data); void CWE134_Uncontrolled_Format_String__wchar_t_console_vprintf_52b_goodG2BSink(wchar_t * data) { CWE134_Uncontrolled_Format_String__wchar_t_console_vprintf_52c_goodG2BSink(data); } /* goodB2G uses the BadSource with the GoodSink */ void CWE134_Uncontrolled_Format_String__wchar_t_console_vprintf_52c_goodB2GSink(wchar_t * data); void CWE134_Uncontrolled_Format_String__wchar_t_console_vprintf_52b_goodB2GSink(wchar_t * data) { CWE134_Uncontrolled_Format_String__wchar_t_console_vprintf_52c_goodB2GSink(data); } #endif /* OMITGOOD */
// Copyright (c) 2017-present, Facebook, Inc. All rights reserved. // This source code is licensed under both the GPLv2 (found in the // COPYING file in the root directory) and Apache 2.0 License // (found in the LICENSE.Apache file in the root directory). #pragma once #include <memory> #include "util/testharness.h" #include "utilities/cassandra/format.h" #include "utilities/cassandra/serialize.h" namespace rocksdb { namespace cassandra { extern const char kData[]; extern const char kExpiringData[]; extern const int32_t kTtl; extern const int8_t kColumn; extern const int8_t kTombstone; extern const int8_t kExpiringColumn; std::shared_ptr<ColumnBase> CreateTestColumn(int8_t mask, int8_t index, int64_t timestamp); RowValue CreateTestRowValue( std::vector<std::tuple<int8_t, int8_t, int64_t>> column_specs); RowValue CreateRowTombstone(int64_t timestamp); void VerifyRowValueColumns( std::vector<std::shared_ptr<ColumnBase>> &columns, std::size_t index_of_vector, int8_t expected_mask, int8_t expected_index, int64_t expected_timestamp ); int64_t ToMicroSeconds(int64_t seconds); int32_t ToSeconds(int64_t microseconds); } }
#ifndef _KERNEL_APIC_H #define _KERNEL_APIC_H #include <inttypes.h> #define APIC_apicID 0xFEE00020ul #define APIC_version 0xFEE00030ul #define APIC_taskPriority 0xFEE00080ul #define APIC_endOfInterrupt 0xFEE000B0ul #define APIC_logicalDestination 0xFEE000D0ul #define APIC_destinationFormat 0xFEE000E0ul #define APIC_spurious 0xFEE000F0ul #define APIC_interruptCommandLow 0xFEE00300ul #define APIC_interruptCommandHigh 0xFEE00310ul #define APIC_LVTtimer 0xFEE00320ul #define APIC_LVTperfCounter 0xFEE00340ul #define APIC_LVT_LINT0 0xFEE00350ul #define APIC_LVT_LINT1 0xFEE00360ul #define APIC_LVTerror 0xFEE00370ul #define APIC_TIMERinitialCount 0xFEE00380ul #define APIC_TIMERcurrentCount 0xFEE00390ul #define APIC_TIMERdivider 0xFEE003E0ul #define APIC_TIMERdivideBy2 0x00000000 #define APIC_TIMERdivideBy4 0x00000008 #define APIC_TIMERdivideBy8 0x00000002 #define APIC_TIMERdivideBy16 0x0000000A #define APIC_TIMERdivideBy32 0x00000001 #define APIC_TIMERdivideBy64 0x00000009 #define APIC_TIMERdivideBy128 0x00000003 #define APIC_TIMERdivideBy1 0x0000000B #define APIC_TIMERperiodic 0x00020000 #define APIC_INTERRUPT 0x50 extern uint32_t busSpeed; void load_apic( unsigned int cpu_id ); void set_apic_distance( unsigned int cpu_id, unsigned int milliseconds ); #define APIC_SET( reg, value ) *((uint32_t*)reg) = value #define APIC_GET( reg ) *((uint32_t*)reg) #endif
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_COMMON_CHILD_PROCESS_LOGGING_H_ #define CHROME_COMMON_CHILD_PROCESS_LOGGING_H_ #pragma once #include <set> #include <string> #include "base/basictypes.h" #include "base/mac/crash_logging.h" #include "googleurl/src/gurl.h" class CommandLine; namespace content { struct GPUInfo; } // The maximum number of active extensions we will report. // Also used in chrome/app, but we define it here to avoid a common->app // dependency. static const int kMaxReportedActiveExtensions = 10; // The maximum number of prn-info-* records. static const size_t kMaxReportedPrinterRecords = 4; // The maximum number of command line switches to include in the crash // report's metadata. Note that the mini-dump itself will also contain the // (original) command line arguments within the PEB. // Also used in chrome/app, but we define it here to avoid a common->app // dependency. static const size_t kMaxSwitches = 15; namespace child_process_logging { #if defined(OS_POSIX) && !defined(OS_MACOSX) // These are declared here so the crash reporter can access them directly in // compromised context without going through the standard library. extern char g_active_url[]; extern char g_channel[]; extern char g_client_id[]; extern char g_extension_ids[]; extern char g_gpu_vendor_id[]; extern char g_gpu_device_id[]; extern char g_gpu_driver_ver[]; extern char g_gpu_ps_ver[]; extern char g_gpu_vs_ver[]; extern char g_num_extensions[]; extern char g_num_switches[]; extern char g_num_views[]; extern char g_printer_info[]; extern char g_switches[]; // Assume IDs are 32 bytes long. static const size_t kExtensionLen = 32; // Assume command line switches are less than 64 chars. static const size_t kSwitchLen = 64; // Assume printer info strings are less than 64 chars. static const size_t kPrinterInfoStrLen = 64; #endif // Sets the URL that is logged if the child process crashes. Use GURL() to clear // the URL. void SetActiveURL(const GURL& url); // Sets the Client ID that is used as GUID if a Chrome process crashes. void SetClientId(const std::string& client_id); // Gets the Client ID to be used as GUID for crash reporting. Returns the client // id in |client_id| if it's known, an empty string otherwise. std::string GetClientId(); // Sets the list of "active" extensions in this process. We overload "active" to // mean different things depending on the process type: // - browser: all enabled extensions // - renderer: the unique set of extension ids from all content scripts // - extension: the id of each extension running in this process (there can be // multiple because of process collapsing). void SetActiveExtensions(const std::set<std::string>& extension_ids); // Sets a number of views/tabs opened in this process. void SetNumberOfViews(int number_of_views); // Sets the data on the gpu to send along with crash reports. void SetGpuInfo(const content::GPUInfo& gpu_info); // Sets the data on the printer to send along with crash reports. Data may be // separated by ';' up to kMaxReportedPrinterRecords strings. Each substring // would be cut to 63 chars. void SetPrinterInfo(const char* printer_info); // Sets the command line arguments to send along with crash reports to the // values in |command_line|. void SetCommandLine(const CommandLine* command_line); #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_MACOSX) // Sets the product channel data to send along with crash reports to |channel|. void SetChannel(const std::string& channel); #endif // Simple wrapper class that sets the active URL in it's constructor and clears // the active URL in the destructor. class ScopedActiveURLSetter { public: explicit ScopedActiveURLSetter(const GURL& url) { SetActiveURL(url); } ~ScopedActiveURLSetter() { SetActiveURL(GURL()); } private: DISALLOW_COPY_AND_ASSIGN(ScopedActiveURLSetter); }; // Set/clear information about currently accessed printer. class ScopedPrinterInfoSetter { public: explicit ScopedPrinterInfoSetter(const std::string& printer_info) { SetPrinterInfo(printer_info.c_str()); } ~ScopedPrinterInfoSetter() { SetPrinterInfo(""); } private: DISALLOW_COPY_AND_ASSIGN(ScopedPrinterInfoSetter); }; } // namespace child_process_logging #if defined(OS_MACOSX) namespace child_process_logging { void SetActiveURLImpl(const GURL& url, base::mac::SetCrashKeyValueFuncPtr set_key_func, base::mac::ClearCrashKeyValueFuncPtr clear_key_func); extern const int kMaxNumCrashURLChunks; extern const int kMaxNumURLChunkValueLength; extern const char *kUrlChunkFormatStr; } // namespace child_process_logging #endif // defined(OS_MACOSX) #endif // CHROME_COMMON_CHILD_PROCESS_LOGGING_H_
// Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_CHROMEOS_POLICY_DLP_DLP_CONTENT_RESTRICTION_SET_H_ #define CHROME_BROWSER_CHROMEOS_POLICY_DLP_DLP_CONTENT_RESTRICTION_SET_H_ #include "chrome/browser/chromeos/policy/dlp/dlp_rules_manager.h" #include <array> #include "url/gurl.h" namespace policy { // Enum representing the possible restrictions applied to on-screen content. // These values are used in bitmask in DlpContentRestrictionSet and should // correspond to the type in which the mask is stored. enum DlpContentRestriction { // Do not allow any screenshots of the corresponding content. kScreenshot = 0, // Enforce ePrivacy screen when content is visible. kPrivacyScreen = 1, // Do not allow printing. kPrint = 2, // Do not allow video capturing of the content. kVideoCapture = 3, // Do not allow screen share. kScreenShare = 4, // Should be equal to the last restriction. kMaxValue = kScreenShare, }; // Represents result of evaluating restriction - both the level at which it // should be enforced and the url that caused it. struct RestrictionLevelAndUrl { RestrictionLevelAndUrl() = default; RestrictionLevelAndUrl(DlpRulesManager::Level level, GURL url) : level(level), url(url) {} RestrictionLevelAndUrl(const RestrictionLevelAndUrl&) = default; RestrictionLevelAndUrl& operator=(const RestrictionLevelAndUrl&) = default; ~RestrictionLevelAndUrl() = default; // Restrictions with the same level, but different URLs are considered the // same as they don't affect the current restriction enforcement. bool operator==(const RestrictionLevelAndUrl& other) const { return level == other.level; } DlpRulesManager::Level level = DlpRulesManager::Level::kNotSet; GURL url; }; // Represents set of levels of all restrictions applied to on-screen content. // Allowed to be copied and assigned. class DlpContentRestrictionSet { public: DlpContentRestrictionSet(); DlpContentRestrictionSet(DlpContentRestriction restriction, DlpRulesManager::Level level); DlpContentRestrictionSet(const DlpContentRestrictionSet& restriction_set); DlpContentRestrictionSet& operator=(const DlpContentRestrictionSet&); ~DlpContentRestrictionSet(); bool operator==(const DlpContentRestrictionSet& other) const; bool operator!=(const DlpContentRestrictionSet& other) const; // Sets the |restriction| to the |level| if not set to a higher one yet and // remembers the |url| in this case. void SetRestriction(DlpContentRestriction restriction, DlpRulesManager::Level level, const GURL& gurl); // Returns the level for the |restriction|. DlpRulesManager::Level GetRestrictionLevel( DlpContentRestriction restriction) const; // Returns the level and url for the |restriction|. RestrictionLevelAndUrl GetRestrictionLevelAndUrl( DlpContentRestriction restriction) const; // Returns whether no restrictions should be applied. bool IsEmpty() const; // Sets all the restrictions to the highest level from |other| and this. void UnionWith(const DlpContentRestrictionSet& other); // Returns a new set that contains restrictions that exist in this, but not in // |other|. DlpContentRestrictionSet DifferenceWith( const DlpContentRestrictionSet& other) const; // Returns which content restrictions are being applied to the |url| according // to the policies. static DlpContentRestrictionSet GetForURL(const GURL& url); static void SetRestrictionsForURLForTesting( const GURL& url, const DlpContentRestrictionSet& restrictions); private: // The current level and url of each of the restrictions. std::array<RestrictionLevelAndUrl, DlpContentRestriction::kMaxValue + 1> restrictions_; }; } // namespace policy #endif // CHROME_BROWSER_CHROMEOS_POLICY_DLP_DLP_CONTENT_RESTRICTION_SET_H_
//##################################################################### // Copyright 2005, Andrew Selle. // This file is part of PhysBAM whose distribution is governed by the license contained in the accompanying file PHYSBAM_COPYRIGHT.txt. //##################################################################### #ifndef __THREAD_CONDITION__ #define __THREAD_CONDITION__ #include <cstdio> #include <cstdlib> #include <cassert> #include "THREAD_LOCK.h" #if defined(ALAMERE_PTHREADS) # include "alamere.h" #else # include <pthread.h> #endif namespace PhysBAM{ class THREAD_CONDITION { private: pthread_cond_t cond; public: THREAD_CONDITION() {pthread_cond_init(&cond,0);} ~THREAD_CONDITION() {pthread_cond_destroy(&cond);} void Wait(THREAD_LOCK& lock) {pthread_cond_wait(&cond,&lock.mutex);} void Signal() {pthread_cond_signal(&cond);} void Broadcast() {pthread_cond_broadcast(&cond);} }; } #endif
/* BLIS An object-based framework for developing high-performance BLAS-like libraries. Copyright (C) 2014, The University of Texas Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of The University of Texas nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "blis.h" // // Define object-based interface. // void bli_absqsc( obj_t* chi, obj_t* absq ) { if ( bli_error_checking_is_enabled() ) bli_absqsc_check( chi, absq ); bli_absqsc_unb_var1( chi, absq ); } // // Define BLAS-like interfaces. // #undef GENTFUNCR #define GENTFUNCR( ctype_x, ctype_xr, chx, chxr, opname, varname ) \ \ void PASTEMAC2(chx,chxr,opname)( \ ctype_x* chi, \ ctype_xr* absq \ ) \ { \ PASTEMAC(chx,varname)( chi, \ absq ); \ } INSERT_GENTFUNCR_BASIC( absqsc, absqsc_unb_var1 )
/**************************************************************************** * * Copyright (c) 2012-2016 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. Neither the name PX4 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. * ****************************************************************************/ /** * UTC offset (unit: min) * * the difference in hours and minutes from Coordinated * Universal Time (UTC) for a your place and date. * * for example, In case of South Korea(UTC+09:00), * UTC offset is 540 min (9*60) * * refer to https://en.wikipedia.org/wiki/List_of_UTC_time_offsets * * @unit min * @min -1000 * @max 1000 * @group SD Logging */ PARAM_DEFINE_INT32(SDLOG_UTC_OFFSET, 0); /** * Logging Mode * * Determines when to start and stop logging. By default, logging is started * when arming the system, and stopped when disarming. * * @value -1 disabled * @value 0 when armed until disarm (default) * @value 1 from boot until disarm * @value 2 from boot until shutdown * @value 3 depending on AUX1 RC channel * * @reboot_required true * @group SD Logging */ PARAM_DEFINE_INT32(SDLOG_MODE, 0); /** * Mission Log * * If enabled, a small additional "mission" log file will be written to the SD card. * The log contains just those messages that are useful for tasks like * generating flight statistics and geotagging. * * The different modes can be used to further reduce the logged data * (and thus the log file size). For example, choose geotagging mode to * only log data required for geotagging. * Note that the normal/full log is still created, and contains all * the data in the mission log (and more). * * @value 0 Disabled * @value 1 All mission messages * @value 2 Geotagging messages * * @reboot_required true * @group SD Logging */ PARAM_DEFINE_INT32(SDLOG_MISSION, 0); /** * Logging topic profile (integer bitmask). * * This integer bitmask controls the set and rates of logged topics. * The default allows for general log analysis and estimator replay, while * keeping the log file size reasonably small. * * Enabling multiple sets leads to higher bandwidth requirements and larger log * files. * * Set bits true to enable: * 0 : Default set (used for general log analysis) * 1 : Full rate estimator (EKF2) replay topics * 2 : Topics for thermal calibration (high rate raw IMU and Baro sensor data) * 3 : Topics for system identification (high rate actuator control and IMU data) * 4 : Full rates for analysis of fast maneuvers (RC, attitude, rates and actuators) * 5 : Debugging topics (debug_*.msg topics, for custom code) * 6 : Topics for sensor comparison (low rate raw IMU, Baro and Magnetomer data) * 7 : Topics for computer vision and collision avoidance * * @min 0 * @max 255 * @bit 0 Default set (general log analysis) * @bit 1 Estimator replay (EKF2) * @bit 2 Thermal calibration * @bit 3 System identification * @bit 4 High rate * @bit 5 Debug * @bit 6 Sensor comparison * @bit 7 Computer Vision and Avoidance * @reboot_required true * @group SD Logging */ PARAM_DEFINE_INT32(SDLOG_PROFILE, 3); /** * Maximum number of log directories to keep * * If there are more log directories than this value, * the system will delete the oldest directories during startup. * * In addition, the system will delete old logs if there is not enough free space left. * The minimum amount is 300 MB. * * If this is set to 0, old directories will only be removed if the free space falls below * the minimum. * * Note: this does not apply to mission log files. * * @min 0 * @max 1000 * @reboot_required true * @group SD Logging */ PARAM_DEFINE_INT32(SDLOG_DIRS_MAX, 0); /** * Log UUID * * If set to 1, add an ID to the log, which uniquely identifies the vehicle * * @boolean * @group SD Logging */ PARAM_DEFINE_INT32(SDLOG_UUID, 1);
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE194_Unexpected_Sign_Extension__listen_socket_malloc_68a.c Label Definition File: CWE194_Unexpected_Sign_Extension.label.xml Template File: sources-sink-68a.tmpl.c */ /* * @description * CWE: 194 Unexpected Sign Extension * BadSource: listen_socket Read data using a listen socket (server side) * GoodSource: Positive integer * Sink: malloc * BadSink : Allocate memory using malloc() with the size 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" #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 #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <unistd.h> #define INVALID_SOCKET -1 #define SOCKET_ERROR -1 #define CLOSE_SOCKET close #define SOCKET int #endif #define TCP_PORT 27015 #define LISTEN_BACKLOG 5 /* Must be at least 8 for atoi() to work properly */ #define CHAR_ARRAY_SIZE 8 short CWE194_Unexpected_Sign_Extension__listen_socket_malloc_68_badData; short CWE194_Unexpected_Sign_Extension__listen_socket_malloc_68_goodG2BData; #ifndef OMITBAD /* bad function declaration */ void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_68b_badSink(); void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_68_bad() { short data; /* Initialize data */ data = 0; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; int tempInt; struct sockaddr_in service; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (listenSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = INADDR_ANY; service.sin_port = htons(TCP_PORT); if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR) { break; } acceptSocket = accept(listenSocket, NULL, NULL); if (acceptSocket == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed */ recvResult = recv(acceptSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); /* FLAW: Use a value input from the network */ if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate string */ inputBuffer[recvResult] = '\0'; /* Convert to short - ensure int to short conversion will be successful and if * not ensure that data will be negative */ tempInt = atoi(inputBuffer); if (tempInt > SHRT_MAX || tempInt < SHRT_MIN) { data = -1; } else { data = tempInt; } } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } CWE194_Unexpected_Sign_Extension__listen_socket_malloc_68_badData = data; CWE194_Unexpected_Sign_Extension__listen_socket_malloc_68b_badSink(); } #endif /* OMITBAD */ #ifndef OMITGOOD /* good function declarations */ void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_68b_goodG2BSink(); /* goodG2B uses the GoodSource with the BadSink */ static void goodG2B() { short data; /* Initialize data */ data = 0; /* FIX: Use a positive integer less than &InitialDataSize&*/ data = 100-1; CWE194_Unexpected_Sign_Extension__listen_socket_malloc_68_goodG2BData = data; CWE194_Unexpected_Sign_Extension__listen_socket_malloc_68b_goodG2BSink(); } void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_68_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()..."); CWE194_Unexpected_Sign_Extension__listen_socket_malloc_68_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE194_Unexpected_Sign_Extension__listen_socket_malloc_68_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
/*========================================================================= Program: Visualization Toolkit Module: vtkArrayCoordinates.h ------------------------------------------------------------------------- Copyright 2008 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software. ------------------------------------------------------------------------- Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ // .NAME vtkArrayCoordinates - Stores coordinate into an N-way array. // // .SECTION Description // vtkArrayCoordinates stores a collection of coordinates that can be // used to access values in a vtkArray containing an arbitrary number of // dimensions. // // Convenience constructors are provided for working with one, two, and // three dimensions. For higher dimensions, use the default constructor, // SetDimensions() and operator[] to assign a coordinate value along each // dimension. // // .SECTION See Also // vtkArray, vtkArrayExtents // // .SECTION Thanks // Developed by Timothy M. Shead (tshead@sandia.gov) at Sandia National // Laboratories. #ifndef vtkArrayCoordinates_h #define vtkArrayCoordinates_h #include "vtkCommonCoreModule.h" // For export macro #include "vtkSystemIncludes.h" #include <vector> class VTKCOMMONCORE_EXPORT vtkArrayCoordinates { public: typedef vtkIdType CoordinateT; typedef vtkIdType DimensionT; // Description: // Create an empty set of coordinates. Use SetDimensions() and // operator[] to populate the coordinates. vtkArrayCoordinates(); // Description: // Create coordinates for a one-dimensional array. explicit vtkArrayCoordinates(CoordinateT i); // Description: // Create coordinates for a two-dimensional array. vtkArrayCoordinates(CoordinateT i, CoordinateT j); // Description: // Create coordinates for a three-dimensional array. vtkArrayCoordinates(CoordinateT i, CoordinateT j, CoordinateT k); // Description: // Return the number of dimensions contained in the coordinates. DimensionT GetDimensions() const; // Description: // Set the number of dimensions. Note that this method resets the // coordinate along each dimension to zero, so you must set every // coordinate explicitly using operator[] after calling SetDimensions(). void SetDimensions(DimensionT dimensions); // Description: // Returns the coordinate of the i-th dimension. CoordinateT& operator[](DimensionT i); // Description: // Returns the coordinate of the i-th dimension. const CoordinateT& operator[](DimensionT i) const; // Description: // Returns the coordinate of the i-th dimension. CoordinateT GetCoordinate(DimensionT i) const; // Description: // Sets the coordinate of the i-th dimension. void SetCoordinate(DimensionT i, const CoordinateT&); // Description: // Equality comparison bool operator==(const vtkArrayCoordinates& rhs) const; // Description: // Inequality comparison bool operator!=(const vtkArrayCoordinates& rhs) const; VTKCOMMONCORE_EXPORT friend ostream& operator<<( ostream& stream, const vtkArrayCoordinates& rhs); private: //BTX std::vector<CoordinateT> Storage; //ETX }; #endif // VTK-HeaderTest-Exclude: vtkArrayCoordinates.h
/* * Copyright (C) 2010 Google Inc. All rights reserved. * Copyright (C) 2011 Apple Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * 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 SKY_ENGINE_PLATFORM_NETWORK_HTTPREQUEST_H_ #define SKY_ENGINE_PLATFORM_NETWORK_HTTPREQUEST_H_ #include "sky/engine/platform/PlatformExport.h" #include "sky/engine/platform/network/HTTPHeaderMap.h" #include "sky/engine/platform/network/HTTPParsers.h" #include "sky/engine/platform/weborigin/KURL.h" #include "sky/engine/wtf/PassRefPtr.h" #include "sky/engine/wtf/RefCounted.h" #include "sky/engine/wtf/text/WTFString.h" namespace blink { class PLATFORM_EXPORT HTTPRequest : public RefCounted<HTTPRequest> { public: static PassRefPtr<HTTPRequest> create() { return adoptRef(new HTTPRequest()); } static PassRefPtr<HTTPRequest> create(const String& requestMethod, const KURL& url, HTTPVersion version) { return adoptRef(new HTTPRequest(requestMethod, url, version)); } static PassRefPtr<HTTPRequest> parseHTTPRequestFromBuffer(const char* data, size_t length, String& failureReason); virtual ~HTTPRequest(); String requestMethod() const { return m_requestMethod; } void setRequestMethod(const String& method) { m_requestMethod = method; } KURL url() const { return m_url; } void setURL(const KURL& url) { m_url = url; } const Vector<unsigned char>& body() const { return m_body; } const HTTPHeaderMap& headerFields() const { return m_headerFields; } void addHeaderField(const AtomicString& name, const AtomicString& value) { m_headerFields.add(name, value); } void addHeaderField(const char* name, const AtomicString& value) { m_headerFields.add(name, value); } protected: HTTPRequest(); HTTPRequest(const String& requestMethod, const KURL&, HTTPVersion); // Parsing helpers. size_t parseRequestLine(const char* data, size_t length, String& failureReason); size_t parseHeaders(const char* data, size_t length, String& failureReason); size_t parseRequestBody(const char* data, size_t length); KURL m_url; HTTPVersion m_httpVersion; String m_requestMethod; HTTPHeaderMap m_headerFields; Vector<unsigned char> m_body; }; } // namespace blink #endif // SKY_ENGINE_PLATFORM_NETWORK_HTTPREQUEST_H_
/**************************************************************************** * * Copyright (C) 2012-2019 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. Neither the name PX4 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. * ****************************************************************************/ /** * @file test_sleep.c * Tests the px4_usleep() method. */ #include <px4_time.h> #include <px4_config.h> #include <px4_defines.h> #include <sys/types.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <errno.h> #include <arch/board/board.h> #include "tests_main.h" int test_sleep(int argc, char *argv[]) { unsigned int nsleeps = 20; printf("\t %d 100ms sleeps\n", nsleeps); fflush(stdout); for (unsigned int i = 0; i < nsleeps; i++) { px4_usleep(100000); } printf("\t Sleep test successful.\n"); return OK; }
#ifndef _KERNEL_LIMITS_H #define _KERNEL_LIMITS_H #define NAME_LENGTH 64 #endif
/* $NetBSD: strtok_r.c,v 1.10 2012/06/25 22:32:46 abs Exp $ */ /* * Copyright (c) 1988 Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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. */ #include <sys/cdefs.h> #include <assert.h> #include <string.h> char *strtok_r(char *s, const char *delim, char **lasts) { const char *spanp; int c, sc; char *tok; /* s may be NULL */ _DIAGASSERT(delim != NULL); _DIAGASSERT(lasts != NULL); if (s == NULL && (s = *lasts) == NULL) return (NULL); /* * Skip (span) leading delimiters (s += strspn(s, delim), sort of). */ cont: c = *s++; for (spanp = delim; (sc = *spanp++) != 0;) { if (c == sc) goto cont; } if (c == 0) { /* no non-delimiter characters */ *lasts = NULL; return (NULL); } tok = s - 1; /* * Scan token (scan for delimiters: s += strcspn(s, delim), sort of). * Note that delim must have one NUL; we stop if we see that, too. */ for (;;) { c = *s++; spanp = delim; do { if ((sc = *spanp++) == c) { if (c == 0) s = NULL; else s[-1] = 0; *lasts = s; return (tok); } } while (sc != 0); } /* NOTREACHED */ }
// Copyright 2019 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_SIGNIN_PUBLIC_IDENTITY_MANAGER_UBERTOKEN_FETCHER_H_ #define COMPONENTS_SIGNIN_PUBLIC_IDENTITY_MANAGER_UBERTOKEN_FETCHER_H_ #include <memory> #include "base/bind.h" class GoogleServiceAuthError; namespace signin { // Opaque interface that fetches ubertokens for a given account. Clients must // go through IdentityManager to create a functioning instance. class UbertokenFetcher { public: using CompletionCallback = base::OnceCallback<void(GoogleServiceAuthError error, const std::string& token)>; // Constructs an instance and start fetching the token for |account_id|. UbertokenFetcher() = default; UbertokenFetcher(const UbertokenFetcher&) = delete; UbertokenFetcher& operator=(const UbertokenFetcher&) = delete; virtual ~UbertokenFetcher() = 0; }; } // namespace signin #endif // COMPONENTS_SIGNIN_PUBLIC_IDENTITY_MANAGER_UBERTOKEN_FETCHER_H_
// Filename: eventStorePandaNode.h // Created by: drose (13Sep06) // //////////////////////////////////////////////////////////////////// // // 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 EVENTSTOREPANDANODE_H #define EVENTSTOREPANDANODE_H #include "pandabase.h" #include "eventParameter.h" #include "pandaNode.h" //////////////////////////////////////////////////////////////////// // Class : EventStorePandaNode // Description : A class object for storing specifically objects of // type PandaNode. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA_PGRAPH EventStorePandaNode : public EventStoreValueBase { PUBLISHED: INLINE EventStorePandaNode(const PandaNode *value); virtual ~EventStorePandaNode(); INLINE void set_value(const PandaNode *value); INLINE PandaNode *get_value() const; virtual void output(ostream &out) const; public: PT(PandaNode) _value; public: virtual TypeHandle get_type() const { return get_class_type(); } virtual TypeHandle force_init_type() {init_type(); return get_class_type();} static TypeHandle get_class_type() { return _type_handle; } static void init_type() { EventStoreValueBase::init_type(); register_type(_type_handle, "EventStorePandaNode", EventStoreValueBase::get_class_type()); } private: static TypeHandle _type_handle; }; #include "eventStorePandaNode.I" #endif
#ifndef ALIFMDPEDESTALDA_H #define ALIFMDPEDESTALDA_H /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights * reserved. * * See cxx source for full Copyright notice */ // This class implements the pedestal detector algorithm (DA) for the FMD. // It uses 51200 TH1S histograms to store the data for each channel of the FMD. // The mean and standard deviation of a histogram define the pedestal and // the noise for that channel. #include "AliFMDBaseDA.h" #include "TH1.h" #include "TObjArray.h" class TH2; class AliFMDPedestalDA: public AliFMDBaseDA { public: typedef AliFMDBaseDA::Array Array; /** * Constructor. * */ AliFMDPedestalDA(); /** * Copy constructor * * @param pedDA Object to copy from */ AliFMDPedestalDA(const AliFMDPedestalDA & pedDA); /** * Assignment operator * * @param pedDA Object to assign from */ AliFMDPedestalDA& operator=(const AliFMDPedestalDA&) { return *this; } /** * Destructor * */ virtual ~AliFMDPedestalDA(); /** * Open our output files * * The output files are named * * peds.csv * conditions.csv * ddl3072.csv * ddl3073.csv * ddl3074.csv * * and existing files are rotated, or * * peds_XXXXXXXXX.csv * conditions_XXXXXXXXX.csv * ddl3072.csv * ddl3073.csv * ddl3074.csv * * in case the run number is to be appended. * * @param appendRun if true, append run number (9 digits, zero * padded) to the output file name(s). * * @return true on success */ Bool_t OpenFiles(Bool_t appendRun=false); /** * Initialiser * */ void Init(); protected: enum { kPedestalOffset = 1, kNoiseOffset = 2 }; /** * Add a channel to the containers. * * @param sectorArray Array of sectors * @param det Detector * @param ring Ring * @param sec Sector * @param strip Strip */ void AddChannelContainer(Array* sectorArray, UShort_t det, Char_t ring, UShort_t sec, UShort_t strip); /** * Add summary(s) for sectors * * @param secArray * @param det * @param ring * @param sector * @param nStrip */ virtual void AddSectorSummary(Array* secArray, UShort_t det, Char_t ring, UShort_t sector, UShort_t nStrip); /** * Fill ADC values from a digit into the corresponding histogram. * * @param digit Digit to fill ADC values for. */ void FillChannels(AliFMDDigit* digit); /** * Analyse a strip. That is, compute the mean and spread of the ADC * spectra for all strips. Also output on files the values. * * @param det Detector * @param ring Ring * @param sec Sector * @param strip Strip. * @param h Summary histogram with bins for sector and strip */ void Analyse(UShort_t det, Char_t ring, UShort_t sec, UShort_t strip); /** * Write headers to files. * */ void WriteHeaderToFile(); /** * Called at the end of an event. * */ void FinishEvent() {} /** * Called at the end of a job. Fills in missing time-bins and * closes output files * */ void Terminate(TFile* ); private: /** * Get the histogram corresponding to a strip sample. * * @param det Detector * @param ring Ring * @param sec Sector * @param strip Strip * @param sample Sample * * @return ADC spectra of a strip. */ TH1S* GetChannel(UShort_t det, Char_t ring, UShort_t sec, UShort_t strip, UInt_t sample); /** * Get the summary for a sector * * @param det Detector * @param ring Ring * @param sec Sector * @param pedNotNoise Option * * @return histogram */ TH1F* GetSectorSummary(UShort_t det, Char_t ring, UShort_t sec, Bool_t pedNotNoise); /** * Calculate the hardware index * * @param ddl DDL number * @param board Board number * @param altro ALTRO number * @param chan Channel number * * @return Index into hardware cache. */ Int_t HWIndex(UShort_t ddl, UShort_t board, UShort_t altro, UShort_t chan) const; void FillinTimebins(std::ofstream& out, UShort_t ddl); /** Current strip */ Int_t fCurrentChannel; //The current channel /** Pedestal summary */ TH1F fPedSummary; //Summary of pedestals /** Noise summary */ TH1F fNoiseSummary; //Summary of noises /** Output file for zero-suppression for FMD1 */ std::ofstream fZSfileFMD1; //Stream for ZS FMD1 /** Output file for zero-suppression for FMD2 */ std::ofstream fZSfileFMD2; //Stream for ZS FMD2 /** Output file for zero-suppression for FMD3 */ std::ofstream fZSfileFMD3; //Stream for ZS FMD3 /** The minimum timebin seen for all channels */ TArrayS fMinTimebin; //minimum timebin /** The maximum timebin seen for all channels */ TArrayS fMaxTimebin; //maximum timebin void MakeSummary(UShort_t det, Char_t ring); TH2* fSummaryFMD1i; //Summary of FMD1 TH2* fSummaryFMD2i; //Summary of FMD2I TH2* fSummaryFMD2o; //Summary of FMD2O TH2* fSummaryFMD3i; //Summary of FMD3I TH2* fSummaryFMD3o; //Summary of FMD3O ClassDef(AliFMDPedestalDA,0) }; inline Int_t AliFMDPedestalDA::HWIndex(UShort_t ddl, UShort_t b, UShort_t a, UShort_t c) const { // Save some array entries UShort_t lb = (b > 1 ? b-16+2 : b); const Int_t kNDDL = 3; const Int_t kNBoard = 4; const Int_t kNAltro = 3; const Int_t kNChannel = 16; Int_t idx = c + kNChannel * (a + kNAltro * (lb + kNBoard * ddl)); if (idx > kNDDL * kNBoard * kNAltro * kNChannel) return -1; return idx; } #endif // // Local Variables: // mode: C++ // End: //
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE190_Integer_Overflow__int_rand_add_66b.c Label Definition File: CWE190_Integer_Overflow__int.label.xml Template File: sources-sinks-66b.tmpl.c */ /* * @description * CWE: 190 Integer Overflow * BadSource: rand Set data to result of rand(), which may be zero * GoodSource: Set data to a small, non-zero number (two) * Sinks: add * GoodSink: Ensure there will not be an overflow before adding 1 to data * BadSink : Add 1 to data, which can cause an overflow * Flow Variant: 66 Data flow: data passed in an array from one function to another in different source files * * */ #include "std_testcase.h" #ifndef OMITBAD void CWE190_Integer_Overflow__int_rand_add_66b_badSink(int dataArray[]) { /* copy data out of dataArray */ int data = dataArray[2]; { /* POTENTIAL FLAW: Adding 1 to data could cause an overflow */ int result = data + 1; printIntLine(result); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ void CWE190_Integer_Overflow__int_rand_add_66b_goodG2BSink(int dataArray[]) { int data = dataArray[2]; { /* POTENTIAL FLAW: Adding 1 to data could cause an overflow */ int result = data + 1; printIntLine(result); } } /* goodB2G uses the BadSource with the GoodSink */ void CWE190_Integer_Overflow__int_rand_add_66b_goodB2GSink(int dataArray[]) { int data = dataArray[2]; /* FIX: Add a check to prevent an overflow from occurring */ if (data < INT_MAX) { int result = data + 1; printIntLine(result); } else { printLine("data value is too large to perform arithmetic safely."); } } #endif /* OMITGOOD */
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE400_Resource_Exhaustion__rand_sleep_82.h Label Definition File: CWE400_Resource_Exhaustion.label.xml Template File: sources-sinks-82.tmpl.h */ /* * @description * CWE: 400 Resource Exhaustion * BadSource: rand Set data to result of rand(), which may be zero * GoodSource: Assign count to be a relatively small number * Sinks: sleep * GoodSink: Validate count before using it as a parameter in sleep function * BadSink : Use count as the parameter for sleep withhout checking it's size first * Flow Variant: 82 Data flow: data passed in a parameter to an virtual method called via a pointer * * */ #include "std_testcase.h" namespace CWE400_Resource_Exhaustion__rand_sleep_82 { class CWE400_Resource_Exhaustion__rand_sleep_82_base { public: /* pure virtual function */ virtual void action(int count) = 0; }; #ifndef OMITBAD class CWE400_Resource_Exhaustion__rand_sleep_82_bad : public CWE400_Resource_Exhaustion__rand_sleep_82_base { public: void action(int count); }; #endif /* OMITBAD */ #ifndef OMITGOOD class CWE400_Resource_Exhaustion__rand_sleep_82_goodG2B : public CWE400_Resource_Exhaustion__rand_sleep_82_base { public: void action(int count); }; class CWE400_Resource_Exhaustion__rand_sleep_82_goodB2G : public CWE400_Resource_Exhaustion__rand_sleep_82_base { public: void action(int count); }; #endif /* OMITGOOD */ }
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_CONSTANTS_H_ #define COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_CONSTANTS_H_ #include "base/files/file_path.h" namespace history { // filenames extern const base::FilePath::CharType kArchivedHistoryFilename[]; extern const base::FilePath::CharType kFaviconsFilename[]; extern const base::FilePath::CharType kHistoryFilename[]; extern const base::FilePath::CharType kThumbnailsFilename[]; extern const base::FilePath::CharType kTopSitesFilename[]; // The maximum size of the list returned by history::HistoryService::TopHosts(). extern const int kMaxTopHosts; } // namespace history #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_CONSTANTS_H_
/*========================================================================= Program: Visualization Toolkit Module: vtkProgrammableSource.h Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ // .NAME vtkProgrammableSource - generate source dataset via a user-specified function // .SECTION Description // vtkProgrammableSource is a source object that is programmable by the // user. To use this object, you must specify a function that creates the // output. It is possible to generate an output dataset of any (concrete) // type; it is up to the function to properly initialize and define the // output. Typically, you use one of the methods to get a concrete output // type (e.g., GetPolyDataOutput() or GetStructuredPointsOutput()), and // then manipulate the output in the user-specified function. // // Example use of this include writing a function to read a data file or // interface to another system. (You might want to do this in favor of // deriving a new class.) Another important use of this class is that it // allows users of interpreters (e.g., Tcl or Java) the ability to write // source objects without having to recompile C++ code or generate new // libraries. // .SECTION See Also // vtkProgrammableFilter vtkProgrammableAttributeDataFilter // vtkProgrammableDataObjectSource #ifndef vtkProgrammableSource_h #define vtkProgrammableSource_h #include "vtkFiltersSourcesModule.h" // For export macro #include "vtkDataSetAlgorithm.h" class vtkPolyData; class vtkStructuredPoints; class vtkStructuredGrid; class vtkUnstructuredGrid; class vtkRectilinearGrid; class VTKFILTERSSOURCES_EXPORT vtkProgrammableSource : public vtkDataSetAlgorithm { public: static vtkProgrammableSource *New(); vtkTypeMacro(vtkProgrammableSource,vtkDataSetAlgorithm); // Description: // Signature definition for programmable method callbacks. Methods passed // to SetExecuteMethod, SetExecuteMethodArgDelete or // SetRequestInformationMethod must conform to this signature. // The presence of this typedef is useful for reference and for external // analysis tools, but it cannot be used in the method signatures in these // header files themselves because it prevents the internal VTK wrapper // generators from wrapping these methods. typedef void (*ProgrammableMethodCallbackType)(void *arg); // Description: // Specify the function to use to generate the source data. Note // that the function takes a single (void *) argument. void SetExecuteMethod(void (*f)(void *), void *arg); // Description: // Set the arg delete method. This is used to free user memory. void SetExecuteMethodArgDelete(void (*f)(void *)); // Description: // Specify the function to use to fill in information about the source data. void SetRequestInformationMethod(void (*f)(void *)); // Description: // Get the output as a concrete type. This method is typically used by the // writer of the source function to get the output as a particular type // (i.e., it essentially does type casting). It is the users responsibility // to know the correct type of the output data. vtkPolyData *GetPolyDataOutput(); // Description: // Get the output as a concrete type. vtkStructuredPoints *GetStructuredPointsOutput(); // Description: // Get the output as a concrete type. vtkStructuredGrid *GetStructuredGridOutput(); // Description: // Get the output as a concrete type. vtkUnstructuredGrid *GetUnstructuredGridOutput(); // Description: // Get the output as a concrete type. vtkRectilinearGrid *GetRectilinearGridOutput(); protected: vtkProgrammableSource(); ~vtkProgrammableSource(); virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); virtual int RequestDataObject(vtkInformation *, vtkInformationVector **, vtkInformationVector *); virtual int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *); ProgrammableMethodCallbackType ExecuteMethod; //function to invoke ProgrammableMethodCallbackType ExecuteMethodArgDelete; void *ExecuteMethodArg; ProgrammableMethodCallbackType RequestInformationMethod; // function to invoke vtkTimeStamp ExecuteTime; int RequestedDataType; private: vtkProgrammableSource(const vtkProgrammableSource&); // Not implemented. void operator=(const vtkProgrammableSource&); // Not implemented. }; #endif // VTK-HeaderTest-Exclude: vtkProgrammableSource.h
/* BLIS An object-based framework for developing high-performance BLAS-like libraries. Copyright (C) 2014, The University of Texas Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of The University of Texas nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ void bli_her_unb_var1( conj_t conjh, obj_t* alpha, obj_t* x, obj_t* c, her_t* cntl ); #undef GENTPROT2 #define GENTPROT2( ctype_x, ctype_c, chx, chc, varname ) \ \ void PASTEMAC2(chx,chc,varname)( \ uplo_t uplo, \ conj_t conjx, \ conj_t conjh, \ dim_t m, \ void* alpha, \ void* x, inc_t incx, \ void* c, inc_t rs_c, inc_t cs_c \ ); INSERT_GENTPROT2_BASIC( her_unb_var1 ) #ifdef BLIS_ENABLE_MIXED_DOMAIN_SUPPORT INSERT_GENTPROT2_MIX_D( her_unb_var1 ) #endif #ifdef BLIS_ENABLE_MIXED_PRECISION_SUPPORT INSERT_GENTPROT2_MIX_P( her_unb_var1 ) #endif
/* BLIS An object-based framework for developing high-performance BLAS-like libraries. Copyright (C) 2014, The University of Texas Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of The University of Texas nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ void bli_her_int( conj_t conjh, obj_t* alpha, obj_t* x, obj_t* c, her_t* cntl );
/* * Order-1, 3D 25 point stencil with axis-symmetric ariable coefficients * Adapted from PLUTO and Pochoir test bench * * Tareq Malas */ #include <stdio.h> #include <stdlib.h> #include <sys/time.h> #ifdef LIKWID_PERFMON #include <likwid.h> #endif #include "print_utils.h" #define TESTS 2 #define MAX(a,b) ((a) > (b) ? a : b) #define MIN(a,b) ((a) < (b) ? a : b) /* Subtract the `struct timeval' values X and Y, * storing the result in RESULT. * * Return 1 if the difference is negative, otherwise 0. */ int timeval_subtract(struct timeval *result, struct timeval *x, struct timeval *y) { /* Perform the carry for the later subtraction by updating y. */ if (x->tv_usec < y->tv_usec) { int nsec = (y->tv_usec - x->tv_usec) / 1000000 + 1; y->tv_usec -= 1000000 * nsec; y->tv_sec += nsec; } if (x->tv_usec - y->tv_usec > 1000000) { int nsec = (x->tv_usec - y->tv_usec) / 1000000; y->tv_usec += 1000000 * nsec; y->tv_sec -= nsec; } /* Compute the time remaining to wait. * tv_usec is certainly positive. */ result->tv_sec = x->tv_sec - y->tv_sec; result->tv_usec = x->tv_usec - y->tv_usec; /* Return 1 if result is negative. */ return x->tv_sec < y->tv_sec; } int main(int argc, char *argv[]) { int t, i, j, k, m, test; int Nx, Ny, Nz, Nt; if (argc > 3) { Nx = atoi(argv[1])+8; Ny = atoi(argv[2])+8; Nz = atoi(argv[3])+8; } if (argc > 4) Nt = atoi(argv[4]); // allocate the arrays double ****A = (double ****) malloc(sizeof(double***)*2); for(m=0; m<2;m++){ A[m] = (double ***) malloc(sizeof(double**)*Nz); for(i=0; i<Nz; i++){ A[m][i] = (double**) malloc(sizeof(double*)*Ny); for(j=0;j<Ny;j++){ A[m][i][j] = (double*) malloc(sizeof(double)*Nx); } } } double ****coef = (double ****) malloc(sizeof(double***)*13); for(m=0; m<13;m++){ coef[m] = (double ***) malloc(sizeof(double**)*Nz); for(i=0; i<Nz; i++){ coef[m][i] = (double**) malloc(sizeof(double*)*Ny); for(j=0;j<Ny;j++){ coef[m][i][j] = (double*) malloc(sizeof(double)*Nx); } } } // tile size information, including extra element to decide the list length int *tile_size = (int*) malloc(sizeof(int)); tile_size[0] = -1; // The list is modified here before source-to-source transformations tile_size = (int*) realloc((void *)tile_size, sizeof(int)*5); tile_size[0] = 8; tile_size[1] = 8; tile_size[2] = 4; tile_size[3] = 256; tile_size[4] = -1; // for timekeeping int ts_return = -1; struct timeval start, end, result; double tdiff = 0.0, min_tdiff=1.e100; const int BASE = 1024; // initialize variables // srand(42); for (i = 1; i < Nz; i++) { for (j = 1; j < Ny; j++) { for (k = 1; k < Nx; k++) { A[0][i][j][k] = 1.0 * (rand() % BASE); } } } for (m=0; m<13; m++) { for (i=1; i<Nz; i++) { for (j=1; j<Ny; j++) { for (k=1; k<Nx; k++) { coef[m][i][j][k] = 1.0 * (rand() % BASE); } } } } #ifdef LIKWID_PERFMON LIKWID_MARKER_INIT; #pragma omp parallel { LIKWID_MARKER_THREADINIT; #pragma omp barrier LIKWID_MARKER_START("calc"); } #endif int num_threads = 1; #if defined(_OPENMP) num_threads = omp_get_max_threads(); #endif for(test=0; test<TESTS; test++){ gettimeofday(&start, 0); // serial execution - Addition: 6 && Multiplication: 2 #pragma scop for (t = 0; t < Nt; t++) { for (i = 4; i < Nz-4; i++) { for (j = 4; j < Ny-4; j++) { for (k = 4; k < Nx-4; k++) { A[(t+1)%2][i][j][k] = coef[0][i][j][k] * A[(t)%2][i ][j ][k ] + coef[1][i][j][k] * (A[(t)%2][i-1][j ][k ] + A[(t)%2][i+1][j ][k ]) + coef[2][i][j][k] * (A[(t)%2][i ][j-1][k ] + A[(t)%2][i ][j+1][k ]) + coef[3][i][j][k] * (A[(t)%2][i ][j ][k-1] + A[(t)%2][i ][j ][k+1]) + coef[4][i][j][k] * (A[(t)%2][i-2][j ][k ] + A[(t)%2][i+2][j ][k ]) + coef[5][i][j][k] * (A[(t)%2][i ][j-2][k ] + A[(t)%2][i ][j+2][k ]) + coef[6][i][j][k] * (A[(t)%2][i ][j ][k-2] + A[(t)%2][i ][j ][k+2]) + coef[7][i][j][k] * (A[(t)%2][i-3][j ][k ] + A[(t)%2][i+3][j ][k ]) + coef[8][i][j][k] * (A[(t)%2][i ][j-3][k ] + A[(t)%2][i ][j+3][k ]) + coef[9][i][j][k] * (A[(t)%2][i ][j ][k-3] + A[(t)%2][i ][j ][k+3]) + coef[10][i][j][k]* (A[(t)%2][i-4][j ][k ] + A[(t)%2][i+4][j ][k ]) + coef[11][i][j][k]* (A[(t)%2][i ][j-4][k ] + A[(t)%2][i ][j+4][k ]) + coef[12][i][j][k]* (A[(t)%2][i ][j ][k-4] + A[(t)%2][i ][j ][k+4]) ; } } } } #pragma endscop gettimeofday(&end, 0); ts_return = timeval_subtract(&result, &end, &start); tdiff = (double) (result.tv_sec + result.tv_usec * 1.0e-6); min_tdiff = min(min_tdiff, tdiff); printf("Rank 0 TEST# %d time: %f\n", test, tdiff); } PRINT_RESULTS(4, "variable axis-symmetric") #ifdef LIKWID_PERFMON #pragma omp parallel { LIKWID_MARKER_STOP("calc"); } LIKWID_MARKER_CLOSE; #endif // Free allocated arrays for(i=0; i<Nz; i++){ for(j=0;j<Ny;j++){ free(A[0][i][j]); free(A[1][i][j]); } free(A[0][i]); free(A[1][i]); } free(A[0]); free(A[1]); for(m=0; m<13;m++){ for(i=0; i<Nz; i++){ for(j=0;j<Ny;j++){ free(coef[m][i][j]); } free(coef[m][i]); } free(coef[m]); } return 0; }
#include <errno.h> errno;
//===-- CPPTargetMachine.h - TargetMachine for the C++ backend --*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file declares the TargetMachine that is used by the C++ backend. // //===----------------------------------------------------------------------===// #ifndef CPPTARGETMACHINE_H #define CPPTARGETMACHINE_H #include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetData.h" namespace llvm { class formatted_raw_ostream; struct CPPTargetMachine : public TargetMachine { CPPTargetMachine(const Target &T, const std::string &TT, const std::string &FS) : TargetMachine(T) {} virtual bool WantsWholeFile() const { return true; } virtual bool addPassesToEmitWholeFile(PassManager &PM, formatted_raw_ostream &Out, CodeGenFileType FileType, CodeGenOpt::Level OptLevel, bool DisableVerify); virtual const TargetData *getTargetData() const { return 0; } }; extern Target TheCppBackendTarget; } // End llvm namespace #endif
/* +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Marcus Boerger <helly@php.net> | +----------------------------------------------------------------------+ */ /* $Id$ */ #ifndef SPL_OBSERVER_H #define SPL_OBSERVER_H #include "php.h" #include "php_spl.h" extern PHPAPI zend_class_entry *spl_ce_SplObserver; extern PHPAPI zend_class_entry *spl_ce_SplSubject; extern PHPAPI zend_class_entry *spl_ce_SplObjectStorage; extern PHPAPI zend_class_entry *spl_ce_MultipleIterator; PHP_MINIT_FUNCTION(spl_observer); #endif /* SPL_OBSERVER_H */ /* * Local Variables: * c-basic-offset: 4 * tab-width: 4 * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */
/* ** $Id: lfunc.h,v 2.15.1.1 2017/04/19 17:39:34 roberto Exp $ ** Auxiliary functions to manipulate prototypes and closures ** See Copyright Notice in lua.h */ #ifndef lfunc_h #define lfunc_h #include "lobject.h" #define sizeCclosure(n) (cast(int, sizeof(CClosure)) + \ cast(int, sizeof(TValue)*((n)-1))) #define sizeLclosure(n) (cast(int, sizeof(LClosure)) + \ cast(int, sizeof(TValue *)*((n)-1))) /* test whether thread is in 'twups' list */ #define isintwups(L) (L->twups != L) /* ** maximum number of upvalues in a closure (both C and Lua). (Value ** must fit in a VM register.) */ #define MAXUPVAL 255 /* ** Upvalues for Lua closures */ struct UpVal { TValue *v; /* points to stack or to its own value */ lu_mem refcount; /* reference counter */ union { struct { /* (when open) */ UpVal *next; /* linked list */ int touched; /* mark to avoid cycles with dead threads */ } open; TValue value; /* the value (when closed) */ } u; }; #define upisopen(up) ((up)->v != &(up)->u.value) LUAI_FUNC Proto *luaF_newproto (lua_State *L); LUAI_FUNC CClosure *luaF_newCclosure (lua_State *L, int nelems); LUAI_FUNC LClosure *luaF_newLclosure (lua_State *L, int nelems); LUAI_FUNC void luaF_initupvals (lua_State *L, LClosure *cl); LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); LUAI_FUNC void luaF_close (lua_State *L, StkId level); LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f); LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number, int pc); LUAI_FUNC void luaF_shareproto (Proto *func); #endif
#ifndef RPCCONSOLE_H #define RPCCONSOLE_H #include <QDialog> namespace Ui { class RPCConsole; } class ClientModel; /** Local Bitcoin RPC console. */ class RPCConsole: public QDialog { Q_OBJECT public: explicit RPCConsole(QWidget *parent = 0); ~RPCConsole(); void setClientModel(ClientModel *model); enum MessageClass { MC_ERROR, MC_DEBUG, CMD_REQUEST, CMD_REPLY, CMD_ERROR }; protected: virtual bool eventFilter(QObject* obj, QEvent *event); private slots: void on_lineEdit_returnPressed(); void on_tabWidget_currentChanged(int index); /** open the debug.log from the current datadir */ void on_openDebugLogfileButton_clicked(); /** display messagebox with program parameters (same as cloudcoin-qt --help) */ void on_showCLOptionsButton_clicked(); public slots: void clear(); void message(int category, const QString &message, bool html = false); /** Set number of connections shown in the UI */ void setNumConnections(int count); /** Set number of blocks shown in the UI */ void setNumBlocks(int count, int countOfPeers); /** Go forward or back in history */ void browseHistory(int offset); /** Scroll console view to end */ void scrollToEnd(); signals: // For RPC command executor void stopExecutor(); void cmdRequest(const QString &command); private: Ui::RPCConsole *ui; ClientModel *clientModel; QStringList history; int historyPtr; void startExecutor(); }; #endif // RPCCONSOLE_H
#include "ruby.h" #include "rubyspec.h" #ifdef __cplusplus extern "C" { #endif #ifdef HAVE_RB_DEFINE_HOOKED_VARIABLE VALUE g_hooked_var = Qnil; void var_2x_setter(VALUE val, ID id, VALUE *var) { *var = INT2NUM(NUM2INT(val) * 2); } static VALUE sb_define_hooked_variable(VALUE self, VALUE var_name) { rb_define_hooked_variable(StringValuePtr(var_name), &g_hooked_var, 0, var_2x_setter); return Qnil; } #endif #ifdef HAVE_RB_DEFINE_READONLY_VARIABLE VALUE g_ro_var = Qnil; static VALUE sb_define_readonly_variable(VALUE self, VALUE var_name, VALUE val) { g_ro_var = val; rb_define_readonly_variable(StringValuePtr(var_name), &g_ro_var); return Qnil; } #endif #ifdef HAVE_RB_DEFINE_VARIABLE VALUE g_var = Qnil; static VALUE sb_get_global_value(VALUE self) { return g_var; } static VALUE sb_define_variable(VALUE self, VALUE var_name, VALUE val) { g_var = val; rb_define_variable(StringValuePtr(var_name), &g_var); return Qnil; } #endif #ifdef HAVE_RB_F_GLOBAL_VARIABLES static VALUE sb_f_global_variables(VALUE self) { return rb_f_global_variables(); } #endif #ifdef HAVE_RB_GV_GET static VALUE sb_gv_get(VALUE self, VALUE var) { return rb_gv_get(StringValuePtr(var)); } #endif #ifdef HAVE_RB_GV_SET static VALUE sb_gv_set(VALUE self, VALUE var, VALUE val) { return rb_gv_set(StringValuePtr(var), val); } #endif #ifdef HAVE_RB_STDIN static VALUE global_spec_rb_stdin(VALUE self) { return rb_stdin; } #endif #ifdef HAVE_RB_STDOUT static VALUE global_spec_rb_stdout(VALUE self) { return rb_stdout; } #endif #ifdef HAVE_RB_STDERR static VALUE global_spec_rb_stderr(VALUE self) { return rb_stderr; } #endif #ifdef HAVE_RB_DEFOUT static VALUE global_spec_rb_defout(VALUE self) { return rb_defout; } #endif #ifdef HAVE_RB_RS static VALUE global_spec_rb_rs(VALUE self) { return rb_rs; } #endif #ifdef HAVE_RB_DEFAULT_RS static VALUE global_spec_rb_default_rs(VALUE self) { return rb_default_rs; } #endif #ifdef HAVE_RB_OUTPUT_RS static VALUE global_spec_rb_output_rs(VALUE self) { return rb_output_rs; } #endif #ifdef HAVE_RB_OUTPUT_FS static VALUE global_spec_rb_output_fs(VALUE self) { return rb_output_fs; } #endif #ifdef HAVE_RB_LASTLINE_SET static VALUE global_spec_rb_lastline_set(VALUE self, VALUE line) { rb_lastline_set(line); return Qnil; } #endif #ifdef HAVE_RB_LASTLINE_GET static VALUE global_spec_rb_lastline_get(VALUE self) { return rb_lastline_get(); } #endif void Init_globals_spec(void) { VALUE cls; cls = rb_define_class("CApiGlobalSpecs", rb_cObject); #ifdef HAVE_RB_DEFINE_HOOKED_VARIABLE rb_define_method(cls, "rb_define_hooked_variable_2x", sb_define_hooked_variable, 1); #endif #ifdef HAVE_RB_DEFINE_READONLY_VARIABLE rb_define_method(cls, "rb_define_readonly_variable", sb_define_readonly_variable, 2); #endif #ifdef HAVE_RB_DEFINE_VARIABLE rb_define_method(cls, "rb_define_variable", sb_define_variable, 2); rb_define_method(cls, "sb_get_global_value", sb_get_global_value, 0); #endif #ifdef HAVE_RB_F_GLOBAL_VARIABLES rb_define_method(cls, "rb_f_global_variables", sb_f_global_variables, 0); #endif #ifdef HAVE_RB_GV_GET rb_define_method(cls, "sb_gv_get", sb_gv_get, 1); #endif #ifdef HAVE_RB_GV_SET rb_define_method(cls, "sb_gv_set", sb_gv_set, 2); #endif #ifdef HAVE_RB_STDIN rb_define_method(cls, "rb_stdin", global_spec_rb_stdin, 0); #endif #ifdef HAVE_RB_STDOUT rb_define_method(cls, "rb_stdout", global_spec_rb_stdout, 0); #endif #ifdef HAVE_RB_STDERR rb_define_method(cls, "rb_stderr", global_spec_rb_stderr, 0); #endif #ifdef HAVE_RB_DEFOUT rb_define_method(cls, "rb_defout", global_spec_rb_defout, 0); #endif #ifdef HAVE_RB_RS rb_define_method(cls, "rb_rs", global_spec_rb_rs, 0); #endif #ifdef HAVE_RB_DEFAULT_RS rb_define_method(cls, "rb_default_rs", global_spec_rb_default_rs, 0); #endif #ifdef HAVE_RB_OUTPUT_RS rb_define_method(cls, "rb_output_rs", global_spec_rb_output_rs, 0); #endif #ifdef HAVE_RB_OUTPUT_FS rb_define_method(cls, "rb_output_fs", global_spec_rb_output_fs, 0); #endif #ifdef HAVE_RB_LASTLINE_SET rb_define_method(cls, "rb_lastline_set", global_spec_rb_lastline_set, 1); #endif #ifdef HAVE_RB_LASTLINE_GET rb_define_method(cls, "rb_lastline_get", global_spec_rb_lastline_get, 0); #endif } #ifdef __cplusplus } #endif
#ifndef _MModelMessage #define _MModelMessage //- // ========================================================================== // Copyright (C) 1995 - 2006 Autodesk, Inc., and/or its licensors. All // rights reserved. // // The coded instructions, statements, computer programs, and/or related // material (collectively the "Data") in these files contain unpublished // information proprietary to Autodesk, Inc. ("Autodesk") and/or its // licensors, which is protected by U.S. and Canadian federal copyright law // and by international treaties. // // The Data may not be disclosed or distributed to third parties or be // copied or duplicated, in whole or in part, without the prior written // consent of Autodesk. // // The copyright notices in the Software and this entire statement, // including the above license grant, this restriction and the following // disclaimer, must be included in all copies of the Software, in whole // or in part, and all derivative works of the Software, unless such copies // or derivative works are solely in the form of machine-executable object // code generated by a source language processor. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. // AUTODESK DOES NOT MAKE AND HEREBY DISCLAIMS ANY EXPRESS OR IMPLIED // WARRANTIES INCLUDING, BUT NOT LIMITED TO, THE WARRANTIES OF // NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, // OR ARISING FROM A COURSE OF DEALING, USAGE, OR TRADE PRACTICE. IN NO // EVENT WILL AUTODESK AND/OR ITS LICENSORS BE LIABLE FOR ANY LOST // REVENUES, DATA, OR PROFITS, OR SPECIAL, DIRECT, INDIRECT, OR // CONSEQUENTIAL DAMAGES, EVEN IF AUTODESK AND/OR ITS LICENSORS HAS // BEEN ADVISED OF THE POSSIBILITY OR PROBABILITY OF SUCH DAMAGES. // ========================================================================== //+ // // CLASS: MModelMessage // // **************************************************************************** #if defined __cplusplus // **************************************************************************** // INCLUDED HEADER FILES #include <maya/MMessage.h> // **************************************************************************** // DECLARATIONS class MObject; // **************************************************************************** // CLASS DECLARATION (MModelMessage) //! \ingroup OpenMaya //! \brief Scene messages. /*! This class is used to register callbacks for model related messages. The addCallback method registers a function that will be executed whenever the specified message occurs. An id is returned and is used to remove the callback. To remove a callback use MMessage::removeCallback. All callbacks that are registered by a plug-in must be removed by that plug-in when it is unloaded. Failure to do so will result in a fatal error. */ class OPENMAYA_EXPORT MModelMessage : public MMessage { public: //! Message types supported by the addCallback method. enum Message { kActiveListModified //!< active selection changes }; public: static MCallbackId addCallback( Message, MMessage::MBasicFunction, void * clientData = NULL, MStatus * ReturnStatus = NULL ); //! Before duplicate callback static MCallbackId addBeforeDuplicateCallback( MMessage::MBasicFunction, void * clientData = NULL, MStatus * ReturnStatus = NULL ); //! After duplicate callback static MCallbackId addAfterDuplicateCallback( MMessage::MBasicFunction, void * clientData = NULL, MStatus * ReturnStatus = NULL ); //! Node added to model message static MCallbackId addNodeAddedToModelCallback( const MObject &dagNode, MMessage::MNodeFunction, void * clientData = NULL, MStatus * ReturnStatus = NULL ); //! Node removed from model message static MCallbackId addNodeRemovedFromModelCallback( const MObject &dagNode, MMessage::MNodeFunction, void * clientData = NULL, MStatus * ReturnStatus = NULL ); static const char* className(); }; #endif /* __cplusplus */ #endif /* _MModelMessage */
#ifdef HAVE_CONFIG_H #include "../ext_config.h" #endif #include <php.h> #include "../php_ext.h" #include "../ext.h" #include <Zend/zend_operators.h> #include <Zend/zend_exceptions.h> #include <Zend/zend_interfaces.h> #include "kernel/main.h" #include "kernel/object.h" ZEPHIR_INIT_CLASS(stub_12__closure) { ZEPHIR_REGISTER_CLASS(stub, 12__closure, stub, 12__closure, stub_12__closure_method_entry, ZEND_ACC_FINAL_CLASS); return SUCCESS; } PHP_METHOD(stub_12__closure, __invoke) { zval *this_ptr = getThis(); RETURN_LONG(5); }
#pragma once #include <glbinding/glbinding_api.h> #include <glbinding/gl/extension.h> #include <glbinding/gl/types.h> #include <glbinding/gl/values.h> #include <glbinding/gl/boolean.h> #include <glbinding/gl/bitfield.h> #include <glbinding/gl/enum.h> #include <glbinding/gl/functions.h>
// // ALPHAGenericConverter.h // Alpha // // Created by Dal Rupnik on 03/06/15. // Copyright (c) 2015 Unified Sense. All rights reserved. // #import "ALPHADataConverterSource.h" /*! * Generic converter that can convert basically any ALPHAModel */ @interface ALPHAGenericConverter : NSObject <ALPHADataConverterSource> @end
/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 2006-2016 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Andrey Hristov <andrey@mysql.com> | | Ulf Wendel <uwendel@mysql.com> | | Georg Richter <georg@mysql.com> | +----------------------------------------------------------------------+ */ /* $Id: mysqlnd_wireprotocol.h 291983 2009-12-11 11:58:57Z andrey $ */ #ifndef MYSQLND_NET_H #define MYSQLND_NET_H PHPAPI MYSQLND_NET * mysqlnd_net_init(zend_bool persistent, MYSQLND_STATS * stats, MYSQLND_ERROR_INFO * error_info TSRMLS_DC); PHPAPI void mysqlnd_net_free(MYSQLND_NET * const net, MYSQLND_STATS * stats, MYSQLND_ERROR_INFO * error_info TSRMLS_DC); #endif /* MYSQLND_NET_H */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: noet sw=4 ts=4 fdm=marker * vim<600: noet sw=4 ts=4 */
/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2015 Scientific Computing and Imaging Institute, University of Utah. License for the specific language governing rights and limitations under Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef DATAFLOW_NETWORK_GeometryGeneratingModule_H #define DATAFLOW_NETWORK_GeometryGeneratingModule_H #include <Dataflow/Network/Module.h> #include <Dataflow/Network/share.h> namespace SCIRun { namespace Dataflow { namespace Networks { class SCISHARE ModuleLevelUniqueIDGenerator { public: ModuleLevelUniqueIDGenerator(const ModuleInterface& module, const std::string& name) : module_(module), name_(name) {} std::string operator()() const { return generateModuleLevelUniqueID(module_, name_); } private: const ModuleInterface& module_; std::string name_; static std::hash<std::string> hash_; std::string generateModuleLevelUniqueID(const ModuleInterface& module, const std::string& name) const; }; class SCISHARE GeometryGeneratingModule : public Module, public Core::GeometryIDGenerator { public: explicit GeometryGeneratingModule(const ModuleLookupInfo& info); std::string generateGeometryID(const std::string& tag) const override; }; }}} #endif
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // // $NoKeywords: $ //=============================================================================// #ifndef CS_GAMEVARS_SHARED_H #define CS_GAMEVARS_SHARED_H #ifdef _WIN32 #pragma once #endif #include "convar.h" extern ConVar mp_forcecamera; extern ConVar mp_allowspectators; extern ConVar friendlyfire; extern ConVar mp_fadetoblack; extern ConVar mp_timelimit_match, mp_timelimit_extratime_halftime, mp_timelimit_extratime_intermission, mp_timelimit_halftime, mp_timelimit_warmup, mp_timelimit_penalties_intermission, mp_timelimit_cooldown, mp_injurytime_min, mp_injurytime_max, mp_injurytime_coeff, mp_extratime, mp_penalties, mp_showstatetransitions, mp_shield_throwin_radius_teammate, mp_shield_throwin_movement_x, mp_shield_throwin_movement_y, mp_shield_throwin_radius_opponent, mp_shield_freekick_radius_teammate, mp_shield_freekick_radius_opponent, mp_shield_corner_radius_teammate, mp_shield_corner_radius_opponent, mp_shield_kickoff_radius_teammate, mp_shield_kickoff_radius_opponent, mp_shield_ball_radius, mp_shield_border, mp_shield_block_sixyardbox, mp_shield_block_opponent_half, mp_field_padding, mp_field_padding_enabled, mp_offside, mp_joindelay, mp_joincoordduration, mp_maxplayers, mp_weather, mp_teamnames, mp_custom_shirt_numbers, mp_reset_spin_toggles_on_shot, mp_serverinfo, mp_matchinfo, mp_tvcam_speed_coeff, mp_tvcam_speed_coeff_fast, mp_tvcam_speed_exponent, mp_tvcam_speed_exponent_fast, mp_tvcam_border_north, mp_tvcam_border_east, mp_tvcam_border_south, mp_tvcam_border_west, mp_tvcam_offset_forward, mp_tvcam_offset_forward_time, mp_tvcam_offset_north, mp_tvcam_sideline_offset_height, mp_tvcam_sideline_offset_north, mp_tvcam_fixed_sideline_border_top, mp_tvcam_fixed_sideline_border_right, mp_tvcam_fixed_sideline_border_bottom, mp_tvcam_fixed_sideline_border_left, mp_tvcam_fixed_sideline_offset_height, mp_tvcam_fixed_sideline_offset_top, mp_tvcam_fixed_sideline_max_dist, mp_tvcam_targetpos_offset_top, mp_tvcam_fixed_sideline_targetpos_offset_top, mp_timeout_count, mp_timeout_duration, mp_captaincy_home, mp_captaincy_away; #endif // CS_GAMEVARS_SHARED_H
// generated by Fast Light User Interface Designer (fluid) version 1.0303 #ifndef fast_slow_h #define fast_slow_h #include <FL/Fl.H> #include <FL/Fl_Double_Window.H> #include <FL/Fl_Slider.H> extern Fl_Slider *control; extern Fl_Slider *fast; extern Fl_Slider *slow; #include <FL/Fl_Box.H> #endif
#import <UIKit/UIKit.h> @interface UIView (FrameAdditions) - (void)in_setFrameY:(float)y; - (void)in_setFrameX:(float)x; - (void)in_shiftFrame:(CGPoint)offset; - (void)in_setFrameOrigin:(CGPoint)origin; - (void)in_setFrameSize:(CGSize)size; - (void)in_setFrameCenter:(CGPoint)p; - (void)in_setFrameWidth:(float)w; - (void)in_setFrameHeight:(float)h; - (CGPoint)in_topRight; - (CGPoint)in_bottomRight; - (CGPoint)in_bottomLeft; - (id)viewAncestorOfClass:(Class)klass; @end
/* CLI stylizing Copyright (C) 2018-2020 Free Software Foundation, Inc. This file is part of GDB. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef CLI_CLI_STYLE_H #define CLI_CLI_STYLE_H #include "ui-file.h" #include "command.h" #include "gdbsupport/observable.h" /* A single CLI style option. */ class cli_style_option { public: /* Construct a CLI style option with a foreground color. */ cli_style_option (const char *name, ui_file_style::basic_color fg); /* Construct a CLI style option with an intensity. */ cli_style_option (const char *name, ui_file_style::intensity i); /* Return a ui_file_style corresponding to the settings in this CLI style. */ ui_file_style style () const; /* Return the style name. */ const char *name () { return m_name; }; /* Call once to register this CLI style with the CLI engine. */ void add_setshow_commands (enum command_class theclass, const char *prefix_doc, struct cmd_list_element **set_list, struct cmd_list_element **show_list, bool skip_intensity); /* Return the 'set style NAME' command list, that can be used to build a lambda DO_SET to call add_setshow_commands. */ struct cmd_list_element *set_list () { return m_set_list; }; /* Same as SET_LIST but for the show command list. */ struct cmd_list_element *show_list () { return m_show_list; }; /* This style can be observed for any changes. */ gdb::observers::observable<> changed; private: /* The style name. */ const char *m_name; /* The foreground. */ const char *m_foreground; /* The background. */ const char *m_background; /* The intensity. */ const char *m_intensity; /* Storage for prefixes needed when registering the commands. */ std::string m_show_prefix; std::string m_set_prefix; /* Storage for command lists needed when registering subcommands. */ struct cmd_list_element *m_set_list = nullptr; struct cmd_list_element *m_show_list = nullptr; /* Callback to notify the observable. */ static void do_set_value (const char *ignore, int from_tty, struct cmd_list_element *cmd); /* Callback to show the foreground. */ static void do_show_foreground (struct ui_file *file, int from_tty, struct cmd_list_element *cmd, const char *value); /* Callback to show the background. */ static void do_show_background (struct ui_file *file, int from_tty, struct cmd_list_element *cmd, const char *value); /* Callback to show the intensity. */ static void do_show_intensity (struct ui_file *file, int from_tty, struct cmd_list_element *cmd, const char *value); }; /* The file name style. */ extern cli_style_option file_name_style; /* The function name style. */ extern cli_style_option function_name_style; /* The variable name style. */ extern cli_style_option variable_name_style; /* The address style. */ extern cli_style_option address_style; /* The highlight style. */ extern cli_style_option highlight_style; /* The title style. */ extern cli_style_option title_style; /* The metadata style. */ extern cli_style_option metadata_style; /* The border style of a TUI window that does not have the focus. */ extern cli_style_option tui_border_style; /* The border style of a TUI window that does have the focus. */ extern cli_style_option tui_active_border_style; /* True if source styling is enabled. */ extern bool source_styling; /* True if styling is enabled. */ extern bool cli_styling; #endif /* CLI_CLI_STYLE_H */
// $Id$ --*- c -*-- // Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; version 2 of the License. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifdef HAVE_CONFIG_H # include <config.h> #endif #include "vserver.h" #include "virtual.h" #if defined(VC_ENABLE_API_OLDPROC) && defined(VC_ENABLE_API_V13) # define VC_MULTIVERSION_SYSCALL 1 #endif #include "vserver-internal.h" #ifdef VC_ENABLE_API_V13 # include "syscall_getvxinfo-v13.hc" #endif #ifdef VC_ENABLE_API_OLDPROC # include "syscall_getvxinfo-oldproc.hc" #endif int vc_get_vx_info(xid_t xid, struct vc_vx_info *info) { if (info==0) { errno = EFAULT; return -1; } CALL_VC(CALL_VC_V13 (vc_get_vx_info, xid, info), CALL_VC_OLDPROC(vc_get_vx_info, xid, info)); }
/* * crc10.c * $Id: crc10.c 45015 2012-09-20 01:29:52Z morriss $ * * Wireshark - Network traffic analyzer * By Gerald Combs <gerald@wireshark.org> * Copyright 1998 Gerald Combs * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "config.h" #include <glib.h> #include "crc10.h" /* * Charles Michael Heard's CRC-10 code, from * * http://cell-relay.indiana.edu/cell-relay/publications/software/CRC/crc10.html * * with the CRC table initialized with values computed by * his "gen_byte_crc10_table()" routine, rather than by calling that * routine at run time, and with various data type cleanups. */ static const guint16 byte_crc10_table[256] = { 0x0000, 0x0233, 0x0255, 0x0066, 0x0299, 0x00aa, 0x00cc, 0x02ff, 0x0301, 0x0132, 0x0154, 0x0367, 0x0198, 0x03ab, 0x03cd, 0x01fe, 0x0031, 0x0202, 0x0264, 0x0057, 0x02a8, 0x009b, 0x00fd, 0x02ce, 0x0330, 0x0103, 0x0165, 0x0356, 0x01a9, 0x039a, 0x03fc, 0x01cf, 0x0062, 0x0251, 0x0237, 0x0004, 0x02fb, 0x00c8, 0x00ae, 0x029d, 0x0363, 0x0150, 0x0136, 0x0305, 0x01fa, 0x03c9, 0x03af, 0x019c, 0x0053, 0x0260, 0x0206, 0x0035, 0x02ca, 0x00f9, 0x009f, 0x02ac, 0x0352, 0x0161, 0x0107, 0x0334, 0x01cb, 0x03f8, 0x039e, 0x01ad, 0x00c4, 0x02f7, 0x0291, 0x00a2, 0x025d, 0x006e, 0x0008, 0x023b, 0x03c5, 0x01f6, 0x0190, 0x03a3, 0x015c, 0x036f, 0x0309, 0x013a, 0x00f5, 0x02c6, 0x02a0, 0x0093, 0x026c, 0x005f, 0x0039, 0x020a, 0x03f4, 0x01c7, 0x01a1, 0x0392, 0x016d, 0x035e, 0x0338, 0x010b, 0x00a6, 0x0295, 0x02f3, 0x00c0, 0x023f, 0x000c, 0x006a, 0x0259, 0x03a7, 0x0194, 0x01f2, 0x03c1, 0x013e, 0x030d, 0x036b, 0x0158, 0x0097, 0x02a4, 0x02c2, 0x00f1, 0x020e, 0x003d, 0x005b, 0x0268, 0x0396, 0x01a5, 0x01c3, 0x03f0, 0x010f, 0x033c, 0x035a, 0x0169, 0x0188, 0x03bb, 0x03dd, 0x01ee, 0x0311, 0x0122, 0x0144, 0x0377, 0x0289, 0x00ba, 0x00dc, 0x02ef, 0x0010, 0x0223, 0x0245, 0x0076, 0x01b9, 0x038a, 0x03ec, 0x01df, 0x0320, 0x0113, 0x0175, 0x0346, 0x02b8, 0x008b, 0x00ed, 0x02de, 0x0021, 0x0212, 0x0274, 0x0047, 0x01ea, 0x03d9, 0x03bf, 0x018c, 0x0373, 0x0140, 0x0126, 0x0315, 0x02eb, 0x00d8, 0x00be, 0x028d, 0x0072, 0x0241, 0x0227, 0x0014, 0x01db, 0x03e8, 0x038e, 0x01bd, 0x0342, 0x0171, 0x0117, 0x0324, 0x02da, 0x00e9, 0x008f, 0x02bc, 0x0043, 0x0270, 0x0216, 0x0025, 0x014c, 0x037f, 0x0319, 0x012a, 0x03d5, 0x01e6, 0x0180, 0x03b3, 0x024d, 0x007e, 0x0018, 0x022b, 0x00d4, 0x02e7, 0x0281, 0x00b2, 0x017d, 0x034e, 0x0328, 0x011b, 0x03e4, 0x01d7, 0x01b1, 0x0382, 0x027c, 0x004f, 0x0029, 0x021a, 0x00e5, 0x02d6, 0x02b0, 0x0083, 0x012e, 0x031d, 0x037b, 0x0148, 0x03b7, 0x0184, 0x01e2, 0x03d1, 0x022f, 0x001c, 0x007a, 0x0249, 0x00b6, 0x0285, 0x02e3, 0x00d0, 0x011f, 0x032c, 0x034a, 0x0179, 0x0386, 0x01b5, 0x01d3, 0x03e0, 0x021e, 0x002d, 0x004b, 0x0278, 0x0087, 0x02b4, 0x02d2, 0x00e1 }; /* update the data block's CRC-10 remainder one byte at a time */ guint16 update_crc10_by_bytes(guint16 crc10, const guint8 *data_blk_ptr, int data_blk_size) { register int i; guint16 crc10_accum = 0; for (i = 0; i < data_blk_size; i++) { crc10_accum = ((crc10_accum << 8) & 0x3ff) ^ byte_crc10_table[( crc10_accum >> 2) & 0xff] ^ *data_blk_ptr++; } crc10_accum = ((crc10_accum << 8) & 0x3ff) ^ byte_crc10_table[( crc10_accum >> 2) & 0xff] ^ (crc10>>2); crc10_accum = ((crc10_accum << 8) & 0x3ff) ^ byte_crc10_table[( crc10_accum >> 2) & 0xff] ^ ((crc10<<6) & 0xFF); return crc10_accum; }
/* eoBit.h (c) GeNeura Team 1998, Marc Schoenauer 2000 This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Contact: todos@geneura.ugr.es, http://geneura.ugr.es Marc.Schoenauer@polytechnique.fr */ /* MS, Nov. 23, 2000 Added the calls to base class I/O routines that print the fitness Left printing/reading of the size of the bitstring, for backward compatibility, and as it is a general practice in EO MS, Feb. 7, 2001 replaced all ...Bin... names with ...Bit... names - for bitstring as it was ambiguous with bin...ary things */ #ifndef eoBit_h #define eoBit_h //----------------------------------------------------------------------------- #include <algorithm> #include <functional> #include <iostream> #include <string> #include "eoVector.h" /** @defgroup bitstring Bit strings Various functions for a bitstring representation. Example of a complete test program that use various bitstrings operators: @include t-eobin.cpp @ingroup Representations */ /** Implementation of bitstring chromosome. @class eoBit eoBit.h ga/eoBit.h @ingroup bitstring Based on STL's std::vector<bool> specialization. */ template <class FitT> class eoBit: public eoVector<FitT, bool> { public: using eoVector< FitT, bool >::begin; using eoVector< FitT, bool >::end; using eoVector< FitT, bool >::resize; using eoVector< FitT, bool >::size; /** * (Default) Constructor. * @param size Size of the binary std::string. * @param value Default value. */ eoBit(unsigned size = 0, bool value = false): eoVector<FitT, bool>(size, value) {} /// My class name. virtual std::string className() const { return "eoBit"; } /** * To print me on a stream. * @param os The std::ostream. */ virtual void printOn(std::ostream& os) const { EO<FitT>::printOn(os); os << ' '; os << size() << ' '; std::copy(begin(), end(), std::ostream_iterator<bool>(os)); } /** * To read me from a stream. * @param is The std::istream. */ virtual void readFrom(std::istream& is) { EO<FitT>::readFrom(is); unsigned s; is >> s; std::string bits; is >> bits; if (is) { resize(bits.size()); std::transform(bits.begin(), bits.end(), begin(), std::bind2nd(std::equal_to<char>(), '1')); } } }; //----------------------------------------------------------------------------- #endif //eoBit_h // Local Variables: // coding: iso-8859-1 // mode: C++ // c-file-offsets: ((c . 0)) // c-file-style: "Stroustrup" // fill-column: 80 // End:
#include "VideoCapturePerc.h" #ifndef __NENA_VIDEOFACEPERC_INCLUDED__ #define __NENA_VIDEOFACEPERC_INCLUDED__ namespace Nena { namespace Video { namespace Perc { namespace Tracking { struct Face : public Utility::BasicStatus<> { static UINT32 const DefaultProfile = UINT_ERROR; static UINT32 const FirstSuccessfulQuery = UINT_ERROR - 1; typedef void Action; typedef HRESULT Result; typedef pxcStatus Status; PXCSmartPtr<PXCFaceAnalysis> Base; PXCFaceAnalysis::Landmark *Landmark; PXCFaceAnalysis::Detection *Detection; BOOL Paused; BOOL Enabled; UINT32 DescIndex; PXCSession::ImplDesc Desc; PXCFaceAnalysis::ProfileInfo Profile; PXCFaceAnalysis::Landmark::ProfileInfo LandmarkProfile; PXCFaceAnalysis::Detection::ProfileInfo DetectionProfile; Face(_In_ Capture *capture); Face(_In_ PXCSession *session); Action Init(_In_ Capture *capture); Action Init(_In_ PXCSession *session); Action PauseFaceAnalysis(_In_ BOOL paused); Action SubmitRequirements(_Inout_ Capture *host); Action SetProfile(void); Action SetLandmarkProfile(void); Action SetDetectionProfile(void); Action SearchProfile(_In_opt_ UINT32 option = FirstSuccessfulQuery); Action SearchLandmarkProfile(_In_opt_ UINT32 option = FirstSuccessfulQuery); Action SearchDetectionProfile(_In_opt_ UINT32 option = FirstSuccessfulQuery); Status SubmitProcessTask(_Inout_ Sample *sample); Status SubmitProcessTask(_In_ PXCImage *images[], _Outref_ PXCScheduler::SyncPoint **sync); Status SubmitProcessTask(_Inout_ Sample *sample, _In_range_(0, Sample::MaxStreams) UINT32 syncIdx); Status SubmitProcessTaskUnsafe(_Inout_ Sample *sample); Status SubmitProcessTaskUnsafe(_In_ PXCImage *images[], _Outref_ PXCScheduler::SyncPoint **sync); Status SubmitProcessTaskUnsafe(_Inout_ Sample *sample, _In_range_(0, Sample::MaxStreams) UINT32 syncIdx); UINT32 GetLastFaceCount(_Inout_opt_ Status *lastStatus = nullptr); }; } } } } #endif // !__NENA_VIDEOFACEPERC_INCLUDED__
#include <inttypes.h> #include <avr/io.h> #include "uart.h" void UARTInit(void) { //UCSRB |= (1<<TXEN); // UART TX einschalten //UCSRC |= (1<<URSEL)|(3<<UCSZ0); // Asynchron 8N1 //UCSRB |= ( 1 << RXEN ); // RX aktivieren //UCSRB |= ( 1 << RXCIE ); // RX interrupt aktivieren //UCSRC = (1 << URSEL) | (1 << UCSZ1) | (1 << UCSZ0); UCSRA = (1 << RXC) | (1 << TXC); UCSRB = (1 << RXEN) | (1 << TXEN) | (1 << RXCIE); UCSRC = (1 << URSEL) | (1 << UCSZ1) | (1 << UCSZ0); //ATmega32 bei 16MHz und für 9600 Baud UBRRH = 0; // Highbyte ist 0 //UBRRL = 51; // Lowbyte ist 51 ( dezimal ) UBRRL = 103; // Lowbyte ist 51 für // Flush Receive-Buffer do { uint8_t dummy; (void) (dummy = UDR); } while (UCSRA & (1 << RXC)); } void UARTPutChar(unsigned char sign) { // bei neueren AVRs steht der Status in UCSRA/UCSR0A/UCSR1A, hier z.B. fuer ATmega16: while (!(UCSRA & (1<<UDRE))); /* warten bis Senden moeglich */ UDR = sign; /* schreibt das Zeichen x auf die Schnittstelle */ } unsigned char UARTGetChar(void) { while (!(UCSRA & (1<<RXC))); // warten bis Zeichen verfuegbar return UDR; // Zeichen aus UDR an Aufrufer zurueckgeben } void UARTWrite(char* msg) { while(*msg != '\0') { UARTPutChar (*msg++); } } unsigned char AsciiToHex(unsigned char high,unsigned char low) { unsigned char new; // check if lower equal 9 ( assii 57 ) if(high <= 57) // high is a number high = high -48; else // high is a letter high = high -87; high = high << 4; high = high & 0xF0; // check if lower equal 9 ( assii 57 ) if(low <= 57) // high is a number low = low -48; else // high is a letter low = low -87; low = low & 0x0F; new = high | low; return new; } void SendHex(unsigned char hex) { unsigned char high,low; // get highnibble high = hex & 0xF0; high = high >> 4; // get lownibble low = hex & 0x0F; if(high<=9) UARTPutChar(high+48); else UARTPutChar(high+87); if(low<=9) UARTPutChar(low+48); else UARTPutChar(low+87); } /* void uartInit(ulong baudrate, uchar parity, uchar stopbits, uchar databits) { usbDWord_t br; br.dword = F_CPU / (8L * baudrate) - 1; UCSR0A |= (1<<U2X0); #if DEBUG_LEVEL < 1 // USART configuration UCSR0B = 0; UCSR0C = URSEL_MASK | ((parity==1? 3:parity)<<UPM00) | ((stopbits>>1)<<USBS0) | ((databits-5)<<UCSZ00); UBRR0L = br.bytes[0]; UBRR0H = br.bytes[1]; #else DBG1(0xf0, br.bytes, 2); #endif // DEBUG_LEVEL #ifdef USE_UART_RXD_INTERRUPT UCSR0B = (1<<RXEN0) | (1<<TXEN0) | (1<<RXCIE0); #else UCSR0B = (1<<RXEN0) | (1<<TXEN0); #endif } */
/* * (C) Copyright IBM Corp. 2004, 2005 * Copyright (c) 2005, Intel Corporation * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope 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. * * Author(s): * Carl McAdams <carlmc@us.ibm.com> * Xiaowei Yang <xiaowei.yang@intel.com> * * Spec: HPI-B.01.01 * Function: saHpiEventGet * Description: * Call saHpiEventGet passing in a NULL pointer for Event. * Expected return: SA_ERR_HPI_INVALID_PARAMS. * Line: P62-29:P62-30 */ #include <stdio.h> #include "saf_test.h" int Test_Resource(SaHpiSessionIdT session_id) { SaErrorT status; int retval = SAF_TEST_UNKNOWN; status = saHpiSubscribe(session_id); if (status != SA_OK) { retval = SAF_TEST_UNRESOLVED; e_print(saHpiSubscribe, SA_OK, status); } else { // saHpiDiscover(session_id); // // Call saHpiEventGet passing in a NULL pointer for Event // status = saHpiEventGet(session_id, SAHPI_TIMEOUT_IMMEDIATE, NULL, NULL, NULL, NULL); if (status == SA_ERR_HPI_INVALID_PARAMS) { retval = SAF_TEST_PASS; } else { retval = SAF_TEST_FAIL; e_print(saHpiEventGet, SA_ERR_HPI_INVALID_PARAMS, status); } status = saHpiUnsubscribe(session_id); } return (retval); } /********************************************************** * Main Function * takes no arguments * * returns: SAF_TEST_PASS when successfull * SAF_TEST_FAIL when an unexpected error occurs *************************************************************/ int main(int argc, char **argv) { int retval = SAF_TEST_UNKNOWN; retval = process_single_domain(Test_Resource); return (retval); }
/* * IBM PowerPC iSeries Virtual I/O Infrastructure Support. * * Copyright (c) 2005 Stephen Rothwell, IBM Corp. * * 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. */ #include <linux/types.h> #include <linux/device.h> #include <linux/init.h> #include <asm/vio.h> #include <asm/iommu.h> #include <asm/tce.h> #include <asm/abs_addr.h> #include <asm/page.h> #include <asm/iseries/vio.h> #include <asm/iseries/hv_types.h> #include <asm/iseries/hv_lp_config.h> #include <asm/iseries/hv_call_xm.h> #include "iommu.h" struct device *iSeries_vio_dev = &vio_bus_device.dev; EXPORT_SYMBOL(iSeries_vio_dev); static struct iommu_table veth_iommu_table; static struct iommu_table vio_iommu_table; static void __init iommu_vio_init(void) { iommu_table_getparms_iSeries(255, 0, 0xff, &veth_iommu_table); veth_iommu_table.it_size /= 2; vio_iommu_table = veth_iommu_table; vio_iommu_table.it_offset += veth_iommu_table.it_size; if (!iommu_init_table(&veth_iommu_table)) printk("Virtual Bus VETH TCE table failed.\n"); if (!iommu_init_table(&vio_iommu_table)) printk("Virtual Bus VIO TCE table failed.\n"); } /** * vio_register_device_iseries: - Register a new iSeries vio device. * @voidev: The device to register. */ static struct vio_dev *__init vio_register_device_iseries(char *type, uint32_t unit_num) { struct vio_dev *viodev; /* allocate a vio_dev for this device */ viodev = kmalloc(sizeof(struct vio_dev), GFP_KERNEL); if (!viodev) return NULL; memset(viodev, 0, sizeof(struct vio_dev)); snprintf(viodev->dev.bus_id, BUS_ID_SIZE, "%s%d", type, unit_num); viodev->name = viodev->dev.bus_id; viodev->type = type; viodev->unit_address = unit_num; viodev->iommu_table = &vio_iommu_table; if (vio_register_device(viodev) == NULL) { kfree(viodev); return NULL; } return viodev; } void __init probe_bus_iseries(void) { HvLpIndexMap vlan_map; struct vio_dev *viodev; int i; /* there is only one of each of these */ vio_register_device_iseries("viocons", 0); vio_register_device_iseries("vscsi", 0); vlan_map = HvLpConfig_getVirtualLanIndexMap(); for (i = 0; i < HVMAXARCHITECTEDVIRTUALLANS; i++) { if ((vlan_map & (0x8000 >> i)) == 0) continue; viodev = vio_register_device_iseries("vlan", i); /* veth is special and has it own iommu_table */ viodev->iommu_table = &veth_iommu_table; } for (i = 0; i < HVMAXARCHITECTEDVIRTUALDISKS; i++) vio_register_device_iseries("viodasd", i); for (i = 0; i < HVMAXARCHITECTEDVIRTUALCDROMS; i++) vio_register_device_iseries("viocd", i); for (i = 0; i < HVMAXARCHITECTEDVIRTUALTAPES; i++) vio_register_device_iseries("viotape", i); } /** * vio_match_device_iseries: - Tell if a iSeries VIO device matches a * vio_device_id */ static int vio_match_device_iseries(const struct vio_device_id *id, const struct vio_dev *dev) { return strncmp(dev->type, id->type, strlen(id->type)) == 0; } static struct vio_bus_ops vio_bus_ops_iseries = { .match = vio_match_device_iseries, }; /** * vio_bus_init_iseries: - Initialize the iSeries virtual IO bus */ static int __init vio_bus_init_iseries(void) { int err; err = vio_bus_init(&vio_bus_ops_iseries); if (err == 0) { iommu_vio_init(); vio_bus_device.iommu_table = &vio_iommu_table; iSeries_vio_dev = &vio_bus_device.dev; probe_bus_iseries(); } return err; } __initcall(vio_bus_init_iseries);
/* * tree_reader.h * * Created on: Nov 24, 2009 * Author: smitty */ #ifndef TREE_READER_H_ #define TREE_READER_H_ #include <string> #include <vector> using namespace std; #include "node.h" #include "tree.h" class TreeReader{ public: TreeReader(); Tree * readTree(string trees); }; #endif /* TREE_READER_H_ */
/* $Id: MemDetect.c $ */ /** @file * MemDetect.c */ /* * Copyright (C) 2012 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; * you can redistribute it and/or modify it under the terms of the GNU * General Public License (GPL) as published by the Free Software * Foundation, in version 2 as it comes in the "COPYING" file of the * VirtualBox OSE distribution. VirtualBox OSE is distributed in the * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. * * The contents of this file may alternatively be used under the terms * of the Common Development and Distribution License Version 1.0 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the * VirtualBox OSE distribution, in which case the provisions of the * CDDL are applicable instead of those of the GPL. * * You may elect to license modified versions of this file under the * terms and conditions of either the GPL or the CDDL or both. */ /**@file Memory Detection for Virtual Machines. Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. Module Name: MemDetect.c **/ // // The package level header files this module uses // #include <PiPei.h> // // The Library classes this module consumes // #include <Library/DebugLib.h> #include <Library/HobLib.h> #include <Library/IoLib.h> #include <Library/PcdLib.h> #include <Library/PeimEntryPoint.h> #include <Library/ResourcePublicationLib.h> #include <Library/MtrrLib.h> #include "Platform.h" #include "Cmos.h" STATIC UINTN GetSystemMemorySizeBelow4gb ( ) { UINT8 Cmos0x34; UINT8 Cmos0x35; // // CMOS 0x34/0x35 specifies the system memory above 16 MB. // * CMOS(0x35) is the high byte // * CMOS(0x34) is the low byte // * The size is specified in 64kb chunks // * Since this is memory above 16MB, the 16MB must be added // into the calculation to get the total memory size. // Cmos0x34 = (UINT8) CmosRead8 (0x34); Cmos0x35 = (UINT8) CmosRead8 (0x35); return (((UINTN)((Cmos0x35 << 8) + Cmos0x34) << 16) + SIZE_16MB); } STATIC UINT64 GetSystemMemorySizeAbove4gb ( ) { UINT32 Size; UINTN CmosIndex; // // CMOS 0x5b-0x5d specifies the system memory above 4GB MB. // * CMOS(0x5d) is the most significant size byte // * CMOS(0x5c) is the middle size byte // * CMOS(0x5b) is the least significant size byte // * The size is specified in 64kb chunks // Size = 0; for (CmosIndex = 0x5d; CmosIndex >= 0x5b; CmosIndex--) { Size = (UINT32) (Size << 8) + (UINT32) CmosRead8 (CmosIndex); } return LShiftU64 (Size, 16); } /** Peform Memory Detection @return EFI_SUCCESS The PEIM initialized successfully. **/ EFI_PHYSICAL_ADDRESS MemDetect ( ) { EFI_STATUS Status; EFI_PHYSICAL_ADDRESS MemoryBase; UINT64 MemorySize; UINT64 LowerMemorySize; UINT64 UpperMemorySize; DEBUG ((EFI_D_ERROR, "MemDetect called\n")); // // Determine total memory size available // LowerMemorySize = GetSystemMemorySizeBelow4gb (); UpperMemorySize = GetSystemMemorySizeAbove4gb (); // // Determine the range of memory to use during PEI // MemoryBase = PcdGet32 (PcdOvmfMemFvBase) + PcdGet32 (PcdOvmfMemFvSize); MemorySize = LowerMemorySize - MemoryBase; if (MemorySize > SIZE_64MB) { MemoryBase = LowerMemorySize - SIZE_64MB; MemorySize = SIZE_64MB; } MemorySize -= BASE_64KB; /* Reserves 64KB for ACPI tables. */ // // Publish this memory to the PEI Core // Status = PublishSystemMemory(MemoryBase, MemorySize); ASSERT_EFI_ERROR (Status); // // Create memory HOBs // AddMemoryBaseSizeHob (MemoryBase, MemorySize); AddMemoryRangeHob (BASE_1MB, MemoryBase); MtrrSetMemoryAttribute (BASE_1MB, MemoryBase + MemorySize - BASE_1MB, CacheWriteBack); AddMemoryRangeHob (0, BASE_512KB + BASE_128KB); MtrrSetMemoryAttribute (0, BASE_512KB + BASE_128KB, CacheWriteBack); if (UpperMemorySize != 0) { AddUntestedMemoryBaseSizeHob (BASE_4GB, UpperMemorySize); MtrrSetMemoryAttribute (BASE_4GB, UpperMemorySize, CacheWriteBack); } return MemoryBase + MemorySize; }
/* This file is part of the KDE project Copyright (C) 2006 Jarosław Staniek <staniek@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KEXI_LLONGVALIDATOR_H #define KEXI_LLONGVALIDATOR_H #include "kexiutils_export.h" #include <qvalidator.h> class QWidget; namespace KexiUtils { //! @short A validator for longlong data type. /*! This can be used by QLineEdit or subclass to provide validated text entry. Can be provided with a base value (default is 10), to allow the proper entry of hexadecimal, octal, or any other base numeric data. Based on KIntValidator code by Glen Parker <glenebob@nwlink.com> */ class KEXIUTILS_EXPORT LongLongValidator : public QValidator { public: LongLongValidator(QWidget * parent, int base = 10); LongLongValidator(qint64 bottom, qint64 top, QWidget * parent, int base = 10); virtual ~LongLongValidator(); //! Validates the text, and returns the result. Does not modify the parameters. virtual State validate(QString &, int &) const; //! Fixes the text if possible, providing a valid string. The parameter may be modified. virtual void fixup(QString &) const; //! Sets the minimum and maximum values allowed. virtual void setRange(qint64 bottom, qint64 top); //! Sets the numeric base value. virtual void setBase(int base); //! \return the current minimum value allowed virtual qint64 bottom() const; //! \return the current maximum value allowed virtual qint64 top() const; //! \return the current numeric base virtual int base() const; private: qint64 m_base; qint64 m_min; qint64 m_max; }; } #endif
#include <Var7b.d> #include <__oo2c.h> #include <setjmp.h> static OOC_INT16 Var7b__Len(const OOC_CHAR8 str__ref[], OOC_LEN str_0d) { register OOC_INT32 i0,i1; OOC_ALLOCATE_VPAR(str,OOC_CHAR8 ,str_0d) OOC_INITIALIZE_VPAR(str__ref,str,OOC_CHAR8 ,str_0d) i0=(-1); l1_loop: i0 = i0+1; Var7b__i = i0; i1 = *(OOC_UINT8*)((OOC_INT32)str+(_check_index(i0, str_0d, OOC_UINT16, 187))); i1 = i1==0u; if (!i1) goto l1_loop; l5: return i0; ; } void Var7b__Test(void) { register OOC_INT32 i0; i0 = Var7b__Len((OOC_CHAR8*)"", 1); Out0__Int(i0, 0); Out0__Ln(); i0 = Var7b__Len((OOC_CHAR8*)"abc", 4); Out0__Int(i0, 0); Out0__Ln(); return; ; } void OOC_Var7b_init(void) { return; ; } void OOC_Var7b_destroy(void) { } /* --- */
/* * Copyright (C) 2007-2013 Intel Corporation. All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * - Neither the name of Intel Corporation nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "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 INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef MFX_MFXPLUGIN_H #define MFX_MFXPLUGIN_H #include "mfxvideo.h" #pragma warning(disable: 4201) #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ typedef enum { MFX_THREADPOLICY_SERIAL = 0, MFX_THREADPOLICY_PARALLEL = 1 } mfxThreadPolicy; typedef struct mfxPluginParam { mfxU32 reserved[14]; mfxThreadPolicy ThreadPolicy; mfxU32 MaxThreadNum; } mfxPluginParam; typedef struct mfxCoreParam{ mfxU32 reserved[13]; mfxIMPL Impl; mfxVersion Version; mfxU32 NumWorkingThread; } mfxCoreParam; typedef struct mfxCoreInterface { mfxHDL pthis; mfxHDL reserved1[2]; mfxFrameAllocator FrameAllocator; mfxBufferAllocator reserved3; mfxStatus (MFX_CDECL *GetCoreParam)(mfxHDL pthis, mfxCoreParam *par); mfxStatus (MFX_CDECL *GetHandle) (mfxHDL pthis, mfxHandleType type, mfxHDL *handle); mfxStatus (MFX_CDECL *IncreaseReference) (mfxHDL pthis, mfxFrameData *fd); mfxStatus (MFX_CDECL *DecreaseReference) (mfxHDL pthis, mfxFrameData *fd); mfxStatus (MFX_CDECL *CopyFrame) (mfxHDL pthis, mfxFrameSurface1 *dst, mfxFrameSurface1 *src); mfxStatus (MFX_CDECL *CopyBuffer)(mfxHDL pthis, mfxU8 *dst, mfxU32 size, mfxFrameSurface1 *src); mfxStatus (MFX_CDECL *MapOpaqueSurface)(mfxHDL pthis, mfxU32 num, mfxU32 type, mfxFrameSurface1 **op_surf); mfxStatus (MFX_CDECL *UnmapOpaqueSurface)(mfxHDL pthis, mfxU32 num, mfxU32 type, mfxFrameSurface1 **op_surf); mfxStatus (MFX_CDECL *GetRealSurface)(mfxHDL pthis, mfxFrameSurface1 *op_surf, mfxFrameSurface1 **surf); mfxStatus (MFX_CDECL *GetOpaqueSurface)(mfxHDL pthis, mfxFrameSurface1 *surf, mfxFrameSurface1 **op_surf); mfxHDL reserved4[4]; } mfxCoreInterface; typedef struct mfxPlugin{ mfxHDL pthis; mfxStatus (MFX_CDECL *PluginInit) (mfxHDL pthis, mfxCoreInterface *core); mfxStatus (MFX_CDECL *PluginClose) (mfxHDL pthis); mfxStatus (MFX_CDECL *GetPluginParam)(mfxHDL pthis, mfxPluginParam *par); mfxStatus (MFX_CDECL *Submit)(mfxHDL pthis, const mfxHDL *in, mfxU32 in_num, const mfxHDL *out, mfxU32 out_num, mfxThreadTask *task); mfxStatus (MFX_CDECL *Execute)(mfxHDL pthis, mfxThreadTask task, mfxU32 uid_p, mfxU32 uid_a); mfxStatus (MFX_CDECL *FreeResources)(mfxHDL pthis, mfxThreadTask task, mfxStatus sts); mfxHDL reserved[9]; } mfxPlugin; mfxStatus MFX_CDECL MFXVideoUSER_Register(mfxSession session, mfxU32 type, const mfxPlugin *par); mfxStatus MFX_CDECL MFXVideoUSER_Unregister(mfxSession session, mfxU32 type); mfxStatus MFX_CDECL MFXVideoUSER_ProcessFrameAsync(mfxSession session, const mfxHDL *in, mfxU32 in_num, const mfxHDL *out, mfxU32 out_num, mfxSyncPoint *syncp); #ifdef __cplusplus } // extern "C" #endif /* __cplusplus */ #endif /* MFX_MFXPLUGIN_H */
/****************************************************************************** * * Copyright(c) 2009-2010 Realtek Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * The full GNU General Public License is included in this distribution in the * file called LICENSE. * * Contact Information: * wlanfae <wlanfae@realtek.com> * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, * Hsinchu 300, Taiwan. * * Larry Finger <Larry.Finger@lwfinger.net> * *****************************************************************************/ #ifndef __REALTEK_RTL_PCI_PS_H__ #define __REALTEK_RTL_PCI_PS_H__ #define MAX_SW_LPS_SLEEP_INTV 5 bool rtl_ps_set_rf_state(struct ieee80211_hw *hw, enum rf_pwrstate state_toset, u32 changesource, bool protect_or_not); bool rtl_ps_enable_nic(struct ieee80211_hw *hw); bool rtl_ps_disable_nic(struct ieee80211_hw *hw); void rtl_ips_nic_off(struct ieee80211_hw *hw); void rtl_ips_nic_on(struct ieee80211_hw *hw); void rtl_ips_nic_off_wq_callback(void *data); extern void rtl_lps_enter(struct ieee80211_hw *hw); extern void rtl_lps_leave(struct ieee80211_hw *hw); void rtl_lps_set_psmode(struct ieee80211_hw *hw, u8 rt_psmode); void rtl_swlps_beacon(struct ieee80211_hw *hw, void *data, unsigned int len); void rtl_swlps_wq_callback(void *data); void rtl_swlps_rfon_wq_callback(void *data); void rtl_swlps_rf_awake(struct ieee80211_hw *hw); void rtl_swlps_rf_sleep(struct ieee80211_hw *hw); void rtl_p2p_ps_cmd(struct ieee80211_hw *hw,u8 p2p_ps_state); void rtl_p2p_info(struct ieee80211_hw *hw, void *data, unsigned int len); #endif
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- * * Copyright (C) 2008-2009 Richard Hughes <richard@hughsie.com> * * Licensed under the GNU General Public License Version 2 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef GPK_CELL_RENDERER_SIZE_H #define GPK_CELL_RENDERER_SIZE_H #include <glib-object.h> #include <gtk/gtk.h> #define GPK_TYPE_CELL_RENDERER_SIZE (gpk_cell_renderer_size_get_type()) #define GPK_CELL_RENDERER_SIZE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GPK_TYPE_CELL_RENDERER_SIZE, GpkCellRendererSize)) #define GPK_CELL_RENDERER_SIZE_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST((cls), GPK_TYPE_CELL_RENDERER_SIZE, GpkCellRendererSizeClass)) #define GPK_IS_CELL_RENDERER_SIZE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GPK_TYPE_CELL_RENDERER_SIZE)) #define GPK_IS_CELL_RENDERER_SIZE_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE((cls), GPK_TYPE_CELL_RENDERER_SIZE)) #define GPK_CELL_RENDERER_SIZE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GPK_TYPE_CELL_RENDERER_SIZE, GpkCellRendererSizeClass)) G_BEGIN_DECLS typedef struct _GpkCellRendererSize GpkCellRendererSize; typedef struct _GpkCellRendererSizeClass GpkCellRendererSizeClass; struct _GpkCellRendererSize { GtkCellRendererText parent; guint value; gchar *markup; }; struct _GpkCellRendererSizeClass { GtkCellRendererTextClass parent_class; }; GType gpk_cell_renderer_size_get_type (void); GtkCellRenderer *gpk_cell_renderer_size_new (void); G_END_DECLS #endif /* GPK_CELL_RENDERER_SIZE_H */
/* * Linux INET6 implementation * * Authors: * Pedro Roque <roque@di.fc.ul.pt> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef _IP6_FIB_H #define _IP6_FIB_H #ifdef __KERNEL__ #include <linux/ipv6_route.h> #include <net/dst.h> #include <net/flow.h> #include <linux/rtnetlink.h> struct rt6_info; struct fib6_node { struct fib6_node *parent; struct fib6_node *left; struct fib6_node *right; struct fib6_node *subtree; struct rt6_info *leaf; __u16 fn_bit; /* bit key */ __u16 fn_flags; __u32 fn_sernum; }; /* * routing information * */ struct rt6key { struct in6_addr addr; int plen; }; struct rt6_info { union { struct dst_entry dst; struct rt6_info *next; } u; #define rt6i_dev u.dst.dev #define rt6i_nexthop u.dst.neighbour #define rt6i_expires u.dst.expires struct fib6_node *rt6i_node; struct in6_addr rt6i_gateway; u32 rt6i_flags; u32 rt6i_metric; u8 rt6i_hoplimit; atomic_t rt6i_ref; union { struct flow_rule *rt6iu_flowr; struct flow_filter *rt6iu_filter; } flow_u; #define rt6i_flowr flow_u.rt6iu_flowr #define rt6i_filter flow_u.rt6iu_filter struct rt6key rt6i_dst; struct rt6key rt6i_src; }; struct fib6_walker_t { struct fib6_walker_t *prev, *next; struct fib6_node *root, *node; struct rt6_info *leaf; unsigned char state; unsigned char prune; int (*func)(struct fib6_walker_t *); void *args; }; extern struct fib6_walker_t fib6_walker_list; static __inline__ void fib6_walker_link(struct fib6_walker_t *w) { w->next = fib6_walker_list.next; w->prev = &fib6_walker_list; w->next->prev = w; w->prev->next = w; } static __inline__ void fib6_walker_unlink(struct fib6_walker_t *w) { w->next->prev = w->prev; w->prev->next = w->next; w->prev = w->next = w; } struct rt6_statistics { __u32 fib_nodes; __u32 fib_route_nodes; __u32 fib_rt_alloc; /* permanet routes */ __u32 fib_rt_entries; /* rt entries in table */ __u32 fib_rt_cache; /* cache routes */ }; #define RTN_TL_ROOT 0x0001 #define RTN_ROOT 0x0002 /* tree root node */ #define RTN_RTINFO 0x0004 /* node with valid routing info */ /* * priority levels (or metrics) * */ #define RTPRI_FIREWALL 8 /* Firewall control information */ #define RTPRI_FLOW 16 /* Flow based forwarding rules */ #define RTPRI_KERN_CTL 32 /* Kernel control routes */ #define RTPRI_USER_MIN 256 /* Mimimum user priority */ #define RTPRI_USER_MAX 1024 /* Maximum user priority */ #define RTPRI_KERN_DFLT 4096 /* Kernel default routes */ #define MAX_FLOW_BACKTRACE 32 typedef void (*f_pnode)(struct fib6_node *fn, void *); extern struct fib6_node ip6_routing_table; /* * exported functions */ extern struct fib6_node *fib6_lookup(struct fib6_node *root, struct in6_addr *daddr, struct in6_addr *saddr); struct fib6_node *fib6_locate(struct fib6_node *root, struct in6_addr *daddr, int dst_len, struct in6_addr *saddr, int src_len); extern void fib6_clean_tree(struct fib6_node *root, int (*func)(struct rt6_info *, void *arg), int prune, void *arg); extern int fib6_walk(struct fib6_walker_t *w); extern int fib6_walk_continue(struct fib6_walker_t *w); extern int fib6_add(struct fib6_node *root, struct rt6_info *rt); extern int fib6_del(struct rt6_info *rt); extern void inet6_rt_notify(int event, struct rt6_info *rt); extern void fib6_run_gc(unsigned long dummy); extern void fib6_gc_cleanup(void); #endif #endif
/* * idle-task scheduling class. * * (NOTE: these are not related to SCHED_IDLE tasks which are * handled in sched_fair.c) */ #ifdef CONFIG_SMP static int select_task_rq_idle(struct task_struct *p, int sd_flag, int flags) { return task_cpu(p); /* IDLE tasks as never migrated */ } #endif /* CONFIG_SMP */ /* * Idle tasks are unconditionally rescheduled: */ static void check_preempt_curr_idle(struct rq *rq, struct task_struct *p, int flags) { resched_task(rq->idle); } static struct task_struct *pick_next_task_idle(struct rq *rq) { schedstat_inc(rq, sched_goidle); calc_load_account_idle(rq); reset_first_second_pick_cpu(cpu_of(rq)); return rq->idle; } /* * It is not legal to sleep in the idle task - print a warning * message if some code attempts to do it: */ static void dequeue_task_idle(struct rq *rq, struct task_struct *p, int flags) { raw_spin_unlock_irq(&rq->lock); printk(KERN_ERR "bad: scheduling from the idle thread!\n"); dump_stack(); raw_spin_lock_irq(&rq->lock); } static void put_prev_task_idle(struct rq *rq, struct task_struct *prev) { } static void task_tick_idle(struct rq *rq, struct task_struct *curr, int queued) { } static void set_curr_task_idle(struct rq *rq) { } static void switched_to_idle(struct rq *rq, struct task_struct *p) { BUG(); } static void prio_changed_idle(struct rq *rq, struct task_struct *p, int oldprio) { BUG(); } static unsigned int get_rr_interval_idle(struct rq *rq, struct task_struct *task) { return 0; } /* * Simple, special scheduling class for the per-CPU idle tasks: */ static const struct sched_class idle_sched_class = { /* .next is NULL */ /* no enqueue/yield_task for idle tasks */ /* dequeue is not valid, we print a debug message there: */ .dequeue_task = dequeue_task_idle, .check_preempt_curr = check_preempt_curr_idle, .pick_next_task = pick_next_task_idle, .put_prev_task = put_prev_task_idle, #ifdef CONFIG_SMP .select_task_rq = select_task_rq_idle, #endif .set_curr_task = set_curr_task_idle, .task_tick = task_tick_idle, .get_rr_interval = get_rr_interval_idle, .prio_changed = prio_changed_idle, .switched_to = switched_to_idle, };
/* This file is based on: $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/util/AsmMacros.h,v 1.1 2001/11/16 21:13:34 tsi Exp $ Modified for readability by Nick Kurshev */ /* * (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org> * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Except as contained in this notice, the name of David Wexelblat shall not be * used in advertising or otherwise to promote the sale, use or other dealings * in this Software without prior written authorization from David Wexelblat. */ /* * Copyright 1997 * Digital Equipment Corporation. All rights reserved. * This software is furnished under license and may be used and copied only in * accordance with the following terms and conditions. Subject to these * conditions, you may download, copy, install, use, modify and distribute * this software in source and/or binary form. No title or ownership is * transferred hereby. * * 1) Any source code used, modified or distributed must reproduce and retain * this copyright notice and list of conditions as they appear in the source * file. * * 2) No right is granted to use any trade name, trademark, or logo of Digital * Equipment Corporation. Neither the "Digital Equipment Corporation" name * nor any trademark or logo of Digital Equipment Corporation may be used * to endorse or promote products derived from this software without the * prior written permission of Digital Equipment Corporation. * * 3) This software is provided "AS-IS" and any express or implied warranties, * including but not limited to, any implied warranties of merchantability, * fitness for a particular purpose, or non-infringement are disclaimed. In * no event shall DIGITAL be liable for any damages whatsoever, and in * particular, DIGITAL shall not be liable for special, indirect, * consequential, or incidental damages or damages for * lost profits, loss of revenue or loss of use, whether such damages arise * in contract, * negligence, tort, under statute, in equity, at law or otherwise, even if * advised of the possibility of such damage. */ #ifndef MPLAYER_ASMMACROS_ALPHA_H #define MPLAYER_ASMMACROS_ALPHA_H #if defined (__linux__) #include <sys/io.h> #elif defined (__FreeBSD__) #include <sys/types.h> void outb(u_int32_t port, u_int8_t val); void outw(u_int32_t port, u_int16_t val); void outl(u_int32_t port, u_int32_t val); u_int8_t inb(u_int32_t port); u_int16_t inw(u_int32_t port); u_int32_t inl(u_int32_t port); #else #error This stuff is not ported on your system #endif #define intr_disable() #define intr_enable() #endif /* MPLAYER_ASMMACROS_ALPHA_H */
/* * Copyright (C) 2003, 2006, 2010, 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 Language_h #define Language_h #include <wtf/Forward.h> #include <wtf/Vector.h> namespace WebCore { WEBCORE_EXPORT String defaultLanguage(); WEBCORE_EXPORT Vector<String> userPreferredLanguages(); Vector<String> userPreferredLanguagesOverride(); WEBCORE_EXPORT void overrideUserPreferredLanguages(const Vector<String>&); size_t indexOfBestMatchingLanguageInList(const String& language, const Vector<String>& languageList, bool& exactMatch); // The observer function will be called when system language changes. typedef void (*LanguageChangeObserverFunction)(void* context); WEBCORE_EXPORT void addLanguageChangeObserver(void* context, LanguageChangeObserverFunction); WEBCORE_EXPORT void removeLanguageChangeObserver(void* context); Vector<String> platformUserPreferredLanguages(); String displayNameForLanguageLocale(const String&); // Called from platform specific code when the user's preferred language(s) change. WEBCORE_EXPORT void languageDidChange(); } #endif
// // PBGitSidebar.h // GitX // // Created by Pieter de Bie on 9/8/09. // Copyright 2009 __MyCompanyName__. All rights reserved. // #import <Cocoa/Cocoa.h> #import "PBViewController.h" #import "PBHistorySearchMode.h" @class PBSourceViewItem; @class PBGitHistoryController; @class PBGitCommitController; NS_ASSUME_NONNULL_BEGIN @interface PBGitSidebarController : PBViewController - (void)selectStage; - (void)selectCurrentBranch; - (NSMenu *)menuForRow:(NSInteger)row; - (void)menuNeedsUpdate:(NSMenu *)menu; - (IBAction)fetchPullPushAction:(id)sender; @property (readonly) NSMutableArray *items; @property (readonly) PBSourceViewItem *remotes; @property (readonly) NSOutlineView *sourceView; @property (readonly) NSView *sourceListControlsView; @end NS_ASSUME_NONNULL_END
/* ScummVM - Graphic Adventure Engine * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT * file distributed with this source distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ #ifndef AGS_ENGINE_MAIN_GAMEFILE_H #define AGS_ENGINE_MAIN_GAMEFILE_H #include "ags/shared/util/error.h" #include "ags/shared/util/string.h" namespace AGS3 { using AGS::Shared::HError; // Preload particular game-describing parameters from the game data header (title, save game dir name, etc) HError preload_game_data(); // Loads game data and reinitializes the game state; assigns error message in case of failure HError load_game_file(); void display_game_file_error(HError err); } // namespace AGS3 #endif
/** * Copyright (c) 2019 Anup Patel. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * @file uart8250.h * @author Anup Patel (anup@brainfault.org) * @brief Header file for UART 8250 serial port driver. */ #ifndef __UART8250_H_ #define __UART8250_H_ #include <arch_types.h> bool uart8250_can_getc(virtual_addr_t base, u32 reg_shift, u32 reg_width); char uart8250_getc(virtual_addr_t base, u32 reg_shift, u32 reg_width); void uart8250_putc(virtual_addr_t base, u32 reg_shift, u32 reg_width, char ch); void uart8250_init(virtual_addr_t base, u32 reg_shift, u32 reg_width, u32 baudrate, u32 input_clock); #endif /* __UART8250_H_ */
/* * Copyright (C) 2010 Enrico Zini <enrico@enricozini.org> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <wibble/net/http.h> #include <wibble/test.h> #include <sstream> #include <iostream> namespace { using namespace std; using namespace wibble; struct TestHTTP { Test boilerplate() { // TODO: implement real test assert(true); } }; } // vim:set ts=4 sw=4:
/*- * Copyright (c) 2003-2007 Tim Kientzle * 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(S) ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR(S) 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 "archive_platform.h" __FBSDID("$FreeBSD: src/lib/libarchive/archive_write_open_filename.c,v 1.20 2008/02/19 05:46:58 kientzle Exp $"); #ifdef HAVE_SYS_STAT_H #include <sys/stat.h> #endif #ifdef HAVE_ERRNO_H #include <errno.h> #endif #ifdef HAVE_FCNTL_H #include <fcntl.h> #endif #ifdef HAVE_STDLIB_H #include <stdlib.h> #endif #ifdef HAVE_STRING_H #include <string.h> #endif #ifdef HAVE_UNISTD_H #include <unistd.h> #endif #include "archive.h" #ifndef O_BINARY #define O_BINARY 0 #endif struct write_file_data { int fd; char filename[1]; }; static int file_close(struct archive *, void *); static int file_open(struct archive *, void *); static ssize_t file_write(struct archive *, void *, const void *buff, size_t); int archive_write_open_file(struct archive *a, const char *filename) { return (archive_write_open_filename(a, filename)); } int archive_write_open_filename(struct archive *a, const char *filename) { struct write_file_data *mine; if (filename == NULL || filename[0] == '\0') return (archive_write_open_fd(a, 1)); mine = (struct write_file_data *)malloc(sizeof(*mine) + strlen(filename)); if (mine == NULL) { archive_set_error(a, ENOMEM, "No memory"); return (ARCHIVE_FATAL); } strcpy(mine->filename, filename); mine->fd = -1; return (archive_write_open(a, mine, file_open, file_write, file_close)); } static int file_open(struct archive *a, void *client_data) { int flags; struct write_file_data *mine; struct stat st; mine = (struct write_file_data *)client_data; flags = O_WRONLY | O_CREAT | O_TRUNC | O_BINARY; /* * Open the file. */ mine->fd = open(mine->filename, flags, 0666); if (mine->fd < 0) { archive_set_error(a, errno, "Failed to open '%s'", mine->filename); return (ARCHIVE_FATAL); } if (fstat(mine->fd, &st) != 0) { archive_set_error(a, errno, "Couldn't stat '%s'", mine->filename); return (ARCHIVE_FATAL); } /* * Set up default last block handling. */ if (archive_write_get_bytes_in_last_block(a) < 0) { if (S_ISCHR(st.st_mode) || S_ISBLK(st.st_mode) || S_ISFIFO(st.st_mode)) /* Pad last block when writing to device or FIFO. */ archive_write_set_bytes_in_last_block(a, 0); else /* Don't pad last block otherwise. */ archive_write_set_bytes_in_last_block(a, 1); } /* * If the output file is a regular file, don't add it to * itself. If it's a device file, it's okay to add the device * entry to the output archive. */ if (S_ISREG(st.st_mode)) archive_write_set_skip_file(a, st.st_dev, st.st_ino); return (ARCHIVE_OK); } static ssize_t file_write(struct archive *a, void *client_data, const void *buff, size_t length) { struct write_file_data *mine; ssize_t bytesWritten; mine = (struct write_file_data *)client_data; bytesWritten = write(mine->fd, buff, length); if (bytesWritten <= 0) { archive_set_error(a, errno, "Write error"); return (-1); } return (bytesWritten); } static int file_close(struct archive *a, void *client_data) { struct write_file_data *mine = (struct write_file_data *)client_data; (void)a; /* UNUSED */ close(mine->fd); free(mine); return (ARCHIVE_OK); }
#include "../../../src/renderingcontrol/hrenderingcontrol_adapter.h"
/* * A fast, small, non-recursive O(nlog n) sort for the Linux kernel * * Jan 23 2005 Matt Mackall <mpm@selenic.com> */ #include <linux/kernel.h> #include <linux/module.h> #include <linux/sort.h> #include <linux/slab.h> static void u32_swap(void *a, void *b, int size) { u32 t = *(u32 *)a; *(u32 *)a = *(u32 *)b; *(u32 *)b = t; } static void generic_swap(void *a, void *b, int size) { char t; do { t = *(char *)a; *(char *)a++ = *(char *)b; *(char *)b++ = t; } while (--size > 0); } /** * sort - sort an array of elements * @base: pointer to data to sort * @num: number of elements * @size: size of each element * @cmp_func: pointer to comparison function * @swap_func: pointer to swap function or NULL * * This function does a heapsort on the given array. You may provide a * swap_func function optimized to your element type. * * Sorting time is O(n log n) both on average and worst-case. While * qsort is about 20% faster on average, it suffers from exploitable * O(n*n) worst-case behavior and extra memory requirements that make * it less suitable for kernel use. */ // ARM10C 20131019 // sort(&meminfo.bank, meminfo.nr_banks, sizeof(meminfo.bank[0]), meminfo_cmp, NULL); void sort(void *base, size_t num, size_t size, int (*cmp_func)(const void *, const void *), void (*swap_func)(void *, void *, int size)) { /* pre-scale counters for performance */ int i = (num/2 - 1) * size, n = num * size, c, r; if (!swap_func) swap_func = (size == 4 ? u32_swap : generic_swap); /* heapify */ for ( ; i >= 0; i -= size) { for (r = i; r * 2 + size < n; r = c) { c = r * 2 + size; if (c < n - size && cmp_func(base + c, base + c + size) < 0) c += size; if (cmp_func(base + r, base + c) >= 0) break; swap_func(base + r, base + c, size); } } /* sort */ for (i = n - size; i > 0; i -= size) { swap_func(base, base + i, size); for (r = 0; r * 2 + size < i; r = c) { c = r * 2 + size; if (c < i - size && cmp_func(base + c, base + c + size) < 0) c += size; if (cmp_func(base + r, base + c) >= 0) break; swap_func(base + r, base + c, size); } } } EXPORT_SYMBOL(sort); #if 0 /* a simple boot-time regression test */ int cmpint(const void *a, const void *b) { return *(int *)a - *(int *)b; } static int sort_test(void) { int *a, i, r = 1; a = kmalloc(1000 * sizeof(int), GFP_KERNEL); BUG_ON(!a); printk("testing sort()\n"); for (i = 0; i < 1000; i++) { r = (r * 725861) % 6599; a[i] = r; } sort(a, 1000, sizeof(int), cmpint, NULL); for (i = 0; i < 999; i++) if (a[i] > a[i+1]) { printk("sort() failed!\n"); break; } kfree(a); return 0; } module_init(sort_test); #endif
#include <stdint.h> #include <device/pci_def.h> #include <arch/io.h> #include <device/pnp_def.h> #include <arch/romcc_io.h> #include <cpu/x86/lapic.h> #include <stdlib.h> #include <console/console.h> #include "southbridge/intel/i82801ex/early_smbus.c" #include "northbridge/intel/e7520/raminit.h" #include "superio/winbond/w83627hf/w83627hf.h" #include "cpu/x86/lapic/boot_cpu.c" #include "cpu/x86/mtrr/earlymtrr.c" #include "debug.c" #include "watchdog.c" #include "reset.c" #include "superio/winbond/w83627hf/early_serial.c" #include "northbridge/intel/e7520/memory_initialized.c" #include "cpu/x86/bist.h" #include <spd.h> #define CONSOLE_SERIAL_DEV PNP_DEV(0x2e, W83627HF_SP1) #define HIDDEN_SERIAL_DEV PNP_DEV(0x2e, W83627HF_SP2) #define DUMMY_DEV PNP_DEV(0x2e, 0) #define DEVPRES_CONFIG ( \ DEVPRES_D0F0 | \ DEVPRES_D1F0 | \ DEVPRES_D2F0 | \ DEVPRES_D3F0 | \ DEVPRES_D4F0 | \ DEVPRES_D6F0 | \ 0 ) #define DEVPRES1_CONFIG (DEVPRES1_D0F1 | DEVPRES1_D8F0) static void mch_reset(void) {} static void mainboard_set_e7520_pll(unsigned bits) {} static void mainboard_set_e7520_leds(void) {} static inline int spd_read_byte(unsigned device, unsigned address) { return smbus_read_byte(device, address); } #include "northbridge/intel/e7520/raminit.c" #include "lib/generic_sdram.c" #include "arch/x86/lib/stages.c" static void main(unsigned long bist) { static const struct mem_controller mch[] = { { .node_id = 0, .channel0 = {DIMM3, DIMM2, DIMM1, DIMM0, }, .channel1 = {DIMM7, DIMM6, DIMM5, DIMM4, }, } }; if (bist == 0) { /* Skip this if there was a built in self test failure */ early_mtrr_init(); if (memory_initialized()) skip_romstage(); } w83627hf_set_clksel_48(DUMMY_DEV); w83627hf_enable_serial(CONSOLE_SERIAL_DEV, CONFIG_TTYS0_BASE); uart_init(); console_init(); /* Halt if there was a built in self test failure */ // report_bist_failure(bist); /* MOVE ME TO A BETTER LOCATION !!! */ /* config LPC decode for flash memory access */ device_t dev; dev = pci_locate_device(PCI_ID(0x8086, 0x24d0), 0); if (dev == PCI_DEV_INVALID) die("Missing ich5?"); pci_write_config32(dev, 0xe8, 0x00000000); pci_write_config8(dev, 0xf0, 0x00); #if 0 display_cpuid_update_microcode(); print_pci_devices(); #endif #if 1 enable_smbus(); #endif #if 0 // dump_spd_registers(&cpu[0]); int i; for(i = 0; i < 1; i++) dump_spd_registers(); #endif disable_watchdogs(); // dump_ipmi_registers(); mainboard_set_e7520_leds(); sdram_initialize(ARRAY_SIZE(mch), mch); #if 0 dump_pci_devices(); dump_pci_device(PCI_DEV(0, 0x00, 0)); dump_bar14(PCI_DEV(0, 0x00, 0)); #endif }
/* $Id$ * psr.h: This file holds the macros for masking off various parts of * the processor status register on the Sparc. This is valid * for Version 8. On the V9 this is renamed to the PSTATE * register and its members are accessed as fields like * PSTATE.PRIV for the current CPU privilege level. * * Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu) */ #ifndef __LINUX_SPARC_PSR_H #define __LINUX_SPARC_PSR_H /* The Sparc PSR fields are laid out as the following: * * ------------------------------------------------------------------------ * | impl | vers | icc | resv | EC | EF | PIL | S | PS | ET | CWP | * | 31-28 | 27-24 | 23-20 | 19-14 | 13 | 12 | 11-8 | 7 | 6 | 5 | 4-0 | * ------------------------------------------------------------------------ */ #define PSR_CWP 0x0000001f /* current window pointer */ #define PSR_ET 0x00000020 /* enable traps field */ #define PSR_PS 0x00000040 /* previous privilege level */ #define PSR_S 0x00000080 /* current privilege level */ #define PSR_PIL 0x00000f00 /* processor interrupt level */ #define PSR_EF 0x00001000 /* enable floating point */ #define PSR_EC 0x00002000 /* enable co-processor */ #define PSR_LE 0x00008000 /* SuperSparcII little-endian */ #define PSR_ICC 0x00f00000 /* integer condition codes */ #define PSR_C 0x00100000 /* carry bit */ #define PSR_V 0x00200000 /* overflow bit */ #define PSR_Z 0x00400000 /* zero bit */ #define PSR_N 0x00800000 /* negative bit */ #define PSR_VERS 0x0f000000 /* cpu-version field */ #define PSR_IMPL 0xf0000000 /* cpu-implementation field */ #ifdef __KERNEL__ #ifndef __ASSEMBLY__ /* Get the %psr register. */ static inline unsigned int get_psr(void) { unsigned int psr; __asm__ __volatile__( "rd %%psr, %0\n\t" "nop\n\t" "nop\n\t" "nop\n\t" : "=r" (psr) : /* no inputs */ : "memory"); return psr; } static inline void put_psr(unsigned int new_psr) { __asm__ __volatile__( "wr %0, 0x0, %%psr\n\t" "nop\n\t" "nop\n\t" "nop\n\t" : /* no outputs */ : "r" (new_psr) : "memory", "cc"); } /* Get the %fsr register. Be careful, make sure the floating point * enable bit is set in the %psr when you execute this or you will * incur a trap. */ extern unsigned int fsr_storage; static inline unsigned int get_fsr(void) { unsigned int fsr = 0; __asm__ __volatile__( "st %%fsr, %1\n\t" "ld %1, %0\n\t" : "=r" (fsr) : "m" (fsr_storage)); return fsr; } #endif /* !(__ASSEMBLY__) */ #endif /* (__KERNEL__) */ #endif /* !(__LINUX_SPARC_PSR_H) */
/* * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms are permitted * provided that the above copyright notice and this paragraph are * duplicated in all such forms and that any documentation, * advertising materials, and other materials related to such * distribution and use acknowledge that the software was developed * by the University of California, Berkeley. The name of the * University may not be used to endorse or promote products derived * from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ /* This code was based on vsprintf.c */ /* doc in vfprintf.c */ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "%W% (Berkeley) %G%"; #endif /* LIBC_SCCS and not lint */ #include <_ansi.h> #include <stdio.h> #include <limits.h> #ifdef _HAVE_STDC #include <stdarg.h> #else #include <varargs.h> #endif #ifndef _REENT_ONLY int _DEFUN(vasprintf, (strp, fmt, ap), char **strp _AND _CONST char *fmt _AND va_list ap) { int ret; FILE f; f._flags = __SWR | __SSTR | __SMBF; f._bf._base = f._p = NULL; f._bf._size = f._w = 0; f._file = -1; /* No file. */ ret = _vfprintf_r (_REENT, &f, fmt, ap); *f._p = 0; *strp = f._bf._base; return ret; } #endif /* !_REENT_ONLY */ int _DEFUN(_vasprintf_r, (ptr, strp, fmt, ap), struct _reent *ptr _AND char **strp _AND _CONST char *fmt _AND va_list ap) { int ret; FILE f; f._flags = __SWR | __SSTR | __SMBF ; f._bf._base = f._p = NULL; f._bf._size = f._w = 0; f._file = -1; /* No file. */ ret = _vfprintf_r (ptr, &f, fmt, ap); *f._p = 0; *strp = f._bf._base; return ret; }
/* * Copyright (C) 2007-2010 Nick Schermer <nick@xfce.org> * * This library 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 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 General Public License for * more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef __CLOCK_LCD_H__ #define __CLOCK_LCD_H__ G_BEGIN_DECLS typedef struct _XfceClockLcdClass XfceClockLcdClass; typedef struct _XfceClockLcd XfceClockLcd; #define XFCE_CLOCK_TYPE_LCD (xfce_clock_lcd_get_type ()) #define XFCE_CLOCK_LCD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XFCE_CLOCK_TYPE_LCD, XfceClockLcd)) #define XFCE_CLOCK_LCD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XFCE_CLOCK_TYPE_LCD, XfceClockLcdClass)) #define XFCE_CLOCK_IS_LCD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XFCE_CLOCK_TYPE_LCD)) #define XFCE_CLOCK_IS_LCD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XFCE_CLOCK_TYPE_LCD)) #define XFCE_CLOCK_LCD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XFCE_CLOCK_TYPE_LCD, XfceClockLcdClass)) GType xfce_clock_lcd_get_type (void) G_GNUC_CONST; void xfce_clock_lcd_register_type (XfcePanelTypeModule *type_module); GtkWidget *xfce_clock_lcd_new (void) G_GNUC_MALLOC; G_END_DECLS #endif /* !__CLOCK_LCD_H__ */
#pragma once #include "DomoticzHardware.h" #include "hardwaretypes.h" class CNefitEasy : public CDomoticzHardwareBase { public: CNefitEasy(const int ID, const std::string &IPAddress, const unsigned short usIPPort); ~CNefitEasy(void); bool WriteToHardware(const char *pdata, const unsigned char length) override; void SetSetpoint(const int idx, const float temp); private: void Init(); bool StartHardware() override; bool StopHardware() override; void Do_Work(); bool GetStatusDetails(); bool GetOutdoorTemp(); bool GetFlowTemp(); bool GetPressure(); bool GetDisplayCode(); bool GetGasUsage(); void SetUserMode(bool bSetUserModeClock); void SetHotWaterMode(bool bTurnOn); private: std::string m_AccessKey; std::string m_SerialNumber; std::string m_Password; std::string m_ConnectionPassword; std::string m_jid; std::string m_from; std::string m_to; std::string m_szIPAddress; unsigned short m_usIPPort; std::string m_LastDisplayCode; std::string m_LastBoilerStatus; bool m_bClockMode; volatile bool m_stoprequested; std::shared_ptr<std::thread> m_thread; uint32_t m_lastgasusage; P1Gas m_p1gas; };
/****************************************************************************** * Spine Runtimes Software License v2.5 * * Copyright (c) 2013-2016, Esoteric Software * All rights reserved. * * You are granted a perpetual, non-exclusive, non-sublicensable, and * non-transferable license to use, install, execute, and perform the Spine * Runtimes software and derivative works solely for personal or internal * use. Without the written permission of Esoteric Software (see Section 2 of * the Spine Software License Agreement), you may not (a) modify, translate, * adapt, or develop new applications using the Spine Runtimes or otherwise * create derivative works or improvements of the Spine Runtimes or (b) remove, * delete, alter, or obscure any trademarks or any copyright, trademark, patent, * or other intellectual property or proprietary rights notices on or in the * Software, including any copy thereof. Redistributions in binary or source * form must include this license and terms. * * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "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 ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF * USE, DATA, OR PROFITS) 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 <spine/PathAttachment.h> #include <spine/extension.h> void _spPathAttachment_dispose (spAttachment* attachment) { spPathAttachment* self = SUB_CAST(spPathAttachment, attachment); _spVertexAttachment_deinit(SUPER(self)); FREE(self->lengths); FREE(self); } spPathAttachment* spPathAttachment_create (const char* name) { spPathAttachment* self = NEW(spPathAttachment); _spVertexAttachment_init(SUPER(self)); _spAttachment_init(SUPER(SUPER(self)), name, SP_ATTACHMENT_PATH, _spPathAttachment_dispose); return self; }
/* Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of version 2.1 of the GNU Lesser General Public License as published by the Free Software Foundation. This program is distributed in the hope that it would be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Further, this software is distributed without any warranty that it is free of the rightful claim of any third person regarding infringement or the like. Any license provided herein, whether implied or otherwise, applies only to this software file. Patent licenses, if any, provided herein do not apply to combinations of this program with other software, or any other product whatsoever. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, Mountain View, CA 94043, or: http://www.sgi.com For further information regarding this notice, see: http://oss.sgi.com/projects/GenInfo/NoticeExplan */ /* USMID @(#) libu/ffio/vms_def.h 92.0 10/08/98 14:57:41 */ /* These are definitions for the record formats and subtypes allowed */ /* with assign -F vms. They are used in vms_parse.h */ #define VMS_F 1 #define VMS_V 2 #define VMS_S 3 #define VMS_BB 4 #define VMS_TAPE 5 #define VMS_TR 6 #define VMS_DSK 7 #define VMS_NONL 8
;/* ; * FreeRTOS Kernel V10.0.1 ; * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. ; * ; * Permission is hereby granted, free of charge, to any person obtaining a copy of ; * this software and associated documentation files (the "Software"), to deal in ; * the Software without restriction, including without limitation the rights to ; * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of ; * the Software, and to permit persons to whom the Software is furnished to do so, ; * subject to the following conditions: ; * ; * The above copyright notice and this permission notice shall be included in all ; * copies or substantial portions of the Software. ; * ; * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ; * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS ; * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR ; * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER ; * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN ; * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ; * ; * http://www.FreeRTOS.org ; * http://aws.amazon.com/freertos ; * ; * 1 tab == 4 spaces! ; */ #include "FreeRTOSConfig.h" ; Variables used by scheduler ;------------------------------------------------------------------------------ EXTERN pxCurrentTCB EXTERN usCriticalNesting ;------------------------------------------------------------------------------ ; portSAVE_CONTEXT MACRO ; Saves the context of the general purpose registers, CS and ES (only in far ; memory mode) registers the usCriticalNesting Value and the Stack Pointer ; of the active Task onto the task stack ;------------------------------------------------------------------------------ portSAVE_CONTEXT MACRO PUSH AX ; Save AX Register to stack. PUSH HL MOV A, CS ; Save CS register. XCH A, X MOV A, ES ; Save ES register. PUSH AX PUSH DE ; Save the remaining general purpose registers. PUSH BC MOVW AX, usCriticalNesting ; Save the usCriticalNesting value. PUSH AX MOVW AX, pxCurrentTCB ; Save the Stack pointer. MOVW HL, AX MOVW AX, SP MOVW [HL], AX ENDM ;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------ ; portRESTORE_CONTEXT MACRO ; Restores the task Stack Pointer then use this to restore usCriticalNesting, ; general purpose registers and the CS and ES (only in far memory mode) ; of the selected task from the task stack ;------------------------------------------------------------------------------ portRESTORE_CONTEXT MACRO MOVW AX, pxCurrentTCB ; Restore the Stack pointer. MOVW HL, AX MOVW AX, [HL] MOVW SP, AX POP AX ; Restore usCriticalNesting value. MOVW usCriticalNesting, AX POP BC ; Restore the necessary general purpose registers. POP DE POP AX ; Restore the ES register. MOV ES, A XCH A, X ; Restore the CS register. MOV CS, A POP HL ; Restore general purpose register HL. POP AX ; Restore AX. ENDM ;------------------------------------------------------------------------------
#ifndef __XML_GENERATED_DEPLOYMENT_H_ #define __XML_GENERATED_DEPLOYMENT_H_ #define POK_GENERATED_CODE 1 #define POK_NEEDS_LIBC_STDIO 1 #define POK_CONFIG_NB_THREADS 3 #define POK_NEEDS_ARINC653_PROCESS 1 #define POK_NEEDS_ARINC653_PARTITION 1 #define POK_NEEDS_ARINC653_TIME 1 #define POK_NEEDS_ARINC653 1 #endif