text
stringlengths
4
6.14k
/* This is part of the netCDF package. Copyright 2005 University Corporation for Atmospheric Research/Unidata See COPYRIGHT file for conditions of use. Test internal netcdf-4 file code. $Id: tst_mem.c 994 2011-03-21 16:00:55Z ed $ */ #include <config.h> #include <stdio.h> #include <nc_tests.h> #include "netcdf.h" #include <hdf5.h> #include <unistd.h> #include <time.h> #include <sys/time.h> /* Extra high precision time info. */ #include <string.h> #define NDIMS 1 #define FILE_NAME "tst_mem.nc" #define NUM_TRIES 20000 #define TIME_NAME "time" #define SFC_TEMP_NAME "sfc_temp" void get_mem_used2(int *mem_used) { char buf[30]; FILE *pf; snprintf(buf, 30, "/proc/%u/statm", (unsigned)getpid()); pf = fopen(buf, "r"); if (pf) { unsigned size; /* total program size */ unsigned resident;/* resident set size */ unsigned share;/* shared pages */ unsigned text;/* text (code) */ unsigned lib;/* library */ unsigned data;/* data/stack */ /*unsigned dt; dirty pages (unused in Linux 2.6)*/ fscanf(pf, "%u %u %u %u %u %u", &size, &resident, &share, &text, &lib, &data); *mem_used = data; } else *mem_used = -1; fclose(pf); } int main(void) { int ncid, sfc_tempid; float data; int dimid; size_t l_index[NDIMS] = {10000}; int mem_used, mem_used1; int i; printf("\n*** Testing netcdf-4 memory use with unlimited dimensions.\n"); printf("*** testing with user-contributed code..."); if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR; if (nc_def_dim(ncid, TIME_NAME, NC_UNLIMITED, &dimid)) ERR; if (nc_def_var(ncid, SFC_TEMP_NAME, NC_FLOAT, NDIMS, &dimid, &sfc_tempid)) ERR; /* Write data each 100ms*/ get_mem_used2(&mem_used); for (i = 0; i < NUM_TRIES; i++) { data = 25.5 + l_index[0]; if (nc_put_var1_float(ncid, sfc_tempid, l_index, (const float*) &data)) ERR; l_index[0]++; get_mem_used2(&mem_used1); if (!(i%100) && mem_used1 - mem_used) printf("delta %d bytes of memory for try %d\n", mem_used1 - mem_used, i); } if (nc_close(ncid)) ERR; SUMMARIZE_ERR; FINAL_RESULTS; }
/* * Multi2Sim * Copyright (C) 2007 Rafael Ubal Tena (raurte@gap.upv.es) * * 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 */ #include <options.h> #include <m2skernel.h> /* Options */ static uint32_t start_address = 0; static uint32_t stop_address = 0; static void sim_reg_options() { opt_reg_uint32("-start_address", "address to start dump", &start_address); opt_reg_uint32("-stop_address", "address to stop dump", &stop_address); } static void sim_dump_section(void *buf, uint32_t addr, int size) { uint32_t start, stop, offset; x86_inst_t inst; start = start_address > addr ? start_address - addr : 0; if (!stop_address || stop_address >= addr + size - 1) stop = size - 1; else stop = stop_address - addr; for (offset = start; offset <= stop; offset += inst.size) { x86_disasm(buf + offset, addr + offset, &inst); printf("%x ", addr + offset); if (inst.opcode == op_none) { printf("???\n"); break; } x86_inst_dump(&inst, stdout); printf("\n"); } } static void sim_dump(char *file) { struct elf_file_t *elf; void *buf; uint32_t addr, size, flags; char *name; int i; /* Open file */ elf = elf_open(file); if (!elf) fatal("%s: cannot open file", file); /* Sections */ for (i = 0; i < elf_section_count(elf); i++) { elf_section_info(elf, i, &name, &addr, &size, &flags); if (!(flags & SHF_EXECINSTR)) continue; /* Not in requested range */ if (stop_address && stop_address < addr) continue; if (start_address >= addr + size) continue; /* Obtain buffer */ buf = elf_section_read(elf, i); sim_dump_section(buf, addr, size); elf_free_buffer(buf); } } int main(int argc, char **argv) { /* Initial information */ fprintf(stderr, "\nMulti2Sim. Executable file dumper (m2s-objdump)\n"); fprintf(stderr, "Last compilation: %s %s\n\n", __DATE__, __TIME__); /* Options */ opt_init(); sim_reg_options(); opt_check_options(&argc, argv); opt_print_options(stderr); if (argc != 2) { fprintf(stderr, "syntax: m2s-objdump [<options>] <file>\n"); exit(1); } disasm_init(); sim_dump(argv[1]); disasm_done(); opt_done(); return 0; }
/* * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://ugfx.org/license.html */ /** * @file boards/addons/gdisp/board_SSD1289_stm32f4discovery.h * @brief GDISP Graphic Driver subsystem board interface for the SSD1289 display. * * @note This file contains a mix of hardware specific and operating system specific * code. You will need to change it for your CPU and/or operating system. */ #ifndef _GDISP_LLD_BOARD_H #define _GDISP_LLD_BOARD_H // For a multiple display configuration we would put all this in a structure and then // set g->board to that structure. #define GDISP_REG ((volatile uint16_t *) 0x60000000)[0] /* RS = 0 */ #define GDISP_RAM ((volatile uint16_t *) 0x60020000)[0] /* RS = 1 */ #define GDISP_DMA_STREAM STM32_DMA2_STREAM6 #define FSMC_BANK 0 /* PWM configuration structure. We use timer 3 channel 3 */ static const PWMConfig pwmcfg = { 100000, /* 100 kHz PWM clock frequency. */ 100, /* PWM period is 100 cycles. */ 0, { {PWM_OUTPUT_DISABLED, 0}, {PWM_OUTPUT_DISABLED, 0}, {PWM_OUTPUT_ACTIVE_HIGH, 0}, {PWM_OUTPUT_DISABLED, 0} }, 0, 0 }; static GFXINLINE void init_board(GDisplay *g) { // As we are not using multiple displays we set g->board to NULL as we don't use it. g->board = 0; switch(g->controllerdisplay) { case 0: // Set up for Display 0 /** * Performs the following functions: * 1. initialise the io port used by the display * 2. initialise the reset pin (initial state not-in-reset) * 3. initialise the chip select pin (initial state not-active) * 4. initialise the backlight pin (initial state back-light off) */ #if defined(STM32F1XX) || defined(STM32F3XX) /* FSMC setup for F1/F3 */ rccEnableAHB(RCC_AHBENR_FSMCEN, 0); #if defined(GDISP_USE_DMA) #error "GDISP: SSD1289 - DMA not implemented for F1/F3 Devices" #endif #elif defined(STM32F4XX) || defined(STM32F2XX) /* STM32F2-F4 FSMC init */ rccEnableAHB3(RCC_AHB3ENR_FSMCEN, 0); #if defined(GDISP_USE_DMA) if (dmaStreamAllocate(GDISP_DMA_STREAM, 0, 0, 0)) gfxExit(); dmaStreamSetMemory0(GDISP_DMA_STREAM, &GDISP_RAM); dmaStreamSetMode(GDISP_DMA_STREAM, STM32_DMA_CR_PL(0) | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_DIR_M2M); #else #warning "GDISP: SSD1289 - DMA is supported for F2/F4 Devices. Define GDISP_USE_DMA in your gfxconf.h to turn this on for better performance." #endif #else #error "GDISP: SSD1289 - FSMC not implemented for this device" #endif /* set pins to FSMC mode */ IOBus busD = {GPIOD, (1 << 0) | (1 << 1) | (1 << 4) | (1 << 5) | (1 << 7) | (1 << 8) | (1 << 9) | (1 << 10) | (1 << 11) | (1 << 14) | (1 << 15), 0}; IOBus busE = {GPIOE, (1 << 7) | (1 << 8) | (1 << 9) | (1 << 10) | (1 << 11) | (1 << 12) | (1 << 13) | (1 << 14) | (1 << 15), 0}; palSetBusMode(&busD, PAL_MODE_ALTERNATE(12)); palSetBusMode(&busE, PAL_MODE_ALTERNATE(12)); /* FSMC timing */ FSMC_Bank1->BTCR[FSMC_BANK+1] = FSMC_BTR1_ADDSET_0 | FSMC_BTR1_DATAST_2 | FSMC_BTR1_BUSTURN_0 ; /* Bank1 NOR/SRAM control register configuration * This is actually not needed as already set by default after reset */ FSMC_Bank1->BTCR[FSMC_BANK] = FSMC_BCR1_MWID_0 | FSMC_BCR1_WREN | FSMC_BCR1_MBKEN; /* Display backlight control */ /* TIM3 is an alternate function 2 (AF2) */ pwmStart(&PWMD3, &pwmcfg); palSetPadMode(GPIOB, 0, PAL_MODE_ALTERNATE(2)); pwmEnableChannel(&PWMD3, 2, 100); break; } } static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { (void) g; (void) state; } static GFXINLINE void set_backlight(GDisplay *g, uint8_t percent) { (void) g; pwmEnableChannel(&PWMD3, 2, percent); } static GFXINLINE void acquire_bus(GDisplay *g) { (void) g; } static GFXINLINE void release_bus(GDisplay *g) { (void) g; } static GFXINLINE void write_index(GDisplay *g, uint16_t index) { (void) g; GDISP_REG = index; } static GFXINLINE void write_data(GDisplay *g, uint16_t data) { (void) g; GDISP_RAM = data; } static GFXINLINE void setreadmode(GDisplay *g) { (void) g; FSMC_Bank1->BTCR[FSMC_BANK+1] = FSMC_BTR1_ADDSET_3 | FSMC_BTR1_DATAST_3 | FSMC_BTR1_BUSTURN_0; /* FSMC timing */ } static GFXINLINE void setwritemode(GDisplay *g) { (void) g; FSMC_Bank1->BTCR[FSMC_BANK+1] = FSMC_BTR1_ADDSET_0 | FSMC_BTR1_DATAST_2 | FSMC_BTR1_BUSTURN_0; /* FSMC timing */ } static GFXINLINE uint16_t read_data(GDisplay *g) { (void) g; return GDISP_RAM; } #if defined(GDISP_USE_DMA) || defined(__DOXYGEN__) static GFXINLINE void dma_with_noinc(GDisplay *g, color_t *buffer, int area) { (void) g; dmaStreamSetPeripheral(GDISP_DMA_STREAM, buffer); dmaStreamSetMode(GDISP_DMA_STREAM, STM32_DMA_CR_PL(0) | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_DIR_M2M); for (; area > 0; area -= 65535) { dmaStreamSetTransactionSize(GDISP_DMA_STREAM, area > 65535 ? 65535 : area); dmaStreamEnable(GDISP_DMA_STREAM); dmaWaitCompletion(GDISP_DMA_STREAM); } } static GFXINLINE void dma_with_inc(GDisplay *g, color_t *buffer, int area) { (void) g; dmaStreamSetPeripheral(GDISP_DMA_STREAM, buffer); dmaStreamSetMode(GDISP_DMA_STREAM, STM32_DMA_CR_PL(0) | STM32_DMA_CR_PINC | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_DIR_M2M); for (; area > 0; area -= 65535) { dmaStreamSetTransactionSize(GDISP_DMA_STREAM, area > 65535 ? 65535 : area); dmaStreamEnable(GDISP_DMA_STREAM); dmaWaitCompletion(GDISP_DMA_STREAM); } } #endif #endif /* _GDISP_LLD_BOARD_H */
// VideoInputFfmpeg.h: Video input processing using Gstreamer // // Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 // Free Software Foundation, Inc. // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; 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 St, Fifth Floor, Boston, MA 02110-1301 USA #ifndef GNASH_VIDEOINPUTFFMPEG_H #define GNASH_VIDEOINPUTFFMPEG_H #include <vector> #include <cstdint> // for C99 int types #include <vector> #include "VideoInput.h" namespace gnash { namespace media { namespace ffmpeg { class VideoInputFfmpeg : public VideoInput { public: /// Constructor for the VideoInputFfmpeg class // /// TODO: most of these properties need not be stored, but should rather /// be queried from the input device. VideoInputFfmpeg(); /// Destructor for the VideoInputFfmpeg class virtual ~VideoInputFfmpeg(); static void getNames(std::vector<std::string>& /*names*/) {} /// Return the current activity level of the webcam // /// @return A double specifying the amount of motion currently /// detected by the camera. double activityLevel () const { return _activityLevel; } /// The maximum available bandwidth for outgoing connections // /// TODO: see if this should really be here. size_t bandwidth() const { return _bandwidth; } void setBandwidth(size_t bandwidth) { _bandwidth = bandwidth; } /// The current frame rate of the webcam // /// @return A double specifying the webcam's current FPS double currentFPS() const { return _currentFPS; } /// The maximum FPS rate of the webcam // /// @return A double specifying the webcam's maximum FPS double fps() const { return _fps; } /// Return the height of the webcam's frame size_t height() const { return _height; } /// Return the width of the webcam's frame size_t width() const { return _width; } /// The index of the camera size_t index() const { return _index; } /// Request a native mode most closely matching the passed variables. // /// @param width The required width /// @param height The required height /// @param fps The required frame rate /// @param favorArea How to match the requested mode. void requestMode(size_t width, size_t height, double fps, bool favorArea); /// Set the amount of motion required before notifying the core void setMotionLevel(int m) { _motionLevel = m; } /// Return the current motionLevel setting int motionLevel() const { return _motionLevel; } /// Set time without motion in milliseconds before core is notified void setMotionTimeout(int m) { _motionTimeout = m; } /// Return the current motionTimeout setting. int motionTimeout() const { return _motionTimeout; } void mute(bool m) { _muted = m; } bool muted() const { return _muted; } /// Return the name of this webcam // /// @return a string specifying the name of the webcam. const std::string& name() const { return _name; } /// Set the quality of the webcam void setQuality(int q) { _quality = q; } /// Return the current quality of the webcam int quality() const { return _quality; } /// \brief Function starts up the pipeline designed earlier in code /// execution. This puts everything into motion. /// /// @return True if the pipeline was started correctly, false otherwise. bool play(); /// \brief Function stops the pipeline designed earlier in code execution. /// /// @return True if the pipeline was stopped correctly, false otherwise. bool stop(); private: /// TODO: see which of these need to be retrieved from the camera, /// which of them should be stored like this, and which should /// be stored in the Camera_as relay object. /// The currently detected activity level. This should be queried from /// the camera. double _activityLevel; /// The available bandwidth. This probably shouldn't be dealt with by /// the camera class. But maybe it should. size_t _bandwidth; /// The current FPS of the camera. This should be queried from the /// camera. double _currentFPS; /// The maximum FPS allowed. double _fps; /// The height of the frame. This should probably be retrieved from /// the camera size_t _height; /// The width of the frame. This should probably be retrieved from /// the camera size_t _width; /// The index of this Webcam size_t _index; /// The motion level required to trigger a notification to the core int _motionLevel; /// The length of inactivity required to trigger a notification to the core. int _motionTimeout; /// Whether access to the camera is allowed. This depends on the rcfile /// setting bool _muted; /// The name of this camera. std::string _name; /// The current quality setting. int _quality; }; } // ffmpeg namespace } // media namespace } // gnash namespace #endif
/***************************************************************************** * * 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 * * $Id: ffmpeg.h 271 2005-08-09 08:31:35Z picard $ * * The Core Pocket Media Player * Copyright (c) 2004-2005 Gabor Kovacs * ****************************************************************************/ #ifndef __FFMPEG_H #define __FFMPEG_H void FFMPEG_Init(); void FFMPEG_Done(); #endif
#pragma region Copyright (c) 2014-2016 OpenRCT2 Developers /***************************************************************************** * OpenRCT2, an open source clone of Roller Coaster Tycoon 2. * * OpenRCT2 is the work of many authors, a full list can be found in contributors.md * For more information, visit https://github.com/OpenRCT2/OpenRCT2 * * OpenRCT2 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. * * A full copy of the GNU General Public License can be found in licence.txt *****************************************************************************/ #pragma endregion #include "../../common.h" #include "../../interface/viewport.h" #include "../track_paint.h" #include "../../paint/supports.h" #include "../../paint/paint.h" #include "../track.h" enum { SPR_SPACE_RINGS_FENCE_NE = 22146, SPR_SPACE_RINGS_FENCE_SE = 22147, SPR_SPACE_RINGS_FENCE_SW = 22148, SPR_SPACE_RINGS_FENCE_NW = 22149, }; static const uint32 space_rings_fence_sprites[] = { SPR_SPACE_RINGS_FENCE_NE, SPR_SPACE_RINGS_FENCE_SE, SPR_SPACE_RINGS_FENCE_SW, SPR_SPACE_RINGS_FENCE_NW, }; /** rct2: 0x00768A3B */ static void paint_space_rings_structure(rct_ride * ride, uint8 direction, uint32 segment, int height) { rct_map_element * savedMapElement = g_currently_drawn_item; uint32 vehicleIndex = (segment - direction) & 0x3; if (ride->num_stations == 0 || vehicleIndex < ride->num_vehicles) { rct_ride_entry * ride_type = get_ride_entry(ride->subtype); rct_vehicle * vehicle = NULL; int frameNum = direction; uint32 baseImageId = ride_type->vehicles[0].base_image_id; if (ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK && ride->vehicles[0] != SPRITE_INDEX_NULL) { gPaintInteractionType = VIEWPORT_INTERACTION_ITEM_SPRITE; vehicle = GET_VEHICLE(ride->vehicles[vehicleIndex]); g_currently_drawn_item = vehicle; frameNum += (sint8) vehicle->vehicle_sprite_type * 4; } uint32 imageColourFlags = gTrackColours[SCHEME_MISC]; if ((ride->colour_scheme_type & 3) != RIDE_COLOUR_SCHEME_DIFFERENT_PER_TRAIN) { vehicleIndex = 0; } if (imageColourFlags == 0x20000000) { imageColourFlags = ride->vehicle_colours[vehicleIndex].body_colour << 19 | ride->vehicle_colours[0].trim_colour << 24 | 0xA0000000; } uint32 imageId = (baseImageId + frameNum) | imageColourFlags; sub_98197C(imageId, 0, 0, 20, 20, 23, height, -10, -10, height, get_current_rotation()); if (vehicle != NULL && vehicle->num_peeps > 0) { rct_peep * rider = GET_PEEP(vehicle->peep[0]); imageColourFlags = rider->tshirt_colour << 19 | rider->trousers_colour << 24 | 0xA0000000; imageId = ((baseImageId & 0x7FFFF) + 352 + frameNum) | imageColourFlags; sub_98199C(imageId, 0, 0, 20, 20, 23, height, -10, -10, height, get_current_rotation()); } } g_currently_drawn_item = savedMapElement; gPaintInteractionType = VIEWPORT_INTERACTION_ITEM_RIDE; } /** rct2: 0x00767C40 */ static void paint_space_rings(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) { trackSequence = track_map_3x3[direction][trackSequence]; int edges = edges_3x3[trackSequence]; rct_ride * ride = get_ride(rideIndex); rct_xy16 position = {gPaintMapPosition.x, gPaintMapPosition.y}; uint32 imageId; wooden_a_supports_paint_setup((direction & 1), 0, height, gTrackColours[SCHEME_MISC], NULL); track_paint_util_paint_floor(edges, gTrackColours[SCHEME_TRACK], height, floorSpritesCork, get_current_rotation()); switch (trackSequence) { case 7: if (track_paint_util_has_fence(EDGE_SW, position, mapElement, ride, get_current_rotation())) { imageId = SPR_SPACE_RINGS_FENCE_SW | gTrackColours[SCHEME_MISC]; sub_98197C(imageId, 0, 0, 1, 28, 7, height, 29, 0, height + 2, get_current_rotation()); } if (track_paint_util_has_fence(EDGE_SE, position, mapElement, ride, get_current_rotation())) { imageId = SPR_SPACE_RINGS_FENCE_SE | gTrackColours[SCHEME_MISC]; sub_98197C(imageId, 0, 0, 28, 1, 7, height, 0, 29, height + 2, get_current_rotation()); } break; default: track_paint_util_paint_fences(edges, position, mapElement, ride, gTrackColours[SCHEME_MISC], height, space_rings_fence_sprites, get_current_rotation()); break; } switch (trackSequence) { case 0: paint_space_rings_structure(ride, direction, 0, height + 3); break; case 5: paint_space_rings_structure(ride, direction, 1, height + 3); break; case 7: paint_space_rings_structure(ride, direction, 2, height + 3); break; case 8: paint_space_rings_structure(ride, direction, 3, height + 3); break; } int cornerSegments = 0; switch (trackSequence) { case 0: cornerSegments = 0; break; case 1: cornerSegments = SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4 | SEGMENT_CC | SEGMENT_BC; break; case 2: cornerSegments = SEGMENT_B4 | SEGMENT_CC | SEGMENT_BC; break; case 3: cornerSegments = SEGMENT_B4 | SEGMENT_CC | SEGMENT_BC | SEGMENT_D4 | SEGMENT_C0; break; case 4: cornerSegments = SEGMENT_B4 | SEGMENT_C8 | SEGMENT_B8; break; case 5: cornerSegments = SEGMENT_BC | SEGMENT_D4 | SEGMENT_C0; break; case 6: cornerSegments = SEGMENT_B4 | SEGMENT_C8 | SEGMENT_B8 | SEGMENT_D0 | SEGMENT_C0; break; case 7: cornerSegments = SEGMENT_B8 | SEGMENT_D0 | SEGMENT_C0 | SEGMENT_D4 | SEGMENT_BC; break; case 8: cornerSegments = SEGMENT_B8 | SEGMENT_D0 | SEGMENT_C0; break; } paint_util_set_segment_support_height(cornerSegments, height + 2, 0x20); paint_util_set_segment_support_height(SEGMENTS_ALL & ~cornerSegments, 0xFFFF, 0); paint_util_set_general_support_height(height + 48, 0x20); } /** * rct2: 0x0x00767A40 */ TRACK_PAINT_FUNCTION get_track_paint_function_space_rings(int trackType, int direction) { if (trackType != FLAT_TRACK_ELEM_3_X_3) { return NULL; } return paint_space_rings; }
/* Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization dedicated to making software imaging solutions freely available. You may not use this file except in compliance with the License. obtain a copy of the License at http://www.imagemagick.org/script/license.php 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. MagickCore image color methods. */ #ifndef _MAGICKCORE_COLOR_PRIVATE_H #define _MAGICKCORE_COLOR_PRIVATE_H #if defined(__cplusplus) || defined(c_plusplus) extern "C" { #endif #include <magick/image.h> #include <magick/color.h> #include <magick/exception-private.h> static inline MagickBooleanType IsColorEqual(const PixelPacket *p, const PixelPacket *q) { if ((GetPixelRed(p) == GetPixelRed(q)) && (GetPixelGreen(p) == GetPixelGreen(q)) && (GetPixelBlue(p) == GetPixelBlue(q))) return(MagickTrue); return(MagickFalse); } static inline MagickBooleanType IsGray(const PixelPacket *pixel) { if ((GetPixelRed(pixel) == GetPixelGreen(pixel)) && (GetPixelGreen(pixel) == GetPixelBlue(pixel))) return(MagickTrue); return(MagickFalse); } static inline MagickBooleanType IsMagickColorEqual(const MagickPixelPacket *p, const MagickPixelPacket *q) { #if !defined(MAGICKCORE_HDRI_SUPPORT) if ((p->matte != MagickFalse) && (q->matte == MagickFalse) && (p->opacity != OpaqueOpacity)) return(MagickFalse); if ((q->matte != MagickFalse) && (p->matte == MagickFalse) && (q->opacity != OpaqueOpacity)) return(MagickFalse); if ((p->matte != MagickFalse) && (q->matte != MagickFalse)) { if (p->opacity != q->opacity) return(MagickFalse); if (p->opacity == TransparentOpacity) return(MagickTrue); } if (p->red != q->red) return(MagickFalse); if (p->green != q->green) return(MagickFalse); if (p->blue != q->blue) return(MagickFalse); if ((p->colorspace == CMYKColorspace) && (p->index != q->index)) return(MagickFalse); #else if ((p->matte != MagickFalse) && (q->matte == MagickFalse) && (fabs(p->opacity-OpaqueOpacity) > 0.5)) return(MagickFalse); if ((q->matte != MagickFalse) && (p->matte == MagickFalse) && (fabs(q->opacity-OpaqueOpacity)) > 0.5) return(MagickFalse); if ((p->matte != MagickFalse) && (q->matte != MagickFalse)) { if (fabs(p->opacity-q->opacity) > 0.5) return(MagickFalse); if (fabs(p->opacity-TransparentOpacity) <= 0.5) return(MagickTrue); } if (fabs(p->red-q->red) > 0.5) return(MagickFalse); if (fabs(p->green-q->green) > 0.5) return(MagickFalse); if (fabs(p->blue-q->blue) > 0.5) return(MagickFalse); if ((p->colorspace == CMYKColorspace) && (fabs(p->index-q->index) > 0.5)) return(MagickFalse); #endif return(MagickTrue); } static inline MagickBooleanType IsMagickGray(const MagickPixelPacket *pixel) { if (pixel->colorspace != RGBColorspace) return(MagickFalse); if ((pixel->red == pixel->green) && (pixel->green == pixel->blue)) return(MagickTrue); return(MagickFalse); } static inline MagickRealType MagickPixelIntensity( const MagickPixelPacket *pixel) { return((MagickRealType) (0.299*pixel->red+0.587*pixel->green+0.114*pixel->blue)); } static inline Quantum MagickPixelIntensityToQuantum( const MagickPixelPacket *pixel) { #if !defined(MAGICKCORE_HDRI_SUPPORT) return((Quantum) (0.299*pixel->red+0.587*pixel->green+0.114*pixel->blue+0.5)); #else return((Quantum) (0.299*pixel->red+0.587*pixel->green+0.114*pixel->blue)); #endif } static inline MagickRealType MagickPixelLuminance( const MagickPixelPacket *pixel) { MagickRealType luminance; luminance=0.21267*pixel->red+0.71516*pixel->green+0.07217*pixel->blue; return(luminance); } static inline MagickRealType PixelIntensity(const PixelPacket *pixel) { MagickRealType intensity; if ((GetPixelRed(pixel) == GetPixelGreen(pixel)) && (GetPixelGreen(pixel) == GetPixelBlue(pixel))) return((MagickRealType) pixel->red); intensity=(MagickRealType) (0.299*GetPixelRed(pixel)+0.587* GetPixelGreen(pixel)+0.114*GetPixelBlue(pixel)); return(intensity); } static inline Quantum PixelIntensityToQuantum(const PixelPacket *pixel) { #if !defined(MAGICKCORE_HDRI_SUPPORT) if ((GetPixelRed(pixel) == GetPixelGreen(pixel)) && (GetPixelGreen(pixel) == GetPixelBlue(pixel))) return(GetPixelRed(pixel)); return((Quantum) (0.299*GetPixelRed(pixel)+0.587* GetPixelGreen(pixel)+0.114*GetPixelBlue(pixel)+0.5)); #else { double alpha, beta; alpha=GetPixelRed(pixel)-GetPixelGreen(pixel); beta=GetPixelGreen(pixel)-GetPixelBlue(pixel); if ((fabs(alpha) <= MagickEpsilon) && (fabs(beta) <= MagickEpsilon)) return(GetPixelRed(pixel)); return((Quantum) (0.299*GetPixelRed(pixel)+0.587* GetPixelGreen(pixel)+0.114*GetPixelBlue(pixel))); } #endif } #if defined(__cplusplus) || defined(c_plusplus) } #endif #endif
//---------------------------------------------------------------------------- /** @file GoBensonSolver.h Recognize safe stones and territories according to [Benson 1976]. D.B. Benson. Life in the game of Go. Information Sciences, 10:17Ð29, 1976. Reprinted in Computer Games, Levy, D.N.L. (Editor), Vol. II, pp. 203-213, Springer Verlag, 1988. */ //---------------------------------------------------------------------------- #ifndef GO_BENSONSOLVER_H #define GO_BENSONSOLVER_H #include "GoBoard.h" #include "GoRegion.h" #include "GoStaticSafetySolver.h" //---------------------------------------------------------------------------- /** Benson's classic algorithm for finding unconditionally alive blocks */ class GoBensonSolver : public GoStaticSafetySolver { public: /** If regions = 0, creates its own GoRegionBoard */ explicit GoBensonSolver(const GoBoard& board, GoRegionBoard* regions = 0) : GoStaticSafetySolver(board, regions) { } /** Main function, compute safe points */ void FindSafePoints(SgBWSet* safe); }; //---------------------------------------------------------------------------- #endif // GO_BENSONSOLVER_H
/** * Qt-SslServer, a Tcp Server class with SSL support using QTcpServer and QSslSocket. * Copyright (C) 2014 TRUCHOT Guillaume * * 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 SSLSERVER_H #define SSLSERVER_H #include <QTcpServer> #include <QString> #include <QSsl> #include <QSslCertificate> #include <QSslKey> class SslServer : public QTcpServer { Q_OBJECT public: SslServer(QObject *parent = 0); const QSslCertificate &getSslLocalCertificate() const; const QSslKey &getSslPrivateKey() const; QSsl::SslProtocol getSslProtocol() const; void setSslLocalCertificate(const QSslCertificate &certificate); bool setSslLocalCertificate(const QString &path, QSsl::EncodingFormat format = QSsl::Pem); void setSslPrivateKey(const QSslKey &key); bool setSslPrivateKey(const QString &fileName, QSsl::KeyAlgorithm algorithm = QSsl::Rsa, QSsl::EncodingFormat format = QSsl::Pem, const QByteArray &passPhrase = QByteArray()); void setSslProtocol(QSsl::SslProtocol protocol); protected: void incomingConnection(qintptr socketDescriptor) override final; private: QSslCertificate m_sslLocalCertificate; QSslKey m_sslPrivateKey; QSsl::SslProtocol m_sslProtocol; }; #endif // SSLSERVER_H
#pragma once #ifndef INTERRUPT_H #define INTERRUPT_H /** * Copyright 2014 University of Applied Sciences Western Switzerland / Fribourg * * 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. * * Project: EIA-FR / Embedded Systems 2 Laboratory * * Abstract: ARM Interrupt Handling - Low Level Interface * * Purpose: Module to deal with the low level ARM9/i.MX27 * microprocessor interrupt logic * * Author: Daniel Gachet * Date: 28.06.2014 */ /** * i.MX27 interrupt vectors enumeration */ enum interrupt_vectors { INT_UNDEF, /**< undefined instruction */ INT_SWI, /**< software interrupt */ INT_PREFETCH, /**< prefetch abort (instruction prefetch) */ INT_DATA, /**< data abort (data access) */ INT_IRQ, /**< hardware interrupt request */ INT_FIQ, /**< hardware fast interrupt request */ INT_NB_VECTORS}; /** * Prototype of the interrupt service routines * * @param addr return address * @param vector i.MX27 interrupt vector * @param param parameter specified while attaching the interrupt * service routine */ typedef void (*interrupt_isr_t) (void* addr, enum interrupt_vectors vector, void* param); /** * Method to initialize low level resources of the ARM9 microprocessor * A 16KB of memory will be allocated for each interrupt vector */ extern void interrupt_init(); /** * Method to attach an interrupt servicde routine to the i.MX27 interrupt * vector table * * @param vector i.MX27 interrupt vector * @param routine interrupt service routine to attach to the specified vector * @param param parameter to be passed as argument while calling the the * specified ISR * @return execution status, 0 if sussess, -1 if an ISR is already attached */ extern int interrupt_attach (enum interrupt_vectors vector, interrupt_isr_t routine, void* param); /** * Method to deattach an interrupt service routine from the i.MX27 interrupt * vector table * * @param vector i.MX27 interrupt vector */ extern void interrupt_detach (enum interrupt_vectors vector); /** * Method to enable both normal and fast interrupt requests (IRQ/FIQ) */ extern void interrupt_enable(); /** * Method to disable both normal and fast interrupt requests (IRQ/FIQ) */ extern void interrupt_disable(); #endif
//----------------------------------------------------------------------------- // // Alarm.h // // Implementation of the Z-Wave COMMAND_CLASS_ALARM // // Copyright (c) 2010 Mal Lansell <openzwave@lansell.org> // // SOFTWARE NOTICE AND LICENSE // // This file is part of OpenZWave. // // OpenZWave 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. // // OpenZWave 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 OpenZWave. If not, see <http://www.gnu.org/licenses/>. // //----------------------------------------------------------------------------- #ifndef _Alarm_H #define _Alarm_H #include "command_classes/CommandClass.h" #include "TimerThread.h" namespace OpenZWave { class ValueByte; namespace Internal { namespace CC { /** \brief Implements COMMAND_CLASS_NOTIFICATION (0x71), a Z-Wave device command class. * \ingroup CommandClass */ class Alarm: public CommandClass, private Timer { public: static CommandClass* Create(uint32 const _homeId, uint8 const _nodeId) { return new Alarm(_homeId, _nodeId); } virtual ~Alarm() { } /** \brief Get command class ID (1 byte) identifying this command class. */ static uint8 const StaticGetCommandClassId() { return 0x71; } /** \brief Get a string containing the name of this command class. */ static string const StaticGetCommandClassName() { return "COMMAND_CLASS_NOTIFICATION"; } // From CommandClass virtual bool RequestState(uint32 const _requestFlags, uint8 const _instance, Driver::MsgQueue const _queue) override; virtual bool RequestValue(uint32 const _requestFlags, uint16 const _index, uint8 const _instance, Driver::MsgQueue const _queue) override; /** \brief Get command class ID (1 byte) identifying this command class. (Inherited from CommandClass) */ virtual uint8 const GetCommandClassId() const override { return StaticGetCommandClassId(); } /** \brief Get a string containing the name of this command class. (Inherited from CommandClass) */ virtual string const GetCommandClassName() const override { return StaticGetCommandClassName(); } /** \brief Handle a response to a message associated with this command class. (Inherited from CommandClass) */ virtual bool HandleMsg(uint8 const* _data, uint32 const _length, uint32 const _instance = 1) override; virtual uint8 GetMaxVersion() override { return 8; } virtual bool SetValue(Internal::VC::Value const& _value) override; private: Alarm(uint32 const _homeId, uint8 const _nodeId); void SetupEvents(uint32 type, uint32 index, vector<Internal::VC::ValueList::Item> *_items, uint32 const _instance); void ClearAlarm(uint32 type); void ClearEventParams(uint32 const _instance); bool m_v1Params; std::vector<uint32> m_ParamsSet; uint32 m_ClearTimeout; std::map<uint32, uint32> m_TimersToInstances; }; } // namespace CommandClass } // namespace Internal } // namespace OpenZWave #endif
/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3 as published by the Free Software ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will ** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ #pragma once #include <QDialog> namespace QmlDesigner { namespace Ui { class PuppetDialog; } class PuppetDialog : public QDialog { Q_OBJECT public: explicit PuppetDialog(QWidget *parent = nullptr); ~PuppetDialog() override; void setDescription(const QString &description); void setCopyAndPasteCode(const QString &text); static void warning(QWidget *parent, const QString &title, const QString &description, const QString &copyAndPasteCode); private: Ui::PuppetDialog *ui; }; } //QmlDesigner
/* * Buffered Filter * (C) 1999-2007 Jack Lloyd * * Botan is released under the Simplified BSD License (see license.txt) */ #ifndef BOTAN_BUFFERED_FILTER_H_ #define BOTAN_BUFFERED_FILTER_H_ #include <botan/secmem.h> namespace Botan { /** * Filter mixin that breaks input into blocks, useful for * cipher modes */ class BOTAN_PUBLIC_API(2,0) Buffered_Filter { public: /** * Write bytes into the buffered filter, which will them emit them * in calls to buffered_block in the subclass * @param in the input bytes * @param length of in in bytes */ void write(const uint8_t in[], size_t length); template<typename Alloc> void write(const std::vector<uint8_t, Alloc>& in, size_t length) { write(in.data(), length); } /** * Finish a message, emitting to buffered_block and buffered_final * Will throw an exception if less than final_minimum bytes were * written into the filter. */ void end_msg(); /** * Initialize a Buffered_Filter * @param block_size the function buffered_block will be called * with inputs which are a multiple of this size * @param final_minimum the function buffered_final will be called * with at least this many bytes. */ Buffered_Filter(size_t block_size, size_t final_minimum); virtual ~Buffered_Filter() = default; protected: /** * The block processor, implemented by subclasses * @param input some input bytes * @param length the size of input, guaranteed to be a multiple * of block_size */ virtual void buffered_block(const uint8_t input[], size_t length) = 0; /** * The final block, implemented by subclasses * @param input some input bytes * @param length the size of input, guaranteed to be at least * final_minimum bytes */ virtual void buffered_final(const uint8_t input[], size_t length) = 0; /** * @return block size of inputs */ size_t buffered_block_size() const { return m_main_block_mod; } /** * @return current position in the buffer */ size_t current_position() const { return m_buffer_pos; } /** * Reset the buffer position */ void buffer_reset() { m_buffer_pos = 0; } private: size_t m_main_block_mod, m_final_minimum; secure_vector<uint8_t> m_buffer; size_t m_buffer_pos; }; } #endif
/* * Copyright (C) Tildeslash Ltd. All rights reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License version 3. * * 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 Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * * You must obey the GNU Affero General Public License in all respects * for all of the code used other than OpenSSL. */ #ifndef MONIT_ALERT_H #define MONIT_ALERT_H #include "event.h" /** Default mail from string */ #define ALERT_FROM "monit@$HOST" /** Default mail subject */ #define ALERT_SUBJECT "monit alert -- $EVENT $SERVICE" /** Default mail message */ #define ALERT_MESSAGE "$EVENT Service $SERVICE \r\n"\ "\r\n"\ "\tDate: $DATE\r\n"\ "\tAction: $ACTION\r\n"\ "\tHost: $HOST\r\n"\ "\tDescription: $DESCRIPTION\r\n"\ "\r\n"\ "Your faithful employee,\r\n"\ "Monit\r\n" /** * This module is used for event notifications. Users may register * interest for certain events in the monit control file. When an * event occurs this module is called from the event processing * machinery to notify users who have asked to be alerted for * particular events. * * @file */ /** * Notify registred users about the event * @param E An Event object * @return If failed, return HANDLER_ALERT flag or HANDLER_SUCCEEDED flag if succeeded */ int handle_alert(Event_T E); #endif
/**************************************************************************** ** ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of Qt Creator. ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://www.qt.io/licensing. For further information ** use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional ** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef FUTUREPROGRESS_H #define FUTUREPROGRESS_H #include <coreplugin/core_global.h> #include <coreplugin/id.h> #include <QString> #include <QFuture> #include <QWidget> namespace Core { class FutureProgressPrivate; class CORE_EXPORT FutureProgress : public QWidget { Q_OBJECT public: enum KeepOnFinishType { HideOnFinish = 0, KeepOnFinishTillUserInteraction = 1, KeepOnFinish = 2 }; explicit FutureProgress(QWidget *parent = 0); virtual ~FutureProgress(); virtual bool eventFilter(QObject *object, QEvent *); void setFuture(const QFuture<void> &future); QFuture<void> future() const; void setTitle(const QString &title); QString title() const; void setType(Id type); Id type() const; void setKeepOnFinish(KeepOnFinishType keepType); bool keepOnFinish() const; bool hasError() const; void setWidget(QWidget *widget); QWidget *widget() const; void setStatusBarWidget(QWidget *widget); QWidget *statusBarWidget() const; bool isFading() const; QSize sizeHint() const; signals: void clicked(); void finished(); void canceled(); void removeMe(); void hasErrorChanged(); void fadeStarted(); void statusBarWidgetChanged(); protected: void mousePressEvent(QMouseEvent *event); void paintEvent(QPaintEvent *); private slots: void updateToolTip(const QString &); void cancel(); void setStarted(); void setFinished(); void setProgressRange(int min, int max); void setProgressValue(int val); void setProgressText(const QString &text); private: friend class FutureProgressPrivate; // for sending signal FutureProgressPrivate *d; }; } // namespace Core #endif // FUTUREPROGRESS_H
/* * SALSA-Lib - Timer Interface * * Copyright (c) 2007-2012 by Takashi Iwai <tiwai@suse.de> * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __ALSA_TIMER_H #define __ALSA_TIMER_H #include "recipe.h" #include "timer_func.h" #include "timer_macros.h" #define snd_timer_id_alloca(ptr) __snd_alloca(ptr, snd_timer_id) #define snd_timer_ginfo_alloca(ptr) __snd_alloca(ptr, snd_timer_ginfo) #define snd_timer_info_alloca(ptr) __snd_alloca(ptr, snd_timer_info) #define snd_timer_params_alloca(ptr) __snd_alloca(ptr, snd_timer_params) #define snd_timer_status_alloca(ptr) __snd_alloca(ptr, snd_timer_status) #endif /* __ALSA_TIMER_H */
/* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free ** Software License B, Version 1.1 (the "License"), the contents of this ** file are subject only to the provisions of the License. You may not use ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: ** ** http://oss.sgi.com/projects/FreeB ** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. ** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. ** ** Additional Notice Provisions: This software was created using the ** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has ** not been independently verified as being compliant with the OpenGL(R) ** version 1.2.1 Specification. */
/* The content of this file was generated using the C profile of libCellML 0.2.0. */ #pragma once #include <stddef.h> extern const char VERSION[]; extern const char LIBCELLML_VERSION[]; extern const size_t STATE_COUNT; extern const size_t VARIABLE_COUNT; typedef enum { VARIABLE_OF_INTEGRATION, STATE, CONSTANT, COMPUTED_CONSTANT, ALGEBRAIC } VariableType; typedef struct { char name[2]; char units[3]; char component[12]; VariableType type; } VariableInfo; extern const VariableInfo VOI_INFO; extern const VariableInfo STATE_INFO[]; extern const VariableInfo VARIABLE_INFO[]; double * createStatesArray(); double * createVariablesArray(); void deleteArray(double *array); void initialiseStatesAndConstants(double *states, double *variables); void computeComputedConstants(double *variables); void computeRates(double voi, double *states, double *rates, double *variables); void computeVariables(double voi, double *states, double *rates, double *variables);
/* * For machines on which the rand() function returns a long int (32 bits). * Suns, for instance: */ #define LONG_RAND /* * For Berkeley-based C compilers. Many Berkeley-ish machines, such as Suns, * HP-UX machines, and Apollos are compatible enough with SYSV that this flag * is not needed. If your machine has '/usr/include/strings.h' rather than * 'string.h', you need this defined. */ /*#define BSD*/ /* * This flags does not work yet: */ /*#define MOONS*/
// Copyright 2020 The Marl Authors. // // 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 // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef marl_task_h #define marl_task_h #include "export.h" #include <functional> namespace marl { // Task is a unit of work for the scheduler. class Task { public: using Function = std::function<void()>; enum class Flags { None = 0, // SameThread ensures the task will be run on the same thread that scheduled // the task. This can offer performance improvements if the current thread // is immediately going to block on the newly scheduled task, by reducing // overheads of waking another thread. SameThread = 1, }; MARL_NO_EXPORT inline Task(); MARL_NO_EXPORT inline Task(const Task&); MARL_NO_EXPORT inline Task(Task&&); MARL_NO_EXPORT inline Task(const Function& function, Flags flags = Flags::None); MARL_NO_EXPORT inline Task(Function&& function, Flags flags = Flags::None); MARL_NO_EXPORT inline Task& operator=(const Task&); MARL_NO_EXPORT inline Task& operator=(Task&&); MARL_NO_EXPORT inline Task& operator=(const Function&); MARL_NO_EXPORT inline Task& operator=(Function&&); // operator bool() returns true if the Task has a valid function. MARL_NO_EXPORT inline operator bool() const; // operator()() runs the task. MARL_NO_EXPORT inline void operator()() const; // is() returns true if the Task was created with the given flag. MARL_NO_EXPORT inline bool is(Flags flag) const; private: Function function; Flags flags = Flags::None; }; Task::Task() {} Task::Task(const Task& o) : function(o.function), flags(o.flags) {} Task::Task(Task&& o) : function(std::move(o.function)), flags(o.flags) {} Task::Task(const Function& function, Flags flags /* = Flags::None */) : function(function), flags(flags) {} Task::Task(Function&& function, Flags flags /* = Flags::None */) : function(std::move(function)), flags(flags) {} Task& Task::operator=(const Task& o) { function = o.function; flags = o.flags; return *this; } Task& Task::operator=(Task&& o) { function = std::move(o.function); flags = o.flags; return *this; } Task& Task::operator=(const Function& f) { function = f; flags = Flags::None; return *this; } Task& Task::operator=(Function&& f) { function = std::move(f); flags = Flags::None; return *this; } Task::operator bool() const { return function.operator bool(); } void Task::operator()() const { function(); } bool Task::is(Flags flag) const { return (static_cast<int>(flags) & static_cast<int>(flag)) == static_cast<int>(flag); } } // namespace marl #endif // marl_task_h
/*========================================================================= Library: TubeTK/VTree3D Authors: Stephen Aylward, Julien Jomier, and Elizabeth Bullitt Original implementation: Copyright University of North Carolina, Chapel Hill, NC, USA. Revised implementation: Copyright Kitware Inc., Carrboro, NC, USA. All rights reserved. Licensed under the Apache License, Version 2.0 ( the "License" ); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. =========================================================================*/ #ifndef __tubeParabolicFitOptimizer1D_h #define __tubeParabolicFitOptimizer1D_h #include "tubeOptimizer1D.h" #include "tubeUserFunction.h" namespace tube { class ParabolicFitOptimizer1D : public Optimizer1D { public: typedef ParabolicFitOptimizer1D Self; typedef Optimizer1D Superclass; typedef Self * Pointer; typedef const Self * ConstPointer; typedef Superclass::ValueFunctionType ValueFunctionType; /** Return the type of this object. */ tubeTypeMacro( ParabolicFitOptimizer1D ); /** Constructor. */ ParabolicFitOptimizer1D( void ); /** Constructor. */ ParabolicFitOptimizer1D( ValueFunctionType::Pointer funcVal ); /** Destructor. */ ~ParabolicFitOptimizer1D( void ); void Use( ValueFunctionType::Pointer funcVal ); protected: double m_Center( double x1, double y1, double x2, double y2, double x3, double y3 ); bool m_Extreme( double * x, double * xVal ) override; private: // Copy constructor not implemented. ParabolicFitOptimizer1D( const Self & self ); // Copy assignment operator not implemented. void operator=( const Self & self ); }; // End class ParabolicFitOptimizer1D } // End namespace tube #endif // End !defined( __tubeParabolicFitOptimizer1D_h )
#ifndef INVERSE_KINEMATICSEXAMPLE_H #define INVERSE_KINEMATICSEXAMPLE_H enum Method {IK_JACOB_TRANS=0, IK_PURE_PSEUDO, IK_DLS, IK_SDLS , IK_DLS_SVD}; class CommonExampleInterface* InverseKinematicsExampleCreateFunc(struct CommonExampleOptions& options); #endif //INVERSE_KINEMATICSEXAMPLE_H
/* * StopNgram.h -- * N-gram LM with stop words removed from context * * Copyright (c) 1996,2002 SRI International. All Rights Reserved. * * @(#)$Header: /home/srilm/devel/lm/src/RCS/StopNgram.h,v 1.3 2002/08/25 17:27:45 stolcke Exp $ * */ #ifndef _StopNgram_h_ #define _StopNgram_h_ #include "Ngram.h" #include "SubVocab.h" class StopNgram: public Ngram { public: StopNgram(Vocab &vocab, SubVocab &stopWords, unsigned int order); /* * LM interface */ LogP wordProb(VocabIndex word, const VocabIndex *context); void *contextID(VocabIndex word, const VocabIndex *context, unsigned &length); LogP contextBOW(const VocabIndex *context, unsigned length); SubVocab &stopWords; /* stop word set */ protected: unsigned removeStopWords(const VocabIndex *context, VocabIndex *usedContext, unsigned usedLength); }; #endif /* _StopNgram_h_ */
void f1(int nargs, __builtin_va_list l) { int a; for (;nargs > 0;nargs--) { a = __builtin_va_arg(l, int); printf("%i ", a); } } void f(int nargs, ...) { __builtin_va_list l; __builtin_va_start(l, f); f1(nargs, l); __builtin_va_end(l); } int main() { f(3, 1, 2, 3); }
#ifndef _RMSETJMP_H #define _RMSETJMP_H FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); #include <setjmp.h> #include <realmode.h> /** A real-mode-extended jump buffer */ typedef struct { /** Jump buffer */ jmp_buf env; /** Real-mode stack pointer */ segoff_t rm_stack; } rmjmp_buf[1]; #define rmsetjmp( _env ) ( { \ (_env)->rm_stack.segment = rm_ss; \ (_env)->rm_stack.offset = rm_sp; \ setjmp ( (_env)->env ); } ) \ #define rmlongjmp( _env, _val ) do { \ rm_ss = (_env)->rm_stack.segment; \ rm_sp = (_env)->rm_stack.offset; \ longjmp ( (_env)->env, (_val) ); \ } while ( 0 ) #endif /* _RMSETJMP_H */
/*========================================================================= Program: Insight Segmentation & Registration Toolkit Module: $RCSfile: ITKHeader.h,v $ Language: C++ Date: $Date: 2007-07-10 11:35:36 -0400 (Tue, 10 Jul 2007) $ Version: $Revision: 0 $ Copyright (c) 2002 Insight Consortium. All rights reserved. See ITKCopyright.txt or http://www.itk.org/HTML/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 notices for more information. =========================================================================*/
/* 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 LIBRARIES_NACL_IO_KERNEL_PROXY_H_ #define LIBRARIES_NACL_IO_KERNEL_PROXY_H_ #include <ppapi/c/pp_instance.h> #include <ppapi/c/ppb.h> #include <pthread.h> #include <map> #include <string> #include <vector> #include "nacl_io/kernel_object.h" #include "nacl_io/mount.h" #include "nacl_io/ostypes.h" #include "nacl_io/path.h" class KernelHandle; class Mount; class MountNode; class PepperInterface; // KernelProxy provide one-to-one mapping for libc kernel calls. Calls to the // proxy will result in IO access to the provided Mount and MountNode objects. class KernelProxy : protected KernelObject { public: typedef Mount* (*MountFactory_t)(int, StringMap_t&, PepperInterface*); typedef std::map<std::string, std::string> StringMap_t; typedef std::map<std::string, MountFactory_t> MountFactoryMap_t; KernelProxy(); virtual ~KernelProxy(); // Takes ownership of |ppapi|. // |ppapi| may be NULL. If so, no mount that uses pepper calls can be mounted. virtual void Init(PepperInterface* ppapi); // KernelHandle and FD allocation and manipulation functions. virtual int open(const char *path, int oflag); virtual int close(int fd); virtual int dup(int fd); virtual int dup2(int fd, int newfd); // System calls handled by KernelProxy (not mount-specific) virtual int chdir(const char* path); virtual char* getcwd(char* buf, size_t size); virtual char* getwd(char* buf); virtual int mount(const char *source, const char *target, const char *filesystemtype, unsigned long mountflags, const void *data); virtual int umount(const char *path); // System calls that take a path as an argument: // The kernel proxy will look for the Node associated to the path. To // find the node, the kernel proxy calls the corresponding mount's GetNode() // method. The corresponding method will be called. If the node // cannot be found, errno is set and -1 is returned. virtual int chmod(const char *path, mode_t mode); virtual int mkdir(const char *path, mode_t mode); virtual int rmdir(const char *path); virtual int stat(const char *path, struct stat *buf); // System calls that take a file descriptor as an argument: // The kernel proxy will determine to which mount the file // descriptor's corresponding file handle belongs. The // associated mount's function will be called. virtual ssize_t read(int fd, void *buf, size_t nbyte); virtual ssize_t write(int fd, const void *buf, size_t nbyte); virtual int fchmod(int fd, int prot); virtual int fstat(int fd, struct stat *buf); virtual int getdents(int fd, void *buf, unsigned int count); virtual int fsync(int fd); virtual int isatty(int fd); // lseek() relies on the mount's Stat() to determine whether or not the // file handle corresponding to fd is a directory virtual off_t lseek(int fd, off_t offset, int whence); // remove() uses the mount's GetNode() and Stat() to determine whether or // not the path corresponds to a directory or a file. The mount's Rmdir() // or Unlink() is called accordingly. virtual int remove(const char* path); // unlink() is a simple wrapper around the mount's Unlink function. virtual int unlink(const char* path); // access() uses the Mount's Stat(). virtual int access(const char* path, int amode); virtual int link(const char* oldpath, const char* newpath); virtual int symlink(const char* oldpath, const char* newpath); virtual void* mmap(void* addr, size_t length, int prot, int flags, int fd, size_t offset); virtual int munmap(void* addr, size_t length); // NaCl-only function to read resources specified in the NMF file. virtual int open_resource(const char* file); protected: MountFactoryMap_t factories_; int dev_; PepperInterface* ppapi_; static KernelProxy *s_instance_; DISALLOW_COPY_AND_ASSIGN(KernelProxy); }; #endif // LIBRARIES_NACL_IO_KERNEL_PROXY_H_
/* Source File : WrittenFontCFF.h Copyright 2011 Gal Kahana PDFWriter Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #pragma once #include "AbstractWrittenFont.h" #include <utility> #include <list> typedef std::pair<unsigned char,unsigned char> UCharAndUChar; typedef std::list<UCharAndUChar> UCharAndUCharList; class WrittenFontCFF : public AbstractWrittenFont { public: WrittenFontCFF(ObjectsContext* inObjectsContext,bool inIsCID); virtual ~WrittenFontCFF(void); virtual PDFHummus::EStatusCode WriteFontDefinition(FreeTypeFaceWrapper& inFontInfo, bool inEmbedFont); virtual PDFHummus::EStatusCode WriteState(ObjectsContext* inStateWriter,ObjectIDType inObjectId); virtual PDFHummus::EStatusCode ReadState(PDFParser* inStateReader,ObjectIDType inObjectID); private: virtual bool AddToANSIRepresentation(const GlyphUnicodeMappingList& inGlyphsList, UShortList& outEncodedCharacters); virtual bool AddToANSIRepresentation(const GlyphUnicodeMappingListList& inGlyphsList, UShortListList& outEncodedCharacters); bool HasEnoughSpaceForGlyphs(const GlyphUnicodeMappingList& inGlyphsList); unsigned short EncodeGlyph(unsigned int inGlyph,const ULongVector& inCharacters); void RemoveFromFreeList(unsigned char inAllocatedPosition); unsigned char AllocateFromFreeList(unsigned int inGlyph); bool HasEnoughSpaceForGlyphs(const GlyphUnicodeMappingListList& inGlyphsList); unsigned char mAvailablePositionsCount; UCharAndUCharList mFreeList; bool mAssignedPositionsAvailable[256]; unsigned int mAssignedPositions[256]; bool mIsCID; };
/* * Copyright (c) 2014-2015, Ericsson AB. All rights reserved. * Copyright (c) 2014, Centricular Ltd * Author: Sebastian Dröge <sebastian@centricular.com> * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, this * list of conditions and the following disclaimer in the documentation and/or other * materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. */ #ifndef __OWR_UTILS_H__ #define __OWR_UTILS_H__ #include "owr_types.h" #include <glib.h> #include <gst/gst.h> #ifndef __GTK_DOC_IGNORE__ G_BEGIN_DECLS #define OWR_UNUSED(x) (void)x void *_owr_require_symbols(void); OwrCodecType _owr_caps_to_codec_type(GstCaps *caps); void _owr_utils_call_closure_with_list(GClosure *callback, GList *list); GClosure *_owr_utils_list_closure_merger_new(GClosure *final_callback, GDestroyNotify list_item_destroy); /* FIXME: This should be removed when the GStreamer required version * is 1.6 and gst_caps_foreach() can be used. * Upstream commit: http://cgit.freedesktop.org/gstreamer/gstreamer/commit/?id=bc11a1b79dace8ca73d3367d7c70629f8a6dd7fd * The author of the above commit, Sebastian Dröge, agreed * relicensing this copy of the function under BSD 2-Clause. */ typedef gboolean (*OwrGstCapsForeachFunc) (GstCapsFeatures *features, GstStructure *structure, gpointer user_data); gboolean _owr_gst_caps_foreach(const GstCaps *caps, OwrGstCapsForeachFunc func, gpointer user_data); void _owr_deep_notify(GObject *object, GstObject *orig, GParamSpec *pspec, gpointer user_data); int _owr_rotation_and_mirror_to_video_flip_method(guint rotation, gboolean mirror); GHashTable *_owr_value_table_new(); GValue *_owr_value_table_add(GHashTable *table, const gchar *key, GType type); G_END_DECLS #endif /* __GTK_DOC_IGNORE__ */ #endif /* __OWR_UTILS_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 PRINTING_BACKEND_PRINT_BACKEND_H_ #define PRINTING_BACKEND_PRINT_BACKEND_H_ #include <map> #include <string> #include <vector> #include "base/memory/ref_counted.h" #include "printing/print_job_constants.h" #include "printing/printing_export.h" #include "ui/gfx/geometry/size.h" namespace base { class DictionaryValue; } // This is the interface for platform-specific code for a print backend namespace printing { // Note: There are raw values. The |printer_name| and |printer_description| // require further interpretation on Mac. See existing callers for examples. struct PRINTING_EXPORT PrinterBasicInfo { PrinterBasicInfo(); PrinterBasicInfo(const PrinterBasicInfo& other); ~PrinterBasicInfo(); std::string printer_name; std::string printer_description; int printer_status; int is_default; std::map<std::string, std::string> options; }; using PrinterList = std::vector<PrinterBasicInfo>; struct PRINTING_EXPORT PrinterSemanticCapsAndDefaults { PrinterSemanticCapsAndDefaults(); PrinterSemanticCapsAndDefaults(const PrinterSemanticCapsAndDefaults& other); ~PrinterSemanticCapsAndDefaults(); bool collate_capable; bool collate_default; bool copies_capable; bool duplex_capable; DuplexMode duplex_default; bool color_changeable; bool color_default; ColorModel color_model; ColorModel bw_model; struct Paper { std::string display_name; std::string vendor_id; gfx::Size size_um; }; std::vector<Paper> papers; Paper default_paper; std::vector<gfx::Size> dpis; gfx::Size default_dpi; }; struct PRINTING_EXPORT PrinterCapsAndDefaults { PrinterCapsAndDefaults(); PrinterCapsAndDefaults(const PrinterCapsAndDefaults& other); ~PrinterCapsAndDefaults(); std::string printer_capabilities; std::string caps_mime_type; std::string printer_defaults; std::string defaults_mime_type; }; // PrintBackend class will provide interface for different print backends // (Windows, CUPS) to implement. User will call CreateInstance() to // obtain available print backend. // Please note, that PrintBackend is not platform specific, but rather // print system specific. For example, CUPS is available on both Linux and Mac, // but not available on ChromeOS, etc. This design allows us to add more // functionality on some platforms, while reusing core (CUPS) functions. class PRINTING_EXPORT PrintBackend : public base::RefCountedThreadSafe<PrintBackend> { public: // Enumerates the list of installed local and network printers. virtual bool EnumeratePrinters(PrinterList* printer_list) = 0; // Gets the default printer name. Empty string if no default printer. virtual std::string GetDefaultPrinterName() = 0; // Gets the basic printer info for a specific printer. virtual bool GetPrinterBasicInfo(const std::string& printer_name, PrinterBasicInfo* printer_info) = 0; // Gets the semantic capabilities and defaults for a specific printer. // This is usually a lighter implementation than GetPrinterCapsAndDefaults(). // NOTE: on some old platforms (WinXP without XPS pack) // GetPrinterCapsAndDefaults() will fail, while this function will succeed. virtual bool GetPrinterSemanticCapsAndDefaults( const std::string& printer_name, PrinterSemanticCapsAndDefaults* printer_info) = 0; // Gets the capabilities and defaults for a specific printer. virtual bool GetPrinterCapsAndDefaults( const std::string& printer_name, PrinterCapsAndDefaults* printer_info) = 0; // Gets the information about driver for a specific printer. virtual std::string GetPrinterDriverInfo( const std::string& printer_name) = 0; // Returns true if printer_name points to a valid printer. virtual bool IsValidPrinter(const std::string& printer_name) = 0; // Allocates a print backend. If |print_backend_settings| is nullptr, default // settings will be used. static scoped_refptr<PrintBackend> CreateInstance( const base::DictionaryValue* print_backend_settings); // Returns the value of the native cups flag static bool GetNativeCupsEnabled(); static void SetNativeCupsEnabled(bool enabled); protected: friend class base::RefCountedThreadSafe<PrintBackend>; virtual ~PrintBackend(); }; } // namespace printing #endif // PRINTING_BACKEND_PRINT_BACKEND_H_
/* $NetBSD: _strtoul.h,v 1.7 2013/05/17 12:55:56 joerg Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Original version ID: * NetBSD: src/lib/libc/locale/_wcstoul.h,v 1.2 2003/08/07 16:43:03 agc Exp */ /* * function template for strtoul, strtoull and strtoumax. * * parameters: * _FUNCNAME : function name * __UINT : return type * __UINT_MAX : upper limit of the return type */ #if defined(_KERNEL) || defined(_STANDALONE) || \ defined(HAVE_NBTOOL_CONFIG_H) || defined(BCS_ONLY) __UINT _FUNCNAME(const char *nptr, char **endptr, int base) #else #include <locale.h> #include "setlocale_local.h" #define INT_FUNCNAME_(pre, name, post) pre ## name ## post #define INT_FUNCNAME(pre, name, post) INT_FUNCNAME_(pre, name, post) static __UINT INT_FUNCNAME(_int_, _FUNCNAME, _l)(const char *nptr, char **endptr, int base, locale_t loc) #endif { const char *s; __UINT acc, cutoff; unsigned char c; int i, neg, any, cutlim; _DIAGASSERT(nptr != NULL); /* endptr may be NULL */ /* check base value */ if (base && (base < 2 || base > 36)) { #if !defined(_KERNEL) && !defined(_STANDALONE) errno = EINVAL; return(0); #else panic("%s: invalid base %d", __func__, base); #endif } /* * Skip white space and pick up leading +/- sign if any. * If base is 0, allow 0x for hex and 0 for octal, else * assume decimal; if base is already 16, allow 0x. */ s = nptr; #if defined(_KERNEL) || defined(_STANDALONE) || \ defined(HAVE_NBTOOL_CONFIG_H) || defined(BCS_ONLY) do { c = *s++; } while (isspace(c)); #else do { c = *s++; } while (isspace_l(c, loc)); #endif if (c == '-') { neg = 1; c = *s++; } else { neg = 0; if (c == '+') c = *s++; } if ((base == 0 || base == 16) && c == '0' && (*s == 'x' || *s == 'X')) { c = s[1]; s += 2; base = 16; } if (base == 0) base = (c == '0' ? 8 : 10); /* * See strtol for comments as to the logic used. */ cutoff = ((__UINT)__UINT_MAX / (__UINT)base); cutlim = (int)((__UINT)__UINT_MAX % (__UINT)base); for (acc = 0, any = 0;; c = *s++) { if (c >= '0' && c <= '9') i = c - '0'; else if (c >= 'a' && c <= 'z') i = (c - 'a') + 10; else if (c >= 'A' && c <= 'Z') i = (c - 'A') + 10; else break; if (i >= base) break; if (any < 0) continue; if (acc > cutoff || (acc == cutoff && i > cutlim)) { acc = __UINT_MAX; #if !defined(_KERNEL) && !defined(_STANDALONE) any = -1; errno = ERANGE; #else any = 0; break; #endif } else { any = 1; acc *= (__UINT)base; acc += i; } } if (neg && any > 0) acc = -acc; if (endptr != NULL) /* LINTED interface specification */ *endptr = __UNCONST(any ? s - 1 : nptr); return(acc); } #if !defined(_KERNEL) && !defined(_STANDALONE) && \ !defined(HAVE_NBTOOL_CONFIG_H) && !defined(BCS_ONLY) __UINT _FUNCNAME(const char *nptr, char **endptr, int base) { return INT_FUNCNAME(_int_, _FUNCNAME, _l)(nptr, endptr, base, _current_locale()); } __UINT INT_FUNCNAME(, _FUNCNAME, _l)(const char *nptr, char **endptr, int base, locale_t loc) { return INT_FUNCNAME(_int_, _FUNCNAME, _l)(nptr, endptr, base, loc); } #endif
/* * Software License Agreement (BSD License) * * Point Cloud Library (PCL) - www.pointclouds.org * Copyright (c) 2012, Willow Garage, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * Neither the name of Willow Garage, 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. * */ #pragma once #include <QObject> namespace pcl { namespace modeler { class CloudMeshItem; class AbstractWorker; class ThreadController : public QObject { Q_OBJECT public: ThreadController(); ~ThreadController(); bool runWorker(AbstractWorker* worker); Q_SIGNALS: void prepared(); private Q_SLOTS: void slotOnCloudMeshItemUpdate(CloudMeshItem* cloud_mesh_item); }; } }
/* -*- Mode: C; tab-width:4 -*- */ /* ex: set ts=4 shiftwidth=4 softtabstop=4 cindent: */ /** * @brief */ /** * Module needs to include <module.h> */ #include <sys_module.h> #include <module.h> #define LED_DEBUG #include <led_dbg.h> #define PONG_TIMER_INTERVAL 1024L #define PONG_TID 0 #define PONGER_ID DFLT_APP_ID0 #define MSG_TEST MOD_MSG_START /** * Module can define its own state */ typedef struct { uint8_t pid; } app_state_t; /** * Module state and ID declaration. * All modules should call the fallowing to macros to help the linker add * module specific meta data to the resulting binary image. Note that the * parameters my be different. */ /** * Pong module * * @param msg Message being delivered to the module * @return int8_t SOS status message * * Modules implement a module function that acts as a message handler. The * module function is typically implemented as a switch acting on the message * type. * * All modules should included a handler for MSG_INIT to initialize module * state, and a handler for MSG_FINAL to release module resources. */ static int8_t module(void *start, Message *e); /** * This is the only global variable one can have. */ static mod_header_t mod_header SOS_MODULE_HEADER = { .mod_id = DFLT_APP_ID0, .state_size = sizeof(app_state_t), .num_timers = 0, .num_sub_func = 0, .num_prov_func = 0, .platform_type = HW_TYPE /* or PLATFORM_ANY */, .processor_type = MCU_TYPE, .code_id = ehtons(DFLT_APP_ID0), .module_handler = module, }; static int8_t module(void *state, Message *msg) { /** * The module is passed in a void* that contains its state. For easy * reference it is handy to typecast this variable to be of the * applications state type. Note that since we are running as a module, * this state is not accessible in the form of a global or static * variable. */ app_state_t *s = (app_state_t*)state; /** * Switch to the correct message handler */ switch (msg->type){ /** * MSG_INIT is used to initialize module state the first time the * module is used. Many modules set timers at this point, so that * they will continue to receive periodic (or one shot) timer events. */ case MSG_INIT: { LED_DBG(LED_YELLOW_TOGGLE); s->pid = msg->did; DEBUG("Pong Start\n"); break; } /** * MSG_FINAL is used to shut modules down. Modules should release all * resources at this time and take care of any final protocol * shutdown. */ case MSG_FINAL: { DEBUG("Pong Stop\n"); break; } case MSG_TEST: { uint8_t* seq; //MsgParam* params = (MsgParam*)(msg->data); seq = (int8_t*) msg->data; LED_DBG(LED_GREEN_TOGGLE); post_net(PONGER_ID, PONGER_ID, MSG_TEST, sizeof(uint8_t), seq, SOS_MSG_HIGH_PRIORITY, BCAST_ADDRESS); DEBUG("Recv Packet\n"); break; } /** * The default handler is used to catch any messages that the module * does no know how to handle. */ default: return -EINVAL; } /** * Return SOS_OK for those handlers that have successfully been handled. */ return SOS_OK; } #ifndef _MODULE_ mod_header_ptr pong_get_header() { return sos_get_header_address(mod_header); } #endif
int strcmp(char *, char*); int strlen(char *);
/* * Copyright 2006 The Android Open Source Project * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SkTransparentShader_DEFINED #define SkTransparentShader_DEFINED #include "SkShader.h" class SK_API SkTransparentShader : public SkShader { public: SkTransparentShader() {} virtual size_t contextSize() const SK_OVERRIDE; class TransparentShaderContext : public SkShader::Context { public: TransparentShaderContext(const SkTransparentShader& shader, const ContextRec&); virtual ~TransparentShaderContext(); virtual uint32_t getFlags() const SK_OVERRIDE; virtual void shadeSpan(int x, int y, SkPMColor[], int count) SK_OVERRIDE; virtual void shadeSpan16(int x, int y, uint16_t span[], int count) SK_OVERRIDE; private: const SkBitmap* fDevice; typedef SkShader::Context INHERITED; }; SK_TO_STRING_OVERRIDE() SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTransparentShader) protected: virtual Context* onCreateContext(const ContextRec&, void* storage) const SK_OVERRIDE; // we don't need to flatten anything at all virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE {} private: typedef SkShader INHERITED; }; #endif
/* * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef OPENSSL_KDFERR_H # define OPENSSL_KDFERR_H # pragma once #include <openssl/cryptoerr_legacy.h> #endif /* !defined(OPENSSL_KDFERR_H) */
/* ** Copyright 2001, Travis Geiselbrecht. All rights reserved. ** Distributed under the terms of the NewOS License. */ #ifndef _MMU_H #define _MMU_H #include <boot/stage2.h> void mmu_init(kernel_args *ka, unsigned int *next_paddr); void mmu_map_page(unsigned int vaddr, unsigned int paddr); #endif
/************************************************************************************ Filename : CAPI_D3D11_HSWDisplay.h Content : Implements Health and Safety Warning system. Created : July 7, 2014 Authors : Paul Pedriana Copyright : Copyright 2014 Oculus VR, Inc. All Rights reserved. Licensed under the Oculus VR Rift SDK License Version 3.1 (the "License"); you may not use the Oculus VR Rift SDK except in compliance with the License, which is provided at the time of installation or download, or which otherwise accompanies this software in either electronic or hard copy form. You may obtain a copy of the License at http://www.oculusvr.com/licenses/LICENSE-3.1 Unless required by applicable law or agreed to in writing, the Oculus VR SDK distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ************************************************************************************/ #ifndef OVR_CAPI_D3D11_HSWDisplay_h #define OVR_CAPI_D3D11_HSWDisplay_h #if !defined(OVR_D3D_VERSION) || ((OVR_D3D_VERSION != 10) && (OVR_D3D_VERSION != 11)) #error This header expects OVR_D3D_VERSION to be defined, to 10 or 11. #endif // Due to the similarities between DX10 and DX11, there is a shared implementation of the headers and source // which is differentiated only by the OVR_D3D_VERSION define. This define causes D3D_NS (D3D namespace) to // be defined to either D3D10 or D3D11, as well as other similar effects. #include "CAPI_D3D1X_HSWDisplay.h" #endif // OVR_CAPI_D3D11_HSWDisplay_h
#pragma once #include <sys/stat.h> #include "pal.h" PAL_BEGIN_EXTERNC int32_t GetLStat(const char* path, struct stat* buf); PAL_END_EXTERNC
//----------------------------------------------------------------------------- // Copyright (c) 2013 GarageGames, LLC // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to // deal in the Software without restriction, including without limitation the // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or // sell copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. //----------------------------------------------------------------------------- /*! @addtogroup ConsoleOutput Console Output @ingroup TorqueScriptFunctions @{ */ /*! Fatal Script Assertion @param condition if false, exit the program @param message message to print on assertion */ ConsoleFunctionWithDocs( Assert, void, 3, 3, (condition, message) ) { // Process Assertion. AssertISV( dAtob(argv[1]), argv[2] ); } /*! @} */ // group ConsoleOutput
// // Copyright 2011-2012 Jeff Verkoeyen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #import <UIKit/UIKit.h> // All docs are in the .m. @interface BasicInstantiationAttributedLabelViewController : UIViewController @end
// The MIT License // // Copyright (c) 2013 Gwendal Roué // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. #import "GRMustacheExpression_private.h" /** * The GRMustacheFilteredExpression is able to apply a filter to a value, and * to return the result. * * @see GRMustacheExpression * @see GRMustacheFilter */ @interface GRMustacheFilteredExpression : GRMustacheExpression { @private GRMustacheExpression *_filterExpression; GRMustacheExpression *_argumentExpression; BOOL _curry; } /** * Returns a filtered expression, given an expression that returns a filter, and * an expression that return the filter argument. * * For example, the Mustache tag `{{ f(x) }}` contains a filtered expression, * whose filterExpression is a GRMustacheIdentifierExpression (for the * identifier `f`), and whose argumentExpression is a * GRMustacheIdentifierExpression (for the identifier `x`). * * @param filterExpression An expression whose value is an object conforming * to the <GRMustacheFilter> protocol. * @param argumentExpression An expression whose value is the argument of the * filter. * * @return A GRMustacheFilteredExpression. */ + (instancetype)expressionWithFilterExpression:(GRMustacheExpression *)filterExpression argumentExpression:(GRMustacheExpression *)argumentExpression GRMUSTACHE_API_INTERNAL; /** * Returns a filtered expression, given an expression that returns a filter, and * an expression that return the filter argument. * * For example, the Mustache tag `{{ f(x) }}` contains a filtered expression, * whose filterExpression is a GRMustacheIdentifierExpression (for the * identifier `f`), and whose argumentExpression is a * GRMustacheIdentifierExpression (for the identifier `x`). * * @param filterExpression An expression whose value is an object conforming * to the <GRMustacheFilter> protocol. * @param argumentExpression An expression whose value is the argument of the * filter. * @param curry If YES, this expression must evaluate to a filter. * * @return A GRMustacheFilteredExpression. */ + (instancetype)expressionWithFilterExpression:(GRMustacheExpression *)filterExpression argumentExpression:(GRMustacheExpression *)argumentExpression curry:(BOOL)curry GRMUSTACHE_API_INTERNAL; @end
// // Use this file to import your target's public headers that you would like to expose to Swift. // #import <libxml/HTMLtree.h> #import <libxml/xpath.h> #import <FXReachability/FXReachability.h>
/* NSObjCRuntime.h Copyright (c) 1994-2012, Apple Inc. All rights reserved. */ #ifndef _OBJC_NSOBJCRUNTIME_H_ #define _OBJC_NSOBJCRUNTIME_H_ #include <TargetConditionals.h> #include <objc/objc.h> #if __LP64__ || (TARGET_OS_EMBEDDED && !TARGET_OS_IPHONE) || TARGET_OS_WIN32 || NS_BUILD_32_LIKE_64 typedef long NSInteger; typedef unsigned long NSUInteger; #else typedef int NSInteger; typedef unsigned int NSUInteger; #endif #define NSIntegerMax LONG_MAX #define NSIntegerMin LONG_MIN #define NSUIntegerMax ULONG_MAX #define NSINTEGER_DEFINED 1 #ifndef NS_DESIGNATED_INITIALIZER #if __has_attribute(objc_designated_initializer) #define NS_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer)) #else #define NS_DESIGNATED_INITIALIZER #endif #endif #endif
/***************************************************************************** * * File name : clock-stx5197.h * Description : Low Level API - Clocks identifiers * COPYRIGHT (C) 2009 STMicroelectronics - All Rights Reserved * May be copied or modified under the terms of the GNU General Public * License v2 only. See linux/COPYING for more information. * *****************************************************************************/ /* LLA version: YYYYMMDD */ #define LLA_VERSION 20100322 enum { OSC_REF, /* PLLs reference clock */ PLLA, /* PLLA */ PLLB, /* PLLB */ PLL_CPU, /* Div0 */ PLL_LMI, PLL_BIT, PLL_SYS, PLL_FDMA, PLL_DDR, PLL_AV, PLL_SPARE, PLL_ETH, PLL_ST40_ICK, PLL_ST40_PCK, /* FSs clocks */ FSA_SPARE, FSA_PCM, FSA_SPDIF, FSA_DSS, FSB_PIX, FSB_FDMA_FS, FSB_AUX, FSB_USB, };
/* * Copyright (c) 2008,2009,2010 Lukáš Tvrdý <lukast.dev@gmail.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KIS_SPRAY_PAINTOP_SETTINGS_H_ #define KIS_SPRAY_PAINTOP_SETTINGS_H_ #include <kis_paintop_settings.h> #include <kis_types.h> #include <kis_outline_generation_policy.h> #include "kis_spray_paintop_settings_widget.h" class KisSprayPaintOpSettings : public KisOutlineGenerationPolicy<KisPaintOpSettings> { public: KisSprayPaintOpSettings(); QPainterPath brushOutline(const KisPaintInformation &info, OutlineMode mode) const; QString modelName() const { return "airbrush"; } bool paintIncremental(); bool isAirbrushing() const; int rate() const; }; #endif
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- #ifndef __gnu_xml_transform_Template__ #define __gnu_xml_transform_Template__ #pragma interface #include <java/lang/Object.h> extern "Java" { namespace gnu { namespace xml { namespace transform { class Stylesheet; class Template; class TemplateNode; } namespace xpath { class Expr; class Pattern; class Test; } } } namespace javax { namespace xml { namespace namespace { class QName; } } } namespace org { namespace w3c { namespace dom { class Node; } } } } class gnu::xml::transform::Template : public ::java::lang::Object { public: // actually package-private Template(::gnu::xml::transform::Stylesheet *, ::javax::xml::namespace::QName *, ::gnu::xml::xpath::Pattern *, ::gnu::xml::transform::TemplateNode *, jint, ::java::lang::String *, ::javax::xml::namespace::QName *); private: Template(::gnu::xml::transform::Stylesheet *, ::javax::xml::namespace::QName *, ::gnu::xml::xpath::Pattern *, ::gnu::xml::transform::TemplateNode *, jint, jdouble, ::javax::xml::namespace::QName *, jboolean); public: // actually package-private virtual ::gnu::xml::transform::Template * clone(::gnu::xml::transform::Stylesheet *); public: virtual jint compareTo(::java::lang::Object *); public: // actually package-private virtual ::gnu::xml::xpath::Test * getNodeTest(::gnu::xml::xpath::Expr *); virtual jboolean matches(::javax::xml::namespace::QName *, ::org::w3c::dom::Node *); virtual jboolean matches(::javax::xml::namespace::QName *); virtual jboolean imports(::gnu::xml::transform::Template *); virtual void apply(::gnu::xml::transform::Stylesheet *, ::javax::xml::namespace::QName *, ::org::w3c::dom::Node *, jint, jint, ::org::w3c::dom::Node *, ::org::w3c::dom::Node *); public: virtual ::java::lang::String * toString(); public: // actually package-private virtual void list(::java::io::PrintStream *); static jdouble DEFAULT_PRIORITY; ::gnu::xml::transform::Stylesheet * __attribute__((aligned(__alignof__( ::java::lang::Object)))) stylesheet; ::javax::xml::namespace::QName * name; ::gnu::xml::xpath::Pattern * match; ::gnu::xml::transform::TemplateNode * node; jdouble priority; jint precedence; ::javax::xml::namespace::QName * mode; jboolean isAnyNode; public: static ::java::lang::Class class$; }; #endif // __gnu_xml_transform_Template__
/* Copyright (C) 1997-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #include <fenv.h> #include <fpu_control.h> int fesetexceptflag (const fexcept_t *flagp, int excepts) { fpu_fpsr_t fpsr; fpu_fpsr_t fpsr_new; /* Get the current environment. */ _FPU_GETFPSR (fpsr); excepts &= FE_ALL_EXCEPT; /* Set the desired exception mask. */ fpsr_new = fpsr & ~excepts; fpsr_new |= *flagp & excepts; /* Save state back to the FPU. */ if (fpsr != fpsr_new) _FPU_SETFPSR (fpsr_new); return 0; }
#ifndef _UAPI_LINUX_FS_H #define _UAPI_LINUX_FS_H #include <linux/limits.h> #include <linux/ioctl.h> #include <linux/types.h> #undef NR_OPEN #define INR_OPEN_CUR 1024 #define INR_OPEN_MAX 4096 #define BLOCK_SIZE_BITS 10 #define BLOCK_SIZE (1<<BLOCK_SIZE_BITS) #define SEEK_SET 0 #define SEEK_CUR 1 #define SEEK_END 2 #define SEEK_DATA 3 #define SEEK_HOLE 4 #define SEEK_MAX SEEK_HOLE #define RENAME_NOREPLACE (1 << 0) #define RENAME_EXCHANGE (1 << 1) #define RENAME_WHITEOUT (1 << 2) struct fstrim_range { __u64 start; __u64 len; __u64 minlen; }; struct files_stat_struct { unsigned long nr_files; unsigned long nr_free_files; unsigned long max_files; }; struct inodes_stat_t { long nr_inodes; long nr_unused; long dummy[5]; }; #define NR_FILE 8192 #define MS_RDONLY 1 #define MS_NOSUID 2 #define MS_NODEV 4 #define MS_NOEXEC 8 #define MS_SYNCHRONOUS 16 #define MS_REMOUNT 32 #define MS_MANDLOCK 64 #define MS_DIRSYNC 128 #define MS_EMERGENCY_RO 256 #define MS_NOATIME 1024 #define MS_NODIRATIME 2048 #define MS_BIND 4096 #define MS_MOVE 8192 #define MS_REC 16384 #define MS_VERBOSE 32768 #define MS_SILENT 32768 #define MS_POSIXACL (1<<16) #define MS_UNBINDABLE (1<<17) #define MS_PRIVATE (1<<18) #define MS_SLAVE (1<<19) #define MS_SHARED (1<<20) #define MS_RELATIME (1<<21) #define MS_KERNMOUNT (1<<22) #define MS_I_VERSION (1<<23) #define MS_STRICTATIME (1<<24) #define MS_NOSEC (1<<28) #define MS_BORN (1<<29) #define MS_ACTIVE (1<<30) #define MS_NOUSER (1<<31) #define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION) #define MS_MGC_VAL 0xC0ED0000 #define MS_MGC_MSK 0xffff0000 #define BLKROSET _IO(0x12,93) #define BLKROGET _IO(0x12,94) #define BLKRRPART _IO(0x12,95) #define BLKGETSIZE _IO(0x12,96) #define BLKFLSBUF _IO(0x12,97) #define BLKRASET _IO(0x12,98) #define BLKRAGET _IO(0x12,99) #define BLKFRASET _IO(0x12,100) #define BLKFRAGET _IO(0x12,101) #define BLKSECTSET _IO(0x12,102) #define BLKSECTGET _IO(0x12,103) #define BLKSSZGET _IO(0x12,104) #if 0 #define BLKPG _IO(0x12,105) #define BLKELVGET _IOR(0x12,106,size_t) #define BLKELVSET _IOW(0x12,107,size_t) #endif #define BLKBSZGET _IOR(0x12,112,size_t) #define BLKBSZSET _IOW(0x12,113,size_t) #define BLKGETSIZE64 _IOR(0x12,114,size_t) #define BLKTRACESETUP _IOWR(0x12,115,struct blk_user_trace_setup) #define BLKTRACESTART _IO(0x12,116) #define BLKTRACESTOP _IO(0x12,117) #define BLKTRACETEARDOWN _IO(0x12,118) #define BLKDISCARD _IO(0x12,119) #define BLKIOMIN _IO(0x12,120) #define BLKIOOPT _IO(0x12,121) #define BLKALIGNOFF _IO(0x12,122) #define BLKPBSZGET _IO(0x12,123) #define BLKDISCARDZEROES _IO(0x12,124) #define BLKSECDISCARD _IO(0x12,125) #define BLKROTATIONAL _IO(0x12,126) #define BLKZEROOUT _IO(0x12,127) #define BMAP_IOCTL 1 #define FIBMAP _IO(0x00,1) #define FIGETBSZ _IO(0x00,2) #define FIFREEZE _IOWR('X', 119, int) #define FITHAW _IOWR('X', 120, int) #define FITRIM _IOWR('X', 121, struct fstrim_range) #define FIDTRIM _IOWR('f', 128, struct fstrim_range) #define FS_IOC_GETFLAGS _IOR('f', 1, long) #define FS_IOC_SETFLAGS _IOW('f', 2, long) #define FS_IOC_GETVERSION _IOR('v', 1, long) #define FS_IOC_SETVERSION _IOW('v', 2, long) #define FS_IOC_FIEMAP _IOWR('f', 11, struct fiemap) #define FS_IOC32_GETFLAGS _IOR('f', 1, int) #define FS_IOC32_SETFLAGS _IOW('f', 2, int) #define FS_IOC32_GETVERSION _IOR('v', 1, int) #define FS_IOC32_SETVERSION _IOW('v', 2, int) #define FS_SECRM_FL 0x00000001 #define FS_UNRM_FL 0x00000002 #define FS_COMPR_FL 0x00000004 #define FS_SYNC_FL 0x00000008 #define FS_IMMUTABLE_FL 0x00000010 #define FS_APPEND_FL 0x00000020 #define FS_NODUMP_FL 0x00000040 #define FS_NOATIME_FL 0x00000080 #define FS_DIRTY_FL 0x00000100 #define FS_COMPRBLK_FL 0x00000200 #define FS_NOCOMP_FL 0x00000400 #define FS_ECOMPR_FL 0x00000800 #define FS_BTREE_FL 0x00001000 #define FS_INDEX_FL 0x00001000 #define FS_IMAGIC_FL 0x00002000 #define FS_JOURNAL_DATA_FL 0x00004000 #define FS_NOTAIL_FL 0x00008000 #define FS_DIRSYNC_FL 0x00010000 #define FS_TOPDIR_FL 0x00020000 #define FS_EXTENT_FL 0x00080000 #define FS_DIRECTIO_FL 0x00100000 #define FS_NOCOW_FL 0x00800000 #define FS_RESERVED_FL 0x80000000 #define FS_FL_USER_VISIBLE 0x0003DFFF #define FS_FL_USER_MODIFIABLE 0x000380FF #define SYNC_FILE_RANGE_WAIT_BEFORE 1 #define SYNC_FILE_RANGE_WRITE 2 #define SYNC_FILE_RANGE_WAIT_AFTER 4 #endif
#ifdef __KERNEL__ # include <linux/slab.h> #else # include <stdlib.h> # include <assert.h> # define kfree(x) do { if (x) free(x); } while (0) # define BUG_ON(x) assert(!(x)) # include "include/int_types.h" #endif #include "crush.h" const char *crush_bucket_alg_name(int alg) { switch (alg) { case CRUSH_BUCKET_UNIFORM: return "uniform"; case CRUSH_BUCKET_LIST: return "list"; case CRUSH_BUCKET_TREE: return "tree"; case CRUSH_BUCKET_STRAW: return "straw"; case CRUSH_BUCKET_STRAW2: return "straw2"; default: return "unknown"; } } /** * crush_get_bucket_item_weight - Get weight of an item in given bucket * @b: bucket pointer * @p: item index in bucket */ int crush_get_bucket_item_weight(const struct crush_bucket *b, int p) { if ((__u32)p >= b->size) return 0; switch (b->alg) { case CRUSH_BUCKET_UNIFORM: return ((struct crush_bucket_uniform *)b)->item_weight; case CRUSH_BUCKET_LIST: return ((struct crush_bucket_list *)b)->item_weights[p]; case CRUSH_BUCKET_TREE: return ((struct crush_bucket_tree *)b)->node_weights[crush_calc_tree_node(p)]; case CRUSH_BUCKET_STRAW: return ((struct crush_bucket_straw *)b)->item_weights[p]; case CRUSH_BUCKET_STRAW2: return ((struct crush_bucket_straw2 *)b)->item_weights[p]; } return 0; } void crush_destroy_bucket_uniform(struct crush_bucket_uniform *b) { kfree(b->h.perm); kfree(b->h.items); kfree(b); } void crush_destroy_bucket_list(struct crush_bucket_list *b) { kfree(b->item_weights); kfree(b->sum_weights); kfree(b->h.perm); kfree(b->h.items); kfree(b); } void crush_destroy_bucket_tree(struct crush_bucket_tree *b) { kfree(b->h.perm); kfree(b->h.items); kfree(b->node_weights); kfree(b); } void crush_destroy_bucket_straw(struct crush_bucket_straw *b) { kfree(b->straws); kfree(b->item_weights); kfree(b->h.perm); kfree(b->h.items); kfree(b); } void crush_destroy_bucket_straw2(struct crush_bucket_straw2 *b) { kfree(b->item_weights); kfree(b->h.perm); kfree(b->h.items); kfree(b); } void crush_destroy_bucket(struct crush_bucket *b) { switch (b->alg) { case CRUSH_BUCKET_UNIFORM: crush_destroy_bucket_uniform((struct crush_bucket_uniform *)b); break; case CRUSH_BUCKET_LIST: crush_destroy_bucket_list((struct crush_bucket_list *)b); break; case CRUSH_BUCKET_TREE: crush_destroy_bucket_tree((struct crush_bucket_tree *)b); break; case CRUSH_BUCKET_STRAW: crush_destroy_bucket_straw((struct crush_bucket_straw *)b); break; case CRUSH_BUCKET_STRAW2: crush_destroy_bucket_straw2((struct crush_bucket_straw2 *)b); break; } } /** * crush_destroy - Destroy a crush_map * @map: crush_map pointer */ void crush_destroy(struct crush_map *map) { /* buckets */ if (map->buckets) { __s32 b; for (b = 0; b < map->max_buckets; b++) { if (map->buckets[b] == NULL) continue; crush_destroy_bucket(map->buckets[b]); } kfree(map->buckets); } /* rules */ if (map->rules) { __u32 b; for (b = 0; b < map->max_rules; b++) crush_destroy_rule(map->rules[b]); kfree(map->rules); } kfree(map->choose_tries); kfree(map); } void crush_destroy_rule(struct crush_rule *rule) { kfree(rule); } // methods to check for safe arithmetic operations int crush_addition_is_unsafe(__u32 a, __u32 b) { if ((((__u32)(-1)) - b) < a) return 1; else return 0; } int crush_multiplication_is_unsafe(__u32 a, __u32 b) { // prevent division by zero if (!b) return 1; if ((((__u32)(-1)) / b) < a) return 1; else return 0; }
#include "token.h" void token_init(struct token_t *token) { token->token = NULL; token->type = TOKEN_ERROR; } void token_set(struct token_t *token, struct buffer_t *buffer, int token_type) { token->token = malloc(buffer->bufpos + 1); memcpy(token->token, buffer->buf, buffer->bufpos); token->token[buffer->bufpos] = '\0'; token->type = token_type; } void token_free(struct token_t *token) { free(token->token); free(token); }
//-------------------------------------------------------------------------- // Copyright (C) 2014-2015 Cisco and/or its affiliates. All rights reserved. // // This program is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License Version 2 as published // by the Free Software Foundation. You may not use, modify or distribute // this program under any other version of the GNU General Public 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 Street, Fifth Floor, Boston, MA 02110-1301, USA. //-------------------------------------------------------------------------- // flush_bucket.h author Russ Combs <rucombs@cisco.com> #ifndef FLUSH_BUCKET_H #define FLUSH_BUCKET_H #include "main/snort_types.h" #include "main/thread.h" class FlushBucket { public: virtual ~FlushBucket() { } virtual uint16_t get_next() = 0; static uint16_t get_size(); static void set(unsigned sz); static void clear(); protected: FlushBucket() { } }; class ConstFlushBucket : public FlushBucket { public: ConstFlushBucket(uint16_t sz) { size = sz; } uint16_t get_next() { return size; } private: uint16_t size; }; class StaticFlushBucket : public FlushBucket { public: StaticFlushBucket(); uint16_t get_next(); private: unsigned idx; }; class RandomFlushBucket : public StaticFlushBucket { public: RandomFlushBucket(); }; #endif
/* Copyright (C) 2013 Free Software Foundation, Inc. Contributed by Manuel Lopez-Ibanez <manu@gcc.gnu.org> 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/>. */ /* Based on code from: */ /* grep.c - main driver file for grep. Copyright (C) 1992, 1997-2002, 2004-2013 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, 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. Written July 1992 by Mike Haertel. */ #ifndef GCC_DIAGNOSTIC_COLOR_H #define GCC_DIAGNOSTIC_COLOR_H /* How often diagnostics are prefixed by their locations: o DIAGNOSTICS_SHOW_PREFIX_NEVER: never - not yet supported; o DIAGNOSTICS_SHOW_PREFIX_ONCE: emit only once; o DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE: emit each time a physical line is started. */ typedef enum { DIAGNOSTICS_COLOR_NO = 0, DIAGNOSTICS_COLOR_YES = 1, DIAGNOSTICS_COLOR_AUTO = 2 } diagnostic_color_rule_t; const char *colorize_start (bool, const char *, size_t); const char *colorize_stop (bool); bool colorize_init (diagnostic_color_rule_t); inline const char * colorize_start (bool show_color, const char *name) { return colorize_start (show_color, name, strlen (name)); } #endif /* ! GCC_DIAGNOSTIC_COLOR_H */
// Copyright (C) 2009,2010,2011,2012 GlavSoft LLC. // All rights reserved. // //------------------------------------------------------------------------- // This file is part of the TightVNC software. Please visit our Web site: // // http://www.tightvnc.com/ // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // 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 _WINSOCK_CLASS_H_ #define _WINSOCK_CLASS_H_ #include "util/CommonHeader.h" #include "util/Exception.h" // // Class that startup and cleanup Windows Sockets subsystem. // class WindowsSocket { public: // Initializes Windows sockets subsystem. // Throws exception if winsock already initialized or // if was error during winsock startup. static void startup(BYTE loVer, BYTE hiVer) throw(Exception); // Deinitializes Windows sockets subsystem. // Throws exception if winsock does not initialized or // if was error during winsock cleanup. static void cleanup() throw(Exception); protected: static bool m_isStarted; }; #endif
/* * Copyright (C) 2010 The Paparazzi Team * * This file is part of paparazzi. * * paparazzi 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. * * paparazzi 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 paparazzi; see the file COPYING. If not, write to * the Free Software Foundation, 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /** * @file subsystems/ahrs/ahrs_float_cmpl.h * * Complementary filter in float to estimate the attitude, heading and gyro bias. * * Propagation can be done in rotation matrix or quaternion representation. */ #ifndef AHRS_FLOAT_CMPL_H #define AHRS_FLOAT_CMPL_H #include "std.h" #include "math/pprz_algebra_float.h" #include "math/pprz_orientation_conversion.h" #include "subsystems/gps.h" enum AhrsFCStatus { AHRS_FC_UNINIT, AHRS_FC_RUNNING }; struct AhrsFloatCmpl { struct FloatRates gyro_bias; struct FloatRates rate_correction; struct FloatRates imu_rate; struct FloatQuat ltp_to_imu_quat; struct FloatRMat ltp_to_imu_rmat; bool_t correct_gravity; ///< enable gravity correction during coordinated turns float ltp_vel_norm; ///< velocity norm for gravity correction during coordinated turns bool_t ltp_vel_norm_valid; float accel_omega; ///< filter cut-off frequency for correcting the attitude from accels (pseudo-gravity measurement) float accel_zeta; ///< filter damping for correcting the gyro-bias from accels (pseudo-gravity measurement) float mag_omega; ///< filter cut-off frequency for correcting the attitude (heading) from magnetometer float mag_zeta; ///< filter damping for correcting the gyro bias from magnetometer /** sets how strongly the gravity heuristic reduces accel correction. * Set to zero in order to disable gravity heuristic. */ uint8_t gravity_heuristic_factor; float weight; bool_t heading_aligned; struct FloatVect3 mag_h; /* internal counters for the gains */ uint16_t accel_cnt; ///< number of propagations since last accel update uint16_t mag_cnt; ///< number of propagations since last mag update struct OrientationReps body_to_imu; struct OrientationReps ltp_to_body; enum AhrsFCStatus status; bool_t is_aligned; }; extern struct AhrsFloatCmpl ahrs_fc; extern void ahrs_fc_init(void); extern void ahrs_fc_set_body_to_imu(struct OrientationReps *body_to_imu); extern void ahrs_fc_set_body_to_imu_quat(struct FloatQuat *q_b2i); extern void ahrs_fc_recompute_ltp_to_body(void); extern bool_t ahrs_fc_align(struct FloatRates *lp_gyro, struct FloatVect3 *lp_accel, struct FloatVect3 *lp_mag); extern void ahrs_fc_propagate(struct FloatRates *gyro, float dt); extern void ahrs_fc_update_accel(struct FloatVect3 *accel, float dt); extern void ahrs_fc_update_mag(struct FloatVect3 *mag, float dt); extern void ahrs_fc_update_gps(struct GpsState *gps_s); /** Update yaw based on a heading measurement. * e.g. from GPS course * @param heading Heading in body frame, radians (CW/north) */ void ahrs_fc_update_heading(float heading); /** Hard reset yaw to a heading. * Doesn't affect the bias. * Sets ahrs_fc.heading_aligned to TRUE. * @param heading Heading in body frame, radians (CW/north) */ void ahrs_fc_realign_heading(float heading); #endif /* AHRS_FLOAT_CMPL_H */
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ** ** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia. ** ** Authors: ** Stevan M. Quenette, Senior Software Engineer, VPAC. (steve@vpac.org) ** Patrick D. Sunter, Software Engineer, VPAC. (pds@vpac.org) ** Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins@vpac.org) ** Siew-Ching Tan, Software Engineer, VPAC. (siew@vpac.org) ** Alan H. Lo, Computational Engineer, VPAC. (alan@vpac.org) ** Raquibul Hassan, Computational Engineer, VPAC. (raq@vpac.org) ** ** This library is free software; you can redistribute it and/or ** modify it under the terms of the GNU Lesser General Public ** License as published by the Free Software Foundation; either ** version 2.1 of the License, or (at your option) any later version. ** ** This library is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** Lesser General Public License for more details. ** ** You should have received a copy of the GNU Lesser General Public ** License along with this library; if not, write to the Free Software ** Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ** ** ** ** Assumptions: ** ** Comments: ** ** $Id: Swarm_Register.c 2745 2005-05-10 08:12:18Z RaquibulHassan $ ** **~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ #include "Base/Base.h" #include "Discretisation/Geometry/Geometry.h" #include "Discretisation/Shape/Shape.h" #include "Discretisation/Mesh/Mesh.h" #include "Discretisation/Utils/Utils.h" #include "types.h" #include "shortcuts.h" #include "StandardParticle.h" const Type StandardParticle_Type = "StandardParticle"; const Type LocalParticle_Type = "LocalParticle"; const Type GlobalParticle_Type = "GlobalParticle";
/**************************************************************************************** * Copyright (c) 2008 Peter ZHOU <peterzhoulei@gmail.com> * * * * This program is free software; you can redistribute it and/or modify it under * * the terms of the GNU General Public License as published by the Free Software * * Foundation; either version 2 of the License, or (at your option) any later * * version. * * * * This program is distributed in the hope that it will be useful, but WITHOUT ANY * * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * * PARTICULAR PURPOSE. See the GNU General Public License for more details. * * * * 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 METATYPE_EXPORTER_H #define METATYPE_EXPORTER_H #include "core/meta/Meta.h" #include "core/capabilities/EditCapability.h" #include <QObject> #include <QScriptable> #ifdef DEBUG class AMAROK_EXPORT #else class #endif MetaTrackPrototype : public QObject, protected QScriptable { Q_OBJECT Q_PROPERTY( QString title WRITE setTitle READ title ) Q_PROPERTY( int sampleRate READ sampleRate ) Q_PROPERTY( int bitrate READ bitrate ) Q_PROPERTY( double score WRITE setScore READ score ) Q_PROPERTY( int rating WRITE setRating READ rating ) Q_PROPERTY( bool inCollection READ inCollection ) Q_PROPERTY( QString type READ type ) Q_PROPERTY( int length READ length ) Q_PROPERTY( int fileSize READ fileSize ) Q_PROPERTY( int trackNumber WRITE setTrackNumber READ trackNumber ) Q_PROPERTY( int discNumber WRITE setDiscNumber READ discNumber ) Q_PROPERTY( int playCount READ playCount ) Q_PROPERTY( bool playable READ playable ) Q_PROPERTY( QString album WRITE setAlbum READ album ) Q_PROPERTY( QString artist WRITE setArtist READ artist ) Q_PROPERTY( QString composer WRITE setComposer READ composer ) Q_PROPERTY( QString genre WRITE setGenre READ genre ) Q_PROPERTY( int year WRITE setYear READ year ) Q_PROPERTY( QString comment WRITE setComment READ comment ) Q_PROPERTY( QString path READ path ) Q_PROPERTY( bool isValid READ isValid ) Q_PROPERTY( bool isEditable READ isEditable ) Q_PROPERTY( QString lyrics WRITE setLyrics READ lyrics ) Q_PROPERTY( QString imageUrl WRITE setImageUrl READ imageUrl ) Q_PROPERTY( QString url READ url ) Q_PROPERTY( double bpm READ bpm ) // setter not yet available in Meta::Track public: MetaTrackPrototype( QObject *parent ); ~MetaTrackPrototype(); public slots: QScriptValue imagePixmap( int size ) const; QScriptValue imagePixmap() const; private: int sampleRate() const; int bitrate() const; double score() const; int rating() const; bool inCollection() const; QString type() const; qint64 length() const; int fileSize() const; int trackNumber() const; int discNumber() const; int playCount() const; bool playable() const; QString album() const; QString artist() const; QString composer() const; QString genre() const; int year() const; QString comment() const; QString path() const; bool isValid() const; bool isEditable() const; QString lyrics() const; QString title() const; QString imageUrl() const; QString url() const; double bpm() const; void setScore( double score ); void setRating( int rating ); void setTrackNumber( int number ); void setDiscNumber( int number ); void setAlbum( const QString &album ); void setArtist( const QString &artist ); void setComposer( const QString &composer ); void setGenre( const QString &genre ); void setYear( int year ); void setComment( const QString &comment ); void setLyrics( const QString &lyrics ); void setTitle( const QString& name ); void setImageUrl( const QString& imageUrl ); }; #endif
/* charlcd.c Copyright Luki <humbell@ethz.ch> Copyright 2011 Michel Pollet <buserror@gmail.com> Copyright 2014 Doug Szumski <d.s.szumski@gmail.com> This file is part of simavr. simavr 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. simavr 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 simavr. If not, see <http://www.gnu.org/licenses/>. */ #include <stdlib.h> #include <stdio.h> #include <libgen.h> #include "sim_avr.h" #include "avr_ioport.h" #include "sim_elf.h" #include "sim_gdb.h" #if __APPLE__ #include <GLUT/glut.h> #else #include <GL/glut.h> #endif #include <pthread.h> #include "ssd1306_glut.h" int window_identifier; avr_t * avr = NULL; ssd1306_t ssd1306; int win_width, win_height; static void * avr_run_thread (void * ignore) { while (1) { avr_run (avr); } return NULL; } /* Called on a key press */ void keyCB (unsigned char key, int x, int y) { switch (key) { case 'q': exit (0); break; } } /* Function called whenever redisplay needed */ void displayCB (void) { const uint8_t seg_remap_default = ssd1306_get_flag ( &ssd1306, SSD1306_FLAG_SEGMENT_REMAP_0); const uint8_t seg_comscan_default = ssd1306_get_flag ( &ssd1306, SSD1306_FLAG_COM_SCAN_NORMAL); glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Set up projection matrix glMatrixMode (GL_PROJECTION); // Start with an identity matrix glLoadIdentity (); glOrtho (0, win_width, 0, win_height, 0, 10); // Apply vertical and horizontal display mirroring glScalef (seg_remap_default ? 1 : -1, seg_comscan_default ? -1 : 1, 1); glTranslatef (seg_remap_default ? 0 : -win_width, seg_comscan_default ? -win_height : 0, 0); // Select modelview matrix glMatrixMode (GL_MODELVIEW); glPushMatrix (); // Start with an identity matrix glLoadIdentity (); ssd1306_gl_draw (&ssd1306); glPopMatrix (); glutSwapBuffers (); } // gl timer. if the lcd is dirty, refresh display void timerCB (int i) { // restart timer glutTimerFunc (1000 / 64, timerCB, 0); glutPostRedisplay (); } int initGL (int w, int h, float pix_size) { win_width = w * pix_size; win_height = h * pix_size; // Double buffered, RGB disp mode. glutInitDisplayMode (GLUT_RGB | GLUT_DOUBLE); glutInitWindowSize (win_width, win_height); window_identifier = glutCreateWindow ("SSD1306 128x64 OLED"); // Set window's display callback glutDisplayFunc (displayCB); // Set window's key callback glutKeyboardFunc (keyCB); glutTimerFunc (1000 / 24, timerCB, 0); ssd1306_gl_init (pix_size, SSD1306_GL_WHITE); return 1; } int main (int argc, char *argv[]) { elf_firmware_t f; const char * fname = "atmega32_ssd1306.axf"; char path[256]; sprintf (path, "%s/%s", dirname (argv[0]), fname); printf ("Firmware pathname is %s\n", path); elf_read_firmware (fname, &f); printf ("firmware %s f=%d mmcu=%s\n", fname, (int) f.frequency, f.mmcu); avr = avr_make_mcu_by_name (f.mmcu); if (!avr) { fprintf (stderr, "%s: AVR '%s' not known\n", argv[0], f.mmcu); exit (1); } avr_init (avr); avr_load_firmware (avr, &f); ssd1306_init (avr, &ssd1306, 128, 64); // SSD1306 wired to the SPI bus, with the following additional pins: ssd1306_wiring_t wiring = { .chip_select.port = 'B', .chip_select.pin = 4, .data_instruction.port = 'B', .data_instruction.pin = 1, .reset.port = 'B', .reset.pin = 3, }; ssd1306_connect (&ssd1306, &wiring); printf ("SSD1306 display demo\n Press 'q' to quit\n"); // Initialize GLUT system glutInit (&argc, argv); initGL (ssd1306.columns, ssd1306.rows, 2.0); pthread_t run; pthread_create (&run, NULL, avr_run_thread, NULL); glutMainLoop (); }
#pragma once #include "ASyncSerial.h" #include "KMTronicBase.h" class KMTronic433 : public AsyncSerial, public KMTronicBase { public: KMTronic433(int ID, const std::string &devname); ~KMTronic433() override = default; private: bool StartHardware() override; bool StopHardware() override; void GetRelayStates(); int m_iQueryState; bool m_bHaveReceived; std::shared_ptr<std::thread> m_thread; int m_retrycntr; void Do_Work(); bool OpenSerialDevice(); /** * Read callback, stores data in the buffer */ void readCallback(const char *data, size_t len); bool WriteInt(const unsigned char *data, size_t len, bool bWaitForReturn) override; };
/** * Marlin 3D Printer Firmware * Copyright (C) 2019 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/>. * */ /** * Geeetech GT2560 Revision A+ board pin assignments */ #define BOARD_NAME "GT2560 Rev.A+" #include "pins_GT2560_REV_A.h" #if ENABLED(BLTOUCH) #define SERVO0_PIN 11 #else #define SERVO0_PIN 32 #endif
/* * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. The rights granted to you under the License * may not be used to create, or enable the creation or redistribution of, * unlawful or unlicensed copies of an Apple operating system, or to * circumvent, violate, or enable the circumvention or violation of, any * terms of an Apple operating system software license agreement. * * Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ /* * @OSF_COPYRIGHT@ */ /* * Mach Operating System * Copyright (c) 1991,1990,1989 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. */ /* */ #ifndef _MACH_DEBUG_ZONE_INFO_H_ #define _MACH_DEBUG_ZONE_INFO_H_ #include <mach/boolean.h> #include <mach/machine/vm_types.h> /* * Legacy definitions for host_zone_info(). This interface, and * these definitions have been deprecated in favor of the new * mach_zone_info() inteface and types below. */ #define ZONE_NAME_MAX_LEN 80 typedef struct zone_name { char zn_name[ZONE_NAME_MAX_LEN]; } zone_name_t; typedef zone_name_t *zone_name_array_t; typedef struct zone_info { integer_t zi_count; /* Number of elements used now */ vm_size_t zi_cur_size; /* current memory utilization */ vm_size_t zi_max_size; /* how large can this zone grow */ vm_size_t zi_elem_size; /* size of an element */ vm_size_t zi_alloc_size; /* size used for more memory */ integer_t zi_pageable; /* zone pageable? */ integer_t zi_sleepable; /* sleep if empty? */ integer_t zi_exhaustible; /* merely return if empty? */ integer_t zi_collectable; /* garbage collect elements? */ } zone_info_t; typedef zone_info_t *zone_info_array_t; /* * Remember to update the mig type definitions * in mach_debug_types.defs when adding/removing fields. */ #define MACH_ZONE_NAME_MAX_LEN 80 typedef struct mach_zone_name { char mzn_name[ZONE_NAME_MAX_LEN]; } mach_zone_name_t; typedef mach_zone_name_t *mach_zone_name_array_t; typedef struct mach_zone_info_data { uint64_t mzi_count; /* count of elements in use */ uint64_t mzi_cur_size; /* current memory utilization */ uint64_t mzi_max_size; /* how large can this zone grow */ uint64_t mzi_elem_size; /* size of an element */ uint64_t mzi_alloc_size; /* size used for more memory */ uint64_t mzi_sum_size; /* sum of all allocs (life of zone) */ uint64_t mzi_exhaustible; /* merely return if empty? */ uint64_t mzi_collectable; /* garbage collect elements? */ } mach_zone_info_t; typedef mach_zone_info_t *mach_zone_info_array_t; typedef struct task_zone_info_data { uint64_t tzi_count; /* count of elements in use */ uint64_t tzi_cur_size; /* current memory utilization */ uint64_t tzi_max_size; /* how large can this zone grow */ uint64_t tzi_elem_size; /* size of an element */ uint64_t tzi_alloc_size; /* size used for more memory */ uint64_t tzi_sum_size; /* sum of all allocs (life of zone) */ uint64_t tzi_exhaustible; /* merely return if empty? */ uint64_t tzi_collectable; /* garbage collect elements? */ uint64_t tzi_caller_acct; /* charged to caller (or kernel) */ uint64_t tzi_task_alloc; /* sum of all allocs by this task */ uint64_t tzi_task_free; /* sum of all frees by this task */ } task_zone_info_t; typedef task_zone_info_t *task_zone_info_array_t; #endif /* _MACH_DEBUG_ZONE_INFO_H_ */
/* Copyright (c) 2007. Victor M. Alvarez [plusvic@gmail.com]. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #include "re.h" #undef yyparse #undef yylex #undef yyerror #undef yyfatal #undef yychar #undef yydebug #undef yynerrs #undef yyget_extra #undef yyget_lineno #undef YY_FATAL_ERROR #undef YY_DECL #undef LEX_ENV #define yyparse hex_yyparse #define yylex hex_yylex #define yyerror hex_yyerror #define yyfatal hex_yyfatal #define yychar hex_yychar #define yydebug hex_yydebug #define yynerrs hex_yynerrs #define yyget_extra hex_yyget_extra #define yyget_lineno hex_yyget_lineno #ifndef YY_TYPEDEF_YY_SCANNER_T #define YY_TYPEDEF_YY_SCANNER_T typedef void* yyscan_t; #endif #define YY_EXTRA_TYPE RE* #define YY_USE_CONST typedef struct _HEX_LEX_ENVIRONMENT { int token_count; int inside_or; int last_error_code; char last_error_message[256]; } HEX_LEX_ENVIRONMENT; #define YY_FATAL_ERROR(msg) hex_yyfatal(yyscanner, msg) #define LEX_ENV ((HEX_LEX_ENVIRONMENT*) lex_env) #include <hex_grammar.h> #define YY_DECL int hex_yylex \ (YYSTYPE * yylval_param , yyscan_t yyscanner, HEX_LEX_ENVIRONMENT* lex_env) YY_EXTRA_TYPE yyget_extra( yyscan_t yyscanner); int yylex( YYSTYPE* yylval_param, yyscan_t yyscanner, HEX_LEX_ENVIRONMENT* lex_env); int yyparse( void* yyscanner, HEX_LEX_ENVIRONMENT* lex_env); void yyerror( yyscan_t yyscanner, HEX_LEX_ENVIRONMENT* lex_env, const char* error_message); void yyfatal( yyscan_t yyscanner, const char* error_message); int yr_parse_hex_string( const char* hex_string, int flags, RE** re, RE_ERROR* error);
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <QCloseEvent> #include <QListWidgetItem> #include <QSharedPointer> #include "processinvoker.h" #include "settings/settings.h" namespace Ui { class MainWindow; } namespace Launcher { class PlayPage; class GraphicsPage; class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); private slots: void play(); void changePage(QListWidgetItem*,QListWidgetItem*); private: bool writeSettings(); void setupListWidget(); void createIcons(); void closeEvent(QCloseEvent *event); Ui::MainWindow *ui; QSharedPointer<PlayPage> mPlayPage; QSharedPointer<GraphicsPage> mGraphicsPage; ProcessInvoker mProcessInvoker; Settings::Settings mSettings; }; } #endif // MAINWINDOW_H
/* Internal declarations for getopt. Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998, 1999, 2001, 2003, 2004, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. 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 _GETOPT_INT_H #define _GETOPT_INT_H 1 extern int _getopt_internal (int ___argc, char **___argv, const char *__shortopts, const struct option *__longopts, int *__longind, int __long_only, int __posixly_correct); /* Reentrant versions which can handle parsing multiple argument vectors at the same time. */ /* Data type for reentrant functions. */ struct _getopt_data { /* These have exactly the same meaning as the corresponding global variables, except that they are used for the reentrant versions of getopt. */ int optind; int opterr; int optopt; char *optarg; /* Internal members. */ /* True if the internal members have been initialized. */ int __initialized; /* The next char to be scanned in the option-element in which the last option character we returned was found. This allows us to pick up the scan where we left off. If this is zero, or a null string, it means resume the scan by advancing to the next ARGV-element. */ char *__nextchar; /* Describe how to deal with options that follow non-option ARGV-elements. If the caller did not specify anything, the default is REQUIRE_ORDER if the environment variable POSIXLY_CORRECT is defined, PERMUTE otherwise. REQUIRE_ORDER means don't recognize them as options; stop option processing when the first non-option is seen. This is what Unix does. This mode of operation is selected by either setting the environment variable POSIXLY_CORRECT, or using `+' as the first character of the list of option characters, or by calling getopt. PERMUTE is the default. We permute the contents of ARGV as we scan, so that eventually all the non-options are at the end. This allows options to be given in any order, even with programs that were not written to expect this. RETURN_IN_ORDER is an option available to programs that were written to expect options and other ARGV-elements in any order and that care about the ordering of the two. We describe each non-option ARGV-element as if it were the argument of an option with character code 1. Using `-' as the first character of the list of option characters selects this mode of operation. The special argument `--' forces an end of option-scanning regardless of the value of `ordering'. In the case of RETURN_IN_ORDER, only `--' can cause `getopt' to return -1 with `optind' != ARGC. */ enum { REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER } __ordering; /* If the POSIXLY_CORRECT environment variable is set or getopt was called. */ int __posixly_correct; /* Handle permutation of arguments. */ /* Describe the part of ARGV that contains non-options that have been skipped. `first_nonopt' is the index in ARGV of the first of them; `last_nonopt' is the index after the last of them. */ int __first_nonopt; int __last_nonopt; #if defined _LIBC && defined USE_NONOPTION_FLAGS int __nonoption_flags_max_len; int __nonoption_flags_len; # endif }; /* The initializer is necessary to set OPTIND and OPTERR to their default values and to clear the initialization flag. */ #define _GETOPT_DATA_INITIALIZER { 1, 1 } extern int _getopt_internal_r (int ___argc, char **___argv, const char *__shortopts, const struct option *__longopts, int *__longind, int __long_only, int __posixly_correct, struct _getopt_data *__data); extern int _getopt_long_r (int ___argc, char **___argv, const char *__shortopts, const struct option *__longopts, int *__longind, struct _getopt_data *__data); extern int _getopt_long_only_r (int ___argc, char **___argv, const char *__shortopts, const struct option *__longopts, int *__longind, struct _getopt_data *__data); #endif /* getopt_int.h */
/* +--------------------------------------------------------------------+ | PECL :: http | +--------------------------------------------------------------------+ | Redistribution and use in source and binary forms, with or without | | modification, are permitted provided that the conditions mentioned | | in the accompanying LICENSE file are met. | +--------------------------------------------------------------------+ | Copyright (c) 2004-2005, Michael Wallner <mike@php.net> | +--------------------------------------------------------------------+ */ /* $Id$ */ #ifndef PHP_HTTP_MESSAGE_OBJECT_H #define PHP_HTTP_MESSAGE_OBJECT_H #ifdef ZEND_ENGINE_2 #include "php_http_message_api.h" typedef struct { zend_object zo; http_message *message; zend_object_value parent; } http_message_object; extern zend_class_entry *http_message_object_ce; extern zend_function_entry http_message_object_fe[]; extern PHP_MINIT_FUNCTION(http_message_object); #define http_message_object_new(ce) _http_message_object_new((ce) TSRMLS_CC) extern zend_object_value _http_message_object_new(zend_class_entry *ce TSRMLS_DC); #define http_message_object_new_ex(ce, msg, ptr) _http_message_object_new_ex((ce), (msg), (ptr) TSRMLS_CC) extern zend_object_value _http_message_object_new_ex(zend_class_entry *ce, http_message *msg, http_message_object **ptr TSRMLS_DC); #define http_message_object_clone(zobj) _http_message_object_clone_obj(zobj TSRMLS_CC) extern zend_object_value _http_message_object_clone_obj(zval *object TSRMLS_DC); #define http_message_object_free(o) _http_message_object_free((o) TSRMLS_CC) extern void _http_message_object_free(zend_object *object TSRMLS_DC); #define HTTP_MSG_PROPHASH_TYPE 276192743LU #define HTTP_MSG_PROPHASH_HTTP_VERSION 1138628683LU #define HTTP_MSG_PROPHASH_BODY 254474387LU #define HTTP_MSG_PROPHASH_HEADERS 3199929089LU #define HTTP_MSG_PROPHASH_PARENT_MESSAGE 2105714836LU #define HTTP_MSG_PROPHASH_REQUEST_METHOD 1669022159LU #define HTTP_MSG_PROPHASH_REQUEST_URI 3208695486LU #define HTTP_MSG_PROPHASH_RESPONSE_STATUS 3857097400LU #define HTTP_MSG_PROPHASH_RESPONSE_CODE 1305615119LU #define HTTP_MSG_CHILD_PROPHASH_TYPE 624467825LU #define HTTP_MSG_CHILD_PROPHASH_HTTP_VERSION 1021966997LU #define HTTP_MSG_CHILD_PROPHASH_BODY 602749469LU #define HTTP_MSG_CHILD_PROPHASH_HEADERS 3626850379LU #define HTTP_MSG_CHILD_PROPHASH_PARENT_MESSAGE 3910157662LU #define HTTP_MSG_CHILD_PROPHASH_REQUEST_METHOD 3473464985LU #define HTTP_MSG_CHILD_PROPHASH_REQUEST_URI 3855912904LU #define HTTP_MSG_CHILD_PROPHASH_RESPONSE_STATUS 3274168514LU #define HTTP_MSG_CHILD_PROPHASH_RESPONSE_CODE 1750746777LU #define HTTP_MSG_CHECK_OBJ(obj, dofail) \ if (!(obj)->message) { \ http_error(E_WARNING, HTTP_E_MSG, "HttpMessage is empty"); \ dofail; \ } #define HTTP_MSG_CHECK_STD() HTTP_MSG_CHECK_OBJ(obj, RETURN_FALSE) #define HTTP_MSG_INIT_OBJ(obj) \ if (!(obj)->message) { \ (obj)->message = http_message_new(); \ } #define HTTP_MSG_INIT_STD() HTTP_MSG_INIT_OBJ(obj) PHP_METHOD(HttpMessage, __construct); PHP_METHOD(HttpMessage, getBody); PHP_METHOD(HttpMessage, setBody); PHP_METHOD(HttpMessage, getHeaders); PHP_METHOD(HttpMessage, setHeaders); PHP_METHOD(HttpMessage, addHeaders); PHP_METHOD(HttpMessage, getType); PHP_METHOD(HttpMessage, setType); PHP_METHOD(HttpMessage, getResponseCode); PHP_METHOD(HttpMessage, setResponseCode); PHP_METHOD(HttpMessage, getRequestMethod); PHP_METHOD(HttpMessage, setRequestMethod); PHP_METHOD(HttpMessage, getRequestUri); PHP_METHOD(HttpMessage, setRequestUri); PHP_METHOD(HttpMessage, getHttpVersion); PHP_METHOD(HttpMessage, setHttpVersion); PHP_METHOD(HttpMessage, getParentMessage); PHP_METHOD(HttpMessage, send); PHP_METHOD(HttpMessage, toString); PHP_METHOD(HttpMessage, fromString); #endif #endif /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: noet sw=4 ts=4 fdm=marker * vim<600: noet sw=4 ts=4 */
/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qt Creator. ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms and ** conditions see http://www.qt.io/terms-conditions. For further information ** use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef PROJECTMACROEXPANDER_H #define PROJECTMACROEXPANDER_H #include "projectexplorer_export.h" #include <utils/macroexpander.h> namespace ProjectExplorer { class Kit; class PROJECTEXPLORER_EXPORT ProjectMacroExpander : public Utils::MacroExpander { public: ProjectMacroExpander(const QString &projectName, const Kit *kit, const QString &bcName); }; } // namespace ProjectExplorer #endif // PROJECTMACROEXPANDER_H
/* * * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #ifndef GRPC_SUPPORT_ATM_WIN32_H #define GRPC_SUPPORT_ATM_WIN32_H #include <grpc/impl/codegen/atm_win32.h> #endif /* GRPC_SUPPORT_ATM_WIN32_H */
/* * Copyright 1999-2006 University of Chicago * * 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. */ /** globus_libc_setenv_test.c Test the functionality in globus_libc_setenv.c * @author by Michael Lebman */ #include "globus_common.h" #include "globus_test_tap.h" struct envVar { char *name; char *value; }; int globus_libc_setenv_test(void) { struct envVar vars[] = {{"var0", "val0"}, {"var1", "val1"}, {"var2", "val2"}, {"var3", "val3"}, {"var4", "val4"}, {"var5", "val5"}, {"var6", "val6"}, {"var7", "val7"}, {"var8", "val8"}, {"var9", "val9"}, {"var10", "val10"}, {"var11", "val11"}, {"var12", "val12"}, {"var13", "val13"}, {"var14", "val14"}, {"var15", "val15"}, {"var16", "val16"}, {"var17", "val17"}, {"var18", "val18"}, {"var19", "val19"}, {"var20", "val20"}, {"var21", "val21"}, {"var22", "val22"}, {"var23", "val23"}, {"var24", "val24"}, {"var25", "val25"}, {"var26", "val26"}, {"var27", "val27"}, {"var28", "val28"}, {"var29", "val29"}, {"var30", "val30"}, {"var31", "val31"}, {"var32", "val32"}, {"var33", "val33"}, {"var34", "val34"}, {"var35", "val35"}, {"var36", "val36"}, {"var37", "val37"}, {"var38", "val38"}, {"var39", "val39"}, {"var40", "val40"}, {"var41", "val41"}, {"var42", "val42"}, {"var43", "val43"}, {"var44", "val44"}, {"var45", "val45"}, {"var46", "val46"}, {"var47", "val47"}, {"var48", "val48"}, {"var49", "val49"}}; int i; char *value; char temp[256]; printf("1..330\n"); globus_module_activate(GLOBUS_COMMON_MODULE); for (i = 40; i < 50; i++) { ok((value = getenv(vars[i].name)) == NULL, "variable_%s_shouldnt_exist", vars[i].name); } /* add a bunch of variables to the environment */ printf(" Setting environment variables...\n"); for (i = 0; i < 50; i++) { ok(globus_libc_setenv(vars[i].name, vars[i].value, 0) == 0, "globus_libc_setenv_%s", vars[i].name); } /** * @test * Check to see whether all of the variables were added correctly, * then make sure they stay the same if overwrite is false and change * if it is true. */ printf(" Verifying set environment variables...\n"); for (i = 0; i < 50; i++) { ok((value = getenv(vars[i].name)) != NULL, "getenv_%s", vars[i].name); strcpy(temp, vars[i].name); temp[2] = 'l'; /* overwrite the 'r' with an 'l' */ skip(value == NULL, ok(globus_libc_setenv(vars[i].name, temp, 0) == 0, "set_%s_without_overwrite", vars[i].name)); skip(value == NULL, ok(strcmp(getenv(vars[i].name), vars[i].value) == 0, "compare_%s_after_not_changing", vars[i].name)); skip(value == NULL, ok(globus_libc_setenv(vars[i].name, temp, 1) == 0, "set_%s_with_overwrite", vars[i].name)); skip(value == NULL, ok(strcmp(getenv(vars[i].name), temp) == 0, "compare_%s_after_changing", vars[i].name)); } /** * @test unset most of the variables with globus_libc_unsetenv() */ printf(" Unsetting environment variables...\n"); for (i = 10; i < 50; i++) { printf(" Unsetting %s\n", vars[i].name); globus_libc_unsetenv(vars[i].name); } /** @test check again for their presence; include both set and unset * variables */ printf(" Checking set environment variables...\n"); for (i = 0; i < 10; i++) /* should still be present */ { ok(getenv(vars[i].name) != NULL, "test_that_not_unset_%s_is_set", vars[i].name); } printf(" Checking unset environment variables...\n"); for (i = 10; i < 20; i++) /* should be unset */ { ok((value = getenv(vars[i].name)) == NULL, "test_that_%s_is_unset", vars[i].name); if (value) { printf(" UNEXPECTED VALUE %s\n", value); } } globus_module_deactivate(GLOBUS_COMMON_MODULE); return TEST_EXIT_CODE; } int main(int argc, char *argv[]) { return globus_libc_setenv_test(); }
/* * Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ /** * Identity Verification Attributes */ @interface SESIdentityVerificationAttributes:NSObject { NSString *verificationStatus; NSString *verificationToken; } /** * Default constructor for a new object. Callers should use the * property methods to initialize this object after creating it. */ -(id)init; /** * The verification status of the identity: "Pending", "Success", * "Failed", or "TemporaryFailure". * <p> * <b>Constraints:</b><br/> * <b>Allowed Values: </b>Pending, Success, Failed, TemporaryFailure */ @property (nonatomic, retain) NSString *verificationStatus; /** * The verification token for a domain identity. Null for email address * identities. */ @property (nonatomic, retain) NSString *verificationToken; /** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. */ -(NSString *)description; @end
// // OEXZeroRatingConfig.h // edXVideoLocker // // Created by Jotiram Bhagat on 23/02/15. // Copyright (c) 2015-2016 edX. All rights reserved. // #import "OEXConfig.h" NS_ASSUME_NONNULL_BEGIN @interface OEXZeroRatingConfig : NSObject - (instancetype)initWithDictionary:(NSDictionary*)dictionary; @property(readonly, nonatomic, assign, getter = isEnabled) BOOL enabled; @property (readonly, nonatomic) NSArray<NSString*>* carriers; @end @interface OEXConfig (ZeroRating) @property (readonly, nonatomic, strong, nullable) OEXZeroRatingConfig* zeroRatingConfig; @end NS_ASSUME_NONNULL_END
/* * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ /****************************************************************** iLBC Speech Coder ANSI-C Source Code WebRtcIlbcfix_InitEncode.h ******************************************************************/ #ifndef MODULES_AUDIO_CODING_CODECS_ILBC_MAIN_SOURCE_INIT_ENCODE_H_ #define MODULES_AUDIO_CODING_CODECS_ILBC_MAIN_SOURCE_INIT_ENCODE_H_ #include "defines.h" /*----------------------------------------------------------------* * Initiation of encoder instance. *---------------------------------------------------------------*/ int WebRtcIlbcfix_InitEncode( /* (o) Number of bytes encoded */ IlbcEncoder *iLBCenc_inst, /* (i/o) Encoder instance */ int16_t mode /* (i) frame size mode */ ); #endif
/* * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://ugfx.org/license.html * * Mail: fede.677387@hotmail.it * * Board: STM32F3-Discovery */ /** * @file boards/addons/gdisp/board_SPFD54124B_stm32f3.h * @brief GDISP Graphic Driver subsystem board interface for the SPFD54124B display. */ #ifndef _GDISP_LLD_BOARD_H #define _GDISP_LLD_BOARD_H #define SPFD54124B_SPID SPID2 #define SPFD54124B_SPI_PORT GPIOB #define SPFD54124B_SPI_NSS 12 #define SPFD54124B_SPI_SCK 13 #define SPFD54124B_SPI_MISO 14 // not used #define SPFD54124B_SPI_MOSI 15 #define SPFD54124B_PIN_PORT GPIOA #define SPFD54124B_PIN_RST 5 #define SET_RST palSetPad(SPFD54124B_PIN_PORT, SPFD54124B_PIN_RST); #define CLR_RST palClearPad(SPFD54124B_PIN_PORT, SPFD54124B_PIN_RST); #define USE_SOFT_SPI TRUE #define USE_HARD_SPI !(USE_SOFT_SPI) #if USE_HARD_SPI #if GFX_USE_OS_CHIBIOS static int32_t thdPriority = 0; #endif /* * Maximum speed SPI configuration in 9 bit mode */ static const SPIConfig hs_spicfg = { NULL, /* Operation complete callback or @p NULL. */ SPFD54124B_SPI_PORT, /* The chip select line port */ SPFD54124B_SPI_NSS, /* The chip select line pad number */ 0, /* SPI CR1 register initialization data*/ SPI_CR2_DS_3 /* SPI CR2 register initialization data 9-bit */ }; #endif #if USE_SOFT_SPI static GFXINLINE void soft_spi_sck(void){ palSetPad(SPFD54124B_SPI_PORT, SPFD54124B_SPI_SCK); palClearPad(SPFD54124B_SPI_PORT, SPFD54124B_SPI_SCK); } static GFXINLINE void soft_spi_write_9bit(uint16_t data){ uint8_t i; // activate lcd by low on CS pin palClearPad(SPFD54124B_SPI_PORT, SPFD54124B_SPI_NSS); for (i=0; i<9; i++){ // setting data if(data & (SPFD54124B_SEND_DATA >> i)) { palSetPad(SPFD54124B_SPI_PORT, SPFD54124B_SPI_MOSI); } else palClearPad(SPFD54124B_SPI_PORT, SPFD54124B_SPI_MOSI); // clock data soft_spi_sck(); } //deactivate lcd by high on CS pin palSetPad(SPFD54124B_SPI_PORT, SPFD54124B_SPI_NSS); } #endif static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { (void) g; if(state) { CLR_RST; } else { SET_RST; } } static GFXINLINE void init_board(GDisplay *g) { // As we are not using multiple displays we set g->board to NULL as we don't use it. g->board = 0; switch(g->controllerdisplay) { case 0: // Set up for Display 0 /* * SPI1 I/O pins setup. */ palSetPadMode(SPFD54124B_PIN_PORT, SPFD54124B_PIN_RST, PAL_MODE_OUTPUT_PUSHPULL); /* RESET */ setpin_reset(g, TRUE); #if USE_HARD_SPI palSetPadMode(SPFD54124B_SPI_PORT, SPFD54124B_SPI_SCK, PAL_MODE_ALTERNATE(5) | PAL_STM32_OSPEED_HIGHEST); /* SCK. */ palSetPadMode(SPFD54124B_SPI_PORT, SPFD54124B_SPI_MISO, PAL_MODE_ALTERNATE(5) | PAL_STM32_OSPEED_HIGHEST); /* MISO.*/ palSetPadMode(SPFD54124B_SPI_PORT, SPFD54124B_SPI_MOSI, PAL_MODE_ALTERNATE(5) | PAL_STM32_OSPEED_HIGHEST); /* MOSI.*/ palSetPadMode(SPFD54124B_SPI_PORT, SPFD54124B_SPI_NSS, PAL_MODE_OUTPUT_PUSHPULL | PAL_STM32_OSPEED_HIGHEST); /* NSS */ palSetPad(SPFD54124B_SPI_PORT, SPFD54124B_SPI_NSS); palClearPad(SPFD54124B_SPI_PORT, SPFD54124B_SPI_SCK); palClearPad(SPFD54124B_SPI_PORT, SPFD54124B_SPI_MOSI); spiInit(); #endif #if USE_SOFT_SPI palSetPadMode(SPFD54124B_SPI_PORT, SPFD54124B_SPI_SCK, PAL_MODE_OUTPUT_PUSHPULL | PAL_STM32_OSPEED_HIGHEST); /* SCK. */ palSetPadMode(SPFD54124B_SPI_PORT, SPFD54124B_SPI_MISO, PAL_MODE_OUTPUT_PUSHPULL | PAL_STM32_OSPEED_HIGHEST); /* MISO.*/ palSetPadMode(SPFD54124B_SPI_PORT, SPFD54124B_SPI_MOSI, PAL_MODE_OUTPUT_PUSHPULL | PAL_STM32_OSPEED_HIGHEST); /* MOSI.*/ palSetPadMode(SPFD54124B_SPI_PORT, SPFD54124B_SPI_NSS, PAL_MODE_OUTPUT_PUSHPULL | PAL_STM32_OSPEED_HIGHEST); /* NSS */ palSetPad(SPFD54124B_SPI_PORT, SPFD54124B_SPI_NSS); palClearPad(SPFD54124B_SPI_PORT, SPFD54124B_SPI_SCK); palClearPad(SPFD54124B_SPI_PORT, SPFD54124B_SPI_MOSI); #endif break; } } static GFXINLINE void acquire_bus(GDisplay *g) { (void) g; #if USE_HARD_SPI #if GFX_USE_OS_CHIBIOS thdPriority = (int32_t)chThdGetPriority(); chThdSetPriority(HIGHPRIO); #endif spiAcquireBus(&SPFD54124B_SPID); #endif } static GFXINLINE void release_bus(GDisplay *g) { (void) g; #if USE_HARD_SPI #if GFX_USE_OS_CHIBIOS chThdSetPriority(thdPriority); #endif spiReleaseBus(&SPFD54124B_SPID); #endif } static GFXINLINE void write_data(GDisplay *g, uint16_t data) { (void) g; uint16_t b; #if USE_HARD_SPI spiStart(&SPFD54124B_SPID, &hs_spicfg); spiSelect(&SPFD54124B_SPID); b = (data >> 0x08) | SPFD54124B_SEND_DATA; spiSend(&SPFD54124B_SPID, 0x01, &b); b = (data & 0xFF) | SPFD54124B_SEND_DATA; spiSend(&SPFD54124B_SPID, 0x01, &b); spiUnselect(&SPFD54124B_SPID); spiStop(&SPFD54124B_SPID); #endif #if USE_SOFT_SPI b = (data >> 0x08) | SPFD54124B_SEND_DATA; soft_spi_write_9bit(b); b = (data & 0xFF) | SPFD54124B_SEND_DATA; soft_spi_write_9bit(b); #endif } static GFXINLINE void write_index(GDisplay *g, uint16_t index) { (void) g; #if USE_HARD_SPI spiStart(&SPFD54124B_SPID, &hs_spicfg); spiSelect(&SPFD54124B_SPID); spiSend(&SPFD54124B_SPID, 0x01, &index); spiUnselect(&SPFD54124B_SPID); spiStop(&SPFD54124B_SPID); #endif #if USE_SOFT_SPI soft_spi_write_9bit(index); #endif } static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } static GFXINLINE void set_backlight(GDisplay *g, uint8_t percent) { (void) g; (void) percent; } #endif /* _GDISP_LLD_BOARD_H */
/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #ifndef TENSORFLOW_FRAMEWORK_NUMERIC_TYPES_H_ #define TENSORFLOW_FRAMEWORK_NUMERIC_TYPES_H_ #include <complex> #include "third_party/eigen3/unsupported/Eigen/CXX11/Tensor" // Disable clang-format to prevent 'FixedPoint' header from being included // before 'Tensor' header on which it depends. // clang-format off #include "third_party/eigen3/unsupported/Eigen/CXX11/FixedPoint" // clang-format on #include "tensorflow/core/platform/types.h" namespace tensorflow { // Single precision complex. typedef std::complex<float> complex64; // Double precision complex. typedef std::complex<double> complex128; // We use Eigen's QInt implementations for our quantized int types. typedef Eigen::QInt8 qint8; typedef Eigen::QUInt8 quint8; typedef Eigen::QInt32 qint32; typedef Eigen::QInt16 qint16; typedef Eigen::QUInt16 quint16; // see framework/bfloat16.h for description. struct bfloat16 { EIGEN_DEVICE_FUNC bfloat16() {} EIGEN_DEVICE_FUNC explicit bfloat16(const float v) { const uint16_t* p = reinterpret_cast<const uint16_t*>(&v); #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ value = p[0]; #else value = p[1]; #endif } template <class T> explicit EIGEN_DEVICE_FUNC bfloat16(const T& val) : bfloat16(static_cast<float>(val)) {} EIGEN_DEVICE_FUNC EIGEN_EXPLICIT_CAST(float) const { float result; uint16_t* q = reinterpret_cast<uint16_t*>(&result); #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ q[0] = value; q[1] = 0; #else q[0] = 0; q[1] = value; #endif return result; } EIGEN_DEVICE_FUNC explicit operator bool() const { return static_cast<bool>(float(*this)); } EIGEN_DEVICE_FUNC explicit operator Eigen::half() const { return static_cast<Eigen::half>(float(*this)); } EIGEN_DEVICE_FUNC explicit operator short() const { return static_cast<short>(float(*this)); } EIGEN_DEVICE_FUNC explicit operator int() const { return static_cast<int>(float(*this)); } EIGEN_DEVICE_FUNC explicit operator char() const { return static_cast<char>(float(*this)); } EIGEN_DEVICE_FUNC explicit operator signed char() const { return static_cast<signed char>(float(*this)); } EIGEN_DEVICE_FUNC explicit operator unsigned char() const { return static_cast<unsigned char>(float(*this)); } EIGEN_DEVICE_FUNC explicit operator unsigned int() const { return static_cast<unsigned int>(float(*this)); } EIGEN_DEVICE_FUNC explicit operator unsigned long() const { return static_cast<unsigned long>(float(*this)); } EIGEN_DEVICE_FUNC explicit operator unsigned long long() const { return static_cast<unsigned long long>(float(*this)); } EIGEN_DEVICE_FUNC explicit operator long long() const { return static_cast<long long>(float(*this)); } EIGEN_DEVICE_FUNC explicit operator double() const { return static_cast<double>(float(*this)); } uint16_t value; }; inline bool operator==(const bfloat16 a, const bfloat16 b) { return a.value == b.value; } inline bool operator!=(const bfloat16 a, const bfloat16 b) { return a.value != b.value; } } // end namespace tensorflow namespace Eigen { template <> struct NumTraits<tensorflow::bfloat16> : GenericNumTraits<uint16_t> {}; using ::tensorflow::operator==; using ::tensorflow::operator!=; } // namespace Eigen #ifdef COMPILER_MSVC namespace std { template <> struct hash<Eigen::half> { std::size_t operator()(const Eigen::half& a) const { return static_cast<std::size_t>(a.x); } }; } // namespace std #endif // COMPILER_MSVC #endif // TENSORFLOW_FRAMEWORK_NUMERIC_TYPES_H_
/********************************************************************** // @@@ START COPYRIGHT @@@ // // Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, // software distributed under the License is distributed on an // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. // // @@@ END COPYRIGHT @@@ **********************************************************************/ // File is being obsoleted. It uses features from the Open Source // Foundation which is not support by Apache and the functions in this // file were not being used.
/** * @file * @brief * * @date 05.07.2012 * @author Andrey Gazukin * @author Anton Kozlov */ #include <fcntl.h> #include <unistd.h> #include <dirent.h> #include <embox/test.h> EMBOX_TEST_SUITE("fs read tests"); #define FS_TEST_MOUNTPOINT "/mnt/fs_test" static char fs_test_temp_buf[512]; static const char fs_test_rd_file[] = FS_TEST_MOUNTPOINT "/rd_file"; static const char fs_test_rd_file_content[] = "This is read-only file with original content string\n"; TEST_CASE("Test read operation on fs") { int fd; int nread; test_assert(0 <= (fd = open(fs_test_rd_file, O_RDONLY))); nread = read(fd, fs_test_temp_buf, sizeof(fs_test_temp_buf)); test_assert_equal(nread, sizeof(fs_test_rd_file_content) - 1); test_assert_zero(memcmp(fs_test_temp_buf, fs_test_rd_file_content, sizeof(fs_test_rd_file_content) - 1)); close(fd); } TEST_CASE("Test stat operations on fs") { struct stat st, fst; int fd; stat(fs_test_rd_file, &st); test_assert(0 <= (fd = open(fs_test_rd_file, O_RDONLY))); test_assert_zero(fstat(fd, &fst)); close(fd); test_assert(0 == memcmp(&st, &fst, sizeof(struct stat))); test_assert_true(S_ISREG(st.st_mode)); test_assert_equal(st.st_size, sizeof(fs_test_rd_file_content) - 1); } static const char fs_test_rd_dir[] = FS_TEST_MOUNTPOINT "/rd_dir"; static const char *fs_test_rd_dir_ents[] = { "f1", "f2", "f3", }; TEST_CASE("Test readdir operations on fs") { struct dirent *dent; DIR *d; int i; bool ent_extra = false; bool ent_seen[ARRAY_SIZE(fs_test_rd_dir_ents)]; memset(ent_seen, 0, sizeof(ent_seen)); d = opendir(fs_test_rd_dir); test_assert_not_null(d); dent = readdir(d); while (dent) { for (i = 0; i < ARRAY_SIZE(fs_test_rd_dir_ents); i++) { if (!strcmp(dent->d_name, fs_test_rd_dir_ents[i])) { break; } } if (i < ARRAY_SIZE(fs_test_rd_dir_ents)) { ent_seen[i] = true; } else { ent_extra = true; } dent = readdir(d); } closedir(d); for (i = 0; i < ARRAY_SIZE(fs_test_rd_dir_ents); i++) { test_assert_equal(true, ent_seen[i]); } test_assert_equal(false, ent_extra); }
/* $Id: tif_unix.c,v 1.12 2006/03/21 16:37:51 dron Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ /* * TIFF Library UNIX-specific Routines. These are should also work with the * Windows Common RunTime Library. */ #include "tif_config.h" #ifdef HAVE_SYS_TYPES_H # include <sys/types.h> #endif #include <stdarg.h> #include <stdlib.h> #include <sys/stat.h> #ifdef HAVE_UNISTD_H # include <unistd.h> #endif #ifdef HAVE_FCNTL_H # include <fcntl.h> #endif #ifdef _WIN32 #include <io.h> #endif #include "tiffiop.h" static tsize_t _tiffReadProc(thandle_t fd, tdata_t buf, tsize_t size) { return ((tsize_t) read((int) fd, buf, (size_t) size)); } static tsize_t _tiffWriteProc(thandle_t fd, tdata_t buf, tsize_t size) { return ((tsize_t) write((int) fd, buf, (size_t) size)); } static toff_t _tiffSeekProc(thandle_t fd, toff_t off, int whence) { return ((toff_t) lseek((int) fd, (off_t) off, whence)); } static int _tiffCloseProc(thandle_t fd) { return (close((int) fd)); } static toff_t _tiffSizeProc(thandle_t fd) { #ifdef _AM29K long fsize; return ((fsize = lseek((int) fd, 0, SEEK_END)) < 0 ? 0 : fsize); #else struct stat sb; return (toff_t) (fstat((int) fd, &sb) < 0 ? 0 : sb.st_size); #endif } #ifdef HAVE_MMAP #include <sys/mman.h> static int _tiffMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize) { toff_t size = _tiffSizeProc(fd); if (size != (toff_t) -1) { *pbase = (tdata_t) mmap(0, size, PROT_READ, MAP_SHARED, (int) fd, 0); if (*pbase != (tdata_t) -1) { *psize = size; return (1); } } return (0); } static void _tiffUnmapProc(thandle_t fd, tdata_t base, toff_t size) { (void) fd; (void) munmap(base, (off_t) size); } #else /* !HAVE_MMAP */ static int _tiffMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize) { (void) fd; (void) pbase; (void) psize; return (0); } static void _tiffUnmapProc(thandle_t fd, tdata_t base, toff_t size) { (void) fd; (void) base; (void) size; } #endif /* !HAVE_MMAP */ /* * Open a TIFF file descriptor for read/writing. */ TIFF* TIFFFdOpen(int fd, const char* name, const char* mode) { TIFF* tif; tif = TIFFClientOpen(name, mode, (thandle_t) fd, _tiffReadProc, _tiffWriteProc, _tiffSeekProc, _tiffCloseProc, _tiffSizeProc, _tiffMapProc, _tiffUnmapProc); if (tif) tif->tif_fd = fd; return (tif); } /* * Open a TIFF file for read/writing. */ TIFF* TIFFOpen(const char* name, const char* mode) { static const char module[] = "TIFFOpen"; int m, fd; TIFF* tif; m = _TIFFgetMode(mode, module); if (m == -1) return ((TIFF*)0); /* for cygwin and mingw */ #ifdef O_BINARY m |= O_BINARY; #endif #ifdef _AM29K fd = open(name, m); #else fd = open(name, m, 0666); #endif if (fd < 0) { TIFFErrorExt(0, module, "%s: Cannot open", name); return ((TIFF *)0); } tif = TIFFFdOpen((int)fd, name, mode); if(!tif) close(fd); return tif; } #ifdef __WIN32__ #include <windows.h> /* * Open a TIFF file with a Unicode filename, for read/writing. */ TIFF* TIFFOpenW(const wchar_t* name, const char* mode) { static const char module[] = "TIFFOpenW"; int m, fd; int mbsize; char *mbname; TIFF* tif; m = _TIFFgetMode(mode, module); if (m == -1) return ((TIFF*)0); /* for cygwin and mingw */ #ifdef O_BINARY m |= O_BINARY; #endif fd = _wopen(name, m, 0666); if (fd < 0) { TIFFErrorExt(0, module, "%s: Cannot open", name); return ((TIFF *)0); } mbname = NULL; mbsize = WideCharToMultiByte(CP_ACP, 0, name, -1, NULL, 0, NULL, NULL); if (mbsize > 0) { mbname = _TIFFmalloc(mbsize); if (!mbname) { TIFFErrorExt(0, module, "Can't allocate space for filename conversion buffer"); return ((TIFF*)0); } WideCharToMultiByte(CP_ACP, 0, name, -1, mbname, mbsize, NULL, NULL); } tif = TIFFFdOpen((int)fd, (mbname != NULL) ? mbname : "<unknown>", mode); _TIFFfree(mbname); if(!tif) close(fd); return tif; } #endif void* _TIFFmalloc(tsize_t s) { return (malloc((size_t) s)); } void _TIFFfree(tdata_t p) { free(p); } void* _TIFFrealloc(tdata_t p, tsize_t s) { return (realloc(p, (size_t) s)); } void _TIFFmemset(tdata_t p, int v, tsize_t c) { memset(p, v, (size_t) c); } void _TIFFmemcpy(tdata_t d, const tdata_t s, tsize_t c) { memcpy(d, s, (size_t) c); } int _TIFFmemcmp(const tdata_t p1, const tdata_t p2, tsize_t c) { return (memcmp(p1, p2, (size_t) c)); } static void unixWarningHandler(const char* module, const char* fmt, va_list ap) { if (module != NULL) fprintf(stderr, "%s: ", module); fprintf(stderr, "Warning, "); vfprintf(stderr, fmt, ap); fprintf(stderr, ".\n"); } TIFFErrorHandler _TIFFwarningHandler = unixWarningHandler; static void unixErrorHandler(const char* module, const char* fmt, va_list ap) { if (module != NULL) fprintf(stderr, "%s: ", module); vfprintf(stderr, fmt, ap); fprintf(stderr, ".\n"); } TIFFErrorHandler _TIFFerrorHandler = unixErrorHandler;
/* $NetBSD: fpclassifyd_ieee754.c,v 1.2 2008/04/28 20:22:59 martin Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation * by Klaus Klein. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) __RCSID("$NetBSD: fpclassifyd_ieee754.c,v 1.2 2008/04/28 20:22:59 martin Exp $"); #endif #include <machine/ieee.h> #include <math.h> /* * 7.12.3.1 fpclassify - classify real floating type * IEEE 754 double-precision version */ int __fpclassifyd(double x) { union ieee_double_u u; u.dblu_d = x; if (u.dblu_dbl.dbl_exp == 0) { if (u.dblu_dbl.dbl_frach == 0 && u.dblu_dbl.dbl_fracl == 0) return FP_ZERO; else return FP_SUBNORMAL; } else if (u.dblu_dbl.dbl_exp == DBL_EXP_INFNAN) { if (u.dblu_dbl.dbl_frach == 0 && u.dblu_dbl.dbl_fracl == 0) return FP_INFINITE; else return FP_NAN; } return FP_NORMAL; }
// Copyright 2021 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 REMOTING_HOST_CHROMEOS_FEATURES_H_ #define REMOTING_HOST_CHROMEOS_FEATURES_H_ #include "base/feature_list.h" namespace remoting { // Enable to allow CRD to stream other monitors than the primary display. extern const base::Feature kEnableMultiMonitorsInCrd; } // namespace remoting #endif // REMOTING_HOST_CHROMEOS_FEATURES_H_
/* Copyright (c) 2012, Lunar Workshop, 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 by Lunar Workshop, Inc. 4. Neither the name of the Lunar Workshop 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 LUNAR WORKSHOP 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 LUNAR WORKSHOP 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. */ #pragma once class Vector; class Color { public: Color(); Color(Vector v); Color(int _r, int _g, int _b); Color(int _r, int _g, int _b, int _a); Color(float _r, float _g, float _b); Color(float _r, float _g, float _b, float _a); void SetColor(int _r, int _g, int _b, int _a); void SetColor(float _r, float _g, float _b, float _a); void SetRed(int _r); void SetGreen(int _g); void SetBlue(int _b); void SetAlpha(int _a); void SetAlpha(float f); void SetHSL(float h, float s, float l); void GetHSL(float& h, float& s, float& l); int r() const { return red; }; int g() const { return green; }; int b() const { return blue; }; int a() const { return alpha; }; Color operator-(void) const; Color operator+(const Color& v) const; Color operator-(const Color& v) const; Color operator*(float s) const; Color operator/(float s) const; void operator+=(const Color &v); void operator-=(const Color &v); void operator*=(float s); void operator/=(float s); Color operator*(const Color& v) const; friend Color operator*( float f, const Color& v ) { return Color( v.red*f, v.green*f, v.blue*f, v.alpha*f ); } friend Color operator/( float f, const Color& v ) { return Color( f/v.red, f/v.green, f/v.blue, f/v.alpha ); } operator unsigned char*() { return(&red); } operator const unsigned char*() const { return(&red); } private: unsigned char red; unsigned char green; unsigned char blue; unsigned char alpha; };
/* * Copyright (c) 2014 Nicholas Robbins * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * remove judder in video stream * * Algorithm: * - If the old packets had PTS of old_pts[i]. Replace these with new * value based on the running average of the last n=cycle frames. So * * new_pts[i] = Sum(k=i-n+1, i, old_pts[k])/n * + (old_pts[i]-old_pts[i-n])*(n-1)/2n * * For any repeating pattern of length n of judder this will produce * an even progression of PTS's. * * - In order to avoid calculating this sum ever frame, a running tally * is maintained in ctx->new_pts. Each frame the new term at the start * of the sum is added, the one and the end is removed, and the offset * terms (second line in formula above) are recalculated. * * - To aid in this a ringbuffer of the last n-2 PTS's is maintained in * ctx->ringbuff. With the indices of the first two and last two entries * stored in i1, i2, i3, & i4. * * - To ensure that the new PTS's are integers, time_base is divided * by 2n. This removes the division in the new_pts calculation. * * - frame_rate is also multiplied by 2n to allow the frames to fall * where they may in what may now be a VFR output. This produces more * even output then setting frame_rate=1/0 in practice. */ #include "libavutil/opt.h" #include "libavutil/mathematics.h" #include "avfilter.h" #include "internal.h" #include "video.h" typedef struct DejudderContext { const AVClass *class; int64_t *ringbuff; int i1, i2, i3, i4; int64_t new_pts; int start_count; /* options */ int cycle; } DejudderContext; #define OFFSET(x) offsetof(DejudderContext, x) #define FLAGS AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM static const AVOption dejudder_options[] = { {"cycle", "set the length of the cycle to use for dejuddering", OFFSET(cycle), AV_OPT_TYPE_INT, {.i64 = 4}, 2, 240, .flags = FLAGS}, {NULL} }; AVFILTER_DEFINE_CLASS(dejudder); static int config_out_props(AVFilterLink *outlink) { AVFilterContext *ctx = outlink->src; DejudderContext *s = ctx->priv; AVFilterLink *inlink = outlink->src->inputs[0]; outlink->time_base = av_mul_q(inlink->time_base, av_make_q(1, 2 * s->cycle)); outlink->frame_rate = av_mul_q(inlink->frame_rate, av_make_q(2 * s->cycle, 1)); av_log(ctx, AV_LOG_VERBOSE, "cycle:%d\n", s->cycle); return 0; } static av_cold int dejudder_init(AVFilterContext *ctx) { DejudderContext *s = ctx->priv; s->ringbuff = av_mallocz_array(s->cycle+2, sizeof(*s->ringbuff)); if (!s->ringbuff) return AVERROR(ENOMEM); s->new_pts = 0; s->i1 = 0; s->i2 = 1; s->i3 = 2; s->i4 = 3; s->start_count = s->cycle + 2; return 0; } static av_cold void dejudder_uninit(AVFilterContext *ctx) { DejudderContext *s = ctx->priv; av_freep(&(s->ringbuff)); } static int filter_frame(AVFilterLink *inlink, AVFrame *frame) { int k; AVFilterContext *ctx = inlink->dst; AVFilterLink *outlink = ctx->outputs[0]; DejudderContext *s = ctx->priv; int64_t *judbuff = s->ringbuff; int64_t next_pts = frame->pts; int64_t offset; if (next_pts == AV_NOPTS_VALUE) return ff_filter_frame(outlink, frame); if (s->start_count) { s->start_count--; s->new_pts = next_pts * 2 * s->cycle; } else { if (next_pts < judbuff[s->i2]) { offset = next_pts + judbuff[s->i3] - judbuff[s->i4] - judbuff[s->i1]; for (k = 0; k < s->cycle + 2; k++) judbuff[k] += offset; } s->new_pts += (s->cycle - 1) * (judbuff[s->i3] - judbuff[s->i1]) + (s->cycle + 1) * (next_pts - judbuff[s->i4]); } judbuff[s->i2] = next_pts; s->i1 = s->i2; s->i2 = s->i3; s->i3 = s->i4; s->i4 = (s->i4 + 1) % (s->cycle + 2); frame->pts = s->new_pts; for (k = 0; k < s->cycle + 2; k++) av_log(ctx, AV_LOG_DEBUG, "%"PRId64"\t", judbuff[k]); av_log(ctx, AV_LOG_DEBUG, "next=%"PRId64", new=%"PRId64"\n", next_pts, frame->pts); return ff_filter_frame(outlink, frame); } static const AVFilterPad dejudder_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, }, { NULL } }; static const AVFilterPad dejudder_outputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, .config_props = config_out_props, }, { NULL } }; AVFilter ff_vf_dejudder = { .name = "dejudder", .description = NULL_IF_CONFIG_SMALL("Remove judder produced by pullup."), .priv_size = sizeof(DejudderContext), .priv_class = &dejudder_class, .inputs = dejudder_inputs, .outputs = dejudder_outputs, .init = dejudder_init, .uninit = dejudder_uninit, };
// Copyright 2022 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CONTENT_BROWSER_AGGREGATION_SERVICE_AGGREGATION_SERVICE_FEATURES_H_ #define CONTENT_BROWSER_AGGREGATION_SERVICE_AGGREGATION_SERVICE_FEATURES_H_ #include "base/feature_list.h" #include "base/metrics/field_trial_params.h" namespace content { // Enables the Aggregation Service. See crbug.com/1207974. extern const base::Feature kPrivacySandboxAggregationService; extern const base::FeatureParam<std::string> kPrivacySandboxAggregationServiceTrustedServerUrlParam; } // namespace content #endif // CONTENT_BROWSER_AGGREGATION_SERVICE_AGGREGATION_SERVICE_FEATURES_H_
#ifndef PTR_STACK_H_62B23520_7C8E_11DE_8A39_0800200C9A66 #define PTR_STACK_H_62B23520_7C8E_11DE_8A39_0800200C9A66 #if defined(_MSC_VER) || \ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4 #pragma once #endif #include <cstddef> #include <cstdlib> #include <memory> #include <vector> #include "yaml-cpp/noncopyable.h" // TODO: This class is no longer needed template <typename T> class ptr_stack : private YAML::noncopyable { public: ptr_stack() {} void clear() { m_data.clear(); } std::size_t size() const { return m_data.size(); } bool empty() const { return m_data.empty(); } void push(std::unique_ptr<T>&& t) { m_data.push_back(std::move(t)); } std::unique_ptr<T> pop() { std::unique_ptr<T> t(std::move(m_data.back())); m_data.pop_back(); return t; } T& top() { return *(m_data.back().get()); } const T& top() const { return *(m_data.back().get()); } T& top(std::ptrdiff_t diff) { return *((m_data.end() - 1 + diff)->get()); } const T& top(std::ptrdiff_t diff) const { return *((m_data.end() - 1 + diff)->get()); } private: std::vector<std::unique_ptr<T>> m_data; }; #endif // PTR_STACK_H_62B23520_7C8E_11DE_8A39_0800200C9A66
/* * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #ifndef WEBRTC_VIDEO_ENGINE_VIE_CHANNEL_MANAGER_H_ #define WEBRTC_VIDEO_ENGINE_VIE_CHANNEL_MANAGER_H_ #include <list> #include <map> #include "webrtc/engine_configurations.h" #include "webrtc/system_wrappers/interface/scoped_ptr.h" #include "webrtc/typedefs.h" #include "webrtc/video_engine/include/vie_rtp_rtcp.h" #include "webrtc/video_engine/vie_channel_group.h" #include "webrtc/video_engine/vie_defines.h" #include "webrtc/video_engine/vie_manager_base.h" #include "webrtc/video_engine/vie_remb.h" namespace webrtc { class Config; class CriticalSectionWrapper; class MapWrapper; class ProcessThread; class RtcpRttObserver; class ViEChannel; class ViEEncoder; class VoEVideoSync; class VoiceEngine; typedef std::list<ChannelGroup*> ChannelGroups; typedef std::list<ViEChannel*> ChannelList; typedef std::map<int, ViEChannel*> ChannelMap; typedef std::map<int, ViEEncoder*> EncoderMap; class ViEChannelManager: private ViEManagerBase { friend class ViEChannelManagerScoped; public: ViEChannelManager(int engine_id, int number_of_cores, const Config& config); ~ViEChannelManager(); void SetModuleProcessThread(ProcessThread* module_process_thread); // Creates a new channel. 'channel_id' will be the id of the created channel. int CreateChannel(int* channel_id); // Creates a new channel grouped with |original_channel|. The new channel // will get its own |ViEEncoder| if |sender| is set to true. It will be a // receive only channel, without an own |ViEEncoder| if |sender| is false. int CreateChannel(int* channel_id, int original_channel, bool sender); // Deletes a channel. int DeleteChannel(int channel_id); // Set the voice engine instance to be used by all video channels. int SetVoiceEngine(VoiceEngine* voice_engine); // Enables lip sync of the channel. int ConnectVoiceChannel(int channel_id, int audio_channel_id); // Disables lip sync of the channel. int DisconnectVoiceChannel(int channel_id); VoiceEngine* GetVoiceEngine(); // Adds a channel to include when sending REMB. bool SetRembStatus(int channel_id, bool sender, bool receiver); // Switches a channel and its associated group to use (or not) the absolute // send time header extension with |id|. bool SetReceiveAbsoluteSendTimeStatus(int channel_id, bool enable, int id); // Updates the SSRCs for a channel. If one of the SSRCs already is registered, // it will simply be ignored and no error is returned. void UpdateSsrcs(int channel_id, const std::list<unsigned int>& ssrcs); private: // Creates a channel object connected to |vie_encoder|. Assumed to be called // protected. bool CreateChannelObject(int channel_id, ViEEncoder* vie_encoder, RtcpBandwidthObserver* bandwidth_observer, RemoteBitrateEstimator* remote_bitrate_estimator, RtcpRttObserver* rtcp_rtt_observer, RtcpIntraFrameObserver* intra_frame_observer, bool sender); // Used by ViEChannelScoped, forcing a manager user to use scoped. // Returns a pointer to the channel with id 'channel_id'. ViEChannel* ViEChannelPtr(int channel_id) const; // Methods used by ViECaptureScoped and ViEEncoderScoped. // Gets the ViEEncoder used as input for video_channel_id ViEEncoder* ViEEncoderPtr(int video_channel_id) const; // Returns a free channel id, -1 if failing. int FreeChannelId(); // Returns a previously allocated channel id. void ReturnChannelId(int channel_id); // Returns the iterator to the ChannelGroup containing |channel_id|. ChannelGroup* FindGroup(int channel_id); // Returns true if at least one other channels uses the same ViEEncoder as // channel_id. bool ChannelUsingViEEncoder(int channel_id) const; void ChannelsUsingViEEncoder(int channel_id, ChannelList* channels) const; // Protects channel_map_ and free_channel_ids_. CriticalSectionWrapper* channel_id_critsect_; int engine_id_; int number_of_cores_; // TODO(mflodman) Make part of channel group. ChannelMap channel_map_; bool* free_channel_ids_; int free_channel_ids_size_; // List with all channel groups. std::list<ChannelGroup*> channel_groups_; // TODO(mflodman) Make part of channel group. // Maps Channel id -> ViEEncoder. EncoderMap vie_encoder_map_; VoEVideoSync* voice_sync_interface_; VoiceEngine* voice_engine_; ProcessThread* module_process_thread_; const Config& config_; }; class ViEChannelManagerScoped: private ViEManagerScopedBase { public: explicit ViEChannelManagerScoped( const ViEChannelManager& vie_channel_manager); ViEChannel* Channel(int vie_channel_id) const; ViEEncoder* Encoder(int vie_channel_id) const; // Returns true if at least one other channels uses the same ViEEncoder as // channel_id. bool ChannelUsingViEEncoder(int channel_id) const; // Returns a list with pointers to all channels using the same encoder as the // channel with |channel_id|, including the one with the specified id. void ChannelsUsingViEEncoder(int channel_id, ChannelList* channels) const; }; } // namespace webrtc #endif // WEBRTC_VIDEO_ENGINE_VIE_CHANNEL_MANAGER_H_
/* * This file is part of the MicroPython project, http://micropython.org/ * * The MIT License (MIT) * * Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2015 Daniel Campora * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include "py/builtin.h" const char *cc3200_help_text = "Welcome to MicroPython!\n" "For online help please visit http://micropython.org/help/.\n" "For further help on a specific object, type help(obj)\n";
// This file was generated based on 'C:\ProgramData\Uno\Packages\UnoCore\0.20.1\Source\Uno\$.uno'. // WARNING: Changes might be lost if you edit this file directly. #pragma once #include <Uno.Delegate.h> namespace g{ namespace Uno{ // public delegate void Action() :8 uDelegateType* Action_typeof(); }} // ::g::Uno
/***************************************************************************** * src.c : Secret Rabbit Code (a.k.a. libsamplerate) resampler ***************************************************************************** * Copyright (C) 2011-2012 Rémi Denis-Courmont * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ /***************************************************************************** * NOTA BENE: this module requires the linking against a library which is * known to require licensing under the GNU General Public License version 2 * (or later). Therefore, the result of compiling this module will normally * be subject to the terms of that later license. *****************************************************************************/ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include <vlc_common.h> #include <vlc_plugin.h> #include <vlc_aout.h> #include <vlc_filter.h> #include <samplerate.h> #include <math.h> #define SRC_CONV_TYPE_TEXT N_("Sample rate converter type") #define SRC_CONV_TYPE_LONGTEXT N_( \ "Different resampling algorithms are supported. " \ "The best one is slower, while the fast one exhibits low quality.") static const int conv_type_values[] = { SRC_SINC_BEST_QUALITY, SRC_SINC_MEDIUM_QUALITY, SRC_SINC_FASTEST, SRC_ZERO_ORDER_HOLD, SRC_LINEAR, }; static const char *const conv_type_texts[] = { N_("Sinc function (best quality)"), N_("Sinc function (medium quality)"), N_("Sinc function (fast)"), N_("Zero Order Hold (fastest)"), N_("Linear (fastest)"), }; static int Open (vlc_object_t *); static int OpenResampler (vlc_object_t *); static void Close (vlc_object_t *); vlc_module_begin () set_shortname (N_("SRC resampler")) set_description (N_("Secret Rabbit Code (libsamplerate) resampler") ) set_category (CAT_AUDIO) set_subcategory (SUBCAT_AUDIO_RESAMPLER) add_integer ("src-converter-type", SRC_SINC_FASTEST, SRC_CONV_TYPE_TEXT, SRC_CONV_TYPE_LONGTEXT, true) change_integer_list (conv_type_values, conv_type_texts) set_capability ("audio converter", 50) set_callbacks (Open, Close) add_submodule () set_capability ("audio resampler", 50) set_callbacks (OpenResampler, Close) vlc_module_end () static block_t *Resample (filter_t *, block_t *); static int Open (vlc_object_t *obj) { filter_t *filter = (filter_t *)obj; /* Will change rate */ if (filter->fmt_in.audio.i_rate == filter->fmt_out.audio.i_rate) return VLC_EGENERIC; return OpenResampler (obj); } static int OpenResampler (vlc_object_t *obj) { filter_t *filter = (filter_t *)obj; /* Only float->float */ if (filter->fmt_in.audio.i_format != VLC_CODEC_FL32 || filter->fmt_out.audio.i_format != VLC_CODEC_FL32 /* No channels remapping */ || filter->fmt_in.audio.i_channels != filter->fmt_out.audio.i_channels ) return VLC_EGENERIC; int type = var_InheritInteger (obj, "src-converter-type"); int err; SRC_STATE *s = src_new (type, filter->fmt_in.audio.i_channels, &err); if (s == NULL) { msg_Err (obj, "cannot initialize resampler: %s", src_strerror (err)); return VLC_EGENERIC; } filter->p_sys = (filter_sys_t *)s; filter->pf_audio_filter = Resample; return VLC_SUCCESS; } static void Close (vlc_object_t *obj) { filter_t *filter = (filter_t *)obj; SRC_STATE *s = (SRC_STATE *)filter->p_sys; src_delete (s); } static block_t *Resample (filter_t *filter, block_t *in) { block_t *out = NULL; const size_t framesize = filter->fmt_out.audio.i_bytes_per_frame; SRC_STATE *s = (SRC_STATE *)filter->p_sys; SRC_DATA src; src.src_ratio = (double)filter->fmt_out.audio.i_rate / (double)filter->fmt_in.audio.i_rate; int err = src_set_ratio (s, src.src_ratio); if (err != 0) { msg_Err (filter, "cannot update resampling ratio: %s", src_strerror (err)); goto error; } src.input_frames = in->i_nb_samples; src.output_frames = ceil (src.src_ratio * src.input_frames); src.end_of_input = 0; out = block_Alloc (src.output_frames * framesize); if (unlikely(out == NULL)) goto error; src.data_in = (float *)in->p_buffer; src.data_out = (float *)out->p_buffer; err = src_process (s, &src); if (err != 0) { msg_Err (filter, "cannot resample: %s", src_strerror (err)); block_Release (out); out = NULL; goto error; } if (src.input_frames_used < src.input_frames) msg_Err (filter, "lost %ld of %ld input frames", src.input_frames - src.input_frames_used, src.input_frames); out->i_buffer = src.output_frames_gen * framesize; out->i_nb_samples = src.output_frames_gen; out->i_pts = in->i_pts; out->i_length = src.output_frames_gen * CLOCK_FREQ / filter->fmt_out.audio.i_rate; error: block_Release (in); return out; }
/* ************************************************************************** qgslinearminmaxenhancement.h - description ------------------- begin : Fri Nov 16 2007 copyright : (C) 2007 by Peter J. Ersts email : ersts@amnh.org ****************************************************************************/ /* ************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef QGSLINEARMINMAXENHANCEMENT_H #define QGSLINEARMINMAXENHANCEMENT_H #include "qgscontrastenhancementfunction.h" /** \ingroup core * A color enhancement function that performs a linear enhanceContrast between min and max. */ class CORE_EXPORT QgsLinearMinMaxEnhancement : public QgsContrastEnhancementFunction { public: QgsLinearMinMaxEnhancement( Qgis::DataType, double, double ); int enhance( double ) override; }; #endif
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ** ** Copyright (C), 2003, ** Steve Quenette, 110 Victoria Street, Melbourne, Victoria, 3053, Australia. ** Californian Institute of Technology, 1200 East California Boulevard, Pasadena, California, 91125, USA. ** University of Texas, 1 University Station, Austin, Texas, 78712, USA. ** ** Authors: ** Stevan M. Quenette, Senior Software Engineer, VPAC. (steve@vpac.org) ** Stevan M. Quenette, Visitor in Geophysics, Caltech. ** Luc Lavier, Research Scientist, The University of Texas. (luc@utig.ug.utexas.edu) ** Luc Lavier, Research Scientist, Caltech. ** ** 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 ** */ /** \file ** Role: ** ** Assumptions: ** None as yet. ** ** Comments: ** None as yet. ** ** $Id: types.h 1084 2004-03-26 11:17:10Z PatrickSunter $ ** **~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ #ifndef __SnacTemperature_types_h__ #define __SnacTemperature_types_h__ /* Plastic */ typedef struct _SnacTemperature_Context SnacTemperature_Context; typedef struct _SnacTemperature_Element SnacTemperature_Element; typedef struct _SnacTemperature_Node SnacTemperature_Node; #endif /* __SnacTemperature_types_h__ */
#ifndef _IP_CONNTRACK_TUPLE_H #define _IP_CONNTRACK_TUPLE_H /* A `tuple' is a structure containing the information to uniquely identify a connection. ie. if two packets have the same tuple, they are in the same connection; if not, they are not. We divide the structure along "manipulatable" and "non-manipulatable" lines, for the benefit of the NAT code. */ /* The protocol-specific manipulable parts of the tuple: always in network order! */ union ip_conntrack_manip_proto { /* Add other protocols here. */ u_int16_t all; struct { u_int16_t port; } tcp; struct { u_int16_t port; } udp; struct { u_int16_t id; } icmp; struct { u_int16_t key; /* GRE key is 32bit, PPtP only uses 16bit */ } gre; }; /* The manipulable part of the tuple. */ struct ip_conntrack_manip { u_int32_t ip; union ip_conntrack_manip_proto u; }; /* This contains the information to distinguish a connection. */ struct ip_conntrack_tuple { struct ip_conntrack_manip src; /* These are the parts of the tuple which are fixed. */ struct { u_int32_t ip; union { /* Add other protocols here. */ u_int16_t all; struct { u_int16_t port; } tcp; struct { u_int16_t port; } udp; struct { u_int8_t type, code; } icmp; struct { u_int16_t key; } gre; } u; /* The protocol. */ u_int16_t protonum; } dst; }; /* This is optimized opposed to a memset of the whole structure. Everything we * really care about is the source/destination unions */ #define IP_CT_TUPLE_U_BLANK(tuple) \ do { \ (tuple)->src.u.all = 0; \ (tuple)->dst.u.all = 0; \ } while (0) enum ip_conntrack_dir { IP_CT_DIR_ORIGINAL, IP_CT_DIR_REPLY, IP_CT_DIR_MAX }; #ifdef __KERNEL__ #define DUMP_TUPLE(tp) \ DEBUGP("tuple %p: %u %u.%u.%u.%u:%hu -> %u.%u.%u.%u:%hu\n", \ (tp), (tp)->dst.protonum, \ NIPQUAD((tp)->src.ip), ntohs((tp)->src.u.all), \ NIPQUAD((tp)->dst.ip), ntohs((tp)->dst.u.all)) #define CTINFO2DIR(ctinfo) ((ctinfo) >= IP_CT_IS_REPLY ? IP_CT_DIR_REPLY : IP_CT_DIR_ORIGINAL) /* If we're the first tuple, it's the original dir. */ #define DIRECTION(h) ((enum ip_conntrack_dir)(&(h)->ctrack->tuplehash[1] == (h))) /* Connections have two entries in the hash table: one for each way */ struct ip_conntrack_tuple_hash { struct list_head list; struct ip_conntrack_tuple tuple; /* this == &ctrack->tuplehash[DIRECTION(this)]. */ struct ip_conntrack *ctrack; }; #endif /* __KERNEL__ */ static inline int ip_ct_tuple_src_equal(const struct ip_conntrack_tuple *t1, const struct ip_conntrack_tuple *t2) { return t1->src.ip == t2->src.ip && t1->src.u.all == t2->src.u.all; } static inline int ip_ct_tuple_dst_equal(const struct ip_conntrack_tuple *t1, const struct ip_conntrack_tuple *t2) { return t1->dst.ip == t2->dst.ip && t1->dst.u.all == t2->dst.u.all && t1->dst.protonum == t2->dst.protonum; } static inline int ip_ct_tuple_equal(const struct ip_conntrack_tuple *t1, const struct ip_conntrack_tuple *t2) { return ip_ct_tuple_src_equal(t1, t2) && ip_ct_tuple_dst_equal(t1, t2); } static inline int ip_ct_tuple_mask_cmp(const struct ip_conntrack_tuple *t, const struct ip_conntrack_tuple *tuple, const struct ip_conntrack_tuple *mask) { return !(((t->src.ip ^ tuple->src.ip) & mask->src.ip) || ((t->dst.ip ^ tuple->dst.ip) & mask->dst.ip) || ((t->src.u.all ^ tuple->src.u.all) & mask->src.u.all) || ((t->dst.u.all ^ tuple->dst.u.all) & mask->dst.u.all) || ((t->dst.protonum ^ tuple->dst.protonum) & mask->dst.protonum)); } #endif /* _IP_CONNTRACK_TUPLE_H */
/* dsa-verify.c * * The DSA publickey algorithm. */ /* nettle, low-level cryptographics library * * Copyright (C) 2002, 2003 Niels Möller * * The nettle library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or (at your * option) any later version. * * The nettle 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 nettle library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02111-1301, USA. */ #if HAVE_CONFIG_H # include "config.h" #endif #include <stdlib.h> #include "dsa.h" #include "bignum.h" int _dsa_verify(const struct dsa_public_key *key, unsigned digest_size, const uint8_t *digest, const struct dsa_signature *signature) { mpz_t w; mpz_t tmp; mpz_t v; int res; if (mpz_sizeinbase(key->q, 2) != 8 * digest_size) return 0; /* Check that r and s are in the proper range */ if (mpz_sgn(signature->r) <= 0 || mpz_cmp(signature->r, key->q) >= 0) return 0; if (mpz_sgn(signature->s) <= 0 || mpz_cmp(signature->s, key->q) >= 0) return 0; mpz_init(w); /* Compute w = s^-1 (mod q) */ /* NOTE: In gmp-2, mpz_invert sometimes generates negative inverses, * so we need gmp-3 or better. */ if (!mpz_invert(w, signature->s, key->q)) { mpz_clear(w); return 0; } mpz_init(tmp); mpz_init(v); /* The message digest */ nettle_mpz_set_str_256_u(tmp, digest_size, digest); /* v = g^{w * h (mod q)} (mod p) */ mpz_mul(tmp, tmp, w); mpz_fdiv_r(tmp, tmp, key->q); mpz_powm(v, key->g, tmp, key->p); /* y^{w * r (mod q) } (mod p) */ mpz_mul(tmp, signature->r, w); mpz_fdiv_r(tmp, tmp, key->q); mpz_powm(tmp, key->y, tmp, key->p); /* v = (g^{w * h} * y^{w * r} (mod p) ) (mod q) */ mpz_mul(v, v, tmp); mpz_fdiv_r(v, v, key->p); mpz_fdiv_r(v, v, key->q); res = !mpz_cmp(v, signature->r); mpz_clear(w); mpz_clear(tmp); mpz_clear(v); return res; }
/* * linux/drivers/mmc/core/core.h * * Copyright (C) 2003 Russell King, All Rights Reserved. * Copyright 2007 Pierre Ossman * * 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. */ #ifndef _MMC_CORE_CORE_H #define _MMC_CORE_CORE_H #include <linux/delay.h> #define MMC_CMD_RETRIES 3 #define MMC_WAKELOCK_TIMEOUT 1 #define MMC_DETECT_RETRIES 5 struct mmc_bus_ops { int (*awake)(struct mmc_host *); int (*sleep)(struct mmc_host *); void (*remove)(struct mmc_host *); void (*detect)(struct mmc_host *); int (*suspend)(struct mmc_host *); int (*resume)(struct mmc_host *); int (*power_save)(struct mmc_host *); int (*power_restore)(struct mmc_host *); int (*alive)(struct mmc_host *); int (*change_bus_speed)(struct mmc_host *, unsigned long *); int (*reinit)(struct mmc_host *); int (*shutdown)(struct mmc_host *); }; void mmc_attach_bus(struct mmc_host *host, const struct mmc_bus_ops *ops); void mmc_detach_bus(struct mmc_host *host); void mmc_init_erase(struct mmc_card *card); void mmc_power_up(struct mmc_host *host); void mmc_power_off(struct mmc_host *host); void mmc_set_chip_select(struct mmc_host *host, int mode); void mmc_set_clock(struct mmc_host *host, unsigned int hz); void mmc_gate_clock(struct mmc_host *host); void mmc_ungate_clock(struct mmc_host *host); void mmc_set_ungated(struct mmc_host *host); void mmc_set_bus_mode(struct mmc_host *host, unsigned int mode); void mmc_set_bus_width(struct mmc_host *host, unsigned int width); u32 mmc_select_voltage(struct mmc_host *host, u32 ocr); int mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage); int __mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage); void mmc_set_timing(struct mmc_host *host, unsigned int timing); void mmc_set_driver_type(struct mmc_host *host, unsigned int drv_type); void mmc_power_off(struct mmc_host *host); void mmc_power_cycle(struct mmc_host *host); static inline void mmc_delay(unsigned int ms) { if (ms < 1000 / HZ) { cond_resched(); mdelay(ms); } else if (ms < jiffies_to_msecs(2)) { usleep_range(ms * 1000, (ms + 1) * 1000); } else { msleep(ms); } } void mmc_rescan(struct work_struct *work); void mmc_enable_detection(struct work_struct *work); void mmc_stats(struct work_struct *work); void mmc_start_host(struct mmc_host *host); void mmc_stop_host(struct mmc_host *host); int _mmc_detect_card_removed(struct mmc_host *host); int mmc_attach_mmc(struct mmc_host *host); int mmc_attach_sd(struct mmc_host *host); int mmc_attach_sdio(struct mmc_host *host); extern bool use_spi_crc; void mmc_add_host_debugfs(struct mmc_host *host); void mmc_remove_host_debugfs(struct mmc_host *host); void mmc_add_card_debugfs(struct mmc_card *card); void mmc_remove_card_debugfs(struct mmc_card *card); void mmc_init_context_info(struct mmc_host *host); extern void mmc_disable_clk_scaling(struct mmc_host *host); extern bool mmc_can_scale_clk(struct mmc_host *host); extern void mmc_init_clk_scaling(struct mmc_host *host); extern void mmc_exit_clk_scaling(struct mmc_host *host); extern void mmc_reset_clk_scale_stats(struct mmc_host *host); extern unsigned long mmc_get_max_frequency(struct mmc_host *host); #endif
/***************************************************************************/ /* * linux/arch/m68knommu/platform/5249/config.c * * Copyright (C) 2002, Greg Ungerer (gerg@snapgear.com) */ /***************************************************************************/ #include <linux/kernel.h> #include <linux/sched.h> #include <linux/param.h> #include <linux/init.h> #include <linux/interrupt.h> #include <asm/irq.h> #include <asm/dma.h> #include <asm/traps.h> #include <asm/machdep.h> #include <asm/coldfire.h> #include <asm/mcftimer.h> #include <asm/mcfsim.h> #include <asm/mcfdma.h> /***************************************************************************/ void coldfire_tick(void); void coldfire_timer_init(irq_handler_t handler); unsigned long coldfire_timer_offset(void); void coldfire_reset(void); /***************************************************************************/ /* * DMA channel base address table. */ unsigned int dma_base_addr[MAX_M68K_DMA_CHANNELS] = { MCF_MBAR + MCFDMA_BASE0, MCF_MBAR + MCFDMA_BASE1, MCF_MBAR + MCFDMA_BASE2, MCF_MBAR + MCFDMA_BASE3, }; unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS]; /***************************************************************************/ void mcf_autovector(unsigned int vec) { volatile unsigned char *mbar; if ((vec >= 25) && (vec <= 31)) { mbar = (volatile unsigned char *) MCF_MBAR; vec = 0x1 << (vec - 24); *(mbar + MCFSIM_AVR) |= vec; mcf_setimr(mcf_getimr() & ~vec); } } /***************************************************************************/ void mcf_settimericr(unsigned int timer, unsigned int level) { volatile unsigned char *icrp; unsigned int icr, imr; if (timer <= 2) { switch (timer) { case 2: icr = MCFSIM_TIMER2ICR; imr = MCFSIM_IMR_TIMER2; break; default: icr = MCFSIM_TIMER1ICR; imr = MCFSIM_IMR_TIMER1; break; } icrp = (volatile unsigned char *) (MCF_MBAR + icr); *icrp = MCFSIM_ICR_AUTOVEC | (level << 2) | MCFSIM_ICR_PRI3; mcf_setimr(mcf_getimr() & ~imr); } } /***************************************************************************/ int mcf_timerirqpending(int timer) { unsigned int imr = 0; switch (timer) { case 1: imr = MCFSIM_IMR_TIMER1; break; case 2: imr = MCFSIM_IMR_TIMER2; break; default: break; } return (mcf_getipr() & imr); } /***************************************************************************/ void config_BSP(char *commandp, int size) { mcf_setimr(MCFSIM_IMR_MASKALL); mach_sched_init = coldfire_timer_init; mach_tick = coldfire_tick; mach_gettimeoffset = coldfire_timer_offset; mach_reset = coldfire_reset; } /***************************************************************************/
/* Copyright (c) 2000-2003, 2007 MySQL AB Use is subject to license terms 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 Street, Fifth Floor, Boston, MA 02110-1301, USA */ #include <my_global.h> #include <mysql_com.h> #include <mysql.h> /* Get the length of next field. Change parameter to point at fieldstart */ ulong STDCALL net_field_length(uchar **packet) { reg1 uchar *pos= (uchar *)*packet; if (*pos < 251) { (*packet)++; return (ulong) *pos; } if (*pos == 251) { (*packet)++; return NULL_LENGTH; } if (*pos == 252) { (*packet)+=3; return (ulong) uint2korr(pos+1); } if (*pos == 253) { (*packet)+=4; return (ulong) uint3korr(pos+1); } (*packet)+=9; /* Must be 254 when here */ return (ulong) uint4korr(pos+1); } /* The same as above but returns longlong */ my_ulonglong net_field_length_ll(uchar **packet) { reg1 uchar *pos= *packet; if (*pos < 251) { (*packet)++; return (my_ulonglong) *pos; } if (*pos == 251) { (*packet)++; return (my_ulonglong) NULL_LENGTH; } if (*pos == 252) { (*packet)+=3; return (my_ulonglong) uint2korr(pos+1); } if (*pos == 253) { (*packet)+=4; return (my_ulonglong) uint3korr(pos+1); } (*packet)+=9; /* Must be 254 when here */ #ifdef NO_CLIENT_LONGLONG return (my_ulonglong) uint4korr(pos+1); #else return (my_ulonglong) uint8korr(pos+1); #endif } /* Store an integer with simple packing into a output package SYNOPSIS net_store_length() pkg Store the packed integer here length integers to store NOTES This is mostly used to store lengths of strings. We have to cast the result for the LL() becasue of a bug in Forte CC compiler. RETURN Position in 'pkg' after the packed length */ uchar *net_store_length(uchar *packet, ulonglong length) { if (length < (ulonglong) LL(251)) { *packet=(uchar) length; return packet+1; } /* 251 is reserved for NULL */ if (length < (ulonglong) LL(65536)) { *packet++=252; int2store(packet,(uint) length); return packet+2; } if (length < (ulonglong) LL(16777216)) { *packet++=253; int3store(packet,(ulong) length); return packet+3; } *packet++=254; int8store(packet,length); return packet+8; } /** The length of space required to store the resulting length-encoded integer for the given number. This function can be used at places where one needs to dynamically allocate the buffer for a given number to be stored as length- encoded integer. @param num [IN] the input number @return length of buffer needed to store this number [1, 3, 4, 9]. */ uint net_length_size(ulonglong num) { if (num < (ulonglong) LL(252)) return 1; if (num < (ulonglong) LL(65536)) return 3; if (num < (ulonglong) LL(16777216)) return 4; return 9; }
/* * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved. * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef ResourceRequest_h #define ResourceRequest_h #include "ResourceRequestBase.h" typedef const struct _CFURLRequest* CFURLRequestRef; namespace WebCore { class ResourceRequest : public ResourceRequestBase { public: ResourceRequest(const String& url) : ResourceRequestBase(KURL(ParsedURLString, url), UseProtocolCachePolicy) { } ResourceRequest(const KURL& url) : ResourceRequestBase(url, UseProtocolCachePolicy) { } ResourceRequest(const KURL& url, const String& referrer, ResourceRequestCachePolicy policy = UseProtocolCachePolicy) : ResourceRequestBase(url, policy) { setHTTPReferrer(referrer); } ResourceRequest() : ResourceRequestBase(KURL(), UseProtocolCachePolicy) { } // Needed for compatibility. CFURLRequestRef cfURLRequest() const { return 0; } private: friend class ResourceRequestBase; void doUpdatePlatformRequest() {} void doUpdateResourceRequest() {} }; } // namespace WebCore #endif // ResourceRequest_h
/* Copyright (c) Ferruccio Barletta (ferruccio.barletta@gmail.com), 2010 This file is part of BDBVu. BDBVu 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. BDBVu 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 BDBVu. If not, see <http://www.gnu.org/licenses/>. */ #ifndef DATABASE_H #define DATABASE_H #include <db_cxx.h> #include <QList> #include <QStringList> #include <vector> // // create our own exception class so that we can use something more flexible than a char* for messages // class dbexception : public std::exception { public: dbexception(const QString& message) : std::exception() { this->message = message; } virtual ~dbexception() throw() {} const char* what() const throw() { return message.toAscii(); } private: QString message; }; // // maps displayed keys to searchable keys // class dbkey { public: QString display; // what is displayed to user std::vector<char> key; // actual db key }; // // encapsulate BDB database // class database { public: database(); virtual ~database(); QStringList sdblist; // sub-database list QList<dbkey> keylist; // key list QString sdbtype; // sub-database type bool isopen() { return db != 0; } void open(const char* filename); void close(); void opensubdb(const QString& dbname); QString getRecord(int index); private: QString filename; // db filename DbEnv env; // BDB environment Db *db; // current database Db *sdb; // current sub-database bool multiple; // does database contain sub-databases void buildDatabaseList(); void closesubdb(); void buildKeyList(); }; #endif // DATABASE_H
/* -*- c++ -*- */ /* * Copyright 2013 Free Software Foundation, Inc. * * This file is part of GNU Radio * * SPDX-License-Identifier: GPL-3.0-or-later * */ #ifndef INCLUDED_STREAM_PDU_BASE_H #define INCLUDED_STREAM_PDU_BASE_H #include <gnuradio/basic_block.h> #include <gnuradio/logger.h> #include <gnuradio/thread/thread.h> #include <pmt/pmt.h> class basic_block; namespace gr { namespace blocks { class stream_pdu_base { public: stream_pdu_base(int MTU = 10000); ~stream_pdu_base(); protected: int d_fd; bool d_started; bool d_finished; std::vector<uint8_t> d_rxbuf; gr::thread::thread d_thread; pmt::pmt_t d_port; basic_block* d_blk; void run(); void send(pmt::pmt_t msg); bool wait_ready(); void start_rxthread(basic_block* blk, pmt::pmt_t rxport); void stop_rxthread(); gr::logger_ptr d_pdu_logger, d_pdu_debug_logger; }; } /* namespace blocks */ } /* namespace gr */ #endif /* INCLUDED_STREAM_PDU_BASE_H */
/* * Copyright (C) 2015 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ #include <errno.h> #include <fcntl.h> #include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/stat.h> #include <unistd.h> #include "utils.h" #include "cleanup-funcs.h" void die(const char *msg, ...) { int saved_errno = errno; va_list va; va_start(va, msg); vfprintf(stderr, msg, va); va_end(va); if (errno != 0) { fprintf(stderr, ": %s\n", strerror(saved_errno)); } else { fprintf(stderr, "\n"); } exit(1); } bool error(const char *msg, ...) { va_list va; va_start(va, msg); vfprintf(stderr, msg, va); va_end(va); return false; } struct sc_bool_name { const char *text; bool value; }; static const struct sc_bool_name sc_bool_names[] = { {"yes", true}, {"no", false}, {"1", true}, {"0", false}, {"", false}, }; /** * Convert string to a boolean value. * * The return value is 0 in case of success or -1 when the string cannot be * converted correctly. In such case errno is set to indicate the problem and * the value is not written back to the caller-supplied pointer. **/ static int str2bool(const char *text, bool * value) { if (value == NULL) { errno = EFAULT; return -1; } if (text == NULL) { *value = false; return 0; } for (int i = 0; i < sizeof sc_bool_names / sizeof *sc_bool_names; ++i) { if (strcmp(text, sc_bool_names[i].text) == 0) { *value = sc_bool_names[i].value; return 0; } } errno = EINVAL; return -1; } /** * Get an environment variable and convert it to a boolean. * * Supported values are those of str2bool(), namely "yes", "no" as well as "1" * and "0". All other values are treated as false and a diagnostic message is * printed to stderr. **/ static bool getenv_bool(const char *name) { const char *str_value = getenv(name); bool value; if (str2bool(str_value, &value) < 0) { if (errno == EINVAL) { fprintf(stderr, "WARNING: unrecognized value of environment variable %s (expected yes/no or 1/0)\n", name); return false; } else { die("cannot convert value of environment variable %s to a boolean", name); } } return value; } bool sc_is_debug_enabled() { return getenv_bool("SNAP_CONFINE_DEBUG"); } void debug(const char *msg, ...) { if (sc_is_debug_enabled()) { va_list va; va_start(va, msg); fprintf(stderr, "DEBUG: "); vfprintf(stderr, msg, va); fprintf(stderr, "\n"); va_end(va); } } void write_string_to_file(const char *filepath, const char *buf) { debug("write_string_to_file %s %s", filepath, buf); FILE *f = fopen(filepath, "w"); if (f == NULL) die("fopen %s failed", filepath); if (fwrite(buf, strlen(buf), 1, f) != 1) die("fwrite failed"); if (fflush(f) != 0) die("fflush failed"); if (fclose(f) != 0) die("fclose failed"); } int sc_nonfatal_mkpath(const char *const path, mode_t mode) { // If asked to create an empty path, return immediately. if (strlen(path) == 0) { return 0; } // We're going to use strtok_r, which needs to modify the path, so we'll // make a copy of it. char *path_copy __attribute__ ((cleanup(sc_cleanup_string))) = NULL; path_copy = strdup(path); if (path_copy == NULL) { return -1; } // Open flags to use while we walk the user data path: // - Don't follow symlinks // - Don't allow child access to file descriptor // - Only open a directory (fail otherwise) const int open_flags = O_NOFOLLOW | O_CLOEXEC | O_DIRECTORY; // We're going to create each path segment via openat/mkdirat calls instead // of mkdir calls, to avoid following symlinks and placing the user data // directory somewhere we never intended for it to go. The first step is to // get an initial file descriptor. int fd __attribute__ ((cleanup(sc_cleanup_close))) = AT_FDCWD; if (path_copy[0] == '/') { fd = open("/", open_flags); if (fd < 0) { return -1; } } // strtok_r needs a pointer to keep track of where it is in the string. char *path_walker = NULL; // Initialize tokenizer and obtain first path segment. char *path_segment = strtok_r(path_copy, "/", &path_walker); while (path_segment) { // Try to create the directory. It's okay if it already existed, but // return with error on any other error. Reset errno before attempting // this as it may stay stale (errno is not reset if mkdirat(2) returns // successfully). errno = 0; if (mkdirat(fd, path_segment, mode) < 0 && errno != EEXIST) { return -1; } // Open the parent directory we just made (and close the previous one // (but not the special value AT_FDCWD) so we can continue down the // path. int previous_fd = fd; fd = openat(fd, path_segment, open_flags); if (previous_fd != AT_FDCWD && close(previous_fd) != 0) { return -1; } if (fd < 0) { return -1; } // Obtain the next path segment. path_segment = strtok_r(NULL, "/", &path_walker); } return 0; }
/* -*- c++ -*- */ /* * Copyright 2004 Free Software Foundation, Inc. * * This file is part of GNU Radio * * GNU Radio is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * GNU Radio is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_GR_LFSR_32K_SOURCE_S_H #define INCLUDED_GR_LFSR_32K_SOURCE_S_H #include <gr_core_api.h> #include <gr_sync_block.h> #include <gri_lfsr_32k.h> class gr_lfsr_32k_source_s; typedef boost::shared_ptr<gr_lfsr_32k_source_s> gr_lfsr_32k_source_s_sptr; GR_CORE_API gr_lfsr_32k_source_s_sptr gr_make_lfsr_32k_source_s (); /*! * \brief LFSR pseudo-random source with period of 2^15 bits (2^11 shorts) * \ingroup source_blk * * This source is typically used along with gr_check_lfsr_32k_s to test * the USRP using its digital loopback mode. */ class GR_CORE_API gr_lfsr_32k_source_s : public gr_sync_block { friend GR_CORE_API gr_lfsr_32k_source_s_sptr gr_make_lfsr_32k_source_s (); static const int BUFSIZE = 2048 - 1; // ensure pattern isn't packet aligned int d_index; short d_buffer[BUFSIZE]; gr_lfsr_32k_source_s (); public: virtual int work (int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); }; #endif
/******************************************************************************* OpenAirInterface Copyright(c) 1999 - 2014 Eurecom OpenAirInterface 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. OpenAirInterface 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 OpenAirInterface.The full GNU General Public License is included in this distribution in the file called "COPYING". If not, see <http://www.gnu.org/licenses/>. Contact Information OpenAirInterface Admin: openair_admin@eurecom.fr OpenAirInterface Tech : openair_tech@eurecom.fr OpenAirInterface Dev : openair4g-devel@eurecom.fr Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE *******************************************************************************/ #include <stdio.h> #include <stdlib.h> #include <assert.h> #include <string.h> #define G_LOG_DOMAIN ("PARSER") #include "typedef_type.h" #include "ui_interface.h" int typedef_dissect_from_buffer( types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line) { int length = 0; char cbuf[50 + (type->name ? strlen (type->name) : 0)]; types_t *type_child = NULL; DISPLAY_PARSE_INFO("typedef", type->name, offset, parent_offset); if (type->child != NULL) { /* Ignore TYPEDEF children */ for (type_child = type->child; type_child != NULL && type_child->type == TYPE_TYPEDEF; type_child = type_child->child) { } } if ((type_child == NULL) || (type_child->type != TYPE_FUNDAMENTAL)) { INDENTED_STRING(cbuf, new_line ? indent : 0, length = sprintf (cbuf, "%s, ", type->name)); ui_set_signal_text_cb(user_data, cbuf, length); new_line = FALSE; } /* Simply call next_type */ if (type->child != NULL) { type->child->parent = type; type->child->type_dissect_from_buffer( type->child, ui_set_signal_text_cb, user_data, buffer, offset, parent_offset, indent, new_line); } return 0; } int typedef_type_file_print(types_t *type, int indent, FILE *file) { if (type == NULL) return -1; INDENTED(file, indent, fprintf(file, "<Typedef>\n")); INDENTED(file, indent+4, fprintf(file, "Name .......: %s\n", type->name)); INDENTED(file, indent+4, fprintf(file, "Type .......: %d\n", type->type_xml)); INDENTED(file, indent+4, fprintf(file, "Size .......: %d\n", type->size)); INDENTED(file, indent+4, fprintf(file, "Align ......: %d\n", type->align)); INDENTED(file, indent+4, fprintf(file, "Artificial .: %d\n", type->artificial)); INDENTED(file, indent+4, fprintf(file, "File .......: %s\n", type->file)); INDENTED(file, indent+4, fprintf(file, "Line .......: %d\n", type->line)); INDENTED(file, indent+4, fprintf(file, "Members ....: %s\n", type->members)); INDENTED(file, indent+4, fprintf(file, "Mangled ....: %s\n", type->mangled)); INDENTED(file, indent+4, fprintf(file, "Demangled ..: %s\n", type->demangled)); if (type->file_ref != NULL) type->file_ref->type_file_print(type->file_ref, indent+4, file); if (type->child != NULL) type->child->type_file_print(type->child, indent+4, file); INDENTED(file, indent, fprintf(file, "</Typedef>\n")); return 0; } int typedef_type_hr_display(types_t *type, int indent) { if (type == NULL) return -1; INDENTED(stdout, indent, printf("<Typedef>\n")); INDENTED(stdout, indent+4, printf("Name .......: %s\n", type->name)); INDENTED(stdout, indent+4, printf("Type .......: %d\n", type->type_xml)); INDENTED(stdout, indent+4, printf("Size .......: %d\n", type->size)); INDENTED(stdout, indent+4, printf("Align ......: %d\n", type->align)); INDENTED(stdout, indent+4, printf("Artificial .: %d\n", type->artificial)); INDENTED(stdout, indent+4, printf("File .......: %s\n", type->file)); INDENTED(stdout, indent+4, printf("Line .......: %d\n", type->line)); INDENTED(stdout, indent+4, printf("Members ....: %s\n", type->members)); INDENTED(stdout, indent+4, printf("Mangled ....: %s\n", type->mangled)); INDENTED(stdout, indent+4, printf("Demangled ..: %s\n", type->demangled)); if (type->file_ref != NULL) type->file_ref->type_hr_display(type->file_ref, indent+4); if (type->child != NULL) type->child->type_hr_display(type->child, indent+4); INDENTED(stdout, indent, printf("</Typedef>\n")); return 0; }
//========= Copyright Valve Corporation, All rights reserved. ============// // // Purpose: // //=============================================================================// #ifndef TIMEDEVENTMGR_H #define TIMEDEVENTMGR_H #ifdef _WIN32 #pragma once #endif #include "utlpriorityqueue.h" // // // These classes provide fast timed event callbacks. To use them, make a CTimedEventMgr // and put CEventRegister objects in your objects that want the timed events. // // class CTimedEventMgr; abstract_class IEventRegisterCallback { public: virtual void FireEvent() = 0; }; class CEventRegister { friend bool TimedEventMgr_LessFunc( CEventRegister* const &a, CEventRegister* const &b ); friend class CTimedEventMgr; public: CEventRegister(); ~CEventRegister(); // Call this before ever calling SetUpdateInterval(). void Init( CTimedEventMgr *pMgr, IEventRegisterCallback *pCallback ); // Use these to start and stop getting updates. void SetUpdateInterval( float interval ); void StopUpdates(); inline bool IsRegistered() const { return m_bRegistered; } private: void Reregister(); // After having an event processed, this is called to have it register for the next one. void Term(); private: CTimedEventMgr *m_pEventMgr; float m_flNextEventTime; float m_flUpdateInterval; IEventRegisterCallback *m_pCallback; bool m_bRegistered; }; class CTimedEventMgr { friend class CEventRegister; public: CTimedEventMgr(); // Call this each frame to fire events. void FireEvents(); private: // Things used by CEventRegister. void RegisterForNextEvent( CEventRegister *pEvent ); void RemoveEvent( CEventRegister *pEvent ); private: // Events, sorted by the time at which they will fire. CUtlPriorityQueue<CEventRegister*> m_Events; }; #endif // TIMEDEVENTMGR_H