text
stringlengths
4
6.14k
#include "tests.h" #include <asm/unistd.h> #ifdef __NR_fchdir # include <stdio.h> # include <unistd.h> int main(void) { const long int fd = (long int) 0xdeadbeefffffffff; long rc = syscall(__NR_fchdir, fd); printf("fchdir(%d) = %ld %s (%m)\n", (int) fd, rc, errno2name()); puts("+++ exited with 0 +++"); return 0; } #else SKIP_MAIN_UNDEFINED("__NR_fchdir") #endif
// 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 CHROME_BROWSER_UI_VIEWS_APPS_APP_INFO_DIALOG_APP_INFO_HEADER_PANEL_H_ #define CHROME_BROWSER_UI_VIEWS_APPS_APP_INFO_DIALOG_APP_INFO_HEADER_PANEL_H_ #include "base/memory/weak_ptr.h" #include "chrome/browser/ui/views/apps/app_info_dialog/app_info_panel.h" #include "ui/views/controls/link_listener.h" class Profile; namespace extensions { class Extension; } namespace gfx { class Image; } namespace views { class ImageView; class Label; class Link; class View; } // A small summary panel with the app's name, icon, version, and various links // that is displayed at the top of the app info dialog. class AppInfoHeaderPanel : public AppInfoPanel, public views::LinkListener, public base::SupportsWeakPtr<AppInfoHeaderPanel> { public: AppInfoHeaderPanel(Profile* profile, const extensions::Extension* app); virtual ~AppInfoHeaderPanel(); private: void CreateControls(); void LayoutAppNameAndVersionInto(views::View* parent_view); void LayoutControls(); // Overridden from views::LinkListener: virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; // Load the app icon asynchronously. For the response, check OnAppImageLoaded. void LoadAppImageAsync(); // Called when the app's icon is loaded. void OnAppImageLoaded(const gfx::Image& image); // Returns true if the app has a version number that makes sense to display. bool HasVersion() const; // Opens the app in the web store. Must only be called if // CanShowAppInWebStore() returns true. void ShowAppInWebStore() const; bool CanShowAppInWebStore() const; // Displays the licenses for the app. Must only be called if // CanDisplayLicenses() returns true. void DisplayLicenses(); bool CanDisplayLicenses(); // UI elements on the dialog. Elements are NULL if they are not displayed. views::ImageView* app_icon_; views::Label* app_name_label_; views::Label* app_version_label_; views::Link* view_in_store_link_; views::Link* licenses_link_; base::WeakPtrFactory<AppInfoHeaderPanel> weak_ptr_factory_; DISALLOW_COPY_AND_ASSIGN(AppInfoHeaderPanel); }; #endif // CHROME_BROWSER_UI_VIEWS_APPS_APP_INFO_DIALOG_APP_INFO_HEADER_PANEL_H_
// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef OSP_PUBLIC_NETWORK_METRICS_H_ #define OSP_PUBLIC_NETWORK_METRICS_H_ #include <cstdint> #include "osp/public/timestamp.h" namespace openscreen { namespace osp { // Holds a set of metrics, captured over a specific range of time, about the // behavior of a network service running in the library. struct NetworkMetrics { NetworkMetrics() = default; ~NetworkMetrics() = default; // The range of time over which the metrics were collected; end_timestamp > // start_timestamp timestamp_t start_timestamp = 0; timestamp_t end_timestamp = 0; // The number of packets and bytes sent over the timestamp range. uint64_t packets_sent = 0; uint64_t bytes_sent = 0; // The number of packets and bytes received over the timestamp range. uint64_t packets_received = 0; uint64_t bytes_received = 0; // The maximum number of connections over the timestamp range. The // latter two fields break this down by connections to ipv4 and ipv6 // endpoints. size_t max_connections = 0; size_t max_ipv4_connections = 0; size_t max_ipv6_connections = 0; }; } // namespace osp } // namespace openscreen #endif // OSP_PUBLIC_NETWORK_METRICS_H_
//===-- CommandObjectPlatform.h ---------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_CommandObjectPlatform_h_ #define liblldb_CommandObjectPlatform_h_ // C Includes // C++ Includes // Other libraries and framework includes // Project includes #include "lldb/Interpreter/CommandObjectMultiword.h" #include "lldb/Interpreter/Options.h" namespace lldb_private { //------------------------------------------------------------------------- // CommandObjectPlatform //------------------------------------------------------------------------- class CommandObjectPlatform : public CommandObjectMultiword { public: CommandObjectPlatform(CommandInterpreter &interpreter); ~CommandObjectPlatform() override; private: DISALLOW_COPY_AND_ASSIGN(CommandObjectPlatform); }; } // namespace lldb_private #endif // liblldb_CommandObjectPlatform_h_
/** ****************************************************************************** * @file Project/STM32F10x_StdPeriph_Template/stm32f10x_conf.h * @author MCD Application Team * @version V3.5.0 * @date 08-April-2011 * @brief Library configuration file. ****************************************************************************** * @attention * * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. * * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2> ****************************************************************************** */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F10x_CONF_H #define __STM32F10x_CONF_H /* Includes ------------------------------------------------------------------*/ /* Uncomment/Comment the line below to enable/disable peripheral header file inclusion */ #include "stm32f10x_adc.h" //#include "stm32f10x_bkp.h" //#include "stm32f10x_can.h" //#include "stm32f10x_cec.h" //#include "stm32f10x_crc.h" //#include "stm32f10x_dac.h" #include "stm32f10x_dbgmcu.h" #include "stm32f10x_dma.h" #include "stm32f10x_exti.h" #include "stm32f10x_flash.h" //#include "stm32f10x_fsmc.h" #include "stm32f10x_gpio.h" //#include "stm32f10x_i2c.h" //#include "stm32f10x_iwdg.h" //#include "stm32f10x_pwr.h" //#include "stm32f10x_rcc.h" //#include "stm32f10x_rtc.h" //#include "stm32f10x_sdio.h" //#include "stm32f10x_spi.h" #include "stm32f10x_tim.h" #include "stm32f10x_usart.h" //#include "stm32f10x_wwdg.h" #include "misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */ /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ /* Uncomment the line below to expanse the "assert_param" macro in the Standard Peripheral Library drivers code */ /* #define USE_FULL_ASSERT 1 */ /* Exported macro ------------------------------------------------------------*/ #ifdef USE_FULL_ASSERT /** * @brief The assert_param macro is used for function's parameters check. * @param expr: If expr is false, it calls assert_failed function which reports * the name of the source file and the source line number of the call * that failed. If expr is true, it returns no value. * @retval None */ #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__)) /* Exported functions ------------------------------------------------------- */ void assert_failed(uint8_t* file, uint32_t line); #else #define assert_param(expr) ((void)0) #endif /* USE_FULL_ASSERT */ #endif /* __STM32F10x_CONF_H */ /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE252_Unchecked_Return_Value__wchar_t_fputc_04.c Label Definition File: CWE252_Unchecked_Return_Value.label.xml Template File: point-flaw-04.tmpl.c */ /* * @description * CWE: 252 Unchecked Return Value * Sinks: fputc * GoodSink: Check if fputwc() fails * BadSink : Do not check if fputwc() fails * Flow Variant: 04 Control flow: if(STATIC_CONST_TRUE) and if(STATIC_CONST_FALSE) * * */ #include "std_testcase.h" #ifndef _WIN32 #include <wchar.h> #endif /* The two variables below are declared "const", so a tool should be able to identify that reads of these will always return their initialized values. */ static const int STATIC_CONST_TRUE = 1; /* true */ static const int STATIC_CONST_FALSE = 0; /* false */ #ifndef OMITBAD void CWE252_Unchecked_Return_Value__wchar_t_fputc_04_bad() { if(STATIC_CONST_TRUE) { /* FLAW: Do not check the return value */ fputwc((wchar_t)L'A', stdout); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* good1() uses if(STATIC_CONST_FALSE) instead of if(STATIC_CONST_TRUE) */ static void good1() { if(STATIC_CONST_FALSE) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { /* FIX: check the return value */ if (fputwc((wchar_t)L'A', stdout) == WEOF) { printLine("fputwc failed!"); } } } /* good2() reverses the bodies in the if statement */ static void good2() { if(STATIC_CONST_TRUE) { /* FIX: check the return value */ if (fputwc((wchar_t)L'A', stdout) == WEOF) { printLine("fputwc failed!"); } } } void CWE252_Unchecked_Return_Value__wchar_t_fputc_04_good() { good1(); good2(); } #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()..."); CWE252_Unchecked_Return_Value__wchar_t_fputc_04_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE252_Unchecked_Return_Value__wchar_t_fputc_04_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
/* * This file contains trace and debugging related definitions * * Copyright (c) 2009-2017 Red Hat, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met : * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and / or other materials provided with the distribution. * 3. Neither the names of the copyright holders nor the names of their 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 HOLDERS 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 "kdebugprint.h" #define EVENT_TRACING #if !defined(EVENT_TRACING) extern ULONG driverDebugFlags; extern int driverDebugLevel; #if !defined(TRACE_LEVEL_NONE) #define TRACE_LEVEL_NONE 0 #define TRACE_LEVEL_FATAL 1 #define TRACE_LEVEL_ERROR 2 #define TRACE_LEVEL_WARNING 3 #define TRACE_LEVEL_INFORMATION 4 #define TRACE_LEVEL_VERBOSE 5 #define TRACE_LEVEL_RESERVED6 6 #define TRACE_LEVEL_RESERVED7 7 #define TRACE_LEVEL_RESERVED8 8 #define TRACE_LEVEL_RESERVED9 9 #endif // // Define Debug Flags // #define DBG_INIT 0x00000001 #define DBG_PNP 0x00000002 #define DBG_POWER 0x00000004 #define DBG_WMI 0x00000008 #define DBG_CREATE_CLOSE 0x00000010 #define DBG_IOCTLS 0x00000020 #define DBG_WRITE 0x00000040 #define DBG_READ 0x00000080 #define DBG_DPC 0x00000100 #define DBG_INTERRUPT 0x00000200 #define DBG_LOCKS 0x00000400 #define DBG_QUEUEING 0x00000800 #define DBG_HW_ACCESS 0x00001000 #define TraceEvents(level, flags, message, ...) \ if (level > driverDebugLevel || !bDebugPrint || !(driverDebugFlags & flags)) {} \ else VirtioDebugPrintProc(message, __VA_ARGS__) #define WPP_INIT_TRACING(a,b) #define WPP_CLEANUP(DriverObject) #else #define WPP_CHECK_FOR_NULL_STRING #define WPP_CONTROL_GUIDS \ WPP_DEFINE_CONTROL_GUID(BalloonTraceGuid,(08cb9471,36fb,46ee,998b,d1bfbe1c4899), \ WPP_DEFINE_BIT(DBG_INIT) /* bit 0 = 0x00000001 */ \ WPP_DEFINE_BIT(DBG_PNP) /* bit 1 = 0x00000002 */ \ WPP_DEFINE_BIT(DBG_POWER) /* bit 2 = 0x00000004 */ \ WPP_DEFINE_BIT(DBG_WMI) /* bit 3 = 0x00000008 */ \ WPP_DEFINE_BIT(DBG_CREATE_CLOSE) /* bit 4 = 0x00000010 */ \ WPP_DEFINE_BIT(DBG_IOCTLS) /* bit 5 = 0x00000020 */ \ WPP_DEFINE_BIT(DBG_WRITE) /* bit 6 = 0x00000040 */ \ WPP_DEFINE_BIT(DBG_READ) /* bit 7 = 0x00000080 */ \ WPP_DEFINE_BIT(DBG_DPC) /* bit 8 = 0x00000100 */ \ WPP_DEFINE_BIT(DBG_INTERRUPT) /* bit 9 = 0x00000200 */ \ WPP_DEFINE_BIT(DBG_LOCKS) /* bit 10 = 0x00000400 */ \ WPP_DEFINE_BIT(DBG_QUEUEING) /* bit 11 = 0x00000800 */ \ WPP_DEFINE_BIT(DBG_HW_ACCESS) /* bit 12 = 0x00001000 */ \ ) #define WPP_FLAG_LEVEL_LOGGER(flag, level) \ WPP_LEVEL_LOGGER(flag) #define WPP_FLAG_LEVEL_ENABLED(flag, level) \ (WPP_LEVEL_ENABLED(flag) && WPP_CONTROL(WPP_BIT_ ## flag).Level >= level) #define WPP_LEVEL_FLAGS_LOGGER(lvl,flags) \ WPP_LEVEL_LOGGER(flags) #define WPP_LEVEL_FLAGS_ENABLED(lvl, flags) \ (WPP_LEVEL_ENABLED(flags) && WPP_CONTROL(WPP_BIT_ ## flags).Level >= lvl) // // This comment block is scanned by the trace preprocessor to define our // Trace function. // // begin_wpp config // FUNC Trace{FLAG=MYDRIVER_ALL_INFO}(LEVEL, MSG, ...); // FUNC TraceEvents(LEVEL, FLAGS, MSG, ...); // end_wpp // #endif void InitializeDebugPrints(IN PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath);
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE23_Relative_Path_Traversal__char_file_open_83.h Label Definition File: CWE23_Relative_Path_Traversal.label.xml Template File: sources-sink-83.tmpl.h */ /* * @description * CWE: 23 Relative Path Traversal * BadSource: file Read input from a file * GoodSource: Use a fixed file name * Sinks: open * BadSink : Open the file named in data using open() * Flow Variant: 83 Data flow: data passed to class constructor and destructor by declaring the class object on the stack * * */ #include "std_testcase.h" #ifdef _WIN32 #define BASEPATH "c:\\temp\\" #else #include <wchar.h> #define BASEPATH "/tmp/" #endif namespace CWE23_Relative_Path_Traversal__char_file_open_83 { #ifndef OMITBAD class CWE23_Relative_Path_Traversal__char_file_open_83_bad { public: CWE23_Relative_Path_Traversal__char_file_open_83_bad(char * dataCopy); ~CWE23_Relative_Path_Traversal__char_file_open_83_bad(); private: char * data; }; #endif /* OMITBAD */ #ifndef OMITGOOD class CWE23_Relative_Path_Traversal__char_file_open_83_goodG2B { public: CWE23_Relative_Path_Traversal__char_file_open_83_goodG2B(char * dataCopy); ~CWE23_Relative_Path_Traversal__char_file_open_83_goodG2B(); private: char * data; }; #endif /* OMITGOOD */ }
/*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef _MITK_POINT_SET_READER_SERVICE__H_ #define _MITK_POINT_SET_READER_SERVICE__H_ // MITK #include <mitkAbstractFileReader.h> #include <mitkPointSet.h> class TiXmlElement; namespace mitk { /** * @internal * * @brief reads xml representations of mitk::PointSets from a file * * Reader for xml files containing one or multiple xml represenations of * mitk::PointSet. If multiple mitk::PointSet objects are stored in one file, * these are assigned to multiple BaseData objects. * * The reader is able to read the old 3D Pointsets without the "specification" and "timeseries" tags and the new 4D * Pointsets. * * @ingroup IO */ class PointSetReaderService : public AbstractFileReader { public: PointSetReaderService(); virtual ~PointSetReaderService(); using AbstractFileReader::Read; virtual std::vector<itk::SmartPointer<BaseData>> Read() override; private: PointSetReaderService(const PointSetReaderService &other); mitk::BaseGeometry::Pointer ReadGeometry(TiXmlElement *parentElement); mitk::PointSet::Pointer ReadPoints(mitk::PointSet::Pointer newPointSet, TiXmlElement *currentTimeSeries, unsigned int currentTimeStep); virtual PointSetReaderService *Clone() const override; }; } #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_BROWSER_UI_VIEWS_ASH_STATUS_AREA_HOST_AURA_H_ #define CHROME_BROWSER_UI_VIEWS_ASH_STATUS_AREA_HOST_AURA_H_ #pragma once #include "base/compiler_specific.h" #include "chrome/browser/chromeos/status/status_area_button.h" #include "chrome/browser/ui/browser_list.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #if defined(OS_CHROMEOS) #include "base/memory/scoped_ptr.h" #include "chrome/browser/chromeos/login/login_html_dialog.h" #endif class ClockUpdater; class StatusAreaView; namespace views { class Views; class Widget; } class StatusAreaHostAura : public StatusAreaButton::Delegate, public BrowserList::Observer, public content::NotificationObserver { public: StatusAreaHostAura(); virtual ~StatusAreaHostAura(); // Returns the status area view. StatusAreaView* GetStatusArea(); // Instantiates and sets |status_area_view_|, and sets it as the contents of // a new views::Widget |status_area_widget_| which is returned. // The caller is expected to take ownership of |status_area_widget_|. views::Widget* CreateStatusArea(); // Adds the buttons to the status area. This is called separately, after // the profile has been initialized. void AddButtons(); // StatusAreaButton::Delegate implementation. virtual bool ShouldExecuteStatusAreaCommand( const views::View* button_view, int command_id) const OVERRIDE; virtual void ExecuteStatusAreaCommand( const views::View* button_view, int command_id) OVERRIDE; virtual StatusAreaButton::TextStyle GetStatusAreaTextStyle() const OVERRIDE; virtual void ButtonVisibilityChanged(views::View* button_view) OVERRIDE; // BrowserList::Observer implementation. virtual void OnBrowserAdded(const Browser* browser) OVERRIDE {} virtual void OnBrowserRemoved(const Browser* browser) OVERRIDE {} virtual void OnBrowserSetLastActive(const Browser* browser) OVERRIDE; // content::NotificationObserver implementation. virtual void Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) OVERRIDE; private: // Is either the login or lock screen currently displayed? bool IsLoginOrLockScreenDisplayed() const; // Triggers an update of the status area text style and position. void UpdateAppearance(); // Owned by caller of CreateStatusArea(). views::Widget* status_area_widget_; // Owned by status_area_widget_. StatusAreaView* status_area_view_; #if defined(OS_CHROMEOS) scoped_ptr<ClockUpdater> clock_updater_; #endif content::NotificationRegistrar registrar_; DISALLOW_COPY_AND_ASSIGN(StatusAreaHostAura); }; #endif // CHROME_BROWSER_UI_VIEWS_ASH_STATUS_AREA_HOST_AURA_H_
// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef NET_NETWORK_ERROR_LOGGING_NETWORK_ERROR_LOGGING_TEST_UTIL_H_ #define NET_NETWORK_ERROR_LOGGING_NETWORK_ERROR_LOGGING_TEST_UTIL_H_ #include <string> #include <vector> #include "base/callback.h" #include "base/macros.h" #include "net/base/address_list.h" #include "net/base/ip_address.h" #include "net/network_error_logging/network_error_logging_service.h" #include "url/gurl.h" #include "url/origin.h" namespace net { class IPAddress; // A NetworkErrorLoggingService implementation that stashes all NEL headers and // reports so that they can be easily verified in unit tests. class TestNetworkErrorLoggingService : public NetworkErrorLoggingService { public: struct Header { Header() = default; ~Header() = default; // Returns whether the |received_ip_address| field matches any of the // addresses in |address_list|. bool MatchesAddressList(const AddressList& address_list) const; NetworkIsolationKey network_isolation_key; url::Origin origin; IPAddress received_ip_address; std::string value; }; TestNetworkErrorLoggingService(); TestNetworkErrorLoggingService(const TestNetworkErrorLoggingService&) = delete; TestNetworkErrorLoggingService& operator=( const TestNetworkErrorLoggingService&) = delete; ~TestNetworkErrorLoggingService() override; const std::vector<Header>& headers() { return headers_; } const std::vector<RequestDetails>& errors() { return errors_; } // NetworkErrorLoggingService implementation void OnHeader(const NetworkIsolationKey& network_isolation_key, const url::Origin& origin, const IPAddress& received_ip_address, const std::string& value) override; void OnRequest(RequestDetails details) override; void QueueSignedExchangeReport(SignedExchangeReportDetails details) override; void RemoveBrowsingData( const base::RepeatingCallback<bool(const GURL&)>& origin_filter) override; void RemoveAllBrowsingData() override; private: std::vector<Header> headers_; std::vector<RequestDetails> errors_; }; } // namespace net #endif // NET_NETWORK_ERROR_LOGGING_NETWORK_ERROR_LOGGING_TEST_UTIL_H_
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE121_Stack_Based_Buffer_Overflow__src_char_alloca_cpy_54b.c Label Definition File: CWE121_Stack_Based_Buffer_Overflow__src.label.xml Template File: sources-sink-54b.tmpl.c */ /* * @description * CWE: 121 Stack Based Buffer Overflow * BadSource: Initialize data as a large string * GoodSource: Initialize data as a small string * Sink: cpy * BadSink : Copy data to string using strcpy * Flow Variant: 54 Data flow: data passed as an argument from one function through three others to a fifth; all five functions are in different source files * * */ #include "std_testcase.h" #include <wchar.h> /* all the sinks are the same, we just want to know where the hit originated if a tool flags one */ #ifndef OMITBAD /* bad function declaration */ void CWE121_Stack_Based_Buffer_Overflow__src_char_alloca_cpy_54c_badSink(char * data); void CWE121_Stack_Based_Buffer_Overflow__src_char_alloca_cpy_54b_badSink(char * data) { CWE121_Stack_Based_Buffer_Overflow__src_char_alloca_cpy_54c_badSink(data); } #endif /* OMITBAD */ #ifndef OMITGOOD /* good function declaration */ void CWE121_Stack_Based_Buffer_Overflow__src_char_alloca_cpy_54c_goodG2BSink(char * data); /* goodG2B uses the GoodSource with the BadSink */ void CWE121_Stack_Based_Buffer_Overflow__src_char_alloca_cpy_54b_goodG2BSink(char * data) { CWE121_Stack_Based_Buffer_Overflow__src_char_alloca_cpy_54c_goodG2BSink(data); } #endif /* OMITGOOD */
/// /// \file merge.h /// Data merge functions. /// /// \author Enno Luebbers <luebbers@reconos.de> /// \date 28.09.2007 // // This file is part of the ReconOS project <http://www.reconos.de>. // University of Paderborn, Computer Engineering Group. // // (C) Copyright University of Paderborn 2007. // #ifndef __MERGE_NO_GLOBALS_H__ #define __MERGE_NO_GLOBALS_H__ #ifndef cyg_addrword_t #define cyg_addrword_t unsigned int #endif typedef struct { unsigned int *left; unsigned int *right; unsigned int blocksize; unsigned int *result; } merge_info; void simple_merge( merge_info * mi ); void merge_entry( cyg_addrword_t data ); unsigned int *recursive_merge( unsigned int *data, unsigned int *result, unsigned int size, unsigned int blocksize, void ( *mergefun ) ( merge_info * mi ) ); #endif // __MERGE_H__
/* ---------------------------------------------------------------------------- * Robotics Laboratory, Westphalian University of Applied Science * ---------------------------------------------------------------------------- * Project : Stereo Vision Project * Revision : 1.0 * Recent changes : 18.06.2014 * ---------------------------------------------------------------------------- * LOG: * ---------------------------------------------------------------------------- * Developer : Dennis Luensch (dennis.luensch@gmail.com) Tom Marvin Liebelt (fh@tom-liebelt.de) Christian Blesing (christian.blesing@gmail.com) * License : BSD * * Copyright (c) 2014, Dennis Lünsch, Tom Marvin Liebelt, Christian Blesing * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * # Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * # Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * # Neither the name of the {organization} nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ------------------------------------------------------------------------- */ #ifndef ADCENSUSCV_H #define ADCENSUSCV_H #include <opencv2/opencv.hpp> using namespace cv; class ADCensusCV { public: ADCensusCV(const Mat &leftImage, const Mat &rightImage, Size censusWin, float lambdaAD, float lambdaCensus); float ad(int wL, int hL, int wR, int hR) const; float census(int wL, int hL, int wR, int hR) const; float adCensus(int wL, int hL, int wR, int hR) const; private: Mat leftImage; Mat rightImage; Size censusWin; float lambdaAD; float lambdaCensus; }; #endif // ADCENSUSCV_H
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE36_Absolute_Path_Traversal__char_connect_socket_fopen_84.h Label Definition File: CWE36_Absolute_Path_Traversal.label.xml Template File: sources-sink-84.tmpl.h */ /* * @description * CWE: 36 Absolute Path Traversal * BadSource: connect_socket Read data using a connect socket (client side) * GoodSource: Full path and file name * Sinks: fopen * BadSink : Open the file named in data using fopen() * Flow Variant: 84 Data flow: data passed to class constructor and destructor by declaring the class object on the heap and deleting it after use * * */ #include "std_testcase.h" #ifndef _WIN32 #include <wchar.h> #endif namespace CWE36_Absolute_Path_Traversal__char_connect_socket_fopen_84 { #ifndef OMITBAD class CWE36_Absolute_Path_Traversal__char_connect_socket_fopen_84_bad { public: CWE36_Absolute_Path_Traversal__char_connect_socket_fopen_84_bad(char * dataCopy); ~CWE36_Absolute_Path_Traversal__char_connect_socket_fopen_84_bad(); private: char * data; }; #endif /* OMITBAD */ #ifndef OMITGOOD class CWE36_Absolute_Path_Traversal__char_connect_socket_fopen_84_goodG2B { public: CWE36_Absolute_Path_Traversal__char_connect_socket_fopen_84_goodG2B(char * dataCopy); ~CWE36_Absolute_Path_Traversal__char_connect_socket_fopen_84_goodG2B(); private: char * data; }; #endif /* OMITGOOD */ }
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE121_Stack_Based_Buffer_Overflow__src_char_alloca_cat_02.c Label Definition File: CWE121_Stack_Based_Buffer_Overflow__src.label.xml Template File: sources-sink-02.tmpl.c */ /* * @description * CWE: 121 Stack Based Buffer Overflow * BadSource: Initialize data as a large string * GoodSource: Initialize data as a small string * Sink: cat * BadSink : Copy data to string using strcat * Flow Variant: 02 Control flow: if(1) and if(0) * * */ #include "std_testcase.h" #include <wchar.h> #ifndef OMITBAD void CWE121_Stack_Based_Buffer_Overflow__src_char_alloca_cat_02_bad() { char * data; char * dataBuffer = (char *)ALLOCA(100*sizeof(char)); data = dataBuffer; if(1) { /* FLAW: Initialize data as a large buffer that is larger than the small buffer used in the sink */ memset(data, 'A', 100-1); /* fill with 'A's */ data[100-1] = '\0'; /* null terminate */ } { char dest[50] = ""; /* POTENTIAL FLAW: Possible buffer overflow if data is larger than sizeof(dest)-strlen(dest)*/ strcat(dest, data); printLine(data); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B1() - use goodsource and badsink by changing the 1 to 0 */ static void goodG2B1() { char * data; char * dataBuffer = (char *)ALLOCA(100*sizeof(char)); data = dataBuffer; if(0) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { /* FIX: Initialize data as a small buffer that as small or smaller than the small buffer used in the sink */ memset(data, 'A', 50-1); /* fill with 'A's */ data[50-1] = '\0'; /* null terminate */ } { char dest[50] = ""; /* POTENTIAL FLAW: Possible buffer overflow if data is larger than sizeof(dest)-strlen(dest)*/ strcat(dest, data); printLine(data); } } /* goodG2B2() - use goodsource and badsink by reversing the blocks in the if statement */ static void goodG2B2() { char * data; char * dataBuffer = (char *)ALLOCA(100*sizeof(char)); data = dataBuffer; if(1) { /* FIX: Initialize data as a small buffer that as small or smaller than the small buffer used in the sink */ memset(data, 'A', 50-1); /* fill with 'A's */ data[50-1] = '\0'; /* null terminate */ } { char dest[50] = ""; /* POTENTIAL FLAW: Possible buffer overflow if data is larger than sizeof(dest)-strlen(dest)*/ strcat(dest, data); printLine(data); } } void CWE121_Stack_Based_Buffer_Overflow__src_char_alloca_cat_02_good() { goodG2B1(); goodG2B2(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE121_Stack_Based_Buffer_Overflow__src_char_alloca_cat_02_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE121_Stack_Based_Buffer_Overflow__src_char_alloca_cat_02_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
// // Copyright (c) 2009-2010 Shawn Singh, Mubbasir Kapadia, Petros Faloutsos, Glenn Reinman // See license.txt for complete license. // #ifndef __STEERLIB_CAMERA_H__ #define __STEERLIB_CAMERA_H__ /// @file Camera.h /// @brief Declares a simple camera class /// @todo /// - document this file and the .cpp file /// - make the code more SteerLib style #include <vector> #include "util/Geometry.h" #include "Globals.h" #ifdef _WIN32 // on win32, there is an unfortunate conflict between exporting symbols for a // dynamic/shared library and STL code. A good document describing the problem // in detail is http://www.unknownroad.com/rtfm/VisualStudio/warningC4251.html // the "least evil" solution is just to simply ignore this warning. #pragma warning( push ) #pragma warning( disable : 4251 ) #endif namespace SteerLib { class STEERLIB_API CameraView { public: /// Position of the camera Util::Point position; /// Point that the camera should look at Util::Point lookat; /// Up direction relative to the camera Util::Vector up; /// Field of view (fov) in the y direction float fovy; /// Default constructor, initializes the camera to the origin, looking down the positive z-axis. CameraView() { position = Util::Point(0.0f, 0.0f, 0.0f); lookat = Util::Point(0.0f, 0.0f, 1.0f); up = Util::Vector(0.0f, 1.0f, 0.0f); } /// Initializes the camera to the desired position, looking at the desired target. CameraView(const Util::Point & newPos, const Util::Point & newLookat, const Util::Vector & newUp, const float newFovy) { set(newPos, newLookat, newUp, newFovy); } /// Sets the camera to the desired position, looking at the desired target, with the specified up orientation and vertical field-of-view. inline void set(const Util::Point & newPos, const Util::Point & newLookat, const Util::Vector & newUp, const float newFovy) { position = newPos; lookat = newLookat; up = newUp; fovy = newFovy; } }; class STEERLIB_API Camera { public: Camera(); void reset(); void setView(const CameraView & view); void setView(const Util::Point & pos, const Util::Point & lookat, const Util::Vector & up, const float fovy); int addPointOfInterest(const Util::Point & pos, const Util::Point & lookat, const Util::Vector & up); int addPointOfInterest(const Util::Point & pos, const Util::Point & lookat); void useNextPointOfInterest(); void update(float totalTime, float elapsedTime); void apply(); void nudgeRotate(float tilt, float swivel); void nudgeZoom(float zoom); void nudgePosition(float xNudge, float yNudge); Util::Point position(); Util::Point lookat(); Util::Vector up(); CameraView nextPointOfInterestView(); private: Util::Point setPosition(const Util::Point & pos); Util::Point setLookat(const Util::Point & lookat); Util::Vector setUp(const Util::Vector & up); CameraView m_currentView; CameraView m_targetView; bool m_isInterpolating; float m_interpolationTime; // pois = Points of Interest std::vector<CameraView> m_pois; int m_currentPoi; static const float INTERPOLATE_TIME; }; } // namespace SteerLib #ifdef _WIN32 #pragma warning( pop ) #endif #endif
/* * FreeRTOS+FAT FS V1.0.0 (C) 2013 HCC Embedded * * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license * terms. * * FreeRTOS+FAT SL uses a dual license model that allows the software to be used * under a standard GPL open source license, or a commercial license. The * standard GPL license (unlike the modified GPL license under which FreeRTOS * itself is distributed) requires that all software statically linked with * FreeRTOS+FAT SL is also distributed under the same GPL V2 license terms. * Details of both license options follow: * * - Open source licensing - * FreeRTOS+FAT SL is a free download and may be used, modified, evaluated and * distributed without charge provided the user adheres to version two of the * GNU General Public License (GPL) and does not remove the copyright notice or * this text. The GPL V2 text is available on the gnu.org web site, and on the * following URL: http://www.FreeRTOS.org/gpl-2.0.txt. * * - Commercial licensing - * Businesses and individuals who for commercial or other reasons cannot comply * with the terms of the GPL V2 license must obtain a commercial license before * incorporating FreeRTOS+FAT SL into proprietary software for distribution in * any form. Commercial licenses can be purchased from * http://shop.freertos.org/fat_sl and do not require any source files to be * changed. * * FreeRTOS+FAT SL is distributed in the hope that it will be useful. You * cannot use FreeRTOS+FAT SL unless you agree that you use the software 'as * is'. FreeRTOS+FAT SL is provided WITHOUT ANY WARRANTY; without even the * implied warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. Real Time Engineers Ltd. and HCC Embedded disclaims all * conditions and terms, be they implied, expressed, or statutory. * * http://www.FreeRTOS.org * http://www.FreeRTOS.org/FreeRTOS-Plus * */ #ifndef __UTIL_H #define __UTIL_H #include "util_sfn.h" #include "../../version/ver_fat_sl.h" #if VER_FAT_SL_MAJOR != 3 || VER_FAT_SL_MINOR != 2 #error Incompatible FAT_SL version number! #endif #ifdef __cplusplus extern "C" { #endif void f_igettimedate ( unsigned short * time, unsigned short * date ); unsigned short _f_getword ( void * ); unsigned long _f_getlong ( void * ); char _f_toupper ( char ); void _f_memset ( void *, unsigned char, int ); void _f_memcpy ( void *, void *, int ); void _f_setword ( void *, unsigned short ); void _f_setlong ( void *, unsigned long ); unsigned char * _setcharzero ( int, unsigned char * ); unsigned char * _setchar ( const unsigned char *, int, unsigned char * ); unsigned char * _setword ( unsigned short, unsigned char * ); unsigned char * _setlong ( unsigned long, unsigned char * ); #ifdef __cplusplus } #endif #endif /* ifndef __UTIL_H */
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE773_Missing_Reference_to_Active_File_Descriptor_or_Handle__open_51b.c Label Definition File: CWE773_Missing_Reference_to_Active_File_Descriptor_or_Handle__open.label.xml Template File: source-sinks-51b.tmpl.c */ /* * @description * CWE: 773 Missing Reference to Active File Descriptor or Handle * BadSource: Create a file descriptor using open() * Sinks: * GoodSink: Close the file before reusing the file descriptor * BadSink : Reassign the file descriptor before closing the file * Flow Variant: 51 Data flow: data passed as an argument from one function to another in different source files * * */ #include "std_testcase.h" #ifdef _WIN32 #define OPEN _open #define CLOSE _close #else #include <unistd.h> #define OPEN open #define CLOSE close #endif #ifndef OMITBAD void CWE773_Missing_Reference_to_Active_File_Descriptor_or_Handle__open_51b_badSink(int data) { /* FLAW: Assign data to another file descriptor without closing the descriptor from the source */ data = OPEN("BadSink_open.txt", O_RDWR|O_CREAT, S_IREAD|S_IWRITE); /* avoid incidental for not closing the file */ if (data != -1) { CLOSE(data); } } #endif /* OMITBAD */ #ifndef OMITGOOD void CWE773_Missing_Reference_to_Active_File_Descriptor_or_Handle__open_51b_goodB2GSink(int data) { /* FIX: Close the file from the source before reassigning data to a new file descriptor */ if (data != -1) { CLOSE(data); } data = OPEN("GoodSink_open.txt", O_RDWR|O_CREAT, S_IREAD|S_IWRITE); /* avoid incidental for not closing the file */ if (data != -1) { CLOSE(data); } } #endif /* OMITGOOD */
/* tab:4 * * * "Copyright (c) 2000-2002 The Regents of the University of California. * All rights reserved. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose, without fee, and without written agreement is * hereby granted, provided that the above copyright notice, the following * two paragraphs and the author appear in all copies of this software. * * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." * */ /* tab:4 * IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. By * downloading, copying, installing or using the software you agree to * this license. If you do not agree to this license, do not download, * install, copy or use the software. * * Intel Open Source License * * Copyright (c) 2002 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 the Intel Corporation nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL 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. * * */ /* * * Authors: Jason Hill, David Gay, Philip Levis * Date last modified: 6/25/02 * */ // Message format #include "Routing.h" #ifndef _H_AM_h #define _H_AM_h enum { TOS_BCAST_ADDR = 0xffff, TOS_UART_ADDR = 0x007e, }; #ifndef DEF_TOS_AM_GROUP #define DEF_TOS_AM_GROUP 0x7d #endif enum { TOS_DEFAULT_AM_GROUP = DEF_TOS_AM_GROUP }; uint8_t TOS_AM_GROUP = TOS_DEFAULT_AM_GROUP; #ifndef TOSH_DATA_LENGTH #define TOSH_DATA_LENGTH 29 #endif typedef struct TOS_Msg { /* The following fields are transmitted/received on the radio. */ uint16_t addr; uint8_t type; uint8_t group; uint8_t length; int8_t data[TOSH_DATA_LENGTH]; uint16_t crc; /* The following fields are not actually transmitted or received * on the radio! They are used for internal accounting only. * The reason they are in this structure is that the AM interface * requires them to be part of the TOS_Msg that is passed to * send/receive operations. */ uint16_t strength; uint8_t ack; uint16_t time; RoutingDispatch_t dispatch; RoutingMsgExt_t ext; } TOS_Msg; enum { MSG_DATA_SIZE = offsetof(struct TOS_Msg, crc) + sizeof(uint16_t), // 36 by default DATA_LENGTH = TOSH_DATA_LENGTH, LENGTH_BYTE_NUMBER = offsetof(struct TOS_Msg, length) + 1 }; typedef TOS_Msg *TOS_MsgPtr; uint8_t TOS_MsgLength(uint8_t type) { #if 0 uint8_t i; for (i = 0; i < MSGLEN_TABLE_SIZE; i++) if (msgTable[i].handler == type) return msgTable[i].length; #endif return offsetof(TOS_Msg, strength); } #endif // _H_AM_h
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE134_Uncontrolled_Format_String__char_file_printf_17.c Label Definition File: CWE134_Uncontrolled_Format_String.label.xml Template File: sources-sinks-17.tmpl.c */ /* * @description * CWE: 134 Uncontrolled Format String * BadSource: file Read input from a file * GoodSource: Copy a fixed string into data * Sinks: printf * GoodSink: printf with "%s" as the first argument and data as the second * BadSink : printf with only data as an argument * Flow Variant: 17 Control flow: for loops * * */ #include "std_testcase.h" #ifndef _WIN32 #include <wchar.h> #endif #ifdef _WIN32 #define FILENAME "C:\\temp\\file.txt" #else #define FILENAME "/tmp/file.txt" #endif #ifndef OMITBAD void CWE134_Uncontrolled_Format_String__char_file_printf_17_bad() { int i,j; char * data; char dataBuffer[100] = ""; data = dataBuffer; for(i = 0; i < 1; i++) { { /* Read input from a file */ size_t dataLen = strlen(data); FILE * pFile; /* if there is room in data, attempt to read the input from a file */ if (100-dataLen > 1) { pFile = fopen(FILENAME, "r"); if (pFile != NULL) { /* POTENTIAL FLAW: Read data from a file */ if (fgets(data+dataLen, (int)(100-dataLen), pFile) == NULL) { printLine("fgets() failed"); /* Restore NUL terminator if fgets fails */ data[dataLen] = '\0'; } fclose(pFile); } } } } for(j = 0; j < 1; j++) { /* POTENTIAL FLAW: Do not specify the format allowing a possible format string vulnerability */ printf(data); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodB2G() - use badsource and goodsink in the for statements */ static void goodB2G() { int i,k; char * data; char dataBuffer[100] = ""; data = dataBuffer; for(i = 0; i < 1; i++) { { /* Read input from a file */ size_t dataLen = strlen(data); FILE * pFile; /* if there is room in data, attempt to read the input from a file */ if (100-dataLen > 1) { pFile = fopen(FILENAME, "r"); if (pFile != NULL) { /* POTENTIAL FLAW: Read data from a file */ if (fgets(data+dataLen, (int)(100-dataLen), pFile) == NULL) { printLine("fgets() failed"); /* Restore NUL terminator if fgets fails */ data[dataLen] = '\0'; } fclose(pFile); } } } } for(k = 0; k < 1; k++) { /* FIX: Specify the format disallowing a format string vulnerability */ printf("%s\n", data); } } /* goodG2B() - use goodsource and badsink in the for statements */ static void goodG2B() { int h,j; char * data; char dataBuffer[100] = ""; data = dataBuffer; for(h = 0; h < 1; h++) { /* FIX: Use a fixed string that does not contain a format specifier */ strcpy(data, "fixedstringtest"); } for(j = 0; j < 1; j++) { /* POTENTIAL FLAW: Do not specify the format allowing a possible format string vulnerability */ printf(data); } } void CWE134_Uncontrolled_Format_String__char_file_printf_17_good() { goodB2G(); 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()..."); CWE134_Uncontrolled_Format_String__char_file_printf_17_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE134_Uncontrolled_Format_String__char_file_printf_17_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
# include "poisson.h" void sweep_seq(int nx, int ny, double dx, double dy, double *f_, int itold, int itnew, double *u_, double *unew_) { int i; int it; int j; double (*f)[nx][ny] = (double (*)[nx][ny])f_; double (*u)[nx][ny] = (double (*)[nx][ny])u_; double (*unew)[nx][ny] = (double (*)[nx][ny])unew_; for (it = itold + 1; it <= itnew; it++) { for (i = 0; i < nx; i++) { for (j = 0; j < ny; j++) { (*u)[i][j] = (*unew)[i][j]; } } for (i = 0; i < nx; i++) { for (j = 0; j < ny; j++) { if (i == 0 || j == 0 || i == nx - 1 || j == ny - 1) { (*unew)[i][j] = (*f)[i][j]; } else { (*unew)[i][j] = 0.25 * ((*u)[i-1][j] + (*u)[i][j+1] + (*u)[i][j-1] + (*u)[i+1][j] + (*f)[i][j] * dx * dy); } } } } }
#pragma once #include "NeuralNetwork.h" #include "ActionMemory.h" class Lab1ReinforcementLearning { public: int num_exp_replay_; // histories for experience replay training int num_input_histories_; // input to nn int num_state_variables_; // dimension of the state variables of the game int num_game_actions_; // num outputs of the game float gamma_; NeuralNetwork nn_; ArmMemory memory_; VectorND<float> old_input_vector_, reward_vector_, next_input_vector_; void initialize() { //assert(num_exp_replay_ >= num_input_histories_); // initialize neural network const int num_hidden_layers = 1; // h529 : state_variables_ by input_histories·Î 2Â÷¿ø ¹è¿­ »ý¼º > ÀÌ°Ô ³ªÁß¿¡ value·Î ³Ñ¾î°¨ nn_.initialize(num_state_variables_ * num_input_histories_, num_game_actions_, num_hidden_layers); for (int i = 0; i <= num_hidden_layers + 1; i++) nn_.layers_[i].act_type_ = LayerBase::ReLU; // h529 : Learning rate nn_.eta_ = 1e-5; // h529 : Momentum, ÀÏÁ¾ÀÇ ¼öÄ¡ÇØ¼® ±â¹ý nn_.alpha_ = 0.9f; // h529 : Q-Learning ¹æÁ¤½Ä¿¡¼­ Gamma, 0~1»çÀÌ·Î ÇнÀ ºñÀ² gamma_ = 0.5f; // initialize replay memory memory_.reserve(1e5); // h529 : value old_input_vector_.initialize(nn_.num_input_, true); next_input_vector_.initialize(nn_.num_input_, true); //TODO: don't train if histories are not enough } void trainReward() { trainReward(0); // train with last memory // train precious experience only //if (history_.getValue(-2).reward_ > 0.5) // for (int i = 0; i < 10; i++) // trainReward(0); //else // trainReward(0); } void trainRewardMemory() { for (int ix_from_end = 0; ix_from_end > -(memory_.num_elements_ - num_input_histories_); ix_from_end--) trainReward(ix_from_end); } void trainReward(const int ix_from_end) { // guess next Q value makeInputVectorFromHistory(ix_from_end, next_input_vector_); const float reward_ix = memory_.getRewardFromLast(ix_from_end); nn_.setInputVector(next_input_vector_); nn_.feedForward(); const float next_Q = reward_ix < 0.0f ? 0.0f : nn_.getOutputValueMaxComponent(); // final status test //const float next_Q = nn_.getOutputValueMaxComponent(); //const int selected_dir = history_.getValue(history_.getLastIndex() -1 + ix_from_end).choice_; // last history is in one step future const int selected_dir = memory_.getSelectedIxFromLast(ix_from_end); //TODO: default training direction! makeInputVectorFromHistory(ix_from_end - 1, old_input_vector_); //const float high_reward_th = 0.8; const float high_reward_tr_ep = 0.1f; //if (high_reward_th <= reward_ix || reward_ix < 0.1) { //std::cout << "High reward training start" << std::endl; int count = 0; while (true) // for(int r = 0; r < 1; r ++) { nn_.setInputVector(old_input_vector_); // old input nn_.feedForward(); nn_.copyOutputVectorTo(false, reward_vector_); const float target = reward_ix + gamma_ * next_Q; const float error = ABS(reward_vector_[selected_dir] - target); reward_vector_[selected_dir] = reward_ix + gamma_ * next_Q; nn_.propBackward(reward_vector_); nn_.check(); if (error < high_reward_tr_ep || count > 10000) { break; } count++; } } } void forward() { makeInputVectorFromHistory(0, old_input_vector_); nn_.setInputVector(old_input_vector_); nn_.feedForward(); } // push back this to history void recordHistory(const VectorND<float>& state_vector, const float& reward, const int& choice, const VectorND<float>& q_values) { //TODO: this makes slower memory_.append(state_vector, choice, reward, q_values); } void makeInputVectorFromHistory(const int& ix_from_end, VectorND<float>& input) { for (int r = 0, count = 0; r < num_input_histories_; r++, count += num_state_variables_) { const VectorND<float> &state_vector = memory_.getStateVectorFromLast(ix_from_end - r); //history_.getValue(history_.getLastIndex() - r + ix_from_end).state_vector_; input.copyPartial(state_vector, count, 0, num_state_variables_); } } };
int arr[100]; void notify(char* str); int* fib(){ notify("Hello from WASM"); arr[0] = 0; arr[1] = 1; for(int i=2;i<=100;i++){ arr[i] = arr[i-1] + arr[i-2]; } return &arr[0]; }
/* * Copyright (c) 2008 Travis Geiselbrecht * * Use of this source code is governed by a MIT-style * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT */ #ifndef __SMC91C96_P_H #define __SMC91C96_P_H // LAN91C96 stuffs /* registers */ #define SMC_BSR 14 /* bank 0 */ #define SMC_TCR 0 #define SMC_EPHSR 2 #define SMC_RCR 4 #define SMC_ECR 6 #define SMC_MIR 8 #define SMC_MCR 10 /* bank 1 */ #define SMC_CR 0 #define SMC_BAR 2 #define SMC_IAR0 4 #define SMC_IAR1 5 #define SMC_IAR2 6 #define SMC_IAR3 7 #define SMC_IAR4 8 #define SMC_IAR5 9 #define SMC_GPR 10 #define SMC_CTR 12 /* bank 2 */ #define SMC_MMUCR 0 #define SMC_AUTOTX 1 #define SMC_PNR 2 #define SMC_ARR 3 #define SMC_FIFO 4 #define SMC_PTR 6 #define SMC_DATA0 8 #define SMC_DATA1 10 #define SMC_IST 12 #define SMC_ACK 12 #define SMC_MSK 13 /* bank 3 */ #define SMC_MT0 0 #define SMC_MT1 1 #define SMC_MT2 2 #define SMC_MT3 3 #define SMC_MT4 4 #define SMC_MT5 5 #define SMC_MT6 6 #define SMC_MT7 7 #define SMC_MGMT 8 #define SMC_REV 10 #define SMC_ERCV 12 #endif
#include "lib9.h" #include <bio.h> int Bflush(Biobuf *bp) { int n, c; switch(bp->state) { case Bwactive: n = bp->bsize+bp->ocount; if(n == 0) return 0; c = write(bp->fid, bp->bbuf, n); if(n == c) { bp->offset += n; bp->ocount = -bp->bsize; return 0; } bp->state = Binactive; bp->ocount = 0; break; case Bracteof: bp->state = Bractive; case Bractive: bp->icount = 0; bp->gbuf = bp->ebuf; return 0; } return Beof; }
/* SPDX-License-Identifier: BSD-3-Clause * Copyright(C) 2022 Marvell. */ #include "cn9k_worker.h" #include "cnxk_eventdev.h" #include "cnxk_worker.h" #define R(name, flags) SSO_DEQ_CA_SEG(cn9k_sso_hws_deq_ca_seg_##name, flags) NIX_RX_FASTPATH_MODES_112_127 #undef R
// // KMTextviewCell.h // KMWordPress // // Created by Karl Monaghan on 02/12/2012. // Copyright (c) 2012 Crayons and Brown Paper. All rights reserved. // #import <UIKit/UIKit.h> @interface KMTextviewCell : UITableViewCell @property (strong, nonatomic) IBOutlet UITextView *inputView; @end
#include "Burger.h" #include <Graphics.h> /********************************** Draw a masked shape on the screen **********************************/ void DrawMShape(Word x,Word y,void *ShapePtr) { ((CCB*)ShapePtr)->ccb_XPos = x<<16; /* Set the X coord */ ((CCB*)ShapePtr)->ccb_YPos = y<<16; /* Set the Y coord */ ((CCB*)ShapePtr)->ccb_Flags &= ~CCB_BGND; /* Enable masking */ DrawCels(VideoItem,(CCB*)ShapePtr); /* Draw the shape */ }
/* Copyright (C) 2015 Apple Inc. All Rights Reserved. See LICENSE.txt for this sample’s licensing information Abstract: A color palette view that allows the user to select a color defined in the \c AAPLListColor enumeration. */ @import Cocoa; @import ListerKit; @class AAPLColorPaletteView; // Delegate protocol to let other objects know about changes to the selected color. @protocol AAPLColorPaletteViewDelegate <NSObject> - (void)colorPaletteViewDidChangeSelectedColor:(AAPLColorPaletteView *)colorPaletteView; @end @interface AAPLColorPaletteView : NSView @property (weak) IBOutlet id<AAPLColorPaletteViewDelegate> delegate; @property (nonatomic) AAPLListColor selectedColor; @end
// // AudioChannelConfiguration.h // DASH Player // // Created by DataArt Apps on 28.07.14. // Copyright (c) 2014 DataArt Apps. All rights reserved. // #import <Foundation/Foundation.h> @interface AudioChannelConfiguration : NSObject @property (nonatomic, strong) NSString *schemeIdUri; @property (nonatomic, assign) NSUInteger value; - (void)setValueFromString:(NSString *)valueString; @end
// // DCRoundSwitch.h // // Created by Patrick Richards on 28/06/11. // MIT License. // // http://twitter.com/patr // http://domesticcat.com.au/projects // http://github.com/domesticcatsoftware/DCRoundSwitch // #import <UIKit/UIKit.h> #import <QuartzCore/QuartzCore.h> @class DCRoundSwitchToggleLayer; @class DCRoundSwitchOutlineLayer; @class DCRoundSwitchKnobLayer; @interface DCRoundSwitch : UIControl { @private DCRoundSwitchOutlineLayer *outlineLayer; DCRoundSwitchToggleLayer *toggleLayer; DCRoundSwitchKnobLayer *knobLayer; CAShapeLayer *clipLayer; BOOL ignoreTap; } @property (nonatomic, retain) UIColor *onTintColor; // default: blue (matches normal UISwitch) @property (nonatomic, getter=isOn) BOOL on; // default: NO @property (nonatomic, copy) NSString *onText; // default: 'ON' - automatically localized @property (nonatomic, copy) NSString *offText; // default: 'OFF' - automatically localized - (void)setOn:(BOOL)newOn animated:(BOOL)animated; - (void)setOn:(BOOL)newOn animated:(BOOL)animated ignoreControlEvents:(BOOL)ignoreControlEvents; @end
/* * Copyright (c) 2017, 2019, Oracle and/or its affiliates. * * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, this list of * conditions and the following disclaimer in the documentation and/or other materials provided * with the distribution. * * 3. Neither the name of the copyright holder nor the names of its contributors may be used to * endorse or promote products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ #define TYPE long #include "test.h"
/* GStreamer * Copyright (C) 2011 Collabora Ltd. * Copyright (C) 2011 Intel * * Author: Nicolas Dufresne <nicolas.dufresne@collabora.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; 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 "gstsurfaceconverter.h" #include "gstsurfacebuffer.h" /** * SECTION:gstsurfaceconverter * @short_description: Interface for #GstSurfaceBuffer conversion * * Objects implementing this interface are used as a conversion context. This * allows elements to optimize the upload by keeping ahold of required resources * between uploads. The context must be discarded when the pipeline goes to * #GST_STATE_NULL or renewed whenever the caps are changed. * <note> * The GstVideoContext interface is unstable API and may change in future. * One can define GST_USE_UNSTABLE_API to acknowledge and avoid this warning. * </note> * * <refsect2> * <title>Example uploading to GL texture</title> * |[ * if (G_UNLIKELY (priv->converter == NULL)) * priv->converter = gst_surface_buffer_create_converter (surface, "opengl", &value); * * gst_surface_converter_upload (priv->converter, surface); * ]| * </refsect2> */ G_DEFINE_INTERFACE (GstSurfaceConverter, gst_surface_converter, G_TYPE_INVALID); static void gst_surface_converter_default_init (GstSurfaceConverterInterface * iface) { /* default virtual functions */ iface->upload = NULL; } /** * gst_surface_converter_upload: * @converter: a #GstSurfaceConverter * @buffer: the #GstSurfaceBuffer to upload * * Convert and uploads the #GstSurfaceBuffer to the converter destination. * * Returns: #TRUE on success, #FALSE otherwise */ gboolean gst_surface_converter_upload (GstSurfaceConverter * converter, GstSurfaceBuffer * buffer) { g_return_val_if_fail (GST_IS_SURFACE_CONVERTER (converter), FALSE); g_return_val_if_fail (GST_IS_SURFACE_BUFFER (buffer), FALSE); return GST_SURFACE_CONVERTER_GET_IFACE (converter)->upload (converter, buffer); }
// Emacs style mode select -*- C++ -*- //----------------------------------------------------------------------------- // // $Id:$ // // Copyright (C) 1993-1996 by id Software, Inc. // // This source is available for distribution and/or modification // only under the terms of the DOOM Source Code License as // published by id Software. All rights reserved. // // The source is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License // for more details. // // DESCRIPTION: // Simple basic typedefs, isolated here to make it easier // separating modules. // //----------------------------------------------------------------------------- #ifndef __DOOMTYPE__ #define __DOOMTYPE__ #ifndef __BYTEBOOL__ #define __BYTEBOOL__ // Fixed to use builtin bool type with C++. #ifdef __cplusplus typedef bool boolean; #else typedef enum {false, true} boolean; #endif typedef unsigned char byte; #endif // Predefined with some OS. #ifdef LINUX #include <values.h> #else #define MAXCHAR ((char)0x7f) #define MAXSHORT ((short)0x7fff) // Max pos 32-bit int. #define MAXINT ((int)0x7fffffff) #define MAXLONG ((long)0x7fffffff) #define MINCHAR ((char)0x80) #define MINSHORT ((short)0x8000) // Max negative 32-bit integer. #define MININT ((int)0x80000000) #define MINLONG ((long)0x80000000) #endif #endif //----------------------------------------------------------------------------- // // $Log:$ // //-----------------------------------------------------------------------------
/* Machine settings for software floating-point emulation of Andes NDS32 cpu for GNU compiler Copyright (C) 2012-2013 Free Software Foundation, Inc. Contributed by Andes Technology Corporation. This file is part of GNU C Library. The GNU C 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. In addition to the permissions in the GNU Lesser General Public License, the Free Software Foundation gives you unlimited permission to link the compiled version of this file into combinations with other programs, and to distribute those combinations without any restriction coming from the use of this file. (The Lesser General Public License restrictions do apply in other respects; for example, they cover modification of the file, and distribution when not linked into a combine executable.) The GNU C 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 the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #define _FP_W_TYPE_SIZE 32 #define _FP_W_TYPE unsigned long #define _FP_WS_TYPE signed long #define _FP_I_TYPE long /* The type of the result of a floating point comparison. This must match `__libgcc_cmp_return__' in GCC for the target. */ typedef int __gcc_CMPtype __attribute__ ((mode (__libgcc_cmp_return__))); #define CMPtype __gcc_CMPtype #define _FP_MUL_MEAT_S(R,X,Y) \ _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm) #define _FP_MUL_MEAT_D(R,X,Y) \ _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm) #define _FP_MUL_MEAT_Q(R,X,Y) \ _FP_MUL_MEAT_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm) #define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_loop(S,R,X,Y) #define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y) #define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_4_udiv(Q,R,X,Y) #define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1) #define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1), -1 #define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1 #define _FP_NANSIGN_S 0 #define _FP_NANSIGN_D 0 #define _FP_NANSIGN_Q 0 #define _FP_KEEPNANFRACP 1 #define _FP_QNANNEGATEDP 0 /* Someone please check this. */ #define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \ do { \ if ((_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs) \ && !(_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs)) \ { \ R##_s = Y##_s; \ _FP_FRAC_COPY_##wc(R,Y); \ } \ else \ { \ R##_s = X##_s; \ _FP_FRAC_COPY_##wc(R,X); \ } \ R##_c = FP_CLS_NAN; \ } while (0) #define __LITTLE_ENDIAN 1234 #define __BIG_ENDIAN 4321 #if defined __big_endian__ # define __BYTE_ORDER __BIG_ENDIAN #else # define __BYTE_ORDER __LITTLE_ENDIAN #endif /* Define ALIASNAME as a strong alias for NAME. */ # define strong_alias(name, aliasname) _strong_alias(name, aliasname) # define _strong_alias(name, aliasname) \ extern __typeof (name) aliasname __attribute__ ((alias (#name)));
/* * $Id: mknode1.c,v 1.4 2002/05/12 22:51:17 hiroo Exp $ */ /* * FreeWnn is a network-extensible Kana-to-Kanji conversion system. * This file is part of FreeWnn. * * Copyright Kyoto University Research Institute for Mathematical Sciences * 1987, 1988, 1989, 1990, 1991, 1992 * Copyright OMRON Corporation. 1987, 1988, 1989, 1990, 1991, 1992, 1999 * Copyright ASTEC, Inc. 1987, 1988, 1989, 1990, 1991, 1992 * Copyright FreeWnn Project 1999, 2000, 2002 * * Maintainer: FreeWnn Project <freewnn@tomo.gr.jp> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include <config.h> #endif #if STDC_HEADERS # include <stdlib.h> #else # if HAVE_MALLOC_H # include <malloc.h> # endif #endif /* STDC_HEADERS */ #include "commonhd.h" #include "de_header.h" #include "kaiseki.h" static void lnk_sbn (); static struct SYO_BNSETSU *free_sbn_top = NULL; static struct free_list *free_list_sbn = NULL; /************************************************/ /* initialize link struct SYO_BNSETSU */ /************************************************/ int init_sbn () { free_area (free_list_sbn); if (get_area (FIRST_SBN_KOSUU, sizeof (struct SYO_BNSETSU), &free_list_sbn) < 0) return (-1); lnk_sbn (free_list_sbn); return (0); } int get_area (kosuu, size, list) register int kosuu; register int size; struct free_list **list; { register struct free_list *area; if ((area = (struct free_list *) malloc (size * kosuu + sizeof (struct free_list))) == NULL) { wnn_errorno = WNN_MALLOC_INITIALIZE; error1 ("Cannot Malloc in get_area.\n"); return (-1); } area->lnk = *list; area->num = kosuu; *list = area; return (0); } void free_area (list) register struct free_list *list; { if (list == 0) return; free_area (list->lnk); free (list); } /* free_sbn ¤¬ 0 ¤Ç¤Ê¤¤»þ¤Ë¸Æ¤ó¤À¤é¤¢¤«¤ó¤è */ static void lnk_sbn (list) struct free_list *list; { register int n; register struct SYO_BNSETSU *wk_ptr; free_sbn_top = wk_ptr = (struct SYO_BNSETSU *) ((char *) list + sizeof (struct free_list)); for (n = list->num - 1; n > 0; wk_ptr++, n--) wk_ptr->lnk_br = wk_ptr + 1; wk_ptr->lnk_br = 0; } /*******************************************************/ /* struct SYO_BNSETSU & ICHBNP & KANGO free ¥¨¥ê¥¢ºîÀ® */ /*******************************************************/ void freesbn (sbn) /* struct SYO_BNSETSU ¤ò free_area ¤Ø¥ê¥ó¥¯ */ register struct SYO_BNSETSU *sbn; /* ¥¯¥ê¥¢¤¹¤ë¥Î¡¼¥É¤Î¥Ý¥¤¥ó¥¿ */ { if (sbn == 0) return; sbn->reference--; if (sbn->reference <= 0) { sbn->lnk_br = free_sbn_top; free_sbn_top = sbn; } } void clr_sbn_node (sbn) register struct SYO_BNSETSU *sbn; { if (sbn == 0) return; if ((sbn->reference) <= 1) { freesbn (sbn); clr_sbn_node (sbn->parent); } else { sbn->reference--; } } /******************************************/ /* SYO_BNSETSU area ¤Î³ÍÆÀ */ /******************************************/ struct SYO_BNSETSU * getsbnsp () { register struct SYO_BNSETSU *rtnptr; if (free_sbn_top == 0) { if (get_area (SBN_KOSUU, sizeof (struct SYO_BNSETSU), &free_list_sbn) < 0) return ((struct SYO_BNSETSU *) -1); lnk_sbn (free_list_sbn); } rtnptr = free_sbn_top; free_sbn_top = free_sbn_top->lnk_br; rtnptr->lnk_br = 0; rtnptr->parent = 0; rtnptr->son_v = 0; rtnptr->reference = 0; rtnptr->jentptr = 0; rtnptr->status = 0; rtnptr->status_bkwd = 0; return (rtnptr); }
/* * AES (Rijndael) cipher - decrypt * * Modifications to public domain implementation: * - support only 128-bit keys * - cleanup * - use C pre-processor to make it easier to change S table access * - added option (AES_SMALL_TABLES) for reducing code size by about 8 kB at * cost of reduced throughput (quite small difference on Pentium 4, * 10-25% when using -O1 or -O2 optimization) * * Copyright (c) 2003-2005, Jouni Malinen <j@w1.fi> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * Alternatively, this software may be distributed under the terms of BSD * license. * * See README and COPYING for more details. */ #include "includes.h" #include "common.h" #include "crypto.h" #include "aes_i.h" /** * Expand the cipher key into the decryption key schedule. * * @return the number of rounds for the given cipher key size. */ static void rijndaelKeySetupDec(u32 rk[/*44*/], const u8 cipherKey[]) { int Nr = 10, i, j; u32 temp; /* expand the cipher key: */ rijndaelKeySetupEnc(rk, cipherKey); /* invert the order of the round keys: */ for (i = 0, j = 4*Nr; i < j; i += 4, j -= 4) { temp = rk[i ]; rk[i ] = rk[j ]; rk[j ] = temp; temp = rk[i + 1]; rk[i + 1] = rk[j + 1]; rk[j + 1] = temp; temp = rk[i + 2]; rk[i + 2] = rk[j + 2]; rk[j + 2] = temp; temp = rk[i + 3]; rk[i + 3] = rk[j + 3]; rk[j + 3] = temp; } /* apply the inverse MixColumn transform to all round keys but the * first and the last: */ for (i = 1; i < Nr; i++) { rk += 4; for (j = 0; j < 4; j++) { rk[j] = TD0_(TE4((rk[j] >> 24) )) ^ TD1_(TE4((rk[j] >> 16) & 0xff)) ^ TD2_(TE4((rk[j] >> 8) & 0xff)) ^ TD3_(TE4((rk[j] ) & 0xff)); } } } void * aes_decrypt_init(const u8 *key, size_t len) { u32 *rk; if (len != 16) return NULL; rk = os_malloc(AES_PRIV_SIZE); if (rk == NULL) return NULL; rijndaelKeySetupDec(rk, key); return rk; } static void rijndaelDecrypt(const u32 rk[/*44*/], const u8 ct[16], u8 pt[16]) { u32 s0, s1, s2, s3, t0, t1, t2, t3; const int Nr = 10; #ifndef FULL_UNROLL int r; #endif /* ?FULL_UNROLL */ /* * map byte array block to cipher state * and add initial round key: */ s0 = GETU32(ct ) ^ rk[0]; s1 = GETU32(ct + 4) ^ rk[1]; s2 = GETU32(ct + 8) ^ rk[2]; s3 = GETU32(ct + 12) ^ rk[3]; #define ROUND(i,d,s) \ d##0 = TD0(s##0) ^ TD1(s##3) ^ TD2(s##2) ^ TD3(s##1) ^ rk[4 * i]; \ d##1 = TD0(s##1) ^ TD1(s##0) ^ TD2(s##3) ^ TD3(s##2) ^ rk[4 * i + 1]; \ d##2 = TD0(s##2) ^ TD1(s##1) ^ TD2(s##0) ^ TD3(s##3) ^ rk[4 * i + 2]; \ d##3 = TD0(s##3) ^ TD1(s##2) ^ TD2(s##1) ^ TD3(s##0) ^ rk[4 * i + 3] #ifdef FULL_UNROLL ROUND(1,t,s); ROUND(2,s,t); ROUND(3,t,s); ROUND(4,s,t); ROUND(5,t,s); ROUND(6,s,t); ROUND(7,t,s); ROUND(8,s,t); ROUND(9,t,s); rk += Nr << 2; #else /* !FULL_UNROLL */ /* Nr - 1 full rounds: */ r = Nr >> 1; for (;;) { ROUND(1,t,s); rk += 8; if (--r == 0) break; ROUND(0,s,t); } #endif /* ?FULL_UNROLL */ #undef ROUND /* * apply last round and * map cipher state to byte array block: */ s0 = TD41(t0) ^ TD42(t3) ^ TD43(t2) ^ TD44(t1) ^ rk[0]; PUTU32(pt , s0); s1 = TD41(t1) ^ TD42(t0) ^ TD43(t3) ^ TD44(t2) ^ rk[1]; PUTU32(pt + 4, s1); s2 = TD41(t2) ^ TD42(t1) ^ TD43(t0) ^ TD44(t3) ^ rk[2]; PUTU32(pt + 8, s2); s3 = TD41(t3) ^ TD42(t2) ^ TD43(t1) ^ TD44(t0) ^ rk[3]; PUTU32(pt + 12, s3); } void aes_decrypt(void *ctx, const u8 *crypt, u8 *plain) { rijndaelDecrypt(ctx, crypt, plain); } void aes_decrypt_deinit(void *ctx) { os_memset(ctx, 0, AES_PRIV_SIZE); os_free(ctx); }
/** * Copyright (C) 2011 Felipe Contreras * * 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 PN_AUTH_H #define PN_AUTH_H typedef struct PnAuth PnAuth; typedef void (*PnAuthCb) (PnAuth *auth, void *data); #include "session.h" struct MsnSession; PnAuth *pn_auth_new (MsnSession *session); void pn_auth_free (PnAuth *oim_session); void pn_auth_get_ticket (PnAuth *auth, int id, PnAuthCb cb, void *cb_data); #endif /* PN_AUTH_H */
/* ######################################################################## # # # Collector: Tag based file management for Linux # # # # Copyright 2015 Brendan Whitfield (bcw7044@rit.edu) # # # ######################################################################## # # # filestore.h # # # # This file is part of Collector # # # # Collector 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. # # # # Collector 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 Collector. If not, see <http://www.gnu.org/licenses/>. # # # ######################################################################## */ #pragma once #include <unordered_map> #include <filestore/types.h> //map strings to TagEntry //primary data structure for the filestore typedef std::unordered_map<Tag, TagEntry*> TagMap; class FileStore { public: FileStore(); ~FileStore(); //primary accessors Selection* select(Selector* selector); void operation(Operation* operation); private: FileVector files; TagMap tags; bool has_tag(const Tag & tag); void insert_file(File* file); void add_tag(Selection* const selection, const Tag & tag); void remove_tag(Selection* const selection, const Tag & tag); };
/* * @file boundary_mesh.h * @brief virtual base class of SurfaceMesh and Polygon * @author Fei Zhu * * This file is part of Physika, a versatile physics simulation library. * Copyright (C) 2013- Physika Group. * * This Source Code Form is subject to the terms of the GNU General Public License v2.0. * If a copy of the GPL was not distributed with this file, you can obtain one at: * http://www.gnu.org/licenses/gpl-2.0.html * */ #ifndef PHYSIKA_GEOMETRY_BOUNDARY_MESHES_BOUNDARY_MESH_H_ #define PHYSIKA_GEOMETRY_BOUNDARY_MESHES_BOUNDARY_MESH_H_ namespace Physika{ class BoundaryMesh { public: BoundaryMesh(){} virtual ~BoundaryMesh(){} virtual unsigned int dims() const = 0; }; } //end of namespace Physika #endif //PHYSIKA_GEOMETRY_BOUNDARY_MESHES_BOUNDARY_MESH_H_
/* * filter registration * Copyright (c) 2008 Vitor Sessak * * This file is part of FFmpeg. * * FFmpeg 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. * * FFmpeg 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 FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "avfilter.h" #define REGISTER_FILTER(X,x,y) { \ extern AVFilter avfilter_##y##_##x ; \ if(CONFIG_##X##_FILTER ) avfilter_register(&avfilter_##y##_##x ); } void avfilter_register_all(void) { static int initialized; if (initialized) return; initialized = 1; REGISTER_FILTER (ACONVERT, aconvert, af); REGISTER_FILTER (AFORMAT, aformat, af); REGISTER_FILTER (ANULL, anull, af); REGISTER_FILTER (ARESAMPLE, aresample, af); REGISTER_FILTER (ASHOWINFO, ashowinfo, af); REGISTER_FILTER (EARWAX, earwax, af); REGISTER_FILTER (PAN, pan, af); REGISTER_FILTER (VOLUME, volume, af); REGISTER_FILTER (ABUFFER, abuffer, asrc); REGISTER_FILTER (AEVALSRC, aevalsrc, asrc); REGISTER_FILTER (AMOVIE, amovie, asrc); REGISTER_FILTER (ANULLSRC, anullsrc, asrc); REGISTER_FILTER (ABUFFERSINK, abuffersink, asink); REGISTER_FILTER (ANULLSINK, anullsink, asink); REGISTER_FILTER (ASS, ass, vf); REGISTER_FILTER (BLACKFRAME, blackframe, vf); REGISTER_FILTER (BOXBLUR, boxblur, vf); REGISTER_FILTER (COPY, copy, vf); REGISTER_FILTER (CROP, crop, vf); REGISTER_FILTER (CROPDETECT, cropdetect, vf); REGISTER_FILTER (DELOGO, delogo, vf); REGISTER_FILTER (DESHAKE, deshake, vf); REGISTER_FILTER (DRAWBOX, drawbox, vf); REGISTER_FILTER (DRAWTEXT, drawtext, vf); REGISTER_FILTER (FADE, fade, vf); REGISTER_FILTER (FIELDORDER, fieldorder, vf); REGISTER_FILTER (FIFO, fifo, vf); REGISTER_FILTER (FORMAT, format, vf); REGISTER_FILTER (FREI0R, frei0r, vf); REGISTER_FILTER (GRADFUN, gradfun, vf); REGISTER_FILTER (HFLIP, hflip, vf); REGISTER_FILTER (HQDN3D, hqdn3d, vf); REGISTER_FILTER (LUT, lut, vf); REGISTER_FILTER (LUTRGB, lutrgb, vf); REGISTER_FILTER (LUTYUV, lutyuv, vf); REGISTER_FILTER (MP, mp, vf); REGISTER_FILTER (NEGATE, negate, vf); REGISTER_FILTER (NOFORMAT, noformat, vf); REGISTER_FILTER (NULL, null, vf); REGISTER_FILTER (OCV, ocv, vf); REGISTER_FILTER (OVERLAY, overlay, vf); REGISTER_FILTER (PAD, pad, vf); REGISTER_FILTER (PIXDESCTEST, pixdesctest, vf); REGISTER_FILTER (SCALE, scale, vf); REGISTER_FILTER (SELECT, select, vf); REGISTER_FILTER (SETDAR, setdar, vf); REGISTER_FILTER (SETPTS, setpts, vf); REGISTER_FILTER (SETSAR, setsar, vf); REGISTER_FILTER (SETTB, settb, vf); REGISTER_FILTER (SHOWINFO, showinfo, vf); REGISTER_FILTER (SLICIFY, slicify, vf); REGISTER_FILTER (SPLIT, split, vf); REGISTER_FILTER (TRANSPOSE, transpose, vf); REGISTER_FILTER (UNSHARP, unsharp, vf); REGISTER_FILTER (VFLIP, vflip, vf); REGISTER_FILTER (YADIF, yadif, vf); REGISTER_FILTER (BUFFER, buffer, vsrc); REGISTER_FILTER (CELLAUTO, cellauto, vsrc); REGISTER_FILTER (COLOR, color, vsrc); REGISTER_FILTER (FREI0R, frei0r_src, vsrc); REGISTER_FILTER (LIFE, life, vsrc); REGISTER_FILTER (MANDELBROT, mandelbrot, vsrc); REGISTER_FILTER (MOVIE, movie, vsrc); REGISTER_FILTER (MPTESTSRC, mptestsrc, vsrc); REGISTER_FILTER (NULLSRC, nullsrc, vsrc); REGISTER_FILTER (RGBTESTSRC, rgbtestsrc, vsrc); REGISTER_FILTER (TESTSRC, testsrc, vsrc); REGISTER_FILTER (BUFFERSINK, buffersink, vsink); REGISTER_FILTER (NULLSINK, nullsink, vsink); }
/* * Support for 32-bit Linux for S390 ELF binaries. * * Copyright (C) 2000 IBM Deutschland Entwicklung GmbH, IBM Corporation * Author(s): Gerhard Tonn (ton@de.ibm.com) * * Heavily inspired by the 32-bit Sparc compat code which is * Copyright (C) 1995, 1996, 1997, 1998 David S. Miller (davem@redhat.com) * Copyright (C) 1995, 1996, 1997, 1998 Jakub Jelinek (jj@ultra.linux.cz) */ #define __ASMS390_ELF_H #include <linux/time.h> /* * These are used to set parameters in the core dumps. */ #define ELF_CLASS ELFCLASS32 #define ELF_DATA ELFDATA2MSB #define ELF_ARCH EM_S390 /* * This is used to ensure we don't load something for the wrong architecture. */ #define elf_check_arch(x) \ (((x)->e_machine == EM_S390 || (x)->e_machine == EM_S390_OLD) \ && (x)->e_ident[EI_CLASS] == ELF_CLASS) /* ELF register definitions */ #define NUM_GPRS 16 #define NUM_FPRS 16 #define NUM_ACRS 16 /* For SVR4/S390 the function pointer to be registered with `atexit` is passed in R14. */ #define ELF_PLAT_INIT(_r, load_addr) \ do { \ _r->gprs[14] = 0; \ } while(0) #define USE_ELF_CORE_DUMP #define ELF_EXEC_PAGESIZE 4096 /* This is the location that an ET_DYN program is loaded if exec'ed. Typical use of this is to invoke "./ld.so someprog" to test out a new version of the loader. We need to make sure that it is out of the way of the program that it will "exec", and that there is sufficient room for the brk. */ #define ELF_ET_DYN_BASE (TASK_SIZE / 3 * 2) /* Wow, the "main" arch needs arch dependent functions too.. :) */ /* regs is struct pt_regs, pr_reg is elf_gregset_t (which is now struct_user_regs, they are different) */ #define ELF_CORE_COPY_REGS(pr_reg, regs) dump_regs32(regs, &pr_reg); #define ELF_CORE_COPY_TASK_REGS(tsk, regs) dump_task_regs32(tsk, regs) #define ELF_CORE_COPY_FPREGS(tsk, fpregs) dump_task_fpu(tsk, fpregs) /* This yields a mask that user programs can use to figure out what instruction set this CPU supports. */ #define ELF_HWCAP (0) /* This yields a string that ld.so will use to load implementation specific libraries for optimization. This is more specific in intent than poking at uname or /proc/cpuinfo. For the moment, we have only optimizations for the Intel generations, but that could change... */ #define ELF_PLATFORM (NULL) #define SET_PERSONALITY(ex, ibcs2) \ do { \ if (ibcs2) \ set_personality(PER_SVR4); \ else if (current->personality != PER_LINUX32) \ set_personality(PER_LINUX); \ set_thread_flag(TIF_31BIT); \ } while (0) #include "compat_linux.h" typedef _s390_fp_regs32 elf_fpregset_t; typedef struct { _psw_t32 psw; __u32 gprs[__NUM_GPRS]; __u32 acrs[__NUM_ACRS]; __u32 orig_gpr2; } s390_regs32; typedef s390_regs32 elf_gregset_t; static inline int dump_regs32(struct pt_regs *ptregs, elf_gregset_t *regs) { int i; memcpy(&regs->psw.mask, &ptregs->psw.mask, 4); memcpy(&regs->psw.addr, (char *)&ptregs->psw.addr + 4, 4); for (i = 0; i < NUM_GPRS; i++) regs->gprs[i] = ptregs->gprs[i]; save_access_regs(regs->acrs); regs->orig_gpr2 = ptregs->orig_gpr2; return 1; } static inline int dump_task_regs32(struct task_struct *tsk, elf_gregset_t *regs) { struct pt_regs *ptregs = task_pt_regs(tsk); int i; memcpy(&regs->psw.mask, &ptregs->psw.mask, 4); memcpy(&regs->psw.addr, (char *)&ptregs->psw.addr + 4, 4); for (i = 0; i < NUM_GPRS; i++) regs->gprs[i] = ptregs->gprs[i]; memcpy(regs->acrs, tsk->thread.acrs, sizeof(regs->acrs)); regs->orig_gpr2 = ptregs->orig_gpr2; return 1; } static inline int dump_task_fpu(struct task_struct *tsk, elf_fpregset_t *fpregs) { if (tsk == current) save_fp_regs((s390_fp_regs *) fpregs); else memcpy(fpregs, &tsk->thread.fp_regs, sizeof(elf_fpregset_t)); return 1; } #include <asm/processor.h> #include <linux/module.h> #include <linux/config.h> #include <linux/elfcore.h> #include <linux/binfmts.h> #include <linux/compat.h> #define elf_prstatus elf_prstatus32 struct elf_prstatus32 { struct elf_siginfo pr_info; /* Info associated with signal */ short pr_cursig; /* Current signal */ u32 pr_sigpend; /* Set of pending signals */ u32 pr_sighold; /* Set of held signals */ pid_t pr_pid; pid_t pr_ppid; pid_t pr_pgrp; pid_t pr_sid; struct compat_timeval pr_utime; /* User time */ struct compat_timeval pr_stime; /* System time */ struct compat_timeval pr_cutime; /* Cumulative user time */ struct compat_timeval pr_cstime; /* Cumulative system time */ elf_gregset_t pr_reg; /* GP registers */ int pr_fpvalid; /* True if math co-processor being used. */ }; #define elf_prpsinfo elf_prpsinfo32 struct elf_prpsinfo32 { char pr_state; /* numeric process state */ char pr_sname; /* char for pr_state */ char pr_zomb; /* zombie */ char pr_nice; /* nice val */ u32 pr_flag; /* flags */ u16 pr_uid; u16 pr_gid; pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid; /* Lots missing */ char pr_fname[16]; /* filename of executable */ char pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */ }; #include <linux/highuid.h> #undef NEW_TO_OLD_UID #undef NEW_TO_OLD_GID #define NEW_TO_OLD_UID(uid) ((uid) > 65535) ? (u16)overflowuid : (u16)(uid) #define NEW_TO_OLD_GID(gid) ((gid) > 65535) ? (u16)overflowgid : (u16)(gid) #define elf_addr_t u32 /* #define init_elf_binfmt init_elf32_binfmt */ #undef start_thread #define start_thread start_thread31 MODULE_DESCRIPTION("Binary format loader for compatibility with 32bit Linux for S390 binaries," " Copyright 2000 IBM Corporation"); MODULE_AUTHOR("Gerhard Tonn <ton@de.ibm.com>"); #undef MODULE_DESCRIPTION #undef MODULE_AUTHOR #undef cputime_to_timeval #define cputime_to_timeval cputime_to_compat_timeval static __inline__ void cputime_to_compat_timeval(const cputime_t cputime, struct compat_timeval *value) { value->tv_usec = cputime % 1000000; value->tv_sec = cputime / 1000000; } #include "../../../fs/binfmt_elf.c"
/* * Copyright (C) Huawei Technologies Co., Ltd. 2012-2015. All rights reserved. * foss@huawei.com * * If distributed as part of the Linux kernel, the following license terms * apply: * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License version 2 and * * only version 2 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * * Otherwise, the following license terms apply: * * * 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 Huawei 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 _OSL_ERR_H #define _OSL_ERR_H #ifdef __KERNEL__ #include <linux/err.h> #else #define __must_check __attribute__((warn_unused_result)) static inline void * __must_check ERR_PTR(long error) { return (void *) error; } static inline long __must_check PTR_ERR(const void *ptr) { return (long) ptr; } #ifndef IS_ERR #define MAX_ERRNO 4095 #define IS_ERR_VALUE(x) ((x) >= (unsigned long)-MAX_ERRNO) static inline long __must_check IS_ERR(const void *ptr) { return IS_ERR_VALUE((unsigned long)ptr); } #endif #endif /* __KERNEL__ */ #endif /*_OSL_ERR_H*/
// SPDX-License-Identifier: GPL-2.0-or-later /* * Copyright (C) 2019 Cyril Hrubis <chrubis@suse.cz> */ /* * This is a basic functional test for RWF_NOWAIT flag, we are attempting to * force preadv2() either to return a short read or EAGAIN with three * concurently running threads: * * nowait_reader: reads from a random offset from a random file with * RWF_NOWAIT flag and expects to get EAGAIN and short * read sooner or later * * writer_thread: rewrites random file in order to keep the underlying device * busy so that pages evicted from cache cannot be faulted * immediately * * cache_dropper: attempts to evict pages from a cache in order for reader to * hit evicted page sooner or later */ /* * If test fails with EOPNOTSUPP you have likely hit a glibc bug: * * https://sourceware.org/bugzilla/show_bug.cgi?id=23579 * * Which can be worked around by calling preadv2() directly by syscall() such as: * * static ssize_t sys_preadv2(int fd, const struct iovec *iov, int iovcnt, * off_t offset, int flags) * { * return syscall(SYS_preadv2, fd, iov, iovcnt, offset, offset>>32, flags); * } * */ #define _GNU_SOURCE #include <string.h> #include <sys/uio.h> #include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <pthread.h> #include "tst_test.h" #include "tst_safe_pthread.h" #include "lapi/preadv2.h" #define CHUNK_SZ 4123 #define CHUNKS 60 #define MNTPOINT "mntpoint" #define FILES 500 static int fds[FILES]; static volatile int stop; static void drop_caches(void) { SAFE_FILE_PRINTF("/proc/sys/vm/drop_caches", "3"); } /* * All files are divided in chunks each filled with the same bytes starting with * '0' at offset 0 and with increasing value on each next chunk. * * 000....000111....111.......AAA......AAA... * | chunk0 || chunk1 | ... | chunk17 | */ static int verify_short_read(struct iovec *iov, size_t iov_cnt, off_t off, size_t size) { unsigned int i; size_t j, checked = 0; for (i = 0; i < iov_cnt; i++) { char *buf = iov[i].iov_base; for (j = 0; j < iov[i].iov_len; j++) { char exp_val = '0' + (off + checked)/CHUNK_SZ; if (exp_val != buf[j]) { tst_res(TFAIL, "Wrong value read pos %zu size %zu %c (%i) %c (%i)!", checked, size, exp_val, exp_val, isprint(buf[j]) ? buf[j] : ' ', buf[j]); return 1; } if (++checked >= size) return 0; } } return 0; } static void *nowait_reader(void *unused LTP_ATTRIBUTE_UNUSED) { char buf1[CHUNK_SZ/2]; char buf2[CHUNK_SZ]; unsigned int full_read_cnt = 0, eagain_cnt = 0; unsigned int short_read_cnt = 0, zero_read_cnt = 0; struct iovec rd_iovec[] = { {buf1, sizeof(buf1)}, {buf2, sizeof(buf2)}, }; while (!stop) { if (eagain_cnt >= 100 && short_read_cnt >= 10) stop = 1; /* Ensure short reads doesn't happen because of tripping on EOF */ off_t off = random() % ((CHUNKS - 2) * CHUNK_SZ); int fd = fds[random() % FILES]; TEST(preadv2(fd, rd_iovec, 2, off, RWF_NOWAIT)); if (TST_RET < 0) { if (TST_ERR != EAGAIN) tst_brk(TBROK | TTERRNO, "preadv2() failed"); eagain_cnt++; continue; } if (TST_RET == 0) { zero_read_cnt++; continue; } if (TST_RET != CHUNK_SZ + CHUNK_SZ/2) { verify_short_read(rd_iovec, 2, off, TST_RET); short_read_cnt++; continue; } full_read_cnt++; } tst_res(TINFO, "Number of full_reads %u, short reads %u, zero len reads %u, EAGAIN(s) %u", full_read_cnt, short_read_cnt, zero_read_cnt, eagain_cnt); return (void*)(long)eagain_cnt; } static void *writer_thread(void *unused) { char buf[CHUNK_SZ]; unsigned int j, write_cnt = 0; struct iovec wr_iovec[] = { {buf, sizeof(buf)}, }; while (!stop) { int fd = fds[random() % FILES]; for (j = 0; j < CHUNKS; j++) { memset(buf, '0' + j, sizeof(buf)); off_t off = CHUNK_SZ * j; if (pwritev(fd, wr_iovec, 1, off) < 0) { if (errno == EBADF) { tst_res(TINFO | TERRNO, "FDs closed, exiting..."); return unused; } tst_brk(TBROK | TERRNO, "pwritev()"); } write_cnt++; } } tst_res(TINFO, "Number of writes %u", write_cnt); return unused; } static void *cache_dropper(void *unused) { unsigned int drop_cnt = 0; while (!stop) { drop_caches(); drop_cnt++; } tst_res(TINFO, "Cache dropped %u times", drop_cnt); return unused; } static void verify_preadv2(void) { pthread_t reader, dropper, writer; unsigned int max_runtime = 600; void *eagains; stop = 0; drop_caches(); SAFE_PTHREAD_CREATE(&dropper, NULL, cache_dropper, NULL); SAFE_PTHREAD_CREATE(&reader, NULL, nowait_reader, NULL); SAFE_PTHREAD_CREATE(&writer, NULL, writer_thread, NULL); while (!stop && max_runtime-- > 0) usleep(100000); stop = 1; SAFE_PTHREAD_JOIN(reader, &eagains); SAFE_PTHREAD_JOIN(dropper, NULL); SAFE_PTHREAD_JOIN(writer, NULL); if (eagains) tst_res(TPASS, "Got some EAGAIN"); else tst_res(TFAIL, "Haven't got EAGAIN"); } static void check_preadv2_nowait(int fd) { char buf[1]; struct iovec iovec[] = { {buf, sizeof(buf)}, }; TEST(preadv2(fd, iovec, 1, 0, RWF_NOWAIT)); if (TST_ERR == EOPNOTSUPP) tst_brk(TCONF | TTERRNO, "preadv2()"); } static void setup(void) { char path[1024]; char buf[CHUNK_SZ]; unsigned int i; char j; for (i = 0; i < FILES; i++) { snprintf(path, sizeof(path), MNTPOINT"/file_%i", i); fds[i] = SAFE_OPEN(path, O_RDWR | O_CREAT, 0644); if (i == 0) check_preadv2_nowait(fds[i]); for (j = 0; j < CHUNKS; j++) { memset(buf, '0' + j, sizeof(buf)); SAFE_WRITE(1, fds[i], buf, sizeof(buf)); } } } static void do_cleanup(void) { unsigned int i; for (i = 0; i < FILES; i++) { if (fds[i] > 0) SAFE_CLOSE(fds[i]); } } TST_DECLARE_ONCE_FN(cleanup, do_cleanup); static struct tst_test test = { .setup = setup, .cleanup = cleanup, .test_all = verify_preadv2, .mntpoint = MNTPOINT, .mount_device = 1, .all_filesystems = 1, .needs_root = 1, };
/* * Copyright (C) 2005-2013 Team XBMC * http://xbmc.org * * This Program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This Program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with XBMC; see the file COPYING. If not, see * <http://www.gnu.org/licenses/>. * */ #pragma once #include "windowing/WinSystem.h" #include "utils/Stopwatch.h" #include "threads/CriticalSection.h" #include "threads/SystemClock.h" #include "settings/lib/ISettingCallback.h" #include "X11/Xlib.h" #include "X11/Xutil.h" class IDispResource; class CWinSystemX11 : public CWinSystemBase { public: CWinSystemX11(); virtual ~CWinSystemX11(); // CWinSystemBase bool InitWindowSystem() override; bool DestroyWindowSystem() override; bool CreateNewWindow(const std::string& name, bool fullScreen, RESOLUTION_INFO& res, PHANDLE_EVENT_FUNC userFunction) override; bool DestroyWindow() override; bool ResizeWindow(int newWidth, int newHeight, int newLeft, int newTop) override; bool SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool blankOtherDisplays) override; void UpdateResolutions() override; int GetNumScreens() override { return 1; } int GetCurrentScreen() override { return m_nScreen; } void ShowOSMouse(bool show) override; void ResetOSScreensaver() override; bool EnableFrameLimiter() override; void EnableSystemScreenSaver(bool bEnable) override; void NotifyAppActiveChange(bool bActivated) override; void NotifyAppFocusChange(bool bGaining) override; bool Minimize() override; bool Restore() override; bool Hide() override; bool Show(bool raise = true) override; virtual void Register(IDispResource *resource); virtual void Unregister(IDispResource *resource); bool HasCalibration(const RESOLUTION_INFO &resInfo) override; // Local to WinSystemX11 only Display* GetDisplay() { return m_dpy; } void NotifyXRREvent(); void GetConnectedOutputs(std::vector<std::string> *outputs); bool IsCurrentOutput(std::string output); void RecreateWindow(); int GetCrtc() { return m_crtc; } protected: virtual bool SetWindow(int width, int height, bool fullscreen, const std::string &output, int *winstate = NULL) = 0; virtual XVisualInfo* GetVisual() = 0; void OnLostDevice(); Window m_glWindow, m_mainWindow; Display *m_dpy; Cursor m_invisibleCursor; Pixmap m_icon; bool m_bIsRotated; bool m_bWasFullScreenBeforeMinimize; bool m_minimized; bool m_bIgnoreNextFocusMessage; CCriticalSection m_resourceSection; std::vector<IDispResource*> m_resources; bool m_delayDispReset; XbmcThreads::EndTime m_dispResetTimer; std::string m_currentOutput; std::string m_userOutput; bool m_windowDirty; bool m_bIsInternalXrr; int m_MouseX, m_MouseY; int m_crtc; private: bool IsSuitableVisual(XVisualInfo *vInfo); static int XErrorHandler(Display* dpy, XErrorEvent* error); bool CreateIconPixmap(); bool HasWindowManager(); void UpdateCrtc(); CStopWatch m_screensaverReset; };
/**************************************************************************** ** ** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. ** ** This file is part of an example program for Qt. This example ** program may be used, distributed and modified without limitation. ** *****************************************************************************/ /**************************************************************************** ** ** The GLObjectWindow contains a GLBox and three sliders connected to ** the GLBox's rotation slots. ** ****************************************************************************/ #ifndef GLOBJWIN_H #define GLOBJWIN_H #include <qwidget.h> class GLBox; class GLObjectWindow : public QWidget { Q_OBJECT public: GLObjectWindow( QWidget* parent = 0, const char* name = 0 ); protected slots: void deleteFirstWidget(); private: GLBox* c1; GLBox* c2; }; #endif // GLOBJWIN_H
/* Copyright (c) 2004 Gregory Kuhlmann, Peter Stone University of Texas at Austin 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 of Amsterdam 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 _WORLD_MODEL_SAY_MSG_TYPES_ #define _WORLD_MODEL_SAY_MSG_TYPES_ #include "WorldModel.h" #include "SayMsgTypes.h" class WMOurPos : public OurPos { private: WorldModel *WM; public: WMOurPos( WorldModel *wm ); void process(); } ; class WMBallInfo : public BallInfo { private: WorldModel *WM; public: WMBallInfo( WorldModel *wm ); void process(); } ; class WMWeHaveBall : public WeHaveBall { private: WorldModel *WM; public: WMWeHaveBall( WorldModel *wm ); void process(); } ; class WMOppHasBall : public OppHasBall { private: WorldModel *WM; public: WMOppHasBall( WorldModel *wm ); void process(); } ; class WMPassToPlayer : public PassToPlayer { private: WorldModel *WM; public: WMPassToPlayer( WorldModel *wm ); void process(); } ; class WMPassToCoord : public PassToCoord { private: WorldModel *WM; public: WMPassToCoord( WorldModel *wm ); void process(); } ; class WMWantPass : public WantPass { private: WorldModel *WM; public: WMWantPass( WorldModel *wm ); void process(); } ; class WMOppPos : public OppPos { private: WorldModel *WM; public: WMOppPos( WorldModel *wm ); void process(); } ; class WMTeammatePos : public TeammatePos { private: WorldModel *WM; public: WMTeammatePos( WorldModel *wm ); void process(); } ; #endif
#include "../../corelibs/U2Lang/src/support/MarkerUtils.h"
/* Copyright 2004,2007,2009,2010 ENSEIRB, INRIA & CNRS ** ** This file is part of the Scotch software package for static mapping, ** graph partitioning and sparse matrix ordering. ** ** This software is governed by the CeCILL-C license under French law ** and abiding by the rules of distribution of free software. You can ** use, modify and/or redistribute the software under the terms of the ** CeCILL-C license as circulated by CEA, CNRS and INRIA at the following ** URL: "http://www.cecill.info". ** ** As a counterpart to the access to the source code and rights to copy, ** modify and redistribute granted by the license, users are provided ** only with a limited warranty and the software's author, the holder of ** the economic rights, and the successive licensors have only limited ** liability. ** ** In this respect, the user's attention is drawn to the risks associated ** with loading, using, modifying and/or developing or reproducing the ** software by the user in light of its specific status of free software, ** that may mean that it is complicated to manipulate, and that also ** therefore means that it is reserved for developers and experienced ** professionals having in-depth computer knowledge. Users are therefore ** encouraged to load and test the software's suitability as regards ** their requirements in conditions enabling the security of their ** systems and/or data to be ensured and, more generally, to use and ** operate it in the same conditions as regards security. ** ** The fact that you are presently reading this means that you have had ** knowledge of the CeCILL-C license and that you accept its terms. */ /************************************************************/ /** **/ /** NAME : hmesh_order_bl.h **/ /** **/ /** AUTHOR : Francois PELLEGRINI **/ /** **/ /** FUNCTION : These lines are the data declaration **/ /** for the block splitting algorithm. **/ /** **/ /** DATES : # Version 4.0 : from : 28 sep 2002 **/ /** to 04 jan 2005 **/ /** # Version 5.1 : from : 01 oct 2009 **/ /** to : 04 nov 2010 **/ /** **/ /************************************************************/ /* ** The type and structure definitions. */ /*+ This structure holds the method parameters. +*/ typedef struct HmeshOrderBlParam_ { Strat * strat; /*+ Ordering strategy +*/ INT cblkmin; /*+ Block splitting size +*/ } HmeshOrderBlParam; /* ** The function prototypes. */ #ifndef HMESH_ORDER_BL #define static #endif int hmeshOrderBl (const Hmesh * const, Order * const, const Gnum, OrderCblk * const, const HmeshOrderBlParam * const); #undef static
/* * Copyright 2008-2009 NVIDIA Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /*! \file lanczos_options.h * \brief Lanczos options */ #pragma once #include <cusp/detail/config.h> #include <cusp/array1d.h> #include <limits> #include <iostream> namespace cusp { namespace eigen { typedef enum { SA, LA, BE, } SpectrumPart; typedef enum { None, Full, } ReorthStrategy; template<typename ValueType> class lanczos_options { public: bool computeEigVecs; bool verbose; size_t minIter; size_t maxIter; size_t extraIter; size_t stride; size_t defaultMinIterFactor; size_t defaultMaxIterFactor; ValueType eigLowCut; ValueType eigHighCut; ValueType memoryExpansionFactor; ValueType doubleReorthGamma; ValueType localReorthGamma; ValueType tol; SpectrumPart eigPart; ReorthStrategy reorth; lanczos_options() : computeEigVecs(false), verbose(false), minIter(0), maxIter(0), extraIter(10), stride(10), reorth(None), eigPart(LA), memoryExpansionFactor(1.2), tol(1e-4), doubleReorthGamma(1.0/std::sqrt(2.0)), localReorthGamma(1.0/std::sqrt(2.0)), defaultMinIterFactor(5), defaultMaxIterFactor(50), eigLowCut(std::numeric_limits<ValueType>::infinity()), eigHighCut(-std::numeric_limits<ValueType>::infinity()) {} lanczos_options(const lanczos_options<ValueType>& opts); void print(void); }; } // end namespace eigen } // end namespace cusp #include <cusp/eigen/detail/lanczos_options.inl>
/* * Copyright © 2010 M Joonas Pihlaja * * 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. * * Author: M Joonas Pihlaja <jpihlaja@cc.helsinki.fi> */ #include "cairo-test.h" /* Test that we can simultaneously downscale and extend a surface * pattern. Reported by Franz Schmid to the cairo mailing list as a * regression in 1.9.6: * * http://lists.cairographics.org/archives/cairo/2010-February/019492.html */ static cairo_test_status_t draw_with_extend (cairo_t *cr, int w, int h, cairo_extend_t extend) { cairo_pattern_t *pattern; cairo_set_source_rgb (cr, 1,1,1); cairo_paint (cr); cairo_push_group_with_content (cr, CAIRO_CONTENT_COLOR); { /* A two by two checkerboard with black, red and yellow * cells. */ cairo_set_source_rgb (cr, 1,0,0); cairo_rectangle (cr, w/2, 0, w-w/2, h/2); cairo_fill (cr); cairo_set_source_rgb (cr, 1,1,0); cairo_rectangle (cr, 0, h/2, w/2, h-h/2); cairo_fill (cr); } pattern = cairo_pop_group (cr); cairo_pattern_set_extend(pattern, extend); cairo_scale (cr, 0.5, 0.5); cairo_set_source (cr, pattern); cairo_paint (cr); cairo_pattern_destroy (pattern); return CAIRO_TEST_SUCCESS; } static cairo_test_status_t draw_repeat (cairo_t *cr, int w, int h) { return draw_with_extend (cr, w, h, CAIRO_EXTEND_REPEAT); } static cairo_test_status_t draw_none (cairo_t *cr, int w, int h) { return draw_with_extend (cr, w, h, CAIRO_EXTEND_NONE); } static cairo_test_status_t draw_reflect (cairo_t *cr, int w, int h) { return draw_with_extend (cr, w, h, CAIRO_EXTEND_REFLECT); } static cairo_test_status_t draw_pad (cairo_t *cr, int w, int h) { return draw_with_extend (cr, w, h, CAIRO_EXTEND_PAD); } CAIRO_TEST (surface_pattern_scale_down_extend_repeat, "Test interaction of downscaling a surface pattern and extend-repeat", "pattern, transform, extend", /* keywords */ NULL, /* requirements */ 100, 100, NULL, draw_repeat) CAIRO_TEST (surface_pattern_scale_down_extend_none, "Test interaction of downscaling a surface pattern and extend-none", "pattern, transform, extend", /* keywords */ NULL, /* requirements */ 100, 100, NULL, draw_none) CAIRO_TEST (surface_pattern_scale_down_extend_reflect, "Test interaction of downscaling a surface pattern and extend-reflect", "pattern, transform, extend", /* keywords */ NULL, /* requirements */ 100, 100, NULL, draw_reflect) CAIRO_TEST (surface_pattern_scale_down_extend_pad, "Test interaction of downscaling a surface pattern and extend-pad", "pattern, transform, extend", /* keywords */ NULL, /* requirements */ 100, 100, NULL, draw_pad)
#pragma once /* * Copyright (C) 2005-2013 Team XBMC * http://xbmc.org * * This Program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This Program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with XBMC; see the file COPYING. If not, see * <http://www.gnu.org/licenses/>. * */ #include "guilib/GUIDialog.h" #include "addons/IAddon.h" #include "utils/Job.h" class CGUIDialogAddonInfo : public CGUIDialog, public IJobCallback { public: CGUIDialogAddonInfo(void); virtual ~CGUIDialogAddonInfo(void); virtual bool OnMessage(CGUIMessage& message); virtual bool OnAction(const CAction &action); virtual CFileItemPtr GetCurrentListItem(int offset = 0) { return m_item; } virtual bool HasListItems() const { return true; } static bool ShowForItem(const CFileItemPtr& item); // job callback void OnJobComplete(unsigned int jobID, bool success, CJob* job); private: void OnInitWindow(); /*! \brief Set the item to display addon info on. \param item to display \return true if we can display information, false otherwise */ bool SetItem(const CFileItemPtr &item); void UpdateControls(); void OnUpdate(); void OnInstall(); void OnUninstall(); void OnEnable(bool enable); void OnSettings(); void OnChangeLog(); void OnSelect(); /*! Returns true if current addon can be opened (i.e is a plugin)*/ bool CanOpen() const; /*! Returns true if current addon can be run (i.e is a script)*/ bool CanRun() const; /*! * Returns true if current addon is of a type that can only have one activly * in use at a time and can be changed (e.g skins)*/ bool CanUse() const; /*! \brief check if the add-on is a dependency of others, and if so prompt the user. \param heading the label for the heading of the prompt dialog \param line2 the action that could not be completed. \return true if prompted, false otherwise. */ bool PromptIfDependency(int heading, int line2); CFileItemPtr m_item; ADDON::AddonPtr m_addon; ADDON::AddonPtr m_localAddon; unsigned int m_jobid; bool m_changelog; };
#include "hieth.h" #include "mdio.h" #include "mac.h" #include "ctrl.h" #include "glb.h" int hieth_port_init(struct hieth_netdev_local *ld, int port) { /* HW DEFAULT RX-PKT-LEN-RANGE [42,1518] */ /* HW MAC FILTER TABLE DISABLE */ hieth_assert(port == ld->port); hieth_set_endian_mode(ld, HIETH_LITTLE_ENDIAN); hieth_set_linkstat(ld, 0); hieth_set_negmode(ld, HIETH_NEGMODE_CPUSET); /* MII or RMII mode */ hieth_set_mii_mode(ld, ld->mdio_intf); /*clear all interrupt status*/ hieth_clear_irqstatus(ld, UD_BIT_NAME(BITS_IRQS_MASK)); /*disable interrupts*/ hieth_writel_bits(ld, 0, GLB_RW_IRQ_ENA, UD_BIT_NAME(BITS_IRQS_ENA)); hieth_irq_disable(ld, UD_BIT_NAME(BITS_IRQS_MASK)); /*disable vlan func*/ hieth_writel_bits(ld, 0, GLB_FWCTRL, BITS_VLAN_ENABLE); /*enable UpEther<->CPU*/ if (ld->port == UP_PORT) { hieth_writel_bits(ld, 1, GLB_FWCTRL, BITS_FW2CPU_ENA_UP); hieth_writel_bits(ld, 1, GLB_FWCTRL, BITS_FWALL2CPU_UP); hieth_writel_bits(ld, 1, GLB_MACTCTRL, BITS_BROAD2CPU_UP); } else if (ld->port == DOWN_PORT) { /*enable DownEther<->CPU*/ hieth_writel_bits(ld, 1, GLB_FWCTRL, BITS_FW2CPU_ENA_DOWN); hieth_writel_bits(ld, 1, GLB_FWCTRL, BITS_FWALL2CPU_DOWN); hieth_writel_bits(ld, 1, GLB_MACTCTRL, BITS_BROAD2CPU_DOWN); } else { BUG(); } hieth_set_mac_leadcode_cnt_limit(ld, 0); return 0; } /* vim: set ts=8 sw=8 tw=78: */
static char rcsid[] = "$Id: mrqmin.c,v 1.1.1.1 2005/06/14 04:38:33 svitak Exp $"; /* ** $Log: mrqmin.c,v $ ** Revision 1.1.1.1 2005/06/14 04:38:33 svitak ** Import from snapshot of CalTech CVS tree of June 8, 2005 ** ** Revision 1.1 1992/12/11 19:05:58 dhb ** Initial revision ** */ int mrqmin(x,y,sig,ndata,a,ma,lista,mfit,covar,alpha,chisq,funcs,alamda) float x[],y[],sig[],a[],**covar,**alpha,*chisq,*alamda; int ndata,ma,lista[],mfit; void (*funcs)(); { int k,kk,j,ihit; static float *da,*atry,**oneda,*beta,ochisq; float *vector(),**matrix(); void mrqcof(),covsrt(),nrerror(),free_matrix(),free_vector(); int gaussj(); if (*alamda < 0.0) { oneda=matrix(1,mfit,1,1); atry=vector(1,ma); da=vector(1,ma); beta=vector(1,ma); kk=mfit+1; for (j=1;j<=ma;j++) { ihit=0; for (k=1;k<=mfit;k++) if (lista[k] == j) ihit++; if (ihit == 0) { lista[kk++]=j; } else if (ihit > 1) { nrerror("Bad LISTA permutation in MRQMIN-1"); return(0); } } if (kk != ma+1) { nrerror("Bad LISTA permutation in MRQMIN-2"); return(0); } *alamda=0.001; mrqcof(x,y,sig,ndata,a,ma,lista,mfit,alpha,beta,chisq,funcs); ochisq=(*chisq); } for (j=1;j<=mfit;j++) { for (k=1;k<=mfit;k++) covar[j][k]=alpha[j][k]; covar[j][j]=alpha[j][j]*(1.0+(*alamda)); oneda[j][1]=beta[j]; } if (gaussj(covar,mfit,oneda,1) == 0) /* error */ return(0); for (j=1;j<=mfit;j++) da[j]=oneda[j][1]; if (*alamda == 0.0) { covsrt(covar,ma,lista,mfit); free_vector(beta,1,ma); free_vector(da,1,ma); free_vector(atry,1,ma); free_matrix(oneda,1,mfit,1,1); return(1); } for (j=1;j<=ma;j++) atry[j]=a[j]; for (j=1;j<=mfit;j++) atry[lista[j]] = a[lista[j]]+da[j]; mrqcof(x,y,sig,ndata,atry,ma,lista,mfit,covar,da,chisq,funcs); if (*chisq < ochisq) { *alamda *= 0.1; ochisq=(*chisq); for (j=1;j<=mfit;j++) { for (k=1;k<=mfit;k++) alpha[j][k]=covar[j][k]; beta[j]=da[j]; a[lista[j]]=atry[lista[j]]; } } else { *alamda *= 10.0; *chisq=ochisq; } return(1); }
/* * dspbridge/src/api/linux/Timer.c * * DSP-BIOS Bridge driver support functions for TI OMAP processors. * * Copyright (C) 2007 Texas Instruments, Inc. * * 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 version 2.1 of the License. * * This program is distributed .as is. WITHOUT ANY WARRANTY of any kind, * whether express or implied; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. */ /* * ======== Timer.c ======== * Description: * Source for API time measurements. For Debugging only * * *! Revision History *! ================= *! 01-May-2008 RG: Initial version * */ /* ----------------------------------- Host OS */ #include <perfutils.h> /* * ======== StartTimer ======== */ INT getTimeStamp(struct timeval *tv) { INT Result = 0; struct timezone tz; Result = gettimeofday(tv, &tz); if (Result != 0) fprintf(stdout, "FAIL: gettimeofday is failed\n"); return Result; } /* * ======== PrintStatisticsStartTimer ======== */ void PrintStatistics(struct timeval *tv_beg, struct timeval *tv_end, char *ModuleName, INT BufferSize) { ULONG totalTimeuSec = 0; if (tv_end->tv_usec < tv_beg->tv_usec) { tv_end->tv_usec += 1000000; tv_end->tv_sec -= 1; } totalTimeuSec = (tv_end->tv_sec - tv_beg->tv_sec) * 1000000 + (tv_end->tv_usec - tv_beg->tv_usec); fprintf(stdout, "LOG: *********BEGIN STATISTICS************" "********************\n"); fprintf(stdout, "LOG: MODULE: %s \n", ModuleName); if (BufferSize != 0) fprintf(stdout, "LOG: BufferSize: 0x%x \n", BufferSize); fprintf(stdout, "LOG: RESULT: %lu\n", totalTimeuSec); fprintf(stdout, "LOG: **********END STATISTICS*************" "******************\n"); }
/* AbiCollab - Code to enable the modification of remote documents. * Copyright (C) 2007 by Ryan Pavlik <abiryan@ryand.net> * Copyright (C) 2006 by Marc Maurer <uwog@uwog.net> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. */ #ifndef AP_WIN32DIALOG_COLLABORATIONADDACCOUNT_H #define AP_WIN32DIALOG_COLLABORATIONADDACCOUNT_H #include <vector> #include "xap_Win32DialogHelper.h" #include "ut_assert.h" #include <dialogs/xp/ap_Dialog_CollaborationAddAccount.h> #include "ap_Win32Res_DlgCollaborationAddAccount.rc2" class XAP_Frame; class AP_Win32Dialog_CollaborationAddAccount : public AP_Dialog_CollaborationAddAccount { public: AP_Win32Dialog_CollaborationAddAccount(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id); static XAP_Dialog * static_constructor(XAP_DialogFactory * pFactory, XAP_Dialog_Id id); void runModal(XAP_Frame * pFrame); static BOOL CALLBACK s_dlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); static BOOL CALLBACK s_detailsProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); BOOL _onInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam); BOOL _onCommand(HWND hWnd, WPARAM wParam, LPARAM lParam); BOOL _onDetailsCommand(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); BOOL detailsProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); static LRESULT s_detailsGetMsgProc(int nCode, WPARAM wParam, LPARAM lParam); LRESULT detailsGetMsgProc(int nCode, WPARAM wParam, LPARAM lParam); void setBackendValidity(bool valid); protected: XAP_Win32DialogHelper * m_pWin32Dialog; virtual void* _getEmbeddingParent(); virtual AccountHandler* _getActiveAccountHandler(); // Handles HINSTANCE m_hInstance; HWND m_hOk; LONG_PTR m_pOldDetailsProc; HWND m_hWnd; HWND m_hDetails; HHOOK m_hDetailsHook; // Data std::vector<AccountHandler*> m_vAccountTypeCombo; private: void _populateWindowData(void); }; #endif /* AP_WIN32DIALOG_COLLABORATIONADDACCOUNT_H */
/* * Copyright (C) 2010-2014, 2016-2017 ARM Limited. All rights reserved. * * This program is free software and is provided to you under the terms of the GNU General Public License version 2 * as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence. * * A copy of the licence is included with the program, and can also be obtained from Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef __MALI_KERNEL_L2_CACHE_H__ #define __MALI_KERNEL_L2_CACHE_H__ #include "mali_osk.h" #include "mali_hw_core.h" #define MALI_MAX_NUMBER_OF_L2_CACHE_CORES 3 /* Maximum 1 GP and 4 PP for an L2 cache core (Mali-400 MP4) */ #define MALI_MAX_NUMBER_OF_GROUPS_PER_L2_CACHE 5 /** * Definition of the L2 cache core struct * Used to track a L2 cache unit in the system. * Contains information about the mapping of the registers */ struct mali_l2_cache_core { /* Common HW core functionality */ struct mali_hw_core hw_core; /* Synchronize L2 cache access */ _mali_osk_spinlock_irq_t *lock; /* Unique core ID */ u32 core_id; /* The power domain this L2 cache belongs to */ struct mali_pm_domain *pm_domain; /* MALI_TRUE if power is on for this L2 cache */ mali_bool power_is_on; /* A "timestamp" to avoid unnecessary flushes */ u32 last_invalidated_id; /* Performance counter 0, MALI_HW_CORE_NO_COUNTER for disabled */ u32 counter_src0; /* Performance counter 1, MALI_HW_CORE_NO_COUNTER for disabled */ u32 counter_src1; /* * Performance counter 0 value base/offset * (allows accumulative reporting even after power off) */ u32 counter_value0_base; /* * Performance counter 0 value base/offset * (allows accumulative reporting even after power off) */ u32 counter_value1_base; /* Used by PM domains to link L2 caches of same domain */ _mali_osk_list_t pm_domain_list; }; _mali_osk_errcode_t mali_l2_cache_initialize(void); void mali_l2_cache_terminate(void); struct mali_l2_cache_core *mali_l2_cache_create( _mali_osk_resource_t *resource, u32 domain_index); void mali_l2_cache_delete(struct mali_l2_cache_core *cache); MALI_STATIC_INLINE u32 mali_l2_cache_get_id(struct mali_l2_cache_core *cache) { MALI_DEBUG_ASSERT_POINTER(cache); return cache->core_id; } MALI_STATIC_INLINE struct mali_pm_domain *mali_l2_cache_get_pm_domain( struct mali_l2_cache_core *cache) { MALI_DEBUG_ASSERT_POINTER(cache); return cache->pm_domain; } void mali_l2_cache_power_up(struct mali_l2_cache_core *cache); void mali_l2_cache_power_down(struct mali_l2_cache_core *cache); void mali_l2_cache_core_set_counter_src( struct mali_l2_cache_core *cache, u32 source_id, u32 counter); MALI_STATIC_INLINE u32 mali_l2_cache_core_get_counter_src0( struct mali_l2_cache_core *cache) { MALI_DEBUG_ASSERT_POINTER(cache); return cache->counter_src0; } MALI_STATIC_INLINE u32 mali_l2_cache_core_get_counter_src1( struct mali_l2_cache_core *cache) { MALI_DEBUG_ASSERT_POINTER(cache); return cache->counter_src1; } void mali_l2_cache_core_get_counter_values( struct mali_l2_cache_core *cache, u32 *src0, u32 *value0, u32 *src1, u32 *value1); struct mali_l2_cache_core *mali_l2_cache_core_get_glob_l2_core(u32 index); u32 mali_l2_cache_core_get_glob_num_l2_cores(void); struct mali_group *mali_l2_cache_get_group( struct mali_l2_cache_core *cache, u32 index); void mali_l2_cache_invalidate(struct mali_l2_cache_core *cache); void mali_l2_cache_invalidate_conditional( struct mali_l2_cache_core *cache, u32 id); void mali_l2_cache_invalidate_all(void); void mali_l2_cache_invalidate_all_pages(u32 *pages, u32 num_pages); #endif /* __MALI_KERNEL_L2_CACHE_H__ */
/* * jabberd - Jabber Open Source Server * Copyright (c) 2007 Tomasz Sterna * * 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, MA02111-1307USA */ /* * this sx plugin implements My IP Address extension * as described in http://delta.affinix.com/specs/xmppstream.html#myip */ #include "sx.h" /** sx features callback */ static void _sx_address_features(sx_t s, sx_plugin_t p, nad_t nad) { int ns; /* offer feature only when not authenticated yet */ if(s->state >= state_OPEN) return; _sx_debug(ZONE, "adding address feature"); ns = nad_add_namespace(nad, uri_ADDRESS_FEATURE, NULL); nad_append_elem(nad, ns, "address", 1); nad_append_cdata(nad, s->ip, strlen(s->ip), 2); } /** args: none */ int sx_address_init(sx_env_t env, sx_plugin_t p, va_list args) { log_debug(ZONE, "initialising address sx plugin"); p->features = _sx_address_features; return 0; }
/* * Copyright (C) by Olivier Goffart <ogoffart@woboq.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * 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. */ #pragma once #include <QDialog> #include <QTreeWidget> #include "accountfwd.h" class QTreeWidgetItem; class QTreeWidget; class QNetworkReply; class QLabel; namespace OCC { class Folder; /** * @brief The SelectiveSyncTreeView class * @ingroup gui */ class SelectiveSyncTreeView : public QTreeWidget { Q_OBJECT public: explicit SelectiveSyncTreeView(AccountPtr account, QWidget* parent = 0); /// Returns a list of blacklisted paths, each including the trailing / QStringList createBlackList(QTreeWidgetItem* root = 0) const; QStringList oldBlackList() const; //Estimate the total size of checked item (recursively) qint64 estimatedSize(QTreeWidgetItem *root = 0); void refreshFolders(); // oldBlackList is a list of excluded paths, each including a trailing / void setFolderInfo(const QString &folderPath, const QString &rootName, const QStringList &oldBlackList = QStringList()); QSize sizeHint() const Q_DECL_OVERRIDE; private slots: void slotUpdateDirectories(const QStringList &); void slotItemExpanded(QTreeWidgetItem *); void slotItemChanged(QTreeWidgetItem*,int); void slotLscolFinishedWithError(QNetworkReply*); private: void recursiveInsert(QTreeWidgetItem* parent, QStringList pathTrail, QString path, qint64 size); QString _folderPath; QString _rootName; QStringList _oldBlackList; bool _inserting; // set to true when we are inserting new items on the list AccountPtr _account; QLabel *_loading; }; /** * @brief The SelectiveSyncDialog class * @ingroup gui */ class SelectiveSyncDialog : public QDialog { Q_OBJECT public: // Dialog for a specific folder (used from the account settings button) explicit SelectiveSyncDialog(AccountPtr account, Folder *folder, QWidget* parent = 0, Qt::WindowFlags f = 0); // Dialog for the whole account (Used from the wizard) explicit SelectiveSyncDialog(AccountPtr account, const QString &folder, const QStringList &blacklist, QWidget* parent = 0, Qt::WindowFlags f = 0); virtual void accept() Q_DECL_OVERRIDE; QStringList createBlackList() const; QStringList oldBlackList() const; // Estimate the size of the total of sync'ed files from the server qint64 estimatedSize(); private: void init(const AccountPtr &account, const QString &label); SelectiveSyncTreeView *_treeView; Folder *_folder; }; }
/* * KoReport Library * Copyright (C) 2007-2010 by Adam Pigg (adam@piggz.co.uk) * * 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, see <http://www.gnu.org/licenses/>. */ #ifndef KROBJECTDATA_H #define KROBJECTDATA_H #include <koproperty/Property.h> #include <QObject> #include <QDomElement> #include <QFont> #include <QColor> #include "koreport_export.h" #include "krpos.h" #include "krsize.h" class OROPage; class OROSection; class KRSize; class KRScriptHandler; class KoReportData; namespace KoProperty { class Set; class Property; } class KRTextStyleData { public: QFont font; Qt::Alignment alignment; QColor backgroundColor; QColor foregroundColor; int backgroundOpacity; }; class KRLineStyleData { public: int weight; QColor lineColor; Qt::PenStyle style; }; /** @author */ class KOREPORT_EXPORT KoReportItemBase : public QObject { Q_OBJECT public: KoReportItemBase(); virtual ~KoReportItemBase(); /** @brief Return the item type as a string. Required by all items @return Item type */ virtual QString typeName() const = 0; /** @brief Render the item into a primitive which is used by the second stage renderer @return the height required by the object */ virtual int render(OROPage* page, OROSection* section, QPointF offset, QVariant data, KRScriptHandler *script); /** @brief Render a complex item that uses a sub query as a data source @return the height required by the object */ virtual int render(OROPage* page, OROSection* section, QPointF offset, KoReportData *data, KRScriptHandler *script); /** @brief Override if the item supports a simple data source, such as a field @return The field name or expression for the data source */ virtual QString itemDataSource() const; /** @brief Override if the item uses a sub query and linked fields, such as a chart or sub-report @return True if uses a sub query */ virtual bool supportsSubQuery(); KoProperty::Set* propertySet() const; KRPos position(); void setEntityName(const QString& n); QString entityName(); virtual void setUnit(const KoUnit& u); qreal Z; protected: KoProperty::Set *m_set; KoProperty::Property *m_name; KRPos m_pos; KRSize m_size; QString m_oldName; void addDefaultProperties(); virtual void createProperties() = 0; static bool parseReportRect(const QDomElement &, KRPos *pos, KRSize *siz); static bool parseReportTextStyleData(const QDomElement &, KRTextStyleData &); static bool parseReportLineStyleData(const QDomElement &, KRLineStyleData &); }; #endif
/* Copyright (C) 2007-2013 Open Information Security Foundation * * You can copy, redistribute or modify this Program under the terms of * the GNU General Public License version 2 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 * version 2 along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. */ /** * \file * * \author Victor Julien <victor@inliniac.net> */ #ifndef __UTIL_TIME_H__ #define __UTIL_TIME_H__ /** * A timeval with 32 bit fields. * * Used by the unified on disk file format. */ typedef struct SCTimeval32_ { uint32_t tv_sec; uint32_t tv_usec; } SCTimeval32; void TimeInit(void); void TimeDeinit(void); void TimeSetByThread(const int thread_id, const struct timeval *tv); void TimeGet(struct timeval *); #ifdef UNITTESTS void TimeSet(struct timeval *); void TimeSetToCurrentTime(void); void TimeSetIncrementTime(uint32_t); #endif void TimeModeSetLive(void); void TimeModeSetOffline (void); int TimeModeIsLive(void); struct tm *SCLocalTime(time_t timep, struct tm *result); void CreateTimeString(const struct timeval *ts, char *str, size_t size); void CreateIsoTimeString(const struct timeval *ts, char *str, size_t size); void CreateUtcIsoTimeString(const struct timeval *ts, char *str, size_t size); void CreateFormattedTimeString(const struct tm *t, const char * fmt, char *str, size_t size); time_t SCMkTimeUtc(struct tm *tp); int SCStringPatternToTime(char *string, const char **patterns, int num_patterns, struct tm *time); int SCTimeToStringPattern (time_t epoch, const char *pattern, char *str, size_t size); uint64_t SCParseTimeSizeString (const char *str); uint64_t SCGetSecondsUntil (const char *str, time_t epoch); #endif /* __UTIL_TIME_H__ */
/* $Id: conv.h,v 1.1.1.1 2010/12/02 04:21:59 walf_wu Exp $ * conv.h: Utility macros for Solaris emulation * * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) */ /* #define DEBUG_SOLARIS */ #define DEBUG_SOLARIS_KMALLOC #ifndef __ASSEMBLY__ #include <asm/unistd.h> /* Use this to get at 32-bit user passed pointers. */ #define A(__x) \ ({ unsigned long __ret; \ __asm__ ("srl %0, 0, %0" \ : "=r" (__ret) \ : "0" (__x)); \ (void __user *)__ret; \ }) extern unsigned sys_call_table[]; extern unsigned sys_call_table32[]; extern unsigned sunos_sys_table[]; #define SYS(name) ((long)sys_call_table[__NR_##name]) #define SUNOS(x) ((long)sunos_sys_table[x]) #ifdef DEBUG_SOLARIS #define SOLD(s) printk("%s,%d,%s(): %s\n",__FILE__,__LINE__,__FUNCTION__,(s)) #define SOLDD(s) printk("solaris: "); printk s #else #define SOLD(s) #define SOLDD(s) #endif #endif /* __ASSEMBLY__ */
// // Copyright (C) 2009 by sinamas <sinamas at users.sourceforge.net> // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as // published by the Free Software Foundation. // // 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 version 2 for more details. // // You should have received a copy of the GNU General Public License // version 2 along with this program; if not, write to the // Free Software Foundation, Inc., // 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. // #ifndef MEDIAWORKER_H #define MEDIAWORKER_H #include "atomicvar.h" #include "callqueue.h" #include "sourceupdater.h" #include "syncvar.h" #include "usec.h" #include <QMutex> #include <QMutexLocker> #include <QThread> #include <QWaitCondition> #include <deque> class AudioEngine; struct PixelBuffer; class MediaWorker : private QThread { public: class Callback { public: virtual void paused() = 0; virtual void blit(usec_t synctimebase, usec_t synctimeinc) = 0; virtual bool cancelBlit() = 0; virtual void audioEngineFailure() = 0; virtual bool tryLockVideoBuffer(PixelBuffer &pb) = 0; virtual void unlockVideoBuffer() = 0; virtual ~Callback() {} }; MediaWorker(MediaSource &source, AudioEngine &ae, long aerate, int aelatency, std::size_t resamplerNo, Callback &callback, QObject *parent = 0); MediaSource & source() const { return sourceUpdater_.source(); } SyncVar & waitingForSync() { return waitingForSync_; } void start(); void stop(); void pause(); void unpause() { pauseVar_.unpause(PauseVar::pause_bit); } void qPause() { pauseVar_.pause(PauseVar::qpause_bit); } void qUnpause() { pauseVar_.unpause(PauseVar::qpause_bit); } void recover() { pauseVar_.unpause(PauseVar::fail_bit); } bool paused() const { return pauseVar_.waitingForUnpause(); } void resetAudio(); void setAudioOut(AudioEngine &newAe, long rate, int latency, std::size_t resamplerNo); void setFrameTime(Rational ft); void setSamplesPerFrame(Rational spf); void setFrameTimeEstimate(long ftest) { AtomicVar<long>::Locked(frameTimeEst_).set(ftest); } bool frameStep(); void setFastForwardSpeed(int speed) { turboSkip_.setSpeed(speed); } int fastForwardSpeed() const { return turboSkip_.speed(); } void setFastForward(bool enable); bool fastForward() const { return turboSkip_.isEnabled(); } void updateJoysticks(); template<class T> void pushCall(T const &t) { pauseVar_.pushCall(t, AtomicVar<bool>::ConstLocked(doneVar_).get()); } protected: virtual void run(); private: class AudioOut; class PauseVar { public: enum { pause_bit = 1, qpause_bit = 2, fail_bit = 4 }; PauseVar() : var_(0) , waiting_(true) { } void localPause(unsigned bits) { if (waiting_) { var_ |= bits; } else pause(bits); } void pause(unsigned bits) { QMutexLocker l(&mut_); var_ |= bits; } void unpause(unsigned bits); void waitWhilePaused(Callback &cb, AudioOut &ao); bool waitingForUnpause() const { QMutexLocker l(&mut_); return waiting_; } void unwait() { waiting_ = false; } void rewait() { waiting_ = true; } template<class T> void pushCall(T const &t, bool stopped); private: CallQueue<> callq_; mutable QMutex mut_; QWaitCondition cond_; unsigned var_; bool waiting_; friend class PushMediaWorkerCall; }; class TurboSkip { public: TurboSkip() : cnt_(0) , inc_(0) , speed_(4) { } void setEnabled(bool enable) { if (enable) inc_ = 1; else cnt_ = inc_ = 0; } bool isEnabled() const { return inc_; } void setSpeed(int speed) { speed_ = speed; } int speed() const { return speed_; } bool update() { if ((cnt_ += inc_) >= speed_) cnt_ = 0; return cnt_; } private: int cnt_, inc_, speed_; }; class MeanQueue { public: MeanQueue(long mean, long var); void reset(long mean, long var); long mean() const { return sum_ / size; } long var() const { return dsum_ / size; } void push(long i); private: enum { size = 16 }; struct Elem { long sumpart, dsumpart; Elem(long sp, long dp) : sumpart(sp), dsumpart(dp) {} }; std::deque<Elem> q_; long sum_; long dsum_; }; struct ResetAudio; struct SetAudioOut; struct SetFrameTime; struct SetSamplesPerFrame; struct SetFastForward; Callback &callback_; SyncVar waitingForSync_; MeanQueue meanQueue_; PauseVar pauseVar_; AtomicVar<long> frameTimeEst_; AtomicVar<bool> doneVar_; TurboSkip turboSkip_; SourceUpdater sourceUpdater_; Array<qint16> sndOutBuffer_; scoped_ptr<AudioOut> ao_; long usecft_; friend class PushMediaWorkerCall; long adaptToRateEstimation(long estft); void adjustResamplerRate(long outRate); std::ptrdiff_t sourceUpdate(); void initAudioEngine(); }; template<class T> void MediaWorker::PauseVar::pushCall(T const &t, bool const stopped) { QMutexLocker l(&mut_); callq_.push(t); cond_.wakeAll(); if (stopped) callq_.pop_all(); } #endif
/* * This file is part of the coreboot project. * * Copyright (C) 2014 Imagination Technologies * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; version 2 of * the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, * MA 02110-1301 USA */ #include <cbmem.h> #include <stdlib.h> #include <symbols.h> void *cbmem_top(void) { return _dram + (CONFIG_DRAM_SIZE_MB << 20); }
/* This file is part of the KDE project Copyright 2009 Vera Lukman <shicmap@gmail.com> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2 as published by the Free Software Foundation. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KIS_MIN_HEAP_H #define KIS_MIN_HEAP_H #include <QDebug> #include <QList> template <typename T> struct PriorityNode { T data; int key; int pos; }; template <typename T, int N> class KisMinHeap { public: KisMinHeap(): m_list(0) { m_size = N; m_last = 0; m_list = new PriorityNode <T>* [N]; } inline KisMinHeap(const T& data, int key) { KisMinHeap(); append(data, key); } inline KisMinHeap(PriorityNode<T>* node) { KisMinHeap(); append(node); } ~KisMinHeap() { delete[] m_list; } inline void changeKey(int pos, int newKey) { m_list[pos]->key = newKey; heapifyUp(pos); heapifyDown(pos); } inline int size() { return m_last; } inline T valueAt(int pos) { return m_list[pos]->data; } void append(PriorityNode<T>* node) { node->pos = m_last; m_list[m_last] = node; ++m_last; heapifyUp(node->pos); node = 0; } void append(const T& data, int key) { if (m_last >= m_size) return; PriorityNode <T>* node = new PriorityNode<T>; node->data = data; node->key = key; append(node); } void remove(int pos) { if (pos < 0) return; swap(pos, m_last - 1); --m_last; delete m_list[m_last]; m_list[m_last] = 0; heapifyUp(pos); heapifyDown(pos); } void remove(const T& data) { int pos = find(data); if (pos >= 0) remove(pos); } int find(const T& data) { for (int pos = 0; pos < m_last; pos++) { if (m_list[pos]->data == data) return pos; } return -1; } private: int m_last; int m_size; PriorityNode <T>* *m_list; void swap(int pos1, int pos2) { PriorityNode <T>* temp(m_list[pos1]); m_list[pos1] = m_list[pos2]; m_list[pos1]->pos = pos1; m_list[pos2] = temp; m_list[pos2]->pos = pos2; temp = 0; } void heapifyUp(int pos) { while (pos > 0 && m_list[pos]->key < m_list[parentPos(pos)]->key) { swap(pos, parentPos(pos)); pos = parentPos(pos); } } void heapifyDown(int pos) { if (leftChildPos(pos) >= m_last) return; //no children else { int childPos = 0; if (rightChildPos(pos) >= m_last) { //1 child childPos = leftChildPos(pos); } else { //2 children m_list[leftChildPos(pos)]->key < m_list[rightChildPos(pos)]->key ? childPos = leftChildPos(pos) : childPos = rightChildPos(pos); } if (m_list[childPos]->key < m_list[pos]->key) { swap(pos, childPos); heapifyDown(childPos); } else return; } } inline int leftChildPos(int x) { return 2 * x + 1; } inline int rightChildPos(int x) { return 2 * x + 2; } inline int parentPos(int x) { return (x - 1) / 2; } }; #endif // HEAP_H
/* * Copyright (C) 2003 PMC-Sierra Inc. * Author: Manish Lachwani (lachwani@pmc-sierra.com) * * Copyright (C) 2006 Ralf Baechle (ralf@linux-mips.org) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * THIS SOFTWARE IS PROVIDED ``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 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. * * 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. * * Second level Interrupt handlers for the PMC-Sierra Titan/Yosemite board */ #include <linux/errno.h> #include <linux/init.h> #include <linux/kernel_stat.h> #include <linux/module.h> #include <linux/signal.h> #include <linux/sched.h> #include <linux/types.h> #include <linux/interrupt.h> #include <linux/ioport.h> #include <linux/irq.h> #include <linux/timex.h> #include <linux/slab.h> #include <linux/random.h> #include <linux/bitops.h> #include <asm/bootinfo.h> #include <asm/io.h> #include <asm/irq.h> #include <asm/irq_cpu.h> #include <asm/mipsregs.h> #include <asm/system.h> #include <asm/titan_dep.h> /* Hypertransport specific */ #define IRQ_ACK_BITS 0x00000000 /* Ack bits */ #define HYPERTRANSPORT_INTA 0x78 /* INTA# */ #define HYPERTRANSPORT_INTB 0x79 /* INTB# */ #define HYPERTRANSPORT_INTC 0x7a /* INTC# */ #define HYPERTRANSPORT_INTD 0x7b /* INTD# */ /* * Handle hypertransport & SMP interrupts. The interrupt lines are scarce. * For interprocessor interrupts, the best thing to do is to use the INTMSG * register. We use the same external interrupt line, i.e. INTB3 and monitor * another status bit */ static void ll_ht_smp_irq_handler(int irq) { u32 status = OCD_READ(RM9000x2_OCD_INTP0STATUS4); /* Ack all the bits that correspond to the interrupt sources */ if (status != 0) OCD_WRITE(RM9000x2_OCD_INTP0STATUS4, IRQ_ACK_BITS); status = OCD_READ(RM9000x2_OCD_INTP1STATUS4); if (status != 0) OCD_WRITE(RM9000x2_OCD_INTP1STATUS4, IRQ_ACK_BITS); #ifdef CONFIG_HT_LEVEL_TRIGGER /* * Level Trigger Mode only. Send the HT EOI message back to the source. */ switch (status) { case 0x1000000: OCD_WRITE(RM9000x2_OCD_HTEOI, HYPERTRANSPORT_INTA); break; case 0x2000000: OCD_WRITE(RM9000x2_OCD_HTEOI, HYPERTRANSPORT_INTB); break; case 0x4000000: OCD_WRITE(RM9000x2_OCD_HTEOI, HYPERTRANSPORT_INTC); break; case 0x8000000: OCD_WRITE(RM9000x2_OCD_HTEOI, HYPERTRANSPORT_INTD); break; case 0x0000001: /* PLX */ OCD_WRITE(RM9000x2_OCD_HTEOI, 0x20); OCD_WRITE(IRQ_CLEAR_REG, IRQ_ACK_BITS); break; case 0xf000000: OCD_WRITE(RM9000x2_OCD_HTEOI, HYPERTRANSPORT_INTA); OCD_WRITE(RM9000x2_OCD_HTEOI, HYPERTRANSPORT_INTB); OCD_WRITE(RM9000x2_OCD_HTEOI, HYPERTRANSPORT_INTC); OCD_WRITE(RM9000x2_OCD_HTEOI, HYPERTRANSPORT_INTD); break; } #endif /* CONFIG_HT_LEVEL_TRIGGER */ do_IRQ(irq); } asmlinkage void plat_irq_dispatch(void) { unsigned int cause = read_c0_cause(); unsigned int status = read_c0_status(); unsigned int pending = cause & status; if (pending & STATUSF_IP7) { do_IRQ(7); } else if (pending & STATUSF_IP2) { #ifdef CONFIG_HYPERTRANSPORT ll_ht_smp_irq_handler(2); #else do_IRQ(2); #endif } else if (pending & STATUSF_IP3) { do_IRQ(3); } else if (pending & STATUSF_IP4) { do_IRQ(4); } else if (pending & STATUSF_IP5) { #ifdef CONFIG_SMP titan_mailbox_irq(); #else do_IRQ(5); #endif } else if (pending & STATUSF_IP6) { do_IRQ(4); } } #ifdef CONFIG_KGDB extern void init_second_port(void); #endif /* * Initialize the next level interrupt handler */ void __init arch_init_irq(void) { clear_c0_status(ST0_IM); mips_cpu_irq_init(0); rm7k_cpu_irq_init(8); rm9k_cpu_irq_init(12); #ifdef CONFIG_KGDB /* At this point, initialize the second serial port */ init_second_port(); #endif #ifdef CONFIG_GDB_CONSOLE register_gdb_console(); #endif }
/* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, 2011,2012 Giovanni Di Sirio. This file is part of ChibiOS/RT. ChibiOS/RT 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. ChibiOS/RT 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/>. --- A special exception to the GPL can be applied should you wish to distribute a combined work that includes ChibiOS/RT, without being obliged to provide the source code for any proprietary components. See the file exception.txt for full details of how and when the exception can be applied. */ /* Concepts and parts of this file have been contributed by Uladzimir Pylinsky aka barthess. */ /** * @file STM32/RTCv1/rtc_lld.h * @brief STM32F1xx RTC subsystem low level driver header. * * @addtogroup RTC * @{ */ #ifndef _RTC_LLD_H_ #define _RTC_LLD_H_ #if HAL_USE_RTC || defined(__DOXYGEN__) /*===========================================================================*/ /* Driver constants. */ /*===========================================================================*/ /** * @brief This RTC implementation supports callbacks. */ #define RTC_SUPPORTS_CALLBACKS TRUE /** * @brief One alarm comparator available. */ #define RTC_ALARMS 1 /*===========================================================================*/ /* Driver pre-compile time settings. */ /*===========================================================================*/ /** * @name Configuration options * @{ */ /* * RTC driver system settings. */ #define STM32_RTC_IRQ_PRIORITY 15 /** @} */ /*===========================================================================*/ /* Derived constants and error checks. */ /*===========================================================================*/ #if HAL_USE_RTC && !STM32_HAS_RTC #error "RTC not present in the selected device" #endif #if STM32_RTCCLK == 0 #error "RTC clock not enabled" #endif /*===========================================================================*/ /* Driver data structures and types. */ /*===========================================================================*/ /** * @brief Type of a structure representing an RTC alarm time stamp. */ typedef struct RTCAlarm RTCAlarm; /** * @brief Type of a structure representing an RTC callbacks config. */ typedef struct RTCCallbackConfig RTCCallbackConfig; /** * @brief Type of an RTC alarm. * @details Meaningful on platforms with more than 1 alarm comparator. */ typedef uint32_t rtcalarm_t; /** * @brief Type of an RTC event. */ typedef enum { RTC_EVENT_SECOND = 0, /** Triggered every second. */ RTC_EVENT_ALARM = 1, /** Triggered on alarm. */ RTC_EVENT_OVERFLOW = 2 /** Triggered on counter overflow. */ } rtcevent_t; /** * @brief Type of a generic RTC callback. */ typedef void (*rtccb_t)(RTCDriver *rtcp, rtcevent_t event); /** * @brief Structure representing an RTC callbacks config. */ struct RTCCallbackConfig{ /** * @brief Generic RTC callback pointer. */ rtccb_t callback; }; /** * @brief Structure representing an RTC time stamp. */ struct RTCTime { /** * @brief Seconds since UNIX epoch. */ uint32_t tv_sec; /** * @brief Fractional part. */ uint32_t tv_msec; }; /** * @brief Structure representing an RTC alarm time stamp. */ struct RTCAlarm { /** * @brief Seconds since UNIX epoch. */ uint32_t tv_sec; }; /** * @brief Structure representing an RTC driver. */ struct RTCDriver{ /** * @brief Callback pointer. */ rtccb_t callback; }; /*===========================================================================*/ /* Driver macros. */ /*===========================================================================*/ /*===========================================================================*/ /* External declarations. */ /*===========================================================================*/ #if !defined(__DOXYGEN__) extern RTCDriver RTCD1; #endif #ifdef __cplusplus extern "C" { #endif void rtc_lld_init(void); void rtc_lld_set_time(RTCDriver *rtcp, const RTCTime *timespec); void rtc_lld_get_time(RTCDriver *rtcp, RTCTime *timespec); void rtc_lld_set_alarm(RTCDriver *rtcp, rtcalarm_t alarm, const RTCAlarm *alarmspec); void rtc_lld_get_alarm(RTCDriver *rtcp, rtcalarm_t alarm, RTCAlarm *alarmspec); void rtc_lld_set_callback(RTCDriver *rtcp, rtccb_t callback); #ifdef __cplusplus } #endif #endif /* HAL_USE_RTC */ #endif /* _RTC_LLD_H_ */ /** @} */
/* * This file is part of Cleanflight. * * Cleanflight is free software. You can redistribute * this software and/or modify this software under the terms of the * GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) * any later version. * * Cleanflight is distributed in the hope that it * will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software. * * If not, see <http://www.gnu.org/licenses/>. */ #define SDIO_CFG_TO_DEV(x) ((x) - 1) #define SDIO_DEV_TO_CFG(x) ((x) + 1) typedef enum { SDIOINVALID = -1, SDIODEV_1 = 0, SDIODEV_2, } SDIODevice; #define SDIODEV_COUNT 2 #if defined(STM32H7) void sdioPinConfigure(); void SDIO_GPIO_Init(void); #endif
/******************************************************************** * COPYRIGHT: * Copyright (c) 1997-2001, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ /******************************************************************************** * * File CESTST.C * * Modification History: * Name Description * Madhu Katragadda Ported for C API *********************************************************************************/ /** * CollationSpanishTest is a third level test class. This tests the locale * specific primary, secondary and tertiary rules. For example, the ignorable * character '-' in string "black-bird". The en_US locale uses the default * collation rules as its sorting sequence. */ #include <stdlib.h> #include "unicode/utypes.h" #if !UCONFIG_NO_COLLATION #include "unicode/ucol.h" #include "unicode/uloc.h" #include "cintltst.h" #include "cestst.h" #include "ccolltst.h" #include "callcoll.h" #include "unicode/ustring.h" #include "string.h" static UCollator *myCollation; const static UChar testSourceCases[][MAX_TOKEN_LEN] = { {0x0062/*'a'*/, 0x006c/*'l'*/, 0x0069/*'i'*/, 0x0061/*'a'*/, 0x0073/*'s'*/, 0x0000}, {0x0045/*'E'*/, 0x006c/*'l'*/, 0x006c/*'l'*/, 0x0069/*'i'*/, 0x006f/*'o'*/, 0x0074/*'t'*/, 0x0000}, {0x0048/*'H'*/, 0x0065/*'e'*/, 0x006c/*'l'*/, 0x006c/*'l'*/, 0x006f/*'o'*/, 0x0000}, {0x0061/*'a'*/, 0x0063/*'c'*/, 0x0048/*'H'*/, 0x0063/*'c'*/, 0x0000}, {0x0061/*'a'*/, 0x0063/*'c'*/, 0x0063/*'c'*/, 0x0000}, {0x0061/*'a'*/, 0x006c/*'l'*/, 0x0069/*'i'*/, 0x0061/*'a'*/, 0x0073/*'s'*/, 0x0000}, {0x0061/*'a'*/, 0x0063/*'c'*/, 0x0048/*'H'*/, 0x0063/*'c'*/, 0x0000}, {0x0061/*'a'*/, 0x0063/*'c'*/, 0x0063/*'c'*/, 0x0000}, {0x0048/*'H'*/, 0x0065/*'e'*/, 0x006c/*'l'*/, 0x006c/*'l'*/, 0x006f/*'o'*/, 0x0000}, }; const static UChar testTargetCases[][MAX_TOKEN_LEN] = { {0x0062/*'a'*/, 0x006c/*'l'*/, 0x006c/*'l'*/, 0x0069/*'i'*/, 0x0061/*'a'*/, 0x0073/*'s'*/, 0x0000}, {0x0045/*'E'*/, 0x006d/*'m'*/, 0x0069/*'i'*/, 0x006f/*'o'*/, 0x0074/*'t'*/, 0x0000}, {0x0068/*'h'*/, 0x0065/*'e'*/, 0x006c/*'l'*/, 0x006c/*'l'*/, 0x006f/*'O'*/, 0x0000}, {0x0061/*'a'*/, 0x0043/*'C'*/, 0x0048/*'H'*/, 0x0063/*'c'*/, 0x0000}, {0x0061/*'a'*/, 0x0043/*'C'*/, 0x0048/*'H'*/, 0x0063/*'c'*/, 0x0000}, {0x0062/*'a'*/, 0x006c/*'l'*/, 0x006c/*'l'*/, 0x0069/*'i'*/, 0x0061/*'a'*/, 0x0073/*'s'*/, 0x0000}, {0x0061/*'a'*/, 0x0043/*'C'*/, 0x0048/*'H'*/, 0x0063/*'c'*/, 0x0000}, {0x0061/*'a'*/, 0x0043/*'C'*/, 0x0048/*'H'*/, 0x0063/*'c'*/, 0x0000}, {0x0068/*'h'*/, 0x0065/*'e'*/, 0x006c/*'l'*/, 0x006c/*'l'*/, 0x006f/*'O'*/, 0x0000}, }; const static UCollationResult results[] = { UCOL_LESS, UCOL_LESS, UCOL_GREATER, UCOL_LESS, UCOL_LESS, /* test primary > 5*/ UCOL_LESS, UCOL_EQUAL, UCOL_LESS, UCOL_EQUAL }; void addSpanishCollTest(TestNode** root) { addTest(root, &TestPrimary, "tscoll/cestst/TestPrimary"); addTest(root, &TestTertiary, "tscoll/cestst/TestTertiary"); } static void TestTertiary( ) { int32_t i; UErrorCode status = U_ZERO_ERROR; myCollation = ucol_open("es_ES", &status); if(U_FAILURE(status)){ log_err("ERROR: %s: in creation of rule based collator: %s\n", __FILE__, myErrorName(status)); return; } log_verbose("Testing Spanish Collation with Tertiary strength\n"); ucol_setStrength(myCollation, UCOL_TERTIARY); for (i = 0; i < 5 ; i++) { doTest(myCollation, testSourceCases[i], testTargetCases[i], results[i]); } ucol_close(myCollation); } static void TestPrimary() { int32_t i; UErrorCode status = U_ZERO_ERROR; myCollation = ucol_open("es_ES", &status); if(U_FAILURE(status)){ log_err("ERROR: %s: in creation of rule based collator: %s\n", __FILE__, myErrorName(status)); return; } log_verbose("Testing Spanish Collation with Primary strength\n"); ucol_setStrength(myCollation, UCOL_PRIMARY); for (i = 5; i < 9; i++) { doTest(myCollation, testSourceCases[i], testTargetCases[i], results[i]); } ucol_close(myCollation); } #endif /* #if !UCONFIG_NO_COLLATION */
/* * Generated by asn1c-0.9.24 (http://lionet.info/asn1c) * From ASN.1 module "InformationElements" * found in "../asn/InformationElements.asn" * `asn1c -fcompound-names -fnative-types` */ #include "PRACH-Midamble.h" int PRACH_Midamble_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using NativeEnumerated, * so here we adjust the DEF accordingly. */ static void PRACH_Midamble_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeEnumerated.free_struct; td->print_struct = asn_DEF_NativeEnumerated.print_struct; td->ber_decoder = asn_DEF_NativeEnumerated.ber_decoder; td->der_encoder = asn_DEF_NativeEnumerated.der_encoder; td->xer_decoder = asn_DEF_NativeEnumerated.xer_decoder; td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder; td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder; td->uper_encoder = asn_DEF_NativeEnumerated.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeEnumerated.per_constraints; td->elements = asn_DEF_NativeEnumerated.elements; td->elements_count = asn_DEF_NativeEnumerated.elements_count; /* td->specifics = asn_DEF_NativeEnumerated.specifics; // Defined explicitly */ } void PRACH_Midamble_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { PRACH_Midamble_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int PRACH_Midamble_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { PRACH_Midamble_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t PRACH_Midamble_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { PRACH_Midamble_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t PRACH_Midamble_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { PRACH_Midamble_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t PRACH_Midamble_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { PRACH_Midamble_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t PRACH_Midamble_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { PRACH_Midamble_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t PRACH_Midamble_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { PRACH_Midamble_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t PRACH_Midamble_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { PRACH_Midamble_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t asn_PER_type_PRACH_Midamble_constr_1 = { { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; static asn_INTEGER_enum_map_t asn_MAP_PRACH_Midamble_value2enum_1[] = { { 0, 6, "direct" }, { 1, 15, "direct-Inverted" } }; static unsigned int asn_MAP_PRACH_Midamble_enum2value_1[] = { 0, /* direct(0) */ 1 /* direct-Inverted(1) */ }; static asn_INTEGER_specifics_t asn_SPC_PRACH_Midamble_specs_1 = { asn_MAP_PRACH_Midamble_value2enum_1, /* "tag" => N; sorted by tag */ asn_MAP_PRACH_Midamble_enum2value_1, /* N => "tag"; sorted by N */ 2, /* Number of elements in the maps */ 0, /* Enumeration is not extensible */ 1, /* Strict enumeration */ 0, /* Native long size */ 0 }; static ber_tlv_tag_t asn_DEF_PRACH_Midamble_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) }; asn_TYPE_descriptor_t asn_DEF_PRACH_Midamble = { "PRACH-Midamble", "PRACH-Midamble", PRACH_Midamble_free, PRACH_Midamble_print, PRACH_Midamble_constraint, PRACH_Midamble_decode_ber, PRACH_Midamble_encode_der, PRACH_Midamble_decode_xer, PRACH_Midamble_encode_xer, PRACH_Midamble_decode_uper, PRACH_Midamble_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_PRACH_Midamble_tags_1, sizeof(asn_DEF_PRACH_Midamble_tags_1) /sizeof(asn_DEF_PRACH_Midamble_tags_1[0]), /* 1 */ asn_DEF_PRACH_Midamble_tags_1, /* Same as above */ sizeof(asn_DEF_PRACH_Midamble_tags_1) /sizeof(asn_DEF_PRACH_Midamble_tags_1[0]), /* 1 */ &asn_PER_type_PRACH_Midamble_constr_1, 0, 0, /* Defined elsewhere */ &asn_SPC_PRACH_Midamble_specs_1 /* Additional specs */ };
// // AxolotlExceptions.h // AxolotlKit // // Created by Frederic Jacobs on 23/07/14. // Copyright (c) 2014 Frederic Jacobs. All rights reserved. // #ifndef AxolotlKit_AxolotlExceptions_h #define AxolotlKit_AxolotlExceptions_h /** * Thrown when the user is: 1) Sending a message with a PreKeyBundle that contains a different identity key than the previously known one. 2) Receiving a new PreKeyWhisperMessage that has a different identity key than the previously known one. */ static NSString *UntrustedIdentityKeyException = @"AxolotlUnstrustedIdentityKeyException"; /** * Thrown thrown when a message is received with an unknown PreKeyID. */ static NSString *InvalidKeyIdException = @"AxolotlInvalidKeyIdException"; /** * Thrown when: 1) Signature of Prekeys are not correctly signed. 2) We received a key type that is not compatible with this version. (All keys should be Curve25519). */ static NSString *InvalidKeyException = @"AxolotlInvalidKeyException"; /** * Thrown when receiving a message with no associated session for decryption. */ static NSString *NoSessionException = @"AxolotlNoSessionException"; /** * Thrown when receiving a malformatted message. */ static NSString *InvalidMessageException = @"AxolotlInvalidMessageException"; /** * Thrown when experiencing issues encrypting/decrypting a message symetrically. */ static NSString *CipherException = @"AxolotlCipherIssue"; /** * Thrown when detecting a message being sent a second time. (Replay attacks/bugs) */ static NSString *DuplicateMessageException = @"AxolotlDuplicateMessage"; /** * Thrown when receiving a message send with a non-supported version of the TextSecure protocol. */ static NSString *LegacyMessageException = @"AxolotlLegacyMessageException"; /** * Thrown when a client tries to initiate a session with a non-supported version. */ static NSString *InvalidVersionException = @"AxolotlInvalidVersionException"; #endif
/* 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 */ #pragma ident "@(#) libfi/mpp_reduce/maxloc_s_1.c 92.1 07/09/99 17:05:42" #include <stdlib.h> #include <liberrno.h> #include <fmath.h> #include <cray/dopevec.h> #include "f90_macros.h" #define RANK 1 /* * Compiler generated call: CALL _MAXLOC_JS1(RESULT, SOURCE, MASK) * * Purpose: Determine the location of the first element of SOURCE * having the maximum value of the elements identified * by MASK. This particular routine handles source arrays * of rank 1 with a data type of 64-bit integer or * 64-bit floating point. * * Arguments: * RESULT - Dope vector for result array * SOURCE - Dope vector for user source array * MASK - Dope vector for logical mask array * * Description: * This is the MPP single PE version of MAXLOC. This * routine checks the scope of the source and mask * arrays and if they are private, calls the current * Y-MP single processor version of the routine. If they * are shared, then it allocates a result array before * calling a Fortran routine which declares the source * and mask arguments to be UNKNOWN SHARED. * * Include file maxloc_s.h contains the rank independent * source code for this routine. */ #include "maxloc_s.h"
//____________________________________________________________________________ /*! \namespace genie::utils::geometry \brief Geometry utilities \author Costas Andreopoulos <costas.andreopoulos \at stfc.ac.uk> STFC, Rutherford Appleton Laboratory \created March 26, 2009 \cpright Copyright (c) 2003-2013, GENIE Neutrino MC Generator Collaboration For the full text of the license visit http://copyright.genie-mc.org or see $GENIE/LICENSE */ //____________________________________________________________________________ #ifndef _GEO_UTILS_H_ #define _GEO_UTILS_H_ #include <string> class TGeoVolume; using std::string; namespace genie { namespace utils { namespace geometry { void RecursiveExhaust(TGeoVolume *topvol, string volnames, bool exhaust); } // geometry namespace } // utils namespace } // genie namespace #endif // _GEO_UTILS_H_
/* Copyright 2005-2009 Last.fm Ltd. - Primarily authored by Max Howell, Jono Cole, Erik Jaelevik, Christian Muehlhaeuser This file is part of the Last.fm Desktop Application Suite. lastfm-desktop 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. lastfm-desktop 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 lastfm-desktop. If not, see <http://www.gnu.org/licenses/>. */ #ifndef ITUNES_LIBRARY_H #define ITUNES_LIBRARY_H #include "ITunesLibraryTrack.h" #include <lastfm/Track.h> #include <QList> /** @author Max Howell <max@last.fm> - Mac * @author <erik@last.fm> - Win * * This class offers easy access to the iTunes Library database * It uses AppleScript and COM to access and query iTunes */ class ITunesLibrary { public: /** the isIPod bool is for Windows only, the source, mac :( */ ITunesLibrary( const QString& source = "", bool isIPod = false ); // throws ~ITunesLibrary(); typedef ITunesLibraryTrack Track; bool hasTracks() const; Track nextTrack(); int trackCount() const; private: uint m_currentIndex; #ifdef WIN32 class ITunesComWrapper* m_com; long m_trackCount; bool const m_isIPod; #else QList<Track> m_tracks; #endif private: Q_DISABLE_COPY( ITunesLibrary ); }; #endif
/* * Generated by asn1c-0.9.24 (http://lionet.info/asn1c) * From ASN.1 module "InformationElements" * found in "../asn/InformationElements.asn" * `asn1c -fcompound-names -fnative-types` */ #ifndef _SysInfoType15_1bis_v920ext_IEs_H_ #define _SysInfoType15_1bis_v920ext_IEs_H_ #include <asn_application.h> /* Including external dependencies */ #include "UE-Positioning-DGANSSCorrections-v920ext.h" #include <constr_SEQUENCE.h> #ifdef __cplusplus extern "C" { #endif /* SysInfoType15-1bis-v920ext-IEs */ typedef struct SysInfoType15_1bis_v920ext_IEs { UE_Positioning_DGANSSCorrections_v920ext_t ue_positioning_GANSS_DGANSS_Corrections; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } SysInfoType15_1bis_v920ext_IEs_t; /* Implementation */ extern asn_TYPE_descriptor_t asn_DEF_SysInfoType15_1bis_v920ext_IEs; #ifdef __cplusplus } #endif #endif /* _SysInfoType15_1bis_v920ext_IEs_H_ */ #include <asn_internal.h>
/* * Copyright (c) 2010 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #include <stdlib.h> // EXIT_SUCCESS #include <stdio.h> #include <dlfcn.h> #include <mach-o/dyld.h> #include <mach-o/dyld_images.h> #include "test.h" extern struct mach_header __dso_handle; struct dyld_all_image_infos* getImageInfosFromKernel() { task_dyld_info_data_t task_dyld_info; mach_msg_type_number_t count = TASK_DYLD_INFO_COUNT; if ( task_info(mach_task_self(), TASK_DYLD_INFO, (task_info_t)&task_dyld_info, &count) ) { FAIL("all_image_infos: task_info() failed"); exit(0); } return (struct dyld_all_image_infos*)(uintptr_t)task_dyld_info.all_image_info_addr; } int main() { struct dyld_all_image_infos* info = getImageInfosFromKernel(); if ( info->version < 10 ) { FAIL("image-count: dyld_all_image_infos is < 10"); exit(0); } if ( info->infoArrayCount != info->initialImageCount ) { FAIL("image-count: dyld_all_image_infos.infoArrayCount != dyld_all_image_infos.initialImageCount"); exit(0); } void* h = dlopen("libfoo.dylib", RTLD_LAZY); if ( h == NULL ) { FAIL("image-count: dyld_all_image_infos is < 10"); exit(0); } if ( info->infoArrayCount != (info->initialImageCount+1) ) { FAIL("image-count: infoArrayCount did not increment when libfoo.dylib was loaded"); exit(0); } dlclose(h); if ( info->infoArrayCount != info->initialImageCount ) { FAIL("image-count: infoArrayCount did not decrement when libfoo.dylib was unloaded"); exit(0); } PASS("image-count"); return EXIT_SUCCESS; }
/* Copyright (C) 2003-2015 LiveCode Ltd. This file is part of LiveCode. LiveCode is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License v3 as published by the Free Software Foundation. LiveCode 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 LiveCode. If not see <http://www.gnu.org/licenses/>. */ // // MCError class declarations // #ifndef ERROR_H #define ERROR_H class MCScriptPoint; class MCError { MCStringRef buffer; uint2 errorline; uint2 errorpos; uint2 depth; Boolean thrown; public: MCError() { MCStringCreateMutable(0, buffer); errorline = errorpos = 0; depth = 0; thrown = False; } ~MCError() { MCValueRelease(buffer); } void add(uint2 id, MCScriptPoint &); void add(uint2 id, uint2 line, uint2 pos); void add(uint2 id, uint2 line, uint2 pos, uint32_t); // void add(uint2 id, uint2 line, uint2 pos, const MCString &); void add(uint2 id, uint2 line, uint2 pos, const char *); void add(uint2 id, uint2 line, uint2 pos, MCValueRef); void append(MCError& string); #ifdef LEGACY_EXEC const MCString &getsvalue(); #endif void copystringref(MCStringRef s, Boolean t); bool copyasstringref(MCStringRef &r_string); void clear(); Boolean isempty() { return MCStringIsEmpty(buffer); } void geterrorloc(uint2 &line, uint2 &pos); private: void doadd(uint2 id, uint2 line, uint2 pos, MCStringRef token); }; #endif
/************************************************************************/ /** \file KnownSeqLen.c \version V1.11 \date 07.07.14 \brief \copyright (c) UCL / Dr. Andrew C. R. Martin 1993-2014 \author Dr. Andrew C. R. Martin \par Institute of Structural & Molecular Biology, University College London, Gower Street, London. WC1E 6BT. \par andrew@bioinf.org.uk andrew.martin@ucl.ac.uk ************************************************************************** This code is NOT IN THE PUBLIC DOMAIN, but it may be copied according to the conditions laid out in the accompanying file COPYING.DOC. The code may be modified as required, but any modifications must be documented so that the person responsible can be identified. The code may not be sold commercially or included as part of a commercial product except as described in the file COPYING.DOC. ************************************************************************** Description: ============ ************************************************************************** Usage: ====== ************************************************************************** Revision History: ================= - V1.0 29.09.92 Original - V1.1 07.06.93 Corrected allocation - V1.2 18.06.93 Handles multi-chains and skips NTER and CTER residues. Added SplitSeq() - V1.3 09.07.93 SplitSeq() cleans up properly if allocation failed - V1.4 11.05.94 Added TrueSeqLen() - V1.5 13.05.94 Fixed bug in PDB2Seq(). Added KnownSeqLen(). - V1.6 07.09.94 Fixed allocation bug in SplitSeq() - V1.7 19.07.95 Added check for ATOM records - V1.8 24.01.96 Fixed bug when no ATOM records in linked list Returns a blank string - V1.9 26.08.97 Renamed DoPDB2Seq() with handling of Asx/Glx and protein-only. Added macros to recreate the old PDB2Seq() interface and similar new calls - V1.10 02.10.00 Added NoX option - V1.11 07.07.14 Use bl prefix for functions By: CTP *************************************************************************/ /* Doxygen ------- #GROUP Handling Sequence Data #SUBGROUP Obtaining information #FUNCTION blKnownSeqLen() Scans a 1-letter code sequence and calculate the length without `-', ` ' or '?' residues */ /************************************************************************/ /* Includes */ /************************************************************************/ /* Defines and macros */ /************************************************************************/ /* Globals */ /************************************************************************/ /* Prototypes */ /************************************************************************/ /*>int blKnownSeqLen(char *sequence) --------------------------------- *//** \param[in] *sequence A sequence containing deletions \return Length without deletions Scans a 1-letter code sequence and calculate the length without `-', ` ' or '?' residues - 13.05.94 Original By: ACRM - 07.07.14 Use bl prefix for functions By: CTP */ int blKnownSeqLen(char *sequence) { int length = 0, i = 0; for(i=0; sequence[i]; i++) { if(sequence[i] != '-' && sequence[i] != ' ' && sequence[i] != '?') length++; } return(length); }
// Modified by Lubos Dolezel for Darling /* * Copyright (c) 2002 Apple Computer, Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * The contents of this file constitute Original Code as defined in and * are subject to the Apple Public Source License Version 1.1 (the * "License"). You may not use this file except in compliance with the * License. Please obtain a copy of the License at * http://www.apple.com/publicsource and read it before using this file. * * This Original Code and all software distributed under the License are * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the * License for the specific language governing rights and limitations * under the License. * * @APPLE_LICENSE_HEADER_END@ */ #define ENTRY(name) \ .globl _##name; \ .align 4; \ _##name##: #ifndef NO_FENV #define PRIVATE_ENTRY(name) \ .globl _##name; .private_extern _##name; \ .align 4; \ _##name##: #else #define PRIVATE_ENTRY(name) #endif #undef END #define END(name) /* NOTHING */ #define RCSID(s) /* NOTHING */
/* * Phusion Passenger - https://www.phusionpassenger.com/ * Copyright (c) 2011-2013 Phusion * * "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui. * * 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 _PASSENGER_APPLICATION_POOL2_DUMMY_SPAWNER_H_ #define _PASSENGER_APPLICATION_POOL2_DUMMY_SPAWNER_H_ #include <ApplicationPool2/Spawner.h> namespace Passenger { namespace ApplicationPool2 { using namespace std; using namespace boost; using namespace oxt; class DummySpawner: public Spawner { private: SpawnerConfigPtr config; boost::mutex lock; unsigned int count; public: unsigned int cleanCount; DummySpawner(const ResourceLocator &resourceLocator, const SpawnerConfigPtr &_config) : Spawner(resourceLocator), config(_config) { count = 0; cleanCount = 0; } virtual ProcessPtr spawn(const Options &options) { TRACE_POINT(); possiblyRaiseInternalError(options); SocketPair adminSocket = createUnixSocketPair(); SocketListPtr sockets = boost::make_shared<SocketList>(); sockets->add("main", "tcp://127.0.0.1:1234", "session", config->concurrency); syscalls::usleep(config->spawnTime); boost::lock_guard<boost::mutex> l(lock); count++; ProcessPtr process = boost::make_shared<Process>(SafeLibevPtr(), (pid_t) count, "gupid-" + toString(count), toString(count), adminSocket.second, FileDescriptor(), sockets, SystemTime::getUsec(), SystemTime::getUsec()); process->dummy = true; return process; } virtual bool cleanable() const { return true; } virtual void cleanup() { cleanCount++; } }; typedef boost::shared_ptr<DummySpawner> DummySpawnerPtr; } // namespace ApplicationPool2 } // namespace Passenger #endif /* _PASSENGER_APPLICATION_POOL2_DUMMY_SPAWNER_H_ */
/************************************************************************** * Otter Browser: Web browser controlled by the user, not vice-versa. * Copyright (C) 2013 - 2019 Michal Dutkiewicz aka Emdek <michal@emdek.pl> * * 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 OTTER_QTWEBKITWEBBACKEND_H #define OTTER_QTWEBKITWEBBACKEND_H #include "../../../../core/WebBackend.h" namespace Otter { class QtWebKitPage; class QtWebKitSpellChecker; class QtWebKitWebBackend final : public WebBackend { Q_OBJECT public: enum OptionIdentifier { QtWebKitBackend_EnableMediaOption = 0, QtWebKitBackend_EnableMediaSourceOption, QtWebKitBackend_EnableWebSecurityOption }; explicit QtWebKitWebBackend(QObject *parent = nullptr); WebWidget* createWidget(const QVariantMap &parameters, ContentsWidget *parent = nullptr) override; WebPageThumbnailJob* createPageThumbnailJob(const QUrl &url, const QSize &size) override; QString getName() const override; QString getTitle() const override; QString getDescription() const override; QString getVersion() const override; QString getEngineVersion() const override; QString getSslVersion() const override; QString getUserAgent(const QString &pattern = {}) const override; QUrl getHomePage() const override; BackendCapabilities getCapabilities() const override; static int getOptionIdentifier(OptionIdentifier identifier); protected: static QtWebKitWebBackend* getInstance(); static QString getActiveDictionary(); protected slots: void handleOptionChanged(int identifier); void setActiveWidget(WebWidget *widget); private: bool m_isInitialized; static QtWebKitWebBackend* m_instance; static QPointer<WebWidget> m_activeWidget; static QHash<QString, QString> m_userAgentComponents; static QMap<QString, QString> m_userAgents; static int m_enableMediaOption; static int m_enableMediaSourceOption; static int m_enableWebSecurityOption; signals: void activeDictionaryChanged(const QString &dictionary); friend class QtWebKitSpellChecker; }; class QtWebKitWebPageThumbnailJob final : public WebPageThumbnailJob { Q_OBJECT public: explicit QtWebKitWebPageThumbnailJob(const QUrl &url, const QSize &size, QObject *parent = nullptr); QString getTitle() const override; QPixmap getThumbnail() const override; bool isRunning() const override; public slots: void start() override; void cancel() override; protected slots: void handlePageLoadFinished(bool result); private: QtWebKitPage *m_page; QString m_title; QUrl m_url; QSize m_size; QPixmap m_pixmap; }; } #endif
//____________________________________________________________________________ /*! \class genie::rew::GSystSet \brief Set of systematics to be considered by the reweighting package. \author Costas Andreopoulos <costas.andreopoulos \at stfc.ac.uk> STFC, Rutherford Appleton Laboratory \created Aug 1, 2009 \cpright Copyright (c) 2003-2013, GENIE Neutrino MC Generator Collaboration For the full text of the license visit http://copyright.genie-mc.org or see $GENIE/LICENSE */ //____________________________________________________________________________ #ifndef _G_SET_OF_SYSTEMATICS_H_ #define _G_SET_OF_SYSTEMATICS_H_ #include <string> #include <map> #include <vector> #include "ReWeight/GSyst.h" using std::string; using std::map; using std::vector; namespace genie { namespace rew { class GSystInfo; class GSystSet { public: GSystSet(); GSystSet(const GSystSet & syst_set); ~GSystSet(); void Init (GSyst_t syst, double init=0., double min=-1., double max=+1., double step=0.05); void Remove (GSyst_t syst); void Set (GSyst_t syst, double current_value); int Size (void) const; bool Added (GSyst_t syst) const; void Print (void); void Copy (const GSystSet & syst_set); const GSystInfo * Info(GSyst_t syst) const; vector<genie::rew::GSyst_t> AllIncluded (void); private: map<GSyst_t, GSystInfo *> fSystematics; }; class GSystInfo { public: GSystInfo() : CurValue(0), InitValue(0), MinValue(0), MaxValue(0), Step(0) { } GSystInfo(double init, double min, double max, double step) : CurValue(init), InitValue(init), MinValue(min), MaxValue(max), Step(step) { } ~GSystInfo() { } double CurValue; double InitValue; double MinValue; double MaxValue; double Step; }; } // rew namespace } // genie namespace #endif
/* 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 of the GNU 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 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 */ /* ==================================================================== * ==================================================================== * * Module: driver_util.h * $Revision: 1.2 $ * $Date: 02/11/07 23:41:18-00:00 $ * $Author: fchow@keyresearch.com $ * $Source: /scratch/mee/2.4-65/kpro64-pending/be/be/SCCS/s.driver_util.h $ * * Revision history: * 17-Feb-95 - Original Version * * Description: * supporting functions for the backend driver. * * ==================================================================== * ==================================================================== */ #ifndef driver_util_INCLUDED #define driver_util_INCLUDED #ifdef __cplusplus extern "C" { #endif extern void Get_Phase_Args (BE_PHASES, INT*, char ***); extern void Process_Command_Line (INT, char **); extern void Prepare_Source (void); extern void Prepare_Listing_File (void); extern void Lowering_Initialize (void); extern void Lower_Init(void); extern BOOL warnings_are_errors; #ifdef __cplusplus } #endif #endif /* driver_util_INCLUDED */
/* -*- c++ -*- */ /* * Copyright 2005 Free Software Foundation, Inc. * * This file is part of GNU Radio * * GNU Radio 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, or (at your option) * any later version. * * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_GR_FFT_FILTER_FFF_H #define INCLUDED_GR_FFT_FILTER_FFF_H #include <gr_core_api.h> #include <gr_sync_decimator.h> class gr_fft_filter_fff; typedef boost::shared_ptr<gr_fft_filter_fff> gr_fft_filter_fff_sptr; GR_CORE_API gr_fft_filter_fff_sptr gr_make_fft_filter_fff (int decimation, const std::vector<float> &taps); class gri_fft_filter_fff_generic; //class gri_fft_filter_fff_sse; /*! * \brief Fast FFT filter with float input, float output and float taps * \ingroup filter_blk */ class GR_CORE_API gr_fft_filter_fff : public gr_sync_decimator { private: friend GR_CORE_API gr_fft_filter_fff_sptr gr_make_fft_filter_fff (int decimation, const std::vector<float> &taps); int d_nsamples; bool d_updated; #if 1 // don't enable the sse version until handling it is worked out gri_fft_filter_fff_generic *d_filter; #else gri_fft_filter_fff_sse *d_filter; #endif std::vector<float> d_new_taps; /*! * Construct a FFT filter with the given taps * * \param decimation >= 1 * \param taps float filter taps */ gr_fft_filter_fff (int decimation, const std::vector<float> &taps); public: ~gr_fft_filter_fff (); void set_taps (const std::vector<float> &taps); int work (int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); }; #endif /* INCLUDED_GR_FFT_FILTER_FFF_H */
/* * Copyright (C) 2016 Stuart Howarth <showarth@marxoft.co.uk> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 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, see <http://www.gnu.org/licenses/>. */ #ifndef CACHINGNETWORKACCESSMANAGER_H #define CACHINGNETWORKACCESSMANAGER_H #include <QNetworkAccessManager> class CachingNetworkAccessManager : public QNetworkAccessManager { Q_OBJECT public: explicit CachingNetworkAccessManager(QObject *parent = 0); private: virtual QNetworkReply* createRequest(Operation op, const QNetworkRequest &req, QIODevice *outgoingData = 0); }; #endif // CACHINGNETWORKACCESSMANAGER_H
/* * This file is part of the Code::Blocks IDE and licensed under the GNU General Public License, version 3 * http://www.gnu.org/licenses/gpl-3.0.html */ #ifndef REOPENEDITORLISTVIEW_H #define REOPENEDITORLISTVIEW_H #include "loggers.h" class wxListEvent; class cbProject; class wxPanel; class ReopenEditorListView : public wxPanel { public: ReopenEditorListView(const wxArrayString& titles, const wxArrayInt& widths); ReopenEditorListView(const ReopenEditorListView& Original); ~ReopenEditorListView(); virtual size_t GetItemsCount() const; virtual void Prepend(const wxString& msg, Logger::level lv = Logger::info); virtual void Prepend(const wxArrayString& colValues, Logger::level lv = Logger::info); virtual void RemoveAt(size_t i); virtual wxArrayString GetItemAsArray(long item) const; virtual wxString GetFilename(long item) const; virtual cbProject* GetProject(long item) const; virtual void SetProject(long item, cbProject* prj) const; private: void Init(); private: wxListCtrl* m_pListControl; struct ListStyles { wxFont font; wxColour colour; }; ListStyles style[Logger::num_levels]; void OnDoubleClick(wxListEvent& event); void OnContextMenu(wxContextMenuEvent& /*event*/); void OnReopenItems(wxCommandEvent& event); void OnRemoveItems(wxCommandEvent& event); void OnReopenAll(wxCommandEvent& /*event*/); void OnRemoveAll(wxCommandEvent& /*event*/); void DoShowContextMenu(); void DoOpen(wxString fname); void DoOpen(wxArrayString fnames); DECLARE_EVENT_TABLE() }; #endif // REOPENEDITORLISTVIEW_H
// -*- C++ -*- /* Copyright (C) 1989, 1990, 1991, 1992, 2002, 2003, 2009 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) This file is part of groff. groff 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. groff 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/>. */ class ps_output { public: ps_output(FILE *, int max_line_length); ps_output &put_string(const char *, int); ps_output &put_number(int); ps_output &put_fix_number(int); ps_output &put_float(double); ps_output &put_symbol(const char *); ps_output &put_color(unsigned int); ps_output &put_literal_symbol(const char *); ps_output &set_fixed_point(int); ps_output &simple_comment(const char *); ps_output &begin_comment(const char *); ps_output &comment_arg(const char *); ps_output &end_comment(); ps_output &set_file(FILE *); ps_output &include_file(FILE *); ps_output &copy_file(FILE *); ps_output &end_line(); ps_output &put_delimiter(char); ps_output &special(const char *); FILE *get_file(); private: FILE *fp; int col; int max_line_length; // not including newline int need_space; int fixed_point; }; inline FILE *ps_output::get_file() { return fp; } enum resource_type { RESOURCE_FONT, RESOURCE_PROCSET, RESOURCE_FILE, RESOURCE_ENCODING, RESOURCE_FORM, RESOURCE_PATTERN }; struct resource; extern string an_empty_string; class resource_manager { public: resource_manager(); ~resource_manager(); void import_file(const char *filename, ps_output &); void need_font(const char *name); void print_header_comments(ps_output &); void document_setup(ps_output &); void output_prolog(ps_output &); private: unsigned extensions; unsigned language_level; resource *procset_resource; resource *resource_list; resource *lookup_resource(resource_type type, string &name, string &version = an_empty_string, unsigned revision = 0); resource *lookup_font(const char *name); void read_download_file(); void supply_resource(resource *r, int rank, FILE *outfp, int is_document = 0); void process_file(int rank, FILE *fp, const char *filename, FILE *outfp); resource *read_file_arg(const char **); resource *read_procset_arg(const char **); resource *read_font_arg(const char **); resource *read_resource_arg(const char **); void print_resources_comment(unsigned flag, FILE *outfp); void print_extensions_comment(FILE *outfp); void print_language_level_comment(FILE *outfp); int do_begin_resource(const char *ptr, int rank, FILE *fp, FILE *outfp); int do_include_resource(const char *ptr, int rank, FILE *fp, FILE *outfp); int do_begin_document(const char *ptr, int rank, FILE *fp, FILE *outfp); int do_include_document(const char *ptr, int rank, FILE *fp, FILE *outfp); int do_begin_procset(const char *ptr, int rank, FILE *fp, FILE *outfp); int do_include_procset(const char *ptr, int rank, FILE *fp, FILE *outfp); int do_begin_font(const char *ptr, int rank, FILE *fp, FILE *outfp); int do_include_font(const char *ptr, int rank, FILE *fp, FILE *outfp); int do_begin_file(const char *ptr, int rank, FILE *fp, FILE *outfp); int do_include_file(const char *ptr, int rank, FILE *fp, FILE *outfp); int change_to_end_resource(const char *ptr, int rank, FILE *fp, FILE *outfp); int do_begin_preview(const char *ptr, int rank, FILE *fp, FILE *outfp); int do_begin_data(const char *ptr, int rank, FILE *fp, FILE *outfp); int do_begin_binary(const char *ptr, int rank, FILE *fp, FILE *outfp); }; extern unsigned broken_flags; // broken_flags is ored from these enum { NO_SETUP_SECTION = 01, STRIP_PERCENT_BANG = 02, STRIP_STRUCTURE_COMMENTS = 04, USE_PS_ADOBE_2_0 = 010, NO_PAPERSIZE = 020 }; #include "searchpath.h" extern search_path include_search_path;
/* * See the file LICENSE for redistribution information. * * Copyright (c) 2005, 2015 Oracle and/or its affiliates. All rights reserved. * * $Id$ */ #include "bench.h" static int usage(void); int b_curalloc(int argc, char *argv[]) { extern char *optarg; extern int optind; DB *dbp; DBC *curp; int ch, i, count; count = 100000; while ((ch = getopt(argc, argv, "c:")) != EOF) switch (ch) { case 'c': count = atoi(optarg); break; case '?': default: return (usage()); } argc -= optind; argv += optind; if (argc != 0) return (usage()); /* Create the database. */ DB_BENCH_ASSERT(db_create(&dbp, NULL, 0) == 0); dbp->set_errfile(dbp, stderr); #if DB_VERSION_MAJOR > 4 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1) DB_BENCH_ASSERT(dbp->open( dbp, NULL, TESTFILE, NULL, DB_BTREE, DB_CREATE, 0666) == 0); #else DB_BENCH_ASSERT( dbp->open(dbp, TESTFILE, NULL, DB_BTREE, DB_CREATE, 0666) == 0); #endif /* Allocate a cursor count times. */ TIMER_START; for (i = 0; i < count; ++i) { DB_BENCH_ASSERT(dbp->cursor(dbp, NULL, &curp, 0) == 0); DB_BENCH_ASSERT(curp->c_close(curp) == 0); } TIMER_STOP; printf("# %d cursor allocations\n", count); TIMER_DISPLAY(count); DB_BENCH_ASSERT(dbp->close(dbp, 0) == 0); return (0); } static int usage() { (void)fprintf(stderr, "usage: b_curalloc [-c count]\n"); return (EXIT_FAILURE); }
/**************************************************************** * * * Copyright 2001, 2013 Fidelity Information Services, Inc * * * * This source code contains the intellectual property * * of its copyright holder(s), and is made available * * under a license. If you do not know the terms of * * the license, please stop and do not read further. * * * ****************************************************************/ #ifndef _REPL_CTL_H #define _REPL_CTL_H #ifdef GTM_CRYPT #include "gtmcrypt.h" /* for gtmcrypt_key_t type used in repl_ctl_element */ #endif typedef enum { JNL_FILE_UNREAD, JNL_FILE_OPEN, JNL_FILE_CLOSED, JNL_FILE_EMPTY, JNL_FILE_STATES } jnl_file_state; typedef enum { TR_NOT_FOUND, TR_FIND_ERR, TR_WILL_NOT_BE_FOUND, TR_FIND_WOULD_BLOCK, TR_FOUND } tr_search_state_t; typedef enum { TR_LINEAR_SEARCH, TR_BINARY_SEARCH } tr_search_method_t; typedef struct { unsigned char *recbuff; /* The journal record pointer */ int reclen; /* The journal record length */ uint4 recaddr; /* On-disk journal record offset */ uint4 readaddr; /* Next on-disk read offset */ uint4 buffremaining; /* Remaining buffer space */ unsigned char *base_buff; /* Actual malloced buffer start : Not necessarily "gtm_fs_block_size" aligned */ unsigned char *base; /* "gtm_fs_block_size" aligned buffer start */ # ifdef DEBUG uint4 save_readaddr; /* copy of readaddr before repl_read_file updates it */ uint4 save_dskaddr; /* copy of dskaddr noted down, in repl_read_file, from shared memory */ uint4 save_buffremaining; /* copy of buffremaining before repl_read_file updates it */ # endif } repl_buff_desc; #define REPL_BLKSIZE(x) ((x)->fc->jfh->alignsize) typedef struct { uint4 eof_addr; /* On-disk last byte offset */ uint4 fs_block_size; /* underlying journal file system block size */ jnl_file_header *jfh_base; jnl_file_header *jfh; int fd; gd_id id; } repl_file_control_t; enum { REPL_MAINBUFF = 0, REPL_SCRATCHBUFF, REPL_NUMBUFF }; typedef struct { int buffindex; repl_buff_desc buff[2]; /* Main buffer, and scratch */ repl_file_control_t *fc; struct repl_ctl_struct *backctl; /* Back pointer to ctl element to * which this buffer belongs */ } repl_buff_t; /* * repl_ctl_element maintains information for reading from the journal * files. A list of these structures consists sub-lists, each sub-list * corresponding to a region. Each sub-list contains info about the various * generations of the journal file of particular region, the earliest * generation coming first while searching from the beginning of the list */ typedef struct repl_ctl_struct { gd_region *reg; repl_buff_t *repl_buff; seq_num min_seqno; /* least JNL_SEQNO in this file */ seq_num max_seqno; /* largest JNL_SEQNO in this file */ uint4 min_seqno_dskaddr; uint4 max_seqno_dskaddr; seq_num seqno; /* Next read positioned at first * jnl rec with JNL_SEQNO seqno */ trans_num tn; /* tn corresponding to seqno */ int4 file_state; /* enum jnl_file_state */ boolean_t lookback; boolean_t first_read_done; boolean_t eof_addr_final; /* TRUE if the journal file is switched and the final eof addr for this jnl file * is noted down */ boolean_t max_seqno_final; /* TRUE ONLY if ctl->eof_addr_final is TRUE and if source server has noted down * the final max_seqno for this journal file */ boolean_t read_complete; int4 jnl_fn_len; char jnl_fn[JNL_NAME_SIZE]; struct repl_ctl_struct *prev; struct repl_ctl_struct *next; # ifdef GTM_CRYPT gtmcrypt_key_t encr_key_handle; # endif } repl_ctl_element; typedef struct { seq_num seqno; /* the last sequence number seen in a block before linear search returns */ seq_num prev_seqno; /* the one previous to the last one */ } tr_search_status_t; #define JNL_BLK_DSKADDR(addr, blksize) \ ((ROUND_DOWN((addr), (blksize)) > JNL_FILE_FIRST_RECORD) ? \ ROUND_DOWN((addr), (blksize)) : JNL_FILE_FIRST_RECORD) int repl_ctl_close(repl_ctl_element *ctl); int repl_ctl_create(repl_ctl_element **ctl, gd_region *reg, int jnl_fn_len, char *jnl_fn, boolean_t init); int repl_open_jnl_file_by_name(repl_ctl_element *tmp_ctl, int jnl_fn_len, char *jnl_fn, int *fd_ptr, void *stat_buf_ptr); #endif
#include "coordconvert.h" #include "math.h" // Some numerical values related to WGS 84 ellipsoid #define A 6378137 // semi major axis #define E 0.081819190842622 // first eccentricity // convert (long,lat,h) to ECEF coord sys. (X,Y,Z) void geotedic_to_ECEF(double lg, double lt, double h, double *X, double *Y, double *Z) { double pi = acos(-1); lg = lg*pi/180.; lt = lt*pi/180.; double N = A/sqrt(1.-E*E*sin(lt)*sin(lt)); *X=(N+h)*cos(lt)*cos(lg); *Y=(N+h)*cos(lt)*sin(lg); *Z=(N*(1.-E*E)+h)*sin(lt); } // given (X,Y,Z) ECEF coord, computes the alt above the WGS 84 ellipsoid // (faster than ECEF_to_lgt_lat_alt, but only gives the altitude) double get_altitude_from_ECEF(double X, double Y, double Z) { double p = sqrt(X*X+Y*Y); double k0 = 1./(1.-E*E); double c0 = pow(p*p+(1.-E*E)*Z*Z*k0*k0,1.5)/(A*E*E); double k1 = k0; double c1 = c0; double h0=-10000.,h; double diff=10000.; // newton-raphson; most of the time, // only takes 2 iterations int max_nb_iter=15,nb_iter=0; while( (fabs(diff)>0.001) && (nb_iter <= max_nb_iter) ) { k1 = 1. + (p*p+(1.-E*E)*Z*Z*k1*k1*k1)/(c1-p*p); c1 = pow(p*p+(1.-E*E)*Z*Z*k1*k1,1.5)/(A*E*E); h = sqrt(p*p+Z*Z*k1*k1)*(1./k1-1./k0)/(E*E); diff=h0-h; h0=h; nb_iter++; } return h; } // given (X,Y,Z) ECEF coord, computes the lat/long/alt // above the WGS 84 ellipsoid void ECEF_to_lgt_lat_alt(double X, double Y, double Z, double *lgt, double *lat, double *h) { double E2=E*E; double deg2rad=atan2(1,1)/45.; double epsilon_phi = 1e-12; double kpi=45./atan2(1,1); double R=sqrt(X*X+Y*Y); double phi1 = atan2(Z,R*(1-A*E2/sqrt(X*X+Y*Y+Z*Z))); double phi0 = phi1 + 10.*epsilon_phi; // altitude int max_nb_iter=15,nb_iter=0; while ( (fabs(phi1-phi0) > epsilon_phi) && (nb_iter <= max_nb_iter) ) { phi0 = phi1; phi1 = atan2(Z/R,1-A*E2*cos(phi0)/(R*sqrt(1-E2*sin(phi0)*sin(phi0)))); *h=R/cos(phi1)-A/sqrt(1-E2*sin(phi1)*sin(phi1)); nb_iter++; } // longitude *lgt = atan2(Y,X)*kpi; //latitude *lat = phi1*kpi; }
// vim : set fileencoding=utf-8 expandtab noai ts=4 sw=4 : /// @addtogroup mmu_cache /// @{ /// @file nocache.h /// Cache placeholder. Implements the cache interface and forwards request to /// mmu or ahb interface depending on the configuration. /// /// @date 2010-2015 /// @copyright All rights reserved. /// Any reproduction, use, distribution or disclosure of this /// program, without the express, prior written consent of the /// authors is strictly prohibited. /// @author Thomas Schuster /// #ifndef __NOCACHE_H_ #define __NOCACHE_H_ #include "core/common/base.h" #include "core/common/systemc.h" #include "core/common/sr_signal.h" #include "core/common/verbose.h" #include "gaisler/leon3/mmucache/cache_if.h" #include "gaisler/leon3/mmucache/mem_if.h" class nocache : public DefaultBase, public cache_if { public: // External interface functions (mem_if): // ----------------------------------------------------------- /// read from cache virtual bool mem_read(unsigned int address, unsigned int asi, unsigned char * data, unsigned int len, sc_core::sc_time * t, unsigned int * debug, bool is_dbg, bool &cacheable, bool is_lock = false); /// write through cache virtual void mem_write(unsigned int address, unsigned int asi, unsigned char * data, unsigned int len, sc_core::sc_time * t, unsigned int * debug, bool is_dbg, bool &cacheable, bool is_lock = false); /// flush cache virtual void flush(sc_core::sc_time * t, unsigned int * debug, bool is_dbg); /// read data cache tags (ASI 0xe) virtual void read_cache_tag(unsigned int address, unsigned int * data, sc_core::sc_time *t); /// write data cache tags (ASI 0xe) virtual void write_cache_tag(unsigned int address, unsigned int * data, sc_core::sc_time *t); /// read data cache entries/data (ASI 0xf) virtual void read_cache_entry(unsigned int address, unsigned int * data, sc_core::sc_time *t); /// write data cache entries/data (ASI 0xf) virtual void write_cache_entry(unsigned int address, unsigned int * data, sc_core::sc_time *t); /// read cache configuration register (ASI 0x2) virtual unsigned int read_config_reg(sc_core::sc_time *t); /// implement ccr check (not there) virtual unsigned int check_mode(); /// implement cache type function virtual t_cache_type get_cache_type(); /// dummy snooping function virtual void snoop_invalidate(const t_snoop& snoop, const sc_core::sc_time& delay); /// Helper functions for definition of clock cycle void clkcng(sc_core::sc_time &clk); // debug and helper functions // -------------------------- /// display of cache lines for debug virtual void dbg_out(unsigned int line); // constructor nocache(ModuleName name, mem_if * _mem_adapter); // destructor virtual ~nocache() { } ; private: mem_if * m_mem_adapter; }; #endif // __NOCACHE_H_ /// @}
/* * Copyright (C) 2008 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. * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef JSDOMWindowShell_h #define JSDOMWindowShell_h #include "JSDOMWindow.h" #include "JSDOMBinding.h" namespace WebCore { class DOMWindow; class Frame; class JSDOMWindowShell : public DOMObject { typedef DOMObject Base; public: JSDOMWindowShell(PassRefPtr<DOMWindow>); virtual ~JSDOMWindowShell(); JSDOMWindow* window() const { return m_window; } void setWindow(JSDOMWindow* window) { ASSERT_ARG(window, window); m_window = window; setPrototype(window->prototype()); } void setWindow(PassRefPtr<DOMWindow>); static const JSC::ClassInfo s_info; DOMWindow* impl() const; void disconnectFrame(); void clear(); void* operator new(size_t); static PassRefPtr<JSC::Structure> createStructure(JSC::JSValuePtr prototype) { return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType)); } private: virtual void mark(); virtual JSC::UString className() const; virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&); virtual void put(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSValuePtr, JSC::PutPropertySlot&); virtual void putWithAttributes(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSValuePtr, unsigned attributes); virtual bool deleteProperty(JSC::ExecState*, const JSC::Identifier& propertyName); virtual void getPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&); virtual bool getPropertyAttributes(JSC::ExecState*, const JSC::Identifier& propertyName, unsigned& attributes) const; virtual void defineGetter(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction); virtual void defineSetter(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* setterFunction); virtual JSC::JSValuePtr lookupGetter(JSC::ExecState*, const JSC::Identifier& propertyName); virtual JSC::JSValuePtr lookupSetter(JSC::ExecState*, const JSC::Identifier& propertyName); virtual JSC::JSObject* unwrappedObject(); virtual const JSC::ClassInfo* classInfo() const { return &s_info; } JSDOMWindow* m_window; }; JSC::JSValuePtr toJS(JSC::ExecState*, Frame*); JSDOMWindowShell* toJSDOMWindowShell(Frame*); } // namespace WebCore #endif // JSDOMWindowShell_h
/**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtQml module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional ** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QV4PROPERTYDESCRIPTOR_H #define QV4PROPERTYDESCRIPTOR_H #include "qv4global_p.h" #include "qv4value_p.h" #include "qv4internalclass_p.h" QT_BEGIN_NAMESPACE namespace QV4 { struct FunctionObject; struct Property { union { Value value; struct { FunctionObject *get; FunctionObject *set; }; }; // Section 8.10 inline void fullyPopulated(PropertyAttributes *attrs) { if (!attrs->hasType()) { value = Primitive::undefinedValue(); } if (attrs->type() == PropertyAttributes::Accessor) { attrs->clearWritable(); if (get == (FunctionObject *)0x1) get = 0; if (set == (FunctionObject *)0x1) set = 0; } attrs->resolve(); } static inline Property fromValue(Value v) { Property pd; pd.value = v; return pd; } static inline Property fromAccessor(FunctionObject *getter, FunctionObject *setter) { Property pd; pd.get = getter; pd.set = setter; return pd; } static Property genericDescriptor() { Property pd; pd.value = Primitive::emptyValue(); return pd; } inline bool isSubset(const PropertyAttributes &attrs, const Property &other, PropertyAttributes otherAttrs) const; inline void merge(PropertyAttributes &attrs, const Property &other, PropertyAttributes otherAttrs); inline FunctionObject *getter() const { return get; } inline FunctionObject *setter() const { return set; } inline void setGetter(FunctionObject *g) { get = g; } inline void setSetter(FunctionObject *s) { set = s; } }; inline bool Property::isSubset(const PropertyAttributes &attrs, const Property &other, PropertyAttributes otherAttrs) const { if (attrs.type() != PropertyAttributes::Generic && attrs.type() != otherAttrs.type()) return false; if (attrs.hasEnumerable() && attrs.isEnumerable() != otherAttrs.isEnumerable()) return false; if (attrs.hasConfigurable() && attrs.isConfigurable() != otherAttrs.isConfigurable()) return false; if (attrs.hasWritable() && attrs.isWritable() != otherAttrs.isWritable()) return false; if (attrs.type() == PropertyAttributes::Data && !value.sameValue(other.value)) return false; if (attrs.type() == PropertyAttributes::Accessor) { if (get != other.get) return false; if (set != other.set) return false; } return true; } inline void Property::merge(PropertyAttributes &attrs, const Property &other, PropertyAttributes otherAttrs) { if (otherAttrs.hasEnumerable()) attrs.setEnumerable(otherAttrs.isEnumerable()); if (otherAttrs.hasConfigurable()) attrs.setConfigurable(otherAttrs.isConfigurable()); if (otherAttrs.hasWritable()) attrs.setWritable(otherAttrs.isWritable()); if (otherAttrs.type() == PropertyAttributes::Accessor) { attrs.setType(PropertyAttributes::Accessor); if (other.get) get = (other.get == (FunctionObject *)0x1) ? 0 : other.get; if (other.set) set = (other.set == (FunctionObject *)0x1) ? 0 : other.set; } else if (otherAttrs.type() == PropertyAttributes::Data){ attrs.setType(PropertyAttributes::Data); value = other.value; } } } QT_END_NAMESPACE #endif
/* XMMS2 - X Music Multiplexer System * Copyright (C) 2003-2007 XMMS2 Team * * PLUGINS ARE NOT CONSIDERED TO BE DERIVED WORK !!! * * 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. */ #ifndef __MAIN_H__ #define __MAIN_H__ #define CLI_CLIENTNAME "xmms2-nycli" #define XMMS2_CLI_VERSION "0.1 (Speak To Me)" /* FIXME: shall be loaded from config when config exists */ #define STDINFD 0 #define MAX_CACHE_REFRESH_LOOP 200 #define MAX_INT_VALUE_BUFFER_SIZE 64 /* FIXME: Change this to use gettext later on */ #define _(String) (String) #define N_(String) String #define textdomain(Domain) #define bindtextdomain(Package, Directory) #define COMMAND_REQ_CHECK(action, reqmask) (((reqmask) & (action)->req) == (reqmask)) typedef struct cli_infos_St cli_infos_t; typedef struct cli_cache_St cli_cache_t; typedef struct status_entry_St status_entry_t; typedef struct command_trie_St command_trie_t; typedef struct command_action_St command_action_t; typedef struct command_context_St command_context_t; typedef struct command_argument_St command_argument_t; typedef struct configuration_St configuration_t; typedef struct alias_define_St alias_define_t; typedef GOptionEntry argument_t; typedef void (*command_setup_func)(command_action_t *action); typedef gboolean (*command_exec_func)(cli_infos_t *infos, command_context_t *ctx); typedef enum { CMD_TYPE_COMMAND, CMD_TYPE_ALIAS, } cmd_type_t; typedef enum { COMMAND_REQ_NONE = 0, COMMAND_REQ_CONNECTION = 1, /* need server connection */ COMMAND_REQ_NO_AUTOSTART = 2, /* don't start server if not running */ COMMAND_REQ_CACHE = 4 /* need cache */ } command_req_t; struct command_context_St { gchar *name; gint argc; gchar **argv; GHashTable *flags; }; struct command_action_St { gchar *name; gchar *usage; gchar *description; command_exec_func callback; command_req_t req; argument_t *argdefs; }; typedef enum { COMMAND_ARGUMENT_TYPE_BOOLEAN = G_OPTION_ARG_NONE, COMMAND_ARGUMENT_TYPE_INT = G_OPTION_ARG_INT, COMMAND_ARGUMENT_TYPE_STRING = G_OPTION_ARG_STRING } command_argument_type_t; typedef union { gboolean vbool; gint vint; gchar *vstring; } command_argument_value_t; struct command_argument_St { command_argument_type_t type; command_argument_value_t value; }; void command_run (cli_infos_t *infos, gchar *input); void flag_dispatch (cli_infos_t *infos, gint in_argc, gchar **in_argv); void command_dispatch (cli_infos_t *infos, gint in_argc, gchar **in_argv); #endif /* __MAIN_H__ */
/* ********************************************************** * Copyright (c) 2006-2008 VMware, Inc. All rights reserved. * **********************************************************/ /* * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * * Neither the name of VMware, Inc. nor the names of its contributors may be * used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL VMWARE, INC. OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. */ /* Generates a .B from a trace. * FIXME: need to put in a template * FIXME: need to make native work (exception handling stuff) * FIXME: need to make it work with -detect_mode */ #define NEED_HANDLER 1 #include "tools.h" #define NUM_TIMES 100 #define SWITCH_AFTER 50 /* totally random dummy function */ int dummycall() { int i = 1, j = 2; if ((i += 10) < (j -= 50)) return i + j - 32; else return i - j + 32; } int badtarget = 10; /* .B */ int bad_trace4() { int i, j; int a = 1, b = 100, c = 1000; int (*fnptr)(); fnptr = dummycall; for (i = 0; i < NUM_TIMES; i++) { for (j = 0; j < NUM_TIMES; j++) { if (a < b) { a++; c--; fnptr(); } else { a -= 5; c--; fnptr(); } if (c < SWITCH_AFTER) { fnptr = (int (*)()) & badtarget; print("Next time around jump to data section\n"); } } } return 0; } int main() { INIT(); print("Start\n"); bad_trace4(); print("SHOULD NEVER GET HERE\n"); }
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2011 Ruby-GNOME2 Project Team * Copyright (C) 2004 Masao Mutoh * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA */ #include "rbgtk3private.h" #define RG_TARGET_NAMESPACE cExpander #define _SELF(self) (RVAL2GTKEXPANDER(self)) static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE label, with_mnemonic; GtkWidget* widget = NULL; rb_scan_args(argc, argv, "11", &label, &with_mnemonic); if (NIL_P(with_mnemonic) || ! RVAL2CBOOL(with_mnemonic)){ widget = gtk_expander_new(RVAL2CSTR(label)); } else { widget = gtk_expander_new_with_mnemonic(RVAL2CSTR(label)); } RBGTK_INITIALIZE(self, widget); return Qnil; } void Init_gtk_expander(VALUE mGtk) { VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_EXPANDER, "Expander", mGtk); RG_DEF_METHOD(initialize, -1); }
/* * 6lowpan neighbor discovery * * Copyright (C) 2013 INRIA. * * This file is subject to the terms and conditions of the GNU Lesser * General Public License v2.1. See the file LICENSE in the top level * directory for more details. */ /** * @ingroup net_sixlowpan * @{ * @file sixlowpan/icmp.h * @brief 6lowpan neighbor discovery constants, data structs, and prototypes * @author Stephan Zeisberg <zeisberg@mi.fu-berlin.de> * @author Martin Lenders <mlenders@inf.fu-berlin.de> * @author Oliver Gesch <oliver.gesch@googlemail.com> * @} */ #ifndef _SIXLOWPAN_ICMP_H #define _SIXLOWPAN_ICMP_H #include <stdint.h> #include "vtimer.h" #include "sixlowpan/icmp.h" #include "sixlowpan/ndp.h" #include "sixlowpan/types.h" #include "lowpan.h" #include "ip.h" enum option_types_t { OPT_SLLAO = 1, OPT_TLLAO, OPT_PI, OPT_MTU, OPT_ARO, OPT_6CO, OPT_ABRO, OPT_DAR, OPT_DAC, }; extern kernel_pid_t nd_nbr_cache_rem_pid; void recv_echo_req(void); void recv_echo_repl(void); void recv_rtr_sol(void); void recv_rtr_adv(void); void recv_nbr_adv(void); void recv_nbr_sol(void); void nbr_cache_auto_rem(void); ndp_a6br_cache_t *abr_add_context(uint16_t version, ipv6_addr_t *abr_addr, uint8_t cid); void abr_remove_context(uint8_t cid); #endif /* _SIXLOWPAN_ICMP_H*/
/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt Assistant of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional ** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef HELPWINDOW_H #define HELPWINDOW_H #include <QtGui/QWidget> QT_BEGIN_NAMESPACE class QTextEdit; class HelpWindow : public QWidget { Q_OBJECT public: HelpWindow(QWidget *parent = 0); void setHelp(const QString &topic); private: QTextEdit *m_textEdit; }; QT_END_NAMESPACE #endif
#ifndef CVHAARCLASSIFIERCASCADE_NAME #include "opencv2/opencv.hpp" #include "opencv2/legacy/legacy.hpp" #include "opencv2/legacy/compat.hpp" #include "luacvaux.h" #include "CvSize.h" #include "CvHaarStageClassifier.h" #define CVHAARCLASSIFIERCASCADE_NAME "CvHaarClassifierCascade" #define checkCvHaarClassifierCascade(L,i) luacv_checkObject<CvHaarClassifierCascade>(L,i,CVHAARCLASSIFIERCASCADE_NAME) #define pushCvHaarClassifierCascade(L,data) luacv_pushObject<CvHaarClassifierCascade>(L,data,CVHAARCLASSIFIERCASCADE_NAME,false) extern const struct luaL_Reg CvHaarClassifierCascade_m[]; #endif