text
stringlengths
4
6.14k
/* This file handles the 4 system calls that get and set uids and gids. * It also handles getpid(), setsid(), and getpgrp(). The code for each * one is so tiny that it hardly seemed worthwhile to make each a separate * function. */ #include "mm.h" #include <minix/callnr.h> #include <signal.h> #include "mproc.h" #include "param.h" /*===========================================================================* * do_getset * *===========================================================================*/ PUBLIC int do_getset() { /* Handle GETUID, GETGID, GETPID, GETPGRP, SETUID, SETGID, SETSID. The four * GETs and SETSID return their primary results in 'r'. GETUID, GETGID, and * GETPID also return secondary results (the effective IDs, or the parent * process ID) in 'reply_res2', which is returned to the user. */ register struct mproc *rmp = mp; register int r; switch(mm_call) { case GETUID: r = rmp->mp_realuid; rmp->reply_res2 = rmp->mp_effuid; break; case GETGID: r = rmp->mp_realgid; rmp->reply_res2 = rmp->mp_effgid; break; case GETPID: r = mproc[who].mp_pid; rmp->reply_res2 = mproc[rmp->mp_parent].mp_pid; break; case SETUID: if (rmp->mp_realuid != usr_id && rmp->mp_effuid != SUPER_USER) return(EPERM); rmp->mp_realuid = usr_id; rmp->mp_effuid = usr_id; tell_fs(SETUID, who, usr_id, usr_id); r = OK; break; case SETGID: if (rmp->mp_realgid != grpid && rmp->mp_effuid != SUPER_USER) return(EPERM); rmp->mp_realgid = grpid; rmp->mp_effgid = grpid; tell_fs(SETGID, who, grpid, grpid); r = OK; break; case SETSID: if (rmp->mp_procgrp == rmp->mp_pid) return(EPERM); rmp->mp_procgrp = rmp->mp_pid; tell_fs(SETSID, who, 0, 0); /*FALL THROUGH*/ case GETPGRP: r = rmp->mp_procgrp; break; default: r = EINVAL; break; } return(r); }
/*- * Copyright (c) 2003 Nate Lawson * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/kernel.h> #include <sys/bus.h> #include <sys/sbuf.h> #include <machine/bus.h> #include <machine/resource.h> #include <sys/rman.h> #include <contrib/dev/acpica/include/acpi.h> #include <dev/acpica/acpivar.h> /* * Package manipulation convenience functions */ int acpi_PkgInt(ACPI_OBJECT *res, int idx, UINT64 *dst) { ACPI_OBJECT *obj; obj = &res->Package.Elements[idx]; if (obj == NULL || obj->Type != ACPI_TYPE_INTEGER) return (EINVAL); *dst = obj->Integer.Value; return (0); } int acpi_PkgInt32(ACPI_OBJECT *res, int idx, uint32_t *dst) { UINT64 tmp; int error; error = acpi_PkgInt(res, idx, &tmp); if (error == 0) *dst = (uint32_t)tmp; return (error); } int acpi_PkgStr(ACPI_OBJECT *res, int idx, void *dst, size_t size) { ACPI_OBJECT *obj; void *ptr; size_t length; obj = &res->Package.Elements[idx]; if (obj == NULL) return (EINVAL); bzero(dst, sizeof(dst)); switch (obj->Type) { case ACPI_TYPE_STRING: ptr = obj->String.Pointer; length = obj->String.Length; break; case ACPI_TYPE_BUFFER: ptr = obj->Buffer.Pointer; length = obj->Buffer.Length; break; default: return (EINVAL); } /* Make sure string will fit, including terminating NUL */ if (++length > size) return (E2BIG); strlcpy(dst, ptr, length); return (0); } int acpi_PkgGas(device_t dev, ACPI_OBJECT *res, int idx, int *type, int *rid, struct resource **dst, u_int flags) { ACPI_GENERIC_ADDRESS gas; ACPI_OBJECT *obj; obj = &res->Package.Elements[idx]; if (obj == NULL || obj->Type != ACPI_TYPE_BUFFER || obj->Buffer.Length < sizeof(ACPI_GENERIC_ADDRESS) + 3) return (EINVAL); memcpy(&gas, obj->Buffer.Pointer + 3, sizeof(gas)); return (acpi_bus_alloc_gas(dev, type, rid, &gas, dst, flags)); } ACPI_HANDLE acpi_GetReference(ACPI_HANDLE scope, ACPI_OBJECT *obj) { ACPI_HANDLE h; if (obj == NULL) return (NULL); switch (obj->Type) { case ACPI_TYPE_LOCAL_REFERENCE: case ACPI_TYPE_ANY: h = obj->Reference.Handle; break; case ACPI_TYPE_STRING: /* * The String object usually contains a fully-qualified path, so * scope can be NULL. * * XXX This may not always be the case. */ if (ACPI_FAILURE(AcpiGetHandle(scope, obj->String.Pointer, &h))) h = NULL; break; default: h = NULL; break; } return (h); }
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE427_Uncontrolled_Search_Path_Element__char_environment_09.c Label Definition File: CWE427_Uncontrolled_Search_Path_Element.label.xml Template File: sources-sink-09.tmpl.c */ /* * @description * CWE: 427 Uncontrolled Search Path Element * BadSource: environment Read input from an environment variable * GoodSource: Use a hardcoded path * Sink: * BadSink : Set the environment variable * Flow Variant: 09 Control flow: if(GLOBAL_CONST_TRUE) and if(GLOBAL_CONST_FALSE) * * */ #include "std_testcase.h" #include <wchar.h> #ifdef _WIN32 #define NEW_PATH "%SystemRoot%\\system32" #define PUTENV _putenv #else #define NEW_PATH "/bin" #define PUTENV putenv #endif #define ENV_VARIABLE "ADD" #ifdef _WIN32 #define GETENV getenv #else #define GETENV getenv #endif #ifndef OMITBAD void CWE427_Uncontrolled_Search_Path_Element__char_environment_09_bad() { char * data; char dataBuffer[250] = "PATH="; data = dataBuffer; if(GLOBAL_CONST_TRUE) { { /* Append input from an environment variable to data */ size_t dataLen = strlen(data); char * environment = GETENV(ENV_VARIABLE); /* If there is data in the environment variable */ if (environment != NULL) { /* POTENTIAL FLAW: Read data from an environment variable */ strncat(data+dataLen, environment, 250-dataLen-1); } } } /* POTENTIAL FLAW: Set a new environment variable with a path that is possibly insecure */ PUTENV(data); } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B1() - use goodsource and badsink by changing the GLOBAL_CONST_TRUE to GLOBAL_CONST_FALSE */ static void goodG2B1() { char * data; char dataBuffer[250] = "PATH="; data = dataBuffer; if(GLOBAL_CONST_FALSE) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { /* FIX: Set the path as the "system" path */ strcat(data, NEW_PATH); } /* POTENTIAL FLAW: Set a new environment variable with a path that is possibly insecure */ PUTENV(data); } /* goodG2B2() - use goodsource and badsink by reversing the blocks in the if statement */ static void goodG2B2() { char * data; char dataBuffer[250] = "PATH="; data = dataBuffer; if(GLOBAL_CONST_TRUE) { /* FIX: Set the path as the "system" path */ strcat(data, NEW_PATH); } /* POTENTIAL FLAW: Set a new environment variable with a path that is possibly insecure */ PUTENV(data); } void CWE427_Uncontrolled_Search_Path_Element__char_environment_09_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()..."); CWE427_Uncontrolled_Search_Path_Element__char_environment_09_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE427_Uncontrolled_Search_Path_Element__char_environment_09_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE415_Double_Free__malloc_free_int64_t_82.h Label Definition File: CWE415_Double_Free__malloc_free.label.xml Template File: sources-sinks-82.tmpl.h */ /* * @description * CWE: 415 Double Free * BadSource: Allocate data using malloc() and Deallocate data using free() * GoodSource: Allocate data using malloc() * Sinks: * GoodSink: do nothing * BadSink : Deallocate data using free() * Flow Variant: 82 Data flow: data passed in a parameter to an virtual method called via a pointer * * */ #include "std_testcase.h" #include <wchar.h> namespace CWE415_Double_Free__malloc_free_int64_t_82 { class CWE415_Double_Free__malloc_free_int64_t_82_base { public: /* pure virtual function */ virtual void action(int64_t * data) = 0; }; #ifndef OMITBAD class CWE415_Double_Free__malloc_free_int64_t_82_bad : public CWE415_Double_Free__malloc_free_int64_t_82_base { public: void action(int64_t * data); }; #endif /* OMITBAD */ #ifndef OMITGOOD class CWE415_Double_Free__malloc_free_int64_t_82_goodG2B : public CWE415_Double_Free__malloc_free_int64_t_82_base { public: void action(int64_t * data); }; class CWE415_Double_Free__malloc_free_int64_t_82_goodB2G : public CWE415_Double_Free__malloc_free_int64_t_82_base { public: void action(int64_t * data); }; #endif /* OMITGOOD */ }
/*************************************************************************** * * Copyright (c) 2012 Baidu.com, Inc. All Rights Reserved * $Id$ * **************************************************************************/ /** * @file callback_recv_impl.h * @author * @date 2012/11/13 11:31:37 * @version 1.0.0 * @brief * **/ #ifndef __CALLBACK_RECV_IMPL_H_ #define __CALLBACK_RECV_IMPL_H_ #include "output-cpp/callback.h" class callback_recv_impl_t : public demo::CallbackRecver { public: virtual demo::CallbackResult Callback( int32_t val, const std::map<std::string, std::string>& ctx); }; #endif //__CALLBACK_RECV_IMPL_H_ /* vim: set ts=4 sw=4 sts=4 tw=100 noet: */
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE122_Heap_Based_Buffer_Overflow__c_CWE806_wchar_t_memmove_51b.c Label Definition File: CWE122_Heap_Based_Buffer_Overflow__c_CWE806.label.xml Template File: sources-sink-51b.tmpl.c */ /* * @description * CWE: 122 Heap Based Buffer Overflow * BadSource: Initialize data as a large string * GoodSource: Initialize data as a small string * Sink: memmove * BadSink : Copy data to string using memmove * Flow Variant: 51 Data flow: data passed as an argument from one function to another 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 void CWE122_Heap_Based_Buffer_Overflow__c_CWE806_wchar_t_memmove_51b_badSink(wchar_t * data) { { wchar_t dest[50] = L""; /* POTENTIAL FLAW: Possible buffer overflow if data is larger than dest */ memmove(dest, data, wcslen(data)*sizeof(wchar_t)); dest[50-1] = L'\0'; /* Ensure the destination buffer is null terminated */ printWLine(data); free(data); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ void CWE122_Heap_Based_Buffer_Overflow__c_CWE806_wchar_t_memmove_51b_goodG2BSink(wchar_t * data) { { wchar_t dest[50] = L""; /* POTENTIAL FLAW: Possible buffer overflow if data is larger than dest */ memmove(dest, data, wcslen(data)*sizeof(wchar_t)); dest[50-1] = L'\0'; /* Ensure the destination buffer is null terminated */ printWLine(data); free(data); } } #endif /* OMITGOOD */
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE124_Buffer_Underwrite__wchar_t_alloca_loop_65a.c Label Definition File: CWE124_Buffer_Underwrite.stack.label.xml Template File: sources-sink-65a.tmpl.c */ /* * @description * CWE: 124 Buffer Underwrite * BadSource: Set data pointer to before the allocated memory buffer * GoodSource: Set data pointer to the allocated memory buffer * Sinks: loop * BadSink : Copy string to data using a loop * Flow Variant: 65 Data/control flow: data passed as an argument from one function to a function in a different source file called via a function pointer * * */ #include "std_testcase.h" #include <wchar.h> #ifndef OMITBAD /* bad function declaration */ void CWE124_Buffer_Underwrite__wchar_t_alloca_loop_65b_badSink(wchar_t * data); void CWE124_Buffer_Underwrite__wchar_t_alloca_loop_65_bad() { wchar_t * data; /* define a function pointer */ void (*funcPtr) (wchar_t *) = CWE124_Buffer_Underwrite__wchar_t_alloca_loop_65b_badSink; wchar_t * dataBuffer = (wchar_t *)ALLOCA(100*sizeof(wchar_t)); wmemset(dataBuffer, L'A', 100-1); dataBuffer[100-1] = L'\0'; /* FLAW: Set data pointer to before the allocated memory buffer */ data = dataBuffer - 8; /* use the function pointer */ funcPtr(data); } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ void CWE124_Buffer_Underwrite__wchar_t_alloca_loop_65b_goodG2BSink(wchar_t * data); static void goodG2B() { wchar_t * data; void (*funcPtr) (wchar_t *) = CWE124_Buffer_Underwrite__wchar_t_alloca_loop_65b_goodG2BSink; wchar_t * dataBuffer = (wchar_t *)ALLOCA(100*sizeof(wchar_t)); wmemset(dataBuffer, L'A', 100-1); dataBuffer[100-1] = L'\0'; /* FIX: Set data pointer to the allocated memory buffer */ data = dataBuffer; funcPtr(data); } void CWE124_Buffer_Underwrite__wchar_t_alloca_loop_65_good() { goodG2B(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE124_Buffer_Underwrite__wchar_t_alloca_loop_65_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE124_Buffer_Underwrite__wchar_t_alloca_loop_65_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CONTENT_BROWSER_SCHEDULER_RESPONSIVENESS_WATCHER_H_ #define CONTENT_BROWSER_SCHEDULER_RESPONSIVENESS_WATCHER_H_ #include <vector> #include "base/gtest_prod_util.h" #include "base/time/time.h" #include "content/browser/scheduler/responsiveness/metric_source.h" namespace content { namespace responsiveness { class Calculator; class CONTENT_EXPORT Watcher : public base::RefCounted<Watcher>, public MetricSource::Delegate { public: Watcher(); void SetUp(); void Destroy(); // Must be invoked once-and-only-once, after SetUp(), the first time // MainMessageLoopRun() reaches idle (i.e. done running all tasks queued // during startup). This will be used as a signal for the true end of // "startup" and the beginning of recording // Browser.Responsiveness.JankyIntervalsPerThirtySeconds3. void OnFirstIdle(); protected: friend class base::RefCounted<Watcher>; // Exposed for tests. virtual std::unique_ptr<Calculator> CreateCalculator(); virtual std::unique_ptr<MetricSource> CreateMetricSource(); ~Watcher() override; // Delegate interface implementation. void SetUpOnIOThread() override; void TearDownOnUIThread() override; void TearDownOnIOThread() override; void WillRunTaskOnUIThread(const base::PendingTask* task, bool was_blocked_or_low_priority) override; void DidRunTaskOnUIThread(const base::PendingTask* task) override; void WillRunTaskOnIOThread(const base::PendingTask* task, bool was_blocked_or_low_priority) override; void DidRunTaskOnIOThread(const base::PendingTask* task) override; void WillRunEventOnUIThread(const void* opaque_identifier) override; void DidRunEventOnUIThread(const void* opaque_identifier) override; private: FRIEND_TEST_ALL_PREFIXES(ResponsivenessWatcherTest, TaskForwarding); FRIEND_TEST_ALL_PREFIXES(ResponsivenessWatcherTest, TaskNesting); FRIEND_TEST_ALL_PREFIXES(ResponsivenessWatcherTest, NativeEvents); FRIEND_TEST_ALL_PREFIXES(ResponsivenessWatcherTest, BlockedOrLowPriorityTask); FRIEND_TEST_ALL_PREFIXES(ResponsivenessWatcherTest, DelayedTask); // Metadata for currently running tasks and events is needed to track whether // or not they caused reentrancy. struct Metadata { explicit Metadata(const void* identifier, bool was_blocked_or_low_priority, base::TimeTicks execution_start_time); // An opaque identifier for the task or event. const void* const identifier; // Whether the task was at some point in a queue that was blocked or low // priority. const bool was_blocked_or_low_priority; // The time at which the task or event started running. const base::TimeTicks execution_start_time; // Whether the task or event has caused reentrancy. bool caused_reentrancy = false; }; // This is called when |metric_source_| finishes destruction. void FinishDestroyMetricSource(); // Common implementations for the thread-specific methods. void WillRunTask(const base::PendingTask* task, bool was_blocked_or_low_priority, std::vector<Metadata>* currently_running_metadata); // |callback| will either be synchronously invoked, or else never invoked. using TaskOrEventFinishedCallback = base::OnceCallback< void(base::TimeTicks, base::TimeTicks, base::TimeTicks)>; void DidRunTask(const base::PendingTask* task, std::vector<Metadata>* currently_running_metadata, int* mismatched_task_identifiers, TaskOrEventFinishedCallback callback); // The source that emits responsiveness events. std::unique_ptr<MetricSource> metric_source_; // The following members are all affine to the UI thread. std::unique_ptr<Calculator> calculator_; // Metadata for currently running tasks and events on the UI thread. std::vector<Metadata> currently_running_metadata_ui_; // Task identifiers should only be mismatched once, since the Watcher may // register itself during a Task execution, and thus doesn't capture the // initial WillRunTask() callback. int mismatched_task_identifiers_ui_ = 0; // Event identifiers should be mismatched at most once, since the Watcher may // register itself during an event execution, and thus doesn't capture the // initial WillRunEventOnUIThread callback. int mismatched_event_identifiers_ui_ = 0; // The following members are all affine to the IO thread. std::vector<Metadata> currently_running_metadata_io_; int mismatched_task_identifiers_io_ = 0; // The implementation of this class guarantees that |calculator_io_| will be // non-nullptr and point to a valid object any time it is used on the IO // thread. To ensure this, the first task that this class posts onto the IO // thread sets |calculator_io_|. On destruction, this class first tears down // all consumers of |calculator_io_|, and then clears the member and destroys // Calculator. Calculator* calculator_io_ = nullptr; }; } // namespace responsiveness } // namespace content #endif // CONTENT_BROWSER_SCHEDULER_RESPONSIVENESS_WATCHER_H_
#include "KMotionDef.h" #include "..\CorrectAnalogFunction.c" #define RPM_FACTOR 500.0 // RPM for full duty cycle (max analog out) // desired speed is passed in variable 1 main() { float speed = *(float *)&persist.UserData[1]; // value stored is actually a float FPGA(KAN_TRIG_REG)=4; // Mux PWM0 to JP7 Pin5 IO 44 for KSTEP SetBitDirection(44,1); // define bit as an output FPGA(IO_PWMS_PRESCALE) = 46; // divide clock by 46 (1.4 KHz) FPGA(IO_PWMS+1) = 1; // Enable FPGA(IO_PWMS) = CorrectAnalog(speed/RPM_FACTOR); // Set PWM }
/*=================================================================== 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 mitkDICOMTagScanner_h #define mitkDICOMTagScanner_h #include <stack> #include "itkMutexLock.h" #include "mitkDICOMEnums.h" #include "mitkDICOMTagPath.h" #include "mitkDICOMTagCache.h" #include "mitkDICOMDatasetAccessingImageFrameInfo.h" namespace mitk { /** \ingroup DICOMReaderModule \brief Abstracts the tag scanning process for a set of DICOM files. Formerly integrated as a part of DICOMITKSeriesGDCMReader, the tag scanning part has been factored out into DICOMTagScanner classes in order to allow a single scan for multiple reader alternatives. This helps much in the selection process of e.g. DICOMFileReaderSelector. This is an abstract base class for concrete scanner implementations. @remark When used in a process where multiple classes will access the scan results, care should be taken that all the tags and files of interest are communicated to DICOMTagScanner before requesting the results! */ class MITKDICOMREADER_EXPORT DICOMTagScanner : public itk::Object { public: mitkClassMacroItkParent(DICOMTagScanner, itk::Object); /** \brief Add this tag to the scanning process. */ virtual void AddTag(const DICOMTag& tag) = 0; /** \brief Add a list of tags to the scanning process. */ virtual void AddTags(const DICOMTagList& tags) = 0; /** \brief Add this tag path to the scanning process. */ virtual void AddTagPath(const DICOMTagPath& path) = 0; /** \brief Add a list of tag pathes to the scanning process. */ virtual void AddTagPaths(const DICOMTagPathList& paths) = 0; /** \brief Define the list of files to scan. This does not ADD to an internal list, but it replaces the whole list of files. */ virtual void SetInputFiles(const StringList& filenames) = 0; /** \brief Start the scanning process. Calling Scan() will invalidate previous scans, forgetting all about files and tags from files that have been scanned previously. */ virtual void Scan() = 0; /** \brief Retrieve a result list for file-by-file tag access. */ virtual DICOMDatasetAccessingImageFrameList GetFrameInfoList() const = 0; /** \brief Retrieve Pointer to the complete cache of the scan. */ virtual DICOMTagCache::Pointer GetScanCache() const = 0; protected: /** \brief Return active C locale */ static std::string GetActiveLocale(); /** \brief Remember current locale on stack, activate "C" locale. "C" locale is required for correct parsing of numbers by itk::ImageSeriesReader */ void PushLocale() const; /** \brief Activate last remembered locale from locale stack "C" locale is required for correct parsing of numbers by itk::ImageSeriesReader */ void PopLocale() const; DICOMTagScanner(); virtual ~DICOMTagScanner(); private: static itk::MutexLock::Pointer s_LocaleMutex; mutable std::stack<std::string> m_ReplacedCLocales; mutable std::stack<std::locale> m_ReplacedCinLocales; DICOMTagScanner(const DICOMTagScanner&); }; } #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 PPAPI_PROXY_PLUGIN_RESOURCE_TRACKER_H_ #define PPAPI_PROXY_PLUGIN_RESOURCE_TRACKER_H_ #include <map> #include <unordered_set> #include <utility> #include "base/compiler_specific.h" #include "base/macros.h" #include "ppapi/c/pp_completion_callback.h" #include "ppapi/c/pp_instance.h" #include "ppapi/c/pp_resource.h" #include "ppapi/c/pp_stdint.h" #include "ppapi/c/pp_var.h" #include "ppapi/proxy/ppapi_proxy_export.h" #include "ppapi/shared_impl/host_resource.h" #include "ppapi/shared_impl/resource_tracker.h" namespace base { template<typename T> struct DefaultSingletonTraits; } namespace ppapi { namespace proxy { class PPAPI_PROXY_EXPORT PluginResourceTracker : public ResourceTracker { public: PluginResourceTracker(); PluginResourceTracker(const PluginResourceTracker&) = delete; PluginResourceTracker& operator=(const PluginResourceTracker&) = delete; ~PluginResourceTracker() override; // Given a host resource, maps it to an existing plugin resource ID if it // exists, or returns 0 on failure. PP_Resource PluginResourceForHostResource( const HostResource& resource) const; // "Abandons" a PP_Resource on the plugin side. This releases a reference to // the resource and allows the plugin side of the resource (the proxy // resource) to be destroyed without sending a message to the renderer // notifing it that the plugin has released the resource. This is useful when // the plugin sends a resource to the renderer in reply to a sync IPC. The // plugin would want to release its reference to the reply resource straight // away but doing so can sometimes cause the resource to be deleted in the // renderer before the sync IPC reply has been received giving the renderer a // chance to add a ref to it. (see e.g. crbug.com/490611). Instead the // renderer assumes responsibility for the ref that the plugin created and // this function can be called. void AbandonResource(PP_Resource res); protected: // ResourceTracker overrides. PP_Resource AddResource(Resource* object) override; void RemoveResource(Resource* object) override; private: // Map of host instance/resource pairs to a plugin resource ID. typedef std::map<HostResource, PP_Resource> HostResourceMap; HostResourceMap host_resource_map_; std::unordered_set<PP_Resource> abandoned_resources_; }; } // namespace proxy } // namespace ppapi #endif // PPAPI_PROXY_PLUGIN_RESOURCE_TRACKER_H_
/*********************************************************************************************************************** ** ** Copyright (c) 2011, 2014 ETH Zurich ** All rights reserved. ** ** Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ** following conditions are met: ** ** * 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 ETH Zurich 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 PRECOMPILED_CORE_H_ #define PRECOMPILED_CORE_H_ #if defined __cplusplus // Add C++ includes here #include <QtCore/QDir> #include <QtCore/QDebug> #endif #endif /* PRECOMPILED_CORE_H_ */
/** @file * * @ingroup modularLibrary * * @brief TTObjectBase to handle xml file reading and writing to be able to store / recall state of an object into/from xml files. * * @details * * @authors Théo de la Hogue * * @copyright © 2010, Théo de la Hogue @n * This code is licensed under the terms of the "New BSD License" @n * http://creativecommons.org/licenses/BSD/ */ #ifndef __TT_XML_HANDLER_H__ #define __TT_XML_HANDLER_H__ #include "TTModularIncludes.h" #include <stdio.h> /** Write / Read mecanism writeAs<Format> / readFrom<Format> methods are not directly called using the classic message system. We should prefer use one of the exported TT<Format>Reader / TT<Format>Writer method which have : - an Object attribute : the TTObjectBase you want it reads / writes a file or - the data structure to pass in order to read / write depending on the selected <Format> This allow us to use the same method to start reading / writing and even to ask to other objects to read / write recursively on the same data stucture. Exemple : If you want to read in Xml format you set the Object attribute as myTopObject then you call the Read message with aValueContainingFullPathToaFile. Then this method (as a friend of your TTTopObject class) will automatically create an XmlReader data structure and call ReadFromXml(aValueContainingAnXmlReader) on your myTopObject. Because your TTTopObject class used TTLowerObject to describe himself (and have to extract their xml description from the xml file to set them up) the ReadFromXml method sets recursively the Object Attribute with aLowerObject and then calls the Read message with an empty value : this would calls the ReadFromXml(aValueContainingAnXmlReader) on your TTLowerObject. */ class TTMODULAR_EXPORT TTXmlHandler : public TTObjectBase { TTCLASS_SETUP(TTXmlHandler) public: // use public for recursive access TTValue mObject; ///< the last handled object (it is possible to have an array of objects) TTSymbol mFilePath; ///< the path to the last writen/read file TTSymbol mHeaderNodeName; ///< the name of the header node in the xml file TTSymbol mVersion; ///< the version number TTSymbol mXmlSchemaInstance; ///< the URL of the schema instance location TTSymbol mXmlSchemaLocation; ///< the URL of the xml schema location TTPtr mWriter; // xmlTextWriterPtr TTPtr mReader; // xmlTextReaderPtr TTBoolean mXmlNodeStart; ///< true if the Reader starts to read a Node TTBoolean mXmlNodeIsEmpty; ///< true if the Node is empty TTSymbol mXmlNodeName; ///< the Node name being read by the Reader TTValue mXmlNodeValue; ///< the Node value being read by the Reader /** Setter for mObject attribute. */ TTErr setObject(const TTValue& value); /** TTXmlWriter could takes absolute file path or nothing. In the path case, TTXmlWriter starts xml file writting and then calls the WriteAsXml method of mObject attribute In the second case, it directly calls the WriteAsXml method */ TTErr Write(const TTValue& args, TTValue& outputValue); TTErr WriteAgain(); /** TTXmlReader could takes absolute file path or nothing. In the path case, TTXmlReader starts xml file reading and then calls the ReadFromXml method of mObject attribute In the second case, it directly calls the ReadFromXml method */ TTErr Read(const TTValue& args, TTValue& outputValue); TTErr ReadAgain(); /** TTXmlReader make a TTValue from an xmlChar* using the fromString method (see in TTValue.h) */ // TTErr fromXmlChar(const xmlChar* xCh, TTValue& v, TTBoolean addQuote=NO, TTBoolean numberAsSymbol=NO); TTErr fromXmlChar(const void* xCh, TTValue& v, TTBoolean addQuote=NO, TTBoolean numberAsSymbol=NO); /** Get the value of an xml element attribute */ TTErr getXmlAttribute(TTSymbol attributeName, TTValue& returnedValue, TTBoolean addQuote=NO, TTBoolean numberAsSymbol=NO); /** Get the value of the next xml element attribute */ TTErr getXmlNextAttribute(TTSymbol& returnedAttributeName, TTValue& returnedValue, TTBoolean addQuote=NO, TTBoolean numberAsSymbol=NO); private : TTBoolean mIsWriting; ///< a flag to know if it is writing a file TTBoolean mIsReading; ///< a flag to know if it is reading a file }; typedef TTXmlHandler* TTXmlHandlerPtr; #endif // __TT_XML_HANDLER_H__
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE617_Reachable_Assertion__zero_05.c Label Definition File: CWE617_Reachable_Assertion__zero.label.xml Template File: point-flaw-05.tmpl.c */ /* * @description * CWE: 617 Reachable Assertion * Sinks: * GoodSink: assert(true), which will never trigger * BadSink : assert(false), which will always trigger * Flow Variant: 05 Control flow: if(staticTrue) and if(staticFalse) * * */ #include "std_testcase.h" #include <assert.h> /* The two variables below are not defined as "const", but are never assigned any other value, so a tool should be able to identify that reads of these will always return their initialized values. */ static int staticTrue = 1; /* true */ static int staticFalse = 0; /* false */ #ifndef OMITBAD void CWE617_Reachable_Assertion__zero_05_bad() { if(staticTrue) { /* FLAW: this assertion can be reached, and will always trigger */ assert(0); /* INCIDENTAL: CWE 571 - expression is always true - it's "true" because assert(e) basically does if (!(e)) */ } } #endif /* OMITBAD */ #ifndef OMITGOOD /* good1() uses if(staticFalse) instead of if(staticTrue) */ static void good1() { if(staticFalse) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { /* FIX: ensure assertions cannot be triggered, in this case, to avoid an empty * function, assert(1) */ assert(1); /* INCIDENTAL: CWE 570 - expression is always false - it's "false" because assert(e) basically does if (!(e)) */ } } /* good2() reverses the bodies in the if statement */ static void good2() { if(staticTrue) { /* FIX: ensure assertions cannot be triggered, in this case, to avoid an empty * function, assert(1) */ assert(1); /* INCIDENTAL: CWE 570 - expression is always false - it's "false" because assert(e) basically does if (!(e)) */ } } void CWE617_Reachable_Assertion__zero_05_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()..."); CWE617_Reachable_Assertion__zero_05_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE617_Reachable_Assertion__zero_05_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #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_CHROMEOS_CROS_NETWORK_PARSER_H_ #define CHROME_BROWSER_CHROMEOS_CROS_NETWORK_PARSER_H_ #include <map> #include <string> #include "chrome/browser/chromeos/cros/enum_mapper.h" #include "chrome/browser/chromeos/cros/network_library.h" namespace base { class DictionaryValue; class Value; } namespace chromeos { class NetworkDevice; // This takes a Value of a particular form, and maps the keys in the // dictionary to a NetworkDevice object to initialize it properly. // Subclasses of this can then customize its methods to parse either // libcros (flimflam) data or network setup information obtained from // policy or setup file import depending on the EnumMapper supplied. class NetworkDeviceParser { public: virtual ~NetworkDeviceParser(); virtual NetworkDevice* CreateDeviceFromInfo( const std::string& device_path, const base::DictionaryValue& info); virtual bool UpdateDeviceFromInfo(const base::DictionaryValue& info, NetworkDevice* device); virtual bool UpdateStatus(const std::string& key, const base::Value& value, NetworkDevice* device, PropertyIndex* index); protected: // The NetworkDeviceParser does not take ownership of the |mapper|. explicit NetworkDeviceParser(const EnumMapper<PropertyIndex>* mapper); // Creates new NetworkDevice based on device_path. // Subclasses should override this method and set the correct parser for this // network device if appropriate. virtual NetworkDevice* CreateNewNetworkDevice(const std::string& device_path); virtual bool ParseValue(PropertyIndex index, const base::Value& value, NetworkDevice* device) = 0; virtual ConnectionType ParseType(const std::string& type) = 0; const EnumMapper<PropertyIndex>& mapper() const { return *mapper_; } private: const EnumMapper<PropertyIndex>* mapper_; DISALLOW_COPY_AND_ASSIGN(NetworkDeviceParser); }; // This takes a Value of a particular form, and uses the keys in the // dictionary to create Network (WiFiNetwork, EthernetNetwork, etc.) // objects and initialize them properly. Subclasses of this can then // customize its methods to parse other forms of input dictionaries. class NetworkParser { public: virtual ~NetworkParser(); // Called when a new network is encountered. In addition to setting the // members on the Network object, the Network's property_map_ variable // will include all the property and corresponding value in |info|. // Returns NULL upon failure. virtual Network* CreateNetworkFromInfo(const std::string& service_path, const base::DictionaryValue& info); // Called when an existing network is has new information that needs // to be updated. Network's property_map_ variable will be updated. // Returns false upon failure. virtual bool UpdateNetworkFromInfo(const base::DictionaryValue& info, Network* network); // Called when an individual attribute of an existing network has // changed. |index| is a return value that supplies the appropriate // property index for the given key. |index| is filled in even if // the update fails. Network's property_map_ variable will be updated. // Returns false upon failure. virtual bool UpdateStatus(const std::string& key, const base::Value& value, Network* network, PropertyIndex* index); protected: // The NetworkParser does not take ownership of the |mapper|. explicit NetworkParser(const EnumMapper<PropertyIndex>* mapper); // Creates new Network based on type and service_path. // Subclasses should override this method and set the correct parser for this // network if appropriate. virtual Network* CreateNewNetwork(ConnectionType type, const std::string& service_path); // Parses the value and sets the appropriate field on Network. virtual bool ParseValue(PropertyIndex index, const base::Value& value, Network* network); virtual ConnectionType ParseType(const std::string& type) = 0; virtual ConnectionType ParseTypeFromDictionary( const base::DictionaryValue& info) = 0; const EnumMapper<PropertyIndex>& mapper() const { return *mapper_; } private: const EnumMapper<PropertyIndex>* mapper_; DISALLOW_COPY_AND_ASSIGN(NetworkParser); }; } // namespace chromeos #endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_PARSER_H_
////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2008-2014, Image Engine Design Inc. All rights reserved. // // Copyright 2010 Dr D Studios Pty Limited (ACN 127 184 954) (Dr. D Studios), // its affiliates and/or its licensors. // // 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 Image Engine Design nor the names of any // other contributors to this software 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 IECOREMAYA_TYPEIDS_H #define IECOREMAYA_TYPEIDS_H namespace IECoreMaya { enum TypeId { FromMayaConverterTypeId = 109000, FromMayaObjectConverterTypeId = 109001, FromMayaPlugConverterTypeId = 109002, FromMayaMeshConverterTypeId = 109003, FromMayaCameraConverterTypeId = 109004, FromMayaGroupConverterTypeId = 109005, FromMayaNumericDataConverterTypeId = 109006, FromMayaNumericPlugConverterTypeId = 109007, FromMayaFluidConverterTypeId = 109008, FromMayaStringPlugConverterTypeId = 109009, FromMayaShapeConverterTypeId = 109010, FromMayaCurveConverterTypeId = 109011, FromMayaParticleConverterTypeId = 109012, FromMayaDagNodeConverterTypeId = 109013, ToMayaConverterTypeId = 109014, ToMayaObjectConverterTypeId = 109015, ToMayaNumericDataConverterTypeId = 109016, ToMayaMeshConverterTypeId = 109017, ToMayaArrayDataConverterTypeId = 109018, ToMayaPlugConverterTypeId = 109019, FromMayaPluginDataPlugConverterTypeId = 109020, FromMayaTransformConverterTypeId = 109021, FromMayaImageConverterTypeId = 109022, ToMayaImageConverterTypeId = 109023, PlaybackFrameListTypeId = 109024, FromMayaUnitPlugConverterfTypeId = 109025, FromMayaUnitPlugConverterdTypeId = 109026, FromMayaNumericPlugConverterbbTypeId = 109027, FromMayaNumericPlugConverterbiTypeId = 109028, FromMayaNumericPlugConverteriiTypeId = 109029, FromMayaNumericPlugConverterifTypeId = 109030, FromMayaNumericPlugConverteridTypeId = 109031, FromMayaNumericPlugConverterfiTypeId = 109032, FromMayaNumericPlugConverterffTypeId = 109033, FromMayaNumericPlugConverterfdTypeId = 109034, FromMayaNumericPlugConverterdiTypeId = 109035, FromMayaNumericPlugConverterdfTypeId = 109036, FromMayaNumericPlugConverterddTypeId = 109037, FromMayaArrayDataConverteriiTypeId = 109038, FromMayaArrayDataConverterddTypeId = 109039, FromMayaArrayDataConverterdfTypeId = 109040, FromMayaArrayDataConverterssTypeId = 109041, FromMayaArrayDataConverterVV3fTypeId = 109042, FromMayaArrayDataConverterVV3dTypeId = 109043, FromMayaArrayDataConverterVC3fTypeId = 109044, FromMayaCompoundNumericPlugConverterV2fV2iTypeId = 109045, FromMayaCompoundNumericPlugConverterV2fV2fTypeId = 109046, FromMayaCompoundNumericPlugConverterV2fV2dTypeId = 109047, FromMayaCompoundNumericPlugConverterV2dV2iTypeId = 109048, FromMayaCompoundNumericPlugConverterV2dV2fTypeId = 109049, FromMayaCompoundNumericPlugConverterV2dV2dTypeId = 109050, FromMayaCompoundNumericPlugConverterV3fV3iTypeId = 109051, FromMayaCompoundNumericPlugConverterV3fV3fTypeId = 109052, FromMayaCompoundNumericPlugConverterV3fV3dTypeId = 109053, FromMayaCompoundNumericPlugConverterV3fC3fTypeId = 109054, FromMayaCompoundNumericPlugConverterV3dV3iTypeId = 109055, FromMayaCompoundNumericPlugConverterV3dV3fTypeId = 109056, FromMayaCompoundNumericPlugConverterV3dV3dTypeId = 109057, FromMayaCompoundNumericPlugConverterV3dC3fTypeId = 109058, FromMayaTransformationMatrixfConverterTypeId = 109059, FromMayaTransformationMatrixdConverterTypeId = 109060, Box3ManipulatorTypeId = 109061, FromMayaSkinClusterConverterTypeId = 109062, ToMayaSkinClusterConverterTypeId = 109063, FromMayaArrayDataConverteribTypeId = 109064, FromMayaMatrixVectorDataConverterTypeId = 109065, ToMayaMatrixVectorDataConverterTypeId = 109066, TransformationMatrixManipulatorTypeId = 109067, ToMayaGroupConverterTypeId = 109068, ToMayaParticleConverterTypeId = 109069, V3ManipulatorTypeId = 109070, ToMayaCameraConverterTypeId = 109071, LiveSceneTypeId = 109072, FromMayaProceduralHolderConverterTypeId = 109073, FromMayaLocatorConverterTypeId = 109074, ToMayaLocatorConverterTypeId = 109075, ToMayaCurveConverterTypeId = 109076, // Remember to update TypeIdBinding.cpp LastTypeId = 109999 }; } // namespace IECoreMaya #endif // IECOREMAYA_TYPEIDS_H
/* * Order-2, 3D 25 point stencil * Adapted from PLUTO and Pochoir test bench * * Tareq Malas */ #include <stdio.h> #include <stdlib.h> #include <sys/time.h> #ifdef LIKWID_PERFMON #include <likwid.h> #endif #include "print_utils.h" #define TESTS 2 #define MAX(a,b) ((a) > (b) ? a : b) #define MIN(a,b) ((a) < (b) ? a : b) #ifndef min #define min(x,y) ((x) < (y)? (x) : (y)) #endif /* Subtract the `struct timeval' values X and Y, * storing the result in RESULT. * * Return 1 if the difference is negative, otherwise 0. */ int timeval_subtract(struct timeval *result, struct timeval *x, struct timeval *y) { /* Perform the carry for the later subtraction by updating y. */ if (x->tv_usec < y->tv_usec) { int nsec = (y->tv_usec - x->tv_usec) / 1000000 + 1; y->tv_usec -= 1000000 * nsec; y->tv_sec += nsec; } if (x->tv_usec - y->tv_usec > 1000000) { int nsec = (x->tv_usec - y->tv_usec) / 1000000; y->tv_usec += 1000000 * nsec; y->tv_sec -= nsec; } /* Compute the time remaining to wait. * tv_usec is certainly positive. */ result->tv_sec = x->tv_sec - y->tv_sec; result->tv_usec = x->tv_usec - y->tv_usec; /* Return 1 if result is negative. */ return x->tv_sec < y->tv_sec; } int main(int argc, char *argv[]) { int t, i, j, k, test; int Nx, Ny, Nz, Nt; if (argc > 3) { Nx = atoi(argv[1])+8; Ny = atoi(argv[2])+8; Nz = atoi(argv[3])+8; } if (argc > 4) Nt = atoi(argv[4]); double ****A = (double ****) malloc(sizeof(double***)*2); double ***roc2 = (double ***) malloc(sizeof(double**)); A[0] = (double ***) malloc(sizeof(double**)*Nz); A[1] = (double ***) malloc(sizeof(double**)*Nz); roc2 = (double ***) malloc(sizeof(double**)*Nz); for(i=0; i<Nz; i++){ A[0][i] = (double**) malloc(sizeof(double*)*Ny); A[1][i] = (double**) malloc(sizeof(double*)*Ny); roc2[i] = (double**) malloc(sizeof(double*)*Ny); for(j=0;j<Ny;j++){ A[0][i][j] = (double*) malloc(sizeof(double)*Nx); A[1][i][j] = (double*) malloc(sizeof(double)*Nx); roc2[i][j] = (double*) malloc(sizeof(double)*Nx); } } // tile size information, including extra element to decide the list length int *tile_size = (int*) malloc(sizeof(int)); tile_size[0] = -1; // The list is modified here before source-to-source transformations tile_size = (int*) realloc((void *)tile_size, sizeof(int)*5); tile_size[0] = 16; tile_size[1] = 16; tile_size[2] = 4; tile_size[3] = 256; tile_size[4] = -1; // for timekeeping int ts_return = -1; struct timeval start, end, result; double tdiff = 0.0, min_tdiff=1.e100; const int BASE = 1024; // initialize variables // srand(42); for (i = 1; i < Nz; i++) { for (j = 1; j < Ny; j++) { for (k = 1; k < Nx; k++) { A[0][i][j][k] = 1.0 * (rand() % BASE); roc2[i][j][k] = 2.0 * (rand() % BASE); } } } #ifdef LIKWID_PERFMON LIKWID_MARKER_INIT; #pragma omp parallel { LIKWID_MARKER_THREADINIT; #pragma omp barrier LIKWID_MARKER_START("calc"); } #endif int num_threads = 1; #if defined(_OPENMP) num_threads = omp_get_max_threads(); #endif const double coef0 = -0.28472; const double coef1 = 0.16000; const double coef2 = -0.02000; const double coef3 = 0.00254; const double coef4 = -0.00018; for(test=0; test<TESTS; test++){ gettimeofday(&start, 0); // serial execution - Addition: 6 && Multiplication: 2 #pragma scop for (t = 0; t < Nt; t++) { for (i = 4; i < Nz-4; i++) { for (j = 4; j < Ny-4; j++) { for (k = 4; k < Nx-4; k++) { A[(t+1)%2][i][j][k] = 2.0*A[t%2][i][j][k] - A[(t+1)%2][i][j][k] + roc2[i][j][k]*( coef0* A[t%2][i ][j ][k ] + coef1*(A[t%2][i-1][j ][k ] + A[t%2][i+1][j ][k ] + A[t%2][i ][j-1][k ] + A[t%2][i ][j+1][k ] + A[t%2][i ][j ][k-1] + A[t%2][i ][j ][k+1]) + coef2*(A[t%2][i-2][j ][k ] + A[t%2][i+2][j ][k ] + A[t%2][i ][j-2][k ] + A[t%2][i ][j+2][k ] + A[t%2][i ][j ][k-2] + A[t%2][i ][j ][k+2]) + coef3*(A[t%2][i-3][j ][k ] + A[t%2][i+3][j ][k ] + A[t%2][i ][j-3][k ] + A[t%2][i ][j+3][k ] + A[t%2][i ][j ][k-3] + A[t%2][i ][j ][k+3]) + coef4*(A[t%2][i-4][j ][k ] + A[t%2][i+4][j ][k ] + A[t%2][i ][j-4][k ] + A[t%2][i ][j+4][k ] + A[t%2][i ][j ][k-4] + A[t%2][i ][j ][k+4]) ); } } } } #pragma endscop gettimeofday(&end, 0); ts_return = timeval_subtract(&result, &end, &start); tdiff = (double) (result.tv_sec + result.tv_usec * 1.0e-6); min_tdiff = MIN(min_tdiff, tdiff); printf("Rank 0 TEST# %d time: %f\n", test, tdiff); } PRINT_RESULTS(4, "constant") #ifdef LIKWID_PERFMON #pragma omp parallel { LIKWID_MARKER_STOP("calc"); } LIKWID_MARKER_CLOSE; #endif // Free allocated arrays for(i=0; i<Nz; i++){ for(j=0;j<Ny;j++){ free(A[0][i][j]); free(A[1][i][j]); free(roc2[i][j]); } free(A[0][i]); free(A[1][i]); free(roc2[i]); } free(A[0]); free(A[1]); free(roc2); return 0; }
// functional_hash.h header -*- C++ -*- // Copyright (C) 2007,2008 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the // terms of the GNU General Public License as published by the // Free Software Foundation; either version 2, or (at your option) // any later version. // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this library; see the file COPYING. If not, write to // the Free Software Foundation, 51 Franklin Street, Fifth Floor, // Boston, MA 02110-1301, USA. // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. /** @file bits/functional_hash.h * This is an internal header file, included by other library headers. * You should not attempt to use it directly. */ #ifndef _FUNCTIONAL_HASH_H #define _FUNCTIONAL_HASH_H 1 #pragma GCC system_header #ifndef __GXX_EXPERIMENTAL_CXX0X__ # include <c++0x_warning.h> #endif #if defined(_GLIBCXX_INCLUDE_AS_TR1) # error C++0x header cannot be included from TR1 header #endif #if defined(_GLIBCXX_INCLUDE_AS_CXX0X) # include <tr1_impl/functional_hash.h> #else # define _GLIBCXX_INCLUDE_AS_CXX0X # define _GLIBCXX_BEGIN_NAMESPACE_TR1 # define _GLIBCXX_END_NAMESPACE_TR1 # define _GLIBCXX_TR1 # include <tr1_impl/functional_hash.h> # undef _GLIBCXX_TR1 # undef _GLIBCXX_END_NAMESPACE_TR1 # undef _GLIBCXX_BEGIN_NAMESPACE_TR1 # undef _GLIBCXX_INCLUDE_AS_CXX0X #endif #endif // _FUNCTIONAL_HASH_H
#include <usual/event.h> #include <usual/socket.h> #include <string.h> #include "test_common.h" static int ev_count; static void bumper(int fd, short flags, void *arg) { int res; int *other = arg; char buf[10]; ev_count++; res = recv(fd, buf, 10, 0); if (res != 1) { fprintf(stderr, "recv: %s\n", strerror(errno)); event_loopbreak(); } buf[0]++; if (buf[0] > 'z') { event_loopbreak(); } else { send(*other, buf, 1, 0); } } static void test_event(void *z) { struct event_base *base = NULL; int spair[2]; struct event ev[2]; base = event_init(); tt_assert(socketpair(AF_UNIX, SOCK_STREAM, 0, spair) == 0); tt_assert(socket_setup(spair[0], true)); tt_assert(socket_setup(spair[1], true)); event_set(&ev[0], spair[0], EV_READ | EV_PERSIST, bumper, &spair[1]); tt_assert(event_add(&ev[0], NULL) == 0); event_set(&ev[1], spair[1], EV_READ | EV_PERSIST, bumper, &spair[0]); tt_assert(event_add(&ev[1], NULL) == 0); tt_assert(send(spair[0], "0", 1, 0) == 1); tt_assert(event_loop(0) == 0); event_base_free(base); int_check(ev_count, 75); end:; } struct testcase_t event_tests[] = { { "event", test_event }, END_OF_TESTCASES };
///////////////////////////////////////////////// // Macro-Processor ClassTP(TMacro, PMacro)//{ public: bool Ok; TStr MsgStr; char MacroCh; char VarCh; TStr TxtStr; TStrStrH SubstToValStrH; TStrStrH VarNmToValStrH; public: TMacro(const TStr& TxtStr, const char& _MacroCh='$', const char& _VarCh='#'); static PMacro New( const TStr& TxtStr, const char& MacroCh='$', const char& VarCh='#'){ return PMacro(new TMacro(TxtStr, MacroCh, VarCh));} ~TMacro(){} TMacro(TSIn&){Fail;} static PMacro Load(TSIn&){Fail; return NULL;} void Save(TSOut&) const {Fail;} TMacro& operator=(const TMacro&){Fail; return *this;} bool IsOk() const {return Ok;} TStr GetMsgStr() const {return MsgStr;} TStr GetSrcTxtStr() const {return TxtStr;} TStr GetDstTxtStr() const; int GetSubstStrs() const {return SubstToValStrH.Len();} TStr GetSrcSubstStr(const int& SubstStrN) const { return SubstToValStrH.GetKey(SubstStrN);} bool IsSrcSubstStr(const TStr& SrcSubstStr, int& SubstStrN) const { return SubstToValStrH.IsKey(SrcSubstStr, SubstStrN);} int GetSrcSubstStrN(const TStr& SrcSubstStr) const { return SubstToValStrH.GetKeyId(SrcSubstStr);} void GetSrcSubstStrV(TStrV& SubstStrV) const; TStr GetDstSubstStr(const int& SubstStrN=0) const; void PutSubstValStr(const int& SubstStrN, const TStr& ValStr){ SubstToValStrH[SubstStrN]=ValStr;} TStr GetSubstValStr(const int& SubstStrN) const { return SubstToValStrH[SubstStrN];} TStr GetAllSubstValStr() const; int GetVars() const {return VarNmToValStrH.Len();} TStr GetVarNm(const int& VarN) const {return VarNmToValStrH.GetKey(VarN);} void GetVarNmV(TStrV& VarNmV) const; void PutVarVal(const TStr& VarNm, const TStr& ValStr){ VarNmToValStrH.AddDat(VarNm, ValStr);} TStr GetVarVal(const TStr& VarNm) const { return VarNmToValStrH.GetDat(VarNm);} static void SplitVarNm( const TStr& VarNm, TStr& CapStr, bool& IsComboBox, TStr& TbNm, TStr& ListFldNm, TStr& DataFldNm); };
#ifndef RENDER_H #define RENDER_H #include "sam.h" void Render(sam_memory* sam); void SetMouthThroat(unsigned char mouth, unsigned char throat); void OutputFrames(sam_memory *sam, unsigned char frame_count); /** Scaling c64 rate to sample rate */ // Rate for 22.05kHz // #define SCALE_RATE(x) (((x)*1310)>>16) // Rate for 7.8125KHz #define SCALE_RATE(x) (((x)*420)>>16) #endif
/* * Copyright (C) 2009 Philippe Gerum <rpm@xenomai.org>. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #ifndef _XENO_ASM_GENERIC_BITS_TIMECONV_H #define _XENO_ASM_GENERIC_BITS_TIMECONV_H #include <asm/xenomai/arith.h> static unsigned long long clockfreq; #ifdef XNARCH_HAVE_LLMULSHFT static unsigned int tsc_scale, tsc_shift; #ifdef XNARCH_HAVE_NODIV_LLIMD static rthal_u32frac_t tsc_frac; static rthal_u32frac_t bln_frac; #endif #endif #ifdef XNARCH_HAVE_LLMULSHFT long long xnarch_tsc_to_ns(long long ticks) { return xnarch_llmulshft(ticks, tsc_scale, tsc_shift); } long long xnarch_tsc_to_ns_rounded(long long ticks) { unsigned int shift = tsc_shift - 1; return (xnarch_llmulshft(ticks, tsc_scale, shift) + 1) / 2; } #ifdef XNARCH_HAVE_NODIV_LLIMD long long xnarch_ns_to_tsc(long long ns) { return xnarch_nodiv_llimd(ns, tsc_frac.frac, tsc_frac.integ); } unsigned long long xnarch_divrem_billion(unsigned long long value, unsigned long *rem) { unsigned long long q; unsigned r; q = xnarch_nodiv_ullimd(value, bln_frac.frac, bln_frac.integ); r = value - q * 1000000000; if (r >= 1000000000) { ++q; r -= 1000000000; } *rem = r; return q; } #else /* !XNARCH_HAVE_NODIV_LLIMD */ long long xnarch_ns_to_tsc(long long ns) { return xnarch_llimd(ns, 1 << tsc_shift, tsc_scale); } #endif /* !XNARCH_HAVE_NODIV_LLIMD */ #else /* !XNARCH_HAVE_LLMULSHFT */ long long xnarch_tsc_to_ns(long long ticks) { return xnarch_llimd(ticks, 1000000000, clockfreq); } long long xnarch_tsc_to_ns_rounded(long long ticks) { return (xnarch_llimd(ticks, 1000000000, clockfreq/2) + 1) / 2; } long long xnarch_ns_to_tsc(long long ns) { return xnarch_llimd(ns, clockfreq, 1000000000); } #endif /* !XNARCH_HAVE_LLMULSHFT */ #ifndef XNARCH_HAVE_NODIV_LLIMD unsigned long long xnarch_divrem_billion(unsigned long long value, unsigned long *rem) { return xnarch_ulldiv(value, 1000000000, rem); } #endif /* !XNARCH_HAVE_NODIV_LLIMD */ static void xnarch_init_timeconv(unsigned long long freq) { clockfreq = freq; #ifdef XNARCH_HAVE_LLMULSHFT xnarch_init_llmulshft(1000000000, freq, &tsc_scale, &tsc_shift); #ifdef XNARCH_HAVE_NODIV_LLIMD xnarch_init_u32frac(&tsc_frac, 1 << tsc_shift, tsc_scale); xnarch_init_u32frac(&bln_frac, 1, 1000000000); #endif #endif } #ifdef __KERNEL__ EXPORT_SYMBOL_GPL(xnarch_tsc_to_ns); EXPORT_SYMBOL_GPL(xnarch_ns_to_tsc); EXPORT_SYMBOL_GPL(xnarch_divrem_billion); #endif /* __KERNEL__ */ #endif /* !_XENO_ASM_GENERIC_BITS_TIMECONV_H */
/* * EAC1_1 objects * (C) 2008 Falko Strenzke * * Distributed under the terms of the Botan license */ #ifndef BOTAN_EAC_OBJ_H__ #define BOTAN_EAC_OBJ_H__ #include <botan/signed_obj.h> #include <botan/ecdsa_sig.h> namespace Botan { /** * TR03110 v1.1 EAC CV Certificate */ template<typename Derived> // CRTP is used enable the call sequence: class EAC1_1_obj : public EAC_Signed_Object { public: /** * Return the signature as a concatenation of the encoded parts. * @result the concatenated signature */ SecureVector<byte> get_concat_sig() const { return m_sig.get_concatenation(); } bool check_signature(class Public_Key& key) const { return EAC_Signed_Object::check_signature(key, m_sig.DER_encode()); } protected: ECDSA_Signature m_sig; void init(DataSource& in) { try { Derived::decode_info(in, tbs_bits, m_sig); } catch(Decoding_Error) { throw Decoding_Error(PEM_label_pref + " decoding failed"); } } virtual ~EAC1_1_obj<Derived>(){} }; } #endif
// // ReceptionKit-Bridging-Header.h // ReceptionKit // // Created by Andy Cho on 2015-04-23. // Copyright (c) 2015 Andy Cho. All rights reserved. // #ifndef ReceptionKit_ReceptionKit_Bridging_Header_h #define ReceptionKit_ReceptionKit_Bridging_Header_h #import <SupportKit/SKTConversation.h> #import <SupportKit/SKTMessage.h> #import <SupportKit/SKTSettings.h> #import <SupportKit/SKTUser.h> #import <SupportKit/SupportKit.h> #endif
/* * Copyright (c) 2015 Travis Geiselbrecht * * 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. */ #pragma once #include <compiler.h> __BEGIN_CDECLS; struct miniheap_stats { void *heap_start; size_t heap_len; size_t heap_free; size_t heap_max_chunk; size_t heap_low_watermark; }; void miniheap_get_stats(struct miniheap_stats *ptr); void *miniheap_alloc(size_t, unsigned int alignment); void *miniheap_realloc(void *, size_t); void miniheap_free(void *); void miniheap_init(void *ptr, size_t len); void miniheap_dump(void); void miniheap_trim(void); __END_CDECLS;
/* Copyright (c) 2015 Nordic Semiconductor. All Rights Reserved. * * The information contained herein is property of Nordic Semiconductor ASA. * Terms and conditions of usage are described in detail in NORDIC * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. * * Licensees are granted free, non-transferable use of the information. NO * WARRANTY of ANY KIND is provided. This heading must NOT be removed from * the file. * */ #include "sdk_common.h" #if NRF_MODULE_ENABLED(ANT_SDM) #include "ant_sdm_page_16.h" #include "ant_sdm_utils.h" #define NRF_LOG_MODULE_NAME "ANT_SDM_PAGE_16" #if ANT_SDM_PAGE_16_LOG_ENABLED #define NRF_LOG_LEVEL ANT_SDM_PAGE_16_LOG_LEVEL #define NRF_LOG_INFO_COLOR ANT_SDM_PAGE_16_INFO_COLOR #else // ANT_SDM_PAGE_16_LOG_ENABLED #define NRF_LOG_LEVEL 0 #endif // ANT_SDM_PAGE_16_LOG_ENABLED #include "nrf_log.h" /**@brief SDM page 16 data layout structure. */ typedef struct { uint8_t strides[3]; uint8_t distance[4]; }ant_sdm_page16_data_layout_t; STATIC_ASSERT(ANT_SDM_DISTANCE_DISP_PRECISION == 10); ///< Display format need to be updated /**@brief Function for tracing common data. * * @param[in] p_common_data Pointer to the common data. */ static void page_16_data_log(ant_sdm_common_data_t const * p_common_data) { uint64_t distance = ANT_SDM_DISTANCE_RESCALE(p_common_data->distance); NRF_LOG_INFO("Distance %u.%01u m\r\n", (unsigned int)(distance / ANT_SDM_DISTANCE_DISP_PRECISION), (unsigned int)(distance % ANT_SDM_DISTANCE_DISP_PRECISION)); NRF_LOG_INFO("Strides %u\r\n\n", (unsigned int)p_common_data->strides); } void ant_sdm_page_16_encode(uint8_t * p_page_buffer, ant_sdm_common_data_t const * p_common_data) { ant_sdm_page16_data_layout_t * p_outcoming_data = (ant_sdm_page16_data_layout_t *)p_page_buffer; UNUSED_PARAMETER(uint24_encode(p_common_data->strides, p_outcoming_data->strides)); UNUSED_PARAMETER(uint32_encode(p_common_data->distance << 4, p_outcoming_data->distance)); page_16_data_log(p_common_data); } void ant_sdm_page_16_decode(uint8_t const * p_page_buffer, ant_sdm_common_data_t * p_common_data) { ant_sdm_page16_data_layout_t const * p_incoming_data = (ant_sdm_page16_data_layout_t *)p_page_buffer; p_common_data->strides = uint24_decode(p_incoming_data->strides); p_common_data->distance = uint32_decode(p_incoming_data->distance) >> 4; page_16_data_log(p_common_data); } #endif // NRF_MODULE_ENABLED(ANT_SDM)
// // ASTraitCollection.h // Texture // // Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. // Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved. // Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0 // #import <UIKit/UIKit.h> #import <AsyncDisplayKit/ASBaseDefines.h> @class ASTraitCollection; @protocol ASLayoutElement; @protocol ASTraitEnvironment; NS_ASSUME_NONNULL_BEGIN #pragma mark - ASPrimitiveTraitCollection /** * @abstract This is an internal struct-representation of ASTraitCollection. * * @discussion This struct is for internal use only. Framework users should always use ASTraitCollection. * * If you use ASPrimitiveTraitCollection, please do make sure to initialize it with ASPrimitiveTraitCollectionMakeDefault() * or ASPrimitiveTraitCollectionFromUITraitCollection(UITraitCollection*). */ #pragma clang diagnostic push #pragma clang diagnostic warning "-Wpadded" typedef struct { UIUserInterfaceSizeClass horizontalSizeClass; UIUserInterfaceSizeClass verticalSizeClass; CGFloat displayScale; UIDisplayGamut displayGamut API_AVAILABLE(ios(10.0)); UIUserInterfaceIdiom userInterfaceIdiom; UIForceTouchCapability forceTouchCapability; UITraitEnvironmentLayoutDirection layoutDirection API_AVAILABLE(ios(10.0)); #if AS_BUILD_UIUSERINTERFACESTYLE UIUserInterfaceStyle userInterfaceStyle API_AVAILABLE(tvos(10.0), ios(12.0)); #endif // NOTE: This must be a constant. We will assert. unowned UIContentSizeCategory preferredContentSizeCategory API_AVAILABLE(ios(10.0)); CGSize containerSize; } ASPrimitiveTraitCollection; #pragma clang diagnostic pop /** * Creates ASPrimitiveTraitCollection with default values. */ AS_EXTERN ASPrimitiveTraitCollection ASPrimitiveTraitCollectionMakeDefault(void); /** * Creates a ASPrimitiveTraitCollection from a given UITraitCollection. */ AS_EXTERN ASPrimitiveTraitCollection ASPrimitiveTraitCollectionFromUITraitCollection(UITraitCollection *traitCollection); /** * Compares two ASPrimitiveTraitCollection to determine if they are the same. */ AS_EXTERN BOOL ASPrimitiveTraitCollectionIsEqualToASPrimitiveTraitCollection(ASPrimitiveTraitCollection lhs, ASPrimitiveTraitCollection rhs); /** * Returns a string representation of a ASPrimitiveTraitCollection. */ AS_EXTERN NSString *NSStringFromASPrimitiveTraitCollection(ASPrimitiveTraitCollection traits); /** * This function will walk the layout element hierarchy and updates the layout element trait collection for every * layout element within the hierarchy. */ AS_EXTERN void ASTraitCollectionPropagateDown(id<ASLayoutElement> element, ASPrimitiveTraitCollection traitCollection); /** * Abstraction on top of UITraitCollection for propagation within AsyncDisplayKit-Layout */ @protocol ASTraitEnvironment <NSObject> /** * @abstract Returns a struct-representation of the environment's ASEnvironmentDisplayTraits. * * @discussion This only exists as an internal convenience method. Users should access the trait collections through * the NSObject based asyncTraitCollection API */ - (ASPrimitiveTraitCollection)primitiveTraitCollection; /** * @abstract Sets a trait collection on this environment state. * * @discussion This only exists as an internal convenience method. Users should not override trait collection using it. * Use [ASViewController overrideDisplayTraitsWithTraitCollection] block instead. */ - (void)setPrimitiveTraitCollection:(ASPrimitiveTraitCollection)traitCollection; /** * @abstract Returns the thread-safe UITraitCollection equivalent. */ - (ASTraitCollection *)asyncTraitCollection; @end #define ASPrimitiveTraitCollectionDefaults \ - (ASPrimitiveTraitCollection)primitiveTraitCollection\ {\ return _primitiveTraitCollection.load();\ }\ - (void)setPrimitiveTraitCollection:(ASPrimitiveTraitCollection)traitCollection\ {\ _primitiveTraitCollection = traitCollection;\ }\ #define ASLayoutElementCollectionTableSetTraitCollection(lock) \ - (void)setPrimitiveTraitCollection:(ASPrimitiveTraitCollection)traitCollection\ {\ ASDN::MutexLocker l(lock);\ \ ASPrimitiveTraitCollection oldTraits = self.primitiveTraitCollection;\ [super setPrimitiveTraitCollection:traitCollection];\ \ /* Extra Trait Collection Handling */\ \ /* If the node is not loaded yet don't do anything as otherwise the access of the view will trigger a load */\ if (! self.isNodeLoaded) { return; }\ \ ASPrimitiveTraitCollection currentTraits = self.primitiveTraitCollection;\ if (ASPrimitiveTraitCollectionIsEqualToASPrimitiveTraitCollection(currentTraits, oldTraits) == NO) {\ [self.dataController environmentDidChange];\ }\ }\ #pragma mark - ASTraitCollection AS_SUBCLASSING_RESTRICTED @interface ASTraitCollection : NSObject @property (readonly) UIUserInterfaceSizeClass horizontalSizeClass; @property (readonly) UIUserInterfaceSizeClass verticalSizeClass; @property (readonly) CGFloat displayScale; @property (readonly) UIDisplayGamut displayGamut API_AVAILABLE(ios(10.0)); @property (readonly) UIUserInterfaceIdiom userInterfaceIdiom; @property (readonly) UIForceTouchCapability forceTouchCapability; @property (readonly) UITraitEnvironmentLayoutDirection layoutDirection API_AVAILABLE(ios(10.0)); #if AS_BUILD_UIUSERINTERFACESTYLE @property (readonly) UIUserInterfaceStyle userInterfaceStyle API_AVAILABLE(tvos(10.0), ios(12.0)); #endif @property (readonly) UIContentSizeCategory preferredContentSizeCategory API_AVAILABLE(ios(10.0)); @property (readonly) CGSize containerSize; - (BOOL)isEqualToTraitCollection:(ASTraitCollection *)traitCollection; @end /** * These are internal helper methods. Should never be called by the framework users. */ @interface ASTraitCollection (PrimitiveTraits) + (ASTraitCollection *)traitCollectionWithASPrimitiveTraitCollection:(ASPrimitiveTraitCollection)traits NS_RETURNS_RETAINED; - (ASPrimitiveTraitCollection)primitiveTraitCollection; @end NS_ASSUME_NONNULL_END
#ifdef HAVE_CONFIG_H #include "../../ext_config.h" #endif #include <php.h> #include "../../php_ext.h" #include "../../ext.h" #include <Zend/zend_operators.h> #include <Zend/zend_exceptions.h> #include <Zend/zend_interfaces.h> #include "kernel/main.h" #include "kernel/object.h" #include "kernel/memory.h" #include "kernel/operators.h" /** * Stub\Properties\ProtectedProperties */ ZEPHIR_INIT_CLASS(Stub_Properties_ProtectedProperties) { ZEPHIR_REGISTER_CLASS(Stub\\Properties, ProtectedProperties, stub, properties_protectedproperties, stub_properties_protectedproperties_method_entry, 0); /** * This is a protected property with no initial value */ zend_declare_property_null(stub_properties_protectedproperties_ce, SL("someNull"), ZEND_ACC_PROTECTED); /** * This is a protected property with initial null value */ zend_declare_property_null(stub_properties_protectedproperties_ce, SL("someNullInitial"), ZEND_ACC_PROTECTED); /** * This is a protected property with initial boolean false */ zend_declare_property_bool(stub_properties_protectedproperties_ce, SL("someFalse"), 0, ZEND_ACC_PROTECTED); /** * This is a protected property with initial boolean true */ zend_declare_property_bool(stub_properties_protectedproperties_ce, SL("someTrue"), 1, ZEND_ACC_PROTECTED); /** * This is a protected property with an initial integer value */ zend_declare_property_long(stub_properties_protectedproperties_ce, SL("someInteger"), 10, ZEND_ACC_PROTECTED); /** * This is a protected property with an initial double value */ zend_declare_property_double(stub_properties_protectedproperties_ce, SL("someDouble"), 10.25, ZEND_ACC_PROTECTED); /** * This is a protected property with an initial string value */ zend_declare_property_string(stub_properties_protectedproperties_ce, SL("someString"), "test", ZEND_ACC_PROTECTED); /** * @var null|mixed */ zend_declare_property_null(stub_properties_protectedproperties_ce, SL("someVar"), ZEND_ACC_PROTECTED); /** * This is a property to test default value on extends * @var array */ zend_declare_property_null(stub_properties_protectedproperties_ce, SL("someArrayVar"), ZEND_ACC_PROTECTED); stub_properties_protectedproperties_ce->create_object = zephir_init_properties_Stub_Properties_ProtectedProperties; return SUCCESS; } /** */ PHP_METHOD(Stub_Properties_ProtectedProperties, setSomeVar) { zval *someVar, someVar_sub; zval *this_ptr = getThis(); ZVAL_UNDEF(&someVar_sub); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(someVar) ZEND_PARSE_PARAMETERS_END(); #endif zephir_fetch_params_without_memory_grow(1, 0, &someVar); zephir_update_property_zval(this_ptr, ZEND_STRL("someVar"), someVar); RETURN_THISW(); } /** */ PHP_METHOD(Stub_Properties_ProtectedProperties, getSomeVar) { zval *this_ptr = getThis(); RETURN_MEMBER(getThis(), "someVar"); } /** * This is a property to test default value on extends */ PHP_METHOD(Stub_Properties_ProtectedProperties, setSomeArrayVar) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *someArrayVar_param = NULL; zval someArrayVar; zval *this_ptr = getThis(); ZVAL_UNDEF(&someArrayVar); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ARRAY(someArrayVar) ZEND_PARSE_PARAMETERS_END(); #endif ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &someArrayVar_param); zephir_get_arrval(&someArrayVar, someArrayVar_param); zephir_update_property_zval(this_ptr, ZEND_STRL("someArrayVar"), &someArrayVar); RETURN_THIS(); } /** * This is a property to test default value on extends */ PHP_METHOD(Stub_Properties_ProtectedProperties, getSomeArrayVar) { zval *this_ptr = getThis(); RETURN_MEMBER(getThis(), "someArrayVar"); } /** * @return null|mixed */ PHP_METHOD(Stub_Properties_ProtectedProperties, getSomeNull) { zval *this_ptr = getThis(); RETURN_MEMBER(getThis(), "someNull"); } /** * @return void */ PHP_METHOD(Stub_Properties_ProtectedProperties, setSomeNull) { zval *param, param_sub; zval *this_ptr = getThis(); ZVAL_UNDEF(&param_sub); #if PHP_VERSION_ID >= 80000 bool is_null_true = 1; ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ZVAL(param) ZEND_PARSE_PARAMETERS_END(); #endif zephir_fetch_params_without_memory_grow(1, 0, &param); zephir_update_property_zval(this_ptr, ZEND_STRL("someNull"), param); } /** * @return null */ PHP_METHOD(Stub_Properties_ProtectedProperties, getSomeNullInitial) { zval *this_ptr = getThis(); RETURN_MEMBER(getThis(), "someNullInitial"); } /** * @return bool */ PHP_METHOD(Stub_Properties_ProtectedProperties, getSomeFalse) { zval *this_ptr = getThis(); RETURN_MEMBER(getThis(), "someFalse"); } /** * @return bool */ PHP_METHOD(Stub_Properties_ProtectedProperties, getSomeTrue) { zval *this_ptr = getThis(); RETURN_MEMBER(getThis(), "someTrue"); } /** * @return int */ PHP_METHOD(Stub_Properties_ProtectedProperties, getSomeInteger) { zval *this_ptr = getThis(); RETURN_MEMBER(getThis(), "someInteger"); } /** * @return float */ PHP_METHOD(Stub_Properties_ProtectedProperties, getSomeDouble) { zval *this_ptr = getThis(); RETURN_MEMBER(getThis(), "someDouble"); } /** * @return string */ PHP_METHOD(Stub_Properties_ProtectedProperties, getSomeString) { zval *this_ptr = getThis(); RETURN_MEMBER(getThis(), "someString"); } zend_object *zephir_init_properties_Stub_Properties_ProtectedProperties(zend_class_entry *class_type) { zval _0, _1$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1$$3); ZEPHIR_MM_GROW(); { zval local_this_ptr, *this_ptr = &local_this_ptr; ZEPHIR_CREATE_OBJECT(this_ptr, class_type); zephir_read_property_ex(&_0, this_ptr, ZEND_STRL("someArrayVar"), PH_NOISY_CC | PH_READONLY); if (Z_TYPE_P(&_0) == IS_NULL) { ZEPHIR_INIT_VAR(&_1$$3); array_init(&_1$$3); zephir_update_property_zval_ex(this_ptr, ZEND_STRL("someArrayVar"), &_1$$3); } ZEPHIR_MM_RESTORE(); return Z_OBJ_P(this_ptr); } }
/* * This file is part of MXE. * See index.html for further information. */ #include <modplug.h> int main(int argc, char *argv[]) { (void)argc; (void)argv; ModPlug_Settings settings; ModPlug_GetSettings(&settings); ModPlug_SetSettings(&settings); return 0; }
#ifndef PID_H #define PID_H #include "mbed.h" #include <algorithm> /* Bryce Williams 11/19/2015 PID Controller Class based on Brett Beauregard's Arduino PID Library and PID blog post. Brett Beauregard's blog post explains the PID code implementation very well and discusses why the actual equation is a bit different than the classical equation, i.e. he explains and implements how to overcome windup, dervative kick, etc. This class uses the same implementation, but adds interrupt driven computation. Reference Links: 1. Arduion Library: (http://playground.arduino.cc/Code/PIDLibrary) 2. Brett Beauregard's PID Blog: (http://brettbeauregard.com/blog/2011/04/improving-the-beginners- pid-introduction/) */ class PID{ public: /* Constructor for PID objects. Note: PID objects use given pointers, ie setpoint, feedback, output inside interrupts. When reading/ modifying these vars make sure we don't have possible read/write conflicts if the interrupt fires. Either ensure reads/writes are atomic operations, or call the stop() method perform the read/write and then call the start() method. @param setpoint The setpoint @param feedback Pointer to feedback/sensor data var @param output Pointer to the output var @param output_lower The lower bound of the output value @param output_upper The upper bount of the output value @param kp The Proportional Gain value @param ki The Integral Gain value @param kd The Derivative Gain value @param Ts The sample period at which the PID algorithm will generate an interrupt and run. */ PID(float* setpoint, float* feedback, float* output, float output_lower, float output_upper, float kp, float ki, float kd, float Ts); /* Starts PID Controller; Attaches sample() as callback to Ticker sample_timer and starts the interrupt */ void start(); /* Stops PID Contoller; detaches callback from Ticker sample_timer. Allows manual setting of output and read/write of shared vars, DON'T FORGET TO CALL stop() before read/write of shared vars! Then after call start()!!! */ void stop(); /* Increments/ decrements Gain values and Sample time by the given value. Gives a simple method to programatically step through different values; just put in a loop and go @param delta_"name" The value that will be added to its currently set value */ // void adjust_parameters(float delta_kp, float delta_ki, float delta_kd, float delta Ts); /* Overwrite Gain and Sample Time parameters with new values Note: sample_timer interrupt is disabled during update to avoid synch issues. */ void set_parameters(float kp, float ki, float kd, float Ts); float getKp(); float getKi(); float getKd(); float getTs(); /* returns current error */ float getError(); private: float _kp, _ki, _kd; // PID Gain values float _Ts; // Sample time is seconds float* _setpoint; // Pointer to setpoint value float* _feedback; // Pointer to sensor feedback value (sensor input) float* _output; // Pointer to control output value float _output_lower; // Ouput Lower Limit float _output_upper; // Output Upper Limit float i_accumulator; // Integral Term accumulator float last_feedback; // Previous feedback value float error; // Feedback error term Ticker sample_timer; // Generates the sample time interrupt and calls sample() /* sample() performs next sample calculationand updates command value */ void sample(); /* Clips value to lower/ uppper @param value The value to clip @param lower The mininum allowable value @param upper The maximum allowable value @return The resulting clipped value */ float clip(float value, float lower, float upper); }; #endif
/* * Dibbler - a portable DHCPv6 * * authors: Tomasz Mrugalski <thomson@klub.com.pl> * * Released under GNU GPL v2 licence * * $Id: ReqCfgMgr.h,v 1.3 2007-12-08 04:14:03 thomson Exp $ */ #ifndef REQCFGMGR_H #define REQCFGMGR_H typedef struct { // global parameters char * iface; int timeout; char * dstaddr; // message specific parameters char * addr; char * duid; } ReqCfgMgr; #endif
/* * a52_internal.h * Copyright (C) 2000-2003 Michel Lespinasse <walken@zoy.org> * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca> * * This file is part of a52dec, a free ATSC A-52 stream decoder. * See http://liba52.sourceforge.net/ for updates. * * a52dec 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. * * a52dec 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 */ typedef struct { uint8_t bai; /* fine SNR offset, fast gain */ uint8_t deltbae; /* delta bit allocation exists */ int8_t deltba[50]; /* per-band delta bit allocation */ } ba_t; typedef struct { uint8_t exp[256]; /* decoded channel exponents */ int8_t bap[256]; /* derived channel bit allocation */ } expbap_t; struct a52_state_s { uint8_t fscod; /* sample rate */ uint8_t halfrate; /* halfrate factor */ uint8_t acmod; /* coded channels */ uint8_t lfeon; /* coded lfe channel */ level_t clev; /* centre channel mix level */ level_t slev; /* surround channels mix level */ int output; /* type of output */ level_t level; /* output level */ sample_t bias; /* output bias */ int dynrnge; /* apply dynamic range */ level_t dynrng; /* dynamic range */ void * dynrngdata; /* dynamic range callback funtion and data */ level_t (* dynrngcall) (level_t range, void * dynrngdata); uint8_t chincpl; /* channel coupled */ uint8_t phsflginu; /* phase flags in use (stereo only) */ uint8_t cplstrtmant; /* coupling channel start mantissa */ uint8_t cplendmant; /* coupling channel end mantissa */ uint32_t cplbndstrc; /* coupling band structure */ level_t cplco[5][18]; /* coupling coordinates */ /* derived information */ uint8_t cplstrtbnd; /* coupling start band (for bit allocation) */ uint8_t ncplbnd; /* number of coupling bands */ uint8_t rematflg; /* stereo rematrixing */ uint8_t endmant[5]; /* channel end mantissa */ uint16_t bai; /* bit allocation information */ uint32_t * buffer_start; uint16_t lfsr_state; /* dither state */ uint32_t bits_left; uint32_t current_word; uint8_t csnroffst; /* coarse SNR offset */ ba_t cplba; /* coupling bit allocation parameters */ ba_t ba[5]; /* channel bit allocation parameters */ ba_t lfeba; /* lfe bit allocation parameters */ uint8_t cplfleak; /* coupling fast leak init */ uint8_t cplsleak; /* coupling slow leak init */ expbap_t cpl_expbap; expbap_t fbw_expbap[5]; expbap_t lfe_expbap; sample_t * samples; int downmixed; }; #define LEVEL_PLUS6DB 2.0 #define LEVEL_PLUS3DB 1.4142135623730951 #define LEVEL_3DB 0.7071067811865476 #define LEVEL_45DB 0.5946035575013605 #define LEVEL_6DB 0.5 // these next two constants are used for DPL matrix encoding in downmix.c #define LEVEL_SQRT_1_2 0.5 #define LEVEL_SQRT_3_4 0.8660254037844386 #define EXP_REUSE (0) #define EXP_D15 (1) #define EXP_D25 (2) #define EXP_D45 (3) #define DELTA_BIT_REUSE (0) #define DELTA_BIT_NEW (1) #define DELTA_BIT_NONE (2) #define DELTA_BIT_RESERVED (3) void a52_bit_allocate (a52_state_t * state, ba_t * ba, int bndstart, int start, int end, int fastleak, int slowleak, expbap_t * expbap); int a52_downmix_init (int input, int flags, level_t * level, level_t clev, level_t slev); int a52_downmix_coeff (level_t * coeff, int acmod, int output, level_t level, level_t clev, level_t slev); void a52_downmix (sample_t * samples, int acmod, int output, sample_t bias, level_t clev, level_t slev); void a52_upmix (sample_t * samples, int acmod, int output); void a52_imdct_init (uint32_t accel); void a52_imdct_256 (sample_t * data, sample_t * delay, sample_t bias); void a52_imdct_512 (sample_t * data, sample_t * delay, sample_t bias); uint16_t a52_crc16_block(uint8_t *data, uint32_t num_bytes); #define ROUND(x) ((int)((x) + ((x) > 0 ? 0.5 : -0.5))) typedef struct { #ifdef ARCH_PPC uint8_t regv[12*16]; #endif int dummy; } cpu_state_t; /* cpu_accel.c */ uint32_t a52_detect_accel (uint32_t accel); /* cpu_state.c */ void a52_cpu_state_init (uint32_t accel); #ifndef LIBA52_FIXED typedef sample_t quantizer_t; #define SAMPLE(x) (x) #define LEVEL(x) (x) #define MUL(a,b) ((a) * (b)) #define MUL_L(a,b) ((a) * (b)) #define MUL_C(a,b) ((a) * (b)) #define DIV(a,b) ((a) / (b)) #define BIAS(x) ((x) + bias) #else /* LIBA52_FIXED */ typedef int16_t quantizer_t; #define SAMPLE(x) (sample_t)((x) * (1 << 30)) #define LEVEL(x) (level_t)((x) * (1 << 26)) #if 0 #define MUL(a,b) ((int)(((int64_t)(a) * (b) + (1 << 29)) >> 30)) #define MUL_L(a,b) ((int)(((int64_t)(a) * (b) + (1 << 25)) >> 26)) #elif 1 #define MUL(a,b) \ ({ int32_t _ta=(a), _tb=(b), _tc; \ _tc=(_ta & 0xffff)*(_tb >> 16)+(_ta >> 16)*(_tb & 0xffff); (int32_t)(((_tc >> 14))+ (((_ta >> 16)*(_tb >> 16)) << 2 )); }) #define MUL_L(a,b) \ ({ int32_t _ta=(a), _tb=(b), _tc; \ _tc=(_ta & 0xffff)*(_tb >> 16)+(_ta >> 16)*(_tb & 0xffff); (int32_t)((_tc >> 10) + (((_ta >> 16)*(_tb >> 16)) << 6)); }) #else #define MUL(a,b) (((a) >> 15) * ((b) >> 15)) #define MUL_L(a,b) (((a) >> 13) * ((b) >> 13)) #endif #define MUL_C(a,b) MUL_L (a, LEVEL (b)) #define DIV(a,b) ((((int64_t)LEVEL (a)) << 26) / (b)) #define BIAS(x) (x) #endif
/* * Commandline option parsing functions * * Copyright (c) 2003-2008 Fabrice Bellard * Copyright (c) 2009 Kevin Wolf <kwolf@redhat.com> * * 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 QEMU_OPTIONS_H #define QEMU_OPTIONS_H #include <stdint.h> #include "qemu-queue.h" #include "qdict.h" enum QEMUOptionParType { OPT_FLAG, OPT_NUMBER, OPT_SIZE, OPT_STRING, }; typedef struct QEMUOptionParameter { const char *name; enum QEMUOptionParType type; union { uint64_t n; char* s; } value; const char *help; } QEMUOptionParameter; const char *get_opt_name(char *buf, int buf_size, const char *p, char delim); const char *get_opt_value(char *buf, int buf_size, const char *p); int get_next_param_value(char *buf, int buf_size, const char *tag, const char **pstr); int get_param_value(char *buf, int buf_size, const char *tag, const char *str); int check_params(char *buf, int buf_size, const char * const *params, const char *str); /* * The following functions take a parameter list as input. This is a pointer to * the first element of a QEMUOptionParameter array which is terminated by an * entry with entry->name == NULL. */ QEMUOptionParameter *get_option_parameter(QEMUOptionParameter *list, const char *name); int set_option_parameter(QEMUOptionParameter *list, const char *name, const char *value); int set_option_parameter_int(QEMUOptionParameter *list, const char *name, uint64_t value); QEMUOptionParameter *parse_option_parameters(const char *param, QEMUOptionParameter *list, QEMUOptionParameter *dest); void free_option_parameters(QEMUOptionParameter *list); void print_option_parameters(QEMUOptionParameter *list); void print_option_help(QEMUOptionParameter *list); /* ------------------------------------------------------------------ */ typedef struct QemuOpt QemuOpt; typedef struct QemuOpts QemuOpts; typedef struct QemuOptsList QemuOptsList; enum QemuOptType { QEMU_OPT_STRING = 0, /* no parsing (use string as-is) */ QEMU_OPT_BOOL, /* on/off */ QEMU_OPT_NUMBER, /* simple number */ QEMU_OPT_SIZE, /* size, accepts (K)ilo, (M)ega, (G)iga, (T)era postfix */ }; typedef struct QemuOptDesc { const char *name; enum QemuOptType type; const char *help; } QemuOptDesc; struct QemuOptsList { const char *name; const char *implied_opt_name; QTAILQ_HEAD(, QemuOpts) head; QemuOptDesc desc[]; }; const char *qemu_opt_get(QemuOpts *opts, const char *name); int qemu_opt_get_bool(QemuOpts *opts, const char *name, int defval); uint64_t qemu_opt_get_number(QemuOpts *opts, const char *name, uint64_t defval); uint64_t qemu_opt_get_size(QemuOpts *opts, const char *name, uint64_t defval); int qemu_opt_set(QemuOpts *opts, const char *name, const char *value); typedef int (*qemu_opt_loopfunc)(const char *name, const char *value, void *opaque); int qemu_opt_foreach(QemuOpts *opts, qemu_opt_loopfunc func, void *opaque, int abort_on_failure); QemuOpts *qemu_opts_find(QemuOptsList *list, const char *id); QemuOpts *qemu_opts_create(QemuOptsList *list, const char *id, int fail_if_exists); int qemu_opts_set(QemuOptsList *list, const char *id, const char *name, const char *value); const char *qemu_opts_id(QemuOpts *opts); void qemu_opts_del(QemuOpts *opts); int qemu_opts_validate(QemuOpts *opts, const QemuOptDesc *desc); int qemu_opts_do_parse(QemuOpts *opts, const char *params, const char *firstname); QemuOpts *qemu_opts_parse(QemuOptsList *list, const char *params, int permit_abbrev); QemuOpts *qemu_opts_from_qdict(QemuOptsList *list, const QDict *qdict); QDict *qemu_opts_to_qdict(QemuOpts *opts, QDict *qdict); typedef int (*qemu_opts_loopfunc)(QemuOpts *opts, void *opaque); int qemu_opts_print(QemuOpts *opts, void *dummy); int qemu_opts_foreach(QemuOptsList *list, qemu_opts_loopfunc func, void *opaque, int abort_on_failure); #endif
/* * \brief Signal driven network handler * \author Stefan Kalkowski * \auhtor Sebastian Sumpf * \date 2013-09-24 */ /* * Copyright (C) 2010-2013 Genode Labs GmbH * * This file is part of the Genode OS framework, which is distributed * under the terms of the GNU General Public License version 2. */ #ifndef _PACKET_HANDLER_H_ #define _PACKET_HANDLER_H_ /* Genode */ #include <nic_session/connection.h> namespace Net { class Packet_handler; } /** * Generic packet handler used as base for NIC and client packet handlers. */ class Net::Packet_handler { private: /** * submit queue not empty anymore */ void _packet_avail(unsigned); /** * acknoledgement queue not full anymore */ void _ready_to_ack(unsigned); /** * acknoledgement queue not empty anymore */ void _ack_avail(unsigned); /** * submit queue not full anymore * * TODO: by now, we just drop packets that cannot be transferred * to the other side, that's why we ignore this signal. */ void _ready_to_submit(unsigned) { } protected: Genode::Signal_dispatcher<Packet_handler> _sink_ack; Genode::Signal_dispatcher<Packet_handler> _sink_submit; Genode::Signal_dispatcher<Packet_handler> _source_ack; Genode::Signal_dispatcher<Packet_handler> _source_submit; public: Packet_handler(); virtual Packet_stream_sink< ::Nic::Session::Policy> * sink() = 0; virtual Packet_stream_source< ::Nic::Session::Policy> * source() = 0; void packet_avail() { _packet_avail(1); } }; #endif /* _PACKET_HANDLER_H_ */
/* * linux/arch/parisc/kernel/sys_hpux.c * * implements HPUX syscalls. */ #include <linux/mm.h> #include <linux/sched.h> #include <linux/file.h> #include <linux/smp_lock.h> #include <linux/slab.h> #include <asm/errno.h> #include <asm/uaccess.h> int hpux_execve(struct pt_regs *regs) { int error; char *filename; filename = getname((char *) regs->gr[26]); error = PTR_ERR(filename); if (IS_ERR(filename)) goto out; error = do_execve(filename, (char **) regs->gr[25], (char **)regs->gr[24], regs); if (error == 0) current->ptrace &= ~PT_DTRACE; putname(filename); out: return error; } struct hpux_dirent { long d_off_pad; /* we only have a 32-bit off_t */ long d_off; ino_t d_ino; short d_reclen; short d_namlen; char d_name[1]; }; struct getdents_callback { struct hpux_dirent *current_dir; struct hpux_dirent *previous; int count; int error; }; #define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de))) #define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1)) static int filldir(void * __buf, const char * name, int namlen, loff_t offset, ino_t ino) { struct hpux_dirent * dirent; struct getdents_callback * buf = (struct getdents_callback *) __buf; int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1); buf->error = -EINVAL; /* only used if we fail.. */ if (reclen > buf->count) return -EINVAL; dirent = buf->previous; if (dirent) put_user(offset, &dirent->d_off); dirent = buf->current_dir; buf->previous = dirent; put_user(ino, &dirent->d_ino); put_user(reclen, &dirent->d_reclen); put_user(namlen, &dirent->d_namlen); copy_to_user(dirent->d_name, name, namlen); put_user(0, dirent->d_name + namlen); ((char *) dirent) += reclen; buf->current_dir = dirent; buf->count -= reclen; return 0; } #undef NAME_OFFSET #undef ROUND_UP int hpux_getdents(unsigned int fd, struct hpux_dirent *dirent, unsigned int count) { struct file * file; struct dentry * dentry; struct inode * inode; struct hpux_dirent * lastdirent; struct getdents_callback buf; int error; lock_kernel(); error = -EBADF; file = fget(fd); if (!file) goto out; dentry = file->f_dentry; if (!dentry) goto out_putf; inode = dentry->d_inode; if (!inode) goto out_putf; buf.current_dir = dirent; buf.previous = NULL; buf.count = count; buf.error = 0; error = -ENOTDIR; if (!file->f_op || !file->f_op->readdir) goto out_putf; /* * Get the inode's semaphore to prevent changes * to the directory while we read it. */ down(&inode->i_sem); error = file->f_op->readdir(file, &buf, filldir); up(&inode->i_sem); if (error < 0) goto out_putf; error = buf.error; lastdirent = buf.previous; if (lastdirent) { put_user(file->f_pos, &lastdirent->d_off); error = count - buf.count; } out_putf: fput(file); out: unlock_kernel(); return error; } int hpux_mount(const char *fs, const char *path, int mflag, const char *fstype, const char *dataptr, int datalen) { return -ENOSYS; } static int cp_hpux_stat(struct inode * inode, struct hpux_stat64 * statbuf) { struct hpux_stat64 tmp; unsigned int blocks, indirect; memset(&tmp, 0, sizeof(tmp)); tmp.st_dev = kdev_t_to_nr(inode->i_dev); tmp.st_ino = inode->i_ino; tmp.st_mode = inode->i_mode; tmp.st_nlink = inode->i_nlink; tmp.st_uid = inode->i_uid; tmp.st_gid = inode->i_gid; tmp.st_rdev = kdev_t_to_nr(inode->i_rdev); tmp.st_size = inode->i_size; tmp.st_atime = inode->i_atime; tmp.st_mtime = inode->i_mtime; tmp.st_ctime = inode->i_ctime; #define D_B 7 #define I_B (BLOCK_SIZE / sizeof(unsigned short)) if (!inode->i_blksize) { blocks = (tmp.st_size + BLOCK_SIZE - 1) / BLOCK_SIZE; if (blocks > D_B) { indirect = (blocks - D_B + I_B - 1) / I_B; blocks += indirect; if (indirect > 1) { indirect = (indirect - 1 + I_B - 1) / I_B; blocks += indirect; if (indirect > 1) blocks++; } } tmp.st_blocks = (BLOCK_SIZE / 512) * blocks; tmp.st_blksize = BLOCK_SIZE; } else { tmp.st_blocks = inode->i_blocks; tmp.st_blksize = inode->i_blksize; } return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; } /* * Revalidate the inode. This is required for proper NFS attribute caching. * Blatently copied wholesale from fs/stat.c */ static __inline__ int do_revalidate(struct dentry *dentry) { struct inode * inode = dentry->d_inode; if (inode->i_op && inode->i_op->revalidate) return inode->i_op->revalidate(dentry); return 0; } long hpux_stat64(const char *path, struct hpux_stat64 *buf) { struct nameidata nd; int error; lock_kernel(); error = user_path_walk(path, &nd); if (!error) { error = do_revalidate(nd.dentry); if (!error) error = cp_hpux_stat(nd.dentry->d_inode, buf); path_release(&nd); } unlock_kernel(); return error; } long hpux_fstat64(unsigned int fd, struct hpux_stat64 *statbuf) { struct file * f; int err = -EBADF; lock_kernel(); f = fget(fd); if (f) { struct dentry * dentry = f->f_dentry; err = do_revalidate(dentry); if (!err) err = cp_hpux_stat(dentry->d_inode, statbuf); fput(f); } unlock_kernel(); return err; } long hpux_lstat64(char *filename, struct hpux_stat64 *statbuf) { struct nameidata nd; int error; lock_kernel(); error = user_path_walk_link(filename, &nd); if (!error) { error = do_revalidate(nd.dentry); if (!error) error = cp_hpux_stat(nd.dentry->d_inode, statbuf); path_release(&nd); } unlock_kernel(); return error; }
/* include/linux/mhl.h * * Copyright (C) 2010 HTC, Inc. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and * may be copied, distributed, and modified under those terms. * * 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 _MHL_H_ #define _MHL_H_ //******************************************************************** // Nested Include Files //******************************************************************** //******************************************************************** // Manifest Constants //******************************************************************** #define MHL_SII9234_I2C_NAME "sii9234" #ifdef CONFIG_FB_MSM_HDMI_MHL_SUPERDEMO #define MHL_SII9234_TOUCH_FINGER_NUM_MAX 2 #endif //******************************************************************** // Type Definitions //******************************************************************** typedef enum { E_MHL_FALSE = 0, E_MHL_TRUE = 1, E_MHL_OK = 0, E_MHL_FAIL = 1, E_MHL_NA = 0xFF } T_MHL_RV; #ifdef CONFIG_FB_MSM_HDMI_MHL_SUPERDEMO typedef enum { E_MHL_EVT_REMOTE_KEY = 0x0001, E_MHL_EVT_REMOTE_KEY_RELEASE = 0x0002, E_MHL_EVT_REMOTE_TOUCH = 0x0003, E_MHL_EVT_REMOTE_TOUCH_RELEASE = 0x0006, E_MHL_EVT_REMOTE_TOUCH_PRESS = 0x0007, E_MHL_EVT_UNKNOWN = 0xFFFF } T_MHL_EVT_REMOTE_CNTL; typedef struct { int x; int y; int z; } T_MHL_REMOTE_FINGER_DATA; typedef struct { int keyIn; int keyCode; } T_MHL_REMOTE_KEY_DATA; #endif typedef struct { bool valid; uint8_t regA3; uint8_t regA6; } mhl_board_params; typedef struct { int gpio_intr; int gpio_reset; int ci2ca; void (*mhl_usb_switch)(int); void (*mhl_1v2_power)(bool enable); int (*enable_5v)(int on); int (*power)(int); #ifdef CONFIG_FB_MSM_HDMI_MHL_SUPERDEMO int abs_x_min; int abs_x_max; int abs_y_min; int abs_y_max; int abs_pressure_min; int abs_pressure_max; int abs_width_min; int abs_width_max; #endif } T_MHL_PLATFORM_DATA; //******************************************************************** // Define & Macro //******************************************************************** #define M_MHL_SEND_DEBUG(x...) pr_info(x) //******************************************************************** // Prototype & Extern variable, function //******************************************************************** #ifdef CONFIG_FB_MSM_HDMI_MHL extern void sii9234_change_usb_owner(bool bMHL); #endif #endif/*_MHL_H_*/
/* SPDX-License-Identifier: LGPL-2.1+ */ #include <net/if_arp.h> #include <string.h> #include "arphrd-list.h" #include "macro.h" static const struct arphrd_name* lookup_arphrd(register const char *str, register GPERF_LEN_TYPE len); #include "arphrd-from-name.h" #include "arphrd-to-name.h" const char *arphrd_to_name(int id) { if (id <= 0) return NULL; if (id >= (int) ELEMENTSOF(arphrd_names)) return NULL; return arphrd_names[id]; } int arphrd_from_name(const char *name) { const struct arphrd_name *sc; assert(name); sc = lookup_arphrd(name, strlen(name)); if (!sc) return 0; return sc->id; } int arphrd_max(void) { return ELEMENTSOF(arphrd_names); }
//------------------------------------------------------------------------------ // Copyright (c) 2004-2010 Atheros Communications Inc. // All rights reserved. // // // The software source and binaries included in this development package are // licensed, not sold. You, or your company, received the package under one // or more license agreements. The rights granted to you are specifically // listed in these license agreement(s). All other rights remain with Atheros // Communications, Inc., its subsidiaries, or the respective owner including // those listed on the included copyright notices. Distribution of any // portion of this package must be in strict compliance with the license // agreement(s) terms. // </copyright> // // <summary> // Wifi driver for AR6002 // </summary> // // // Author(s): ="Atheros" //------------------------------------------------------------------------------ #ifndef _CONFIG_LINUX_H_ #define _CONFIG_LINUX_H_ #ifdef __cplusplus extern "C" { #endif #include <linux/version.h> /* * Host-side GPIO support is optional. * If run-time access to GPIO pins is not required, then * this should be changed to #undef. */ #define CONFIG_HOST_GPIO_SUPPORT /* * Host side Test Command support * Note: when HCI SDIO is enabled, a low stack IRQ or statck overflow is * hit on FC10. So with HCI SDIO, minimize the stack allocation by * mutually exclude TCMD_SUPPORT, which allocates large buffers * in AR_TCMD_RESP in AR_SOFTC_T * */ #ifndef HCI_TRANSPORT_SDIO #define CONFIG_HOST_TCMD_SUPPORT #endif /* Host-side support for Target-side profiling */ #undef CONFIG_TARGET_PROFILE_SUPPORT /*DIX OFFLOAD SUPPORT*/ /*#define DIX_RX_OFFLOAD*/ /*#define DIX_TX_OFFLOAD*/ /* IP/TCP checksum offload */ /* Checksum offload is currently not supported for 64 bit platforms */ #ifndef __LP64__ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) #define CONFIG_CHECKSUM_OFFLOAD #endif #endif /* __LP64__ */ #ifdef __cplusplus } #endif #endif
// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- // // is_na.h: Rcpp R/C++ interface class library -- is_na // // Copyright (C) 2010 - 2013 Dirk Eddelbuettel and Romain Francois // // This file is part of Rcpp. // // Rcpp 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. // // Rcpp 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 Rcpp. If not, see <http://www.gnu.org/licenses/>. #ifndef Rcpp__sugar__is_na_h #define Rcpp__sugar__is_na_h namespace Rcpp{ namespace sugar{ template <int RTYPE, bool NA, typename VEC_TYPE> class IsNa : public ::Rcpp::VectorBase< LGLSXP, false, IsNa<RTYPE,NA,VEC_TYPE> > { public: typedef typename traits::storage_type<RTYPE>::type STORAGE ; typedef Rcpp::VectorBase<RTYPE,NA,VEC_TYPE> BASE ; IsNa( const BASE& obj_) : obj(obj_){} inline int operator[]( int i ) const { return ::Rcpp::traits::is_na<RTYPE>( obj[i] ) ; } inline int size() const { return obj.size() ; } private: const BASE& obj ; } ; // specialization for the case where we already know // the result (FALSE) because it is embedded in the type // (the second template parameter of VectorBase) template <int RTYPE, typename VEC_TYPE> class IsNa<RTYPE,false,VEC_TYPE> : public ::Rcpp::VectorBase< LGLSXP, false, IsNa<RTYPE,false,VEC_TYPE> > { public: typedef typename traits::storage_type<RTYPE>::type STORAGE ; typedef Rcpp::VectorBase<RTYPE,false,VEC_TYPE> BASE ; IsNa( const BASE& obj_) : obj(obj_){} inline int operator[]( int i ) const { return FALSE ; } inline int size() const { return obj.size() ; } private: const BASE& obj ; } ; template <typename T> class IsNa_Vector_is_na : public Rcpp::VectorBase<LGLSXP, false, IsNa_Vector_is_na<T> >{ public: IsNa_Vector_is_na( const T& x) : ref(x){} inline int operator[]( int i) const { return ref[i].is_na() ; } inline int size() const { return ref.size() ; } private: const T& ref ; } ; } // sugar template <int RTYPE, bool NA, typename T> inline sugar::IsNa<RTYPE,NA,T> is_na( const Rcpp::VectorBase<RTYPE,NA,T>& t){ return sugar::IsNa<RTYPE,NA,T>( t ) ; } inline sugar::IsNa_Vector_is_na<DatetimeVector> is_na( const DatetimeVector& x){ return sugar::IsNa_Vector_is_na<DatetimeVector>( x ) ; } inline sugar::IsNa_Vector_is_na<DateVector> is_na( const DateVector& x){ return sugar::IsNa_Vector_is_na<DateVector>( x ) ; } } // Rcpp #endif
#ifndef PROPSET2_H #define PROPSET2_H /* constants for propset 2, most digic3 camera WARNING: The build uses tools/gen_propset_lua.sed to generate propset2.lua from this file */ #define PROPCASE_DRIVE_MODE 102 #define PROPCASE_FOCUS_MODE 133 #define PROPCASE_FLASH_MODE 143 #define PROPCASE_FLASH_FIRE 122 #define PROPCASE_FLASH_MANUAL_OUTPUT 141 #define PROPCASE_FLASH_ADJUST_MODE 121 #define PROPCASE_USER_TV 264 #define PROPCASE_TV 262 #define PROPCASE_USER_AV 26 #define PROPCASE_AV 23 #define PROPCASE_MIN_AV 25 #define PROPCASE_SV 247 #define PROPCASE_DELTA_SV 79 #define PROPCASE_SV_MARKET 246 #define PROPCASE_BV 34 #define PROPCASE_SUBJECT_DIST1 245 #define PROPCASE_SUBJECT_DIST2 65 #define PROPCASE_ISO_MODE 149 #define PROPCASE_SHOOTING 206 #define PROPCASE_IS_FLASH_READY 208 #define PROPCASE_OVEREXPOSURE 103 #define PROPCASE_SHOOTING_MODE 49 #define PROPCASE_IS_MODE 145 #define PROPCASE_QUALITY 57 #define PROPCASE_RESOLUTION 218 #define PROPCASE_EV_CORRECTION_1 107 #define PROPCASE_EV_CORRECTION_2 207 #define PROPCASE_ORIENTATION_SENSOR 219 #define PROPCASE_DIGITAL_ZOOM_STATE 94 #define PROPCASE_DIGITAL_ZOOM_POSITION 95 #define PROPCASE_DISPLAY_MODE 105 #define PROPCASE_BRACKET_MODE 29 #define PROPCASE_FLASH_SYNC_CURTAIN 64 #define PROPCASE_METERING_MODE 155 #define PROPCASE_WB_ADJ 269 #define PROPCASE_ASPECT_RATIO 294 #define PROPCASE_TIMER_MODE 223 #define PROPCASE_OPTICAL_ZOOM_POSITION 195 //#define PROPCASE_OPTICAL_ZOOM_POSITION 251 // not working sx200is #endif
/* * cxgb3i.h: Chelsio S3xx iSCSI driver. * * Copyright (c) 2008 Chelsio Communications, Inc. * * 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. * * Written by: Karen Xie (kxie@chelsio.com) */ #ifndef __CXGB3I_H__ #define __CXGB3I_H__ #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/errno.h> #include <linux/types.h> #include <linux/list.h> #include <linux/netdevice.h> #include <linux/scatterlist.h> #include <scsi/libiscsi_tcp.h> /* from cxgb3 LLD */ #include "common.h" #include "t3_cpl.h" #include "t3cdev.h" #include "cxgb3_ctl_defs.h" #include "cxgb3_offload.h" #include "firmware_exports.h" #include "cxgb3i_offload.h" #include "cxgb3i_ddp.h" #define CXGB3I_SCSI_QDEPTH_DFLT 128 #define CXGB3I_MAX_TARGET CXGB3I_MAX_CONN #define CXGB3I_MAX_LUN 512 #define ISCSI_PDU_NONPAYLOAD_MAX \ (sizeof(struct iscsi_hdr) + ISCSI_MAX_AHS_SIZE + 2*ISCSI_DIGEST_SIZE) struct cxgb3i_adapter; struct cxgb3i_hba; struct cxgb3i_endpoint; /** * struct cxgb3i_hba - cxgb3i iscsi structure (per port) * * @snic: cxgb3i adapter containing this port * @ndev: pointer to netdev structure * @shost: pointer to scsi host structure */ struct cxgb3i_hba { struct cxgb3i_adapter *snic; struct net_device *ndev; struct Scsi_Host *shost; }; /** * struct cxgb3i_adapter - cxgb3i adapter structure (per pci) * * @listhead: list head to link elements * @lock: lock for this structure * @tdev: pointer to t3cdev used by cxgb3 driver * @pdev: pointer to pci dev * @hba_cnt: # of hbas (the same as # of ports) * @hba: all the hbas on this adapter * @tx_max_size: max. tx packet size supported * @rx_max_size: max. rx packet size supported * @tag_format: ddp tag format settings */ struct cxgb3i_adapter { struct list_head list_head; spinlock_t lock; struct t3cdev *tdev; struct pci_dev *pdev; unsigned char hba_cnt; struct cxgb3i_hba *hba[MAX_NPORTS]; unsigned int tx_max_size; unsigned int rx_max_size; struct cxgb3i_tag_format tag_format; }; /** * struct cxgb3i_conn - cxgb3i iscsi connection * * @listhead: list head to link elements * @cep: pointer to iscsi_endpoint structure * @conn: pointer to iscsi_conn structure * @hba: pointer to the hba this conn. is going through * @task_idx_bits: # of bits needed for session->cmds_max */ struct cxgb3i_conn { struct list_head list_head; struct cxgb3i_endpoint *cep; struct iscsi_conn *conn; struct cxgb3i_hba *hba; unsigned int task_idx_bits; }; /** * struct cxgb3i_endpoint - iscsi tcp endpoint * * @c3cn: the h/w tcp connection representation * @hba: pointer to the hba this conn. is going through * @cconn: pointer to the associated cxgb3i iscsi connection */ struct cxgb3i_endpoint { struct s3_conn *c3cn; struct cxgb3i_hba *hba; struct cxgb3i_conn *cconn; }; int cxgb3i_iscsi_init(void); void cxgb3i_iscsi_cleanup(void); struct cxgb3i_adapter *cxgb3i_adapter_add(struct t3cdev *); void cxgb3i_adapter_remove(struct t3cdev *); int cxgb3i_adapter_ulp_init(struct cxgb3i_adapter *); void cxgb3i_adapter_ulp_cleanup(struct cxgb3i_adapter *); struct cxgb3i_hba *cxgb3i_hba_find_by_netdev(struct net_device *); struct cxgb3i_hba *cxgb3i_hba_host_add(struct cxgb3i_adapter *, struct net_device *); void cxgb3i_hba_host_remove(struct cxgb3i_hba *); int cxgb3i_pdu_init(void); void cxgb3i_pdu_cleanup(void); void cxgb3i_conn_cleanup_task(struct iscsi_task *); int cxgb3i_conn_alloc_pdu(struct iscsi_task *, u8); int cxgb3i_conn_init_pdu(struct iscsi_task *, unsigned int, unsigned int); int cxgb3i_conn_xmit_pdu(struct iscsi_task *); void cxgb3i_release_itt(struct iscsi_task *task, itt_t hdr_itt); int cxgb3i_reserve_itt(struct iscsi_task *task, itt_t *hdr_itt); #endif
/******************** (C) COPYRIGHT 2010 STMicroelectronics ******************** * * File Name : lsm303dlh.h * Authors : MSH - Motion Mems BU - Application Team * : Carmine Iascone (carmine.iascone@st.com) * : Matteo Dameno (matteo.dameno@st.com) * Version : V 1.0.1 * Date : 19/03/2010 * Description : LSM303DLH 6D module sensor API * ******************************************************************************** * * 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. * * THE PRESENT SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES * OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, FOR THE SOLE * PURPOSE TO SUPPORT YOUR APPLICATION DEVELOPMENT. * 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 SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. * * THIS SOFTWARE IS SPECIFICALLY DESIGNED FOR EXCLUSIVE USE WITH ST PARTS. * *******************************************************************************/ #ifndef __LSM303DLH_H__ #define __LSM303DLH_H__ #include <linux/ioctl.h> /* For IOCTL macros */ #include <linux/slab.h> #define LSM303DLH_ACC_IOCTL_BASE 'a' /* The following define the IOCTL command values via the ioctl macros */ #define LSM303DLH_ACC_IOCTL_SET_DELAY _IOW(LSM303DLH_ACC_IOCTL_BASE, 0, int) #define LSM303DLH_ACC_IOCTL_GET_DELAY _IOR(LSM303DLH_ACC_IOCTL_BASE, 1, int) #define LSM303DLH_ACC_IOCTL_SET_ENABLE _IOW(LSM303DLH_ACC_IOCTL_BASE, 2, int) #define LSM303DLH_ACC_IOCTL_GET_ENABLE _IOR(LSM303DLH_ACC_IOCTL_BASE, 3, int) #define LSM303DLH_ACC_IOCTL_SET_G_RANGE _IOW(LSM303DLH_ACC_IOCTL_BASE, 4, int) #define LSM303DLH_MAG_IOCTL_BASE 'm' /* The following define the IOCTL command values via the ioctl macros */ #define LSM303DLH_MAG_IOCTL_SET_DELAY _IOW(LSM303DLH_MAG_IOCTL_BASE, 0, int) #define LSM303DLH_MAG_IOCTL_GET_DELAY _IOR(LSM303DLH_MAG_IOCTL_BASE, 1, int) #define LSM303DLH_MAG_IOCTL_SET_ENABLE _IOW(LSM303DLH_MAG_IOCTL_BASE, 2, int) #define LSM303DLH_MAG_IOCTL_GET_ENABLE _IOR(LSM303DLH_MAG_IOCTL_BASE, 3, int) #define LSM303DLH_MAG_IOCTL_SET_H_RANGE _IOW(LSM303DLH_MAG_IOCTL_BASE, 4, int) /*****************************************************************************/ /************************************************/ /* Accelerometer section defines */ /************************************************/ /* Accelerometer Sensor Full Scale */ #define LSM303DLH_G_2G 0x00 #define LSM303DLH_G_4G 0x10 #define LSM303DLH_G_8G 0x30 /* Accelerometer Sensor Operating Mode */ #define LSM303DLH_ACC_PM_OFF 0x00 #define LSM303DLH_ACC_PM_NORMAL 0x20 #define LSM303DLH_ACC_ENABLE_ALL_AXES 0x07 /* Accelerometer output data rate */ #define LSM303DLH_ACC_ODRHALF 0x40 /* 0.5Hz output data rate */ #define LSM303DLH_ACC_ODR1 0x60 /* 1Hz output data rate */ #define LSM303DLH_ACC_ODR2 0x80 /* 2Hz output data rate */ #define LSM303DLH_ACC_ODR5 0xA0 /* 5Hz output data rate */ #define LSM303DLH_ACC_ODR10 0xC0 /* 10Hz output data rate */ #define LSM303DLH_ACC_ODR50 0x00 /* 50Hz output data rate */ #define LSM303DLH_ACC_ODR100 0x08 /* 100Hz output data rate */ #define LSM303DLH_ACC_ODR400 0x10 /* 400Hz output data rate */ #define LSM303DLH_ACC_ODR1000 0x18 /* 1000Hz output data rate */ /************************************************/ /* Magnetometer section defines */ /************************************************/ /* Magnetometer Sensor Full Scale */ #define LSM303DLH_H_1_3G 0x20 #define LSM303DLH_H_1_9G 0x40 #define LSM303DLH_H_2_5G 0x60 #define LSM303DLH_H_4_0G 0x80 #define LSM303DLH_H_4_7G 0xA0 #define LSM303DLH_H_5_6G 0xC0 #define LSM303DLH_H_8_1G 0xE0 /* Magnetic Sensor Operating Mode */ #define LSM303DLH_MAG_NORMAL_MODE 0x00 #define LSM303DLH_MAG_POS_BIAS 0x01 #define LSM303DLH_MAG_NEG_BIAS 0x02 #define LSM303DLH_MAG_CC_MODE 0x00 #define LSM303DLH_MAG_SC_MODE 0x01 #define LSM303DLH_MAG_SLEEP_MODE 0x03 /* Magnetometer output data rate */ #define LSM303DLH_MAG_ODR_75 0x00 /* 0.75Hz output data rate */ #define LSM303DLH_MAG_ODR1_5 0x04 /* 1.5Hz output data rate */ #define LSM303DLH_MAG_ODR3_0 0x08 /* 3Hz output data rate */ #define LSM303DLH_MAG_ODR7_5 0x09 /* 7.5Hz output data rate */ #define LSM303DLH_MAG_ODR15 0x10 /* 15Hz output data rate */ #define LSM303DLH_MAG_ODR30 0x14 /* 30Hz output data rate */ #define LSM303DLH_MAG_ODR75 0x18 /* 75Hz output data rate */ #ifdef __KERNEL__ struct lsm303dlh_acc_platform_data { int poll_interval; int min_interval; u8 g_range; u8 axis_map_x; u8 axis_map_y; u8 axis_map_z; u8 negate_x; u8 negate_y; u8 negate_z; int (*init)(void); void (*exit)(void); int (*power_on)(void); int (*power_off)(void); }; struct lsm303dlh_mag_platform_data { int poll_interval; int min_interval; u8 h_range; u8 axis_map_x; u8 axis_map_y; u8 axis_map_z; u8 negate_x; u8 negate_y; u8 negate_z; int (*init)(void); void (*exit)(void); int (*power_on)(void); int (*power_off)(void); }; #endif /* __KERNEL__ */ #endif /* __LSM303DLH_H__ */
/***************************************************************************** * * Copyright (C) 2010 Thomas Volkert <thomas@homer-conferencing.com> * * This software is free software. * Your are allowed to 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 source is published in the hope that it will be useful, but * WITHOUT ANY WARRANTY 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. Otherwise, you can write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. * Alternatively, you find an online version of the license text under * http://www.gnu.org/licenses/gpl-2.0.html. * *****************************************************************************/ /* * Purpose: Widget for displaying extended session information * Since: 2010-09-18 */ #ifndef _SESSION_INFO_WIDGET_ #define _SESSION_INFO_WIDGET_ #include <HBSocket.h> #include <QWidget> #include <QPoint> #include <ui_SessionInfoWidget.h> namespace Homer { namespace Gui { /////////////////////////////////////////////////////////////////////////////// class SessionInfoWidget : public QWidget, public Ui_SessionInfoWidget { Q_OBJECT; public: /// The default constructor SessionInfoWidget(QWidget* pParent = NULL); void Init(QString pParticipant, enum Homer::Base::TransportType pParticipantTransport, bool pVisible = true); /// The destructor. virtual ~SessionInfoWidget(); void SetVisible(bool pVisible); void SetSipInterface(QString pSipInterface = "unknown"); void InitializeMenuSessionInfoSettings(QMenu *pMenu); public slots: void ToggleVisibility(); void SelectedMenuSessionInfoSettings(QAction *pAction); private: virtual void closeEvent(QCloseEvent* pEvent); virtual void contextMenuEvent(QContextMenuEvent *pContextMenuEvent); virtual void timerEvent(QTimerEvent *pEvent); void initializeGUI(); void UpdateView(); QPoint mWinPos; QString mMessageHistory; QString mParticipant, mSipInterface; enum Homer::Base::TransportType mParticipantTransport; int mTimerId; }; /////////////////////////////////////////////////////////////////////////////// }} #endif
/* headers-check.c * * Test program to ensure all required headers are in the debian package, * by Laszio <ezerotven@gmail.com>. * * Wireshark - Network traffic analyzer * By Gerald Combs <gerald@wireshark.org> * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ #include <wireshark/config.h> #include <epan/stats_tree.h> #include <epan/packet.h> #include <epan/prefs.h>
// // EmulatorViewController.h // emulator // // Created by Karen Tsai (angelXwind) on 2014/3/5. // Copyright (c) 2014 Karen Tsai (angelXwind). All rights reserved. // #import <UIKit/UIKit.h> #import <GLKit/GLKit.h> @interface ViewController : GLKViewController @end
/* * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. * Copyright (C) 2004-2013 Red Hat, Inc. All rights reserved. * * This file is part of LVM2. * * This copyrighted material is made available to anyone wishing to use, * modify, copy, or redistribute it subject to the terms and conditions * of the GNU Lesser General Public License v.2.1. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "lib.h" #include "metadata.h" #include "import-export.h" #include "lvm-string.h" /* * Bitsets held in the 'status' flags get * converted into arrays of strings. */ struct flag { const uint64_t mask; const char *description; int kind; }; static const struct flag _vg_flags[] = { {EXPORTED_VG, "EXPORTED", STATUS_FLAG}, {RESIZEABLE_VG, "RESIZEABLE", STATUS_FLAG}, {PVMOVE, "PVMOVE", STATUS_FLAG}, {LVM_READ, "READ", STATUS_FLAG}, {LVM_WRITE, "WRITE", STATUS_FLAG}, {LVM_WRITE_LOCKED, "WRITE_LOCKED", COMPATIBLE_FLAG}, {CLUSTERED, "CLUSTERED", STATUS_FLAG}, {SHARED, "SHARED", STATUS_FLAG}, {PARTIAL_VG, NULL, 0}, {PRECOMMITTED, NULL, 0}, {ARCHIVED_VG, NULL, 0}, {0, NULL, 0} }; static const struct flag _pv_flags[] = { {ALLOCATABLE_PV, "ALLOCATABLE", STATUS_FLAG}, {EXPORTED_VG, "EXPORTED", STATUS_FLAG}, {MISSING_PV, "MISSING", COMPATIBLE_FLAG}, {UNLABELLED_PV, NULL, 0}, {0, NULL, 0} }; static const struct flag _lv_flags[] = { {LVM_READ, "READ", STATUS_FLAG}, {LVM_WRITE, "WRITE", STATUS_FLAG}, {LVM_WRITE_LOCKED, "WRITE_LOCKED", COMPATIBLE_FLAG}, {FIXED_MINOR, "FIXED_MINOR", STATUS_FLAG}, {VISIBLE_LV, "VISIBLE", STATUS_FLAG}, {PVMOVE, "PVMOVE", STATUS_FLAG}, {LOCKED, "LOCKED", STATUS_FLAG}, {LV_NOTSYNCED, "NOTSYNCED", STATUS_FLAG}, {LV_REBUILD, "REBUILD", STATUS_FLAG}, {LV_WRITEMOSTLY, "WRITEMOSTLY", STATUS_FLAG}, {LV_ACTIVATION_SKIP, "ACTIVATION_SKIP", COMPATIBLE_FLAG}, {LV_ERROR_WHEN_FULL, "ERROR_WHEN_FULL", COMPATIBLE_FLAG}, {LV_NOSCAN, NULL, 0}, {LV_TEMPORARY, NULL, 0}, {POOL_METADATA_SPARE, NULL, 0}, {LOCKD_SANLOCK_LV, NULL, 0}, {RAID, NULL, 0}, {RAID_META, NULL, 0}, {RAID_IMAGE, NULL, 0}, {MIRROR, NULL, 0}, {MIRROR_IMAGE, NULL, 0}, {MIRROR_LOG, NULL, 0}, {MIRRORED, NULL, 0}, {VIRTUAL, NULL, 0}, {SNAPSHOT, NULL, 0}, {MERGING, NULL, 0}, {CONVERTING, NULL, 0}, {PARTIAL_LV, NULL, 0}, {POSTORDER_FLAG, NULL, 0}, {VIRTUAL_ORIGIN, NULL, 0}, {REPLICATOR, NULL, 0}, {REPLICATOR_LOG, NULL, 0}, {THIN_VOLUME, NULL, 0}, {THIN_POOL, NULL, 0}, {THIN_POOL_DATA, NULL, 0}, {THIN_POOL_METADATA, NULL, 0}, {CACHE, NULL, 0}, {CACHE_POOL, NULL, 0}, {CACHE_POOL_DATA, NULL, 0}, {CACHE_POOL_METADATA, NULL, 0}, {LV_PENDING_DELETE, NULL, 0}, /* FIXME Display like COMPATIBLE_FLAG */ {LV_REMOVED, NULL, 0}, {0, NULL, 0} }; static const struct flag *_get_flags(int type) { switch (type & ~STATUS_FLAG) { case VG_FLAGS: return _vg_flags; case PV_FLAGS: return _pv_flags; case LV_FLAGS: return _lv_flags; } log_error("Unknown flag set requested."); return NULL; } /* * Converts a bitset to an array of string values, * using one of the tables defined at the top of * the file. */ int print_flags(uint64_t status, int type, char *buffer, size_t size) { int f, first = 1; const struct flag *flags; if (!(flags = _get_flags(type))) return_0; if (!emit_to_buffer(&buffer, &size, "[")) return 0; for (f = 0; flags[f].mask; f++) { if (status & flags[f].mask) { status &= ~flags[f].mask; if ((type & STATUS_FLAG) != flags[f].kind) continue; /* Internal-only flag? */ if (!flags[f].description) continue; if (!first) { if (!emit_to_buffer(&buffer, &size, ", ")) return 0; } else first = 0; if (!emit_to_buffer(&buffer, &size, "\"%s\"", flags[f].description)) return 0; } } if (!emit_to_buffer(&buffer, &size, "]")) return 0; if (status) log_warn(INTERNAL_ERROR "Metadata inconsistency: " "Not all flags successfully exported."); return 1; } int read_flags(uint64_t *status, int type, const struct dm_config_value *cv) { int f; uint64_t s = UINT64_C(0); const struct flag *flags; if (!(flags = _get_flags(type))) return_0; if (cv->type == DM_CFG_EMPTY_ARRAY) goto out; while (cv) { if (cv->type != DM_CFG_STRING) { log_error("Status value is not a string."); return 0; } for (f = 0; flags[f].description; f++) if (!strcmp(flags[f].description, cv->v.str)) { s |= flags[f].mask; break; } if (type == VG_FLAGS && !strcmp(cv->v.str, "PARTIAL")) { /* * Exception: We no longer write this flag out, but it * might be encountered in old backup files, so restore * it in that case. It is never part of live metadata * though, so only vgcfgrestore needs to be concerned * by this case. */ s |= PARTIAL_VG; } else if (!flags[f].description && (type & STATUS_FLAG)) { log_error("Unknown status flag '%s'.", cv->v.str); return 0; } cv = cv->next; } out: *status |= s; return 1; }
/* * key derivation routines * * Copyright (C) 2014-2016 LastPass. * * 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. * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU General Public License in all respects * for all of the code used other than OpenSSL. If you modify * file(s) with this exception, you may extend this exception to your * version of the file(s), but you are not obligated to do so. If you * do not wish to do so, delete this exception statement from your * version. If you delete this exception statement from all source * files in the program, then also delete it here. * * See LICENSE.OpenSSL for more details regarding this exception. */ #include "kdf.h" #include "util.h" #include <string.h> #include <sys/mman.h> #include <openssl/evp.h> #include <openssl/sha.h> #include <openssl/opensslv.h> #if defined(__APPLE__) && defined(__MACH__) #include <CommonCrypto/CommonCryptor.h> #include <CommonCrypto/CommonKeyDerivation.h> static void pbkdf2_hash(const char *username, size_t username_len, const char *password, size_t password_len, int iterations, unsigned char hash[KDF_HASH_LEN]) { if (CCKeyDerivationPBKDF(kCCPBKDF2, password, password_len, (const uint8_t *)username, username_len, kCCPRFHmacAlgSHA256, iterations, hash, KDF_HASH_LEN) == kCCParamError) die("Failed to compute PBKDF2 for %s", username); } #else #include "pbkdf2.h" static void pbkdf2_hash(const char *username, size_t username_len, const char *password, size_t password_len, int iterations, unsigned char hash[KDF_HASH_LEN]) { if (!PKCS5_PBKDF2_HMAC(password, password_len, (const unsigned char *)username, username_len, iterations, EVP_sha256(), KDF_HASH_LEN, hash)) die("Failed to compute PBKDF2 for %s", username); } #endif static void sha256_hash(const char *username, size_t username_len, const char *password, size_t password_len, unsigned char hash[KDF_HASH_LEN]) { SHA256_CTX sha256; if (!SHA256_Init(&sha256)) goto die; if (!SHA256_Update(&sha256, username, username_len)) goto die; if (!SHA256_Update(&sha256, password, password_len)) goto die; if (!SHA256_Final(hash, &sha256)) goto die; return; die: die("Failed to compute SHA256 for %s", username); } void kdf_login_key(const char *username, const char *password, int iterations, char hex[KDF_HEX_LEN]) { unsigned char hash[KDF_HASH_LEN]; size_t password_len; _cleanup_free_ char *user_lower = xstrlower(username); password_len = strlen(password); if (iterations < 1) iterations = 1; if (iterations == 1) { sha256_hash(user_lower, strlen(user_lower), password, password_len, hash); bytes_to_hex(hash, &hex, KDF_HASH_LEN); sha256_hash(hex, KDF_HEX_LEN - 1, password, password_len, hash); } else { pbkdf2_hash(user_lower, strlen(user_lower), password, password_len, iterations, hash); pbkdf2_hash(password, password_len, (char *)hash, KDF_HASH_LEN, 1, hash); } bytes_to_hex(hash, &hex, KDF_HASH_LEN); mlock(hex, KDF_HEX_LEN); } void kdf_decryption_key(const char *username, const char *password, int iterations, unsigned char hash[KDF_HASH_LEN]) { _cleanup_free_ char *user_lower = xstrlower(username); if (iterations < 1) iterations = 1; if (iterations == 1) sha256_hash(user_lower, strlen(user_lower), password, strlen(password), hash); else pbkdf2_hash(user_lower, strlen(user_lower), password, strlen(password), iterations, hash); mlock(hash, KDF_HASH_LEN); }
/* * spawn.h - Lua configuration management header * * Copyright © 2009 Julien Danjou <julien@danjou.info> * * 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 AWESOME_SPAWN_H #define AWESOME_SPAWN_H #include "objects/client.h" #include <lua.h> void spawn_init(void); void spawn_handle_reap(const char *); char * const * spawn_transform_commandline(char **); void spawn_start_notify(client_t *, const char *); int luaA_spawn(lua_State *); #endif // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
/* Copyright 2020 Ananya Kirti This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include "config_common.h" /* USB Device descriptor parameter */ #define VENDOR_ID 0x416B #define PRODUCT_ID 0x0001 #define DEVICE_VER 0x0011 #define MANUFACTURER Desiboards #define PRODUCT hp69 /* key matrix size */ #define MATRIX_ROWS 5 #define MATRIX_COLS 15 /* * Keyboard Matrix Assignments * * Change this to how you wired your keyboard * COLS: AVR pins used for columns, left to right * ROWS: AVR pins used for rows, top to bottom * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) * */ #define MATRIX_ROW_PINS { B3, B7, A10, B9 ,A9} #define MATRIX_COL_PINS { B12, B15, B10, B13, B14, B11, B8, A0, A1, B5, B0, B2, B6, B1, B4} #define DIODE_DIRECTION COL2ROW #define RGB_DI_PIN A3 #define RGBLED_NUM 20 #define RGBLIGHT_ANIMATIONS #define A4_AUDIO #define A5_AUDIO
/********************************************************************** ** ** Definition of QGPluginManager class ** ** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. ** ** This file is part of the tools module of the Qt GUI Toolkit. ** ** This file may be used under the terms of the GNU General ** Public License versions 2.0 or 3.0 as published by the Free ** Software Foundation and appearing in the files LICENSE.GPL2 ** and LICENSE.GPL3 included in the packaging of this file. ** Alternatively you may (at your option) use any later version ** of the GNU General Public License if such license has been ** publicly approved by Trolltech ASA (or its successors, if any) ** and the KDE Free Qt Foundation. ** ** Please review the following information to ensure GNU General ** Public Licensing requirements will be met: ** http://trolltech.com/products/qt/licenses/licensing/opensource/. ** If you are unsure which license is appropriate for your use, please ** review the following information: ** http://trolltech.com/products/qt/licenses/licensing/licensingoverview ** or contact the sales department at sales@trolltech.com. ** ** This file may be used under the terms of the Q Public License as ** defined by Trolltech ASA and appearing in the file LICENSE.QPL ** included in the packaging of this file. Licensees holding valid Qt ** Commercial licenses may use this file in accordance with the Qt ** Commercial License Agreement provided with the Software. ** ** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, ** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted ** herein. ** **********************************************************************/ #ifndef QGPLUGINMANAGER_P_H #define QGPLUGINMANAGER_P_H #ifndef QT_H #include "qdict.h" #include "qlibrary.h" #include "quuid.h" #include "qstringlist.h" #include "qcom_p.h" #endif // QT_H // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists for the convenience // of a number of Qt sources files. This header file may change from // version to version without notice, or even be removed. // // We mean it. // // #ifndef QT_NO_COMPONENT #if defined(Q_TEMPLATEDLL) // MOC_SKIP_BEGIN //Q_TEMPLATE_EXTERN template class Q_EXPORT QDict<QLibrary>; // MOC_SKIP_END #endif class Q_EXPORT QGPluginManager { public: QGPluginManager( const QUuid& id, const QStringList& paths = QString::null, const QString &suffix = QString::null, bool cs = TRUE ); ~QGPluginManager(); void addLibraryPath( const QString& path ); const QLibrary* library( const QString& feature ) const; QStringList featureList() const; bool autoUnload() const; void setAutoUnload( bool ); protected: bool enabled() const; bool addLibrary( QLibrary* plugin ); QRESULT queryUnknownInterface(const QString& feature, QUnknownInterface** iface) const; QUuid interfaceId; QDict<QLibrary> plugDict; // Dict to match feature with library QDict<QLibrary> libDict; // Dict to match library file with library QStringList libList; uint casesens : 1; uint autounload : 1; }; inline void QGPluginManager::setAutoUnload( bool unload ) { autounload = unload; } inline bool QGPluginManager::autoUnload() const { return autounload; } #endif #endif //QGPLUGINMANAGER_P_H
struct foo {int a;}; typedef struct blah {int a;} name; typedef struct {int a;} xxx;
/* * * This file is part of the FFTlib library. This library is free * software; you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software * Foundation; version 2 of the License. * * 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; 675 Mass Ave, Cambridge, MA 02139, USA. */ /* * * $Id: gfft_shuffle_64_cplx.c,v 1.1 1999/05/06 14:09:55 decoster Exp $ * */ # include <gfft.h> void gfft_shuffle_64_cplx(complex *in) { register real tmp_real; register real tmp_imag; tmp_real = in[1].real; tmp_imag = in[1].imag; in[1].real = in[32].real; in[1].imag = in[32].imag; in[32].real = tmp_real; in[32].imag = tmp_imag; tmp_real = in[2].real; tmp_imag = in[2].imag; in[2].real = in[16].real; in[2].imag = in[16].imag; in[16].real = tmp_real; in[16].imag = tmp_imag; tmp_real = in[3].real; tmp_imag = in[3].imag; in[3].real = in[48].real; in[3].imag = in[48].imag; in[48].real = tmp_real; in[48].imag = tmp_imag; tmp_real = in[4].real; tmp_imag = in[4].imag; in[4].real = in[8].real; in[4].imag = in[8].imag; in[8].real = tmp_real; in[8].imag = tmp_imag; tmp_real = in[5].real; tmp_imag = in[5].imag; in[5].real = in[40].real; in[5].imag = in[40].imag; in[40].real = tmp_real; in[40].imag = tmp_imag; tmp_real = in[6].real; tmp_imag = in[6].imag; in[6].real = in[24].real; in[6].imag = in[24].imag; in[24].real = tmp_real; in[24].imag = tmp_imag; tmp_real = in[7].real; tmp_imag = in[7].imag; in[7].real = in[56].real; in[7].imag = in[56].imag; in[56].real = tmp_real; in[56].imag = tmp_imag; tmp_real = in[9].real; tmp_imag = in[9].imag; in[9].real = in[36].real; in[9].imag = in[36].imag; in[36].real = tmp_real; in[36].imag = tmp_imag; tmp_real = in[10].real; tmp_imag = in[10].imag; in[10].real = in[20].real; in[10].imag = in[20].imag; in[20].real = tmp_real; in[20].imag = tmp_imag; tmp_real = in[11].real; tmp_imag = in[11].imag; in[11].real = in[52].real; in[11].imag = in[52].imag; in[52].real = tmp_real; in[52].imag = tmp_imag; tmp_real = in[13].real; tmp_imag = in[13].imag; in[13].real = in[44].real; in[13].imag = in[44].imag; in[44].real = tmp_real; in[44].imag = tmp_imag; tmp_real = in[14].real; tmp_imag = in[14].imag; in[14].real = in[28].real; in[14].imag = in[28].imag; in[28].real = tmp_real; in[28].imag = tmp_imag; tmp_real = in[15].real; tmp_imag = in[15].imag; in[15].real = in[60].real; in[15].imag = in[60].imag; in[60].real = tmp_real; in[60].imag = tmp_imag; tmp_real = in[17].real; tmp_imag = in[17].imag; in[17].real = in[34].real; in[17].imag = in[34].imag; in[34].real = tmp_real; in[34].imag = tmp_imag; tmp_real = in[19].real; tmp_imag = in[19].imag; in[19].real = in[50].real; in[19].imag = in[50].imag; in[50].real = tmp_real; in[50].imag = tmp_imag; tmp_real = in[21].real; tmp_imag = in[21].imag; in[21].real = in[42].real; in[21].imag = in[42].imag; in[42].real = tmp_real; in[42].imag = tmp_imag; tmp_real = in[22].real; tmp_imag = in[22].imag; in[22].real = in[26].real; in[22].imag = in[26].imag; in[26].real = tmp_real; in[26].imag = tmp_imag; tmp_real = in[23].real; tmp_imag = in[23].imag; in[23].real = in[58].real; in[23].imag = in[58].imag; in[58].real = tmp_real; in[58].imag = tmp_imag; tmp_real = in[25].real; tmp_imag = in[25].imag; in[25].real = in[38].real; in[25].imag = in[38].imag; in[38].real = tmp_real; in[38].imag = tmp_imag; tmp_real = in[27].real; tmp_imag = in[27].imag; in[27].real = in[54].real; in[27].imag = in[54].imag; in[54].real = tmp_real; in[54].imag = tmp_imag; tmp_real = in[29].real; tmp_imag = in[29].imag; in[29].real = in[46].real; in[29].imag = in[46].imag; in[46].real = tmp_real; in[46].imag = tmp_imag; tmp_real = in[31].real; tmp_imag = in[31].imag; in[31].real = in[62].real; in[31].imag = in[62].imag; in[62].real = tmp_real; in[62].imag = tmp_imag; tmp_real = in[35].real; tmp_imag = in[35].imag; in[35].real = in[49].real; in[35].imag = in[49].imag; in[49].real = tmp_real; in[49].imag = tmp_imag; tmp_real = in[37].real; tmp_imag = in[37].imag; in[37].real = in[41].real; in[37].imag = in[41].imag; in[41].real = tmp_real; in[41].imag = tmp_imag; tmp_real = in[39].real; tmp_imag = in[39].imag; in[39].real = in[57].real; in[39].imag = in[57].imag; in[57].real = tmp_real; in[57].imag = tmp_imag; tmp_real = in[43].real; tmp_imag = in[43].imag; in[43].real = in[53].real; in[43].imag = in[53].imag; in[53].real = tmp_real; in[53].imag = tmp_imag; tmp_real = in[47].real; tmp_imag = in[47].imag; in[47].real = in[61].real; in[47].imag = in[61].imag; in[61].real = tmp_real; in[61].imag = tmp_imag; tmp_real = in[55].real; tmp_imag = in[55].imag; in[55].real = in[59].real; in[55].imag = in[59].imag; in[59].real = tmp_real; in[59].imag = tmp_imag; }
/** * Represents the data on a 2D plot as a set of (x,y) values connected * by a line. */ #pragma once #include "Plot2D.h" #include <qwt_plot_curve.h> #include <QString> #include <memory> namespace Carta { namespace Lib { namespace PixelPipeline { class CustomizablePixelPipeline; } } } class QPainter; namespace Carta { namespace Plot2D { class Plot2DProfile : public Plot2D, public QwtPlotCurve { public: /** * Constructor. */ Plot2DProfile(); /** * Attach the data to the plot. * @param plot - the plot on which the data should be drawn. */ virtual void attachToPlot( QwtPlot* plot ) Q_DECL_OVERRIDE; /** * Remove the data from the plot. * @param plot - the plot where the data should be removed. */ virtual void detachFromPlot() Q_DECL_OVERRIDE; /** * Return a custom icon to use for the legend item. * @param index - unused. * @param size - the size of the icon. * @return - a custom icon for the legend item. */ virtual QwtGraphic legendIcon( int index, const QSizeF& size ) const; /** * Set the base y-vale for the plot. * @param val - the baseline for the plot. */ virtual void setBaseLine( double val ) Q_DECL_OVERRIDE; /** * Store the data to be plotted. * @param data the plot data. */ virtual void setData ( std::vector<std::pair<double,double> > data ) Q_DECL_OVERRIDE; /** * Set the draw style for the data (continuous, step, etc). * @param style - an identifier for a draw style. */ virtual void setDrawStyle( const QString& style ); /** * Set an identifier for this data set. * @param id - an identifier for this data set. */ virtual void setId( const QString& id ); /** * Set whether or not to display a sample line with the legend item. * @param showLegendLine - true to display a sample line; false, otherwise. */ virtual void setLegendLine( bool showLegendLine ) Q_DECL_OVERRIDE; /** * Destructor. */ virtual ~Plot2DProfile(); protected: virtual void drawLines (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const; virtual void drawSteps (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const; //This method was put in so that profiles consisting of a single point could be drawn. void drawSymbol( QPainter* painter, const QwtScaleMap & xMap, const QwtScaleMap & yMap, const QRectF & canvasRect, int from, int to ) const; private: std::vector<double> m_datasX; std::vector<double> m_datasY; Plot2DProfile( const Plot2DProfile& other); Plot2DProfile& operator=( const Plot2DProfile& other ); }; } }
/*************************************************************************** qgsproviderguimetadata.h ------------------- begin : June 4th 2019 copyright : (C) 2019 by Peter Petrik email : zilolv at gmail dot com ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef QGSPROVIDERGUIMETADATA_H #define QGSPROVIDERGUIMETADATA_H #include <QList> #include <QMainWindow> #include "qgis_gui.h" #include "qgis_sip.h" class QgsDataItemGuiProvider; class QgsSourceSelectProvider; class QgsProjectStorageGuiProvider; class QgsSubsetStringEditorProvider; class QgsProviderSourceWidgetProvider; /** * \ingroup gui * \brief Holds data for GUI part of the data providers * * \since QGIS 3.10 */ class GUI_EXPORT QgsProviderGuiMetadata { public: /** * Constructor for provider gui metadata */ explicit QgsProviderGuiMetadata( const QString &key ); virtual ~QgsProviderGuiMetadata(); /** * Called during GUI initialization - allows provider to do its internal initialization * of GUI components, possibly making use of the passed pointer to the QGIS main window. */ virtual void registerGui( QMainWindow *widget ); /** * Returns data item gui providers * \note Ownership of created data item gui providers is passed to the caller. */ virtual QList<QgsDataItemGuiProvider *> dataItemGuiProviders() SIP_FACTORY; /** * Returns project storage gui providers * \note Ownership of created project storage gui providers is passed to the caller. */ virtual QList<QgsProjectStorageGuiProvider *> projectStorageGuiProviders() SIP_FACTORY; /** * Returns source select providers * \note Ownership of created source select providers is passed to the caller. */ virtual QList<QgsSourceSelectProvider *> sourceSelectProviders() SIP_FACTORY; /** * Returns subset string editor providers * \note Ownership of created providers is passed to the caller. * \since QGIS 3.18 */ virtual QList<QgsSubsetStringEditorProvider *> subsetStringEditorProviders() SIP_FACTORY; /** * Returns source widget providers * \note Ownership of created providers is passed to the caller. * \since QGIS 3.18 */ virtual QList<QgsProviderSourceWidgetProvider *> sourceWidgetProviders() SIP_FACTORY; //! Returns unique provider key QString key() const; private: //! unique key for data provider QString mKey; }; #endif //QGSPROVIDERGUIMETADATA_H
/** ****************************************************************************** * @file I2C/I2C_TwoBoards_ComIT/Inc/stm32f4xx_it.h * @author MCD Application Team * @version V1.0.1 * @date 26-February-2014 * @brief This file contains the headers of the interrupt handlers. ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2> * * 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 STMicroelectronics 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 to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F4xx_IT_H #define __STM32F4xx_IT_H #ifdef __cplusplus extern "C" { #endif /* Includes ------------------------------------------------------------------*/ #include "main.h" /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ void NMI_Handler(void); void HardFault_Handler(void); void MemManage_Handler(void); void BusFault_Handler(void); void UsageFault_Handler(void); void SVC_Handler(void); void DebugMon_Handler(void); void PendSV_Handler(void); void SysTick_Handler(void); void I2Cx_EV_IRQHandler(void); void I2Cx_ER_IRQHandler(void); #ifdef __cplusplus } #endif #endif /* __STM32F4xx_IT_H */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
#ifndef QFSOSTRINGMAP_H #define QFSOSTRINGMAP_H #include <QtDBus> typedef QMap<QString, QString> QFsoStringMap; Q_DECLARE_METATYPE(QFsoStringMap) #endif // QFSOSTRINGMAP_H
/******************************************************************** * gnc-slots-sql.h: load and save data to SQL * * * * 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, contact: * * * * Free Software Foundation Voice: +1-617-542-5942 * * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 * * Boston, MA 02110-1301, USA gnu@gnu.org * \********************************************************************/ /** @file gnc-slots-sql.h * @brief load and save accounts data to SQL * @author Copyright (c) 2006-2008 Phil Longstaff <plongstaff@rogers.com> * * This file implements the top-level QofBackend API for saving/ * restoring data to/from an SQL database */ #ifndef GNC_SLOTS_SQL_H #define GNC_SLOTS_SQL_H #ifdef __cplusplus extern "C" { #endif #include <glib.h> #include "guid.h" #include "qof.h" #include "gnc-backend-sql.h" /** * gnc_sql_slots_save - Saves slots for an object to the db. * * @param be SQL backend * @param guid Object guid * @param is_infant Is this an infant object? * @param inst The QodInstance owning the slots. * @return TRUE if successful, FALSE if error */ gboolean gnc_sql_slots_save( GncSqlBackend* be, const GncGUID* guid, gboolean is_infant, QofInstance *inst ); /** * gnc_sql_slots_delete - Deletes slots for an object from the db. * * @param be SQL backend * @param guid Object guid * @return TRUE if successful, FALSE if error */ gboolean gnc_sql_slots_delete( GncSqlBackend* be, const GncGUID* guid ); /** Loads slots for an object from the db. * * @param be SQL backend */ void gnc_sql_slots_load( GncSqlBackend* be, QofInstance* inst ); /** * gnc_sql_slots_load_for_list - Loads slots for a list of objects from the db. * Loading slots for a list of objects can be faster than loading for one object * at a time because fewer SQL queries are used. * * @param be SQL backend * @param list List of objects */ void gnc_sql_slots_load_for_list( GncSqlBackend* be, GList* list ); typedef QofInstance* (*BookLookupFn)( const GncGUID* guid, const QofBook* book ); /** * gnc_sql_slots_load_for_sql_subquery - Loads slots for all objects whose guid is * supplied by a subquery. The subquery should be of the form "SELECT DISTINCT guid FROM ...". * This is faster than loading for one object at a time because fewer SQL queries * are used. * * @param be SQL backend * @param subquery Subquery SQL string * @param lookup_fn Lookup function to get the right object from the book */ void gnc_sql_slots_load_for_sql_subquery( GncSqlBackend* be, const gchar* subquery, BookLookupFn lookup_fn ); void gnc_sql_init_slots_handler( void ); #ifdef __cplusplus } #endif #endif /* GNC_SLOTS_SQL_H */
/* capture_dlg.h * Definitions for the "Capture Options" dialog and dialog windows popped * up from it * * $Id: capture_dlg.h 46780 2012-12-26 12:24:55Z guy $ * * Wireshark - Network traffic analyzer * By Gerald Combs <gerald@wireshark.org> * Copyright 1998 Gerald Combs * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef __CAPTURE_DLG_H__ #define __CAPTURE_DLG_H__ /* extern GtkWidget* wireless_tb; */ /** @file * "Capture Options" dialog box. * @ingroup dialog_group */ #include "capture_opts.h" #include <gtk/gtk.h> #define CR_MAIN_NB "compile_results_main_notebook" /** Initialize background capture filter syntax checking */ void capture_filter_init(void); /** User requested the "Capture Options" dialog box by menu or toolbar. * * @param widget parent widget (unused) * @param data unused */ void capture_prep_cb(GtkWidget *widget, gpointer data); /** User requested capture start by menu or toolbar. * * @param widget parent widget (unused) * @param data unused */ void capture_start_cb(GtkWidget *widget, gpointer data); /** User requested capture stop by menu or toolbar. * * @param widget parent widget (unused) * @param data unused */ void capture_stop_cb(GtkWidget *widget, gpointer data); /** User requested capture restart by menu or toolbar. * * @param widget parent widget (unused) * @param data unused */ void capture_restart_cb(GtkWidget *widget, gpointer data); /** User requested the "Capture Airpcap" dialog box by menu or toolbar. * * @param widget parent widget (unused) * @param data unused */ void capture_air_cb(GtkWidget *widget, gpointer data); #ifdef HAVE_PCAP_REMOTE struct remote_host { gchar *remote_host; /**< Host name or network address for remote capturing */ gchar *remote_port; /**< TCP port of remote RPCAP server */ gint auth_type; /**< Authentication type */ gchar *auth_username; /**< Remote authentication parameters */ gchar *auth_password; /**< Remote authentication parameters */ }; #endif gboolean capture_dlg_window_present(void); void enable_selected_interface(gchar *name, gboolean selected); void options_interface_cb(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColumn *column _U_, gpointer userdata); void capture_dlg_refresh_if(void); void update_visible_columns_menu (void); void update_visible_tree_view_columns(void); /* * Refresh everything visible that shows an interface list that * includes local interfaces. */ extern void refresh_local_interface_lists(void); /* * Refresh everything visible that shows an interface list that * includes non-local interfaces. */ extern void refresh_non_local_interface_lists(void); #endif /* capture_dlg.h */
/* ScummVM - Graphic Adventure Engine * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT * file distributed with this source distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ #ifndef AGS_ENGINE_AC_DYNOBJ_CC_AUDIOCHANNEL_H #define AGS_ENGINE_AC_DYNOBJ_CC_AUDIOCHANNEL_H #include "ags/engine/ac/dynobj/cc_agsdynamicobject.h" namespace AGS3 { struct CCAudioChannel final : AGSCCDynamicObject { const char *GetType() override; int Serialize(const char *address, char *buffer, int bufsize) override; void Unserialize(int index, const char *serializedData, int dataSize) override; }; } // namespace AGS3 #endif
/* Aseprite * Copyright (C) 2001-2013 David Capello * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include <windows.h> typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS)(HANDLE, PBOOL); static LPFN_ISWOW64PROCESS fnIsWow64Process = NULL; BOOL IsWow64() { BOOL isWow64 = FALSE; fnIsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress(GetModuleHandle(L"kernel32"), "IsWow64Process"); if (fnIsWow64Process != NULL) fnIsWow64Process(GetCurrentProcess(), &isWow64); return isWow64; }
/* Unix SMB/CIFS implementation. RPC pipe client Copyright (C) Tim Potter 2003 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Stupid dummy functions required due to the horrible dependency mess in Samba. */ void become_root(void) { return; } void unbecome_root(void) { return; }
/* This file is part of the Calligra project * Copyright (C) 2005 Thomas Zander <zander@kde.org> * Copyright (C) 2005 C. Boemann <cbo@boemann.dk> * * 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 KIS_IMAGE_FROM_CLIPBOARD_WIDGET_H #define KIS_IMAGE_FROM_CLIPBOARD_WIDGET_H #include "kis_global.h" #include "KoUnit.h" #include "kis_properties_configuration.h" #include "kis_custom_image_widget.h" class KisDoc2; class KoID; /** * The 'New image from clipboard' widget in the Krita startup widget. * This class is an exstension of the KisCustomImageWidget("Custom document" widget" */ class KisImageFromClipboard : public KisCustomImageWidget { Q_OBJECT public: /** * Constructor. Please note that this class is being used/created by KisDoc. * @param parent the parent widget * @param doc the document that wants to be altered */ KisImageFromClipboard(QWidget *parent, KisDoc2 *doc, qint32 defWidth, qint32 defHeight, double resolution, const QString & defColorModel, const QString & defColorDepth, const QString & defColorProfile, const QString & imageName); virtual ~KisImageFromClipboard(); private slots: void createImage(); void clipboardDataChanged(); private: void createClipboardPreview(); }; #endif
#ifndef WXRC_H #define WXRC_H #include <wx/cmdline.h> #include <wx/ffile.h> #include <wx/filename.h> #include <wx/hashset.h> #include <wx/mimetype.h> #include <wx/utils.h> #include <wx/vector.h> #include <wx/wfstream.h> #include <wx/xml/xml.h> WX_DECLARE_HASH_SET(wxString, ::wxStringHash, ::wxStringEqual, StringSet); class XRCWidgetData { public: XRCWidgetData(const wxString& vname, const wxString& vclass) : m_class(vclass) , m_name(vname) { } const wxString& GetName() const { return m_name; } const wxString& GetClass() const { return m_class; } private: wxString m_class; wxString m_name; }; WX_DECLARE_OBJARRAY(XRCWidgetData, ArrayOfXRCWidgetData); struct ExtractedString { ExtractedString() : lineNo(-1) { } ExtractedString(const wxString& str_, const wxString& filename_, int lineNo_) : str(str_) , filename(filename_) , lineNo(lineNo_) { } wxString str; wxString filename; int lineNo; }; typedef wxVector<ExtractedString> ExtractedStrings; class XRCWndClassData { private: wxString m_className; wxString m_parentClassName; StringSet m_ancestorClassNames; ArrayOfXRCWidgetData m_wdata; void BrowseXmlNode(wxXmlNode* node) { wxString classValue; wxString nameValue; wxXmlNode* children; while(node) { if(node->GetName() == wxT("object") && node->GetAttribute(wxT("class"), &classValue) && node->GetAttribute(wxT("name"), &nameValue)) { m_wdata.Add(XRCWidgetData(nameValue, classValue)); } children = node->GetChildren(); if(children) BrowseXmlNode(children); node = node->GetNext(); } } public: XRCWndClassData(const wxString& className, const wxString& parentClassName, const wxXmlNode* node) : m_className(className) , m_parentClassName(parentClassName) { if(className == wxT("wxMenu")) { m_ancestorClassNames.insert(wxT("wxMenu")); m_ancestorClassNames.insert(wxT("wxMenuBar")); } else if(className == wxT("wxMDIChildFrame")) { m_ancestorClassNames.insert(wxT("wxMDIParentFrame")); } else if(className == wxT("wxMenuBar") || className == wxT("wxStatusBar") || className == wxT("wxToolBar")) { m_ancestorClassNames.insert(wxT("wxFrame")); } else { m_ancestorClassNames.insert(wxT("wxWindow")); } BrowseXmlNode(node->GetChildren()); } const ArrayOfXRCWidgetData& GetWidgetData() { return m_wdata; } bool CanBeUsedWithXRCCTRL(const wxString& name) { if(name == wxT("tool") || name == wxT("data") || name == wxT("unknown") || name == wxT("notebookpage") || name == wxT("separator") || name == wxT("sizeritem") || name == wxT("wxMenu") || name == wxT("wxMenuBar") || name == wxT("wxMenuItem") || name.EndsWith(wxT("Sizer"))) { return false; } return true; } void GenerateHeaderCode(wxFFile& file) { file.Write(wxT("class ") + m_className + wxT(" : public ") + m_parentClassName + wxT(" {\nprotected:\n")); size_t i; for(i = 0; i < m_wdata.GetCount(); ++i) { const XRCWidgetData& w = m_wdata.Item(i); if(!CanBeUsedWithXRCCTRL(w.GetClass())) continue; if(w.GetName().empty()) continue; file.Write(wxT(" ") + w.GetClass() + wxT("* ") + w.GetName() + wxT(";\n")); } file.Write(wxT("\nprivate:\n void InitWidgetsFromXRC(wxWindow *parent){\n") wxT(" wxXmlResource::Get()->LoadObject(this,parent,wxT(\"") + m_className + wxT("\"), wxT(\"") + m_parentClassName + wxT("\"));\n")); for(i = 0; i < m_wdata.GetCount(); ++i) { const XRCWidgetData& w = m_wdata.Item(i); if(!CanBeUsedWithXRCCTRL(w.GetClass())) continue; if(w.GetName().empty()) continue; file.Write(wxT(" ") + w.GetName() + wxT(" = XRCCTRL(*this,\"") + w.GetName() + wxT("\",") + w.GetClass() + wxT(");\n")); } file.Write(wxT(" }\n")); file.Write(wxT("public:\n")); if(m_ancestorClassNames.size() == 1) { file.Write(m_className + wxT("(") + *m_ancestorClassNames.begin() + wxT(" *parent=NULL){\n") + wxT(" InitWidgetsFromXRC((wxWindow *)parent);\n") wxT(" }\n") wxT("};\n")); } else { file.Write(m_className + wxT("(){\n") + wxT(" InitWidgetsFromXRC(NULL);\n") wxT(" }\n") wxT("};\n")); for(StringSet::const_iterator it = m_ancestorClassNames.begin(); it != m_ancestorClassNames.end(); ++it) { file.Write(m_className + wxT("(") + *it + wxT(" *parent){\n") + wxT(" InitWidgetsFromXRC((wxWindow *)parent);\n") wxT(" }\n") wxT("};\n")); } } } }; WX_DECLARE_OBJARRAY(XRCWndClassData, ArrayOfXRCWndClassData); class wxcXmlResourceCmp { wxString m_outputCppFile; wxString m_functionName; wxString m_xrcFile; int m_retCode; wxString m_outputPath; public: // don't use builtin cmd line parsing: virtual bool OnInit() { return true; } virtual int Run(const wxString& inXrcFile, const wxString& outputCppFile, const wxString& functionName); private: void CompileRes(); wxArrayString PrepareTempFiles(); void FindFilesInXML(wxXmlNode* node, wxArrayString& flist, const wxString& inputPath); wxString GetInternalFileName(const wxString& name, const wxArrayString& flist); void DeleteTempFiles(const wxArrayString& flist); void MakePackageCPP(const wxArrayString& flist); void MakePackagePython(const wxArrayString& flist); void OutputGettext(); ExtractedStrings FindStrings(); ExtractedStrings FindStrings(const wxString& filename, wxXmlNode* node); ArrayOfXRCWndClassData aXRCWndClassData; void GenCPPHeader(); }; #endif
/* * Routines for handling tunneling (sit, ipip, gre) device settings * * Copyright (C) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, see <http://www.gnu.org/licenses/> or write * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * * Authors: * Karol Mroz <kmroz@suse.com> */ #ifndef __WICKED_TUNNELING_H__ #define __WICKED_TUNNELING_H__ #include <wicked/types.h> /* Generic tunnel struct. * ttl, tos and pmtudisc are u8 from netlink, but stored as u16 and boolean * for better dbus output formatting. */ struct ni_tunnel { uint16_t ttl; uint16_t tos; ni_bool_t pmtudisc; uint16_t iflags; }; struct ni_sit { ni_tunnel_t tunnel; ni_bool_t isatap; }; /* ttl, tos and pmtudisc are u8 from netlink, but stored as u16 and boolean * for better dbus output formatting. */ struct ni_ipip { ni_tunnel_t tunnel; }; enum { /* bit number flags */ NI_GRE_FLAG_IKEY, NI_GRE_FLAG_OKEY, NI_GRE_FLAG_ISEQ, NI_GRE_FLAG_OSEQ, NI_GRE_FLAG_ICSUM, NI_GRE_FLAG_OCSUM, }; enum { NI_GRE_ENCAP_TYPE_NONE, NI_GRE_ENCAP_TYPE_FOU, NI_GRE_ENCAP_TYPE_GUE, }; enum { /* bit number flags */ NI_GRE_ENCAP_FLAG_CSUM, NI_GRE_ENCAP_FLAG_CSUM6, NI_GRE_ENCAP_FLAG_REMCSUM, }; /* ttl, tos and pmtudisc are u8 from netlink, but stored as u16 and boolean * for better dbus output formatting. */ struct ni_gre { ni_tunnel_t tunnel; uint16_t flags; struct in_addr ikey; struct in_addr okey; struct { uint16_t type; uint16_t flags; uint16_t sport; uint16_t dport; } encap; }; extern ni_sit_t * ni_sit_new(void); extern void ni_sit_free(ni_sit_t *); extern const char * ni_sit_validate(const ni_sit_t *); extern ni_ipip_t * ni_ipip_new(void); extern void ni_ipip_free(ni_ipip_t *); extern const char * ni_ipip_validate(const ni_ipip_t *); extern ni_gre_t * ni_gre_new(void); extern void ni_gre_free(ni_gre_t *); extern const char * ni_gre_validate(const ni_gre_t *); extern const char * ni_gre_flag_bit_to_name(unsigned int); extern ni_bool_t ni_gre_flag_name_to_bit(const char *, unsigned int *); extern const char * ni_gre_encap_type_to_name(unsigned int); extern ni_bool_t ni_gre_encap_name_to_type(const char *, unsigned int *); extern const char * ni_gre_encap_flag_bit_to_name(unsigned int); extern ni_bool_t ni_gre_encap_flag_name_to_bit(const char *, unsigned int *); #endif /* __WICKED_TUNNELING_H__ */
/* sna-utils.h * Definitions for SNA dissection. * * $Id$ * * 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 __SNA_UTILS__ #define __SNA_UTILS__ #include <glib.h> #include <stdio.h> /* * Structure used to represent an FID Type 4 address; gives the layout of the * data pointed to by an AT_SNA "address" structure if the size is * SNA_FID_TYPE_4_ADDR_LEN. */ #define SNA_FID_TYPE_4_ADDR_LEN 6 struct sna_fid_type_4_addr { guint32 saf; guint16 ef; }; extern gchar *sna_fid_to_str(const address *addr); extern void sna_fid_to_str_buf(const address *addr, gchar *buf, int buf_len); #endif
#include <element.h> int update_PLUT(UPDATE_FUNC_ARGS) { if (1>rand()%100 && ((int)(5.0f*pv[y/CELL][x/CELL]))>(rand()%1000)) { create_part(i, x, y, PT_NEUT); } return 0; }
// clang-format off /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- Contributing author: W. Michael Brown (Intel) ------------------------------------------------------------------------- */ #ifdef PAIR_CLASS // clang-format off PairStyle(gayberne/intel,PairGayBerneIntel); // clang-format on #else #ifndef LMP_PAIR_GAYBERNE_INTEL_H #define LMP_PAIR_GAYBERNE_INTEL_H #include "fix_intel.h" #include "pair_gayberne.h" namespace LAMMPS_NS { class PairGayBerneIntel : public PairGayBerne { public: PairGayBerneIntel(class LAMMPS *); virtual void compute(int, int); void init_style(); private: template <class flt_t> class ForceConst; template <class flt_t, class acc_t> void compute(int eflag, int vflag, IntelBuffers<flt_t, acc_t> *buffers, const ForceConst<flt_t> &fc); template <int EFLAG, int NEWTON_PAIR, class flt_t, class acc_t> void eval(const int offload, const int vflag, IntelBuffers<flt_t, acc_t> *buffers, const ForceConst<flt_t> &fc, const int astart, const int aend); template <class flt_t, class acc_t> void pack_force_const(ForceConst<flt_t> &fc, IntelBuffers<flt_t, acc_t> *buffers); template <class flt_t> class ForceConst { public: typedef struct { flt_t cutsq, lj1, lj2, offset, sigma, epsilon, lshape; int form; } fc_packed1; typedef struct { flt_t lj3, lj4; } fc_packed2; typedef struct { flt_t shape2[4], well[4]; } fc_packed3; _alignvar(flt_t special_lj[4], 64); _alignvar(flt_t gamma, 64); _alignvar(flt_t upsilon, 64); _alignvar(flt_t mu, 64); fc_packed1 **ijc; fc_packed2 **lj34; fc_packed3 *ic; flt_t **rsq_form, **delx_form, **dely_form, **delz_form; int **jtype_form, **jlist_form; ForceConst() : _ntypes(0) {} ~ForceConst() { set_ntypes(0, 0, 0, nullptr, _cop); } void set_ntypes(const int ntypes, const int one_length, const int nthreads, Memory *memory, const int cop); private: int _ntypes, _cop; Memory *_memory; }; ForceConst<float> force_const_single; ForceConst<double> force_const_double; int _max_nbors; double gayberne_lj(const int i, const int j, double a1[3][3], double b1[3][3], double g1[3][3], double *r12, const double rsq, double *fforce, double *ttor); FixIntel *fix; int _cop; }; } // namespace LAMMPS_NS #endif #endif
/* * Copyright (C) 2013-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. */ #include <linux/fs.h> /* file system operations */ #include <asm/uaccess.h> /* user space access */ #include "mali_ukk.h" #include "mali_osk.h" #include "mali_kernel_common.h" #include "mali_session.h" #include "mali_ukk_wrappers.h" #include "mali_soft_job.h" #include "mali_timeline.h" int soft_job_start_wrapper(struct mali_session_data *session, _mali_uk_soft_job_start_s __user *uargs) { _mali_uk_soft_job_start_s kargs; u32 type, point; u64 user_job; struct mali_timeline_fence fence; struct mali_soft_job *job = NULL; u32 __user *job_id_ptr = NULL; /* If the job was started successfully, 0 is returned. If there was an error, but the job * was started, we return -ENOENT. For anything else returned, the job was not started. */ MALI_CHECK_NON_NULL(uargs, -EINVAL); MALI_CHECK_NON_NULL(session, -EINVAL); MALI_DEBUG_ASSERT_POINTER(session->soft_job_system); if (0 != copy_from_user(&kargs, uargs, sizeof(kargs))) { return -EFAULT; } type = kargs.type; user_job = kargs.user_job; job_id_ptr = (u32 __user *)(uintptr_t)kargs.job_id_ptr; mali_timeline_fence_copy_uk_fence(&fence, &kargs.fence); if ((MALI_SOFT_JOB_TYPE_USER_SIGNALED != type) && (MALI_SOFT_JOB_TYPE_SELF_SIGNALED != type)) { MALI_DEBUG_PRINT_ERROR(("Invalid soft job type specified\n")); return -EINVAL; } /* Create soft job. */ job = mali_soft_job_create(session->soft_job_system, (enum mali_soft_job_type)type, user_job); if (unlikely(NULL == job)) { return map_errcode(_MALI_OSK_ERR_NOMEM); } /* Write job id back to user space. */ if (0 != put_user(job->id, job_id_ptr)) { MALI_PRINT_ERROR(("Mali Soft Job: failed to put job id")); mali_soft_job_destroy(job); return map_errcode(_MALI_OSK_ERR_NOMEM); } /* Start soft job. */ point = mali_soft_job_start(job, &fence); if (0 != put_user(point, &uargs->point)) { /* Let user space know that something failed after the job was started. */ return -ENOENT; } return 0; } int soft_job_signal_wrapper(struct mali_session_data *session, _mali_uk_soft_job_signal_s __user *uargs) { u32 job_id; _mali_osk_errcode_t err; MALI_DEBUG_ASSERT_POINTER(session); if (0 != get_user(job_id, &uargs->job_id)) return -EFAULT; err = mali_soft_job_system_signal_job(session->soft_job_system, job_id); return map_errcode(err); }
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <unistd.h> #include <sys/time.h> #include "libhashish.h" #include "analysis_common.h" static void die_usage(void) { fputs("Usage: hashstr algorithm string\n", stderr); exit(1); } int main(int argc, char *argv[]) { hash_function_t fun; if (argc != 3) die_usage(); fun = get_hashfunc_by_name(argv[1]); if (!fun) die_list(); return printf("%u\n", fun((const uint8_t*)argv[2], strlen(argv[2])))<= 0; }
/** * @file * @author Chrisitan Urich <christian.urich@gmail.com> * @version 1.0 * @section LICENSE * * This file is part of DynaMind * * Copyright (C) 2011-2012 Christian Urich * 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 DYNAMICINOUT_H #define DYNAMICINOUT_H #include "dmcompilersettings.h" #include "dmmodule.h" using namespace DM; /** * @brief Add user defined attribute to Inlets * * Data Set: * - Inport: * - Read * - Inlets|NODE: A, B, C * - Add * - Inlets|NODE: User Defined * */ class DM_HELPER_DLL_EXPORT DynamicInOut : public Module { DM_DECLARE_NODE(DynamicInOut) private: std::vector<std::string> NewAttributes; bool attributeChanged; DM::System * sys_in; int PrevSize; public: DynamicInOut(); /** @brief Here the dynamic is added **/ void init(); /** @brief Does nothing **/ void run(); /** @brief add a new attribute during runtime of the model */ void addAttribute(std::string name); }; #endif // DYNAMICINOUT_H
/* SPDX-License-Identifier: LGPL-2.1+ */ #include "netdev/vcan.h" const NetDevVTable vcan_vtable = { .object_size = sizeof(VCan), .create_type = NETDEV_CREATE_INDEPENDENT, };
#pragma once /* * Copyright (C) 2016 Christian Browet * 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 <androidjni/JNIBase.h> #include <androidjni/NsdManager.h> namespace jni { class CJNIXBMCNsdManagerRegistrationListener : public CJNINsdManagerRegistrationListener, public CJNIInterfaceImplem<CJNIXBMCNsdManagerRegistrationListener> { public: CJNIXBMCNsdManagerRegistrationListener(); CJNIXBMCNsdManagerRegistrationListener(const CJNIXBMCNsdManagerRegistrationListener& other); CJNIXBMCNsdManagerRegistrationListener(const jni::jhobject &object) : CJNIBase(object) {} virtual ~CJNIXBMCNsdManagerRegistrationListener(); static void RegisterNatives(JNIEnv* env); // CJNINsdManagerRegistrationListener interface public: void onRegistrationFailed(const CJNINsdServiceInfo& serviceInfo, int errorCode) override {} void onServiceRegistered(const CJNINsdServiceInfo& serviceInfo) override {} void onServiceUnregistered(const CJNINsdServiceInfo& serviceInfo) override {} void onUnregistrationFailed(const CJNINsdServiceInfo& serviceInfo, int errorCode) override {} protected: static void _onRegistrationFailed(JNIEnv* env, jobject thiz, jobject serviceInfo, jint errorCode); static void _onServiceRegistered(JNIEnv* env, jobject thiz, jobject serviceInfo); static void _onServiceUnregistered(JNIEnv* env, jobject thiz, jobject serviceInfo); static void _onUnregistrationFailed(JNIEnv* env, jobject thiz, jobject serviceInfo, jint errorCode); }; }
#ifndef THR_COND_INCLUDED #define THR_COND_INCLUDED /* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; 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 */ /** MySQL condition variable implementation. There are three "layers": 1) native_cond_*() Functions that map directly down to OS primitives. Windows - ConditionVariable Other OSes - pthread 2) my_cond_*() Functions that use SAFE_MUTEX (default for debug). Otherwise native_cond_*() is used. 3) mysql_cond*() Functions that include Performance Schema instrumentation. See include/mysql/psi/mysql_thread.h */ #include "my_thread.h" #include "thr_mutex.h" C_MODE_START #ifdef _WIN32 typedef CONDITION_VARIABLE native_cond_t; #else typedef pthread_cond_t native_cond_t; #endif #ifdef _WIN32 /** Convert abstime to milliseconds */ static DWORD get_milliseconds(const struct timespec *abstime) { #ifndef HAVE_STRUCT_TIMESPEC long long millis; union ft64 now; if (abstime == NULL) return INFINITE; GetSystemTimeAsFileTime(&now.ft); /* Calculate time left to abstime - subtract start time from current time(values are in 100ns units) - convert to millisec by dividing with 10000 */ millis= (abstime->tv.i64 - now.i64) / 10000; /* Don't allow the timeout to be negative */ if (millis < 0) return 0; /* Make sure the calculated timeout does not exceed original timeout value which could cause "wait for ever" if system time changes */ if (millis > abstime->max_timeout_msec) millis= abstime->max_timeout_msec; if (millis > UINT_MAX) millis= UINT_MAX; return (DWORD)millis; #else /* Convert timespec to millis and subtract current time. my_getsystime() returns time in 100 ns units. */ return (DWORD)(abstime->tv_sec * 1000 + abstime->tv_nsec / 1000000 - my_getsystime() / 10000); #endif } #endif /* _WIN32 */ static inline int native_cond_init(native_cond_t *cond) { #ifdef _WIN32 InitializeConditionVariable(cond); return 0; #else /* pthread_condattr_t is not used in MySQL */ return pthread_cond_init(cond, NULL); #endif } static inline int native_cond_destroy(native_cond_t *cond) { #ifdef _WIN32 return 0; /* no destroy function */ #else return pthread_cond_destroy(cond); #endif } static inline int native_cond_timedwait(native_cond_t *cond, native_mutex_t *mutex, const struct timespec *abstime) { #ifdef _WIN32 DWORD timeout= get_milliseconds(abstime); if (!SleepConditionVariableCS(cond, mutex, timeout)) return ETIMEDOUT; return 0; #else return pthread_cond_timedwait(cond, mutex, abstime); #endif } static inline int native_cond_wait(native_cond_t *cond, native_mutex_t *mutex) { #ifdef _WIN32 if (!SleepConditionVariableCS(cond, mutex, INFINITE)) return ETIMEDOUT; return 0; #else return pthread_cond_wait(cond, mutex); #endif } static inline int native_cond_signal(native_cond_t *cond) { #ifdef _WIN32 WakeConditionVariable(cond); return 0; #else return pthread_cond_signal(cond); #endif } static inline int native_cond_broadcast(native_cond_t *cond) { #ifdef _WIN32 WakeAllConditionVariable(cond); return 0; #else return pthread_cond_broadcast(cond); #endif } #ifdef SAFE_MUTEX int safe_cond_wait(native_cond_t *cond, my_mutex_t *mp, const char *file, uint line); int safe_cond_timedwait(native_cond_t *cond, my_mutex_t *mp, const struct timespec *abstime, const char *file, uint line); #endif static inline int my_cond_timedwait(native_cond_t *cond, my_mutex_t *mp, const struct timespec *abstime #ifdef SAFE_MUTEX , const char *file, uint line #endif ) { #ifdef SAFE_MUTEX return safe_cond_timedwait(cond, mp, abstime, file, line); #else return native_cond_timedwait(cond, mp, abstime); #endif } static inline int my_cond_wait(native_cond_t *cond, my_mutex_t *mp #ifdef SAFE_MUTEX , const char *file, uint line #endif ) { #ifdef SAFE_MUTEX return safe_cond_wait(cond, mp, file, line); #else return native_cond_wait(cond, mp); #endif } C_MODE_END #endif /* THR_COND_INCLUDED */
/* Output stream that accumulates the output in memory. Copyright (C) 2006-2007 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> /* Specification. */ #include "memory-ostream.h" #include <stdlib.h> #include <string.h> #include "error.h" #include "xalloc.h" #include "xsize.h" #include "gettext.h" #define _(str) gettext (str) struct memory_ostream : struct ostream { fields: char *buffer; /* Buffer containing the accumulated output. */ size_t buflen; /* Number of bytes stored so far. */ size_t allocated; /* Allocated size of the buffer. */ }; /* Implementation of ostream_t methods. */ static void memory_ostream::write_mem (memory_ostream_t stream, const void *data, size_t len) { if (len > 0) { if (len > stream->allocated - stream->buflen) { size_t new_allocated = xmax (xsum (stream->buflen, len), xsum (stream->allocated, stream->allocated)); if (size_overflow_p (new_allocated)) error (EXIT_FAILURE, 0, _("%s: too much output, buffer size overflow"), "memory_ostream"); stream->buffer = (char *) xrealloc (stream->buffer, new_allocated); stream->allocated = new_allocated; } memcpy (stream->buffer + stream->buflen, data, len); stream->buflen += len; } } static void memory_ostream::flush (memory_ostream_t stream) { } static void memory_ostream::free (memory_ostream_t stream) { free (stream->buffer); free (stream); } /* Implementation of memory_ostream_t methods. */ void memory_ostream::contents (memory_ostream_t stream, const void **bufp, size_t *buflenp) { *bufp = stream->buffer; *buflenp = stream->buflen; } /* Constructor. */ memory_ostream_t memory_ostream_create (void) { memory_ostream_t stream = XMALLOC (struct memory_ostream_representation); stream->base.vtable = &memory_ostream_vtable; stream->allocated = 250; stream->buffer = XNMALLOC (stream->allocated, char); stream->buflen = 0; return stream; }
// // Imei.h // Prey // // Created by Carlos Yaconi on 22-01-13. // Copyright (c) 2013 Fork Ltd. All rights reserved. // #import "DataModule.h" @interface Imei : DataModule @end
/* * Copyright 2004, 2005 PathScale, Inc. All Rights Reserved. */ /* Copyright (C) 1999-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, any license provided herein, whether implied or otherwise, is limited to this program in accordance with the express provisions of the GNU Lesser General Public License. Patent licenses, if any, provided herein do not apply to combinations of this program with other product or programs, or any other product whatsoever. This program is distributed without any warranty that the program is delivered free of the rightful claim of any third person by way of infringement or the like. See the GNU Lesser 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 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. */ /* $Header: /proj/osprey/CVS/open64/osprey1.0/libU77/etime_.c,v 1.1.1.1 2005/10/21 19:00:00 marcel Exp $ */ /* * * Return the elapsed execution time for this process. * * calling sequence: * real time(2) * call etime (time) * where: * the 2 element array, time, will receive the user and system * elapsed time since the start of execution. * * This routine can be called as function, and returns the sum of * user and system times. The time array argument must always be given. * * The resolution for all timing is 1/60 second. */ struct tb { float usrtime; float systime; }; #if defined(sgi) || defined (__linux) || defined(BUILD_OS_DARWIN) #include <sys/time.h> #include <sys/resource.h> #ifdef KEY /* Bug 3018 */ #include "pathf90_libU_intrin.h" float pathf90_etime (float tarray[2]) { struct rusage ru; getrusage (RUSAGE_SELF, &ru); tarray[0] = (float)ru.ru_utime.tv_sec + (float)ru.ru_utime.tv_usec * 1e-6; tarray[1] = (float)ru.ru_stime.tv_sec + (float)ru.ru_stime.tv_usec * 1e-6; return(tarray[0] + tarray[1]); } /* Alternate G77 subroutine form */ void pathf90_subr_etime (float tarray[2], float *result) { *result = pathf90_etime(tarray); } #else float etime_ (struct tb *et) { struct rusage ru; getrusage (RUSAGE_SELF, &ru); et->usrtime = (float)ru.ru_utime.tv_sec + (float)ru.ru_utime.tv_usec * 1e-6; et->systime = (float)ru.ru_stime.tv_sec + (float)ru.ru_stime.tv_usec * 1e-6; return(et->usrtime + et->systime); } #endif /* KEY Bug 3018 */ #else /* sgi || __linux */ #if defined(_SYSV) || defined(_SYSTYPE_SVR4) #include <sys/param.h> #include <sys/types.h> #include <sys/times.h> extern float etime_ (struct tb *et) { struct tms clock; (void)times(&clock); et->usrtime = (float) clock.tms_utime / (double)HZ; et->systime = (float) clock.tms_stime / (double)HZ; return(et->usrtime + et->systime); } #endif /* _SYSV || _SYSTYPE_SVR4 */ #endif /* sgi */
/* Drawpile - a collaborative drawing program. Copyright (C) 2019 Calle Laakkonen Drawpile 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. Drawpile 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 Drawpile. If not, see <http://www.gnu.org/licenses/>. */ #ifndef TOOLSETTINGS_INSPECTOR_H #define TOOLSETTINGS_INSPECTOR_H #include "toolsettings.h" class Ui_InspectorSettings; namespace canvas { class UserListModel; } namespace tools { /** * @brief Canvas inspector (a moderation tool) */ class InspectorSettings : public ToolSettings { Q_OBJECT public: InspectorSettings(ToolController *ctrl, QObject *parent=nullptr); ~InspectorSettings(); QString toolType() const override { return QStringLiteral("inspector"); } void setForeground(const QColor &color) override { Q_UNUSED(color); } int getSize() const override { return 0; } bool getSubpixelMode() const override { return false; } void setUserList(canvas::UserListModel *userlist) { m_userlist = userlist; } public slots: void onCanvasInspected(int tx, int ty, int lastEditedBy); protected: QWidget *createUiWidget(QWidget *parent) override; private: Ui_InspectorSettings *m_ui; canvas::UserListModel *m_userlist; }; } #endif
/* -*- c++ -*- */ /* * Copyright 2011 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_QTGUI_UTIL_H #define INCLUDED_QTGUI_UTIL_H #include <qevent.h> #include <gr_qtgui_api.h> #include <qwt_plot_picker.h> #include <qwt_picker_machine.h> class GR_QTGUI_API QwtDblClickPlotPicker: public QwtPlotPicker { public: QwtDblClickPlotPicker(QwtPlotCanvas *); ~QwtDblClickPlotPicker(); virtual QwtPickerMachine * stateMachine(int) const; }; class GR_QTGUI_API QwtPickerDblClickPointMachine: public QwtPickerMachine { public: QwtPickerDblClickPointMachine(); ~QwtPickerDblClickPointMachine(); virtual CommandList transition( const QwtEventPattern &eventPattern, const QEvent *e); }; #endif /* INCLUDED_QTGUI_UTIL_H */
/* * This file is part of EasyRPG Player. * * EasyRPG Player 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. * * EasyRPG Player 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 EasyRPG Player. If not, see <http://www.gnu.org/licenses/>. */ #ifndef EP_GAME_INTERPRETER_BATTLE_H #define EP_GAME_INTERPRETER_BATTLE_H // Headers #include <map> #include <string> #include <vector> #include "game_character.h" #include "rpg_eventcommand.h" #include "system.h" #include "game_interpreter.h" class Game_Event; class Game_CommonEvent; /** * Game_Interpreter_Battle class. */ class Game_Interpreter_Battle : public Game_Interpreter { public: Game_Interpreter_Battle(int _depth = 0, bool _main_flag = false); bool ExecuteCommand() override; private: bool CommandCallCommonEvent(RPG::EventCommand const& com); bool CommandForceFlee(RPG::EventCommand const& com); bool CommandEnableCombo(RPG::EventCommand const& com); bool CommandChangeMonsterHP(RPG::EventCommand const& com); bool CommandChangeMonsterMP(RPG::EventCommand const& com); bool CommandChangeMonsterCondition(RPG::EventCommand const& com); bool CommandShowHiddenMonster(RPG::EventCommand const& com); bool CommandChangeBattleBG(RPG::EventCommand const& com); bool CommandShowBattleAnimation(RPG::EventCommand const& com); bool CommandTerminateBattle(RPG::EventCommand const& com); bool CommandConditionalBranchBattle(RPG::EventCommand const& com); }; #endif
/* * 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/>. */ /* * Replacement for system header file <ctype.h> to avoid macro definitions * Functions are implemented in common/string_light.c */ #ifdef __cplusplus // use original implementation for C++ # include_next <ctype.h> #endif #ifndef _CTYPE_H_ #define _CTYPE_H_ #ifndef _EXFUN # define _EXFUN(name,proto) name proto #endif int _EXFUN(isalnum, (int __c)); int _EXFUN(isalpha, (int __c)); int _EXFUN(iscntrl, (int __c)); int _EXFUN(isdigit, (int __c)); int _EXFUN(isgraph, (int __c)); int _EXFUN(islower, (int __c)); int _EXFUN(isprint, (int __c)); int _EXFUN(ispunct, (int __c)); int _EXFUN(isspace, (int __c)); int _EXFUN(isupper, (int __c)); int _EXFUN(isxdigit,(int __c)); int _EXFUN(tolower, (int __c)); int _EXFUN(toupper, (int __c)); int _EXFUN(isblank, (int __c)); #endif /* _CTYPE_H_ */
/* * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ /** * \file stdafx.h * \brief Standard system include files * \authors Tobias Lorenz * \copyright Copyright (c) 2011, Robert Bosch Engineering and Business Solutions. All rights reserved. * * Include file for standard system include files, * or project specific include files that are used frequently, * but are changed infrequently */ #pragma once /* MFC includes */ #define _SECURE_ATL 1 #define VC_EXTRALEAN /* Exclude rarely-used stuff from Windows headers */ #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS /* some CString constructors will be explicit */ #define _AFX_ALL_WARNINGS /* turns off MFC's hiding of some common and often safely ignored warning messages */ #include <afxwin.h> /* MFC core and standard components */ #include <afxext.h> /* MFC extensions */ #include <afxdisp.h> /* MFC Automation classes */ #ifndef _AFX_NO_AFXCMN_SUPPORT #include <afxcmn.h> /* MFC support for Windows Common Controls */ #endif // _AFX_NO_AFXCMN_SUPPORT #include <afxdlgs.h> /* C++ includes */ #include <iostream> using namespace std;
/* * 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 "PLMN-ValueTag.h" int PLMN_ValueTag_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if((value >= 1 && value <= 256)) { /* Constraint check succeeded */ return 0; } else { _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void PLMN_ValueTag_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; td->specifics = asn_DEF_NativeInteger.specifics; } void PLMN_ValueTag_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { PLMN_ValueTag_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int PLMN_ValueTag_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { PLMN_ValueTag_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t PLMN_ValueTag_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) { PLMN_ValueTag_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t PLMN_ValueTag_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) { PLMN_ValueTag_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t PLMN_ValueTag_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) { PLMN_ValueTag_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t PLMN_ValueTag_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) { PLMN_ValueTag_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t PLMN_ValueTag_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) { PLMN_ValueTag_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t PLMN_ValueTag_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { PLMN_ValueTag_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static asn_per_constraints_t asn_PER_type_PLMN_ValueTag_constr_1 = { { APC_CONSTRAINED, 8, 8, 1, 256 } /* (1..256) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; static ber_tlv_tag_t asn_DEF_PLMN_ValueTag_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_PLMN_ValueTag = { "PLMN-ValueTag", "PLMN-ValueTag", PLMN_ValueTag_free, PLMN_ValueTag_print, PLMN_ValueTag_constraint, PLMN_ValueTag_decode_ber, PLMN_ValueTag_encode_der, PLMN_ValueTag_decode_xer, PLMN_ValueTag_encode_xer, PLMN_ValueTag_decode_uper, PLMN_ValueTag_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_PLMN_ValueTag_tags_1, sizeof(asn_DEF_PLMN_ValueTag_tags_1) /sizeof(asn_DEF_PLMN_ValueTag_tags_1[0]), /* 1 */ asn_DEF_PLMN_ValueTag_tags_1, /* Same as above */ sizeof(asn_DEF_PLMN_ValueTag_tags_1) /sizeof(asn_DEF_PLMN_ValueTag_tags_1[0]), /* 1 */ &asn_PER_type_PLMN_ValueTag_constr_1, 0, 0, /* No members */ 0 /* No specifics */ };
#include "pluto/libpluto.h" #include "isl/union_set.h" #include "isl/union_map.h" int another() { isl_ctx *ctx = isl_ctx_alloc(); isl_union_set *domains = isl_union_set_read_from_str(ctx, "[p_0, p_1, p_2, p_3, p_4, p_5, p_7] -> { S_1[i0, i1] : i0 >= 0 and i0 <= p_0 and i1 >= 0 and i1 <= p_3 and p_2 >= 0; S_0[i0] : i0 >= 0 and i0 <= p_0}"); isl_union_map *deps = isl_union_map_read_from_str(ctx, "[p_0, p_1, p_2, p_3, p_4, p_5, p_7] -> { S_0[i0] -> S_1[o0, o1] : (exists (e0 = [(p_7)/8]: 8o1 = -p_5 + p_7 + 8192i0 - 8192o0 and 8e0 = p_7 and i0 >= 0 and o0 <= p_0 and 8192o0 >= -8p_3 - p_5 + p_7 + 8192i0 and 8192o0 <= -p_5 + p_7 + 8192i0 and p_2 >= 0 and o0 >= 1 + i0)); S_1[i0, i1] -> S_0[o0] : (exists (e0 = [(p_1)/8], e1 = [(p_4)/8], e2 = [(-p_1 + p_7)/8184]: 8192o0 = p_5 - p_7 + 8192i0 + 8i1 and 8e0 = p_1 and 8e1 = p_4 and 8184e2 = -p_1 + p_7 and i1 >= 0 and 8i1 <= 8192p_0 - p_5 + p_7 - 8192i0 and 8184i1 >= 1024 + 1024p_1 - 1023p_5 - p_7 - 8380416i0 and p_2 >= 0 and p_7 <= -1 + p_5 and 8i1 >= 1 + 8p_3 + p_4 - p_5 - 8192i0 and i1 <= p_3 and i0 >= 0 and 8i1 >= 8192 - p_5 + p_7))}"); PlutoOptions *options = pluto_options_alloc(); options->tile = 1; options->parallel = 1; options->debug = 1; isl_union_map *schedule = pluto_schedule(domains, deps, options); if (schedule) { isl_printer *printer = isl_printer_to_file(ctx, stdout); isl_printer_print_union_map(printer, schedule); printf("\n"); isl_printer_free(printer); // Check if the schedule can be applied to the domain. domains = isl_union_set_apply(domains, schedule); }else{ printf("No schedule\n"); } isl_union_set_free(domains); isl_union_map_free(deps); pluto_options_free(options); isl_ctx_free(ctx); } int main() { isl_ctx *ctx = isl_ctx_alloc(); isl_union_set *domains = isl_union_set_read_from_str(ctx, "[n] -> {S_1[i0, i1] : i0 >= 0 and i0 <= 99 and i1 >= 0 and i1 <= 99; S_0[i0] : i0 >= 0 and i0 <= 99; S_2[i0] : i0 >= 0 and i0 <= 99 }"); isl_union_map *deps = isl_union_map_read_from_str(ctx, "[n] -> {S_1[i0, 99] -> S_0[1 + i0] : i0 >= 0 and i0 <= 98; S_1[i0, i1] -> S_1[i0, 1 + i1] : i0 >= 0 and i0 <= 99 and i1 >= 0 and i1 <= 98; S_1[i0, 99] -> S_1[1 + i0, 0] : i0 >= 0 and i0 <= 98; S_0[i0] -> S_1[i0, 0] : i0 >= 0 and i0 <= 99; S_2[i0] -> S_1[1 + i0, 0] : i0 >= 0 and i0 <= 98; S_0[i0] -> S_2[i0] : i0 >= 0 and i0 <= 99; S_1[i0, 99] -> S_2[i0] : i0 >= 0 and i0 <= 99 }"); PlutoOptions *options = pluto_options_alloc(); options->tile = 1; options->parallel = 1; isl_union_map *schedule = pluto_schedule(domains, deps, options); isl_printer *printer = isl_printer_to_file(ctx, stdout); isl_printer_print_union_map(printer, schedule); printf("\n"); isl_printer_free(printer); // Check if the schedule can be applied to the domain. domains = isl_union_set_apply(domains, schedule); isl_union_set_free(domains); isl_union_map_free(deps); pluto_options_free(options); isl_ctx_free(ctx); // another(); }
// randequivalent.h // 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. // // Copyright 2005-2010 Google, Inc. // Author: allauzen@google.com (Cyril Allauzen) // // \file // Tests if two FSTS are equivalent by checking if random // strings from one FST are transduced the same by both FSTs. #ifndef FST_RANDEQUIVALENT_H__ #define FST_RANDEQUIVALENT_H__ #include <fst/arcsort.h> #include <fst/compose.h> #include <fst/project.h> #include <fst/randgen.h> #include <fst/shortest-distance.h> #include <fst/vector-fst.h> namespace fst { // Test if two FSTs are equivalent by randomly generating 'num_paths' // paths (as specified by the RandGenOptions 'opts') in these FSTs. // // For each randomly generated path, the algorithm computes for each // of the two FSTs the sum of the weights of all the successful paths // sharing the same input and output labels as the considered randomly // generated path and checks that these two values are within // 'delta'. template<class Arc, class ArcSelector> bool RandEquivalent(const Fst<Arc> &fst1, const Fst<Arc> &fst2, ssize_t num_paths, float delta, const RandGenOptions<ArcSelector> &opts) { typedef typename Arc::Weight Weight; // Check that the symbol table are compatible if (!CompatSymbols(fst1.InputSymbols(), fst2.InputSymbols()) || !CompatSymbols(fst1.OutputSymbols(), fst2.OutputSymbols())) LOG(FATAL) << "RandEquivalent: input/output symbol tables of 1st " << "argument do not match input/output symbol tables of 2nd " << "argument"; ILabelCompare<Arc> icomp; OLabelCompare<Arc> ocomp; VectorFst<Arc> sfst1(fst1); VectorFst<Arc> sfst2(fst2); Connect(&sfst1); Connect(&sfst2); ArcSort(&sfst1, icomp); ArcSort(&sfst2, icomp); for (ssize_t n = 0; n < num_paths; ++n) { VectorFst<Arc> path; const Fst<Arc> &fst = rand() % 2 ? sfst1 : sfst2; RandGen(fst, &path, opts); VectorFst<Arc> ipath(path); VectorFst<Arc> opath(path); Project(&ipath, PROJECT_INPUT); Project(&opath, PROJECT_OUTPUT); VectorFst<Arc> cfst1, pfst1; Compose(ipath, sfst1, &cfst1); ArcSort(&cfst1, ocomp); Compose(cfst1, opath, &pfst1); // Give up if there are epsilon cycles in a non-idempotent semiring if (!(Weight::Properties() & kIdempotent) && pfst1.Properties(kCyclic, true)) continue; Weight sum1 = ShortestDistance(pfst1); VectorFst<Arc> cfst2, pfst2; Compose(ipath, sfst2, &cfst2); ArcSort(&cfst2, ocomp); Compose(cfst2, opath, &pfst2); // Give up if there are epsilon cycles in a non-idempotent semiring if (!(Weight::Properties() & kIdempotent) && pfst2.Properties(kCyclic, true)) continue; Weight sum2 = ShortestDistance(pfst2); if (!ApproxEqual(sum1, sum2, delta)) { VLOG(1) << "Sum1 = " << sum1; VLOG(1) << "Sum2 = " << sum2; return false; } } return true; } // Test if two FSTs are equivalent by randomly generating 'num_paths' paths // of length no more than 'path_length' using the seed 'seed' in these FSTs. template <class Arc> bool RandEquivalent(const Fst<Arc> &fst1, const Fst<Arc> &fst2, ssize_t num_paths, float delta = kDelta, int seed = time(0), int path_length = INT_MAX) { UniformArcSelector<Arc> uniform_selector(seed); RandGenOptions< UniformArcSelector<Arc> > opts(uniform_selector, path_length); return RandEquivalent(fst1, fst2, num_paths, delta, opts); } } // namespace fst #endif // FST_LIB_RANDEQUIVALENT_H__
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/> // Copyright (C) 2010 Winch Gate Property Limited // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero 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 Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. #ifndef RY_OUTPOST_BUILDING_H #define RY_OUTPOST_BUILDING_H class CStaticOutpostBuilding; class COutpost; #include "creature_manager/creature.h" /** * This class groups all types of buildings (it is like a building slot) * \author Matthieu Besson * \author Nevrax France * \date september 2005 */ class COutpostBuilding { public: DECLARE_PERSISTENCE_METHODS COutpostBuilding(COutpost *parent, TAIAlias alias, const NLMISC::CVector &center, NLMISC::CSheetId defaultSheet); bool construct(NLMISC::CSheetId sheetid); bool destroy(); void update(uint32 currentTime); /// get the alias (unique for each building) TAIAlias getAlias() const { return _Alias; } /// get the default sheet of the building NLMISC::CSheetId getDefaultSheet() const { return _DefaultSheet; } /// get the current sheet of the building NLMISC::CSheetId getCurrentSheet() const { return _CurrentSheet; } /// get the static data (hold by the sheet) const CStaticOutpostBuilding *getStaticData() const { return _StaticData; } /// Called when ais has decided to spawn the corresponding bot void onSpawned(CCreature *pBuilding); // Called when the ais is ready and running void onAISUp(); const COutpost *getParent() const { return _Parent; } bool isConstructing() const { return _Constructing; } /// get a one line description string (for debug) std::string toString() const; /// called only by the command : outpostAccelerateConstruction void setConstructionTime(uint32 nNbSeconds, uint32 nCurrentTime); private: // Never construct a building like this COutpostBuilding() { } void changeShape(const NLMISC::CSheetId &botId, const std::string &name); void postLoad(); private: /// @name Primitive data (static) //@{ COutpost *_Parent; TAIAlias _Alias; // Position in the world NLMISC::CVector _Center; // Default sheet of the building NLMISC::CSheetId _DefaultSheet; //@} /// @name Sheet data (static) //@{ // Static data of the building const CStaticOutpostBuilding *_StaticData; //@} /// @name Persistent data //@{ // Date of the last constructed or the beginning of construction uint32 _BuiltDate; // Is there a construction in progress ? bool _Constructing; // Currently spawned object NLMISC::CSheetId _CurrentSheet; /// Used for driller //@{ float _MPLeft; uint32 _MPLastTime; //@} //@} /// @name Dynamic data //@{ /// Used BotObject NLMISC::CRefPtr<CCreature> _BotObject; //@} }; #endif
/* * Copyright 2010-2012 Fabric Engine Inc. All rights reserved. */ #ifndef _FABRIC_AST_REPORT_H #define _FABRIC_AST_REPORT_H #include <Fabric/Core/AST/Statement.h> #include <Fabric/Core/AST/Expr.h> namespace Fabric { namespace Util { class SimpleString; }; namespace AST { class Report: public Statement { FABRIC_AST_NODE_DECL( Report ); public: REPORT_RC_LEAKS static RC::ConstHandle<Report> Create( CG::Location const &location, RC::ConstHandle<Expr> const &expr ) { return new Report( location, expr ); } virtual void registerTypes( RC::Handle<CG::Manager> const &cgManager, CG::Diagnostics &diagnostics ) const; virtual void llvmCompileToBuilder( CG::BasicBlockBuilder &basicBlockBuilder, CG::Diagnostics &diagnostics ) const; protected: Report( CG::Location const &location, RC::ConstHandle<Expr> const &expr); virtual void appendJSONMembers( JSON::ObjectEncoder const &jsonObjectEncoder, bool includeLocation ) const; private: RC::ConstHandle<Expr> m_expr; }; }; }; #endif //_FABRIC_AST_REPORT_H
/*BHEADER********************************************************************** * Copyright (c) 2008, Lawrence Livermore National Security, LLC. * Produced at the Lawrence Livermore National Laboratory. * This file is part of HYPRE. See file COPYRIGHT for details. * * HYPRE 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 dated February 1999. * * $Revision$ ***********************************************************************EHEADER*/ // ************************************************************************* // Link to build an FEI_Implementation based on HYPRE // ************************************************************************* #ifndef _HYPRE_Builder_h_ #define _HYPRE_Builder_h_ #include "utilities/_hypre_utilities.h" #include "HYPRE.h" #include "../../IJ_mv/HYPRE_IJ_mv.h" #include "../../parcsr_mv/HYPRE_parcsr_mv.h" #include "../../parcsr_ls/HYPRE_parcsr_ls.h" #include "HYPRE_LinSysCore.h" #include "FEI_Implementation.h" class HYPRE_Builder { public: static FEI* FEIBuilder(MPI_Comm comm, int masterProc) { HYPRE_LinSysCore* linSysCore = new HYPRE_LinSysCore(comm); return(new FEI_Implementation(linSysCore, comm, masterProc)); } }; #endif
/****************************************************************/ /* DO NOT MODIFY THIS HEADER */ /* MOOSE - Multiphysics Object Oriented Simulation Environment */ /* */ /* (c) 2010 Battelle Energy Alliance, LLC */ /* ALL RIGHTS RESERVED */ /* */ /* Prepared by Battelle Energy Alliance, LLC */ /* Under Contract No. DE-AC07-05ID14517 */ /* With the U. S. Department of Energy */ /* */ /* See COPYRIGHT for full restrictions */ /****************************************************************/ #ifndef PROBLEM_H #define PROBLEM_H #include "ParallelUniqueId.h" #include "InputParameters.h" #include "ExecStore.h" #include "MooseArray.h" #include "MooseObject.h" #include "MooseUtils.h" // libMesh #include "libmesh/libmesh_common.h" #include "libmesh/equation_systems.h" #include "libmesh/quadrature.h" #include "libmesh/elem.h" #include "libmesh/node.h" #include "libmesh/nonlinear_implicit_system.h" #include <string> class MooseVariable; class MooseVariableScalar; class Output; class Material; class Function; class TimePeriod; class Problem; template<> InputParameters validParams<Problem>(); /** * Class that hold the whole problem being solved. */ class Problem : public MooseObject { public: Problem(const std::string & name, InputParameters parameters); virtual ~Problem(); /** * Get the name of this problem * @return The name of this problem */ virtual const std::string & name(); /** * Get reference to all-purpose parameters */ InputParameters & parameters() { return _pars; } virtual void init() = 0; /** * For Internal Use */ void _setCLIOption() { _cli_option_found = true; } // Time periods ////// /** * Add a time period * @param name Name of the time period * @param start_time Start time of the time period */ TimePeriod & addTimePeriod(const std::string & name, Real start_time); /** * Get time period by name * @param name Name of the time period to get * @return Pointer to the time period struct if found, otherwise NULL */ virtual TimePeriod * getTimePeriodByName(const std::string & name); const std::vector<TimePeriod *> & getTimePeriods() const; /** * Allow objects to request clean termination of the solve */ virtual void terminateSolve() { _termination_requested = true; }; /** * Check of termination has been requested. This should be called by * transient Executioners in the keepGoing() member. */ virtual bool isSolveTerminationRequested() { return _termination_requested; }; protected: /// Time periods std::vector<TimePeriod *> _time_periods; /// True if the CLI option is found bool _cli_option_found; /// True if we're going to attempt to write color output bool _color_output; /// True if termination of the solve has been requested bool _termination_requested; }; #endif /* PROBLEM_H */
#ifndef STATE_CONTROL_WOLF_H #define STATE_CONTROL_WOLF_H /* * ====== WOLF'S ANIMATIONS ====== */ #define TR_ANIMATION_WOLF_STAY_TO_IDLE 0 #define TR_ANIMATION_WOLF_IDLE_TO_STAY 1 #define TR_ANIMATION_WOLF_START_WALK 2 #define TR_ANIMATION_WOLF_WALK 3 #define TR_ANIMATION_WOLF_WALK_TO_CROUCH 4 #define TR_ANIMATION_WOLF_CROUCH 5 #define TR_ANIMATION_WOLF_START_RUN 6 #define TR_ANIMATION_WOLF_RUN 7 #define TR_ANIMATION_WOLF_STAY 8 #define TR_ANIMATION_WOLF_JUMP_ATTACK 9 #define TR_ANIMATION_WOLF_STAY_CROUCH 14 #define TR_ANIMATION_WOLF_WOOOO 16 #define TR_ANIMATION_WOLF_RUN_LEFT 18 #define TR_ANIMATION_WOLF_DEAD1 20 #define TR_ANIMATION_WOLF_DEAD2 21 #define TR_ANIMATION_WOLF_DEAD3 22 // ====== WOLF'S STATES ====== #define TR_STATE_WOLF_STAY 1 // -> 2 -> 7 -> 8 -> 9 #define TR_STATE_WOLF_WALK 2 // -> 1 -> 5 #define TR_STATE_WOLF_RUN 3 // -> 6 -> 9 -> 10 #define TR_STATE_WOLF_CROUCH 5 // -> 3 -> 9 -> 12 #define TR_STATE_WOLF_JUMP_ATTACK 6 // -> 3 #define TR_STATE_WOLF_WOOOO 7 #define TR_STATE_WOLF_IDLE 8 // -> 1 #define TR_STATE_WOLF_STAY_CROUCH 9 // -> 1 -> 3 -> 5 -> 7 -> 12 #define TR_STATE_WOLF_RUN_RIGHT 10 #define TR_STATE_WOLF_DEAD 11 #define TR_STATE_WOLF_STAY_ATTACK 12 #endif
/* Copyright (C) 2000-2012 Novell, Inc 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) version 3.0 of the License. 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 */ /*-/ File: YDialogSpy.h Author: Stefan Hundhammer <sh@suse.de> /-*/ #ifndef YDialogSpy_h #define YDialogSpy_h #include "ImplPtr.h" class YWidget; class YDialog; class YDialogSpyPrivate; /** * An interactive dialog debugger: Show the structure and content of a dialog * and its widgets. * * This can be invoked by special key combinations: * Ctrl-Alt-Shift-Y in the Qt UI **/ class YDialogSpy { public: /** * Show a YDialogSpy for the specified dialog. 0 means "use the topmost * dialog". * This will return only when the user closes the YDialogSpy dialog. **/ static void showDialogSpy( YDialog * dialog = 0 ); /** * Show the "Properties" sub-window. **/ void showProperties(); /** * Hide the "Properties" sub-window. **/ void hideProperties(); /** * Return 'true' if the "Properties" sub-window is currently shown, * 'false' if not. **/ bool propertiesShown() const; protected: /** * Constructor: Create a YDialogSpy for the specified dialog. 0 means "use * the topmost dialog". * * In most cases it is more useful to use the static showDialogSpy() method * rather than create this dialog directly. **/ YDialogSpy( YDialog * dialog = 0 ); /** * Destructor. **/ virtual ~YDialogSpy(); /** * Execute the event loop. This will only return when the user closes the * YDialogSpy dialog. **/ void exec(); /** * Show the properties of the specified widget if the "Properties" * sub-window is currently shown. **/ void showProperties( YWidget * widget ); private: ImplPtr<YDialogSpyPrivate> priv; }; #endif // YDialogSpy_h
// -*-c++-*- /*! \file view_normal.h \brief change view width to normal */ /* *Copyright: Copyright (C) Hidehisa AKIYAMA This code is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *EndCopyright: */ ///////////////////////////////////////////////////////////////////// #ifndef RCSC_ACTION_VIEW_CHANGE_WIDTH_H #define RCSC_ACTION_VIEW_CHANGE_WIDTH_H #include <rcsc/player/soccer_action.h> #include <rcsc/player/view_mode.h> namespace rcsc { /*! \class View_ChangeWidth \brief change view width to the specified type */ class View_ChangeWidth : public ViewAction { private: const ViewWidth M_width; public: /*! \brief construct with view width \param width new view width */ explicit View_ChangeWidth( const ViewWidth & width ) : M_width( width ) { } /*! \brief execute action \param agent pointer to the agent itself \return true if action is performed */ bool execute( PlayerAgent * agent ); /*! \brief create cloned object \return pointer to the cloned object */ ViewAction * clone() const { return new View_ChangeWidth( M_width ); } }; } #endif
/* radare2 - LGPL - Copyright 2015-2018 - pancake */ #ifndef R2_BIND_H #define R2_BIND_H // TODO: move riobind here too? // TODO: move rprint here too typedef int (*RCoreCmd)(void *core, const char *cmd); typedef int (*RCoreCmdF)(void *user, const char *fmt, ...); typedef int (*RCoreDebugBpHit)(void *core, void *bp); typedef char* (*RCoreCmdStr)(void *core, const char *cmd); typedef char* (*RCoreCmdStrF)(void *core, const char *cmd, ...); typedef void (*RCorePuts)(const char *cmd); typedef void (*RCoreSetArchBits)(void *core, const char *arch, int bits); typedef const char *(*RCoreGetName)(void *core, ut64 off); typedef char *(*RCoreGetNameDelta)(void *core, ut64 off); typedef void (*RCoreSeekArchBits)(void *core, ut64 addr); typedef int (*RCoreConfigGetI)(void *core, const char *key); typedef const char *(*RCoreConfigGet)(void *core, const char *key); typedef struct r_core_bind_t { void *core; RCoreCmd cmd; RCoreCmdF cmdf; RCoreCmdStr cmdstr; RCoreCmdStrF cmdstrf; RCorePuts puts; RCoreDebugBpHit bphit; RCoreSetArchBits setab; RCoreGetName getName; RCoreGetNameDelta getNameDelta; RCoreSeekArchBits archbits; RCoreConfigGetI cfggeti; RCoreConfigGet cfgGet; } RCoreBind; #endif
/* Test file for mpfr_add_d Copyright 2007-2016 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. The GNU MPFR 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 3 of the License, or (at your option) any later version. The GNU MPFR 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 MPFR Library; see the file COPYING.LESSER. If not, see http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include <stdio.h> #include <stdlib.h> #include <float.h> #include "mpfr-test.h" #if MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0) static void check_regulars (void) { mpfr_t x, y, z; double d; int inexact; /* (1) check with enough precision */ mpfr_init2 (x, IEEE_DBL_MANT_DIG); mpfr_init2 (y, IEEE_DBL_MANT_DIG); mpfr_init2 (z, IEEE_DBL_MANT_DIG); mpfr_set_str (y, "4096", 10, MPFR_RNDN); d = 0.125; mpfr_clear_flags (); inexact = mpfr_add_d (x, y, d, MPFR_RNDN); if (inexact != 0) { printf ("Inexact flag error in mpfr_add_d (1)\n"); exit (1); } mpfr_set_str (z, "4096.125", 10, MPFR_RNDN); if (mpfr_cmp (z, x)) { printf ("Error in mpfr_add_d ("); mpfr_out_str (stdout, 10, 7, y, MPFR_RNDN); printf (" + %.20g)\nexpected ", d); mpfr_out_str (stdout, 10, 0, z, MPFR_RNDN); printf ("\ngot "); mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); printf ("\n"); exit (1); } /* (2) check inexact flag */ mpfr_set_prec (x, 2); mpfr_set_prec (z, 2); mpfr_clear_flags (); inexact = mpfr_add_d (x, y, d, MPFR_RNDN); if (inexact == 0) { printf ("Inexact flag error in mpfr_add_d (2)\n"); exit (1); } mpfr_set_str (z, "4096.125", 10, MPFR_RNDN); if (mpfr_cmp (z, x)) { printf ("Error in mpfr_add_d ("); mpfr_out_str (stdout, 10, 0, y, MPFR_RNDN); printf (" + %.20g)\nexpected ", d); mpfr_out_str (stdout, 10, 0, z, MPFR_RNDN); printf ("\ngot "); mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); printf ("\n"); exit (1); } mpfr_clears (x, y, z, (mpfr_ptr) 0); } static void check_nans (void) { #if !defined(MPFR_ERRDIVZERO) mpfr_t x, y; int inexact; mpfr_init2 (x, 123); mpfr_init2 (y, 123); /* nan + 1.0 is nan */ mpfr_set_nan (x); mpfr_clear_flags (); inexact = mpfr_add_d (y, x, 1.0, MPFR_RNDN); MPFR_ASSERTN (inexact == 0); MPFR_ASSERTN ((__gmpfr_flags ^ MPFR_FLAGS_NAN) == 0); MPFR_ASSERTN (mpfr_nan_p (y)); /* +inf + 1.0 == +inf */ mpfr_set_inf (x, 1); mpfr_clear_flags (); inexact = mpfr_add_d (y, x, 1.0, MPFR_RNDN); MPFR_ASSERTN (inexact == 0); MPFR_ASSERTN (__gmpfr_flags == 0); MPFR_ASSERTN (mpfr_inf_p (y)); MPFR_ASSERTN (MPFR_IS_POS (y)); /* -inf + 1.0 == -inf */ mpfr_set_inf (x, -1); mpfr_clear_flags (); inexact = mpfr_add_d (y, x, 1.0, MPFR_RNDN); MPFR_ASSERTN (inexact == 0); MPFR_ASSERTN (__gmpfr_flags == 0); MPFR_ASSERTN (mpfr_inf_p (y)); MPFR_ASSERTN (MPFR_IS_NEG (y)); mpfr_clear (x); mpfr_clear (y); #endif } #define TEST_FUNCTION mpfr_add_d #define DOUBLE_ARG2 #define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1, RANDS) #include "tgeneric.c" int main (void) { tests_start_mpfr (); check_nans (); check_regulars (); test_generic (2, 1000, 100); tests_end_mpfr (); return 0; } #else int main (void) { printf ("Warning! Test disabled for this MPFR version.\n"); return 0; } #endif
// // FDOException.h // FoundationDataObjects // // Created by Doug on 1/4/09. // Copyright 2009 Douglas Richardson. All rights reserved. // #import <Foundation/Foundation.h> #define kFDOInvalidArgumentException @"FDOInvalidArgument" #define kFDOCommandClosedException @"FDOCommandClosedException" #define kFDOTypeConversionFailedException @"FDOTypeConversionFailed" @interface FDOException : NSException { } @end
/* CFUUID.h Copyright (c) 1999-2018, Apple Inc. and the Swift project authors Portions Copyright (c) 2014-2018, Apple Inc. and the Swift project authors Licensed under Apache License v2.0 with Runtime Library Exception See http://swift.org/LICENSE.txt for license information See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors */ #if !defined(__COREFOUNDATION_CFUUID__) #define __COREFOUNDATION_CFUUID__ 1 #include <CoreFoundation/CFBase.h> #include <CoreFoundation/CFString.h> CF_IMPLICIT_BRIDGING_ENABLED CF_EXTERN_C_BEGIN typedef const struct CF_BRIDGED_TYPE(id) __CFUUID * CFUUIDRef; typedef struct { UInt8 byte0; UInt8 byte1; UInt8 byte2; UInt8 byte3; UInt8 byte4; UInt8 byte5; UInt8 byte6; UInt8 byte7; UInt8 byte8; UInt8 byte9; UInt8 byte10; UInt8 byte11; UInt8 byte12; UInt8 byte13; UInt8 byte14; UInt8 byte15; } CFUUIDBytes; /* The CFUUIDBytes struct is a 128-bit struct that contains the raw UUID. A CFUUIDRef can provide such a struct from the CFUUIDGetUUIDBytes() function. This struct is suitable for passing to APIs that expect a raw UUID. */ CF_EXPORT CFTypeID CFUUIDGetTypeID(void); CF_EXPORT CFUUIDRef CFUUIDCreate(CFAllocatorRef alloc); /* Create and return a brand new unique identifier */ CF_EXPORT CFUUIDRef CFUUIDCreateWithBytes(CFAllocatorRef alloc, UInt8 byte0, UInt8 byte1, UInt8 byte2, UInt8 byte3, UInt8 byte4, UInt8 byte5, UInt8 byte6, UInt8 byte7, UInt8 byte8, UInt8 byte9, UInt8 byte10, UInt8 byte11, UInt8 byte12, UInt8 byte13, UInt8 byte14, UInt8 byte15); /* Create and return an identifier with the given contents. This may return an existing instance with its ref count bumped because of uniquing. */ CF_EXPORT CFUUIDRef CFUUIDCreateFromString(CFAllocatorRef alloc, CFStringRef uuidStr); /* Converts from a string representation to the UUID. This may return an existing instance with its ref count bumped because of uniquing. */ CF_EXPORT CFStringRef CFUUIDCreateString(CFAllocatorRef alloc, CFUUIDRef uuid); /* Converts from a UUID to its string representation. */ CF_EXPORT CFUUIDRef CFUUIDGetConstantUUIDWithBytes(CFAllocatorRef alloc, UInt8 byte0, UInt8 byte1, UInt8 byte2, UInt8 byte3, UInt8 byte4, UInt8 byte5, UInt8 byte6, UInt8 byte7, UInt8 byte8, UInt8 byte9, UInt8 byte10, UInt8 byte11, UInt8 byte12, UInt8 byte13, UInt8 byte14, UInt8 byte15); /* This returns an immortal CFUUIDRef that should not be released. It can be used in headers to declare UUID constants with #define. */ CF_EXPORT CFUUIDBytes CFUUIDGetUUIDBytes(CFUUIDRef uuid); CF_EXPORT CFUUIDRef CFUUIDCreateFromUUIDBytes(CFAllocatorRef alloc, CFUUIDBytes bytes); CF_EXTERN_C_END CF_IMPLICIT_BRIDGING_DISABLED #endif /* ! __COREFOUNDATION_CFUUID__ */
/* libwmf ("ipa/x/region.h"): library for wmf conversion Copyright (C) 2000 - various; see CREDITS, ChangeLog, and sources The libwmf 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. The libwmf 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 the libwmf Library; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ static void wmf_x_region_frame (wmfAPI* API,wmfPolyRectangle_t* poly_rect) { wmf_x_t* ddata = WMF_X_GetData (API); wmfPen* pen = 0; XPoint TL; XPoint BR; unsigned int i; int width; int height; WMF_DEBUG (API,"wmf_[x_]region_frame"); if (poly_rect->count == 0) return; setdefaultstyle (API); pen = WMF_DC_PEN (poly_rect->dc); XSetForeground (ddata->display,ddata->gc,get_color (API,WMF_PEN_COLOR (pen))); width = x_width (API,poly_rect->width ); height = x_height (API,poly_rect->height); if (width < 1) width = 1; if (height < 1) height = 1; for (i = 0; i < poly_rect->count; i++) { TL = x_translate (API,poly_rect->TL[i]); BR = x_translate (API,poly_rect->BR[i]); if (ddata->window != None) { XFillRectangle (ddata->display,ddata->window,ddata->gc, TL.x-width,TL.y-height,TL.x-(TL.x-width),BR.y-(TL.y-height)); XFillRectangle (ddata->display,ddata->window,ddata->gc, TL.x-width,BR.y,BR.x-(TL.x-width),BR.y+height-(BR.y)); XFillRectangle (ddata->display,ddata->window,ddata->gc, TL.x,TL.y-height,BR.x+width-(TL.x),TL.y-(TL.y-height)); XFillRectangle (ddata->display,ddata->window,ddata->gc, BR.x,TL.y,BR.x+width-(BR.x),BR.y+height-(TL.y)); } if (ddata->pixmap != None) { XFillRectangle (ddata->display,ddata->pixmap,ddata->gc, TL.x-width,TL.y-height,TL.x-(TL.x-width),BR.y-(TL.y-height)); XFillRectangle (ddata->display,ddata->pixmap,ddata->gc, TL.x-width,BR.y,BR.x-(TL.x-width),BR.y+height-(BR.y)); XFillRectangle (ddata->display,ddata->pixmap,ddata->gc, TL.x,TL.y-height,BR.x+width-(TL.x),TL.y-(TL.y-height)); XFillRectangle (ddata->display,ddata->pixmap,ddata->gc, BR.x,TL.y,BR.x+width-(BR.x),BR.y+height-(TL.y)); } } } static void wmf_x_region_paint (wmfAPI* API,wmfPolyRectangle_t* poly_rect) { wmf_x_t* ddata = WMF_X_GetData (API); XPoint TL; XPoint BR; unsigned int i; WMF_DEBUG (API,"wmf_[x_]region_paint"); if (poly_rect->count == 0) return; if (TO_FILL (poly_rect)) { setbrushstyle (API,poly_rect->dc); for (i = 0; i < poly_rect->count; i++) { TL = x_translate (API,poly_rect->TL[i]); BR = x_translate (API,poly_rect->BR[i]); BR.x -= TL.x; BR.y -= TL.y; if (ddata->window != None) { XFillRectangle (ddata->display,ddata->window,ddata->gc,TL.x,TL.y,BR.x,BR.y); } if (ddata->pixmap != None) { XFillRectangle (ddata->display,ddata->pixmap,ddata->gc,TL.x,TL.y,BR.x,BR.y); } } } } static void wmf_x_region_clip (wmfAPI* API,wmfPolyRectangle_t* poly_rect) { wmf_x_t* ddata = WMF_X_GetData (API); XPoint TL; XPoint BR; XRectangle* rect; unsigned int i; WMF_DEBUG (API,"wmf_[x_]region_clip"); XSetClipMask (ddata->display,ddata->gc,None); if (poly_rect->count == 0) return; rect = (XRectangle*) wmf_malloc (API,poly_rect->count * sizeof (XRectangle)); for (i = 0; i < poly_rect->count; i++) { TL = x_translate (API,poly_rect->TL[i]); BR = x_translate (API,poly_rect->BR[i]); rect[i].x = TL.x; rect[i].y = TL.y; rect[i].width = BR.x - TL.x; rect[i].height = BR.y - TL.y; } XSetClipRectangles (ddata->display,ddata->gc,0,0,rect,poly_rect->count,Unsorted); wmf_free (API,rect); }
/* * * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #include <grpc/support/alloc.h> #include <grpc/support/atm.h> #include <grpc/support/log.h> #include <grpc/support/port_platform.h> #include "src/core/lib/support/env.h" #include "src/core/lib/support/string.h" #include <stdio.h> #include <string.h> extern void gpr_default_log(gpr_log_func_args *args); static gpr_log_func g_log_func = gpr_default_log; static gpr_atm g_min_severity_to_print = GPR_LOG_VERBOSITY_UNSET; const char *gpr_log_severity_string(gpr_log_severity severity) { switch (severity) { case GPR_LOG_SEVERITY_DEBUG: return "D"; case GPR_LOG_SEVERITY_INFO: return "I"; case GPR_LOG_SEVERITY_ERROR: return "E"; } GPR_UNREACHABLE_CODE(return "UNKNOWN"); } void gpr_log_message(const char *file, int line, gpr_log_severity severity, const char *message) { if ((gpr_atm)severity < gpr_atm_no_barrier_load(&g_min_severity_to_print)) return; gpr_log_func_args lfargs; memset(&lfargs, 0, sizeof(lfargs)); lfargs.file = file; lfargs.line = line; lfargs.severity = severity; lfargs.message = message; g_log_func(&lfargs); } void gpr_set_log_verbosity(gpr_log_severity min_severity_to_print) { gpr_atm_no_barrier_store(&g_min_severity_to_print, (gpr_atm)min_severity_to_print); } void gpr_log_verbosity_init() { char *verbosity = gpr_getenv("GRPC_VERBOSITY"); if (verbosity == NULL) return; gpr_atm min_severity_to_print = GPR_LOG_VERBOSITY_UNSET; if (strcmp(verbosity, "DEBUG") == 0) { min_severity_to_print = (gpr_atm)GPR_LOG_SEVERITY_DEBUG; } else if (strcmp(verbosity, "INFO") == 0) { min_severity_to_print = (gpr_atm)GPR_LOG_SEVERITY_INFO; } else if (strcmp(verbosity, "ERROR") == 0) { min_severity_to_print = (gpr_atm)GPR_LOG_SEVERITY_ERROR; } gpr_free(verbosity); if ((gpr_atm_no_barrier_load(&g_min_severity_to_print)) == GPR_LOG_VERBOSITY_UNSET) { gpr_atm_no_barrier_store(&g_min_severity_to_print, min_severity_to_print); } } void gpr_set_log_function(gpr_log_func f) { g_log_func = f ? f : gpr_default_log; }
#ifndef SHADOW_H #define SHADOW_H // platform specific defines #include <_ShadowOs.h> #include <_ShadowArch.h> // primitives #include <standard/Boolean.h> #include <standard/Byte.h> #include <standard/UByte.h> #include <standard/Short.h> #include <standard/UShort.h> #include <standard/Int.h> #include <standard/UInt.h> #include <standard/Code.h> #include <standard/Long.h> #include <standard/ULong.h> #include <standard/Float.h> #include <standard/Double.h> // standard library #include <standard/Object.h> #include <standard/Class.h> #include <standard/String.h> #include <standard/MethodTable.h> #include <standard/Array.h> #include <natives/Pointer.h> #endif
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/mediaconvert/MediaConvert_EXPORTS.h> #include <aws/core/utils/memory/stl/AWSString.h> namespace Aws { namespace MediaConvert { namespace Model { enum class AfdSignaling { NOT_SET, NONE, AUTO, FIXED }; namespace AfdSignalingMapper { AWS_MEDIACONVERT_API AfdSignaling GetAfdSignalingForName(const Aws::String& name); AWS_MEDIACONVERT_API Aws::String GetNameForAfdSignaling(AfdSignaling value); } // namespace AfdSignalingMapper } // namespace Model } // namespace MediaConvert } // namespace Aws
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/frauddetector/FraudDetector_EXPORTS.h> #include <aws/core/utils/memory/stl/AWSString.h> #include <utility> namespace Aws { namespace Utils { namespace Json { class JsonValue; class JsonView; } // namespace Json } // namespace Utils namespace FraudDetector { namespace Model { /** * <p>The message details.</p><p><h3>See Also:</h3> <a * href="http://docs.aws.amazon.com/goto/WebAPI/frauddetector-2019-11-15/FileValidationMessage">AWS * API Reference</a></p> */ class AWS_FRAUDDETECTOR_API FileValidationMessage { public: FileValidationMessage(); FileValidationMessage(Aws::Utils::Json::JsonView jsonValue); FileValidationMessage& operator=(Aws::Utils::Json::JsonView jsonValue); Aws::Utils::Json::JsonValue Jsonize() const; /** * <p>The message title.</p> */ inline const Aws::String& GetTitle() const{ return m_title; } /** * <p>The message title.</p> */ inline bool TitleHasBeenSet() const { return m_titleHasBeenSet; } /** * <p>The message title.</p> */ inline void SetTitle(const Aws::String& value) { m_titleHasBeenSet = true; m_title = value; } /** * <p>The message title.</p> */ inline void SetTitle(Aws::String&& value) { m_titleHasBeenSet = true; m_title = std::move(value); } /** * <p>The message title.</p> */ inline void SetTitle(const char* value) { m_titleHasBeenSet = true; m_title.assign(value); } /** * <p>The message title.</p> */ inline FileValidationMessage& WithTitle(const Aws::String& value) { SetTitle(value); return *this;} /** * <p>The message title.</p> */ inline FileValidationMessage& WithTitle(Aws::String&& value) { SetTitle(std::move(value)); return *this;} /** * <p>The message title.</p> */ inline FileValidationMessage& WithTitle(const char* value) { SetTitle(value); return *this;} /** * <p>The message content.</p> */ inline const Aws::String& GetContent() const{ return m_content; } /** * <p>The message content.</p> */ inline bool ContentHasBeenSet() const { return m_contentHasBeenSet; } /** * <p>The message content.</p> */ inline void SetContent(const Aws::String& value) { m_contentHasBeenSet = true; m_content = value; } /** * <p>The message content.</p> */ inline void SetContent(Aws::String&& value) { m_contentHasBeenSet = true; m_content = std::move(value); } /** * <p>The message content.</p> */ inline void SetContent(const char* value) { m_contentHasBeenSet = true; m_content.assign(value); } /** * <p>The message content.</p> */ inline FileValidationMessage& WithContent(const Aws::String& value) { SetContent(value); return *this;} /** * <p>The message content.</p> */ inline FileValidationMessage& WithContent(Aws::String&& value) { SetContent(std::move(value)); return *this;} /** * <p>The message content.</p> */ inline FileValidationMessage& WithContent(const char* value) { SetContent(value); return *this;} /** * <p>The message type.</p> */ inline const Aws::String& GetType() const{ return m_type; } /** * <p>The message type.</p> */ inline bool TypeHasBeenSet() const { return m_typeHasBeenSet; } /** * <p>The message type.</p> */ inline void SetType(const Aws::String& value) { m_typeHasBeenSet = true; m_type = value; } /** * <p>The message type.</p> */ inline void SetType(Aws::String&& value) { m_typeHasBeenSet = true; m_type = std::move(value); } /** * <p>The message type.</p> */ inline void SetType(const char* value) { m_typeHasBeenSet = true; m_type.assign(value); } /** * <p>The message type.</p> */ inline FileValidationMessage& WithType(const Aws::String& value) { SetType(value); return *this;} /** * <p>The message type.</p> */ inline FileValidationMessage& WithType(Aws::String&& value) { SetType(std::move(value)); return *this;} /** * <p>The message type.</p> */ inline FileValidationMessage& WithType(const char* value) { SetType(value); return *this;} private: Aws::String m_title; bool m_titleHasBeenSet; Aws::String m_content; bool m_contentHasBeenSet; Aws::String m_type; bool m_typeHasBeenSet; }; } // namespace Model } // namespace FraudDetector } // namespace Aws