text
stringlengths
4
6.14k
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * * the COPYING file, which can be found at the root of the source code * * distribution tree, or in https://www.hdfgroup.org/licenses. * * If you do not have access to either file, you may request a copy from * * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* Programmer: Quincey Koziol * Saturday, May 31, 2003 * * Purpose: Dataspace selection testing functions. */ #define H5S_PACKAGE /*suppress error about including H5Spkg */ #define H5S_TESTING /*suppress warning about H5S testing funcs*/ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ #include "H5Iprivate.h" /* IDs */ #include "H5Spkg.h" /* Dataspaces */ /*-------------------------------------------------------------------------- NAME H5S_select_shape_same_test PURPOSE Determine if two dataspace selections are the same shape USAGE htri_t H5S_select_shape_same_test(sid1, sid2) hid_t sid1; IN: 1st dataspace to compare hid_t sid2; IN: 2nd dataspace to compare RETURNS Non-negative TRUE/FALSE on success, negative on failure DESCRIPTION Checks to see if the current selection in the dataspaces are the same dimensionality and shape. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ htri_t H5S_select_shape_same_test(hid_t sid1, hid_t sid2) { H5S_t *space1; /* Pointer to 1st dataspace */ H5S_t *space2; /* Pointer to 2nd dataspace */ htri_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Get dataspace structures */ if (NULL == (space1 = (H5S_t *)H5I_object_verify(sid1, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") if (NULL == (space2 = (H5S_t *)H5I_object_verify(sid2, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") /* Check if the dataspace selections are the same shape */ if ((ret_value = H5S_select_shape_same(space1, space2)) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "unable to compare dataspace selections") done: FUNC_LEAVE_NOAPI(ret_value) } /* H5S_select_shape_same_test() */ /*-------------------------------------------------------------------------- NAME H5S_get_rebuild_status_test PURPOSE Determine the status of hyperslab rebuild USAGE htri_t H5S_inquiry_rebuild_status(hid_t space_id) hid_t space_id; IN: dataspace id RETURNS Non-negative TRUE/FALSE on success, negative on failure DESCRIPTION Query the status of rebuilding the hyperslab GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ htri_t H5S_get_rebuild_status_test(hid_t space_id) { H5S_t *space; /* Pointer to 1st dataspace */ htri_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Get dataspace structures */ if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") ret_value = (htri_t)space->select.sel_info.hslab->diminfo_valid; done: FUNC_LEAVE_NOAPI(ret_value) } /* H5S_get_rebuild_status_test() */
/* $NetBSD: obio.c,v 1.11 2003/07/15 00:25:05 lukem Exp $ */ /*- * Copyright (c) 2001, 2002, 2003 Wasabi Systems, Inc. * All rights reserved. * * Written by Jason R. Thorpe for Wasabi Systems, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed for the NetBSD Project by * Wasabi Systems, Inc. * 4. The name of Wasabi Systems, Inc. may not be used to endorse * or promote products derived from this software without specific prior * written permission. * * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC * 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. */ /* * On-board device autoconfiguration support for Broadcom Sentry5 * based boards. * XXX This is totally bogus and is just enough to get the console hopefully * running on the sentry5. */ #include <sys/cdefs.h> __FBSDID("$FreeBSD: soc2013/dpl/head/sys/mips/sentry5/obio.c 202218 2010-01-12 21:36:08Z imp $"); #include <sys/param.h> #include <sys/systm.h> #include <sys/bus.h> #include <sys/kernel.h> #include <sys/module.h> #include <sys/rman.h> #include <sys/malloc.h> #include <machine/bus.h> #include <mips/sentry5/obiovar.h> #include <mips/sentry5/sentry5reg.h> int obio_probe(device_t); int obio_attach(device_t); /* * A bit tricky and hackish. Since we need OBIO to rely * on PCI we make it pseudo-pci device. But there should * be only one such device, so we use this static flag * to prevent false positives on every realPCI device probe. */ static int have_one = 0; int obio_probe(device_t dev) { if (!have_one) { have_one = 1; return 0; } return (ENXIO); } int obio_attach(device_t dev) { struct obio_softc *sc = device_get_softc(dev); sc->oba_st = MIPS_BUS_SPACE_IO; sc->oba_addr = MIPS_PHYS_TO_KSEG1(SENTRY5_UART1ADR); sc->oba_size = 0x03FFFFFF; /* XXX sb pci bus 0 aperture size? */ sc->oba_rman.rm_type = RMAN_ARRAY; sc->oba_rman.rm_descr = "OBIO I/O"; if (rman_init(&sc->oba_rman) != 0 || rman_manage_region(&sc->oba_rman, sc->oba_addr, sc->oba_addr + sc->oba_size) != 0) panic("obio_attach: failed to set up I/O rman"); sc->oba_irq_rman.rm_type = RMAN_ARRAY; sc->oba_irq_rman.rm_descr = "OBIO IRQ"; /* * This module is intended for UART purposes only and * it's IRQ is 4 */ if (rman_init(&sc->oba_irq_rman) != 0 || rman_manage_region(&sc->oba_irq_rman, 4, 4) != 0) panic("obio_attach: failed to set up IRQ rman"); device_add_child(dev, "uart", 0); bus_generic_probe(dev); bus_generic_attach(dev); return (0); } static struct resource * obio_alloc_resource(device_t bus, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags) { struct resource *rv; struct rman *rm; bus_space_handle_t bh = 0; struct obio_softc *sc = device_get_softc(bus); switch (type) { case SYS_RES_IRQ: rm = &sc->oba_irq_rman; break; case SYS_RES_MEMORY: return (NULL); case SYS_RES_IOPORT: rm = &sc->oba_rman; bh = sc->oba_addr; start = bh; break; default: return (NULL); } rv = rman_reserve_resource(rm, start, end, count, flags, child); if (rv == NULL) return (NULL); if (type == SYS_RES_IRQ) return (rv); rman_set_rid(rv, *rid); rman_set_bustag(rv, mips_bus_space_generic); rman_set_bushandle(rv, bh); if (0) { if (bus_activate_resource(child, type, *rid, rv)) { rman_release_resource(rv); return (NULL); } } return (rv); } static int obio_activate_resource(device_t bus, device_t child, int type, int rid, struct resource *r) { return (0); } static device_method_t obio_methods[] = { DEVMETHOD(device_probe, obio_probe), DEVMETHOD(device_attach, obio_attach), DEVMETHOD(bus_alloc_resource, obio_alloc_resource), DEVMETHOD(bus_activate_resource, obio_activate_resource), DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), {0, 0}, }; static driver_t obio_driver = { "obio", obio_methods, sizeof(struct obio_softc), }; static devclass_t obio_devclass; DRIVER_MODULE(obio, pci, obio_driver, obio_devclass, 0, 0);
// Copyright 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 CC_TILES_TILE_H_ #define CC_TILES_TILE_H_ #include <stddef.h> #include <stdint.h> #include "base/macros.h" #include "base/memory/ref_counted.h" #include "cc/raster/tile_task.h" #include "cc/tiles/tile_draw_info.h" #include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/size.h" namespace cc { class PrioritizedTile; class TileManager; struct TilePriority; class CC_EXPORT Tile { public: class CC_EXPORT Deleter { public: void operator()(Tile* tile) const; }; class CC_EXPORT CreateInfo { public: int tiling_i_index; int tiling_j_index; gfx::Rect enclosing_layer_rect; gfx::Rect content_rect; float contents_scale; CreateInfo(int tiling_i_index, int tiling_j_index, const gfx::Rect& enclosing_layer_rect, const gfx::Rect& content_rect, float contents_scale) : tiling_i_index(tiling_i_index), tiling_j_index(tiling_j_index), enclosing_layer_rect(enclosing_layer_rect), content_rect(content_rect), contents_scale(contents_scale) {} }; enum TileRasterFlags { USE_PICTURE_ANALYSIS = 1 << 0, IS_OPAQUE = 1 << 1 }; typedef uint64_t Id; Id id() const { return id_; } // TODO(vmpstr): Move this to the iterators. bool required_for_activation() const { return required_for_activation_; } void set_required_for_activation(bool is_required) { required_for_activation_ = is_required; } bool required_for_draw() const { return required_for_draw_; } void set_required_for_draw(bool is_required) { required_for_draw_ = is_required; } bool use_picture_analysis() const { return !!(flags_ & USE_PICTURE_ANALYSIS); } bool is_opaque() const { return !!(flags_ & IS_OPAQUE); } void AsValueInto(base::trace_event::TracedValue* value) const; const TileDrawInfo& draw_info() const { return draw_info_; } TileDrawInfo& draw_info() { return draw_info_; } float contents_scale() const { return contents_scale_; } const gfx::Rect& content_rect() const { return content_rect_; } const gfx::Rect& enclosing_layer_rect() const { return enclosing_layer_rect_; } int layer_id() const { return layer_id_; } int source_frame_number() const { return source_frame_number_; } size_t GPUMemoryUsageInBytes() const; const gfx::Size& desired_texture_size() const { return content_rect_.size(); } int tiling_i_index() const { return tiling_i_index_; } int tiling_j_index() const { return tiling_j_index_; } void SetInvalidated(const gfx::Rect& invalid_content_rect, Id previous_tile_id) { invalidated_content_rect_ = invalid_content_rect; invalidated_id_ = previous_tile_id; } Id invalidated_id() const { return invalidated_id_; } const gfx::Rect& invalidated_content_rect() const { return invalidated_content_rect_; } bool HasRasterTask() const { return !!raster_task_.get(); } void set_solid_color_analysis_performed(bool performed) { is_solid_color_analysis_performed_ = performed; } bool is_solid_color_analysis_performed() const { return is_solid_color_analysis_performed_; } private: friend class TileManager; friend class FakeTileManager; friend class FakePictureLayerImpl; // Methods called by by tile manager. Tile(TileManager* tile_manager, const CreateInfo& info, int layer_id, int source_frame_number, int flags); ~Tile(); TileManager* const tile_manager_; const gfx::Rect content_rect_; const gfx::Rect enclosing_layer_rect_; const float contents_scale_; TileDrawInfo draw_info_; const int layer_id_; const int source_frame_number_; const int flags_; const int tiling_i_index_; const int tiling_j_index_; bool required_for_activation_ : 1; bool required_for_draw_ : 1; bool is_solid_color_analysis_performed_ : 1; Id id_; // The rect bounding the changes in this Tile vs the previous tile it // replaced. gfx::Rect invalidated_content_rect_; // The |id_| of the Tile that was invalidated and replaced by this tile. Id invalidated_id_; unsigned scheduled_priority_; scoped_refptr<TileTask> raster_task_; DISALLOW_COPY_AND_ASSIGN(Tile); }; using ScopedTilePtr = std::unique_ptr<Tile, Tile::Deleter>; } // namespace cc #endif // CC_TILES_TILE_H_
/*- * Copyright (C) 2012 Margarida Gouveia * 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, * without modification, immediately at the beginning of the file. * 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 ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include <sys/cdefs.h> __FBSDID("$FreeBSD: soc2013/dpl/head/sys/powerpc/wii/platform_wii.c 251174 2013-04-27 06:54:49Z rpaulo $"); #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> #include <sys/bus.h> #include <sys/pcpu.h> #include <sys/proc.h> #include <sys/reboot.h> #include <sys/smp.h> #include <sys/fbio.h> #include <vm/vm.h> #include <vm/pmap.h> #include <machine/bus.h> #include <machine/cpu.h> #include <machine/hid.h> #include <machine/platform.h> #include <machine/platformvar.h> #include <machine/pmap.h> #include <machine/smp.h> #include <machine/spr.h> #include <machine/vmparam.h> #include <powerpc/wii/wii_fbreg.h> #include <powerpc/wii/wii_ipcreg.h> #include "platform_if.h" static int wii_probe(platform_t); static int wii_attach(platform_t); static void wii_mem_regions(platform_t, struct mem_region **, int *, struct mem_region **, int *); static unsigned long wii_timebase_freq(platform_t, struct cpuref *); static void wii_reset(platform_t); static void wii_cpu_idle(sbintime_t); extern void wiibus_reset_system(void); static platform_method_t wii_methods[] = { PLATFORMMETHOD(platform_probe, wii_probe), PLATFORMMETHOD(platform_attach, wii_attach), PLATFORMMETHOD(platform_mem_regions, wii_mem_regions), PLATFORMMETHOD(platform_timebase_freq, wii_timebase_freq), PLATFORMMETHOD(platform_reset, wii_reset), PLATFORMMETHOD_END }; static platform_def_t wii_platform = { "wii", wii_methods, 0 }; PLATFORM_DEF(wii_platform); static int wii_probe(platform_t plat) { register_t vers = mfpvr(); /* * The Wii includes a PowerPC 750CL with custom modifications * ("Broadway"). * For now, we just assume that if we are running on a * PowerPC 750CL, then this platform is a Nintendo Wii. */ if ((vers & 0xfffff0e0) == (MPC750 << 16 | MPC750CL)) return (BUS_PROBE_SPECIFIC); return (ENXIO); } static int wii_attach(platform_t plat) { cpu_idle_hook = wii_cpu_idle; return (0); } #define MEM_REGIONS 2 static struct mem_region avail_regions[MEM_REGIONS]; static void wii_mem_regions(platform_t plat, struct mem_region **phys, int *physsz, struct mem_region **avail, int *availsz) { /* 24MB 1T-SRAM */ avail_regions[0].mr_start = 0x00000000; avail_regions[0].mr_size = 0x01800000; /* * Reserve space for the framebuffer which is located * at the end of this 24MB memory region. See wii_fbreg.h. */ avail_regions[0].mr_size -= WIIFB_FB_LEN; /* 64MB GDDR3 SDRAM */ avail_regions[1].mr_start = 0x10000000; avail_regions[1].mr_size = 0x04000000; /* * Reserve space for the DSP. */ avail_regions[1].mr_start += 0x4000; avail_regions[1].mr_size -= 0x4000; /* * Reserve space for the IOS I/O memory. */ avail_regions[1].mr_size -= WIIIPC_IOH_LEN + 1; *phys = *avail = avail_regions; *physsz = *availsz = MEM_REGIONS; } static u_long wii_timebase_freq(platform_t plat, struct cpuref *cpuref) { /* Bus Frequency (243MHz) / 4 */ return (60750000); } static void wii_reset(platform_t plat __unused) { wiibus_reset_system(); } static void wii_cpu_idle(sbintime_t sbt) { }
// // Copyright (c) 2009, Markus Rickert // 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. // // 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 _RL_MDL_FACTORY_H_ #define _RL_MDL_FACTORY_H_ #include <string> namespace rl { namespace mdl { class Model; class Factory { public: Factory(); virtual ~Factory(); virtual Model* create(const ::std::string& filename); virtual void load(const ::std::string& filename, Model* model) = 0; protected: private: }; } } #endif // _RL_MDL_FACTORY_H_
/* * Copyright (C) 2014 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. * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef DocumentStyleSheetCollector_h #define DocumentStyleSheetCollector_h #include "platform/heap/Handle.h" #include "wtf/HashSet.h" #include "wtf/Vector.h" namespace blink { class CSSStyleSheet; class Document; class StyleSheet; class StyleSheetCollection; class DocumentStyleSheetCollector { // This class contains references to two on-heap collections, therefore // it's unhealthy to have it anywhere but on the stack, where stack // scanning will keep them alive. STACK_ALLOCATED(); public: friend class ImportedDocumentStyleSheetCollector; DocumentStyleSheetCollector(StyleSheetCollection*, HeapVector<Member<StyleSheet>>*, HeapHashSet<Member<Document>>*); ~DocumentStyleSheetCollector(); void appendActiveStyleSheets(const HeapVector<Member<CSSStyleSheet>>&); void appendActiveStyleSheet(CSSStyleSheet*); void appendSheetForList(StyleSheet*); bool hasVisited(Document* document) const { return m_visitedDocuments->contains(document); } void willVisit(Document* document) { m_visitedDocuments->add(document); } private: Member<StyleSheetCollection> m_collection; HeapVector<Member<StyleSheet>>* m_styleSheetsForStyleSheetList; HeapHashSet<Member<Document>>* m_visitedDocuments; }; class ActiveDocumentStyleSheetCollector final : public DocumentStyleSheetCollector { public: ActiveDocumentStyleSheetCollector(StyleSheetCollection&); private: HeapHashSet<Member<Document>> m_visitedDocuments; }; class ImportedDocumentStyleSheetCollector final : public DocumentStyleSheetCollector { public: ImportedDocumentStyleSheetCollector(DocumentStyleSheetCollector&, HeapVector<Member<StyleSheet>>&); }; } // namespace blink #endif // DocumentStyleSheetCollector_h
/*- * Copyright (c) 2006 The FreeBSD Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD: soc2013/dpl/head/lib/libc/resolv/h_errno.c 158835 2006-05-21 11:29:26Z ume $ */ #include <sys/types.h> #include <netinet/in.h> #include <arpa/nameser.h> #include <resolv.h> #undef h_errno extern int h_errno; int * __h_errno(void) { return (&__res_state()->res_h_errno); } void __h_errno_set(res_state res, int err) { h_errno = res->res_h_errno = err; }
/* * sdp-int.h * * Copyright (c) 2001-2003 Maksim Yevmenkin <m_evmenkin@yahoo.com> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE 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. * * $Id: sdp-int.h,v 1.1 2003/09/01 23:01:07 max Exp $ * $FreeBSD: soc2013/dpl/head/lib/libsdp/sdp-int.h 124348 2004-01-09 18:19:12Z emax $ */ #ifndef _SDP_INT_H_ #define _SDP_INT_H_ __BEGIN_DECLS /* * SDP session */ struct sdp_session { uint16_t flags; #define SDP_SESSION_LOCAL (1 << 0) uint16_t tid; /* current session transaction ID (tid) */ uint16_t omtu; /* outgoing MTU (req buffer size) */ uint16_t imtu; /* incoming MTU (rsp buffer size) */ uint8_t *req; /* request buffer (start) */ uint8_t *req_e; /* request buffer (end) */ uint8_t *rsp; /* response buffer (start) */ uint8_t *rsp_e; /* response buffer (end) */ uint32_t cslen; /* continuation state length */ uint8_t cs[16];/* continuation state */ int32_t s; /* L2CAP socket */ int32_t error; /* last error code */ }; typedef struct sdp_session sdp_session_t; typedef struct sdp_session * sdp_session_p; __END_DECLS #endif /* ndef _SDP_INT_H_ */
#ifndef TRACKED_PERSONS_CACHE_H #define TRACKED_PERSONS_CACHE_H #include <map> #include <geometry_msgs/PoseWithCovariance.h> #include <geometry_msgs/TwistWithCovariance.h> #include <spencer_tracking_msgs/TrackedPersons.h> #include "additional_topic_subscriber.h" namespace spencer_tracking_rviz_plugin { typedef unsigned int track_id; /// Data structure for storing information about individual person tracks struct CachedTrackedPerson { Ogre::Vector3 center; geometry_msgs::PoseWithCovariance pose; geometry_msgs::TwistWithCovariance twist; bool isOccluded; }; /// Subscribes to a TrackedPersons topic and caches all TrackedPersons of the current cycle, so that /// the owning rviz::Display can look up track positions etc for visualization. class TrackedPersonsCache { public: typedef std::map<track_id, shared_ptr<CachedTrackedPerson> > CachedTrackedPersonsMap; // Destructor ~TrackedPersonsCache(); /// Create TrackedPersons subscriber and setup RViz properties. void initialize(rviz::Display* display, rviz::DisplayContext* context, ros::NodeHandle update_nh); /// Clear internal state, including all cached track positions. void reset(); /// Lookup information for the given tracked person ID. Returns a null pointer if no information is available. const shared_ptr<CachedTrackedPerson> lookup(track_id trackId); /// Return internal map const CachedTrackedPersonsMap& getMap() { return m_cachedTrackedPersons; } private: // Callback when a new TrackedPersons message has arrived void processTrackedPersonsMessage(const spencer_tracking_msgs::TrackedPersons::ConstPtr& msg); rviz::AdditionalTopicSubscriber<spencer_tracking_msgs::TrackedPersons>* m_tracked_person_subscriber; rviz::Display* m_display; rviz::DisplayContext* m_context; // Our TrackedPerson memory CachedTrackedPersonsMap m_cachedTrackedPersons; }; } #endif // TRACKED_PERSONS_CACHE_H
/* ---------------------------------------------------------------------------- */ /* Atmel Microcontroller Software Support */ /* SAM Software Package License */ /* ---------------------------------------------------------------------------- */ /* Copyright (c) 2015, Atmel Corporation */ /* */ /* All rights reserved. */ /* */ /* Redistribution and use in source and binary forms, with or without */ /* modification, are permitted provided that the following condition is met: */ /* */ /* - Redistributions of source code must retain the above copyright notice, */ /* this list of conditions and the disclaimer below. */ /* */ /* Atmel's name may not be used to endorse or promote products derived from */ /* this software without specific prior written permission. */ /* */ /* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */ /* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */ /* DISCLAIMED. IN NO EVENT SHALL ATMEL 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 _SAM3U_CHIPID_INSTANCE_ #define _SAM3U_CHIPID_INSTANCE_ /* ========== Register definition for CHIPID peripheral ========== */ #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) #define REG_CHIPID_CIDR (0x400E0740U) /**< \brief (CHIPID) Chip ID Register */ #define REG_CHIPID_EXID (0x400E0744U) /**< \brief (CHIPID) Chip ID Extension Register */ #else #define REG_CHIPID_CIDR (*(__I uint32_t*)0x400E0740U) /**< \brief (CHIPID) Chip ID Register */ #define REG_CHIPID_EXID (*(__I uint32_t*)0x400E0744U) /**< \brief (CHIPID) Chip ID Extension Register */ #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */ #endif /* _SAM3U_CHIPID_INSTANCE_ */
/* * Copyright (c) 1990 - 1994, Julianne Frances Haugh * Copyright (c) 1996 - 1997, Marek Michałkiewicz * Copyright (c) 2003 - 2005, Tomasz Kłoczko * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the copyright holders or contributors may not be used to * endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * basename.c - not worth copyrighting :-). Some versions of Linux libc * already have basename(), other versions don't. To avoid confusion, * we will not use the function from libc and use a different name here. * --marekm */ #include <config.h> #ident "$Id$" #include "defines.h" #include "prototypes.h" /*@observer@*/const char *Basename (const char *str) { char *cp = strrchr (str, '/'); return (NULL != cp) ? cp + 1 : str; }
/* * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "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 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 FlowThreadController_h #define FlowThreadController_h #include "core/rendering/RenderView.h" #include <wtf/ListHashSet.h> #include <wtf/OwnPtr.h> namespace WebCore { class RenderFlowThread; class RenderNamedFlowThread; typedef ListHashSet<RenderNamedFlowThread*> RenderNamedFlowThreadList; class FlowThreadController { WTF_MAKE_FAST_ALLOCATED; public: static PassOwnPtr<FlowThreadController> create(RenderView*); ~FlowThreadController(); RenderFlowThread* currentRenderFlowThread() const { return m_currentRenderFlowThread; } void setCurrentRenderFlowThread(RenderFlowThread* flowThread) { m_currentRenderFlowThread = flowThread; } bool isRenderNamedFlowThreadOrderDirty() const { return m_isRenderNamedFlowThreadOrderDirty; } void setIsRenderNamedFlowThreadOrderDirty(bool dirty) { m_isRenderNamedFlowThreadOrderDirty = dirty; if (dirty) m_view->setNeedsLayout(true); } RenderNamedFlowThread* ensureRenderFlowThreadWithName(const AtomicString&); const RenderNamedFlowThreadList* renderNamedFlowThreadList() const { return m_renderNamedFlowThreadList.get(); } bool hasRenderNamedFlowThreads() const { return m_renderNamedFlowThreadList && !m_renderNamedFlowThreadList->isEmpty(); } void layoutRenderNamedFlowThreads(); void styleDidChange(); void registerNamedFlowContentNode(Node*, RenderNamedFlowThread*); void unregisterNamedFlowContentNode(Node*); bool hasFlowThreadsWithAutoLogicalHeightRegions() const { return m_flowThreadsWithAutoLogicalHeightRegions; } void incrementFlowThreadsWithAutoLogicalHeightRegions() { ++m_flowThreadsWithAutoLogicalHeightRegions; } void decrementFlowThreadsWithAutoLogicalHeightRegions() { ASSERT(m_flowThreadsWithAutoLogicalHeightRegions > 0); --m_flowThreadsWithAutoLogicalHeightRegions; } bool updateFlowThreadsNeedingLayout(); bool updateFlowThreadsNeedingTwoStepLayout(); void updateFlowThreadsIntoConstrainedPhase(); #ifndef NDEBUG bool isAutoLogicalHeightRegionsCountConsistent() const; #endif protected: FlowThreadController(RenderView*); void updateFlowThreadsChainIfNecessary(); void resetFlowThreadsWithAutoHeightRegions(); private: RenderView* m_view; RenderFlowThread* m_currentRenderFlowThread; bool m_isRenderNamedFlowThreadOrderDirty; unsigned m_flowThreadsWithAutoLogicalHeightRegions; OwnPtr<RenderNamedFlowThreadList> m_renderNamedFlowThreadList; // maps a content node to its render flow thread. HashMap<Node*, RenderNamedFlowThread*> m_mapNamedFlowContentNodes; }; } #endif
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE675_Duplicate_Operations_on_Resource__fopen_51b.c Label Definition File: CWE675_Duplicate_Operations_on_Resource.label.xml Template File: sources-sinks-51b.tmpl.c */ /* * @description * CWE: 675 Duplicate Operations on Resource * BadSource: fopen Open and close a file using fopen() and flose() * GoodSource: Open a file using fopen() * Sinks: * GoodSink: Do nothing * BadSink : Close the file * Flow Variant: 51 Data flow: data passed as an argument from one function to another in different source files * * */ #include "std_testcase.h" #ifndef OMITBAD void CWE675_Duplicate_Operations_on_Resource__fopen_51b_badSink(FILE * data) { /* POTENTIAL FLAW: Close the file in the sink (it may have been closed in the Source) */ fclose(data); } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ void CWE675_Duplicate_Operations_on_Resource__fopen_51b_goodG2BSink(FILE * data) { /* POTENTIAL FLAW: Close the file in the sink (it may have been closed in the Source) */ fclose(data); } /* goodB2G uses the BadSource with the GoodSink */ void CWE675_Duplicate_Operations_on_Resource__fopen_51b_goodB2GSink(FILE * data) { /* Do nothing */ /* FIX: Don't close the file in the sink */ ; /* empty statement needed for some flow variants */ } #endif /* OMITGOOD */
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE121_Stack_Based_Buffer_Overflow__CWE805_int64_t_alloca_loop_54a.c Label Definition File: CWE121_Stack_Based_Buffer_Overflow__CWE805.label.xml Template File: sources-sink-54a.tmpl.c */ /* * @description * CWE: 121 Stack Based Buffer Overflow * BadSource: Set data pointer to the bad buffer * GoodSource: Set data pointer to the good buffer * Sink: loop * BadSink : Copy int64_t array to data using a loop * Flow Variant: 54 Data flow: data passed as an argument from one function through three others to a fifth; all five functions are in different source files * * */ #include "std_testcase.h" #ifndef OMITBAD /* bad function declaration */ void CWE121_Stack_Based_Buffer_Overflow__CWE805_int64_t_alloca_loop_54b_badSink(int64_t * data); void CWE121_Stack_Based_Buffer_Overflow__CWE805_int64_t_alloca_loop_54_bad() { int64_t * data; int64_t * dataBadBuffer = (int64_t *)ALLOCA(50*sizeof(int64_t)); int64_t * dataGoodBuffer = (int64_t *)ALLOCA(100*sizeof(int64_t)); /* FLAW: Set a pointer to a "small" buffer. This buffer will be used in the sinks as a destination * buffer in various memory copying functions using a "large" source buffer. */ data = dataBadBuffer; CWE121_Stack_Based_Buffer_Overflow__CWE805_int64_t_alloca_loop_54b_badSink(data); } #endif /* OMITBAD */ #ifndef OMITGOOD /* good function declaration */ void CWE121_Stack_Based_Buffer_Overflow__CWE805_int64_t_alloca_loop_54b_goodG2BSink(int64_t * data); /* goodG2B uses the GoodSource with the BadSink */ static void goodG2B() { int64_t * data; int64_t * dataBadBuffer = (int64_t *)ALLOCA(50*sizeof(int64_t)); int64_t * dataGoodBuffer = (int64_t *)ALLOCA(100*sizeof(int64_t)); /* FIX: Set a pointer to a "large" buffer, thus avoiding buffer overflows in the sinks. */ data = dataGoodBuffer; CWE121_Stack_Based_Buffer_Overflow__CWE805_int64_t_alloca_loop_54b_goodG2BSink(data); } void CWE121_Stack_Based_Buffer_Overflow__CWE805_int64_t_alloca_loop_54_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()..."); CWE121_Stack_Based_Buffer_Overflow__CWE805_int64_t_alloca_loop_54_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE121_Stack_Based_Buffer_Overflow__CWE805_int64_t_alloca_loop_54_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
/* native_midi: Hardware Midi support for the SDL_mixer library Copyright (C) 2000,2001 Florian 'Proff' Schulze <florian.proff.schulze@gmx.net> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef _NATIVE_MIDI_COMMON_H_ #define _NATIVE_MIDI_COMMON_H_ #include "SDl/SDL.h" /* Midi Status Bytes */ #define MIDI_STATUS_NOTE_OFF 0x8 #define MIDI_STATUS_NOTE_ON 0x9 #define MIDI_STATUS_AFTERTOUCH 0xA #define MIDI_STATUS_CONTROLLER 0xB #define MIDI_STATUS_PROG_CHANGE 0xC #define MIDI_STATUS_PRESSURE 0xD #define MIDI_STATUS_PITCH_WHEEL 0xE #define MIDI_STATUS_SYSEX 0xF /* We store the midi events in a linked list; this way it is easy to shuffle the tracks together later on; and we are flexible in the size of each elemnt. */ typedef struct MIDIEvent { Uint32 time; /* Time at which this midi events occurs */ Uint8 status; /* Status byte */ Uint8 data[2]; /* 1 or 2 bytes additional data for most events */ Uint32 extraLen; /* For some SysEx events, we need additional storage */ Uint8 *extraData; struct MIDIEvent *next; } MIDIEvent; /* Load a midifile to memory, converting it to a list of MIDIEvents. This function returns a linked lists of MIDIEvents, 0 if an error occured. */ MIDIEvent *CreateMIDIEventList(SDL_RWops *rw, Uint16 *division); /* Release a MIDIEvent list after usage. */ void FreeMIDIEventList(MIDIEvent *head); #endif /* _NATIVE_MIDI_COMMON_H_ */
/* Copyright 2019 The Chromium OS Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ /* Kohaku board configuration */ #ifndef __CROS_EC_BOARD_H #define __CROS_EC_BOARD_H /* Baseboard features */ #include "baseboard.h" #define CONFIG_DPTF_MOTION_LID_NO_GMR_SENSOR #define CONFIG_DPTF_MULTI_PROFILE #define CONFIG_POWER_BUTTON #define CONFIG_KEYBOARD_PROTOCOL_8042 #define CONFIG_LED_COMMON #define CONFIG_LOW_POWER_IDLE #define CONFIG_HOST_INTERFACE_ESPI #undef CONFIG_UART_TX_BUF_SIZE #define CONFIG_UART_TX_BUF_SIZE 4096 /* Keyboard features */ #define CONFIG_PWM_KBLIGHT /* Sensors */ /* BMI160 Base accel/gyro */ #define CONFIG_ACCEL_INTERRUPTS #define CONFIG_ACCELGYRO_BMI160 #define CONFIG_ACCELGYRO_BMI160_INT_EVENT \ TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL) #define CONFIG_ACCELGYRO_BMI160_INT2_OUTPUT /* Camera VSYNC */ #define CONFIG_SYNC #define CONFIG_SYNC_INT_EVENT \ TASK_EVENT_MOTION_SENSOR_INTERRUPT(VSYNC) /* BMA253 Lid accel */ #define CONFIG_ACCEL_BMA255 #define CONFIG_LID_ANGLE #define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL #define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL #define CONFIG_LID_ANGLE_UPDATE /* BH1730 and TCS3400 ALS */ #define CONFIG_ALS #define ALS_COUNT 2 #define I2C_PORT_ALS I2C_PORT_SENSOR #define CONFIG_ALS_BH1730 #define CONFIG_ALS_TCS3400 #define CONFIG_ALS_TCS3400_INT_EVENT \ TASK_EVENT_MOTION_SENSOR_INTERRUPT(CLEAR_ALS) /* Sensors without hardware FIFO are in forced mode */ #define CONFIG_ACCEL_FORCE_MODE_MASK \ (BIT(LID_ACCEL) | BIT(BASE_ALS) | BIT(CLEAR_ALS)) /* Parameter to calculate LUX on Kohaku */ #define CONFIG_ALS_BH1730_LUXTH_PARAMS /* * Calulation formula depends on characteristic of optical window. * In case of kohaku, we can select two different formula * as characteristic of optical window. * BH1730_LUXTH1_1K is charateristic of optical window. * 1. d1_1K/d0_1K * 1000 < BH1730_LUXTH1_1K * 2. d1_1K/d0_1K * 1000 >= BH1730_LUXTH1_1K * d0 and d1 are unsigned 16 bit. So, d1/d0 max is 65535 * To meet 2nd condition, make BH1730_LUXTH2_1K to (max+1)*1000 * Kohaku will not use both BH1730_LUXTH3_1K condition * and BH1730_LUXTH4_1K condition. */ #define BH1730_LUXTH1_1K 270 #define BH1730_LUXTH1_D0_1K 19200 #define BH1730_LUXTH1_D1_1K 30528 #define BH1730_LUXTH2_1K 655360000 #define BH1730_LUXTH2_D0_1K 11008 #define BH1730_LUXTH2_D1_1K 10752 #define BH1730_LUXTH3_1K 1030 #define BH1730_LUXTH3_D0_1K 11008 #define BH1730_LUXTH3_D1_1K 10752 #define BH1730_LUXTH4_1K 3670 #define BH1730_LUXTH4_D0_1K 11008 #define BH1730_LUXTH4_D1_1K 10752 /* USB Type C and USB PD defines */ #define CONFIG_USB_PD_COMM_LOCKED #define CONFIG_USB_PD_TCPM_PS8751 #define BOARD_TCPC_C0_RESET_HOLD_DELAY PS8XXX_RESET_DELAY_MS #define BOARD_TCPC_C0_RESET_POST_DELAY 0 #define BOARD_TCPC_C1_RESET_HOLD_DELAY PS8XXX_RESET_DELAY_MS #define BOARD_TCPC_C1_RESET_POST_DELAY 0 #define GPIO_USB_C0_TCPC_RST GPIO_USB_C0_TCPC_RST_ODL #define GPIO_USB_C1_TCPC_RST GPIO_USB_C1_TCPC_RST_ODL #define GPIO_BAT_LED_RED_L GPIO_LED_1_L #define GPIO_BAT_LED_GREEN_L GPIO_LED_3_L #define GPIO_PWR_LED_BLUE_L GPIO_LED_2_L /* BC 1.2 */ #define CONFIG_BC12_DETECT_MAX14637 /* Charger features */ /* * The IDCHG current limit is set in 512 mA steps. The value set here is * somewhat specific to the battery pack being currently used. The limit here * was set via experimentation by finding how high it can be set and still boot * the AP successfully, then backing off to provide margin. * * TODO(b/133444665): Revisit this threshold once peak power consumption tuning * for the AP is completed. */ #define CONFIG_CHARGER_BQ25710_IDCHG_LIMIT_MA 6144 #define CONFIG_BATTERY_CHECK_CHARGE_TEMP_LIMITS #define CONFIG_CHARGER_PROFILE_OVERRIDE /* Volume Button feature */ #define CONFIG_VOLUME_BUTTONS #define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL #define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL /* Thermal features */ #define CONFIG_TEMP_SENSOR_POWER #define CONFIG_THERMISTOR #define CONFIG_THROTTLE_AP #define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B /* * Macros for GPIO signals used in common code that don't match the * schematic names. Signal names in gpio.inc match the schematic and are * then redefined here to so it's more clear which signal is being used for * which purpose. */ #define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L #define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L #define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL #define GPIO_AC_PRESENT GPIO_ACOK_OD #define GPIO_PG_EC_RSMRST_ODL GPIO_PG_EC_RSMRST_L #define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK #define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L #define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L #define GPIO_TEMP_SENSOR_POWER GPIO_EN_A_RAILS #define GPIO_EN_PP5000 GPIO_EN_PP5000_A #ifndef __ASSEMBLER__ #include "gpio_signal.h" #include "registers.h" /* GPIO signals updated base on board version. */ extern enum gpio_signal gpio_en_pp5000_a; enum adc_channel { ADC_TEMP_SENSOR_1, /* ADC0 */ ADC_TEMP_SENSOR_2, /* ADC1 */ ADC_TEMP_SENSOR_3, /* ADC2 */ ADC_TEMP_SENSOR_4, /* ADC3 */ ADC_CH_COUNT }; enum sensor_id { LID_ACCEL = 0, BASE_ACCEL, BASE_GYRO, BASE_ALS, VSYNC, CLEAR_ALS, RGB_ALS, SENSOR_COUNT, }; enum pwm_channel { PWM_CH_KBLIGHT, PWM_CH_COUNT }; enum temp_sensor_id { TEMP_SENSOR_1, TEMP_SENSOR_2, TEMP_SENSOR_3, TEMP_SENSOR_4, TEMP_SENSOR_COUNT }; /* List of possible batteries */ enum battery_type { BATTERY_DYNA, BATTERY_SDI, BATTERY_TYPE_COUNT, }; #endif /* !__ASSEMBLER__ */ #endif /* __CROS_EC_BOARD_H */
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE121_Stack_Based_Buffer_Overflow__dest_char_alloca_cat_67b.c Label Definition File: CWE121_Stack_Based_Buffer_Overflow__dest.label.xml Template File: sources-sink-67b.tmpl.c */ /* * @description * CWE: 121 Stack Based Buffer Overflow * BadSource: Set data pointer to the bad buffer * GoodSource: Set data pointer to the good buffer * Sinks: cat * BadSink : Copy string to data using strcat * Flow Variant: 67 Data flow: data passed in a struct from one function to another in different source files * * */ #include "std_testcase.h" #include <wchar.h> typedef struct _CWE121_Stack_Based_Buffer_Overflow__dest_char_alloca_cat_67_structType { char * structFirst; } CWE121_Stack_Based_Buffer_Overflow__dest_char_alloca_cat_67_structType; #ifndef OMITBAD void CWE121_Stack_Based_Buffer_Overflow__dest_char_alloca_cat_67b_badSink(CWE121_Stack_Based_Buffer_Overflow__dest_char_alloca_cat_67_structType myStruct) { char * data = myStruct.structFirst; { char source[100]; memset(source, 'C', 100-1); /* fill with 'C's */ source[100-1] = '\0'; /* null terminate */ /* POTENTIAL FLAW: Possible buffer overflow if the sizeof(data)-strlen(data) is less than the length of source */ strcat(data, source); printLine(data); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ void CWE121_Stack_Based_Buffer_Overflow__dest_char_alloca_cat_67b_goodG2BSink(CWE121_Stack_Based_Buffer_Overflow__dest_char_alloca_cat_67_structType myStruct) { char * data = myStruct.structFirst; { char source[100]; memset(source, 'C', 100-1); /* fill with 'C's */ source[100-1] = '\0'; /* null terminate */ /* POTENTIAL FLAW: Possible buffer overflow if the sizeof(data)-strlen(data) is less than the length of source */ strcat(data, source); printLine(data); } } #endif /* OMITGOOD */
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE121_Stack_Based_Buffer_Overflow__dest_wchar_t_alloca_cat_54d.c Label Definition File: CWE121_Stack_Based_Buffer_Overflow__dest.label.xml Template File: sources-sink-54d.tmpl.c */ /* * @description * CWE: 121 Stack Based Buffer Overflow * BadSource: Set data pointer to the bad buffer * GoodSource: Set data pointer to the good buffer * Sink: cat * BadSink : Copy string to data using wcscat * Flow Variant: 54 Data flow: data passed as an argument from one function through three others to a fifth; all five functions are in different source files * * */ #include "std_testcase.h" #include <wchar.h> /* all the sinks are the same, we just want to know where the hit originated if a tool flags one */ #ifndef OMITBAD /* bad function declaration */ void CWE121_Stack_Based_Buffer_Overflow__dest_wchar_t_alloca_cat_54e_badSink(wchar_t * data); void CWE121_Stack_Based_Buffer_Overflow__dest_wchar_t_alloca_cat_54d_badSink(wchar_t * data) { CWE121_Stack_Based_Buffer_Overflow__dest_wchar_t_alloca_cat_54e_badSink(data); } #endif /* OMITBAD */ #ifndef OMITGOOD /* good function declaration */ void CWE121_Stack_Based_Buffer_Overflow__dest_wchar_t_alloca_cat_54e_goodG2BSink(wchar_t * data); /* goodG2B uses the GoodSource with the BadSink */ void CWE121_Stack_Based_Buffer_Overflow__dest_wchar_t_alloca_cat_54d_goodG2BSink(wchar_t * data) { CWE121_Stack_Based_Buffer_Overflow__dest_wchar_t_alloca_cat_54e_goodG2BSink(data); } #endif /* OMITGOOD */
/*========================================================================= Program: Visualization Toolkit Module: vtkBridgeCellIteratorOne.h Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ // .NAME vtkBridgeCellIteratorOne - Iterate over one cell only of a dataset. // .SECTION See Also // vtkBridgeCellIterator, vtkBridgeDataSet, vtkBridgeCellIteratorStrategy #ifndef vtkBridgeCellIteratorOne_h #define vtkBridgeCellIteratorOne_h #include "vtkBridgeCellIteratorStrategy.h" class vtkBridgeCell; class vtkBridgeDataSet; class vtkBridgeCell; class vtkIdList; class vtkPoints; class vtkCell; class VTKTESTINGGENERICBRIDGE_EXPORT vtkBridgeCellIteratorOne : public vtkBridgeCellIteratorStrategy { public: static vtkBridgeCellIteratorOne *New(); vtkTypeMacro(vtkBridgeCellIteratorOne, vtkBridgeCellIteratorStrategy); void PrintSelf(ostream& os, vtkIndent indent); // Description: // Move iterator to first position if any (loop initialization). void Begin(); // Description: // Is there no cell at iterator position? (exit condition). int IsAtEnd(); // Description: // Cell at current position // \pre not_at_end: !IsAtEnd() // \pre c_exists: c!=0 // THREAD SAFE void GetCell(vtkGenericAdaptorCell *c); // Description: // Cell at current position. // NOT THREAD SAFE // \pre not_at_end: !IsAtEnd() // \post result_exits: result!=0 vtkGenericAdaptorCell *GetCell(); // Description: // Move iterator to next position. (loop progression). // \pre not_at_end: !IsAtEnd() void Next(); // Description: // Used internally by vtkBridgeDataSet. // Iterate on one cell `id' of `ds'. // \pre ds_exists: ds!=0 // \pre valid_id: (id>=0)&&(id<=ds->GetNumberOfCells()) void InitWithOneCell(vtkBridgeDataSet *ds, vtkIdType cellid); // Description: // Used internally by vtkBridgeCell. // Iterate on one cell `c'. // \pre c_exists: c!=0 void InitWithOneCell(vtkBridgeCell *c); // Description: // Used internally by vtkBridgeCell. // Iterate on a boundary cell (defined by its points `pts' with coordinates // `coords', dimension `dim' and unique id `cellid') of a cell. // \pre coords_exist: coords!=0 // \pre pts_exist: pts!=0 // \pre valid_dim: dim>=0 && dim<=2 // \pre valid_points: pts->GetNumberOfIds()>dim void InitWithPoints(vtkPoints *coords, vtkIdList *pts, int dim, vtkIdType cellid); protected: vtkBridgeCellIteratorOne(); virtual ~vtkBridgeCellIteratorOne(); int cIsAtEnd; vtkBridgeDataSet *DataSet; // the structure on which the objet iterates. vtkIdType Id; // the id at current position. vtkBridgeCell *Cell; // cell at current position. vtkCell *InternalCell; private: vtkBridgeCellIteratorOne(const vtkBridgeCellIteratorOne&) VTK_DELETE_FUNCTION; void operator=(const vtkBridgeCellIteratorOne&) VTK_DELETE_FUNCTION; }; #endif
/*----------------------------------------------------------------------------*/ /* Copyright (c) FIRST 2008-2017. All Rights Reserved. */ /* Open Source Software - may be modified and shared by FRC teams. The code */ /* must be accompanied by the FIRST BSD license file in the root directory of */ /* the project. */ /*----------------------------------------------------------------------------*/ #pragma once #include <memory> #include <string> #include "Counter.h" namespace frc { /** * Alias for counter class. * Implement the gear tooth sensor supplied by FIRST. Currently there is no * reverse sensing on the gear tooth sensor, but in future versions we might * implement the necessary timing in the FPGA to sense direction. */ class GearTooth : public Counter { public: /// 55 uSec for threshold static constexpr double kGearToothThreshold = 55e-6; explicit GearTooth(int channel, bool directionSensitive = false); explicit GearTooth(DigitalSource* source, bool directionSensitive = false); explicit GearTooth(std::shared_ptr<DigitalSource> source, bool directionSensitive = false); virtual ~GearTooth() = default; void EnableDirectionSensing(bool directionSensitive); std::string GetSmartDashboardType() const override; }; } // namespace frc
// ============================================================================= // PROJECT CHRONO - http://projectchrono.org // // Copyright (c) 2014 projectchrono.org // All rights reserved. // // Use of this source code is governed by a BSD-style license that can be found // in the LICENSE file at the top level of the distribution and at // http://projectchrono.org/license-chrono.txt. // // ============================================================================= // Authors: Radu Serban // ============================================================================= // // Base class for all vehicle subsystems. // // ============================================================================= #ifndef CH_PART_H #define CH_PART_H #include <string> #include "chrono_vehicle/ChApiVehicle.h" #include "chrono_vehicle/ChSubsysDefs.h" namespace chrono { namespace vehicle { /// @addtogroup vehicle /// @{ /// Base class for a vehicle subsystem. /// It manages the part's name, visualization assets, and contact material. class CH_VEHICLE_API ChPart { public: /// Construct a vehicle subsystem with the specified name. ChPart(const std::string& name ///< [in] name of the subsystem ); virtual ~ChPart() {} /// Get the name identifier for this subsystem. const std::string& GetName() const { return m_name; } /// Set the name identifier for this subsystem. void SetName(const std::string& name) { m_name = name; } /// Set the visualization mode for this subsystem. void SetVisualizationType(VisualizationType vis); /// Add visualization assets to this subsystem, for the specified visualization mode. virtual void AddVisualizationAssets(VisualizationType vis) {} /// Remove all visualization assets from this subsystem. virtual void RemoveVisualizationAssets() {} /// Set coefficient of friction. /// The default value is 0.7 void SetContactFrictionCoefficient(float friction_coefficient) { m_friction = friction_coefficient; } /// Set coefficient of restitution. /// The default value is 0.1 void SetContactRestitutionCoefficient(float restitution_coefficient) { m_restitution = restitution_coefficient; } /// Set contact material properties. /// These values are used to calculate contact material coefficients (if the containing /// system is so configured and if the SMC contact method is being used). /// The default values are: Y = 2e5 and nu = 0.3 void SetContactMaterialProperties(float young_modulus, ///< [in] Young's modulus of elasticity float poisson_ratio ///< [in] Poisson ratio ); /// Set contact material coefficients. /// These values are used directly to compute contact forces (if the containing system /// is so configured and if the SMC contact method is being used). /// The default values are: kn=2e5, gn=40, kt=2e5, gt=20 void SetContactMaterialCoefficients(float kn, ///< [in] normal contact stiffness float gn, ///< [in] normal contact damping float kt, ///< [in] tangential contact stiffness float gt ///< [in] tangential contact damping ); /// Get coefficient of friction for contact material. float GetCoefficientFriction() const { return m_friction; } /// Get coefficient of restitution for contact material. float GetCoefficientRestitution() const { return m_restitution; } /// Get Young's modulus of elasticity for contact material. float GetYoungModulus() const { return m_young_modulus; } /// Get Poisson ratio for contact material. float GetPoissonRatio() const { return m_poisson_ratio; } /// Get normal stiffness coefficient for contact material. float GetKn() const { return m_kn; } /// Get tangential stiffness coefficient for contact material. float GetKt() const { return m_kt; } /// Get normal viscous damping coefficient for contact material. float GetGn() const { return m_gn; } /// Get tangential viscous damping coefficient for contact material. float GetGt() const { return m_gt; } /// Utility function for transforming inertia tensors between centroidal frames. /// It converts an inertia matrix specified in a centroidal frame aligned with the /// vehicle reference frame to an inertia matrix expressed in a centroidal body /// reference frame. static ChMatrix33<> TransformInertiaMatrix( const ChVector<>& moments, ///< moments of inertia in vehicle-aligned centroidal frame const ChVector<>& products, ///< products of inertia in vehicle-aligned centroidal frame const ChMatrix33<>& vehicle_rot, ///< vehicle absolute orientation matrix const ChMatrix33<>& body_rot ///< body absolute orientation matrix ); protected: std::string m_name; float m_friction; ///< contact coefficient of friction float m_restitution; ///< contact coefficient of restitution float m_young_modulus; ///< contact material Young modulus float m_poisson_ratio; ///< contact material Poisson ratio float m_kn; ///< normal contact stiffness float m_gn; ///< normal contact damping float m_kt; ///< tangential contact stiffness float m_gt; ///< tangential contact damping }; /// @} vehicle } // end namespace vehicle } // end namespace chrono #endif
#pragma once #include <Spotinetta/Spotinetta> #include <QPointer> #include "pointers.h" /* NOTE: NEED TO FIX THIS CLASS WITH REGARDS TO SESSION SHARED POINTER */ namespace Sonetta { class PersistentPlaylistIndex { public: PersistentPlaylistIndex() : m_index(-1) { } PersistentPlaylistIndex(const Spotinetta::Session * session, const Spotinetta::Playlist & playlist, int index); ~PersistentPlaylistIndex(); PersistentPlaylistIndex(const PersistentPlaylistIndex &other); PersistentPlaylistIndex & operator = (const PersistentPlaylistIndex &other); Spotinetta::Playlist playlist() const; int index() const; bool isValid() const; private: void setup(); void cleanup(); ObjectScopedPointer<Spotinetta::PlaylistWatcher> m_watcher; QPointer<const Spotinetta::Session> m_session; int m_index; }; inline bool operator == (const PersistentPlaylistIndex &a, const PersistentPlaylistIndex &b) { return a.index() == b.index() && a.playlist() == b.playlist(); } } Q_DECLARE_METATYPE(Sonetta::PersistentPlaylistIndex)
/* * Copyright (C) 2008 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef AXTableColumn_h #define AXTableColumn_h #include "modules/accessibility/AXMockObject.h" #include "modules/accessibility/AXTable.h" namespace blink { class AXObjectCacheImpl; class LayoutTableSection; class AXTableColumn final : public AXMockObject { private: explicit AXTableColumn(AXObjectCacheImpl*); public: static PassRefPtr<AXTableColumn> create(AXObjectCacheImpl*); virtual ~AXTableColumn(); // retrieves the topmost "column" header (th) AXObject* headerObject(); // retrieves the "column" headers (th, scope) from top to bottom void headerObjectsForColumn(AccessibilityChildrenVector&); virtual AccessibilityRole roleValue() const override { return ColumnRole; } void setColumnIndex(int columnIndex) { m_columnIndex = columnIndex; } int columnIndex() const { return m_columnIndex; } virtual void addChildren() override; virtual void setParent(AXObject*) override; virtual LayoutRect elementRect() const override; private: unsigned m_columnIndex; LayoutRect m_columnRect; virtual bool isTableCol() const override { return true; } virtual bool computeAccessibilityIsIgnored() const override; }; DEFINE_AX_OBJECT_TYPE_CASTS(AXTableColumn, isTableCol()); } // namespace blink #endif // AXTableColumn_h
/* dtkVrGestureRecognizer.h --- * * Author: Julien Wintz * Copyright (C) 2008 - Julien Wintz, Inria. * Created: Thu Oct 21 19:11:52 2010 (+0200) * Version: $Id$ * Last-Updated: Fri Nov 5 21:24:49 2010 (+0100) * By: Julien Wintz * Update #: 15 */ /* Commentary: * */ /* Change log: * */ #pragma once #include "dtkVrSupportExport.h" #include <QtCore> class dtkAbstractView; class dtkVrGestureRecognizerPrivate; class DTKVRSUPPORT_EXPORT dtkVrGestureRecognizer : public QObject { Q_OBJECT public: dtkVrGestureRecognizer(void); ~dtkVrGestureRecognizer(void); void setReceiver(QObject *receiver); void setView(dtkAbstractView *view); public slots: void startConnection(const QUrl& server); void stopConnection(void); void postPanEvent(Qt::GestureState state); void postSwipeEvent(Qt::GestureState state); void postPinchEvent(Qt::GestureState state); void postCustomEvent(Qt::GestureState state); void postClearEvent(Qt::GestureState state); private: dtkVrGestureRecognizerPrivate *d; };
#include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <errno.h> #include <grp.h> #include <string.h> /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ /* compile instructions (using c static library, for security, to eliminate shared library that could be manipulated): g++ -static untrusted_execute.c -o untrusted_execute change permissions & set suid: (must be root) chown root untrusted_execute chgrp DAEMON_USER untrusted_execute chmod 4550 untrusted_execute */ /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ int main(int argc, char* argv[]) { /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ /* Verify that we have at least two arguments, which untrusted user to run as, and the name of the program to run... */ if (argc < 3) { fprintf(stderr,"untrusted_execute: ERROR! WRONG NUMBER OF ARGUMENTS\n"); exit(1); } int length = strnlen(argv[1], 16); /* verify the untrusted username which must be of the form "untrustedNN" */ if (length != 11 || strstr(argv[1],"untrusted") != argv[1]) { fprintf(stderr,"untrusted_execute: ERROR! Invalid untrusted user %s\n", argv[1]); exit(1); } char which_untrusted_string[3]; strncpy(which_untrusted_string,argv[1]+9,2); which_untrusted_string[2]='\0'; int which_untrusted = atoi(which_untrusted_string); int res; uid_t euid; /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ /* THIS PROGRAM ASSUMES THAT A SPECIAL UNTRUSTED USER & GROUP EXISTS IN THE SYSTEM IF THEIR IDS CHANGE THIS PROGRAM MUST BE EDITED THE SUID BIT & PERMISSIONS MUST BE SET CORRECTLY ON THE EXECUTABLE */ static const uid_t ROOT_UID = 0; /* root's user id & group id */ static const uid_t NUM_UNTRUSTED = __INSTALL__FILLIN__NUM_UNTRUSTED__; /* num untrusted users */ static const uid_t FIRST_UNTRUSTED_UID = __INSTALL__FILLIN__FIRST_UNTRUSTED_UID__; /* untrusted's user id */ static const uid_t FIRST_UNTRUSTED_GID = __INSTALL__FILLIN__FIRST_UNTRUSTED_GID__; /* untrusted's group id */ static const uid_t DAEMON_UID = __INSTALL__FILLIN__DAEMON_UID__; /* submitty_daemon's user id */ static const uid_t DAEMON_GID = __INSTALL__FILLIN__DAEMON_GID__; /* submitty_daemon's group id */ if (which_untrusted < 0 || which_untrusted >= NUM_UNTRUSTED) { fprintf(stderr,"untrusted_execute: INVALID UNTRUSTED ID %d\n", which_untrusted); exit(1); } uid_t MY_UNTRUSTED_UID = FIRST_UNTRUSTED_UID + which_untrusted; uid_t MY_UNTRUSTED_GID = FIRST_UNTRUSTED_GID + which_untrusted; /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ /* Sanity check, this program must be run by submitty_daemon, with effective uid root (suid root bit must be set) */ if (geteuid() != ROOT_UID || getuid() != DAEMON_UID) { fprintf(stderr,"INTERNAL ERROR: BAD USER\n"); fprintf(stderr,"uid:%d euid:%d",getuid(),geteuid()); exit(1); } /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ /* Check the file permissions of this program owner of this file: root group of this file: DAEMON_GROUP suid bit should be set user(root) rx group(DAEMON_GROUP) rx other nothing */ /* We assume we're on Linux! */ struct stat stat_data; res = stat("/proc/self/exe", &stat_data); if (res != 0) { fprintf(stderr,"INTERNAL ERROR: FAILED TO STAT SELF\n"); perror("stat error: "); exit(1); } static const int CORRECT_PERMS = S_IFREG|S_ISUID|S_IRUSR|S_IXUSR|S_IRGRP|S_IXGRP; if (stat_data.st_mode != CORRECT_PERMS) { fprintf(stderr,"INTERNAL ERROR: file permissions 0x%x (vs 0x%x) are invalid!\n", stat_data.st_mode, CORRECT_PERMS); exit(1); } if (stat_data.st_uid != ROOT_UID || stat_data.st_gid != DAEMON_GID) { fprintf(stderr,"INTERNAL ERROR: file uid %d gid %d are invalid\n", stat_data.st_uid, stat_data.st_gid); exit(1); } /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ /* Drop privileges (groups, gid, uid) */ /* make sure to clear out the secondary groups first */ gid_t my_gid = MY_UNTRUSTED_GID; res = setgroups (1,&my_gid); if (res != 0) { fprintf(stderr,"INTERNAL ERROR: FAILED TO DROP GROUPS (setgroups)\n"); perror("setgroups error: "); exit(1); } /* switch the group id to the untrusted group id */ res = setresgid(MY_UNTRUSTED_GID, MY_UNTRUSTED_GID, MY_UNTRUSTED_GID); if (res != 0) { fprintf(stderr,"INTERNAL ERROR: FAILED TO DROP GROUP PRIVS\n"); perror("setresgid error: "); exit(1); } /* switch the user id to the untrusted user id */ res = setresuid(MY_UNTRUSTED_UID, MY_UNTRUSTED_UID, MY_UNTRUSTED_UID); if (res != 0) { fprintf(stderr,"INTERNAL ERROR: FAILED TO DROP USER PRIVS\n"); perror("setresuid error: "); exit(1); } /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ /* chop off this executable, and run the the program specified by the rest of the args */ char *envp[1] = {NULL}; /* clears the environment variables, etc. */ execve(argv[2], argv+2, envp); perror("exec"); fprintf(stderr,"INTERNAL ERROR: exec failed\n"); fprintf(stderr,"%s\n",argv[1]); exit (1); }
// Copyright (c) 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef TOOLS_GN_SCHEDULER_H_ #define TOOLS_GN_SCHEDULER_H_ #include <map> #include "base/atomic_ref_count.h" #include "base/files/file_path.h" #include "base/macros.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "base/synchronization/lock.h" #include "base/threading/sequenced_worker_pool.h" #include "tools/gn/input_file_manager.h" class Target; // Maintains the thread pool and error state. class Scheduler { public: Scheduler(); ~Scheduler(); bool Run(); base::MessageLoop* main_loop() { return &main_loop_; } base::SequencedWorkerPool* pool() { return pool_.get(); } InputFileManager* input_file_manager() { return input_file_manager_.get(); } bool verbose_logging() const { return verbose_logging_; } void set_verbose_logging(bool v) { verbose_logging_ = v; } // TODO(brettw) data race on this access (benign?). bool is_failed() const { return is_failed_; } void Log(const std::string& verb, const std::string& msg); void FailWithError(const Err& err); void ScheduleWork(const base::Closure& work); void Shutdown(); // Declares that the given file was read and affected the build output. // // TODO(brettw) this is global rather than per-BuildSettings. If we // start using >1 build settings, then we probably want this to take a // BuildSettings object so we know the depdency on a per-build basis. // If moved, most of the Add/Get functions below should move as well. void AddGenDependency(const base::FilePath& file); std::vector<base::FilePath> GetGenDependencies() const; // Tracks calls to write_file for resolving with the unknown generated // inputs (see AddUnknownGeneratedInput below). void AddWrittenFile(const SourceFile& file); // Unknown generated inputs are files that a target declares as an input // in the output directory, but which aren't generated by any dependency. // // Some of these files will be files written by write_file and will be // GenDependencies (see AddWrittenFile above). There are OK and include // things like response files for scripts. Others cases will be ones where // the file is generated by a target that's not a dependency. // // In order to distinguish these two cases, the checking for these input // files needs to be done after all targets are complete. This also has the // nice side effect that if a target generates the file we can find it and // tell the user which dependency is missing. // // The result returned by GetUnknownGeneratedInputs will not count any files // that were written by write_file during execution. void AddUnknownGeneratedInput(const Target* target, const SourceFile& file); std::multimap<SourceFile, const Target*> GetUnknownGeneratedInputs() const; void ClearUnknownGeneratedInputsAndWrittenFiles(); // For testing. // We maintain a count of the things we need to do that works like a // refcount. When this reaches 0, the program exits. void IncrementWorkCount(); void DecrementWorkCount(); private: void LogOnMainThread(const std::string& verb, const std::string& msg); void FailWithErrorOnMainThread(const Err& err); void DoTargetFileWrite(const Target* target); void DoWork(const base::Closure& closure); void OnComplete(); base::MessageLoop main_loop_; scoped_refptr<base::SequencedWorkerPool> pool_; scoped_refptr<InputFileManager> input_file_manager_; base::RunLoop runner_; bool verbose_logging_; base::AtomicRefCount work_count_; mutable base::Lock lock_; bool is_failed_; // Used to track whether the worker pool has been shutdown. This is necessary // to clean up after tests that make a scheduler but don't run the message // loop. bool has_been_shutdown_; // Protected by the lock. See the corresponding Add/Get functions above. std::vector<base::FilePath> gen_dependencies_; std::vector<SourceFile> written_files_; std::multimap<SourceFile, const Target*> unknown_generated_inputs_; DISALLOW_COPY_AND_ASSIGN(Scheduler); }; extern Scheduler* g_scheduler; #endif // TOOLS_GN_SCHEDULER_H_
/*=================================================================== 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 mitkRestorePlanePositionOperation_h_Included #define mitkRestorePlanePositionOperation_h_Included #include "mitkCommon.h" #include "mitkPointOperation.h" #include "mitkNumericTypes.h" namespace mitk { //##Documentation //## TODO class MITK_CORE_EXPORT RestorePlanePositionOperation : public Operation { public: //##Documentation //##@brief Operation that handles all actions on one Point. //## //## @param operationType is the type of the operation (see mitkOperation.h; e.g. move or add; Information for StateMachine::ExecuteOperation()); //## @param point is the information of the point to add or is the information to change a point into //## @param index is e.g. the position in a list which describes the element to change //PointOperation(OperationType operationType, Point3D point, int index = -1, bool selected = true, PointSpecificationType type = PTUNDEFINED); RestorePlanePositionOperation(OperationType operationType, ScalarType width, ScalarType height, Vector3D spacing, unsigned int pos, Vector3D direction, AffineTransform3D::Pointer transform); virtual ~RestorePlanePositionOperation(); Vector3D GetDirectionVector(); ScalarType GetWidth(); ScalarType GetHeight(); Vector3D GetSpacing(); unsigned int GetPos(); AffineTransform3D::Pointer GetTransform(); private: Vector3D m_Spacing; Vector3D m_DirectionVector; ScalarType m_Width; ScalarType m_Height; unsigned int m_Pos; AffineTransform3D::Pointer m_Transform; }; }//namespace mitk #endif
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE121_Stack_Based_Buffer_Overflow__CWE805_struct_declare_memmove_53a.c Label Definition File: CWE121_Stack_Based_Buffer_Overflow__CWE805.label.xml Template File: sources-sink-53a.tmpl.c */ /* * @description * CWE: 121 Stack Based Buffer Overflow * BadSource: Set data pointer to the bad buffer * GoodSource: Set data pointer to the good buffer * Sink: memmove * BadSink : Copy twoIntsStruct array to data using memmove * Flow Variant: 53 Data flow: data passed as an argument from one function through two others to a fourth; all four functions are in different source files * * */ #include "std_testcase.h" #ifndef OMITBAD /* bad function declaration */ void CWE121_Stack_Based_Buffer_Overflow__CWE805_struct_declare_memmove_53b_badSink(twoIntsStruct * data); void CWE121_Stack_Based_Buffer_Overflow__CWE805_struct_declare_memmove_53_bad() { twoIntsStruct * data; twoIntsStruct dataBadBuffer[50]; twoIntsStruct dataGoodBuffer[100]; /* FLAW: Set a pointer to a "small" buffer. This buffer will be used in the sinks as a destination * buffer in various memory copying functions using a "large" source buffer. */ data = dataBadBuffer; CWE121_Stack_Based_Buffer_Overflow__CWE805_struct_declare_memmove_53b_badSink(data); } #endif /* OMITBAD */ #ifndef OMITGOOD /* good function declaration */ void CWE121_Stack_Based_Buffer_Overflow__CWE805_struct_declare_memmove_53b_goodG2BSink(twoIntsStruct * data); /* goodG2B uses the GoodSource with the BadSink */ static void goodG2B() { twoIntsStruct * data; twoIntsStruct dataBadBuffer[50]; twoIntsStruct dataGoodBuffer[100]; /* FIX: Set a pointer to a "large" buffer, thus avoiding buffer overflows in the sinks. */ data = dataGoodBuffer; CWE121_Stack_Based_Buffer_Overflow__CWE805_struct_declare_memmove_53b_goodG2BSink(data); } void CWE121_Stack_Based_Buffer_Overflow__CWE805_struct_declare_memmove_53_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()..."); CWE121_Stack_Based_Buffer_Overflow__CWE805_struct_declare_memmove_53_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE121_Stack_Based_Buffer_Overflow__CWE805_struct_declare_memmove_53_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
#ifndef ALIEMCALCORRECTIONCLUSTERENERGYVARIATION_H #define ALIEMCALCORRECTIONCLUSTERENERGYVARIATION_H #include "AliEmcalCorrectionComponent.h" #include "TRandom3.h" /** * @class AliEmcalCorrectionClusterEnergyVariation * @ingroup EMCALCOREFW * @brief Cluster energy variation component in the EMCal correction framework, for EMCal systematics. * * This component allows the cluster energy to be scaled by a constant factor and smeared by a random value drawn * from a Gaussian with specified width. Note that you must configure the input cluster container (in the YAML file) * with the desired default cluster energy type (nonlincorr, hadcorr, etc) to be shifted/smeared. * The shifted/smeared energy is written into the user-defined cluster energy field AliVCluster::kUserDefEnergy1, * which can then be retrieved in later tasks through AliVCluster::GetUserDefEnergy() or through the usual cluster * container machinery (see http://alidoc.cern.ch/AliPhysics/master/READMEcontainers.html#emcalContainerClusterEnergyCorrections). * * @author James Mulligan <james.mulligan@yale.edu>, Yale University * @date Oct 30 2018 */ class AliEmcalCorrectionClusterEnergyVariation : public AliEmcalCorrectionComponent { public: AliEmcalCorrectionClusterEnergyVariation(); virtual ~AliEmcalCorrectionClusterEnergyVariation(); // Sets up and runs the task Bool_t Initialize(); void UserCreateOutputObjects(); void ExecOnce(); Bool_t Run(); protected: Double_t fEnergyScaleShift; ///< Fraction of cluster energy to shift (positive means upward shift) Double_t fSmearingWidth; ///< Width of Gaussian used to smear cluster energy TRandom3 fRandom; //!<! Random number generator for cluster energy smearing private: AliEmcalCorrectionClusterEnergyVariation(const AliEmcalCorrectionClusterEnergyVariation &); // Not implemented AliEmcalCorrectionClusterEnergyVariation &operator=(const AliEmcalCorrectionClusterEnergyVariation &); // Not implemented // Allows the registration of the class so that it is available to be used by the correction task. static RegisterCorrectionComponent<AliEmcalCorrectionClusterEnergyVariation> reg; /// \cond CLASSIMP ClassDef(AliEmcalCorrectionClusterEnergyVariation, 1); // EMCal cluster energy variation component /// \endcond }; #endif /* ALIEMCALCORRECTIONCLUSTERENERGYVARIATION_H */
// 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_TEST_CHROMEDRIVER_STATUS_H_ #define CHROME_TEST_CHROMEDRIVER_STATUS_H_ #include <string> // WebDriver standard status codes. enum StatusCode { kOk = 0, kUnknownCommand = 9, kUnknownError = 13, kSessionNotCreatedException = 33, // Chrome-specific status codes. kNoSuchSession = 100, kChromeNotReachable, }; // Represents a WebDriver status, which may be an error or ok. class Status { public: explicit Status(StatusCode code); Status(StatusCode code, const std::string& details); Status(StatusCode code, const Status& cause); Status(StatusCode code, const std::string& details, const Status& cause); ~Status(); bool IsOk() const; bool IsError() const; StatusCode code() const; const std::string& message() const; private: StatusCode code_; std::string msg_; }; #endif // CHROME_TEST_CHROMEDRIVER_STATUS_H_
//===--- PrettyPrinter.h - Classes for aiding with AST printing -*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file defines the PrinterHelper interface. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_AST_PRETTY_PRINTER_H #define LLVM_CLANG_AST_PRETTY_PRINTER_H #include "clang/Basic/LangOptions.h" #include "clang/Basic/LLVM.h" namespace clang { class Stmt; class TagDecl; class LangOptions; class PrinterHelper { public: virtual ~PrinterHelper(); virtual bool handledStmt(Stmt* E, raw_ostream& OS) = 0; }; /// \brief Describes how types, statements, expressions, and /// declarations should be printed. struct PrintingPolicy { /// \brief Create a default printing policy for C. PrintingPolicy(const LangOptions &LO) : LangOpts(LO), Indentation(2), SuppressSpecifiers(false), SuppressTagKeyword(false), SuppressTag(false), SuppressScope(false), SuppressUnwrittenScope(false), SuppressInitializers(false), ConstantArraySizeAsWritten(false), AnonymousTagLocations(true), SuppressStrongLifetime(false), Bool(LO.Bool), TerseOutput(false), SuppressAttributes(false), DumpSourceManager(0) { } /// \brief What language we're printing. LangOptions LangOpts; /// \brief The number of spaces to use to indent each line. unsigned Indentation : 8; /// \brief Whether we should suppress printing of the actual specifiers for /// the given type or declaration. /// /// This flag is only used when we are printing declarators beyond /// the first declarator within a declaration group. For example, given: /// /// \code /// const int *x, *y; /// \endcode /// /// SuppressSpecifiers will be false when printing the /// declaration for "x", so that we will print "int *x"; it will be /// \c true when we print "y", so that we suppress printing the /// "const int" type specifier and instead only print the "*y". bool SuppressSpecifiers : 1; /// \brief Whether type printing should skip printing the tag keyword. /// /// This is used when printing the inner type of elaborated types, /// (as the tag keyword is part of the elaborated type): /// /// \code /// struct Geometry::Point; /// \endcode bool SuppressTagKeyword : 1; /// \brief Whether type printing should skip printing the actual tag type. /// /// This is used when the caller needs to print a tag definition in front /// of the type, as in constructs like the following: /// /// \code /// typedef struct { int x, y; } Point; /// \endcode bool SuppressTag : 1; /// \brief Suppresses printing of scope specifiers. bool SuppressScope : 1; /// \brief Suppress printing parts of scope specifiers that don't need /// to be written, e.g., for inline or anonymous namespaces. bool SuppressUnwrittenScope : 1; /// \brief Suppress printing of variable initializers. /// /// This flag is used when printing the loop variable in a for-range /// statement. For example, given: /// /// \code /// for (auto x : coll) /// \endcode /// /// SuppressInitializers will be true when printing "auto x", so that the /// internal initializer constructed for x will not be printed. bool SuppressInitializers : 1; /// \brief Whether we should print the sizes of constant array expressions /// as written in the sources. /// /// This flag is determines whether arrays types declared as /// /// \code /// int a[4+10*10]; /// char a[] = "A string"; /// \endcode /// /// will be printed as written or as follows: /// /// \code /// int a[104]; /// char a[9] = "A string"; /// \endcode bool ConstantArraySizeAsWritten : 1; /// \brief When printing an anonymous tag name, also print the location of /// that entity (e.g., "enum <anonymous at t.h:10:5>"). Otherwise, just /// prints "<anonymous>" for the name. bool AnonymousTagLocations : 1; /// \brief When true, suppress printing of the __strong lifetime qualifier in /// ARC. unsigned SuppressStrongLifetime : 1; /// \brief Whether we can use 'bool' rather than '_Bool', even if the language /// doesn't actually have 'bool' (because, e.g., it is defined as a macro). unsigned Bool : 1; /// \brief Provide a 'terse' output. /// /// For example, in this mode we don't print function bodies, class members, /// declarations inside namespaces etc. Effectively, this should print /// only the requested declaration. unsigned TerseOutput : 1; /// \brief When true, do not print attributes attached to the declaration. /// unsigned SuppressAttributes : 1; /// \brief If we are "dumping" rather than "pretty-printing", this points to /// a SourceManager which will be used to dump SourceLocations. Dumping /// involves printing the internal details of the AST and pretty-printing /// involves printing something similar to source code. SourceManager *DumpSourceManager; }; } // end namespace clang #endif
/* The <unistd.h> header contains a few miscellaneous manifest constants. */ #ifndef _UNISTD_H #define _UNISTD_H /* Values used by access(). POSIX Table 2-6. */ #define F_OK 0 /* test if file exists */ #define X_OK 1 /* test if file is executable */ #define W_OK 2 /* test if file is writable */ #define R_OK 4 /* test if file is readable */ /* Values used for whence in lseek(fd, offset, whence). POSIX Table 2-7. */ #define SEEK_SET 0 /* offset is absolute */ #define SEEK_CUR 1 /* offset is relative to current position */ #define SEEK_END 2 /* offset is relative to end of file */ /* This value is required by POSIX Table 2-8. */ #define _POSIX_VERSION 198808L /* which standard is being conformed to */ /* These three definitions are required by POSIX Sec. 8.2.1.2. */ #define STDIN_FILENO 0 /* file descriptor for stdin */ #define STDOUT_FILENO 1 /* file descriptor for stdout */ #define STDERR_FILENO 2 /* file descriptor for stderr */ /* NULL must be defined in <unistd.h> according to POSIX Sec. 2.8.1. */ #define NULL ((void *)0) /* The following relate to configurable system variables. POSIX Table 4-2. */ #define _SC_ARG_MAX 1 #define _SC_CHILD_MAX 2 #define _SC_CLOCKS_PER_SEC 3 #define _SC_NGROUPS_MAX 4 #define _SC_OPEN_MAX 5 #define _SC_JOB_CONTROL 6 #define _SC_SAVED_IDS 7 #define _SC_VERSION 8 /* The following relate to configurable pathname variables. POSIX Table 5-2. */ #define _PC_LINK_MAX 1 /* link count */ #define _PC_MAX_CANON 2 /* size of the canonical input queue */ #define _PC_MAX_INPUT 3 /* type-ahead buffer size */ #define _PC_NAME_MAX 4 /* file name size */ #define _PC_PATH_MAX 5 /* pathname size */ #define _PC_PIPE_BUF 6 /* pipe size */ #define _PC_NO_TRUNC 7 /* treatment of long name components */ #define _PC_VDISABLE 8 /* tty disable */ #define _PC_CHOWN_RESTRICTED 9 /* chown restricted or not */ /* POSIX defines several options that may be implemented or not, at the * implementer's whim. This implementer has made the following choices: * * _POSIX_JOB_CONTROL not defined: no job control * _POSIX_SAVED_IDS not defined: no saved uid/gid * _POSIX_NO_TRUNC not defined: long path names are truncated * _POSIX_CHOWN_RESTRICTED defined: you can't give away files * _POSIX_VDISABLE defined: tty functions can be disabled */ #define _POSIX_CHOWN_RESTRICTED #define _POSIX_VDISABLE '\t' /* can't set any control char to tab */ /* Function Prototypes. */ #ifndef _ANSI_H #include <ansi.h> #endif _PROTOTYPE( void _exit, (int _status) ); _PROTOTYPE( int access, (char *_path, int _amode) ); _PROTOTYPE( int chdir, (char *_path) ); _PROTOTYPE( int chown, (char *_path, int _owner, int _group) ); _PROTOTYPE( int close, (int _fd) ); _PROTOTYPE( char *ctermid, (char *_s) ); _PROTOTYPE( char *cuserid, (char *_s) ); _PROTOTYPE( int dup, (int _fd) ); _PROTOTYPE( int dup2, (int _fd, int _fd2) ); _PROTOTYPE( int execl, (char *_path, ...) ); _PROTOTYPE( int execle, (char *_path, ...) ); _PROTOTYPE( int execlp, (char *_file, ...) ); _PROTOTYPE( int execv, (char *_path, char *_argv[]) ); _PROTOTYPE( int execve, (char *_path, char *_argv[], char *_envp[]) ); _PROTOTYPE( int execvp, (char *_file, char *_argv[]) ); _PROTOTYPE( pid_t fork, (void) ); _PROTOTYPE( long fpathconf, (int _fd, int _name) ); _PROTOTYPE( char *getcwd, (char *_buf, int _size) ); _PROTOTYPE( gid_t getegid, (void) ); _PROTOTYPE( uid_t geteuid, (void) ); _PROTOTYPE( gid_t getgid, (void) ); _PROTOTYPE( int getgroups, (int _gidsetsize, gid_t _grouplist[]) ); _PROTOTYPE( char *getlogin, (void) ); _PROTOTYPE( pid_t getpgrp, (void) ); _PROTOTYPE( pid_t getpid, (void) ); _PROTOTYPE( pid_t getppid, (void) ); _PROTOTYPE( uid_t getuid, (void) ); _PROTOTYPE( unsigned int alarm, (unsigned int _seconds) ); _PROTOTYPE( unsigned int sleep, (unsigned int _seconds) ); _PROTOTYPE( int isatty, (int _fd) ); _PROTOTYPE( int link, (const char *_path1, const char *_path2) ); _PROTOTYPE( off_t lseek, (int _fd, off_t _offset, int _whence) ); _PROTOTYPE( long pathconf, (char *_path, int _name) ); _PROTOTYPE( int pause, (void) ); _PROTOTYPE( int pipe, (int _fildes[2]) ); _PROTOTYPE( int read, (int _fd, char *_buf, unsigned int _n) ); _PROTOTYPE( int rmdir, (const char *_path) ); _PROTOTYPE( int setgid, (int _gid) ); _PROTOTYPE( int setpgid, (pid_t _pid, pid_t _pgid) ); _PROTOTYPE( pid_t setsid, (void) ); _PROTOTYPE( int setuid, (int _uid) ); _PROTOTYPE( long sysconf, (int _name) ); _PROTOTYPE( pid_t tcgetpgrp, (int _fd) ); _PROTOTYPE( int tcsetpgrp, (int _fd, pid_t _pgrp_id) ); _PROTOTYPE( char *ttyname, (int _fd) ); _PROTOTYPE( int unlink, (const char *_path) ); _PROTOTYPE( int write, (int _fd, char *_buf, unsigned int _n) ); #ifdef _MINIX _PROTOTYPE( char *brk, (char *_addr) ); _PROTOTYPE( int mknod, (const char *_name, int _mode, int _addr) ); _PROTOTYPE( int mknod4, (const char *_name, int _mode, int _addr, unsigned _size) ); _PROTOTYPE( char *mktemp, (char *_template) ); _PROTOTYPE( char *sbrk, (int _incr) ); _PROTOTYPE( int chroot, (const char *_name) ); _PROTOTYPE( int mount, (char *_spec, char *_name, int _flag)); _PROTOTYPE( long ptrace, (int _req, int _pid, long _addr, long _data) ); _PROTOTYPE( int stime, (long *top) ); _PROTOTYPE( int sync, (void) ); _PROTOTYPE( int umount, (const char *_name) ); #endif #endif /* _UNISTD_H */
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE256_Plaintext_Storage_of_Password__w32_char_53d.c Label Definition File: CWE256_Plaintext_Storage_of_Password__w32.label.xml Template File: sources-sinks-53d.tmpl.c */ /* * @description * CWE: 256 Plaintext Storage of Password * BadSource: Read the password from a file * GoodSource: Read the password from a file and decrypt it * Sinks: * GoodSink: Decrypt the password then authenticate the user using LogonUserA() * BadSink : Authenticate the user using LogonUserA() * Flow Variant: 53 Data flow: data passed as an argument from one function through two others to a fourth; all four functions are in different source files * * */ #include "std_testcase.h" #include <wchar.h> #include <windows.h> #include <wincrypt.h> #pragma comment(lib, "advapi32") #pragma comment(lib, "crypt32.lib") #define HASH_INPUT "ABCDEFG123456" /* INCIDENTAL: Hardcoded crypto */ #ifndef OMITBAD void CWE256_Plaintext_Storage_of_Password__w32_char_53d_badSink(char * data) { { HANDLE pHandle; char * username = "User"; char * domain = "Domain"; /* POTENTIAL FLAW: Attempt to login user with password from the source */ if (LogonUserA( username, domain, data, LOGON32_LOGON_NETWORK, LOGON32_PROVIDER_DEFAULT, &pHandle) != 0) { printLine("User logged in successfully."); CloseHandle(pHandle); } else { printLine("Unable to login."); } } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ void CWE256_Plaintext_Storage_of_Password__w32_char_53d_goodG2BSink(char * data) { { HANDLE pHandle; char * username = "User"; char * domain = "Domain"; /* POTENTIAL FLAW: Attempt to login user with password from the source */ if (LogonUserA( username, domain, data, LOGON32_LOGON_NETWORK, LOGON32_PROVIDER_DEFAULT, &pHandle) != 0) { printLine("User logged in successfully."); CloseHandle(pHandle); } else { printLine("Unable to login."); } } } /* goodB2G uses the BadSource with the GoodSink */ void CWE256_Plaintext_Storage_of_Password__w32_char_53d_goodB2GSink(char * data) { { HANDLE pHandle; char * username = "User"; char * domain = "Domain"; char hashData[100] = HASH_INPUT; HCRYPTPROV hCryptProv = 0; HCRYPTHASH hHash = 0; HCRYPTKEY hKey = 0; do { BYTE payload[(100 - 1) * sizeof(char)]; /* same size as data except for NUL terminator */ DWORD payloadBytes; /* Hex-decode the input string into raw bytes */ payloadBytes = decodeHexChars(payload, sizeof(payload), data); /* Wipe the hex string, to prevent it from being given to LogonUserA if * any of the crypto calls fail. */ SecureZeroMemory(data, 100 * sizeof(char)); /* Aquire a Context */ if(!CryptAcquireContext(&hCryptProv, NULL, MS_ENH_RSA_AES_PROV, PROV_RSA_AES, 0)) { break; } /* Create hash handle */ if(!CryptCreateHash(hCryptProv, CALG_SHA_256, 0, 0, &hHash)) { break; } /* Hash the input string */ if(!CryptHashData(hHash, (BYTE*)hashData, strlen(hashData), 0)) { break; } /* Derive an AES key from the hash */ if(!CryptDeriveKey(hCryptProv, CALG_AES_256, hHash, 0, &hKey)) { break; } if(!CryptDecrypt(hKey, 0, 1, 0, payload, &payloadBytes)) { break; } /* Copy back into data and NUL-terminate */ memcpy(data, payload, payloadBytes); data[payloadBytes / sizeof(char)] = '\0'; } while (0); if (hKey) { CryptDestroyKey(hKey); } if (hHash) { CryptDestroyHash(hHash); } if (hCryptProv) { CryptReleaseContext(hCryptProv, 0); } /* FIX: Decrypt the password before using it for authentication */ if (LogonUserA( username, domain, data, LOGON32_LOGON_NETWORK, LOGON32_PROVIDER_DEFAULT, &pHandle) != 0) { printLine("User logged in successfully."); CloseHandle(pHandle); } else { printLine("Unable to login."); } } } #endif /* OMITGOOD */
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE197_Numeric_Truncation_Error__int_rand_to_short_68a.c Label Definition File: CWE197_Numeric_Truncation_Error__int.label.xml Template File: sources-sink-68a.tmpl.c */ /* * @description * CWE: 197 Numeric Truncation Error * BadSource: rand Set data to result of rand(), which may be zero * GoodSource: Less than CHAR_MAX * Sink: to_short * BadSink : Convert data to a short * Flow Variant: 68 Data flow: data passed as a global variable from one function to another in different source files * * */ #include "std_testcase.h" int CWE197_Numeric_Truncation_Error__int_rand_to_short_68_badData; int CWE197_Numeric_Truncation_Error__int_rand_to_short_68_goodG2BData; #ifndef OMITBAD /* bad function declaration */ void CWE197_Numeric_Truncation_Error__int_rand_to_short_68b_badSink(); void CWE197_Numeric_Truncation_Error__int_rand_to_short_68_bad() { int data; /* Initialize data */ data = -1; /* POTENTIAL FLAW: Set data to a random value */ data = RAND32(); CWE197_Numeric_Truncation_Error__int_rand_to_short_68_badData = data; CWE197_Numeric_Truncation_Error__int_rand_to_short_68b_badSink(); } #endif /* OMITBAD */ #ifndef OMITGOOD /* good function declarations */ void CWE197_Numeric_Truncation_Error__int_rand_to_short_68b_goodG2BSink(); /* goodG2B uses the GoodSource with the BadSink */ static void goodG2B() { int data; /* Initialize data */ data = -1; /* FIX: Use a positive integer less than CHAR_MAX*/ data = CHAR_MAX-5; CWE197_Numeric_Truncation_Error__int_rand_to_short_68_goodG2BData = data; CWE197_Numeric_Truncation_Error__int_rand_to_short_68b_goodG2BSink(); } void CWE197_Numeric_Truncation_Error__int_rand_to_short_68_good() { goodG2B(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE197_Numeric_Truncation_Error__int_rand_to_short_68_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE197_Numeric_Truncation_Error__int_rand_to_short_68_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
// Copyright 2015 Samsung Electronics. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef OPENSSL_SSL_WRAPPER_H_ #define OPENSSL_SSL_WRAPPER_H_ #ifdef GCC_4_6_X #undef final #endif #include <openssl/ssl.h> #ifdef GCC_4_6_X #define final #endif #endif
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE121_Stack_Based_Buffer_Overflow__CWE805_int64_t_alloca_loop_68b.c Label Definition File: CWE121_Stack_Based_Buffer_Overflow__CWE805.label.xml Template File: sources-sink-68b.tmpl.c */ /* * @description * CWE: 121 Stack Based Buffer Overflow * BadSource: Set data pointer to the bad buffer * GoodSource: Set data pointer to the good buffer * Sink: loop * BadSink : Copy int64_t array to data using a loop * Flow Variant: 68 Data flow: data passed as a global variable from one function to another in different source files * * */ #include "std_testcase.h" extern int64_t * CWE121_Stack_Based_Buffer_Overflow__CWE805_int64_t_alloca_loop_68_badData; extern int64_t * CWE121_Stack_Based_Buffer_Overflow__CWE805_int64_t_alloca_loop_68_goodG2BData; /* all the sinks are the same, we just want to know where the hit originated if a tool flags one */ #ifndef OMITBAD void CWE121_Stack_Based_Buffer_Overflow__CWE805_int64_t_alloca_loop_68b_badSink() { int64_t * data = CWE121_Stack_Based_Buffer_Overflow__CWE805_int64_t_alloca_loop_68_badData; { int64_t source[100] = {0}; /* fill with 0's */ { size_t i; /* POTENTIAL FLAW: Possible buffer overflow if data < 100 */ for (i = 0; i < 100; i++) { data[i] = source[i]; } printLongLongLine(data[0]); } } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ void CWE121_Stack_Based_Buffer_Overflow__CWE805_int64_t_alloca_loop_68b_goodG2BSink() { int64_t * data = CWE121_Stack_Based_Buffer_Overflow__CWE805_int64_t_alloca_loop_68_goodG2BData; { int64_t source[100] = {0}; /* fill with 0's */ { size_t i; /* POTENTIAL FLAW: Possible buffer overflow if data < 100 */ for (i = 0; i < 100; i++) { data[i] = source[i]; } printLongLongLine(data[0]); } } } #endif /* OMITGOOD */
//===-- MICmnLLDBDebugSessionInfoVarObj.h -----------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #pragma once // Third Party Headers: #include "lldb/API/SBValue.h" #include <map> // In-house headers: #include "MIUtilString.h" //++ //============================================================================ // Details: MI debug session variable object. The static functionality in *this // class manages a map container of *these variable objects. //-- class CMICmnLLDBDebugSessionInfoVarObj { // Enums: public: //++ ---------------------------------------------------------------------- // Details: Enumeration of a variable type that is not a composite type //-- enum varFormat_e { // CODETAG_SESSIONINFO_VARFORMAT_ENUM // *** Order is import here *** eVarFormat_Invalid = 0, eVarFormat_Binary, eVarFormat_Octal, eVarFormat_Decimal, eVarFormat_Hex, eVarFormat_Natural, eVarFormat_count // Always last one }; //++ ---------------------------------------------------------------------- // Details: Enumeration of a variable type by composite or internal type //-- enum varType_e { eVarType_InValid = 0, eVarType_Composite, // i.e. struct eVarType_Internal, // i.e. int eVarType_count // Always last one }; // Statics: public: static varFormat_e GetVarFormatForString(const CMIUtilString &vrStrFormat); static varFormat_e GetVarFormatForChar(char vcFormat); static CMIUtilString GetValueStringFormatted(const lldb::SBValue &vrValue, const varFormat_e veVarFormat); static void VarObjAdd(const CMICmnLLDBDebugSessionInfoVarObj &vrVarObj); static void VarObjDelete(const CMIUtilString &vrVarName); static bool VarObjGet(const CMIUtilString &vrVarName, CMICmnLLDBDebugSessionInfoVarObj &vrwVarObj); static void VarObjUpdate(const CMICmnLLDBDebugSessionInfoVarObj &vrVarObj); static void VarObjIdInc(); static MIuint VarObjIdGet(); static void VarObjIdResetToZero(); static void VarObjClear(); static void VarObjSetFormat(varFormat_e eDefaultFormat); // Methods: public: /* ctor */ CMICmnLLDBDebugSessionInfoVarObj(); /* ctor */ CMICmnLLDBDebugSessionInfoVarObj( const CMIUtilString &vrStrNameReal, const CMIUtilString &vrStrName, const lldb::SBValue &vrValue); /* ctor */ CMICmnLLDBDebugSessionInfoVarObj( const CMIUtilString &vrStrNameReal, const CMIUtilString &vrStrName, const lldb::SBValue &vrValue, const CMIUtilString &vrStrVarObjParentName); /* ctor */ CMICmnLLDBDebugSessionInfoVarObj( const CMICmnLLDBDebugSessionInfoVarObj &vrOther); /* ctor */ CMICmnLLDBDebugSessionInfoVarObj( CMICmnLLDBDebugSessionInfoVarObj &vrOther); /* ctor */ CMICmnLLDBDebugSessionInfoVarObj( CMICmnLLDBDebugSessionInfoVarObj &&vrOther); // CMICmnLLDBDebugSessionInfoVarObj & operator=(const CMICmnLLDBDebugSessionInfoVarObj &vrOther); CMICmnLLDBDebugSessionInfoVarObj & operator=(CMICmnLLDBDebugSessionInfoVarObj &&vrwOther); // const CMIUtilString &GetName() const; const CMIUtilString &GetNameReal() const; const CMIUtilString &GetValueFormatted() const; lldb::SBValue &GetValue(); const lldb::SBValue &GetValue() const; varType_e GetType() const; bool SetVarFormat(const varFormat_e veVarFormat); const CMIUtilString &GetVarParentName() const; void UpdateValue(); // Overridden: public: // From CMICmnBase /* dtor */ virtual ~CMICmnLLDBDebugSessionInfoVarObj(); // Typedefs: private: typedef std::map<CMIUtilString, CMICmnLLDBDebugSessionInfoVarObj> MapKeyToVarObj_t; typedef std::pair<CMIUtilString, CMICmnLLDBDebugSessionInfoVarObj> MapPairKeyToVarObj_t; // Statics: private: static CMIUtilString GetStringFormatted(const MIuint64 vnValue, const char *vpStrValueNatural, varFormat_e veVarFormat); // Methods: private: bool CopyOther(const CMICmnLLDBDebugSessionInfoVarObj &vrOther); bool MoveOther(CMICmnLLDBDebugSessionInfoVarObj &vrwOther); // Attributes: private: static const char *ms_aVarFormatStrings[]; static const char *ms_aVarFormatChars[]; static MapKeyToVarObj_t ms_mapVarIdToVarObj; static MIuint ms_nVarUniqueId; static varFormat_e ms_eDefaultFormat; // overrides "natural" format // // *** Update the copy move constructors and assignment operator *** varFormat_e m_eVarFormat; varType_e m_eVarType; CMIUtilString m_strName; lldb::SBValue m_SBValue; CMIUtilString m_strNameReal; CMIUtilString m_strFormattedValue; CMIUtilString m_strVarObjParentName; // *** Update the copy move constructors and assignment operator *** };
../mumble/PAAudioConfig.h
/* * Copyright 2013 Zynga Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "config.h" #include <stdlib.h> #include <priv.h> #include <stdio.h> #include "memcached.h" /* * this section of code will drop all (Solaris) privileges including * those normally granted to all userland process (basic privileges). The * effect of this is that after running this code, the process will not able * to fork(), exec(), etc. See privileges(5) for more information. */ void drop_privileges(void) { priv_set_t *privs = priv_str_to_set("basic", ",", NULL); if (privs == NULL) { perror("priv_str_to_set"); exit(EXIT_FAILURE); } (void)priv_delset(privs, PRIV_FILE_LINK_ANY); (void)priv_delset(privs, PRIV_PROC_EXEC); (void)priv_delset(privs, PRIV_PROC_FORK); (void)priv_delset(privs, PRIV_PROC_INFO); (void)priv_delset(privs, PRIV_PROC_SESSION); if (setppriv(PRIV_SET, PRIV_PERMITTED, privs) != 0) { perror("setppriv(PRIV_SET, PRIV_PERMITTED)"); exit(EXIT_FAILURE); } priv_emptyset(privs); if (setppriv(PRIV_SET, PRIV_INHERITABLE, privs) != 0) { perror("setppriv(PRIV_SET, PRIV_INHERITABLE)"); exit(EXIT_FAILURE); } if (setppriv(PRIV_SET, PRIV_LIMIT, privs) != 0) { perror("setppriv(PRIV_SET, PRIV_LIMIT)"); exit(EXIT_FAILURE); } priv_freeset(privs); }
#pragma once #include <memory> #include <globjects/Buffer.h> #include <gloperate/rendering/Shape.h> #include <gloperate/rendering/Drawable.h> namespace gloperate { /** * @brief * Point shape */ class GLOPERATE_API Point : public Shape { public: /** * @brief * Constructor * * @param[in] options * Shape options */ Point(cppassist::Flags<ShapeOption> options = ShapeOption::None); /** * @brief * Destructor */ virtual ~Point(); // Virtual AbstractDrawable functions virtual void draw() const override; protected: std::unique_ptr<Drawable> m_drawable; ///< Underlying drawable object std::unique_ptr<globjects::Buffer> m_vertices; ///< Vertex buffer std::unique_ptr<globjects::Buffer> m_texCoords; ///< Texture coordinate buffer }; } // namespace gloperate
// MainViewController.h // // This code is provided under the MIT License. // // Please visit www.count.ly for more information. #import <UIKit/UIKit.h> @interface MainViewController : UIViewController <NSURLConnectionDelegate, NSURLConnectionDataDelegate> @end
#ifndef _MFloatVectorArray #define _MFloatVectorArray // //- // ========================================================================== // Copyright (C) 1995 - 2006 Autodesk, Inc., and/or its licensors. All // rights reserved. // // The coded instructions, statements, computer programs, and/or related // material (collectively the "Data") in these files contain unpublished // information proprietary to Autodesk, Inc. ("Autodesk") and/or its // licensors, which is protected by U.S. and Canadian federal copyright law // and by international treaties. // // The Data may not be disclosed or distributed to third parties or be // copied or duplicated, in whole or in part, without the prior written // consent of Autodesk. // // The copyright notices in the Software and this entire statement, // including the above license grant, this restriction and the following // disclaimer, must be included in all copies of the Software, in whole // or in part, and all derivative works of the Software, unless such copies // or derivative works are solely in the form of machine-executable object // code generated by a source language processor. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. // AUTODESK DOES NOT MAKE AND HEREBY DISCLAIMS ANY EXPRESS OR IMPLIED // WARRANTIES INCLUDING, BUT NOT LIMITED TO, THE WARRANTIES OF // NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, // OR ARISING FROM A COURSE OF DEALING, USAGE, OR TRADE PRACTICE. IN NO // EVENT WILL AUTODESK AND/OR ITS LICENSORS BE LIABLE FOR ANY LOST // REVENUES, DATA, OR PROFITS, OR SPECIAL, DIRECT, INDIRECT, OR // CONSEQUENTIAL DAMAGES, EVEN IF AUTODESK AND/OR ITS LICENSORS HAS // BEEN ADVISED OF THE POSSIBILITY OR PROBABILITY OF SUCH DAMAGES. // ========================================================================== //+ // // CLASS: MFloatVectorArray // // ***************************************************************************** // // CLASS DESCRIPTION (MFloatVectorArray) // // This class implements an array of MFloatVectors. Common convenience // functions are available, and the implementation is compatible with the // internal Maya implementation so that it can be passed efficiently between // plugins and internal maya data structures. // // ***************************************************************************** #if defined __cplusplus // ***************************************************************************** // INCLUDED HEADER FILES #include <maya/MTypes.h> #include <maya/MStatus.h> // ***************************************************************************** // DECLARATIONS #include <maya/MFloatVector.h> // ***************************************************************************** // CLASS DECLARATION (MFloatVectorArray) /// Array of MFloatVectors data type /** Implement an array of MFloatVectors data type. */ #ifdef _WIN32 #pragma warning(disable: 4522) #endif // _WIN32 class OPENMAYA_EXPORT MFloatVectorArray { public: /// MFloatVectorArray(); /// MFloatVectorArray( const MFloatVectorArray& other ); /// MFloatVectorArray( const MFloatVector vectors[], unsigned int count ); /// MFloatVectorArray( const double vectors[][3], unsigned int count ); /// MFloatVectorArray( const float vectors[][3], unsigned int count ); /// MFloatVectorArray( unsigned int initialSize, const MFloatVector &initialValue = MFloatVector::zero ); /// ~MFloatVectorArray(); /// const MFloatVector& operator[]( unsigned int index ) const; /// MFloatVector & operator[]( unsigned int index ); /// MFloatVectorArray & operator=( const MFloatVectorArray & other ); /// MStatus set( const MFloatVector& element, unsigned int index ); /// MStatus set( double element[3], unsigned int index ); /// MStatus set( float element[3], unsigned int index ); /// MStatus setLength( unsigned int length ); /// unsigned int length() const; /// MStatus remove( unsigned int index ); /// MStatus insert( const MFloatVector & element, unsigned int index ); /// MStatus append( const MFloatVector & element ); /// MStatus copy( const MFloatVectorArray& source ); /// MStatus clear(); /// MStatus get( double [][3] ) const; /// MStatus get( float [][3] ) const; /// void setSizeIncrement ( unsigned int newIncrement ); /// unsigned int sizeIncrement () const; /// friend OPENMAYA_EXPORT IOS_REF(ostream) &operator<<(IOS_REF(ostream) &os, const MFloatVectorArray &array); protected: // No protected members private: MFloatVectorArray( void* ); void * arr; struct api_data { float x; float y; float z; }; const api_data* debugPeekValue ; bool own; void syncDebugPeekValue(); static const char* className(); }; #ifdef _WIN32 #pragma warning(default: 4522) #endif // _WIN32 // ***************************************************************************** #endif /* __cplusplus */ #endif /* _MFloatVectorArray */
// ============================================================== // File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2017.2 // Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved. // // ============================================================== #ifndef __convolve_kernel_fbkb__HH__ #define __convolve_kernel_fbkb__HH__ #include "ACMP_fadd.h" #include <systemc> template< int ID, int NUM_STAGE, int din0_WIDTH, int din1_WIDTH, int dout_WIDTH> SC_MODULE(convolve_kernel_fbkb) { sc_core::sc_in_clk clk; sc_core::sc_in<sc_dt::sc_logic> reset; sc_core::sc_in<sc_dt::sc_logic> ce; sc_core::sc_in< sc_dt::sc_lv<din0_WIDTH> > din0; sc_core::sc_in< sc_dt::sc_lv<din1_WIDTH> > din1; sc_core::sc_out< sc_dt::sc_lv<dout_WIDTH> > dout; ACMP_fadd<ID, 9, din0_WIDTH, din1_WIDTH, dout_WIDTH> ACMP_fadd_U; SC_CTOR(convolve_kernel_fbkb): ACMP_fadd_U ("ACMP_fadd_U") { ACMP_fadd_U.clk(clk); ACMP_fadd_U.reset(reset); ACMP_fadd_U.ce(ce); ACMP_fadd_U.din0(din0); ACMP_fadd_U.din1(din1); ACMP_fadd_U.dout(dout); } }; #endif //
/* -*- Mode: C++; -*- */ // C&C NLP tools // Copyright (c) Universities of Edinburgh, Oxford and Sydney // Copyright (c) James R. Curran // // This software is covered by a non-commercial use licence. // See LICENCE.txt for the full text of the licence. // // If LICENCE.txt is not included in this distribution // please email candc@it.usyd.edu.au to obtain a copy. // NLP::Tagger::NER // takes POS/chunk tagged input and add named entity tags to the output // there are two interfaces: // a input/output file interface // a single input sentence/POS tags/chunk tags interface namespace NLP { namespace Taggers { class NER: public Tagger { public: class Config: public Tagger::Config { public: OpPath postags; OpPath chunktags; OpPath gazetteers; Model::Types types; Config(const OpPath *base = 0, Mode mode = DECODE, const std::string &name = "ner", const std::string &desc = "NE tagger config"); }; public: NER(NER::Config &cfg); NER(NER &other); virtual ~NER(void); NLP::TagSet postags(void) const; NLP::TagSet chunktags(void) const; // the set of tags permissible for words not seen in the training data const NLP::Tags &unknown_tags(void) const; // the set of tags permissible for numbers not seen in the training data const NLP::Tags &number_tags(void) const; private: // private implementation trick class Impl; }; } }
// // EntityList.h // MindMeld // // Created by Timothy Tuttle on 10/20/11. // Copyright 2011 Expect Labs, Inc. All rights reserved. // #import <Foundation/Foundation.h> #import "MMCollection.h" #import "MMEntity.h" /** * Represents the [Entities](/docs/endpointSession#getSessionSessionidEntities) collection * in the MindMeld API. The history of [Entity](/docs/endpointEntity) objects, * which are derived from TextEntries or directly posted to the Session. * For examples on how to update this object, look at the [Code Examples](/docs/sdks/ios/codeSnippets#iosCodeSnippet10). */ @interface MMEntityList : MMCollection /** * This method returns an entity inside this list. * This method is deprecated. Instead use [MMCollection objectForID:]. * * @param objectID The ID of the entity to be fetched. * * @return The MMEntity that was found in this list. * @see [MMCollection objectForID:] */ - (MMEntity *)objectForId:(NSString *)objectID DEPRECATED_ATTRIBUTE; @end
#import <UIKit/UIKit.h> NS_ASSUME_NONNULL_BEGIN @interface PCKViewAnimation : NSObject @property (strong, nonatomic) UIView *withView; @property (strong, nonatomic) UIView *fromView; @property (strong, nonatomic) UIView *toView; @property (assign, nonatomic) NSTimeInterval duration; @property (assign, nonatomic) NSTimeInterval delay; @property (assign, nonatomic) CGFloat springWithDamping; @property (assign, nonatomic) CGFloat initialSpringVelocity; @property (assign, nonatomic) UIViewAnimationOptions options; @property (strong, nonatomic) void (^animationBlock)(void); @property (strong, nonatomic, nullable) void (^completionBlock)(BOOL); - (void)animate; - (void)complete; - (void)cancel; @end @interface UIView (StubbedAnimation) + (UIView*)lastWithView; + (UIView*)lastFromView; + (UIView*)lastToView; + (NSTimeInterval)lastAnimationDuration; + (NSTimeInterval)lastAnimationDelay; + (UIViewAnimationOptions)lastAnimationOptions; + (CGFloat)lastAnimationSpringWithDamping; + (CGFloat)lastAnimationInitialSpringVelocity; + (void)pauseAnimations; + (void)resumeAnimations; + (NSArray *)animations; + (nullable PCKViewAnimation *)lastAnimation; + (void)resetAnimations; @end NS_ASSUME_NONNULL_END
// XFileOpenListView.h Version 1.0 // // Author: Hans Dietrich // hdietrich@gmail.com // // This software is released into the public domain. You are free to use // it in any way you like, except that you may not sell this source code. // // This software is provided "as is" with no expressed or implied warranty. // I accept no liability for any damage or loss of business that this // software may cause. // /////////////////////////////////////////////////////////////////////////////// #ifndef XFILEOPENLISTVIEW_H #define XFILEOPENLISTVIEW_H #define XLVM_XP_DO_NOT_PERSIST (-1) #define XLVM_XP_UNDEFINED 0 #define XLVM_XP_ICONS 0x7029 #define XLVM_XP_LIST 0x702B #define XLVM_XP_DETAILS 0x702C #define XLVM_XP_THUMBNAILS 0x702D #define XLVM_XP_TILES 0x702E #define XLVM_VISTA_DO_NOT_PERSIST (-1) #define XLVM_VISTA_UNDEFINED 0 #define XLVM_VISTA_DETAILS 0x704B #define XLVM_VISTA_TILES 0x704C #define XLVM_VISTA_EXTRA_LARGE_ICONS 0x704D #define XLVM_VISTA_MEDIUM_ICONS 0x704E #define XLVM_VISTA_LARGE_ICONS 0x704F #define XLVM_VISTA_SMALL_ICONS 0x7050 #define XLVM_VISTA_LIST 0x7051 /////////////////////////////////////////////////////////////////////////////// // This class is used to subclass the "SHELLDLL_DefView" window in the file // open dialog. // class CXFileOpenListView : public CWnd { public: CXFileOpenListView(CWnd * pDlg = NULL) : m_lastViewMode(0), m_pDialog(pDlg) {} void Init(CWnd * pWnd) { m_pDialog = pWnd; } ~CXFileOpenListView() {} CWnd * m_pDialog; DWORD m_lastViewMode; BOOL m_bRedraw; int GetViewMode(); BOOL SetViewMode(int cmd); protected: int GetVistaViewMode(long lView, CListCtrl * plc); int GetXpViewMode(long lView, CListCtrl * plc); virtual LRESULT WindowProc(UINT msg, WPARAM wParam, LPARAM lParam); }; #endif //XFILEOPENLISTVIEW_H
/* * jdscale.c * * Copyright (C) 1998, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains sample scaling for lossless JPEG. This is a * combination of upscaling the undifferenced sample by 2^Pt and downscaling * the sample to fit into JSAMPLE. */ #define JPEG_INTERNALS #include "jinclude12.h" #include "jpeglib12.h" #include "jlossls12.h" /* Private declarations for lossless codec */ #ifdef D_LOSSLESS_SUPPORTED /* * Private scaler object for lossless decoding. */ typedef struct { int scale_factor; } scaler; typedef scaler * scaler_ptr; /* * Scalers for packing sample differences into JSAMPLEs. */ METHODDEF(void) simple_upscale(j_decompress_ptr cinfo, JDIFFROW diff_buf, JSAMPROW output_buf, JDIMENSION width) { j_lossless_d_ptr losslsd = (j_lossless_d_ptr) cinfo->codec; scaler_ptr scale = (scaler_ptr) losslsd->scaler_private; int scale_factor = scale->scale_factor; unsigned int xindex; for (xindex = 0; xindex < width; xindex++) output_buf[xindex] = (JSAMPLE) (diff_buf[xindex] << scale_factor); } METHODDEF(void) simple_downscale(j_decompress_ptr cinfo, JDIFFROW diff_buf, JSAMPROW output_buf, JDIMENSION width) { j_lossless_d_ptr losslsd = (j_lossless_d_ptr) cinfo->codec; scaler_ptr scale = (scaler_ptr) losslsd->scaler_private; int scale_factor = scale->scale_factor; unsigned int xindex; SHIFT_TEMPS for (xindex = 0; xindex < width; xindex++) output_buf[xindex] = (JSAMPLE) RIGHT_SHIFT(diff_buf[xindex], scale_factor); } METHODDEF(void) noscale(j_decompress_ptr cinfo, JDIFFROW diff_buf, JSAMPROW output_buf, JDIMENSION width) { unsigned int xindex; for (xindex = 0; xindex < width; xindex++) output_buf[xindex] = (JSAMPLE) diff_buf[xindex]; } METHODDEF(void) scaler_start_pass (j_decompress_ptr cinfo) { j_lossless_d_ptr losslsd = (j_lossless_d_ptr) cinfo->codec; scaler_ptr scale = (scaler_ptr) losslsd->scaler_private; int downscale; /* * Downscale by the difference in the input vs. output precision. If the * output precision >= input precision, then do not downscale. */ downscale = BITS_IN_JSAMPLE < cinfo->data_precision ? cinfo->data_precision - BITS_IN_JSAMPLE : 0; scale->scale_factor = cinfo->Al - downscale; /* Set scale functions based on scale_factor (positive = left shift) */ if (scale->scale_factor > 0) losslsd->scaler_scale = simple_upscale; else if (scale->scale_factor < 0) { scale->scale_factor = -scale->scale_factor; losslsd->scaler_scale = simple_downscale; } else losslsd->scaler_scale = noscale; } GLOBAL(void) jinit_d_scaler (j_decompress_ptr cinfo) { j_lossless_d_ptr losslsd = (j_lossless_d_ptr) cinfo->codec; scaler_ptr scale; scale = (scaler_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(scaler)); losslsd->scaler_private = (void *) scale; losslsd->scaler_start_pass = scaler_start_pass; } #endif /* D_LOSSLESS_SUPPORTED */
// // TBSDKAlbumManager+PrintInfo.h // TapsbookSDK // // Created by Xinrong Guo on 9/22/15. // Copyright © 2015 tapsbook. All rights reserved. // #import <TapsbookSDK/TapsbookSDK.h> @interface TBSDKAlbumManager (PrintInfo) - (void)loadPrintInfosForThemeID:(long long)themeID completionBlock:(void (^)(NSArray *result, NSError *error))completionBlock; @end
/* hashmap.h - Foundation library - Public Domain - 2013 Mattias Jansson / Rampant Pixels * * This library provides a cross-platform foundation library in C11 providing basic support data types and * functions to write applications and games in a platform-independent fashion. The latest source code is * always available at * * https://github.com/rampantpixels/foundation_lib * * This library is put in the public domain; you can redistribute it and/or modify it without any restrictions. * */ #pragma once #include <foundation/platform.h> #include <foundation/types.h> FOUNDATION_API hashmap_t* hashmap_allocate( unsigned int buckets, unsigned int bucketsize ); FOUNDATION_API void hashmap_deallocate( hashmap_t* map ); FOUNDATION_API void hashmap_initialize( hashmap_t* map, unsigned int buckets, unsigned int bucketsize ); FOUNDATION_API void hashmap_finalize( hashmap_t* map ); FOUNDATION_API void* hashmap_insert( hashmap_t* map, hash_t key, void* value ); FOUNDATION_API void* hashmap_erase( hashmap_t* map, hash_t key ); FOUNDATION_API void* hashmap_lookup( hashmap_t* map, hash_t key ); FOUNDATION_API bool hashmap_has_key( hashmap_t* map, hash_t key ); FOUNDATION_API unsigned int hashmap_size( hashmap_t* map ); FOUNDATION_API void hashmap_clear( hashmap_t* map );
/* * Phasor * * This code has been extracted from the Csound opcode "phasor". * It has been modified to work as a Soundpipe module. * * Original Author(s): Barry Vercoe, John ffitch, Robin whittle * Year: 1991 * Location: OOps/ugens2.c * */ #include <stdlib.h> #include "soundpipe.h" int sp_phasor_create(sp_phasor **p) { *p = malloc(sizeof(sp_phasor)); return SP_OK; } int sp_phasor_destroy(sp_phasor **p) { free(*p); return SP_OK; } int sp_phasor_init(sp_data *sp, sp_phasor *p, SPFLOAT iphs) { p->freq = 440; p->phs = iphs; p->curphs = iphs; p->onedsr = 1.0 / sp->sr; return SP_OK; } int sp_phasor_compute(sp_data *sp, sp_phasor *p, SPFLOAT *in, SPFLOAT *out) { SPFLOAT phase; SPFLOAT incr; phase = p->curphs; incr = p->freq * p->onedsr; *out = phase; phase += incr; if (phase >= 1.0) { phase -= 1.0; } else if (phase < 0.0) { phase += 1.0; } p->curphs = phase; return SP_OK; }
#ifndef _SWAY_LOOP_H #define _SWAY_LOOP_H #include <stdbool.h> /** * This is an event loop system designed for sway clients, not sway itself. * * The loop consists of file descriptors and timers. Typically the Wayland * display's file descriptor will be one of the fds in the loop. */ struct loop; struct loop_timer; /** * Create an event loop. */ struct loop *loop_create(void); /** * Destroy the event loop (eg. on program termination). */ void loop_destroy(struct loop *loop); /** * Poll the event loop. This will block until one of the fds has data. */ void loop_poll(struct loop *loop); /** * Add a file descriptor to the loop. */ void loop_add_fd(struct loop *loop, int fd, short mask, void (*func)(int fd, short mask, void *data), void *data); /** * Add a timer to the loop. * * When the timer expires, the timer will be removed from the loop and freed. */ struct loop_timer *loop_add_timer(struct loop *loop, int ms, void (*callback)(void *data), void *data); /** * Remove a file descriptor from the loop. */ bool loop_remove_fd(struct loop *loop, int fd); /** * Remove a timer from the loop. */ bool loop_remove_timer(struct loop *loop, struct loop_timer *timer); #endif
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #include <stdbool.h> int test2(int x) { return x; } int test(int b) { return test2(b ? b : 1); } int test1(int b) { int x = b ? b : 1; return x; } int test3(int b) { int x = b ?: 1; return x; } int test4(int b) { return test2(b ?: 1); } int test5(int b) { return b ?: 1; } int test6(int* p) { int z = 1 ? *p : 0; return z; } int test7(int b) { return test2(2 + test2(2)) ?: 2; }
/* * stoplight.c * * 31-1-2003 : GWA : Stub functions created for CS161 Asst1. * * NB: You can use any synchronization primitives available to solve * the stoplight problem in this file. */ /* * * Includes * */ #include <types.h> #include <lib.h> #include <test.h> #include <thread.h> /* * * Constants * */ /* * Number of cars created. */ #define NCARS 20 /* * * Function Definitions * */ /* * gostraight() * * Arguments: * unsigned long cardirection: the direction from which the car * approaches the intersection. * unsigned long carnumber: the car id number for printing purposes. * * Returns: * nothing. * * Notes: * This function should implement passing straight through the * intersection from any direction. * Write and comment this function. */ static void gostraight(unsigned long cardirection, unsigned long carnumber) { /* * Avoid unused variable warnings. */ (void) cardirection; (void) carnumber; } /* * turnleft() * * Arguments: * unsigned long cardirection: the direction from which the car * approaches the intersection. * unsigned long carnumber: the car id number for printing purposes. * * Returns: * nothing. * * Notes: * This function should implement making a left turn through the * intersection from any direction. * Write and comment this function. */ static void turnleft(unsigned long cardirection, unsigned long carnumber) { /* * Avoid unused variable warnings. */ (void) cardirection; (void) carnumber; } /* * turnright() * * Arguments: * unsigned long cardirection: the direction from which the car * approaches the intersection. * unsigned long carnumber: the car id number for printing purposes. * * Returns: * nothing. * * Notes: * This function should implement making a right turn through the * intersection from any direction. * Write and comment this function. */ static void turnright(unsigned long cardirection, unsigned long carnumber) { /* * Avoid unused variable warnings. */ (void) cardirection; (void) carnumber; } /* * approachintersection() * * Arguments: * void * unusedpointer: currently unused. * unsigned long carnumber: holds car id number. * * Returns: * nothing. * * Notes: * Change this function as necessary to implement your solution. These * threads are created by createcars(). Each one must choose a direction * randomly, approach the intersection, choose a turn randomly, and then * complete that turn. The code to choose a direction randomly is * provided, the rest is left to you to implement. Making a turn * or going straight should be done by calling one of the functions * above. */ static void approachintersection(void * unusedpointer, unsigned long carnumber) { int cardirection; /* * Avoid unused variable and function warnings. */ (void) unusedpointer; (void) carnumber; (void) gostraight; (void) turnleft; (void) turnright; /* * cardirection is set randomly. */ cardirection = random() % 4; } /* * createcars() * * Arguments: * int nargs: unused. * char ** args: unused. * * Returns: * 0 on success. * * Notes: * Driver code to start up the approachintersection() threads. You are * free to modiy this code as necessary for your solution. */ int createcars(int nargs, char ** args) { int index, error; /* * Avoid unused variable warnings. */ (void) nargs; (void) args; /* * Start NCARS approachintersection() threads. */ for (index = 0; index < NCARS; index++) { error = thread_fork("approachintersection thread", NULL, index, approachintersection, NULL ); /* * panic() on error. */ if (error) { panic("approachintersection: thread_fork failed: %s\n", strerror(error) ); } } return 0; }
/*========================================================================= Program: OsiriX Copyright (c) OsiriX Team All rights reserved. Distributed under GNU - LGPL See http://www.osirix-viewer.com/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. =========================================================================*/ #import <Cocoa/Cocoa.h> #import "HTTPConnection.h" #import "WebPortalUser.h" @class WebPortal, WebPortalServer, WebPortalSession, WebPortalResponse; @interface WebPortalConnection : HTTPConnection { NSLock *sendLock, *running; WebPortalUser* user; WebPortalSession* session; NSString* requestedPath; NSString* GETParams; NSDictionary* parameters; // GET and POST params WebPortalResponse* response; // POST / PUT support int dataStartIndex; NSMutableArray* multipartData; BOOL postHeaderOK; NSData *postBoundary; NSString *POSTfilename; } -(CFHTTPMessageRef)request; @property(retain,readonly) WebPortalResponse* response; @property(retain,readonly) WebPortalSession* session; @property(retain,readonly) WebPortalUser* user; @property(retain,readonly) NSDictionary* parameters; @property(retain,readonly) NSString* GETParams; @property(assign,readonly) WebPortalServer* server; @property(assign,readonly) WebPortal* portal; @property(assign,readonly) AsyncSocket* asyncSocket; +(NSString*)FormatParams:(NSDictionary*)dict; +(NSDictionary*)ExtractParams:(NSString*)paramsString; -(BOOL)requestIsIPhone; -(BOOL)requestIsIPad; -(BOOL)requestIsIPod; -(BOOL)requestIsIOS; -(BOOL)requestIsMacOS; -(NSString*)portalAddress; -(NSString*)portalURL; -(NSString*)dicomCStorePortString; - (void) fillSessionAndUserVariables; @end
/* * R : A Computer Language for Statistical Data Analysis * Copyright (C) 2012 The R Core Team. * * 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, a copy is available at * http://www.r-project.org/Licenses/ */ #ifdef ENABLE_NLS #include <libintl.h> #undef _ #define _(String) dgettext ("grDevices", String) #else #define _(String) (String) #endif SEXP C_contour(SEXP); SEXP C_contourDef(void); SEXP C_filledcontour(SEXP); SEXP C_image(SEXP); SEXP C_persp(SEXP); SEXP C_abline(SEXP args); SEXP C_arrows(SEXP args); SEXP C_axis(SEXP args); SEXP C_box(SEXP args); SEXP C_clip(SEXP args); SEXP C_convertX(SEXP args); SEXP C_convertY(SEXP args); SEXP C_dend(SEXP args); SEXP C_dendwindow(SEXP args); SEXP C_erase(SEXP args); SEXP C_layout(SEXP args); SEXP C_mtext(SEXP args); SEXP C_path(SEXP args); SEXP C_plotXY(SEXP args); SEXP C_plot_window(SEXP args); SEXP C_polygon(SEXP args); SEXP C_raster(SEXP args); SEXP C_rect(SEXP args); SEXP C_segments(SEXP args); SEXP C_strHeight(SEXP args); SEXP C_strWidth (SEXP args); SEXP C_symbols(SEXP args); SEXP C_text(SEXP args); SEXP C_title(SEXP args); SEXP C_xspline(SEXP args); SEXP C_par(SEXP call, SEXP op, SEXP args, SEXP rho); SEXP C_plot_new(SEXP call, SEXP op, SEXP args, SEXP rho); SEXP C_locator(SEXP call, SEXP op, SEXP args, SEXP rho); SEXP C_identify(SEXP call, SEXP op, SEXP args, SEXP rho); void registerBase(void); void unregisterBase(void); SEXP RunregisterBase(void); SEXP C_StemLeaf(SEXP x, SEXP scale, SEXP swidth, SEXP atom); SEXP C_BinCount(SEXP x, SEXP breaks, SEXP right, SEXP lowest); Rboolean isNAcol(SEXP col, int index, int ncol);
/* GemRB - Infinity Engine Emulator * Copyright (C) 2003 The GemRB Project * * 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 CONTROLANIMATIONS_H #define CONTROLANIMATIONS_H #include "RGBAColor.h" #include "exports.h" #include "globals.h" #include <vector> namespace GemRB { class AnimationFactory; class Control; class GEM_EXPORT ControlAnimation { private: AnimationFactory* bam; Control* control; unsigned int cycle; unsigned int frame; unsigned int anim_phase; bool has_palette; bool is_blended; ieDword colors[8]; public: ControlAnimation(Control* ctl, const ieResRef ResRef, int Cycle = 0); ~ControlAnimation(void); void UpdateAnimation(bool paused); //report if the current resource is the same as descripted by the params bool SameResource(const ieResRef ResRef, int Cycle); void SetPaletteGradients(ieDword *col); void SetBlend(bool b); }; } #endif
/* $Id$ * * linux/arch/cris/traps.c * * Here we handle the break vectors not used by the system call * mechanism, as well as some general stack/register dumping * things. * * Copyright (C) 2000-2002 Axis Communications AB * * Authors: Bjorn Wesen * Hans-Peter Nilsson * */ #include <linux/init.h> #include <linux/module.h> #include <asm/pgtable.h> #include <asm/uaccess.h> static int kstack_depth_to_print = 24; extern int raw_printk(const char *fmt, ...); void show_trace(unsigned long * stack) { unsigned long addr, module_start, module_end; extern char _stext, _etext; int i; raw_printk("\nCall Trace: "); i = 1; module_start = VMALLOC_START; module_end = VMALLOC_END; while (((long) stack & (THREAD_SIZE-1)) != 0) { if (__get_user (addr, stack)) { /* This message matches "failing address" marked s390 in ksymoops, so lines containing it will not be filtered out by ksymoops. */ raw_printk ("Failing address 0x%lx\n", (unsigned long)stack); break; } stack++; /* * If the address is either in the text segment of the * kernel, or in the region which contains vmalloc'ed * memory, it *may* be the address of a calling * routine; if so, print it so that someone tracing * down the cause of the crash will be able to figure * out the call path that was taken. */ if (((addr >= (unsigned long) &_stext) && (addr <= (unsigned long) &_etext)) || ((addr >= module_start) && (addr <= module_end))) { if (i && ((i % 8) == 0)) raw_printk("\n "); raw_printk("[<%08lx>] ", addr); i++; } } } /* * These constants are for searching for possible module text * segments. MODULE_RANGE is a guess of how much space is likely * to be vmalloced. */ #define MODULE_RANGE (8*1024*1024) /* * The output (format, strings and order) is adjusted to be usable with * ksymoops-2.4.1 with some necessary CRIS-specific patches. Please don't * change it unless you're serious about adjusting ksymoops and syncing * with the ksymoops maintainer. */ void show_stack(struct task_struct *task, unsigned long *sp) { unsigned long *stack, addr; int i; /* * debugging aid: "show_stack(NULL);" prints a * back trace. */ if(sp == NULL) { if (task) sp = (unsigned long*)task->thread.ksp; else sp = (unsigned long*)rdsp(); } stack = sp; raw_printk("\nStack from %08lx:\n ", (unsigned long)stack); for(i = 0; i < kstack_depth_to_print; i++) { if (((long) stack & (THREAD_SIZE-1)) == 0) break; if (i && ((i % 8) == 0)) raw_printk("\n "); if (__get_user (addr, stack)) { /* This message matches "failing address" marked s390 in ksymoops, so lines containing it will not be filtered out by ksymoops. */ raw_printk ("Failing address 0x%lx\n", (unsigned long)stack); break; } stack++; raw_printk("%08lx ", addr); } show_trace(sp); } static void (*nmi_handler)(struct pt_regs*); extern void arch_enable_nmi(void); void set_nmi_handler(void (*handler)(struct pt_regs*)) { nmi_handler = handler; arch_enable_nmi(); } void handle_nmi(struct pt_regs* regs) { if (nmi_handler) nmi_handler(regs); } #ifdef CONFIG_DEBUG_NMI_OOPS void oops_nmi_handler(struct pt_regs* regs) { stop_watchdog(); raw_printk("NMI!\n"); show_registers(regs); } static int __init oops_nmi_register(void) { set_nmi_handler(oops_nmi_handler); return 0; } __initcall(oops_nmi_register); #endif #if 0 /* displays a short stack trace */ int show_stack() { unsigned long *sp = (unsigned long *)rdusp(); int i; raw_printk("Stack dump [0x%08lx]:\n", (unsigned long)sp); for(i = 0; i < 16; i++) raw_printk("sp + %d: 0x%08lx\n", i*4, sp[i]); return 0; } #endif void dump_stack(void) { show_stack(NULL, NULL); } EXPORT_SYMBOL(dump_stack); void __init trap_init(void) { /* Nothing needs to be done */ } void spinning_cpu(void* addr) { raw_printk("CPU %d spinning on %X\n", smp_processor_id(), addr); dump_stack(); }
/* range_syntax_lineedit.h * Delegates for editing prefereneces. * * Wireshark - Network traffic analyzer * By Gerald Combs <gerald@wireshark.org> * Copyright 1998 Gerald Combs * * SPDX-License-Identifier: GPL-2.0-or-later */ #ifndef RANGE_SYNTAX_LINEEDIT_H #define RANGE_SYNTAX_LINEEDIT_H #include <ui/qt/widgets/syntax_line_edit.h> #include <QWidget> class RangeSyntaxLineEdit : public SyntaxLineEdit { Q_OBJECT public: explicit RangeSyntaxLineEdit(QWidget *parent = 0); void setMaxRange(unsigned int max); public slots: void checkRange(QString range); private: unsigned int maxRange_; }; #endif // RANGE_SYNTAX_LINEEDIT_H /* * Editor modelines * * Local Variables: * c-basic-offset: 4 * tab-width: 8 * indent-tabs-mode: nil * End: * * ex: set shiftwidth=4 tabstop=8 expandtab: * :indentSize=4:tabSize=8:noTabs=true: */
/* -*- 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: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ #ifdef DIHEDRAL_CLASS // clang-format off DihedralStyle(multi/harmonic/omp,DihedralMultiHarmonicOMP); // clang-format on #else #ifndef LMP_DIHEDRAL_MULTI_HARMONIC_OMP_H #define LMP_DIHEDRAL_MULTI_HARMONIC_OMP_H #include "dihedral_multi_harmonic.h" #include "thr_omp.h" namespace LAMMPS_NS { class DihedralMultiHarmonicOMP : public DihedralMultiHarmonic, public ThrOMP { public: DihedralMultiHarmonicOMP(class LAMMPS *lmp); virtual void compute(int, int); private: template <int EVFLAG, int EFLAG, int NEWTON_BOND> void eval(int ifrom, int ito, ThrData *const thr); }; } // namespace LAMMPS_NS #endif #endif
/* * This file is part of the coreboot project. * * Copyright (C) 2007-2009 coresystems GmbH * * 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 */ #ifndef _PCI_MMIO_CFG_H #define _PCI_MMIO_CFG_H #include <arch/io.h> #if CONFIG_MMCONF_SUPPORT #define DEFAULT_PCIEXBAR CONFIG_MMCONF_BASE_ADDRESS static inline __attribute__ ((always_inline)) u8 pcie_read_config8(pci_devfn_t dev, unsigned int where) { void *addr; addr = (void *)(DEFAULT_PCIEXBAR | dev | where); return read8(addr); } static inline __attribute__ ((always_inline)) u16 pcie_read_config16(pci_devfn_t dev, unsigned int where) { void *addr; addr = (void *)(DEFAULT_PCIEXBAR | dev | (where & ~1)); return read16(addr); } static inline __attribute__ ((always_inline)) u32 pcie_read_config32(pci_devfn_t dev, unsigned int where) { void *addr; addr = (void *)(DEFAULT_PCIEXBAR | dev | (where & ~3)); return read32(addr); } static inline __attribute__ ((always_inline)) void pcie_write_config8(pci_devfn_t dev, unsigned int where, u8 value) { void *addr; addr = (void *)(DEFAULT_PCIEXBAR | dev | where); write8(addr, value); } static inline __attribute__ ((always_inline)) void pcie_write_config16(pci_devfn_t dev, unsigned int where, u16 value) { void *addr; addr = (void *)(DEFAULT_PCIEXBAR | dev | (where & ~1)); write16(addr, value); } static inline __attribute__ ((always_inline)) void pcie_write_config32(pci_devfn_t dev, unsigned int where, u32 value) { void *addr; addr = (void *)(DEFAULT_PCIEXBAR | dev | (where & ~3)); write32(addr, value); } static inline __attribute__ ((always_inline)) void pcie_or_config8(pci_devfn_t dev, unsigned int where, u8 ormask) { u8 value = pcie_read_config8(dev, where); pcie_write_config8(dev, where, value | ormask); } static inline __attribute__ ((always_inline)) void pcie_or_config16(pci_devfn_t dev, unsigned int where, u16 ormask) { u16 value = pcie_read_config16(dev, where); pcie_write_config16(dev, where, value | ormask); } static inline __attribute__ ((always_inline)) void pcie_or_config32(pci_devfn_t dev, unsigned int where, u32 ormask) { u32 value = pcie_read_config32(dev, where); pcie_write_config32(dev, where, value | ormask); } #define pci_mmio_read_config8 pcie_read_config8 #define pci_mmio_read_config16 pcie_read_config16 #define pci_mmio_read_config32 pcie_read_config32 #define pci_mmio_write_config8 pcie_write_config8 #define pci_mmio_write_config16 pcie_write_config16 #define pci_mmio_write_config32 pcie_write_config32 #if CONFIG_MMCONF_SUPPORT_DEFAULT #define pci_read_config8 pcie_read_config8 #define pci_read_config16 pcie_read_config16 #define pci_read_config32 pcie_read_config32 #define pci_write_config8 pcie_write_config8 #define pci_write_config16 pcie_write_config16 #define pci_write_config32 pcie_write_config32 #endif #endif /* CONFIG_MMCONF_SUPPORT */ #endif /* _PCI_MMIO_CFG_H */
/****************************************************************************** * * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * ******************************************************************************/ //============================================================ // include files //============================================================ #include "odm_precomp.h" void odm_DynamicTxPowerInit( IN void * pDM_VOID ) { PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; PADAPTER Adapter = pDM_Odm->Adapter; HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); struct dm_priv *pdmpriv = &pHalData->dmpriv; pdmpriv->bDynamicTxPowerEnable = false; pdmpriv->LastDTPLvl = TxHighPwrLevel_Normal; pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal; }
/* 920429-1.c from the execute part of the gcc torture suite. */ #include <testfwk.h> #ifdef __SDCC #pragma std_c99 #endif typedef unsigned char t;int i,j; t*f(const t*p){t c;c=*p++;i=((c&2)?1:0);j=(c&7)+1;return p;} void testTortureExecute (void){const t*p0="ab",*p1;p1=f(p0);if(p0+1!=p1)ASSERT(0);return;}
/* * Mach Operating System * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. * * Carnegie Mellon requests users of this software to return to * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 * * any improvements or extensions that they make and grant Carnegie Mellon * the rights to redistribute these changes. */ /* * Include file for xpr circular buffer silent tracing. * */ /* * If the kernel flag XPRDEBUG is set, the XPR macro is enabled. The * macro should be invoked something like the following: * XPR(XPR_SYSCALLS, ("syscall: %d, 0x%x\n", syscallno, arg1); * which will expand into the following code: * if (xprflags & XPR_SYSCALLS) * xpr("syscall: %d, 0x%x\n", syscallno, arg1); * Xpr will log the pointer to the printf string and up to 6 arguments, * along with a timestamp and cpuinfo (for multi-processor systems), into * a circular buffer. The actual printf processing is delayed until after * the buffer has been collected. It is assumed that the text/data segments * of the kernel can easily be reconstructed in a post-processor which * performs the printf processing. * * If the XPRDEBUG compilation switch is not set, the XPR macro expands * to nothing. */ #ifndef _KERN_XPR_H_ #define _KERN_XPR_H_ #ifndef KERNEL #include <sys/features.h> #endif /* KERNEL */ #include <machine/xpr.h> #if XPR_DEBUG #define XPR(flags,xprargs) if(xprflags&flags) xpr xprargs extern int xprflags; /* * flags for message types. */ #define XPR_SYSCALLS 0x00000001 #define XPR_TRAPS 0x00000002 #define XPR_SCHED 0x00000004 #define XPR_NPTCP 0x00000008 #define XPR_NP 0x00000010 #define XPR_TCP 0x00000020 #define XPR_VM_OBJECT (1 << 8) #define XPR_VM_OBJECT_CACHE (1 << 9) #define XPR_VM_PAGE (1 << 10) #define XPR_VM_PAGEOUT (1 << 11) #define XPR_MEMORY_OBJECT (1 << 12) #define XPR_VM_FAULT (1 << 13) #define XPR_INODE_PAGER (1 << 14) #define XPR_INODE_PAGER_DATA (1 << 15) #else /* XPR_DEBUG */ #define XPR(flags,xprargs) #endif /* XPR_DEBUG */ struct xprbuf { char *msg; int arg1,arg2,arg3,arg4,arg5; int timestamp; int cpuinfo; }; extern void xpr(char *, int, int, int, int, int); extern void xpr_dump(struct xprbuf *, int); extern void xprinit(void); extern void xprbootstrap(void); #endif /* _KERN_XPR_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. * */ //============================================================================= // // Class for reading plain text from the stream // //============================================================================= #ifndef AGS_SHARED_UTIL_TEXTSTREAMREADER_H #define AGS_SHARED_UTIL_TEXTSTREAMREADER_H #include "ags/shared/util/textreader.h" namespace AGS3 { namespace AGS { namespace Shared { class Stream; class TextStreamReader : public TextReader { public: // TODO: use shared ptr TextStreamReader(Stream *stream); ~TextStreamReader() override; bool IsValid() const override; const Stream *GetStream() const; // TODO: use shared ptr instead void ReleaseStream(); bool EOS() const; // Read single character char ReadChar() override; // Read defined number of characters String ReadString(size_t length) override; // Read till line break String ReadLine() override; // Read till end of available data String ReadAll() override; private: Stream *_stream; }; } // namespace Shared } // namespace AGS } // namespace AGS3 #endif
/* $Id: UIWizardCloneVMPageBasic3.h $ */ /** @file * VBox Qt GUI - UIWizardCloneVMPageBasic3 class declaration. */ /* * Copyright (C) 2011-2012 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; * you can redistribute it and/or modify it under the terms of the GNU * General Public License (GPL) as published by the Free Software * Foundation, in version 2 as it comes in the "COPYING" file of the * VirtualBox OSE distribution. VirtualBox OSE is distributed in the * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. */ #ifndef __UIWizardCloneVMPageBasic3_h__ #define __UIWizardCloneVMPageBasic3_h__ /* GUI includes: */ #include "UIWizardPage.h" /* COM includes: */ #include "COMEnums.h" /* Forward declaration: */ class QRadioButton; class QIRichTextLabel; /* 3rd page of the Clone Virtual Machine wizard (base part): */ class UIWizardCloneVMPage3 : public UIWizardPageBase { protected: /* Constructor: */ UIWizardCloneVMPage3(bool fShowChildsOption); /* Stuff for 'cloneMode' field: */ KCloneMode cloneMode() const; void setCloneMode(KCloneMode cloneMode); /* Variables: */ bool m_fShowChildsOption; /* Widgets: */ QRadioButton *m_pMachineRadio; QRadioButton *m_pMachineAndChildsRadio; QRadioButton *m_pAllRadio; }; /* 3rd page of the Clone Virtual Machine wizard (basic extension): */ class UIWizardCloneVMPageBasic3 : public UIWizardPage, public UIWizardCloneVMPage3 { Q_OBJECT; Q_PROPERTY(KCloneMode cloneMode READ cloneMode WRITE setCloneMode); public: /* Constructor: */ UIWizardCloneVMPageBasic3(bool fShowChildsOption); private: /* Translation stuff: */ void retranslateUi(); /* Prepare stuff: */ void initializePage(); /* Validation stuff: */ bool validatePage(); /* Widgets: */ QIRichTextLabel *m_pLabel; }; #endif // __UIWizardCloneVMPageBasic3_h__
#ifndef _ZANavFilterArray_h #define _ZANavFilterArray_h #if _MSC_VER >= 1000 #pragma once #endif #pragma warning(push) #pragma warning(disable : 4275) class ANAV_PORT CNavFilterArray : public CNavArray<CNavFilter> { public: CNavFilterArray (); virtual ~CNavFilterArray (); public: void SetFrom (LPCTSTR str, BOOL bUseFullDescrition = FALSE); int Find (LPCTSTR str); int FindExact (LPCTSTR str); }; #pragma warning(pop) #endif
/* * include/linux/amlogic/vout/aml_tablet_bl.h * * Copyright (C) 2015 Amlogic, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * */ #ifndef __INCLUDE_AML_TABLET_BL_H #define __INCLUDE_AML_TABLET_BL_H #define BL_LEVEL_DEFAULT BL_LEVEL_MID #define BL_NAME "backlight" #define DRV_BL_FLAG 0 #define LCD_BL_FLAG 1 #define BL_LEVEL_MAX 255 #define BL_LEVEL_MIN 10 #define BL_LEVEL_OFF 1 #define BL_LEVEL_MID 128 #define BL_LEVEL_MID_MAPPED 102 #define BL_GPIO_OUTPUT_LOW 0 #define BL_GPIO_OUTPUT_HIGH 1 #define BL_GPIO_INPUT 2 #define bl_gpio_request(dev, gpio) gpiod_get(dev, gpio) #define bl_gpio_free(gpio) gpiod_free(gpio, BL_NAME) #define bl_gpio_input(gpio) gpiod_direction_input(gpio) #define bl_gpio_output(gpio, val) gpiod_direction_output(gpio, val) #define bl_gpio_get_value(gpio) gpiod_get_value(gpio) #define bl_gpio_set_value(gpio, val) gpiod_set_value(gpio, val) extern void bl_power_on(int bl_flag); extern void bl_power_off(int bl_flag); extern unsigned get_backlight_level(void); #endif
/* AbiWord * Copyright (C) 2000 AbiSource, Inc. * Copyright (C) 2001, 2003 Hubert Figuiere * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. */ #ifndef AP_COCOADIALOG_HDRFTR_H #define AP_COCOADIALOG_HDRFTR_H #include <Cocoa/Cocoa.h> #include "ap_Dialog_HdrFtr.h" class XAP_CocoaFrame; @class AP_CocoaDialog_HdrFtrController; /*****************************************************************/ class AP_CocoaDialog_HdrFtr: public AP_Dialog_HdrFtr { public: AP_CocoaDialog_HdrFtr(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id dlgid); virtual ~AP_CocoaDialog_HdrFtr(void); virtual void runModal(XAP_Frame * pFrame); static XAP_Dialog * static_constructor(XAP_DialogFactory *, XAP_Dialog_Id dlgid); virtual void eventOk(void); virtual void eventCancel(void); void RestartSpinChanged(UT_sint32 RestartValue); void CheckChanged(id checkbox); private: AP_CocoaDialog_HdrFtrController* m_dlg; }; @interface AP_CocoaDialog_HdrFtrController : NSWindowController <XAP_CocoaDialogProtocol> { IBOutlet NSButton *cancelBtn; IBOutlet NSBox *footerBox; IBOutlet NSButton *footerFacingBtn; IBOutlet NSButton *footerFirstBtn; IBOutlet NSButton *footerLastBtn; IBOutlet NSBox *headerBox; IBOutlet NSButton *headerFacingBtn; IBOutlet NSButton *headerFirstBtn; IBOutlet NSButton *headerLastBtn; IBOutlet NSButton *okBtn; IBOutlet NSBox *pageNumberBox; IBOutlet NSTextField *restartAtData; IBOutlet NSTextField *restartAtLabel; IBOutlet NSButton *restartPgNumberBtn; IBOutlet NSStepper *restartStepper; AP_CocoaDialog_HdrFtr* _xap; } - (IBAction)cancelAction:(id)sender; - (IBAction)btnAction:(id)sender; - (IBAction)okAction:(id)sender; - (IBAction)restartAction:(id)sender; - (IBAction)restartBtnAction:(id)sender; - (IBAction)restartStepperAction:(id)sender; @end #endif /* AP_COCOADIALOG_HDRFTR_H */
#include <s3c2440_addr.h> #include <intirq.h> #include <stdio.h> static inline void Timer0_Handle(void); static inline void Dma0_Handle(void); void (*isr_handle_array[MAX_IRQ])(void) ; static void Dummy_isr(void) { printf("Dummy_isr\n\r"); while(1); } void init_irq(void) { int i = 0; for (i = 0; i < sizeof(isr_handle_array) / sizeof(isr_handle_array[0]); i++) { isr_handle_array[i] = Dummy_isr; } INTMOD = 0x0; // ËùÓÐÖж϶¼ÉèΪIRQģʽ INTMSK = BIT_ALLMSK; // ÏÈÆÁ±ÎËùÓÐÖÐ¶Ï } int register_interrupt(unsigned int vector_num,void (*vector_handle)(void)) { if(vector_num > (MAX_IRQ - 1)){ printf("Invalid inteerupt vector num.\n"); return -1; } isr_handle_array[vector_num] = vector_handle; INTMSK &= ~(1 << vector_num); return 0; } /* * C interrupt code entry */ void C_IRQ_Handler(int i,int j) { unsigned long oft = INTOFFSET; //ÇåÖÐ¶Ï if (oft == 4) EINTPEND = 1 << 7; //EINT4-7ºÏÓÃIRQ4£¬×¢ÒâEINTPEND[3:0]±£ÁôδÓã¬ÏòÕâЩλдÈë1¿ÉÄܵ¼ÖÂδ֪½á¹û SRCPND = 1 << oft; INTPND = INTPND; /* µ÷ÓÃÖжϷþÎñ³ÌÐò */ isr_handle_array[oft](); } /*timer0 hanlder*/ static void Timer0_Handle(void) { static int num = 0; //every 1s change the led status GPBDAT = (num & 0xf) << 5; num++; } extern int dma_flag; /*dma0 interrupt handler*/ static void Dma0_Handle(void) { dma_flag = 1; /*set beep ring*/ GPBDAT = 0b1001 << 5; }
// Mac only supports 16x16 pixel cursors. #ifdef __WXMAC__ #define CURSORS_SIZE16 #else #define CURSORS_SIZE32 #endif #ifdef CURSORS_SIZE32 // Cursors MUST be 32x32 (or they will be resized). // You only get black, white and transparent to use. // N.B. Under windows the mask color must be in // the color palette. To cater for Win2K a mask // color of saturated red was used. (middle grey #include "Cursors32/DisabledCursor.xpm" #include "Cursors32/EnvCursor.xpm" #include "Cursors32/TimeCursor.xpm" #include "Cursors32/IBeamCursor.xpm" #include "Cursors32/DrawCursor.xpm" #include "Cursors32/ZoomInCursor.xpm" #include "Cursors32/ZoomOutCursor.xpm" #include "Cursors32/LabelCursorLeft.xpm" #include "Cursors32/LabelCursorRight.xpm" #include "Cursors32/BottomFrequencyCursor.xpm" #include "Cursors32/TopFrequencyCursor.xpm" #include "Cursors32/BandWidthCursor.xpm" #ifdef USE_MIDI #include "Cursors32/StretchCursor.xpm" #include "Cursors32/StretchLeftCursor.xpm" #include "Cursors32/StretchRightCursor.xpm" #endif #else #include "Cursors16/DisabledCursor.xpm" #include "Cursors16/EnvCursor.xpm" #include "Cursors16/TimeCursor.xpm" #include "Cursors16/IBeamCursor.xpm" #include "Cursors16/DrawCursor.xpm" #include "Cursors16/ZoomInCursor.xpm" #include "Cursors16/ZoomOutCursor.xpm" #include "Cursors16/LabelCursorLeft.xpm" #include "Cursors16/LabelCursorRight.xpm" #include "Cursors16/BottomFrequencyCursor.xpm" #include "Cursors16/TopFrequencyCursor.xpm" #include "Cursors16/BandWidthCursor.xpm" #ifdef USE_MIDI #include "Cursors16/StretchCursor.xpm" #include "Cursors16/StretchLeftCursor.xpm" #include "Cursors16/StretchRightCursor.xpm" #endif #endif std::unique_ptr<wxCursor> MakeCursor(int WXUNUSED(CursorId), const char * pXpm[36], int HotX, int HotY);
#include "386_common.h" #include "codegen_backend.h" static inline int LOAD_SP_WITH_OFFSET(ir_data_t *ir, int offset) { if (stack32) { if (offset) { uop_ADD_IMM(ir, IREG_eaaddr, IREG_ESP, offset); return IREG_eaaddr; } else return IREG_ESP; } else { if (offset) { uop_ADD_IMM(ir, IREG_eaaddr_W, IREG_SP, offset); uop_MOVZX(ir, IREG_eaaddr, IREG_eaaddr_W); return IREG_eaaddr; } else { uop_MOVZX(ir, IREG_eaaddr, IREG_SP); return IREG_eaaddr; } } } static inline int LOAD_SP(ir_data_t *ir) { return LOAD_SP_WITH_OFFSET(ir, 0); } static inline void ADD_SP(ir_data_t *ir, int offset) { if (stack32) uop_ADD_IMM(ir, IREG_ESP, IREG_ESP, offset); else uop_ADD_IMM(ir, IREG_SP, IREG_SP, offset); } static inline void SUB_SP(ir_data_t *ir, int offset) { if (stack32) uop_SUB_IMM(ir, IREG_ESP, IREG_ESP, offset); else uop_SUB_IMM(ir, IREG_SP, IREG_SP, offset); } static inline void fpu_POP(codeblock_t *block, ir_data_t *ir) { if (block->flags & CODEBLOCK_STATIC_TOP) uop_MOV_IMM(ir, IREG_FPU_TOP, cpu_state.TOP + 1); else uop_ADD_IMM(ir, IREG_FPU_TOP, IREG_FPU_TOP, 1); } static inline void fpu_POP2(codeblock_t *block, ir_data_t *ir) { if (block->flags & CODEBLOCK_STATIC_TOP) uop_MOV_IMM(ir, IREG_FPU_TOP, cpu_state.TOP + 2); else uop_ADD_IMM(ir, IREG_FPU_TOP, IREG_FPU_TOP, 2); } static inline void fpu_PUSH(codeblock_t *block, ir_data_t *ir) { if (block->flags & CODEBLOCK_STATIC_TOP) uop_MOV_IMM(ir, IREG_FPU_TOP, cpu_state.TOP - 1); else uop_SUB_IMM(ir, IREG_FPU_TOP, IREG_FPU_TOP, 1); } static inline void CHECK_SEG_LIMITS(codeblock_t *block, ir_data_t *ir, x86seg *seg, int addr_reg, int end_offset) { if ((seg == &cpu_state.seg_ds && codegen_flat_ds && !(cpu_cur_status & CPU_STATUS_NOTFLATDS)) || (seg == &cpu_state.seg_ss && codegen_flat_ss && !(cpu_cur_status & CPU_STATUS_NOTFLATSS))) return; uop_CMP_JB(ir, addr_reg, ireg_seg_limit_low(seg), codegen_gpf_rout); if (end_offset) { uop_ADD_IMM(ir, IREG_temp3, addr_reg, end_offset); uop_CMP_JNBE(ir, IREG_temp3, ireg_seg_limit_high(seg), codegen_gpf_rout); } else uop_CMP_JNBE(ir, addr_reg, ireg_seg_limit_high(seg), codegen_gpf_rout); } static inline void LOAD_IMMEDIATE_FROM_RAM_8(codeblock_t *block, ir_data_t *ir, int dest_reg, uint32_t addr) { uop_MOVZX_REG_PTR_8(ir, dest_reg, get_ram_ptr(addr)); } void LOAD_IMMEDIATE_FROM_RAM_16_unaligned(codeblock_t *block, ir_data_t *ir, int dest_reg, uint32_t addr); static inline void LOAD_IMMEDIATE_FROM_RAM_16(codeblock_t *block, ir_data_t *ir, int dest_reg, uint32_t addr) { if ((addr & 0xfff) == 0xfff) LOAD_IMMEDIATE_FROM_RAM_16_unaligned(block, ir, dest_reg, addr); else uop_MOVZX_REG_PTR_16(ir, dest_reg, get_ram_ptr(addr)); } void LOAD_IMMEDIATE_FROM_RAM_32_unaligned(codeblock_t *block, ir_data_t *ir, int dest_reg, uint32_t addr); static inline void LOAD_IMMEDIATE_FROM_RAM_32(codeblock_t *block, ir_data_t *ir, int dest_reg, uint32_t addr) { if ((addr & 0xfff) >= 0xffd) LOAD_IMMEDIATE_FROM_RAM_32_unaligned(block, ir, dest_reg, addr); else uop_MOV_REG_PTR(ir, dest_reg, get_ram_ptr(addr)); } int codegen_can_unroll_full(codeblock_t *block, ir_data_t *ir, uint32_t next_pc, uint32_t dest_addr); static inline int codegen_can_unroll(codeblock_t *block, ir_data_t *ir, uint32_t next_pc, uint32_t dest_addr) { if (block->flags & CODEBLOCK_BYTE_MASK) return 0; /*Is dest within block?*/ if (dest_addr > next_pc) return 0; if ((cs+dest_addr) < block->pc) return 0; return codegen_can_unroll_full(block, ir, next_pc, dest_addr); }
#ifndef _GPXE_ETHERNET_H #define _GPXE_ETHERNET_H /** @file * * Ethernet protocol * */ FILE_LICENCE ( GPL2_OR_LATER ); #include <stdint.h> extern void eth_init_addr ( const void *hw_addr, void *ll_addr ); extern const char * eth_ntoa ( const void *ll_addr ); extern int eth_mc_hash ( unsigned int af, const void *net_addr, void *ll_addr ); extern struct net_device * alloc_etherdev ( size_t priv_size ); #endif /* _GPXE_ETHERNET_H */
// SPDX-License-Identifier: GPL-2.0-or-later /* * Copyright (c) 2019 Linaro Limited. All rights reserved. * Author: Sumit Garg <sumit.garg@linaro.org> */ /* * Test syncfs * * It basically tests syncfs() to sync filesystem having large dirty file * pages to block device. Also, it tests all supported filesystems on a test * block device. */ #define _GNU_SOURCE #include <stdlib.h> #include <stdio.h> #include <sys/types.h> #include "tst_test.h" #include "lapi/syncfs.h" #include "check_syncfs.h" #define MNTPOINT "mnt_point" #define FNAME MNTPOINT"/test" #define FILE_SIZE_MB 32 #define FILE_SIZE (FILE_SIZE_MB * TST_MB) #define MODE 0644 static void verify_syncfs(void) { int fd; unsigned long written; fd = SAFE_OPEN(FNAME, O_RDWR|O_CREAT, MODE); tst_dev_sync(fd); tst_dev_bytes_written(tst_device->dev); tst_fill_fd(fd, 0, TST_MB, FILE_SIZE_MB); TEST(syncfs(fd)); if (TST_RET) tst_brk(TFAIL | TTERRNO, "syncfs(fd) failed"); written = tst_dev_bytes_written(tst_device->dev); SAFE_CLOSE(fd); if (written >= FILE_SIZE) tst_res(TPASS, "Test filesystem synced to device"); else tst_res(TFAIL, "Synced %li, expected %i", written, FILE_SIZE); } static void setup(void) { check_syncfs(); } static struct tst_test test = { .needs_root = 1, .mount_device = 1, .all_filesystems = 1, .skip_filesystems = (const char*[]) { "tmpfs", NULL }, .mntpoint = MNTPOINT, .setup = setup, .test_all = verify_syncfs, };
// -*- C++ -*- // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // Copyright (C) 1999-2003 Forgotten // Copyright (C) 2004-2006 Forgotten and the VBA development team // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or(at your option) // any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software Foundation, // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef VBA_BIOS_H #define VBA_BIOS_H extern void BIOS_ArcTan(); extern void BIOS_ArcTan2(); extern void BIOS_BitUnPack(); extern void BIOS_GetBiosChecksum(); extern void BIOS_BgAffineSet(); extern void BIOS_CpuSet(); extern void BIOS_CpuFastSet(); extern void BIOS_Diff8bitUnFilterWram(); extern void BIOS_Diff8bitUnFilterVram(); extern void BIOS_Diff16bitUnFilter(); extern void BIOS_Div(); extern void BIOS_DivARM(); extern void BIOS_HuffUnComp(); extern void BIOS_LZ77UnCompVram(); extern void BIOS_LZ77UnCompWram(); extern void BIOS_ObjAffineSet(); extern void BIOS_RegisterRamReset(); extern void BIOS_RegisterRamReset(u32); extern void BIOS_RLUnCompVram(); extern void BIOS_RLUnCompWram(); extern void BIOS_SoftReset(); extern void BIOS_Sqrt(); extern void BIOS_MidiKey2Freq(); extern void BIOS_SndDriverJmpTableCopy(); #endif // VBA_BIOS_H
/* fvs.h (sparse vector in FVS format) */ /*********************************************************************** * This code is part of GLPK (GNU Linear Programming Kit). * Copyright (C) 2016 Free Software Foundation, Inc. * Written by Andrew Makhorin <mao@gnu.org>. * * GLPK 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. * * GLPK 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 GLPK. If not, see <http://www.gnu.org/licenses/>. ***********************************************************************/ #ifndef FVS_H #define FVS_H typedef struct FVS FVS; struct FVS { /* sparse vector in FVS (Full Vector Storage) format */ int n; /* vector dimension (total number of elements) */ int nnz; /* number of non-zero elements, 0 <= nnz <= n */ int *ind; /* int ind[1+n]; */ /* ind[0] is not used; * ind[k] = j, 1 <= k <= nnz, means that vec[j] != 0 * non-zero indices in the array ind are stored in arbitrary * order; if vec[j] = 0, its index j SHOULD NOT be presented in * the array ind */ double *vec; /* double vec[1+n]; */ /* vec[0] is not used; * vec[j], 1 <= j <= n, is a numeric value of j-th element */ }; #define fvs_alloc_vec _glp_fvs_alloc_vec void fvs_alloc_vec(FVS *x, int n); /* allocate sparse vector */ #define fvs_check_vec _glp_fvs_check_vec void fvs_check_vec(const FVS *x); /* check sparse vector */ #define fvs_gather_vec _glp_fvs_gather_vec void fvs_gather_vec(FVS *x, double eps); /* gather sparse vector */ #define fvs_clear_vec _glp_fvs_clear_vec void fvs_clear_vec(FVS *x); /* clear sparse vector */ #define fvs_copy_vec _glp_fvs_copy_vec void fvs_copy_vec(FVS *x, const FVS *y); /* copy sparse vector */ #define fvs_adjust_vec _glp_fvs_adjust_vec void fvs_adjust_vec(FVS *x, double eps); /* replace tiny vector elements by exact zeros */ #define fvs_free_vec _glp_fvs_free_vec void fvs_free_vec(FVS *x); /* deallocate sparse vector */ #endif /* eof */
#include <linux/init.h> #include <linux/kernel.h> #include <linux/gpio.h> #include <linux/workqueue.h> #include <linux/irq.h> #include <linux/interrupt.h> #include "axc_bq51220Charger.h" #include <linux/asus_bat.h> #include <linux/asus_chg.h> extern void asus_chg_set_chg_mode(enum asus_chg_src chg_src); #define GPIO_WC_POK 85 struct workqueue_struct *wc_intr_wq = NULL; struct delayed_work wc_worker; static irqreturn_t wc_power_ok_handler(int irq, void *dev_id) { queue_delayed_work(wc_intr_wq, &wc_worker, 0); printk("[BAT][WC]%s\n",__FUNCTION__); return IRQ_HANDLED; } static irqreturn_t wc_pd_det_handler(int irq, void *dev_id) { printk("[BAT][WC]%s\n",__FUNCTION__); return IRQ_HANDLED; } static Bq51220_PIN wc_gGpio_pin[]= { {//WC_POK .gpio = 85, .name = "WC_POK", .in_out_flag = 0, .handler = wc_power_ok_handler, .trigger_flag= IRQF_TRIGGER_FALLING|IRQF_TRIGGER_RISING, }, {//WC_PD_DET .gpio = 20, .name = "WC_PD_DET", .in_out_flag = 0, .handler = wc_pd_det_handler, .trigger_flag= IRQF_TRIGGER_FALLING|IRQF_TRIGGER_RISING, }, {//WC_EN1 .gpio = 3, .name = "WC_EN1", .in_out_flag = 1, .init_value = 0, }, {//WC_EN2 .gpio = 2, .name = "WC_EN2", .in_out_flag = 1, .init_value = 0, }, }; static void wc_work(struct work_struct *dat) { if(1 == gpio_get_value(GPIO_WC_POK)) asus_chg_set_chg_mode(ASUS_CHG_SRC_WC); else asus_chg_set_chg_mode(ASUS_CHG_SRC_NONE); } static int AXC_bq51220_GPIO_setting(void) { Bq51220_PIN_DEF i; int err = 0; printk("%s+++\n",__FUNCTION__); for(i = 0; i< Bq51220_PIN_COUNT;i++){ //rquest err = gpio_request(wc_gGpio_pin[i].gpio, wc_gGpio_pin[i].name); if (err < 0) { printk("[BAT][WC]gpio_request %s failed,err = %d\n", wc_gGpio_pin[i].name, err); goto err_exit; } //input if(wc_gGpio_pin[i].in_out_flag == 0){ err = gpio_direction_input(wc_gGpio_pin[i].gpio); if (err < 0) { printk( "[BAT][WC]gpio_direction_input %s failed, err = %d\n", wc_gGpio_pin[i].name, err); goto err_exit; } if(wc_gGpio_pin[i].handler != NULL){ wc_gGpio_pin[i].irq = gpio_to_irq(wc_gGpio_pin[i].gpio); printk("[BAT][WC]:GPIO:%d,IRQ:%d\n",wc_gGpio_pin[i].gpio, wc_gGpio_pin[i].irq); if(true == wc_gGpio_pin[i].irq_enabled){ enable_irq_wake(wc_gGpio_pin[i].irq); } err = request_irq(wc_gGpio_pin[i].irq , wc_gGpio_pin[i].handler, wc_gGpio_pin[i].trigger_flag, wc_gGpio_pin[i].name, NULL); if (err < 0) { printk( "[BAT][CHG][SMB]request_irq %s failed, err = %d\n",wc_gGpio_pin[i].name,err); goto err_exit; } } //output }else{ gpio_direction_output(wc_gGpio_pin[i].gpio, wc_gGpio_pin[i].init_value); } } printk("%s---\n",__FUNCTION__); return 0; err_exit: for(i = 0; i<Bq51220_PIN_COUNT;i++){ gpio_free(wc_gGpio_pin[i].gpio); } printk("[BAT][WC]AXC_Smb346_Charger_InitGPIO_err_exit\n"); return err; } void AXC_bq51220_Charger_Init(void) { wc_intr_wq = create_singlethread_workqueue("wirelessChg_intr_wq"); INIT_DELAYED_WORK(&wc_worker,wc_work); if (0 != AXC_bq51220_GPIO_setting()) { printk( "[BAT][WC]Charger gpio can't init\n"); } }
/* ============================================================ * * This file is a part of kipi-plugins project * http://www.digikam.org * * Date : 2007-02-11 * Description : a kipi plugin to show image using an OpenGL interface. * * Copyright (C) 2007-2008 by Markus Leuthold <kusi at forum dot titlis dot org> * Copyright (C) 2008-2012 by Gilles Caulier <caulier dot gilles 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, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * ============================================================ */ #ifndef TIMER_H #define TIMER_H // Qt includes #include <QString> namespace KIPIViewerPlugin { class Timer { public: Timer(); ~Timer(); void start(); void at(const QString& s); private: class TimerPriv; TimerPriv* const d; }; } // namespace KIPIViewerPlugin #endif // TIMER_H
/* * Copyright (C) 2006 Oracle. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either * version 2 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 021110-1307, USA. */ /* * Description: This test just creates a file and have it * extended by the child process. * * This test has no cluster relevance. * * Author : Mark Fasheh * */ #include <unistd.h> #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <errno.h> #include <string.h> #include <sys/wait.h> #include <stdlib.h> #define DO_FSYNC #define PROGNAME "extend_and_write" #define PRINTERR(err) \ printf("[%d] Error %d (Line %d, Function \"%s\"): \"%s\"\n", \ getpid(), err, __LINE__, __FUNCTION__, strerror(err)) #define SZ 1024 #define NUMWRITES 10240 int count; static void Usage() { printf("\nUsage: %s -h -f <filename> [-s <extend size>]" " [-n <numwrites>]\n", PROGNAME); printf("will create and extend a file, n times.\n\n" "<extend size> Size of the extend (Default=1024)\n" "<numwrites> Number of writes to be performed " "(Default=10240).\n"); exit(1); } int main(int argc, char **argv) { int status = 0; int fd; char filename[256] = "/tmp/extend_and_write.txt"; int off_t = SZ; int loops = NUMWRITES; pid_t pid; // off_t len = SZ; int i, c; if (argc == 1) { Usage(); } opterr = 0; count = argc; while ((c = getopt(argc, argv, ":h:f:s:n:H:-:")) != EOF) { switch (c) { case 'h': Usage(); break; case 'H': Usage(); break; case '-': if (!strcmp(optarg, "help")) Usage(); else { fprintf(stderr, "%s: Invalid option: " "\'--%s\'\n", PROGNAME, optarg); return -EINVAL; } case 'f': snprintf(filename,255,"%s",optarg); if ((*filename == '-')) { fprintf(stderr, "%s: Invalid file name: %s\n", PROGNAME, optarg); return -EINVAL; } break; case 'n': loops = atoi(optarg); if (!loops) { fprintf(stderr, "%s: Invalid numwrites: %s\n", PROGNAME, optarg); return -EINVAL; } break; case 's': off_t = atoi(optarg); if (!off_t) { fprintf(stderr, "%s: Invalid extend size: %s\n", PROGNAME, optarg); return -EINVAL; } break; default: Usage(); break; } } char buffer[off_t]; printf("%s: File will be %d bytes after this run\n", PROGNAME, (2 * off_t * loops)); fd = open(filename, O_CREAT|O_TRUNC|O_RDWR|O_APPEND, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); if (fd == -1) { status = errno; PRINTERR(status); goto bail; } pid = fork(); /* ok, the parent will do the writing, the child the extending */ /* actually, maybe at first they'll both write */ if (pid) { printf("%s: Parent process starting.\n", PROGNAME); memset(buffer, 'A', off_t); for (i = 0; i < loops; i++) { status = write(fd, buffer, off_t); if (status < 0) { PRINTERR(status); goto bail; } if (status != off_t) { printf("%s: (%d) Short write! size = %d," " i=%d\n", PROGNAME, getpid(), status, i); status = 0; goto bail; } // usleep(15); #ifdef DO_FSYNC fsync(fd); #endif } waitpid(pid, NULL, 0); printf("%s: Parent process exiting.\n", PROGNAME); } else { printf("%s: Child process starting.\n", PROGNAME); memset(buffer, 'B', off_t); for (i = 0; i < loops; i++) { status = write(fd, buffer, off_t); if (status < 0) { PRINTERR(status); goto bail; } if (status != off_t) { printf("%s: (%d) Short write! size = %d, " "i=%d\n", PROGNAME, getpid(), status, i); status = 0; goto bail; } // usleep(15); #ifdef DO_FSYNC fsync(fd); #endif } printf("%s: Child process exiting.\n", PROGNAME); } bail: return(status); }
/* =========================================================================== Copyright (C) 1999-2005 Id Software, Inc. This file is part of Quake III Arena source code. Quake III Arena source code 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. Quake III Arena source code 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 Quake III Arena source code; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA =========================================================================== */ #include "tr_local.h" typedef struct { char id[2]; unsigned fileSize; unsigned reserved0; unsigned bitmapDataOffset; unsigned bitmapHeaderSize; unsigned width; unsigned height; unsigned short planes; unsigned short bitsPerPixel; unsigned compression; unsigned bitmapDataSize; unsigned hRes; unsigned vRes; unsigned colors; unsigned importantColors; unsigned char palette[256][4]; } BMPHeader_t; void R_LoadBMP( const char *name, byte **pic, int *width, int *height ) { int columns, rows; unsigned numPixels; byte *pixbuf; int row, column; byte *buf_p; byte *end; byte *buffer = NULL; int length; BMPHeader_t bmpHeader; byte *bmpRGBA; *pic = NULL; if(width) *width = 0; if(height) *height = 0; // // load the file // length = ri.FS_ReadFile( ( char * ) name, (void **)&buffer); if (!buffer || length < 0) { return; } if (length < 54) { ri.Error( ERR_DROP, "LoadBMP: header too short (%s)\n", name ); } buf_p = buffer; end = buffer + length; bmpHeader.id[0] = *buf_p++; bmpHeader.id[1] = *buf_p++; bmpHeader.fileSize = LittleLong( * ( int * ) buf_p ); buf_p += 4; bmpHeader.reserved0 = LittleLong( * ( int * ) buf_p ); buf_p += 4; bmpHeader.bitmapDataOffset = LittleLong( * ( int * ) buf_p ); buf_p += 4; bmpHeader.bitmapHeaderSize = LittleLong( * ( int * ) buf_p ); buf_p += 4; bmpHeader.width = LittleLong( * ( int * ) buf_p ); buf_p += 4; bmpHeader.height = LittleLong( * ( int * ) buf_p ); buf_p += 4; bmpHeader.planes = LittleShort( * ( short * ) buf_p ); buf_p += 2; bmpHeader.bitsPerPixel = LittleShort( * ( short * ) buf_p ); buf_p += 2; bmpHeader.compression = LittleLong( * ( int * ) buf_p ); buf_p += 4; bmpHeader.bitmapDataSize = LittleLong( * ( int * ) buf_p ); buf_p += 4; bmpHeader.hRes = LittleLong( * ( int * ) buf_p ); buf_p += 4; bmpHeader.vRes = LittleLong( * ( int * ) buf_p ); buf_p += 4; bmpHeader.colors = LittleLong( * ( int * ) buf_p ); buf_p += 4; bmpHeader.importantColors = LittleLong( * ( int * ) buf_p ); buf_p += 4; if ( bmpHeader.bitsPerPixel == 8 ) { if (buf_p + sizeof(bmpHeader.palette) > end) ri.Error( ERR_DROP, "LoadBMP: header too short (%s)\n", name ); Com_Memcpy( bmpHeader.palette, buf_p, sizeof( bmpHeader.palette ) ); buf_p += sizeof(bmpHeader.palette); } if (buffer + bmpHeader.bitmapDataOffset > end) { ri.Error( ERR_DROP, "LoadBMP: invalid offset value in header (%s)\n", name ); } buf_p = buffer + bmpHeader.bitmapDataOffset; if ( bmpHeader.id[0] != 'B' && bmpHeader.id[1] != 'M' ) { ri.Error( ERR_DROP, "LoadBMP: only Windows-style BMP files supported (%s)\n", name ); } if ( bmpHeader.fileSize != length ) { ri.Error( ERR_DROP, "LoadBMP: header size does not match file size (%u vs. %u) (%s)\n", bmpHeader.fileSize, length, name ); } if ( bmpHeader.compression != 0 ) { ri.Error( ERR_DROP, "LoadBMP: only uncompressed BMP files supported (%s)\n", name ); } if ( bmpHeader.bitsPerPixel < 8 ) { ri.Error( ERR_DROP, "LoadBMP: monochrome and 4-bit BMP files not supported (%s)\n", name ); } switch ( bmpHeader.bitsPerPixel ) { case 8: case 16: case 24: case 32: break; default: ri.Error( ERR_DROP, "LoadBMP: illegal pixel_size '%hu' in file '%s'\n", bmpHeader.bitsPerPixel, name ); break; } columns = bmpHeader.width; rows = bmpHeader.height; if ( rows < 0 ) rows = -rows; numPixels = columns * rows; if(columns <= 0 || !rows || numPixels > 0x1FFFFFFF // 4*1FFFFFFF == 0x7FFFFFFC < 0x7FFFFFFF || ((numPixels * 4) / columns) / 4 != rows) { ri.Error (ERR_DROP, "LoadBMP: %s has an invalid image size\n", name); } if(buf_p + numPixels*bmpHeader.bitsPerPixel/8 > end) { ri.Error (ERR_DROP, "LoadBMP: file truncated (%s)\n", name); } if ( width ) *width = columns; if ( height ) *height = rows; bmpRGBA = ri.Malloc( numPixels * 4 ); *pic = bmpRGBA; for ( row = rows-1; row >= 0; row-- ) { pixbuf = bmpRGBA + row*columns*4; for ( column = 0; column < columns; column++ ) { unsigned char red, green, blue, alpha; int palIndex; unsigned short shortPixel; switch ( bmpHeader.bitsPerPixel ) { case 8: palIndex = *buf_p++; *pixbuf++ = bmpHeader.palette[palIndex][2]; *pixbuf++ = bmpHeader.palette[palIndex][1]; *pixbuf++ = bmpHeader.palette[palIndex][0]; *pixbuf++ = 0xff; break; case 16: shortPixel = * ( unsigned short * ) pixbuf; pixbuf += 2; *pixbuf++ = ( shortPixel & ( 31 << 10 ) ) >> 7; *pixbuf++ = ( shortPixel & ( 31 << 5 ) ) >> 2; *pixbuf++ = ( shortPixel & ( 31 ) ) << 3; *pixbuf++ = 0xff; break; case 24: blue = *buf_p++; green = *buf_p++; red = *buf_p++; *pixbuf++ = red; *pixbuf++ = green; *pixbuf++ = blue; *pixbuf++ = 255; break; case 32: blue = *buf_p++; green = *buf_p++; red = *buf_p++; alpha = *buf_p++; *pixbuf++ = red; *pixbuf++ = green; *pixbuf++ = blue; *pixbuf++ = alpha; break; } } } ri.FS_FreeFile( buffer ); }
/* * Copyright (C) 1996-2016 The Squid Software Foundation and contributors * * Squid software is distributed under GPLv2+ license and includes * contributions from numerous individuals and organizations. * Please see the COPYING and CONTRIBUTORS files for details. */ #ifndef SQUID_SNMP_PDU_H #define SQUID_SNMP_PDU_H /* required for oid typedef */ #include "asn1.h" #if HAVE_NETINET_IN_H #include <netinet/in.h> #endif /********************************************************************** * * Copyright 1997 by Carnegie Mellon University * * All Rights Reserved * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, * provided that the above copyright notice appear in all copies and that * both that copyright notice and this permission notice appear in * supporting documentation, and that the name of CMU not be * used in advertising or publicity pertaining to distribution of the * software without specific, written prior permission. * * CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL * CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. * * Author: Ryan Troll <ryan+@andrew.cmu.edu> * **********************************************************************/ #ifdef __cplusplus extern "C" { #endif /* An SNMP PDU */ struct snmp_pdu { int command; /* Type of this PDU */ struct sockaddr_in address; /* Address of peer */ int reqid; /* Integer32: Request id */ int errstat; /* INTEGER: Error status */ int errindex; /* INTEGER: Error index */ /* SNMPv2 Bulk Request */ int non_repeaters; /* INTEGER: */ int max_repetitions; /* INTEGER: */ struct variable_list *variables; /* Variable Bindings */ /* Trap information */ oid *enterprise; /* System OID */ int enterprise_length; struct sockaddr_in agent_addr; /* address of object generating trap */ int trap_type; /* generic trap type */ int specific_type; /* specific type */ u_int time; /* Uptime */ }; struct snmp_pdu *snmp_pdu_create(int); struct snmp_pdu *snmp_pdu_clone(struct snmp_pdu *); struct snmp_pdu *snmp_pdu_fix(struct snmp_pdu *, int); struct snmp_pdu *snmp_fix_pdu(struct snmp_pdu *, int); void snmp_free_pdu(struct snmp_pdu *); void snmp_pdu_free(struct snmp_pdu *); u_char *snmp_pdu_encode(u_char *, int *, struct snmp_pdu *); u_char *snmp_pdu_decode(u_char *, int *, struct snmp_pdu *); /* Add a NULL Variable to a PDU */ void snmp_add_null_var(struct snmp_pdu *, oid *, int); /* RFC 1905: Protocol Operations for SNMPv2 * * RFC 1157: A Simple Network Management Protocol (SNMP) * * PDU Types */ #define SNMP_PDU_GET (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) #define SNMP_PDU_GETNEXT (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) #define SNMP_PDU_RESPONSE (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) #ifdef UNUSED_CODE #define SNMP_PDU_SET (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) #define TRP_REQ_MSG (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /*Obsolete */ #endif #define SNMP_PDU_GETBULK (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) #ifdef UNUSED_CODE #define SNMP_PDU_INFORM (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) #define SNMP_PDU_V2TRAP (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) #define SNMP_PDU_REPORT (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) #endif #define MAX_BINDINGS 2147483647 /* PDU Defaults */ #define SNMP_DEFAULT_ERRSTAT -1 #define SNMP_DEFAULT_ERRINDEX -1 #define SNMP_DEFAULT_ADDRESS 0 #define SNMP_DEFAULT_REQID 0 /* RFC 1907: Management Information Base for SNMPv2 * * RFC 1157: A Simple Network Management Protocol (SNMP) * * Trap Types */ #if UNUSED_CODE #define SNMP_TRAP_COLDSTART (0x0) #define SNMP_TRAP_WARMSTART (0x1) #define SNMP_TRAP_LINKDOWN (0x2) #define SNMP_TRAP_LINKUP (0x3) #define SNMP_TRAP_AUTHENTICATIONFAILURE (0x4) #define SNMP_TRAP_EGPNEIGHBORLOSS (0x5) #define SNMP_TRAP_ENTERPRISESPECIFIC (0x6) #endif #ifdef __cplusplus } #endif #endif /* SQUID_SNMP_PDU_H */
// © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html #include "unicode/utypes.h" #if !UCONFIG_NO_FORMATTING #ifndef __NUMBER_STRINGBUILDER_H__ #define __NUMBER_STRINGBUILDER_H__ #include <cstdint> #include "unicode/numfmt.h" #include "unicode/ustring.h" #include "cstring.h" #include "uassert.h" #include "number_types.h" #include "fphdlimp.h" U_NAMESPACE_BEGIN namespace number { namespace impl { class U_I18N_API NumberStringBuilder : public UMemory { private: static const int32_t DEFAULT_CAPACITY = 40; template<typename T> union ValueOrHeapArray { T value[DEFAULT_CAPACITY]; struct { T *ptr; int32_t capacity; } heap; }; public: NumberStringBuilder(); ~NumberStringBuilder(); NumberStringBuilder(const NumberStringBuilder &other); NumberStringBuilder &operator=(const NumberStringBuilder &other); int32_t length() const; int32_t codePointCount() const; inline char16_t charAt(int32_t index) const { U_ASSERT(index >= 0); U_ASSERT(index < fLength); return getCharPtr()[fZero + index]; } inline Field fieldAt(int32_t index) const { U_ASSERT(index >= 0); U_ASSERT(index < fLength); return getFieldPtr()[fZero + index]; } UChar32 getFirstCodePoint() const; UChar32 getLastCodePoint() const; UChar32 codePointAt(int32_t index) const; UChar32 codePointBefore(int32_t index) const; NumberStringBuilder &clear(); int32_t appendCodePoint(UChar32 codePoint, Field field, UErrorCode &status); int32_t insertCodePoint(int32_t index, UChar32 codePoint, Field field, UErrorCode &status); int32_t append(const UnicodeString &unistr, Field field, UErrorCode &status); int32_t insert(int32_t index, const UnicodeString &unistr, Field field, UErrorCode &status); int32_t insert(int32_t index, const UnicodeString &unistr, int32_t start, int32_t end, Field field, UErrorCode &status); int32_t splice(int32_t startThis, int32_t endThis, const UnicodeString &unistr, int32_t startOther, int32_t endOther, Field field, UErrorCode& status); int32_t append(const NumberStringBuilder &other, UErrorCode &status); int32_t insert(int32_t index, const NumberStringBuilder &other, UErrorCode &status); /** * Gets a "safe" UnicodeString that can be used even after the NumberStringBuilder is destructed. * */ UnicodeString toUnicodeString() const; /** * Gets an "unsafe" UnicodeString that is valid only as long as the NumberStringBuilder is alive and * unchanged. Slightly faster than toUnicodeString(). */ const UnicodeString toTempUnicodeString() const; UnicodeString toDebugString() const; const char16_t *chars() const; bool contentEquals(const NumberStringBuilder &other) const; bool nextFieldPosition(FieldPosition& fp, UErrorCode& status) const; void getAllFieldPositions(FieldPositionIteratorHandler& fpih, UErrorCode& status) const; private: bool fUsingHeap = false; ValueOrHeapArray<char16_t> fChars; ValueOrHeapArray<Field> fFields; int32_t fZero = DEFAULT_CAPACITY / 2; int32_t fLength = 0; inline char16_t *getCharPtr() { return fUsingHeap ? fChars.heap.ptr : fChars.value; } inline const char16_t *getCharPtr() const { return fUsingHeap ? fChars.heap.ptr : fChars.value; } inline Field *getFieldPtr() { return fUsingHeap ? fFields.heap.ptr : fFields.value; } inline const Field *getFieldPtr() const { return fUsingHeap ? fFields.heap.ptr : fFields.value; } inline int32_t getCapacity() const { return fUsingHeap ? fChars.heap.capacity : DEFAULT_CAPACITY; } int32_t prepareForInsert(int32_t index, int32_t count, UErrorCode &status); int32_t prepareForInsertHelper(int32_t index, int32_t count, UErrorCode &status); int32_t remove(int32_t index, int32_t count); }; } // namespace impl } // namespace number U_NAMESPACE_END #endif //__NUMBER_STRINGBUILDER_H__ #endif /* #if !UCONFIG_NO_FORMATTING */
////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// // // copyright : (C) 2008 by Eran Ifrah // file name : breakpointdlg.h // // ------------------------------------------------------------------------- // A // _____ _ _ _ _ // / __ \ | | | | (_) | // | / \/ ___ __| | ___| | _| |_ ___ // | | / _ \ / _ |/ _ \ | | | __/ _ ) // | \__/\ (_) | (_| | __/ |___| | || __/ // \____/\___/ \__,_|\___\_____/_|\__\___| // // F i l e // // 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 __breakpointslistctrl__ #define __breakpointslistctrl__ #include "clThemedListCtrl.h" #include "debugger.h" #include <vector> class BreakpointsListctrl : public clThemedListCtrl { enum column_ids { col_id, col_type, col_enabled, col_file, col_lineno, col_functionname, col_at, col_memory, col_what, col_ignorecount, col_extras }; public: BreakpointsListctrl(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDV_ROW_LINES) : clThemedListCtrl(parent, id, pos, size, style) { // Disable any kind of sorting as we want the item in the order we insert them SetSortFunction(nullptr); const wxString column_headers[] = { _("ID"), _("Type"), _("Enabled"), _("File"), _("Line"), _("Function"), _("At"), _("Memory"), _("What"), _("Ignored"), _("Extras") }; for(int n = col_id; n <= col_extras; ++n) { AddHeader(column_headers[n]); } } virtual ~BreakpointsListctrl() {} void Initialise(std::vector<BreakpointInfo>& bps); int GetLinenoColumn() { return col_lineno; } int GetFileColumn() { return col_file; } }; #endif // __breakpointslistctrl__
/* Definitions for ARM EABI ucLinux Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc. Contributed by Paul Brook <paul@codesourcery.com> This file is part of GCC. GCC 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. GCC 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 GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>. */ /* Override settings that are different to the uclinux-elf or bpabi defaults. */ #undef TARGET_DEFAULT #define TARGET_DEFAULT (MASK_SINGLE_PIC_BASE | MASK_INTERWORK) /* On EABI GNU/Linux, we want both the BPABI builtins and the GNU/Linux builtins. */ #undef TARGET_OS_CPP_BUILTINS #define TARGET_OS_CPP_BUILTINS() \ do \ { \ TARGET_BPABI_CPP_BUILTINS(); \ builtin_define ("__uClinux__"); \ builtin_define ("__gnu_linux__"); \ builtin_define_std ("linux"); \ builtin_define_std ("unix"); \ builtin_assert ("system=linux"); \ builtin_assert ("system=unix"); \ builtin_assert ("system=posix"); \ } \ while (false) #undef SUBTARGET_EXTRA_LINK_SPEC #define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux_eabi -elf2flt" \ " --pic-veneer --target2=abs" /* We default to the "aapcs-linux" ABI so that enums are int-sized by default. */ #undef ARM_DEFAULT_ABI #define ARM_DEFAULT_ABI ARM_ABI_AAPCS_LINUX #undef LINK_GCC_C_SEQUENCE_SPEC #define LINK_GCC_C_SEQUENCE_SPEC \ "--start-group %G %L --end-group" /* Clear the instruction cache from `beg' to `end'. This makes an inline system call to SYS_cacheflush. */ #undef CLEAR_INSN_CACHE #define CLEAR_INSN_CACHE(BEG, END) \ { \ register unsigned long _beg __asm ("a1") = (unsigned long) (BEG); \ register unsigned long _end __asm ("a2") = (unsigned long) (END); \ register unsigned long _flg __asm ("a3") = 0; \ register unsigned long _scno __asm ("r7") = 0xf0002; \ __asm __volatile ("swi 0x0 @ sys_cacheflush" \ : "=r" (_beg) \ : "0" (_beg), "r" (_end), "r" (_flg), "r" (_scno)); \ }
/* $Header: /cvsroot/lesstif/lesstif/test/Xm/misc/test2.c,v 1.2 2002/05/13 12:39:01 amai Exp $ */ /* generate XmStrDefs.c from the Motif libXm it is linked to */ #include <stdlib.h> #include <stdio.h> #include <string.h> #include <ctype.h> #include <Xm/XmP.h> /* * order is C, N, R, V, S */ int main() { const char *ptr; int CNRVS = 0; ptr = _XmStrings; do { /* * this isn't perfect. The first and the last entries have to * be fixed by hand (XmS and XmRTopItemPosition) */ if (*ptr) { if (CNRVS == 0 && islower(*ptr)) CNRVS = 1; if (CNRVS == 1 && isupper(*ptr)) CNRVS = 2; if (CNRVS == 2 && islower(*ptr)) CNRVS = 3; if (CNRVS == 3 && isupper(*ptr)) CNRVS = 4; } switch (CNRVS) { case 0: printf("#ifndef XmC%s\n", ptr); printf("#define XmC%s ((char *)&_XmStrings[%d])\n", ptr, ptr - _XmStrings); printf("#endif\n"); break; case 1: printf("#ifndef XmN%s\n", ptr); printf("#define XmN%s ((char *)&_XmStrings[%d])\n", ptr, ptr - _XmStrings); printf("#endif\n"); break; case 2: printf("#ifndef XmR%s\n", ptr); printf("#define XmR%s ((char *)&_XmStrings[%d])\n", ptr, ptr - _XmStrings); printf("#endif\n"); break; case 3: printf("#ifndef XmV%s\n", ptr); printf("#define XmV%s ((char *)&_XmStrings[%d])\n", ptr, ptr - _XmStrings); printf("#endif\n"); break; case 4: printf("#ifndef XmS%s\n", ptr); printf("#define XmS%s ((char *)&_XmStrings[%d])\n", ptr, ptr - _XmStrings); printf("#endif\n"); } ptr += strlen(ptr) + 1; } while (*ptr); printf("\n\n"); printf("/*\n"); printf(" * The missing commas are intentional. Let the compiler\n"); printf(" * concatenate the strings\n"); printf(" */\n"); ptr = _XmStrings; printf("const char _XmStrings[] =\n"); do { printf("/* %-5d */ \"%s\\0\"\n", (int)(ptr - _XmStrings), ptr); ptr += strlen(ptr) + 1; } while (*ptr); printf("\"\\0\";\n"); exit(0); }
/* * Dibbler - a portable DHCPv6 * * authors: Nguyen Vinh Nghiem * changes: Tomasz Mrugalski <thomson@klub.com.pl> * * released under GNU GPL v2 or later licence * */ #ifndef NODECONSTANT_H_ #define NODECONSTANT_H_ #include "Node.h" #include <iostream> class NodeConstant : public Node { public : NodeConstant(); NodeConstant(std::string v); ~NodeConstant(); std::string getStringValue(); std::string value; virtual std::string exec(); virtual std::string exec(SPtr<TSrvMsg> msg); }; #endif /* NODECONSTANT_H_ */
/* Copyright (C) 1999 Lars Knoll (knoll@kde.org) Copyright (C) 2006, 2008, 2015 Apple Inc. All rights reserved. Copyright (c) 2012, Google Inc. All rights reserved. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #pragma once #include "Length.h" #include "RectEdges.h" #include "WritingMode.h" namespace WebCore { class LengthBox : public RectEdges<Length> { public: LengthBox() : LengthBox(Auto) { } explicit LengthBox(LengthType type) : RectEdges(Length(type), Length(type), Length(type), Length(type)) { } explicit LengthBox(int v) : RectEdges(Length(v, Fixed), Length(v, Fixed), Length(v, Fixed), Length(v, Fixed)) { } LengthBox(int top, int right, int bottom, int left) : RectEdges(Length(top, Fixed), Length(right, Fixed), Length(bottom, Fixed), Length(left, Fixed)) { } LengthBox(Length&& top, Length&& right, Length&& bottom, Length&& left) : RectEdges { WTFMove(top), WTFMove(right), WTFMove(bottom), WTFMove(left) } { } bool isZero() const { return top().isZero() && right().isZero() && bottom().isZero() && left().isZero(); } }; using LayoutBoxExtent = RectEdges<LayoutUnit>; using FloatBoxExtent = RectEdges<float>; WTF::TextStream& operator<<(WTF::TextStream&, const LengthBox&); WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, const FloatBoxExtent&); } // namespace WebCore
/* * Copyright (c) 2005, University of New Hampshire * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 59 Temple * Place - Suite 330, Boston, MA 02111-1307 USA. * * Author(s): * Lauren DeMarco <lkdm@cisunix.unh.edu> * * * Function: saHpiParmControl() * Description: * Call saHpiParmControl passing a bad ResourceId. * Expected return: call returns SA_ERR_HPI_INVALID_RESOURCE * * Line: P29-44:P29-46 */ #include <stdio.h> #include <unistd.h> #include "saf_test.h" #define BAD_RESOURCE_ID 0xDEADBEEF int Test_Resource(SaHpiSessionIdT session_id, SaHpiRptEntryT rpt_entry, callback2_t func) { SaHpiResourceIdT resource_id = rpt_entry.ResourceId; SaHpiResetActionT action = SAHPI_DEFAULT_PARM; SaErrorT val; int ret = SAF_TEST_UNKNOWN; SaHpiResourceIdT bad_ID = BAD_RESOURCE_ID; // Make sure that bad_ID is not a valid resource ID if (resource_id == bad_ID) bad_ID++; // Check to see if parameter control is supported if (rpt_entry.ResourceCapabilities & SAHPI_CAPABILITY_CONFIGURATION) { // Call saHpiParmControl with an invalid resource ID val = saHpiParmControl(session_id, bad_ID, action); if (val != SA_ERR_HPI_INVALID_RESOURCE) // The function works abnormally { e_print(saHpiParmControl, SA_ERR_HPI_INVALID_RESOURCE, val); ret = SAF_TEST_FAIL; } else // The function works the way it should ret = SAF_TEST_PASS_AND_EXIT; } else { // Resource Does not support parameter control ret = SAF_TEST_NOTSUPPORT; } return ret; } int main() { int ret = SAF_TEST_UNKNOWN; ret = process_all_domains(Test_Resource, NULL, NULL); return ret; }
#include "../../corelibs/U2View/src/util_msa_align/MSAAlignDialog.h"
//=========================================================================== // // modff.c // // Test of modff() math library function // //=========================================================================== // ####ECOSGPLCOPYRIGHTBEGIN#### // ------------------------------------------- // This file is part of eCos, the Embedded Configurable Operating System. // Copyright (C) 2012 Free Software Foundation, Inc. // // eCos 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. // // eCos 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 eCos; if not, write to the Free Software Foundation, Inc., // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // // As a special exception, if other files instantiate templates or use // macros or inline functions from this file, or you compile this file // and link it with other works to produce a work based on this file, // this file does not by itself cause the resulting work to be covered by // the GNU General Public License. However the source code for this file // must still be made available in accordance with section (3) of the GNU // General Public License v2. // // This exception does not invalidate any other reasons why a work based // on this file might be covered by the GNU General Public License. // ------------------------------------------- // ####ECOSGPLCOPYRIGHTEND#### //=========================================================================== //#####DESCRIPTIONBEGIN#### // // Author(s): // Contributors: visar, ilijak // Date: 1998-02-13 // Purpose: // Description: // Usage: // //####DESCRIPTIONEND#### // //=========================================================================== // Declarations for test system: // // TESTCASE_TYPE=CYG_TEST_MODULE // CONFIGURATION #include <pkgconf/libm.h> // Configuration header // INCLUDES #include <cyg/infra/cyg_type.h> // Common type definitions and support #include <cyg/infra/testcase.h> // Test infrastructure #include <math.h> // Header for this package #include <sys/ieeefp.h> // Cyg_libm_ieee_float_shape_type #include "vectors/vector_support_float.h"// extra support for math tests #include "vectors/modff.h" // FUNCTIONS static void test( CYG_ADDRWORD data ) { cyg_ucount32 vec_size; cyg_bool ret; vec_size = sizeof(modff_vec) / sizeof(Cyg_libm_test_float_vec_t); ret = doTestVecFloat( (CYG_ADDRWORD) &modff, CYG_LIBM_TEST_VEC_FLOAT, CYG_LIBM_TEST_VEC_FLOAT_P, CYG_LIBM_TEST_VEC_FLOAT, &modff_vec[0], vec_size ); if (ret==true) { CYG_TEST_PASS("modff() is stable"); } // if else { CYG_TEST_FAIL("modff() failed tests"); } // else CYG_TEST_FINISH("Finished tests from testcase " __FILE__ " for Math " "library modff() function"); } // test() int main(int argc, char *argv[]) { CYG_TEST_INIT(); CYG_TEST_INFO("Starting tests from testcase " __FILE__ " for Math library " "modff() function"); START_TEST( test ); CYG_TEST_PASS_FINISH("Testing is not applicable to this configuration"); } // main() // EOF modff.c
#ifndef __EXTI_H #define __EXTI_H #include "stm32f10x.h" void EXTI_PA0_Config(void); #endif /* __EXTI_H */
/* * (C) 2007-2011 Alibaba Group Holding Limited. * * 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. * * * Version: $Id * * Authors: * yiming.czw <yiming.czw@taobao.com> * - initial release * */ #ifndef THREAD_H_ #define THREAD_H_ class Thread { public: virtual void run (void ) = 0; virtual ~Thread(){} protected: int interior_loop; }; #endif
/* label_stack.h * * $Id$ * * 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 LABEL_STACK_H #define LABEL_STACK_H #include <QLabel> #include <QStack> #include <QTime> #include <QTimer> class LabelStack : public QLabel { Q_OBJECT public: explicit LabelStack(QWidget *parent = 0); void setTemporaryContext(int ctx); void pushText(QString &text, int ctx); protected: void mousePressEvent(QMouseEvent *event); void mouseReleaseEvent(QMouseEvent *event); void mouseDoubleClickEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event); void contextMenuEvent(QContextMenuEvent *event); private: typedef struct _StackItem { QString text; int ctx; } StackItem; int temporary_ctx_; QList<StackItem *> labels_; QTime temporary_epoch_; QTimer temporary_timer_; void fillLabel(); signals: void toggleTemporaryFlash(bool enable); void mousePressedAt(const QPoint &global_pos, Qt::MouseButton button); public slots: void popText(int ctx); private slots: void updateTemporaryStatus(); }; #endif // LABEL_STACK_H /* * Editor modelines * * Local Variables: * c-basic-offset: 4 * tab-width: 8 * indent-tabs-mode: nil * End: * * ex: set shiftwidth=4 tabstop=8 expandtab: * :indentSize=4:tabSize=8:noTabs=true: */
/* * tunif.h - tun interface * * Copyright (C) 2014 - 2016, Xiaoxiao <i@pxx.io> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef TUNIF_H #define TUNIF_H #include <stddef.h> #include <unistd.h> #ifdef HAVE_CONFIG_H # include "config.h" #endif extern int tun_new(const char *dev); extern void tun_close(int tun); #ifdef TARGET_LINUX # define tun_read read # define tun_write write #endif #ifdef TARGET_DARWIN extern ssize_t tun_read(int tun, void *buf, size_t len); extern ssize_t tun_write(int tun, void *buf, size_t len); #endif #endif // TUNIF_H
/* Copyright (©) 2003-2022 Teus Benschop. 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, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #pragma once #include <config/libraries.h> string sync_changes_url (); string sync_changes (void * webserver_request);
/* mpfr_mul_d -- multiply a multiple precision floating-point number by a machine double precision float Copyright 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. Contributed by the Arenaire and Caramel 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 "mpfr-impl.h" int mpfr_mul_d (mpfr_ptr a, mpfr_srcptr b, double c, mpfr_rnd_t rnd_mode) { int inexact; mpfr_t d; MPFR_SAVE_EXPO_DECL (expo); MPFR_LOG_FUNC (("b[%Pu]=%.*Rg c=%.20g rnd=%d", mpfr_get_prec(b), mpfr_log_prec, b, c, rnd_mode), ("a[%Pu]=%.*Rg inexact=%d", mpfr_get_prec (a), mpfr_get_prec, a, inexact)); MPFR_SAVE_EXPO_MARK (expo); mpfr_init2 (d, IEEE_DBL_MANT_DIG); inexact = mpfr_set_d (d, c, rnd_mode); MPFR_ASSERTN (inexact == 0); mpfr_clear_flags (); inexact = mpfr_mul (a, b, d, rnd_mode); MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags); mpfr_clear(d); MPFR_SAVE_EXPO_FREE (expo); return mpfr_check_range (a, inexact, rnd_mode); }
/** ****************************************************************************** * @file TIM/OCToggle/stm32l1xx_it.c * @author MCD Application Team * @version V1.1.1 * @date 13-April-2012 * @brief Main Interrupt Service Routines. * This file provides template for all exceptions handler and peripherals * interrupt service routine. ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2> * * Licensed under MCD-ST Liberty SW License Agreement V2, (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.st.com/software_license_agreement_liberty_v2 * * 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. * ****************************************************************************** */ /* Includes ------------------------------------------------------------------*/ #include "stm32l1xx_it.h" /** @addtogroup STM32L1xx_StdPeriph_Examples * @{ */ /** @addtogroup TIM_OCToggle * @{ */ /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ uint16_t capture = 0; extern __IO uint16_t CCR1_Val; extern __IO uint16_t CCR2_Val; extern __IO uint16_t CCR3_Val; extern __IO uint16_t CCR4_Val; /* Private function prototypes -----------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ /******************************************************************************/ /* Cortex-M3 Processor Exceptions Handlers */ /******************************************************************************/ /** * @brief This function handles NMI exception. * @param None * @retval None */ void NMI_Handler(void) { } /** * @brief This function handles Hard Fault exception. * @param None * @retval None */ void HardFault_Handler(void) { /* Go to infinite loop when Hard Fault exception occurs */ while (1) {} } /** * @brief This function handles Memory Manage exception. * @param None * @retval None */ void MemManage_Handler(void) { /* Go to infinite loop when Memory Manage exception occurs */ while (1) {} } /** * @brief This function handles Bus Fault exception. * @param None * @retval None */ void BusFault_Handler(void) { /* Go to infinite loop when Bus Fault exception occurs */ while (1) {} } /** * @brief This function handles Usage Fault exception. * @param None * @retval None */ void UsageFault_Handler(void) { /* Go to infinite loop when Usage Fault exception occurs */ while (1) {} } /** * @brief This function handles Debug Monitor exception. * @param None * @retval None */ void DebugMon_Handler(void) {} /** * @brief This function handles SVCall exception. * @param None * @retval None */ void SVC_Handler(void) {} /** * @brief This function handles PendSV_Handler exception. * @param None * @retval None */ void PendSV_Handler(void) {} /** * @brief This function handles SysTick Handler. * @param None * @retval None */ void SysTick_Handler(void) {} /******************************************************************************/ /* STM32L1xx Peripherals Interrupt Handlers */ /******************************************************************************/ /** * @brief This function handles TIM3 global interrupt request. * @param None * @retval None */ void TIM3_IRQHandler(void) { /* TIM3_CH1 toggling with frequency = 244.140 Hz */ if (TIM_GetITStatus(TIM3, TIM_IT_CC1) != RESET) { TIM_ClearITPendingBit(TIM3, TIM_IT_CC1 ); capture = TIM_GetCapture1(TIM3); TIM_SetCompare1(TIM3, capture + CCR1_Val ); } /* TIM3_CH2 toggling with frequency = 976.562 Hz */ if (TIM_GetITStatus(TIM3, TIM_IT_CC2) != RESET) { TIM_ClearITPendingBit(TIM3, TIM_IT_CC2); capture = TIM_GetCapture2(TIM3); TIM_SetCompare2(TIM3, capture + CCR2_Val); } /* TIM3_CH3 toggling with frequency = 1953.125 Hz */ if (TIM_GetITStatus(TIM3, TIM_IT_CC3) != RESET) { TIM_ClearITPendingBit(TIM3, TIM_IT_CC3); capture = TIM_GetCapture3(TIM3); TIM_SetCompare3(TIM3, capture + CCR3_Val); } /* TIM3_CH4 toggling with frequency = 3906.25 Hz */ if (TIM_GetITStatus(TIM3, TIM_IT_CC4) != RESET) { TIM_ClearITPendingBit(TIM3, TIM_IT_CC4); capture = TIM_GetCapture4(TIM3); TIM_SetCompare4(TIM3, capture + CCR4_Val); } } /******************************************************************************/ /* STM32L1xx Peripherals Interrupt Handlers */ /* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */ /* available peripheral interrupt handler's name please refer to the startup */ /* file (startup_stm32l1xx_xx.s). */ /******************************************************************************/ /** * @brief This function handles PPP interrupt request. * @param None * @retval None */ /*void PPP_IRQHandler(void) { }*/ /** * @} */ /** * @} */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
// Copyright 2019-2020 CERN and copyright holders of ALICE O2. // See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. // All rights not expressly granted are reserved. // // This software is distributed under the terms of the GNU General Public // License v3 (GPL Version 3), copied verbatim in the file "COPYING". // // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. /// \file GPUTRDTrack.h /// \author Ole Schmidt #ifndef GPUTRDTRACK_H #define GPUTRDTRACK_H #include "GPUTRDDef.h" #include "GPUCommonDef.h" #include "GPUCommonRtypes.h" struct GPUTRDTrackDataRecord; class AliHLTExternalTrackParam; namespace o2 { namespace tpc { class TrackTPC; } // namespace tpc namespace dataformats { class TrackTPCITS; class GlobalTrackID; } // namespace dataformats } // namespace o2 //_____________________________________________________________________________ #if (defined(__CINT__) || defined(__ROOTCINT__)) && !defined(__CLING__) namespace GPUCA_NAMESPACE { namespace gpu { template <typename T> class GPUTRDTrack_t; } // namespace gpu } // namespace GPUCA_NAMESPACE #else #if (!defined(GPUCA_STANDALONE) && !defined(GPUCA_ALIROOT_LIB)) || defined(GPUCA_HAVE_O2HEADERS) #include "GPUTRDInterfaceO2Track.h" #endif namespace GPUCA_NAMESPACE { namespace gpu { template <typename T> class GPUTRDTrack_t : public T { public: enum EGPUTRDTrack { kNLayers = 6, kAmbiguousFlag = 6, kStopFlag = 7 }; GPUd() GPUTRDTrack_t(); GPUTRDTrack_t(const typename T::baseClass& t) = delete; GPUd() GPUTRDTrack_t(const GPUTRDTrack_t& t); GPUd() GPUTRDTrack_t(const AliHLTExternalTrackParam& t); GPUd() GPUTRDTrack_t(const o2::dataformats::TrackTPCITS& t); GPUd() GPUTRDTrack_t(const o2::tpc::TrackTPC& t); GPUd() GPUTRDTrack_t(const T& t); GPUd() GPUTRDTrack_t& operator=(const GPUTRDTrack_t& t); // attach a tracklet to this track; this overwrites the mFlags flag to true for this layer GPUd() void addTracklet(int iLayer, int idx) { mAttachedTracklets[iLayer] = idx; } // getters GPUd() int getNlayersFindable() const; GPUd() int getTrackletIndex(int iLayer) const { return mAttachedTracklets[iLayer]; } GPUd() unsigned int getRefGlobalTrackIdRaw() const { return mRefGlobalTrackId; } // This method is only defined in TrackTRD.h and is intended to be used only with that TRD track type GPUd() o2::dataformats::GlobalTrackID getRefGlobalTrackId() const; GPUd() short getCollisionId() const { return mCollisionId; } GPUd() int getNtracklets() const; GPUd() float getChi2() const { return mChi2; } GPUd() float getReducedChi2() const { return getNlayersFindable() == 0 ? mChi2 : mChi2 / getNlayersFindable(); } GPUd() bool getIsStopped() const { return (mFlags >> kStopFlag) & 0x1; } GPUd() bool getIsAmbiguous() const { return (mFlags >> kAmbiguousFlag) & 0x1; } GPUd() bool getIsFindable(int iLayer) const { return (mFlags >> iLayer) & 0x1; } GPUd() int getNmissingConsecLayers(int iLayer) const; GPUd() int getIsPenaltyAdded(int iLayer) const { return getIsFindable(iLayer) && getTrackletIndex(iLayer) < 0; } // for AliRoot compatibility. To be removed once HLT/global/AliHLTGlobalEsdConverterComponent.cxx does not require them anymore GPUd() int GetTPCtrackId() const { return mRefGlobalTrackId; } GPUd() bool GetIsStopped() const { return getIsStopped(); } GPUd() int GetNtracklets() const { return getNtracklets(); } // setters GPUd() void setRefGlobalTrackIdRaw(unsigned int id) { mRefGlobalTrackId = id; } // This method is only defined in TrackTRD.h and is intended to be used only with that TRD track type GPUd() void setRefGlobalTrackId(o2::dataformats::GlobalTrackID id); GPUd() void setCollisionId(short id) { mCollisionId = id; } GPUd() void setIsFindable(int iLayer) { mFlags |= (1U << iLayer); } GPUd() void setIsStopped() { mFlags |= (1U << kStopFlag); } GPUd() void setIsAmbiguous() { mFlags |= (1U << kAmbiguousFlag); } GPUd() void setChi2(float chi2) { mChi2 = chi2; } // conversion to / from HLT track structure (only for AliRoot) GPUd() void ConvertTo(GPUTRDTrackDataRecord& t) const; GPUd() void ConvertFrom(const GPUTRDTrackDataRecord& t); protected: float mChi2; // total chi2. unsigned int mRefGlobalTrackId; // raw GlobalTrackID of the seeding track (either ITS-TPC or TPC) int mAttachedTracklets[kNLayers]; // indices of the tracklets attached to this track; -1 means no tracklet in that layer short mCollisionId; // the collision ID of the tracklets attached to this track; is used to retrieve the BC information for this track after the tracking is done unsigned char mFlags; // bits 0 to 5 indicate whether track is findable in layer 0 to 5, bit 6 indicates an ambiguous track and bit 7 flags if the track is stopped in the TRD private: GPUd() void initialize(); #if !defined(GPUCA_STANDALONE) && !defined(GPUCA_ALIROOT_LIB) ClassDefNV(GPUTRDTrack_t, 2); #endif }; } // namespace gpu } // namespace GPUCA_NAMESPACE #endif // !((defined(__CINT__) || defined(__ROOTCINT__)) && !defined(__CLING__)) #endif // GPUTRDTRACK_H
/** * Marlin 3D Printer Firmware * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm * * 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/>. * */ /** * Arduino Mega with RAMPS v1.0, v1.1, v1.2 pin assignments */ #if !defined(__AVR_ATmega1280__) && !defined(__AVR_ATmega2560__) #error "Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu." #endif // Uncomment the following line for RAMPS v1.0 //#define RAMPS_V_1_0 #define X_STEP_PIN 26 #define X_DIR_PIN 28 #define X_ENABLE_PIN 24 #define X_MIN_PIN 3 #define X_MAX_PIN 2 #define Y_STEP_PIN 38 #define Y_DIR_PIN 40 #define Y_ENABLE_PIN 36 #define Y_MIN_PIN 16 #define Y_MAX_PIN 17 #define Z_STEP_PIN 44 #define Z_DIR_PIN 46 #define Z_ENABLE_PIN 42 #define Z_MIN_PIN 18 #define Z_MAX_PIN 19 #define E0_STEP_PIN 32 #define E0_DIR_PIN 34 #define E0_ENABLE_PIN 30 #define SDPOWER 48 #define SDSS 53 #define LED_PIN 13 #if ENABLED(RAMPS_V_1_0) // RAMPS_V_1_0 #define HEATER_0_PIN 12 // RAMPS 1.0 #define HEATER_BED_PIN -1 // RAMPS 1.0 #define FAN_PIN 11 // RAMPS 1.0 #else // RAMPS_V_1_1 or RAMPS_V_1_2 #define HEATER_0_PIN 10 // RAMPS 1.1 #define HEATER_BED_PIN 8 // RAMPS 1.1 #define FAN_PIN 9 // RAMPS 1.1 #endif #define TEMP_0_PIN 2 // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!! #define TEMP_BED_PIN 1 // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!! // SPI for Max6675 or Max31855 Thermocouple #if DISABLED(SDSUPPORT) #define MAX6675_SS 66// Do not use pin 53 if there is even the remote possibility of using Display/SD card #else #define MAX6675_SS 66// Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present #endif #if DISABLED(SDSUPPORT) // these pins are defined in the SD library if building with SD support #define SCK_PIN 52 #define MISO_PIN 50 #define MOSI_PIN 51 #endif
#pragma once class CVobDec { int m_lfsr0, m_lfsr1; void ClockLfsr0Forward(int& lfsr0); void ClockLfsr1Forward(int& lfsr1); void ClockBackward(int& lfsr0, int& lfsr1); void Salt(const BYTE salt[5], int& lfsr0, int& lfsr1); int FindLfsr(const BYTE* crypt, int offset, const BYTE* plain); public: CVobDec(); virtual ~CVobDec(); bool m_fFoundKey; bool FindKey(BYTE* buff); void Decrypt(BYTE* buff); };