text
stringlengths
4
6.14k
/* * window.h * Copyright (C) 2002-2009 Jim Evins <evins@snaught.com>. * * This file is part of gLabels. * * gLabels 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. * * gLabels 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 gLabels. If not, see <http://www.gnu.org/licenses/>. */ #ifndef __WINDOW_H__ #define __WINDOW_H__ #include <gtk/gtk.h> #include "view.h" #include "label.h" #include "ui-property-bar.h" #include "ui-sidebar.h" #include "print-op.h" #include "merge-properties-dialog.h" G_BEGIN_DECLS #define GL_TYPE_WINDOW (gl_window_get_type ()) #define GL_WINDOW(obj) \ (G_TYPE_CHECK_INSTANCE_CAST((obj), GL_TYPE_WINDOW, glWindow )) #define GL_WINDOW_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_WINDOW, glWindowClass)) #define GL_IS_WINDOW(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_WINDOW)) #define GL_IS_WINDOW_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_WINDOW)) typedef struct _glWindow glWindow; typedef struct _glWindowClass glWindowClass; struct _glWindow { GtkWindow parent_widget; GtkUIManager *ui; GtkWidget *hbox; glLabel *label; GtkWidget *view; glUIPropertyBar *property_bar; glUISidebar *sidebar; GtkWidget *status_bar; GtkWidget *cursor_info; GtkWidget *cursor_info_frame; GtkWidget *zoom_info; GtkWidget *zoom_info_frame; guint menu_tips_context_id; glPrintOpSettings *print_settings; glMergePropertiesDialog *merge_dialog; GtkMenu *context_menu; GtkMenu *empty_selection_context_menu; }; struct _glWindowClass { GtkWindowClass parent_class; }; GType gl_window_get_type (void) G_GNUC_CONST; GtkWidget *gl_window_new (void); GtkWidget *gl_window_new_from_file (const gchar *filename); GtkWidget *gl_window_new_from_label (glLabel *label); gboolean gl_window_is_empty (glWindow *window); void gl_window_set_label (glWindow *window, glLabel *label); const GList *gl_window_get_window_list (void); G_END_DECLS #endif /* __WINDOW_H__ */ /* * Local Variables: -- emacs * mode: C -- emacs * c-basic-offset: 8 -- emacs * tab-width: 8 -- emacs * indent-tabs-mode: nil -- emacs * End: -- emacs */
/* * mmu.h * * Created on: 14 nov. 2008 * Author: LESCOUARNECN */ #ifndef MMU_H_ #define MMU_H_ #include <sys/time.h> extern void * start_addr; #define TV2TS(a,b) do{ b.tv_sec=a.tv_sec; b.tv_nsec=1000*a.tv_usec;} while(0) typedef unsigned int addr_phys; typedef void* addr_virt; typedef unsigned int page_virt; typedef unsigned int page_phys; typedef enum {FALSE=0, TRUE=-1} boolean; #define PAGESIZE (1<<12) #define PAGEOF(x) ((page_virt)(x-start_addr)>>12) #define ADDROF(x) ((addr_virt)((x<<12)+start_addr)) #define RECORDOF(a) mmu_array[a] #define INVALID 0xffffffff struct info_mmu{ int dirty; int accessed; page_phys pp; int loaded; // For internal check int swapped; // Allow to check that page is swapped correctly unsigned int cpt; // Compteur pour stocker la date de la dernière utilisation de chaque page struct timeval tv_askedFlush; struct timeval tv_askedLoad; }; int cpt=0; extern struct info_mmu* mmu_array; void mmu_init(int vmsize); void mmu_invalidatePage(page_virt pv); void mmu_addTranslation(page_virt pv, page_phys pp); void mmu_clearDirtyBit(page_virt pv); void mmu_clearAccessedBit(page_virt pv); int mmu_isDirty(page_virt pv); int mmu_isAccessed(page_virt pv); void page_fault_handler(page_virt pv); void print_stats(); void init_faultHandler(int nb_pages_virt, int nb_pages_phys); #endif /* MMU_H_ */
/* * Generated by asn1c-0.9.24 (http://lionet.info/asn1c) * From ASN.1 module "InformationElements" * found in "../asn/InformationElements.asn" * `asn1c -fcompound-names -fnative-types` */ #ifndef _CSGProximityDetection_H_ #define _CSGProximityDetection_H_ #include <asn_application.h> /* Including external dependencies */ #include <NativeEnumerated.h> #include <constr_SEQUENCE.h> #ifdef __cplusplus extern "C" { #endif /* Dependencies */ typedef enum CSGProximityDetection__uTRACSGProximityDetec { CSGProximityDetection__uTRACSGProximityDetec_enable = 0 } e_CSGProximityDetection__uTRACSGProximityDetec; typedef enum CSGProximityDetection__e_UTRACSGProximityDetec { CSGProximityDetection__e_UTRACSGProximityDetec_enable = 0 } e_CSGProximityDetection__e_UTRACSGProximityDetec; /* CSGProximityDetection */ typedef struct CSGProximityDetection { long *uTRACSGProximityDetec /* OPTIONAL */; long *e_UTRACSGProximityDetec /* OPTIONAL */; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } CSGProximityDetection_t; /* Implementation */ /* extern asn_TYPE_descriptor_t asn_DEF_uTRACSGProximityDetec_2; // (Use -fall-defs-global to expose) */ /* extern asn_TYPE_descriptor_t asn_DEF_e_UTRACSGProximityDetec_4; // (Use -fall-defs-global to expose) */ extern asn_TYPE_descriptor_t asn_DEF_CSGProximityDetection; #ifdef __cplusplus } #endif #endif /* _CSGProximityDetection_H_ */ #include <asn_internal.h>
/* * Generated by asn1c-0.9.24 (http://lionet.info/asn1c) * From ASN.1 module "PDU-definitions" * found in "../asn/PDU-definitions.asn" * `asn1c -fcompound-names -fnative-types` */ #ifndef _UTRANMobilityInformation_r7_IEs_H_ #define _UTRANMobilityInformation_r7_IEs_H_ #include <asn_application.h> /* Including external dependencies */ #include "C-RNTI.h" #include "H-RNTI.h" #include "URA-Identity.h" #include <BOOLEAN.h> #include <constr_SEQUENCE.h> #ifdef __cplusplus extern "C" { #endif /* Forward declarations */ struct IntegrityProtectionModeInfo_r7; struct CipheringModeInfo_r7; struct U_RNTI; struct UE_ConnTimersAndConstants_r5; struct CN_InformationInfoFull; struct PLMN_Identity; struct DL_CounterSynchronisationInfo_r5; /* UTRANMobilityInformation-r7-IEs */ typedef struct UTRANMobilityInformation_r7_IEs { struct IntegrityProtectionModeInfo_r7 *integrityProtectionModeInfo /* OPTIONAL */; struct CipheringModeInfo_r7 *cipheringModeInfo /* OPTIONAL */; struct U_RNTI *new_U_RNTI /* OPTIONAL */; C_RNTI_t *new_C_RNTI /* OPTIONAL */; H_RNTI_t *new_H_RNTI /* OPTIONAL */; struct UE_ConnTimersAndConstants_r5 *ue_ConnTimersAndConstants /* OPTIONAL */; struct CN_InformationInfoFull *cn_InformationInfo /* OPTIONAL */; struct PLMN_Identity *primary_plmn_Identity /* OPTIONAL */; URA_Identity_t *ura_Identity /* OPTIONAL */; BOOLEAN_t *supportForChangeOfUE_Capability /* OPTIONAL */; struct DL_CounterSynchronisationInfo_r5 *dl_CounterSynchronisationInfo /* OPTIONAL */; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } UTRANMobilityInformation_r7_IEs_t; /* Implementation */ extern asn_TYPE_descriptor_t asn_DEF_UTRANMobilityInformation_r7_IEs; #ifdef __cplusplus } #endif /* Referred external types */ #include "IntegrityProtectionModeInfo-r7.h" #include "CipheringModeInfo-r7.h" #include "U-RNTI.h" #include "UE-ConnTimersAndConstants-r5.h" #include "CN-InformationInfoFull.h" #include "PLMN-Identity.h" #include "DL-CounterSynchronisationInfo-r5.h" #endif /* _UTRANMobilityInformation_r7_IEs_H_ */ #include <asn_internal.h>
/* * Copyright 2004 PathScale, Inc. All Rights Reserved. */ /* Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of version 2.1 of the GNU Lesser General Public License as published by the Free Software Foundation. This program is distributed in the hope that it would be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Further, this software is distributed without any warranty that it is free of the rightful claim of any third person regarding infringement or the like. Any license provided herein, whether implied or otherwise, applies only to this software file. Patent licenses, if any, provided herein do not apply to combinations of this program with other software, or any other product whatsoever. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, Mountain View, CA 94043, or: http://www.sgi.com For further information regarding this notice, see: http://oss.sgi.com/projects/GenInfo/NoticeExplan */ #pragma ident "@(#) libfi/matrix/matmul_l1l2.c 92.1 07/09/99 15:18:08" #include "matmul.h" /* * Name of this entry point */ #define NAME _MATMUL_L1L2 /* * Name of routine called do computation (if any) */ #if defined(BUILD_COMPILER_GNU) && defined(BUILD_OS_DARWIN) #define SUBNAME underscore_l1l2gemmx__ #else /* defined(BUILD_COMPILER_GNU) && defined(BUILD_OS_DARWIN) */ #define SUBNAME _l1l2gemmx__ #endif /* defined(BUILD_COMPILER_GNU) && defined(BUILD_OS_DARWIN) */ /* * Type of constants alpha and beta */ #define RESULTTYPE _f_int2 void NAME(DopeVectorType *RESULT, DopeVectorType *MATRIX_A, DopeVectorType *MATRIX_B) { void SUBNAME(); const RESULTTYPE true = _btol(1); const RESULTTYPE false = _btol(0); MatrixDimenType matdimdata, *MATDIM; MATDIM = (MatrixDimenType *) &matdimdata; /* * Parse dope vectors, and perform error checking. */ _premult(RESULT, MATRIX_A, MATRIX_B, MATDIM); /* * Perform the matrix multiplication. */ SUBNAME(&MATDIM->m, &MATDIM->n, &MATDIM->k, &true, MATDIM->A, &MATDIM->inc1a, &MATDIM->inc2a, MATDIM->B, &MATDIM->inc1b, &MATDIM->inc2b, &false, MATDIM->C, &MATDIM->inc1c, &MATDIM->inc2c); return; }
/* * Copyright (C) 2011-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 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> #include <inttypes.h> #include "signature.h" SIGNATURE_CHECK (imaxdiv, imaxdiv_t, (intmax_t, intmax_t)); #include "macros.h" int main (void) { { imaxdiv_t result = imaxdiv (101, 7); ASSERT (result.quot = 14); ASSERT (result.rem = 3); } { imaxdiv_t result = imaxdiv (-101, 7); ASSERT (result.quot = -14); ASSERT (result.rem = -3); } { imaxdiv_t result = imaxdiv (101, -7); ASSERT (result.quot = -14); ASSERT (result.rem = 3); } { imaxdiv_t result = imaxdiv (-101, -7); ASSERT (result.quot = 14); ASSERT (result.rem = -3); } return 0; }
/* * Copyright (C) 2009 - 2012 Stephen F. Booth <me@sbooth.org> * All Rights Reserved */ #pragma once #import <Cocoa/Cocoa.h> // ======================================== // Generates multipart/form-data from the given dictionary using the specified boundary // ======================================== NSData * GenerateFormData(NSDictionary *formValues, NSString *boundary);
/* Lzma86Enc.c -- LZMA + x86 (BCJ) Filter Encoder 2008-08-05 Igor Pavlov Public domain */ #include <string.h> #include "Lzma86Enc.h" #include "Alloc.h" #include "Bra.h" #include "LzmaEnc.h" #define SZE_OUT_OVERFLOW SZE_DATA_ERROR static void *SzAlloc(void *p, size_t size) { p = p; return MyAlloc(size); } static void SzFree(void *p, void *address) { p = p; MyFree(address); } static ISzAlloc g_Alloc = { SzAlloc, SzFree }; #define LZMA86_SIZE_OFFSET (1 + LZMA_PROPS_SIZE) #define LZMA86_HEADER_SIZE (LZMA86_SIZE_OFFSET + 8) int Lzma86_Encode(Byte *dest, size_t *destLen, const Byte *src, size_t srcLen, int level, UInt32 dictSize, int filterMode) { size_t outSize2 = *destLen; Byte *filteredStream; Bool useFilter; int mainResult = SZ_ERROR_OUTPUT_EOF; CLzmaEncProps props; LzmaEncProps_Init(&props); props.level = level; props.dictSize = dictSize; *destLen = 0; if (outSize2 < LZMA86_HEADER_SIZE) return SZ_ERROR_OUTPUT_EOF; { int i; UInt64 t = srcLen; for (i = 0; i < 8; i++, t >>= 8) dest[LZMA86_SIZE_OFFSET + i] = (Byte)t; } filteredStream = 0; useFilter = (filterMode != SZ_FILTER_NO); if (useFilter) { if (srcLen != 0) { filteredStream = (Byte *)MyAlloc(srcLen); if (filteredStream == 0) return SZ_ERROR_MEM; memcpy(filteredStream, src, srcLen); } { UInt32 x86State; x86_Convert_Init(x86State); x86_Convert(filteredStream, srcLen, 0, &x86State, 1); } } { size_t minSize = 0; Bool bestIsFiltered = False; /* passes for SZ_FILTER_AUTO: 0 - BCJ + LZMA 1 - LZMA 2 - BCJ + LZMA agaian, if pass 0 (BCJ + LZMA) is better. */ int numPasses = (filterMode == SZ_FILTER_AUTO) ? 3 : 1; int i; for (i = 0; i < numPasses; i++) { size_t outSizeProcessed = outSize2 - LZMA86_HEADER_SIZE; size_t outPropsSize = 5; SRes curRes; Bool curModeIsFiltered = (numPasses > 1 && i == numPasses - 1); if (curModeIsFiltered && !bestIsFiltered) break; if (useFilter && i == 0) curModeIsFiltered = True; curRes = LzmaEncode(dest + LZMA86_HEADER_SIZE, &outSizeProcessed, curModeIsFiltered ? filteredStream : src, srcLen, &props, dest + 1, &outPropsSize, 0, NULL, &g_Alloc, &g_Alloc); if (curRes != SZ_ERROR_OUTPUT_EOF) { if (curRes != SZ_OK) { mainResult = curRes; break; } if (outSizeProcessed <= minSize || mainResult != SZ_OK) { minSize = outSizeProcessed; bestIsFiltered = curModeIsFiltered; mainResult = SZ_OK; } } } dest[0] = (unsigned char) (bestIsFiltered ? 1 : 0); /*MAB: Cast to silence compiler */ *destLen = LZMA86_HEADER_SIZE + minSize; } if (useFilter) MyFree(filteredStream); return mainResult; }
/* =========================================================================== Copyright (c) 2010-2015 Darkstar Dev Teams 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/ This file is part of DarkStar-server source code. =========================================================================== */ #ifndef _CITEMCONTAINER_H #define _CITEMCONTAINER_H #include "../common/cbasetypes.h" enum CONTAINER_ID { LOC_INVENTORY = 0, LOC_MOGSAFE = 1, LOC_STORAGE = 2, LOC_TEMPITEMS = 3, LOC_MOGLOCKER = 4, LOC_MOGSATCHEL = 5, LOC_MOGSACK = 6, LOC_MOGCASE = 7, LOC_WARDROBE = 8, LOC_MOGSAFE2 = 9 }; #define MAX_CONTAINER_ID 10 #define MAX_CONTAINER_SIZE 120 #define ERROR_SLOTID 255 /************************************************************************ * * * * * * ************************************************************************/ class CItem; class CItemContainer { public: CItemContainer(uint16 LocationID); ~CItemContainer(); uint16 GetID(); uint16 GetBuff(); // планируемый размер хранилища (размер без ограничений) uint8 GetSize(); uint8 GetFreeSlotsCount(); // количество свободных ячеек в хранилище uint8 AddBuff(int8 buff); // планируемый размер хранилища (размер без ограничений) uint8 AddSize(int8 size); // увеличиваем/уменьшаем размер контейнера uint8 SetSize(uint8 size); uint8 SearchItem(uint16 ItemID); // поиск предмета в хранилище uint8 SearchItemWithSpace(uint16 ItemID, uint32 quantity); //search for item that has space to accomodate x items added uint8 InsertItem(CItem* PItem); // добавляем заранее созданный предмет в свободную ячейку uint8 InsertItem(CItem* PItem, uint8 slotID); // добавляем заранее созданный предмет в выбранную ячейку uint32 SortingPacket; // количество запросов на сортировку за такт uint32 LastSortingTime; // время последней сортировки контейнера CItem* GetItem(uint8 slotID); // получаем указатель на предмет, находящийся в указанной ячейка. void Clear(); // Remove all items from container template<typename F, typename... Args> void ForEachItem(F func, Args&&... args) { for (uint8 SlotID = 0; SlotID <= m_size; ++SlotID) { if (m_ItemList[SlotID]) { func(m_ItemList[SlotID], std::forward<Args>(args)...); } } } private: uint16 m_id; uint16 m_buff; uint8 m_size; uint8 m_count; CItem* m_ItemList[MAX_CONTAINER_SIZE+1]; }; #endif
/* This file is part of darktable, copyright (c) 2012 Jeremy Rosen darktable 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. darktable 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 darktable. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <lua/lua.h> /* * LUA API VERSIONNING * This API versionning follows semantic versionning as defined in * http://semver.org * only stable releases are considered "released" * => no need to increase API version with every commit, * however, beware of stable releases and API changes */ // 1.6 was 2.0.1 // 1.6.1 was 2.0.2 // 2.0.0 was 3.0.0 // 2.2.0 was 4.0.0 ( removed the ugly yield functions make scripts incompatible) // 2.x will be 5.0.0 (going to lua 5.3 is a major API bump) /* incompatible API change */ #define LUA_API_VERSION_MAJOR 5 /* backward compatible API change */ #define LUA_API_VERSION_MINOR 0 /* bugfixes that should not change anything to the API */ #define LUA_API_VERSION_PATCH 0 /* suffix for unstable version */ #define LUA_API_VERSION_SUFFIX "dev" /** initialize lua stuff at DT start time */ int dt_lua_init_configuration(lua_State *L); // modelines: These editor modelines have been set for all relevant files by tools/update_modelines.sh // vim: shiftwidth=2 expandtab tabstop=2 cindent // kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
#define MAJOR_VERSION 1 #define MINOR_VERSION 3 #define MICRO_VERSION 99 #define BUILD_VERSION 1 #define QUOTE_(x) #x #define QUOTE(x) QUOTE_(x) #define VERSION_STRING QUOTE(MAJOR_VERSION.MINOR_VERSION.MICRO_VERSION.BUILD_VERSION) #define VERSION_STRING_W _T(QUOTE(MAJOR_VERSION.MINOR_VERSION.MICRO_VERSION.BUILD_VERSION)) #define BUILD_DATE_STRING _T(__DATE__) _T(" ") _T(__TIME__)
#ifndef SENDER_KEY #define SENDER_KEY #include <stdint.h> #include <stddef.h> #include "signal_protocol_types.h" #ifdef __cplusplus extern "C" { #endif int sender_message_key_create(sender_message_key **key, uint32_t iteration, signal_buffer *seed, signal_context *global_context); uint32_t sender_message_key_get_iteration(sender_message_key *key); signal_buffer *sender_message_key_get_iv(sender_message_key *key); signal_buffer *sender_message_key_get_cipher_key(sender_message_key *key); signal_buffer *sender_message_key_get_seed(sender_message_key *key); void sender_message_key_destroy(signal_type_base *type); int sender_chain_key_create(sender_chain_key **key, uint32_t iteration, signal_buffer *chain_key, signal_context *global_context); uint32_t sender_chain_key_get_iteration(sender_chain_key *key); int sender_chain_key_create_message_key(sender_chain_key *key, sender_message_key **message_key); int sender_chain_key_create_next(sender_chain_key *key, sender_chain_key **next_key); signal_buffer *sender_chain_key_get_seed(sender_chain_key *key); void sender_chain_key_destroy(signal_type_base *type); #ifdef __cplusplus } #endif #endif /* SENDER_KEY */
/* * This file is a part of hildon * * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved. * * Contact: Rodrigo Novo <rodrigo.novo@nokia.com> * * 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; 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 * */ #ifndef __HILDON_SEEKBAR_PRIVATE_H__ #define __HILDON_SEEKBAR_PRIVATE_H__ G_BEGIN_DECLS typedef struct _HildonSeekbarPrivate HildonSeekbarPrivate; #define HILDON_SEEKBAR_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \ HILDON_TYPE_SEEKBAR, HildonSeekbarPrivate)); struct _HildonSeekbarPrivate { gboolean is_toolbar; /* TRUE if this widget is inside a toolbar */ guint fraction; /* This is the amount of time that has progressed from the beginning. It should be an integer between the minimum and maximum values of the corresponding adjustment, ie. adjument->lower and ->upper.. */ }; G_END_DECLS #endif /* __HILDON_SEEKBAR_PRIVATE_H__ */
/* $XConsortium: DrHiDash.c /main/5 1995/07/15 20:50:42 drk $ */ /* * Motif * * Copyright (c) 1987-2012, The Open Group. All rights reserved. * * These libraries and programs are free software; you can * redistribute them and/or modify them under the terms of the GNU * Lesser General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) * any later version. * * These libraries and programs are distributed in the hope that * they 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 these librararies and programs; if not, write * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth * Floor, Boston, MA 02110-1301 USA * */ /* * HISTORY */ #ifdef HAVE_CONFIG_H #include <config.h> #endif #include "XmI.h" #include "DrawI.h" /****************************_XmDrawHighlight*************************** * * This function modifies the given gc, which therefore needs to be created * using XCreateGC or XtAllocateGC. * ***************************************************************************/ void _XmDrawHighlight(Display *display, Drawable d, GC gc, #if NeedWidePrototypes int x, int y, int width, int height, int highlight_thickness, #else Position x, Position y, Dimension width, Dimension height, Dimension highlight_thickness, #endif /* NeedWidePrototypes */ int line_style) { XSegment seg[4]; register Dimension half_hl = highlight_thickness/2 ; register Dimension cor = highlight_thickness % 2 ; XGCValues gcvalues; if (!d || !highlight_thickness || !width || !height) return ; /* the XmList dash case relies on this particular order of X segments */ seg[0].x1 = seg[2].x1 = x ; seg[0].y1 = seg[0].y2 = y + half_hl ; seg[0].x2 = x + width - highlight_thickness ; seg[1].x1 = seg[1].x2 = x + width - half_hl - cor; seg[1].y1 = seg[3].y1 = y ; seg[3].y2 = y + height - half_hl; seg[2].y1 = seg[2].y2 = y + height - half_hl - cor; seg[3].x1 = seg[3].x2 = x + half_hl ; seg[2].x2 = x + width ; seg[1].y2 = y + height ; /* first save the current values we want to change */ XGetGCValues(display, gc, GCLineWidth|GCLineStyle|GCCapStyle|GCJoinStyle, &gcvalues); /* change them and draw the lines */ XSetLineAttributes(display, gc, highlight_thickness, line_style, CapButt, JoinMiter); XDrawSegments (display, d, gc, seg, 4); /* put them back */ XSetLineAttributes(display, gc, gcvalues.line_width, gcvalues.line_style, gcvalues.cap_style, gcvalues.join_style); /** note that the above is a hack, a read-only GC shoudl not be modified, period */ }
/* Copyright (C) 2012 Fredrik Johansson This file is part of Arb. Arb is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. See <http://www.gnu.org/licenses/>. */ #include "acb_mat.h" void acb_mat_clear(acb_mat_t mat) { if (mat->entries != NULL) { _acb_vec_clear(mat->entries, mat->r * mat->c); flint_free(mat->rows); } }
/* * Copyright (c) 2013-2014, Red Hat. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ #ifndef QED_LINE_H #define QED_LINE_H #include <QtGui> #include "qed_gadget.h" class QedLine : public QedGadget { Q_OBJECT public: QedLine(QWidget *parent, qreal length); QedLine(QWidget *parent, int length, Qt::Orientation o); QedLine(QWidget *parent, int x, int y, int w, int h); void setOrientation(Qt::Orientation o) { my.oriented = o; } private: void setup(void); virtual void paintEvent(QPaintEvent *); virtual void resizeEvent(QResizeEvent *); struct { QRect box; qreal bound; qreal length; enum Qt::Orientation oriented; } my; }; #endif // QED_LINE_H
// // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2011 Daniel Marth <danielmarth@gmx.at> // #ifndef OPENCACHINGPLUGIN_H #define OPENCACHINGPLUGIN_H #include "AbstractDataPlugin.h" #include "RenderPlugin.h" #include "RenderPluginInterface.h" #include <QtCore/QHash> #include <QtGui/QIcon> #include <QtGui/QAbstractButton> namespace Ui { class OpenCachingConfigWidget; } namespace Marble { /** * Plugin to display geocaches from opencaching.de on the map. */ class OpenCachingPlugin : public AbstractDataPlugin { Q_OBJECT Q_INTERFACES( Marble::RenderPluginInterface ) MARBLE_PLUGIN( OpenCachingPlugin ) public: OpenCachingPlugin(); virtual void initialize(); virtual bool isInitialized() const; QString name() const; QString guiString() const; QString description() const; QIcon icon() const; QDialog *configDialog(); /** * @return: The settings of the item. */ virtual QHash<QString,QVariant> settings() const; /** * Set the settings of the item. */ virtual void setSettings( const QHash<QString,QVariant> &settings ); public slots: void readSettings(); void writeSettings(); void updateSettings(); private: bool m_isInitialized; Ui::OpenCachingConfigWidget *m_ui; QDialog *m_configDialog; QHash<QString,QVariant> m_settings; private slots: void validateDateRange(); void validateDifficultyRange(); }; } #endif // OPENCACHINGPLUGIN_H
/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is the Netscape security libraries. * * The Initial Developer of the Original Code is Netscape * Communications Corporation. Portions created by Netscape are * Copyright (C) 1994-2000 Netscape Communications Corporation. All * Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the * terms of the GNU General Public License Version 2 or later (the * "GPL"), in which case the provisions of the GPL are applicable * instead of those above. If you wish to allow use of your * version of this file only under the terms of the GPL and not to * allow others to use your version of this file under the MPL, * indicate your decision by deleting the provisions above and * replace them with the notice and other provisions required by * the GPL. If you do not delete the provisions above, a recipient * may use your version of this file under either the MPL or the * GPL. */ #ifndef NSSBASET_H #define NSSBASET_H #ifdef DEBUG static const char NSSBASET_CVS_ID[] = "@(#) $RCSfile: nssbaset.h,v $ $Revision: 1.4 $ $Date: 2001/11/08 00:14:37 $ $Name: NSS_3_9_BRANCH $"; #endif /* DEBUG */ /* * nssbaset.h * * This file contains the most low-level, fundamental public types. */ #include "nspr.h" #include "nssilock.h" /* * NSS_EXTERN, NSS_IMPLEMENT, NSS_EXTERN_DATA, NSS_IMPLEMENT_DATA * * NSS has its own versions of these NSPR macros, in a form which * does not confuse ctags and other related utilities. NSPR * defines these macros to take the type as an argument, because * of a requirement to support win16 dlls. We do not have that * requirement, so we can drop that restriction. */ #define DUMMY /* dummy */ #define NSS_EXTERN PR_EXTERN(DUMMY) #define NSS_IMPLEMENT PR_IMPLEMENT(DUMMY) #define NSS_EXTERN_DATA PR_EXTERN_DATA(DUMMY) #define NSS_IMPLEMENT_DATA PR_IMPLEMENT_DATA(DUMMY) PR_BEGIN_EXTERN_C /* * NSSError * * Calls to NSS routines may result in one or more errors being placed * on the calling thread's "error stack." Every possible error that * may be returned from a function is declared where the function is * prototyped. All errors are of the following type. */ typedef PRInt32 NSSError; /* * NSSArena * * Arenas are logical sets of heap memory, from which memory may be * allocated. When an arena is destroyed, all memory allocated within * that arena is implicitly freed. These arenas are thread-safe: * an arena pointer may be used by multiple threads simultaneously. * However, as they are not backed by shared memory, they may only be * used within one process. */ struct NSSArenaStr; typedef struct NSSArenaStr NSSArena; /* * NSSItem * * This is the basic type used to refer to an unconstrained datum of * arbitrary size. */ struct NSSItemStr { void *data; PRUint32 size; }; typedef struct NSSItemStr NSSItem; /* * NSSBER * * Data packed according to the Basic Encoding Rules of ASN.1. */ typedef NSSItem NSSBER; /* * NSSDER * * Data packed according to the Distinguished Encoding Rules of ASN.1; * this form is also known as the Canonical Encoding Rules form (CER). */ typedef NSSBER NSSDER; /* * NSSBitString * * Some ASN.1 types use "bit strings," which are passed around as * octet strings but whose length is counted in bits. We use this * typedef of NSSItem to point out the occasions when the length * is counted in bits, not octets. */ typedef NSSItem NSSBitString; /* * NSSUTF8 * * Character strings encoded in UTF-8, as defined by RFC 2279. */ typedef char NSSUTF8; /* * NSSASCII7 * * Character strings guaranteed to be 7-bit ASCII. */ typedef char NSSASCII7; PR_END_EXTERN_C #endif /* NSSBASET_H */
/****************************************************************/ /* MOOSE - Multiphysics Object Oriented Simulation Environment */ /* */ /* All contents are licensed under LGPL V2.1 */ /* See LICENSE for full restrictions */ /****************************************************************/ #ifndef RICHARDSLUMPEDMASSCHANGE #define RICHARDSLUMPEDMASSCHANGE #include "TimeKernel.h" #include "Material.h" #include "RichardsVarNames.h" #include "RichardsDensity.h" #include "RichardsSeff.h" #include "RichardsSat.h" // Forward Declarations class RichardsLumpedMassChange; template<> InputParameters validParams<RichardsLumpedMassChange>(); /** * d(fluid mass in porespace)/dt with the fluid mass * being lumped to the nodes. Usually this is better * to use than a non-lumped version because it prevents * unphysical oscillations. */ class RichardsLumpedMassChange : public TimeKernel { public: RichardsLumpedMassChange(const InputParameters & parameters); RichardsLumpedMassChange(const std::string & deprecated_name, InputParameters parameters); // DEPRECATED CONSTRUCTOR protected: virtual Real computeQpResidual(); virtual Real computeQpJacobian(); virtual Real computeQpOffDiagJacobian(unsigned int jvar); /** * holds info regarding the names of the Richards variables * and methods for extracting values of these variables */ const RichardsVarNames & _richards_name_UO; /// number of richards variables unsigned int _num_p; /** * the index of this variable in the list of Richards variables * held by _richards_name_UO. Eg * if richards_vars = 'pwater pgas poil' in the _richards_name_UO * and this kernel has variable = pgas, then _pvar = 1 * This is used to index correctly into seff_UO, sat_UO, density_UO, etc. */ unsigned int _pvar; /// current value of the porosity const MaterialProperty<Real> &_porosity; /// value of the porosity at the start of the timestep const MaterialProperty<Real> &_porosity_old; /// The userobject that computes effective saturation (as a function of porepressure(s)) for this variable const RichardsSeff * _seff_UO; /// The userobject that computes saturation (as a function of effective saturation) for this variable const RichardsSat * _sat_UO; /// The userobject that computes fluid density (as a function of the porepressure) const RichardsDensity * _density_UO; /** * Holds the values of pressures at all the nodes of the element * Eg: * _ps_at_nodes[_pvar] is a pointer to this variable's nodal porepressure values * So: (*_ps_at_nodes[_pvar])[i] = _var.nodalSln()[i] */ std::vector<VariableValue *> _ps_at_nodes; /// Holds the nodal values of pressures at timestep_begin, in same way as _ps_at_nodes std::vector<VariableValue *> _ps_old_at_nodes; /// holds nodal values of d(Seff)/dP_i std::vector<Real> _dseff; }; #endif //RICHARDSLUMPEDMASSCHANGE
/* * FastRPC -- Fast RPC library compatible with XML-RPC * Copyright (C) 2005-7 Seznam.cz, a.s. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Seznam.cz, a.s. * Radlicka 2, Praha 5, 15000, Czech Republic * http://www.seznam.cz, mailto:fastrpc@firma.seznam.cz * * FILE $Id: frpcurlunmarshaller.h,v 1.1 2011-01-10 22:27:04 burlog Exp $ * * DESCRIPTION Url encoded unmarshaller. * * PROJECT FastRPC library. * * AUTHOR Michal Bukovsky <michal.bukovsky@firma.seznam.cz> * * Copyright (C) Seznam.cz a.s. 2011 * All Rights Reserved * * HISTORY * 2011-01-06 (bukovsky) * First draft. * */ #ifndef FRPC_FRPCURLUNMARSHALLER_H #define FRPC_FRPCURLUNMARSHALLER_H #include <frpcunmarshaller.h> #include <frpcdatabuilder.h> #include "frpcinternals.h" #include <frpc.h> #include <vector> #include <string> namespace FRPC { /** * @short Unmarshalling url encoded form data. */ class URLUnMarshaller_t : public UnMarshaller_t { public: /** * @short C'tor. */ URLUnMarshaller_t(DataBuilder_t &dataBuilder, const std::string &path = std::string("RPC2")); /** Unmarshalls serialized data. * @param data buffer with marshalled data. * @param size size of buffer. * @param type type of data to unmarshall (any, request, response, fault). */ virtual void unMarshall(const char *data, unsigned int size, char type); /** * @short Flush data. */ virtual void finish(); private: DataBuilder_t &dataBuilder; //!< data builder std::string buffer; //!< buffer for data std::string method; //!< called method }; } // namespace FRPC #endif /* FRPC_FRPCURLUNMARSHALLER_H */
/*-------------------------------------------------------------------- (C) Copyright 2006-2013 Barcelona Supercomputing Center Centro Nacional de Supercomputacion This file is part of Mercurium C/C++ source-to-source compiler. See AUTHORS file in the top level directory for information regarding developers and contributors. 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 3 of the License, or (at your option) any later version. Mercurium C/C++ source-to-source compiler 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 Mercurium C/C++ source-to-source compiler; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. --------------------------------------------------------------------*/ /* <testinfo> test_generator=config/mercurium-omp </testinfo> */ #include <stdio.h> #include <stdlib.h> #pragma omp declare reduction(mymin:int,float: omp_out = omp_out > omp_in ? omp_in : omp_out ) initializer(omp_priv = 2147483647) #pragma omp declare reduction(mymin:char: omp_out = omp_out > omp_in ? omp_in : omp_out ) initializer(omp_priv = 2147483647) #define N 100 int omp_get_num_threads(void); int omp_get_thread_num(void); int main (int argc, char **argv) { int i,x = N + 1; float a[N]; for ( i = 0; i < N ; i++ ) a[i] = i; #ifdef NANOX #pragma omp for reduction(mymin:x) #else #pragma omp parallel for reduction(mymin:x) #endif for ( i = 0; i < N ; i++ ) { x = a[i] < x ? a[i] : x; } if ( x != 0 ) { fprintf(stderr, " x = %d\n", x); } return 0; }
#ifndef H_ASIO_BASE #define H_ASIO_BASE #include <socketcan_interface/interface.h> #include <socketcan_interface/dispatcher.h> #include <boost/asio.hpp> #include <boost/thread/mutex.hpp> #include <boost/thread/thread.hpp> #include <boost/bind.hpp> namespace can{ template<typename Socket> class AsioDriver : public DriverInterface{ typedef FilteredDispatcher<const unsigned int, CommInterface::FrameListener> FrameDispatcher; typedef SimpleDispatcher<StateInterface::StateListener> StateDispatcher; FrameDispatcher frame_dispatcher_; StateDispatcher state_dispatcher_; State state_; boost::mutex state_mutex_; boost::mutex socket_mutex_; protected: boost::asio::io_service io_service_; boost::asio::strand strand_; Socket socket_; Frame input_; virtual void triggerReadSome() = 0; virtual bool enqueue(const Frame & msg) = 0; void dispatchFrame(const Frame &msg){ strand_.post(boost::bind(&FrameDispatcher::dispatch, &frame_dispatcher_, msg)); // copies msg } void setErrorCode(const boost::system::error_code& error){ boost::mutex::scoped_lock lock(state_mutex_); if(state_.error_code != error){ state_.error_code = error; state_dispatcher_.dispatch(state_); } } void setInternalError(unsigned int internal_error){ boost::mutex::scoped_lock lock(state_mutex_); if(state_.internal_error != internal_error){ state_.internal_error = internal_error; state_dispatcher_.dispatch(state_); } } void setDriverState(State::DriverState state){ boost::mutex::scoped_lock lock(state_mutex_); if(state_.driver_state != state){ state_.driver_state = state; state_dispatcher_.dispatch(state_); } } void frameReceived(const boost::system::error_code& error){ if(!error){ dispatchFrame(input_); triggerReadSome(); }else{ setErrorCode(error); } } AsioDriver() : strand_(io_service_), socket_(io_service_) {} public: virtual ~AsioDriver() { shutdown(); } State getState(){ boost::mutex::scoped_lock lock(state_mutex_); return state_; } virtual void run(){ setDriverState(socket_.is_open()?State::open : State::closed); if(getState().driver_state == State::open){ io_service_.reset(); boost::asio::io_service::work work(io_service_); setDriverState(State::ready); boost::thread post_thread(boost::bind(&boost::asio::io_service::run, &io_service_)); triggerReadSome(); boost::system::error_code ec; io_service_.run(ec); setErrorCode(ec); setDriverState(socket_.is_open()?State::open : State::closed); } state_dispatcher_.dispatch(state_); } virtual bool send(const Frame & msg){ return getState().driver_state == State::ready && enqueue(msg); } virtual void shutdown(){ if(socket_.is_open()){ socket_.cancel(); socket_.close(); } io_service_.stop(); } virtual FrameListener::Ptr createMsgListener(const FrameDelegate &delegate){ return frame_dispatcher_.createListener(delegate); } virtual FrameListener::Ptr createMsgListener(const Frame::Header&h , const FrameDelegate &delegate){ return frame_dispatcher_.createListener(h, delegate); } virtual StateListener::Ptr createStateListener(const StateDelegate &delegate){ return state_dispatcher_.createListener(delegate); } }; } // namespace can #endif
#ifndef LANGMUIR_H #define LANGMUIR_H #include <string.h> #include <stdlib.h> #include "pic_pc104_config.h" #include "rs232_suchai.h" #if(SCH_PAY_LANGMUIR_ONBOARD==1) #define LAG_BUFFER_LEN (1096) /* Maximum buffer length for Sweep receive packets*/ #else #define LAG_BUFFER_LEN (1) #endif #define LAG_COMMPORT RS2_M_UART3 #define LAG_BAUDRATE (38400) /* BAUD 38400 => ABAUD 25*/ #define LAG_ABAUD (25) /* BAUD 38400 => ABAUD 25*/ #define LAG_SYNC (0x43) #define LAG_CAL (0xC1) #define LAG_PLASMA (0xC2) #define LAG_SWEEP (0xC3) #define langmuir_printf(c) SendStrRS232(c, LAG_COMMPORT) #define langmuir_getc() ((char)ReadRS232(LAG_COMMPORT)) #define langmuir_write(str,len) SendRS232(str, len, LAG_COMMPORT) #define langmuir_read() ReadRS232(LAG_COMMPORT) int lag_read_cal_packet(BOOL verb); int lag_read_plasma_packet(BOOL verb); int lag_read_sweep_packet(BOOL verb); void lag_print_buffer(int len); void lag_erase_buffer(void); int lag_wait_busy_wtimeout(void); unsigned int lag_get_langmuir_buffer_i(int ind); int langmuir_isAlive(void); #endif //LANGMUIR_H
#include <stdio.h> #include <stdlib.h> #define NB_BLOCS 257 #define TAILLE (1024*1024) int main (void) { int i; char * bloc [NB_BLOCS]; for (i = 0; i < NB_BLOCS; i ++) { if ((bloc [i] = (char *) malloc (TAILLE)) == NULL) { fprintf (stderr, "Echec pour i = %d\n", i); break; } fprintf (stderr, "Remplissage de %d\n", i); memset (bloc [i], 0, TAILLE); } fprintf (stderr, "Alloués : %d blocs\n", i); return (0); }
// Copyright 2011 Google Inc. 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. // // IOSIntArray.h // JreEmulation // // Created by Tom Ball on 6/16/11. // #import "IOSArray.h" // An emulation class that represents a Java int array. Like a Java array, // an IOSIntArray is fixed-size but its elements are mutable. @interface IOSIntArray : IOSArray { @private int *buffer_; } // Create an array from a C int array and length. - (id)initWithInts:(const int *)ints count:(NSUInteger)count; + (id)arrayWithInts:(const int *)ints count:(NSUInteger)count; // Return int at a specified index, throws IndexOutOfBoundsException // if out out range; - (int)intAtIndex:(NSUInteger)index; // Sets int at a specified index, throws IndexOutOfBoundsException // if out out range. Returns replacement value. - (int)replaceIntAtIndex:(NSUInteger)index withInt:(int)c; // Copies the array contents into a specified buffer, up to the specified // length. An IndexOutOfBoundsException is thrown if the specified length // is greater than the array size. - (void)getInts:(int *)buffer length:(NSUInteger)length; // Increments an array element. - (int)incr:(NSUInteger)index; // Decrements an array element. - (int)decr:(NSUInteger)index; // Increments an array element but returns the initial value, like the postfix // operator. - (int)postIncr:(NSUInteger)index; // Decrements an array element but returns the initial value, like the postfix // operator. - (int)postDecr:(NSUInteger)index; @end
/*------------------------------------------------------------------------------ * Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team * * Distributable under the terms of either the Apache License (Version 2.0) or * the GNU Lesser General Public License, as specified in the COPYING file. ------------------------------------------------------------------------------*/ #ifndef _lucene_index_Term_ #define _lucene_index_Term_ CL_NS_DEF(index) /** A Term represents a word from text. This is the unit of search. It is composed of two elements, the text of the word, as a string, and the name of the field that the text occured in, an interned string. Note that terms may represent more than words from text fields, but also things like dates, email addresses, urls, etc. IMPORTANT NOTE: Term inherits from the template class LUCENE_REFBASE which tries to do some garbage collection by counting the references an instance has. As a result of this construction you MUST use _CLDECDELETE(obj) when you want to delete an of Term! ABOUT intrn intrn indicates if field and text are interned or not. Interning of Strings is the process of converting duplicated strings to shared ones. */ class CLUCENE_EXPORT Term:LUCENE_REFBASE { private: size_t cachedHashCode; const TCHAR* _field; //CLStringIntern::iterator fielditr; #ifdef LUCENE_TERM_TEXT_LENGTH TCHAR _text[LUCENE_TERM_TEXT_LENGTH+1]; #else TCHAR* _text; size_t textLenBuf; //a cache of text len, this allows for a preliminary comparison of text lengths //bool dupT; //Indicates if Term Text is duplicated (and therefore must be deleted). #endif size_t textLen; //a cache of text len, this allows for a preliminary comparison of text lengths bool internF; //Indicates if Term Field is interned(and therefore must be uninternd). public: //uses the specified fieldTerm's field. this saves on intern'ing time. /** Constructs a Term with the given field and text. * <p>Note that a null field or null text value results in undefined * behavior for most Lucene APIs that accept a Term parameter. */ Term(const Term* fieldTerm, const TCHAR* txt); /** Constructs a blank term */ Term(); /** Constructs a Term with the given field and text. * <p>Note that a null field or null text value results in undefined * behavior for most Lucene APIs that accept a Term parameter. */ Term(const TCHAR* fld, const TCHAR* txt, bool internField); /** * Constructor. Constructs a Term with the given field and text. Field and text are not copied * Field and text are deleted in destructor only if intern is false. * <p>Note that a null field or null text value results in undefined * behavior for most Lucene APIs that accept a Term parameter. */ Term(const TCHAR* fld, const TCHAR* txt); ///Destructor. ~Term(); ///Returns the field of this term, an interned string. The field indicates ///the part of a document which this term came from. const TCHAR* field() const; ///<returns reference ///Returns the text of this term. In the case of words, this is simply the ///text of the word. In the case of dates and other types, this is an ///encoding of the object as a string. const TCHAR* text() const; ///<returns reference ///Resets the field and text of a Term. inline void set(const TCHAR* fld, const TCHAR* txt){ set(fld,txt,true); } /** * Optimized set of Term by reusing same field as this Term * - avoids field.intern() overhead * @param text The text of the new term (field is implicitly same as this Term instance) */ void set(const Term* term, const TCHAR* txt); void set(const TCHAR* fld, const TCHAR* txt, const bool internField); /** Compares two terms, returning a negative integer if this term belongs before the argument, zero if this term is equal to the argument, and a positive integer if this term belongs after the argument. The ordering of terms is first by field, then by text.*/ int32_t compareTo(const Term* other) const; /** Compares two terms, returning a negative integer if this term belongs before the argument, zero if this term is equal to the argument, and a positive integer if this term belongs after the argument. The ordering of terms is purely on the hashCode, so is not a logical ordering, but is repeatable. Note: can't be const because call the to hashCode is not const */ int32_t hashedCompareTo(Term* other); bool equals(const Term* other) const; size_t textLength() const; ///Forms the contents of Field and term in some kind of tuple notation ///<field:text> TCHAR* toString() const; size_t hashCode(); }; class Term_UnorderedCompare:LUCENE_BASE, public CL_NS(util)::Compare::_base //<Term*> { public: bool operator()( Term* t1, Term* t2 ) const{ return ( t1->hashedCompareTo(t2) < 0 ); } size_t operator()( Term* t ) const{ return t->hashCode(); } }; CL_NS_END #endif
// Low-level functions for atomic operations: x86, x >= 3 version -*- C++ -*- // Copyright (C) 2003 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the // terms of the GNU General Public License as published by the // Free Software Foundation; either version 2, or (at your option) // any later version. // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate // templates or use macros or inline functions from this file, or you compile // this file and link it with other files to produce an executable, this // file does not by itself cause the resulting executable to be covered by // the GNU General Public License. This exception does not however // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. #ifndef _BITS_ATOMICITY_H #define _BITS_ATOMICITY_H 1 typedef int _Atomic_word; template <int __inst> struct __Atomicity_lock { static volatile _Atomic_word _S_atomicity_lock; }; template <int __inst> volatile _Atomic_word __Atomicity_lock<__inst>::_S_atomicity_lock = 0; template volatile _Atomic_word __Atomicity_lock<0>::_S_atomicity_lock; static inline _Atomic_word __attribute__ ((__unused__)) __exchange_and_add (volatile _Atomic_word *__mem, int __val) { register _Atomic_word __result, __tmp = 1; /* obtain the atomic exchange/add spin lock */ do { __asm__ __volatile__ ("xchg{l} {%0,%1|%1,%0}" : "+m" (__Atomicity_lock<0>::_S_atomicity_lock), "+r" (__tmp)); } while (__tmp); __result = *__mem; *__mem += __val; /* release spin lock */ __Atomicity_lock<0>::_S_atomicity_lock = 0; return __result; } static inline void __attribute__ ((__unused__)) __atomic_add (volatile _Atomic_word* __mem, int __val) { __exchange_and_add (__mem, __val); } #endif /* atomicity.h */
#pragma once #include "envoy/registry/registry.h" #include "envoy/server/instance.h" #include "server/configuration_impl.h" namespace Envoy { namespace Extensions { namespace StatSinks { namespace MetricsService { /** * Config registration for the MetricsService stats sink. @see StatsSinkFactory. */ class MetricsServiceSinkFactory : Logger::Loggable<Logger::Id::config>, public Server::Configuration::StatsSinkFactory { public: Stats::SinkPtr createStatsSink(const Protobuf::Message& config, Server::Instance& server) override; ProtobufTypes::MessagePtr createEmptyConfigProto() override; std::string name() const override; }; DECLARE_FACTORY(MetricsServiceSinkFactory); } // namespace MetricsService } // namespace StatSinks } // namespace Extensions } // namespace Envoy
/* * $Id: Timer.h 862 2008-10-24 02:13:57Z takaya $ * Copyright (C) 2008 AIST, National Institute of Advanced Industrial Science and Technology */ #ifdef TIMER #if defined(__MICROBLAZE__) || defined(__PPC__) # include <xtmrctr.h> # define MAX_LOG 40 /* * Xilinx EDK environment doesn't provide strings.h which has the prototyp declaration of bzero(). * We don't know the reason. */ extern void bzero (void *__s, size_t __n); void Timer_Initialize(); void Timer(u8* String); void Timer_Start(u8 id); void Timer_End(u8 id, u8* String); void Show_Log(); #endif /* (__MICROBLASE__) || (__PPC__) */ #else #define Timer_Initialize() (0) #define Timer(x) (0) #define Timer_Start(x) (0) #define Timer_End(x,y) (0) #define Show_Log() #endif /* TIMER */
// Copyright 2014 The University of Edinburgh. // // 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 FIBONACCI_H #define FIBONACCI_H /** * Fibonacci numbers class. */ class Fibonacci { public: /** * Calculate the Fibonacci number of the given integer. * * @param n * @return Fibonacci number. */ static unsigned int fibonacci(unsigned int n) { if (n < 2) { return n; } else { return fibonacci(n - 1) + fibonacci(n - 2); } } }; #endif
/**************************************************************************** Copyright (c) 2013 cocos2d-x.org http://www.cocos2d-x.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ #ifndef __CCDISPLAYMANAGER_H__ #define __CCDISPLAYMANAGER_H__ #include "../utils/CCArmatureDefine.h" #include "../display/CCDecorativeDisplay.h" #include "../datas/CCDatas.h" NS_CC_EXT_BEGIN class CCBone; /**! CCDisplayManager manages CCBone's display * @js NA * @lua NA */ class CCDisplayManager : public CCObject { public: static CCDisplayManager *create(CCBone *bone); public: CCDisplayManager(); ~CCDisplayManager(); bool init(CCBone *bone); /** * Use CCBoneData to init the display list. * If display is a sprite, and it have texture info in the TexutreData, then use TexutreData to init the display's anchor point * If the display is a CCArmature, then create a new CCArmature */ virtual void initDisplayList(CCBoneData *boneData); /** * Add display and use _DisplayData init the display. * If index already have a display, then replace it. * If index is current display index, then also change display to _index * * @param displayData it include the display information, like DisplayType. * If you want to create a sprite display, then create a CCSpriteDisplayData param * * @param index the index of the display you want to replace or add to * -1 : append display from back */ void addDisplay(CCDisplayData *displayData, int index); void addDisplay(CCNode *display, int index); void removeDisplay(int index); CCArray *getDecorativeDisplayList(); /** * @deprecated please use changeDisplayWithIndex and changeDisplayWithName */ CC_DEPRECATED_ATTRIBUTE void changeDisplayByIndex(int index, bool force); CC_DEPRECATED_ATTRIBUTE void changeDisplayByName(const char *name, bool force); /** * Change display by index. You can just use this method to change display in the display list. * The display list is just used for this bone, and it is the displays you may use in every frame. * * Note : if index is the same with prev index, the method will not effect * * @param index The index of the display you want to change * @param force If true, then force change display to specified display, or current display will set to display index edit in the flash every key frame. */ void changeDisplayWithIndex(int index, bool force); void changeDisplayWithName(const char *name, bool force); CCNode *getDisplayRenderNode(); DisplayType getDisplayRenderNodeType(); int getCurrentDisplayIndex(); virtual void setCurrentDecorativeDisplay(CCDecorativeDisplay *decoDisplay); virtual CCDecorativeDisplay *getCurrentDecorativeDisplay(); virtual CCDecorativeDisplay *getDecorativeDisplayByIndex( int index); /** * Sets whether the display is visible * The default value is true, a node is default to visible * * @param visible true if the node is visible, false if the node is hidden. */ virtual void setVisible(bool visible); /** * Determines if the display is visible * * @see setVisible(bool) * @return true if the node is visible, false if the node is hidden. */ virtual bool isVisible(); CCSize getContentSize(); CCRect getBoundingBox(); CCPoint getAnchorPoint(); CCPoint getAnchorPointInPoints(); /** * Check if the position is inside the bone. */ virtual bool containPoint(CCPoint &_point); /** * Check if the position is inside the bone. */ virtual bool containPoint(float x, float y); protected: CCArray *m_pDecoDisplayList; //! Display render node. CCNode *m_pDisplayRenderNode; //! Display render node type DisplayType m_eDisplayType; //! Include current display information, like contour sprite, etc. CCDecorativeDisplay *m_pCurrentDecoDisplay; //! Current display index int m_iDisplayIndex; CC_SYNTHESIZE(bool, m_bForceChangeDisplay, ForceChangeDisplay) //! Whether of not the bone is visible. Default is true bool m_bVisible; CCBone *m_pBone; }; NS_CC_EXT_END #endif /*__CCDISPLAYMANAGER_H__*/
/* * Copyright (C) 2013 The Android Open Source Project * * 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 ART_RUNTIME_ARCH_ARM_ASM_SUPPORT_ARM_H_ #define ART_RUNTIME_ARCH_ARM_ASM_SUPPORT_ARM_H_ #include "asm_support.h" #define FRAME_SIZE_SAVE_ALL_CALLEE_SAVE 112 #define FRAME_SIZE_REFS_ONLY_CALLEE_SAVE 32 #define FRAME_SIZE_REFS_AND_ARGS_CALLEE_SAVE 112 // Flag for enabling R4 optimization in arm runtime // #define ARM_R4_SUSPEND_FLAG #endif // ART_RUNTIME_ARCH_ARM_ASM_SUPPORT_ARM_H_
/* * Copyright 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. */ #pragma once int start_negotiate_benchmark_server(int argc, char **argv);
#include<stdlib.h> #include <OneWire.h> #include <DallasTemperature.h> #define ONE_WIRE_BUS 8 OneWire oneWire(ONE_WIRE_BUS); DallasTemperature sensors(&oneWire); #define SSID "YOUR SSID HERE" #define PASS "YOUR PASSWORD HERE" #define IP "184.106.153.149" // thingspeak.com String GET = "GET /update?key=YOURTHINGSPEAKAPIKEY&field2="; void setup() { Serial.begin(115200); sensors.begin(); Serial.println("AT"); delay(5000); if(Serial.find("OK")){ connectWiFi(); } } void loop(){ sensors.requestTemperatures(); float tempC = sensors.getTempCByIndex(0); //tempC = DallasTemperature::toFahrenheit(tempC); char buffer[10]; String tempF = dtostrf(tempC, 4, 1, buffer); updateTemp(tempF); //Serial.println(tempF); delay(60000); } void updateTemp(String tempF){ String cmd = "AT+CIPSTART=\"TCP\",\""; cmd += IP; cmd += "\",80"; Serial.println(cmd); delay(2000); if(Serial.find("Error")){ return; } cmd = GET; cmd += tempF; cmd += "\r\n"; Serial.print("AT+CIPSEND="); Serial.println(cmd.length()); //delay(1000); if(Serial.find(">")){ Serial.print(cmd); }else{ Serial.println("AT+CIPCLOSE"); } } boolean connectWiFi(){ Serial.println("AT+CWMODE=3"); delay(2000); String cmd="AT+CWJAP=\""; cmd+=SSID; cmd+="\",\""; cmd+=PASS; cmd+="\""; Serial.println(cmd); delay(5000); if(Serial.find("OK")){ return true; }else{ return false; } } After managing to send data to web, I tried to implement a webserver which can post data to my network, from where I can monitor that incoming wifi stream with my browser... Found a wonderful sketch on the net which is written by Ray Wang to test wifi sensor node by ESP8266 unit.... works like a charm... I can monitor all my analog ports with this sketch... easy to be modified to one's needs for other ports... The sketch enables the wifi unit, connects to your wifi network via WPA2-PSK, gets an IP adress from the router and you can monitor your sensor node in your beowser using the unit's IP at port 8080... /* ====== ESP8266 Demo ====== * Print out analog values * ========================== * * Change SSID and PASS to match your WiFi settings. * The IP address is displayed to soft serial upon successful connection. * * Ray Wang @ Rayshobby LLC * http://rayshobby.net/?p=9734 */ // comment this part out if not using LCD debug #include <SoftwareSerial.h> SoftwareSerial dbg(7, 8); // using pin 7, 8 for software serial enum {WIFI_ERROR_NONE=0, WIFI_ERROR_AT, WIFI_ERROR_RST, WIFI_ERROR_SSIDPWD, WIFI_ERROR_SERVER, WIFI_ERROR_UNKNOWN}; #define BUFFER_SIZE 128 #define SSID "YOURSSID" // change this to match your WiFi SSID #define PASS "YOURPASS" // change this to match your WiFi password #define PORT "8080" // using port 8080 by default char buffer[BUFFER_SIZE]; void setup() { Serial.begin(115200); Serial.setTimeout(5000); dbg.begin(9600); dbg.println("begin."); byte err = setupWiFi(); if (err) { // error, print error code dbg.print("setup error:"); dbg.println((int)err); } else { // success, print IP dbg.print("ip addr:"); char *ip = getIP(); if (ip) { dbg.println(ip); } else { dbg.println("none"); } maxTimeout(); } } bool maxTimeout() { // send AT command Serial.println("AT+CIPSTO=0"); if(Serial.find("OK")) { return true; } else { return false; } } char* getIP() { // send AT command Serial.println("AT+CIFSR"); // the response from the module is: // AT+CIFSR\n\n // 192.168.x.x\n // so read util \n three times Serial.readBytesUntil('\n', buffer, BUFFER_SIZE); Serial.readBytesUntil('\n', buffer, BUFFER_SIZE); Serial.readBytesUntil('\n', buffer, BUFFER_SIZE); buffer[strlen(buffer)-1]=0; return buffer; } void loop() { int ch_id, packet_len; char *pb; Serial.readBytesUntil('\n', buffer, BUFFER_SIZE); if(strncmp(buffer, "+IPD,", 5)==0) { // request: +IPD,ch,len:data sscanf(buffer+5, "%d,%d", &ch_id, &packet_len); if (packet_len > 0) { // read serial until packet_len character received // start from : pb = buffer+5; while(*pb!=':') pb++; pb++; if (strncmp(pb, "GET /", 5) == 0) { serve_homepage(ch_id); } } } } void serve_homepage(int ch_id) { String header = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nConnection: close\r\nRefresh: 5\r\n"; String content=""; // output the value of each analog input pin for (int analogChannel = 0; analogChannel < 6; analogChannel++) { int sensorReading = analogRead(analogChannel); content += "analog input "; content += analogChannel; content += " is "; content += sensorReading; content += "<br />\n"; } header += "Content-Length:"; header += (int)(content.length()); header += "\r\n\r\n"; Serial.print("AT+CIPSEND="); Serial.print(ch_id); Serial.print(","); Serial.println(header.length()+content.length()); if (Serial.find(">")) { Serial.print(header); Serial.print(content); delay(20); } /*Serial.print("AT+CIPCLOSE="); Serial.println(ch_id);*/ } byte setupWiFi() { Serial.println("AT"); if(!Serial.find("OK")) { return WIFI_ERROR_AT; } delay(500); // reset WiFi module Serial.println("AT+RST"); if(!Serial.find("ready")) { return WIFI_ERROR_RST; } delay(500); // set mode 3 Serial.print("AT+CWJAP=\""); Serial.print(SSID); Serial.print("\",\""); Serial.print(PASS); Serial.println("\""); delay(2000); if(!Serial.find("OK")) { return WIFI_ERROR_SSIDPWD; } delay(500); // start server Serial.println("AT+CIPMUX=1"); if(!Serial.find("OK")){ return WIFI_ERROR_SERVER; } delay(500); Serial.print("AT+CIPSERVER=1,"); // turn on TCP service Serial.println(PORT); if(!Serial.find("OK")){ return WIFI_ERROR_SERVER; } delay(500); return WIFI_ERROR_NONE; }
/* * cl_ee_handler.h - CL edge enhancement handler. * * Copyright (c) 2015 Intel Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Author: wangfei <feix.w.wang@intel.com> */ #ifndef XCAM_CL_EE_HANLDER_H #define XCAM_CL_EE_HANLDER_H #include "xcam_utils.h" #include "cl_image_handler.h" #include "base/xcam_3a_result.h" namespace XCam { typedef struct { float ee_gain; float ee_threshold; float nr_gain; } CLEeConfig; class CLEeImageKernel : public CLImageKernel { public: explicit CLEeImageKernel (SmartPtr<CLContext> &context); bool set_ee_ee (const XCam3aResultEdgeEnhancement &ee); bool set_ee_nr (const XCam3aResultNoiseReduction &nr); protected: virtual XCamReturn prepare_arguments ( SmartPtr<DrmBoBuffer> &input, SmartPtr<DrmBoBuffer> &output, CLArgument args[], uint32_t &arg_count, CLWorkSize &work_size); private: XCAM_DEAD_COPY (CLEeImageKernel); uint32_t _vertical_offset_in; uint32_t _vertical_offset_out; CLEeConfig _ee_config; }; class CLEeImageHandler : public CLImageHandler { public: explicit CLEeImageHandler (const char *name); bool set_ee_config_ee (const XCam3aResultEdgeEnhancement &ee); bool set_ee_config_nr (const XCam3aResultNoiseReduction &nr); bool set_ee_kernel(SmartPtr<CLEeImageKernel> &kernel); private: XCAM_DEAD_COPY (CLEeImageHandler); SmartPtr<CLEeImageKernel> _ee_kernel; }; SmartPtr<CLImageHandler> create_cl_ee_image_handler (SmartPtr<CLContext> &context); }; #endif //XCAM_CL_EE_HANLDER_H
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/codecommit/CodeCommit_EXPORTS.h> #include <aws/core/utils/memory/stl/AWSVector.h> #include <aws/codecommit/model/Approval.h> #include <utility> namespace Aws { template<typename RESULT_TYPE> class AmazonWebServiceResult; namespace Utils { namespace Json { class JsonValue; } // namespace Json } // namespace Utils namespace CodeCommit { namespace Model { class AWS_CODECOMMIT_API GetPullRequestApprovalStatesResult { public: GetPullRequestApprovalStatesResult(); GetPullRequestApprovalStatesResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); GetPullRequestApprovalStatesResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); /** * <p>Information about users who have approved the pull request.</p> */ inline const Aws::Vector<Approval>& GetApprovals() const{ return m_approvals; } /** * <p>Information about users who have approved the pull request.</p> */ inline void SetApprovals(const Aws::Vector<Approval>& value) { m_approvals = value; } /** * <p>Information about users who have approved the pull request.</p> */ inline void SetApprovals(Aws::Vector<Approval>&& value) { m_approvals = std::move(value); } /** * <p>Information about users who have approved the pull request.</p> */ inline GetPullRequestApprovalStatesResult& WithApprovals(const Aws::Vector<Approval>& value) { SetApprovals(value); return *this;} /** * <p>Information about users who have approved the pull request.</p> */ inline GetPullRequestApprovalStatesResult& WithApprovals(Aws::Vector<Approval>&& value) { SetApprovals(std::move(value)); return *this;} /** * <p>Information about users who have approved the pull request.</p> */ inline GetPullRequestApprovalStatesResult& AddApprovals(const Approval& value) { m_approvals.push_back(value); return *this; } /** * <p>Information about users who have approved the pull request.</p> */ inline GetPullRequestApprovalStatesResult& AddApprovals(Approval&& value) { m_approvals.push_back(std::move(value)); return *this; } private: Aws::Vector<Approval> m_approvals; }; } // namespace Model } // namespace CodeCommit } // namespace Aws
// // UIImage+TPCExtension.h // 百思不得姐 // // Created by tripleCC on 15/1/4. // Copyright (c) 2014年 giftTalk All rights reserved. // #import <UIKit/UIKit.h> @interface UIImage (TPCExtension) - (UIImage *)headerImageWithRandomBorderColor; - (UIImage *)headerImageWithBorderColor:(UIColor *)color; - (UIImage *)imageWithCornerRadius:(CGFloat)cornerRadius; + (UIImage *)imageWithRoundClipImage:(UIImage *)image borderColor:(UIColor *)color borderWidth:(CGFloat)width; @end
/* * * Copyright 2021 gRPC 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 * * 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 GRPC_RB_XDS_CHANNEL_CREDENTIALS_H_ #define GRPC_RB_XDS_CHANNEL_CREDENTIALS_H_ #include <grpc/grpc_security.h> #include <ruby/ruby.h> #include <stdbool.h> /* Initializes the ruby ChannelCredentials class. */ void Init_grpc_xds_channel_credentials(); /* Gets the wrapped credentials from the ruby wrapper */ grpc_channel_credentials* grpc_rb_get_wrapped_xds_channel_credentials(VALUE v); /* Check if v is kind of XdsChannelCredentials */ bool grpc_rb_is_xds_channel_credentials(VALUE v); #endif /* GRPC_RB_XDS_CHANNEL_CREDENTIALS_H_ */
#ifndef _fefas_align_h #define _fefas_align_h #if defined(__AVX__) || defined(__xlc__) // Assume these compilers support __attribute__((aligned(32))) # define _align __attribute__((aligned(32))) /* AVX packed instructions need 32-byte alignment */ #elif defined(__GNUC__) # define _align __attribute__((aligned(16))) /* SSE instructions need 16-byte alignment */ #else # define _align #endif #endif
// Copyright 2017 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 THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_CANVAS_COLOR_PARAMS_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_CANVAS_COLOR_PARAMS_H_ #include "components/viz/common/resources/resource_format.h" #include "third_party/blink/renderer/platform/graphics/graphics_types.h" #include "third_party/blink/renderer/platform/platform_export.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" #include "third_party/skia/include/core/SkColorSpace.h" #include "third_party/skia/include/core/SkImageInfo.h" #include "ui/gfx/buffer_types.h" namespace gfx { class ColorSpace; } namespace blink { enum class CanvasColorSpace { kSRGB, kRec2020, kP3, }; enum class CanvasPixelFormat { kUint8, kF16, }; constexpr const char* kSRGBCanvasColorSpaceName = "srgb"; constexpr const char* kRec2020CanvasColorSpaceName = "rec2020"; constexpr const char* kP3CanvasColorSpaceName = "display-p3"; constexpr const char* kUint8CanvasPixelFormatName = "uint8"; constexpr const char* kF16CanvasPixelFormatName = "float16"; // Return the CanvasColorSpace for the specified |name|. On invalid inputs, // returns CanvasColorSpace::kSRGB. CanvasColorSpace PLATFORM_EXPORT CanvasColorSpaceFromName(const String& color_space_name); String PLATFORM_EXPORT CanvasColorSpaceToName(CanvasColorSpace color_space); // Return the SkColorSpace for the specified |color_space|. sk_sp<SkColorSpace> PLATFORM_EXPORT CanvasColorSpaceToSkColorSpace(CanvasColorSpace color_space); // Return the named CanvasColorSpace that best matches |sk_color_space|. CanvasColorSpace PLATFORM_EXPORT CanvasColorSpaceFromSkColorSpace(const SkColorSpace* sk_color_space); class PLATFORM_EXPORT CanvasColorParams { DISALLOW_NEW(); public: // The default constructor will create an output-blended 8-bit surface. CanvasColorParams(); CanvasColorParams(CanvasColorSpace, CanvasPixelFormat, OpacityMode); CanvasColorParams(const WTF::String& color_space, const WTF::String& pixel_format, bool has_alpha); CanvasColorSpace ColorSpace() const { return color_space_; } CanvasPixelFormat PixelFormat() const { return pixel_format_; } OpacityMode GetOpacityMode() const { return opacity_mode_; } String GetColorSpaceAsString() const; const char* GetPixelFormatAsString() const; SkColorInfo GetSkColorInfo() const; // The pixel format to use for allocating SkSurfaces. SkColorType GetSkColorType() const; // Return the color space of the underlying data for the canvas. gfx::ColorSpace GetStorageGfxColorSpace() const; sk_sp<SkColorSpace> GetSkColorSpace() const; uint8_t BytesPerPixel() const; private: CanvasColorSpace color_space_ = CanvasColorSpace::kSRGB; CanvasPixelFormat pixel_format_ = CanvasPixelFormat::kUint8; OpacityMode opacity_mode_ = kNonOpaque; }; } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_CANVAS_COLOR_PARAMS_H_
/* * Copyright (c) 2009 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * * Portions Copyright (c) 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * 3. Neither the name of the Institute nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "netlogon.h" OM_uint32 _netlogon_process_context_token ( OM_uint32 *minor_status, gss_const_ctx_id_t context_handle, const gss_buffer_t token_buffer ) { *minor_status = 0; return GSS_S_COMPLETE; }
// ============================================================================= // PROJECT CHRONO - http://projectchrono.org // // Copyright (c) 2014 projectchrono.org // All rights reserved. // // Use of this source code is governed by a BSD-style license that can be found // in the LICENSE file at the top level of the distribution and at // http://projectchrono.org/license-chrono.txt. // // ============================================================================= // Authors: Radu Serban // ============================================================================= // // 4WD driveline model template based on ChShaft objects using data from file // (JSON format). // // ============================================================================= #ifndef SHAFTS_DRIVELINE_4WD_H #define SHAFTS_DRIVELINE_4WD_H #include "chrono_vehicle/ChApiVehicle.h" #include "chrono_vehicle/wheeled_vehicle/driveline/ChShaftsDriveline4WD.h" #include "chrono_thirdparty/rapidjson/document.h" namespace chrono { namespace vehicle { /// @addtogroup vehicle_wheeled_driveline /// @{ /// 4WD driveline model template based on ChShaft objects using data from file (JSON format). class CH_VEHICLE_API ShaftsDriveline4WD : public ChShaftsDriveline4WD { public: ShaftsDriveline4WD(const std::string& filename); ShaftsDriveline4WD(const rapidjson::Document& d); ~ShaftsDriveline4WD() {} virtual double GetCentralDifferentialBoxInertia() const override { return m_central_differentialbox_inertia; } virtual double GetFrontDifferentialBoxInertia() const override { return m_front_differentialbox_inertia; } virtual double GetRearDifferentialBoxInertia() const override { return m_rear_differentialbox_inertia; } virtual double GetDriveshaftInertia() const override { return m_driveshaft_inertia; } virtual double GetToFrontDiffShaftInertia() const override { return m_frontshaft_inertia; } virtual double GetToRearDiffShaftInertia() const override { return m_rearshaft_inertia; } virtual double GetFrontConicalGearRatio() const override { return m_front_conicalgear_ratio; } virtual double GetRearConicalGearRatio() const override { return m_rear_conicalgear_ratio; } virtual double GetAxleDifferentialLockingLimit() const override { return m_axle_differential_locking_limit; } virtual double GetCentralDifferentialLockingLimit() const override { return m_central_differential_locking_limit; } private: virtual void Create(const rapidjson::Document& d) override; // Shaft inertias. double m_central_differentialbox_inertia; double m_front_differentialbox_inertia; double m_rear_differentialbox_inertia; double m_driveshaft_inertia; double m_frontshaft_inertia; double m_rearshaft_inertia; // Gear ratios. double m_front_conicalgear_ratio; double m_rear_conicalgear_ratio; // Differential locking torque limit. double m_axle_differential_locking_limit; double m_central_differential_locking_limit; }; /// @} vehicle_wheeled_driveline } // end namespace vehicle } // end namespace chrono #endif
///////////////////////////////////////////////////////////////////////////// // // filecache - code for background file reading/caching // ///////////////////////////////////////////////////////////////////////////// #ifndef FILECACHE_H #define FILECACHE_H ///////////////////////////////////////////////////////////////////////////// // // BLOCKS MUST BE 255 OR LESS // // hint: if you set realfd to a negative number, that means it'll use the // gdrom routines to read a pak file starting at that (positive) lba // void filecache_init(int realfd, int pakcdsectors, int blocksize, unsigned char blocks, int vfds); // // Clear All Allocations // void filecache_term(void); // // attempt to read a block // returns the number of bytes read or 0 on error // int filecache_readpakblock(unsigned char *dest, int pakblock, int startofs, int bytes, int blocking); // // set up where the vfd pointers are // void filecache_setvfd(int vfd, int start, int block, int readahead); // // call this every now and then // void filecache_process(void); void filecache_wait_for_prebuffer(int vfd, int nblocks); ///////////////////////////////////////////////////////////////////////////// #endif
/*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Chris Torek. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include <sys/cdefs.h> #include <string.h> /* * Copy a block of memory, handling overlap. * This is the routine that actually implements * (the portable versions of) bcopy, memcpy, and memmove. */ #ifdef MEMCOPY void * memcpy(dst0, src0, length) #else #ifdef MEMMOVE void * memmove(dst0, src0, length) #else void bcopy(src0, dst0, length) #endif #endif void *dst0; const void *src0; size_t length; { char *dst = dst0; const char *src = src0; if (length == 0 || dst == src) /* nothing to do */ goto done; if (((unsigned long)dst < (unsigned long)src) && ((unsigned long)dst < (unsigned long)src + length)) { /* Copy backwards. */ src += length; dst += length; while (length--) { *--dst = *--src; } } else { while (length--) { *dst++ = *src++; } } done: #if defined(MEMCOPY) || defined(MEMMOVE) return (dst0); #else return; #endif }
// Copyright (c) 2011 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_COMMON_QUOTA_DISPATCHER_H_ #define CONTENT_COMMON_QUOTA_DISPATCHER_H_ #include <map> #include <set> #include "base/basictypes.h" #include "base/id_map.h" #include "ipc/ipc_channel.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageQuotaError.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageQuotaType.h" class GURL; namespace IPC { class Message; } namespace WebKit { class WebStorageQuotaCallbacks; } // Dispatches and sends quota related messages sent to/from a child // process from/to the main browser process. There is one instance // per child process. Messages are dispatched on the main child thread. class QuotaDispatcher : public IPC::Channel::Listener { public: QuotaDispatcher(); ~QuotaDispatcher(); // IPC::Channel::Listener implementation. virtual bool OnMessageReceived(const IPC::Message& msg); void QueryStorageUsageAndQuota(const GURL& gurl, WebKit::WebStorageQuotaType type, WebKit::WebStorageQuotaCallbacks* callbacks); void RequestStorageQuota(const GURL& gurl, WebKit::WebStorageQuotaType type, unsigned long long requested_size, WebKit::WebStorageQuotaCallbacks* callbacks); private: // Message handlers. void DidQueryStorageUsageAndQuota(int request_id, int64 current_usage, int64 current_quota); void DidGrantStorageQuota(int request_id, int64 granted_quota); void DidFail(int request_id, WebKit::WebStorageQuotaError error); IDMap<WebKit::WebStorageQuotaCallbacks> pending_quota_callbacks_; DISALLOW_COPY_AND_ASSIGN(QuotaDispatcher); }; #endif // CONTENT_COMMON_QUOTA_DISPATCHER_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 DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_ADAPTER_H_ #define DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_ADAPTER_H_ #include <string> #include "base/callback.h" #include "device/bluetooth/bluetooth_adapter.h" #include "device/bluetooth/bluetooth_device.h" #include "testing/gmock/include/gmock/gmock.h" namespace device { class MockBluetoothAdapter : public BluetoothAdapter { public: class Observer : public BluetoothAdapter::Observer { public: Observer(); virtual ~Observer(); MOCK_METHOD2(AdapterPresentChanged, void(BluetoothAdapter*, bool)); MOCK_METHOD2(AdapterPoweredChanged, void(BluetoothAdapter*, bool)); MOCK_METHOD2(AdapterDiscoveringChanged, void(BluetoothAdapter*, bool)); MOCK_METHOD2(AdapterScanningChanged, void(BluetoothAdapter*, bool)); MOCK_METHOD2(DeviceAdded, void(BluetoothAdapter*, BluetoothDevice*)); MOCK_METHOD2(DeviceChanged, void(BluetoothAdapter*, BluetoothDevice*)); MOCK_METHOD2(DeviceRemoved, void(BluetoothAdapter*, BluetoothDevice*)); }; MockBluetoothAdapter(const std::string& address, const std::string& name); MOCK_METHOD1(AddObserver, void(BluetoothAdapter::Observer*)); MOCK_METHOD1(RemoveObserver, void(BluetoothAdapter::Observer*)); MOCK_CONST_METHOD0(IsInitialized, bool()); MOCK_CONST_METHOD0(IsPresent, bool()); MOCK_CONST_METHOD0(IsPowered, bool()); MOCK_METHOD3(SetPowered, void(bool discovering, const base::Closure& callback, const ErrorCallback& error_callback)); MOCK_CONST_METHOD0(IsDiscovering, bool()); MOCK_CONST_METHOD0(IsScanning, bool()); MOCK_METHOD2(StartDiscovering, void(const base::Closure& callback, const ErrorCallback& error_callback)); MOCK_METHOD2(StopDiscovering, void(const base::Closure& callback, const ErrorCallback& error_callback)); MOCK_CONST_METHOD0(GetDevices, BluetoothAdapter::ConstDeviceList()); MOCK_METHOD1(GetDevice, BluetoothDevice*(const std::string& address)); MOCK_CONST_METHOD1(GetDevice, const BluetoothDevice*(const std::string& address)); MOCK_METHOD2( ReadLocalOutOfBandPairingData, void(const BluetoothOutOfBandPairingDataCallback& callback, const ErrorCallback& error_callback)); protected: virtual ~MockBluetoothAdapter(); }; } // namespace device #endif // DEVICE_BLUETOOTH_TEST_MOCK_BLUETOOTH_ADAPTER_H_
// // SUHost.h // Sparkle // // Copyright 2008 Andy Matuschak. All rights reserved. // #import "Sparkle.h" @interface SUHost : NSObject { @private NSBundle *bundle; } + (NSString *)systemVersionString; - (id)initWithBundle:(NSBundle *)aBundle; - (NSBundle *)bundle; - (NSString *)bundlePath; - (NSString *)name; - (NSString *)version; - (NSString *)displayVersion; - (NSImage *)icon; - (BOOL)isRunningOnReadOnlyVolume; - (BOOL)isBackgroundApplication; - (NSString *)publicDSAKey; - (NSArray *)systemProfile; - (id)objectForInfoDictionaryKey:(NSString *)key; - (BOOL)boolForInfoDictionaryKey:(NSString *)key; - (id)objectForUserDefaultsKey:(NSString *)defaultName; - (void)setObject:(id)value forUserDefaultsKey:(NSString *)defaultName; - (BOOL)boolForUserDefaultsKey:(NSString *)defaultName; - (void)setBool:(BOOL)value forUserDefaultsKey:(NSString *)defaultName; - (id)objectForKey:(NSString *)key; - (BOOL)boolForKey:(NSString *)key; @end
// RUN: rm -fr %t.promo.prof // RUN: rm -fr %t.nopromo.prof // RUN: %clang_pgogen=%t.promo.prof/ -o %t.promo.gen -O2 %s // RUN: %clang_pgogen=%t.promo.prof/ -o %t.promo.gen.ll -emit-llvm -S -O2 %s // RUN: cat %t.promo.gen.ll | FileCheck --check-prefix=PROMO %s // RUN: %run %t.promo.gen // RUN: llvm-profdata merge -o %t.promo.profdata %t.promo.prof/ // RUN: llvm-profdata show --counts --all-functions %t.promo.profdata > %t.promo.dump // RUN: %clang_pgogen=%t.nopromo.prof/ -mllvm -do-counter-promotion=false -o %t.nopromo.gen -O2 %s // RUN: %clang_pgogen=%t.nopromo.prof/ -mllvm -do-counter-promotion=false -o %t.nopromo.gen.ll -emit-llvm -S -O2 %s // RUN: cat %t.nopromo.gen.ll | FileCheck --check-prefix=NOPROMO %s // RUN: %run %t.nopromo.gen // RUN: llvm-profdata merge -o %t.nopromo.profdata %t.nopromo.prof/ // RUN: llvm-profdata show --counts --all-functions %t.nopromo.profdata > %t.nopromo.dump // RUN: diff %t.promo.profdata %t.nopromo.profdata int g; __attribute__((noinline)) void bar(int i) { g += i; } __attribute__((noinline)) void foo(int n, int N) { // PROMO-LABEL: @foo // PROMO: load{{.*}}@__profc_foo{{.*}} 3){{.*}} // PROMO-NEXT: add // PROMO-NEXT: store{{.*}}@__profc_foo{{.*}} 3){{.*}} // PROMO: load{{.*}}@__profc_foo{{.*}} 0){{.*}} // PROMO-NEXT: add // PROMO-NEXT: store{{.*}}@__profc_foo{{.*}} 0){{.*}} // PROMO-NEXT: load{{.*}}@__profc_foo{{.*}} 1){{.*}} // PROMO-NEXT: add // PROMO-NEXT: store{{.*}}@__profc_foo{{.*}} 1){{.*}} // PROMO: load{{.*}}@__profc_foo{{.*}} 2){{.*}} // PROMO-NEXT: add // PROMO-NEXT: store{{.*}}@__profc_foo{{.*}} 2){{.*}} // // NOPROMO-LABEL: @foo // NOPROMO: load{{.*}}@__profc_foo{{.*}} 0){{.*}} // NOPROMO-NEXT: add // NOPROMO-NEXT: store{{.*}}@__profc_foo{{.*}} 0){{.*}} // NOPROMO: load{{.*}}@__profc_foo{{.*}} 1){{.*}} // NOPROMO-NEXT: add // NOPROMO-NEXT: store{{.*}}@__profc_foo{{.*}} 1){{.*}} // NOPROMO: load{{.*}}@__profc_foo{{.*}} 2){{.*}} // NOPROMO-NEXT: add // NOPROMO-NEXT: store{{.*}}@__profc_foo{{.*}} 2){{.*}} int i; for (i = 0; i < N; i++) { if (i < n + 1) bar(1); else if (i < n - 1) bar(2); else bar(3); } } int main() { foo(10, 20); return 0; }
// 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 REMOTING_HOST_POLICY_HACK_POLICY_WATCHER_H_ #define REMOTING_HOST_POLICY_HACK_POLICY_WATCHER_H_ #include "base/callback.h" #include "base/memory/weak_ptr.h" #include "base/values.h" namespace base { class SingleThreadTaskRunner; class TimeDelta; class WaitableEvent; } // namespace base namespace remoting { namespace policy_hack { // Watches for changes to the managed remote access host policies. // If StartWatching() has been called, then before this object can be deleted, // StopWatching() have completed (the provided |done| event must be signaled). class PolicyWatcher { public: // Called first with all policies, and subsequently with any changed policies. typedef base::Callback<void(scoped_ptr<base::DictionaryValue>)> PolicyCallback; explicit PolicyWatcher( scoped_refptr<base::SingleThreadTaskRunner> task_runner); virtual ~PolicyWatcher(); // This guarantees that the |policy_callback| is called at least once with // the current policies. After that, |policy_callback| will be called // whenever a change to any policy is detected. It will then be called only // with the changed policies. virtual void StartWatching(const PolicyCallback& policy_callback); // Should be called after StartWatching() before the object is deleted. Calls // just wait for |done| to be signaled before deleting the object. virtual void StopWatching(base::WaitableEvent* done); // Implemented by each platform. This message loop should be an IO message // loop. static PolicyWatcher* Create( scoped_refptr<base::SingleThreadTaskRunner> task_runner); // The name of the NAT traversal policy. static const char kNatPolicyName[]; // The name of the policy for requiring 2-factor authentication. static const char kHostRequireTwoFactorPolicyName[]; // The name of the host domain policy. static const char kHostDomainPolicyName[]; // The name of the policy that controls the host talkgadget prefix. static const char kHostTalkGadgetPrefixPolicyName[]; // The name of the policy for requiring curtain-mode. static const char kHostRequireCurtainPolicyName[]; protected: virtual void StartWatchingInternal() = 0; virtual void StopWatchingInternal() = 0; virtual void Reload() = 0; // Used to check if the class is on the right thread. bool OnPolicyWatcherThread() const; // Takes the policy dictionary from the OS specific store and extracts the // relevant policies. void UpdatePolicies(const base::DictionaryValue* new_policy); // Used for time-based reloads in case something goes wrong with the // notification system. void ScheduleFallbackReloadTask(); void ScheduleReloadTask(const base::TimeDelta& delay); // The names of policies with boolean values. static const char* const kBooleanPolicyNames[]; static const int kBooleanPolicyNamesNum; // The names of policies with string values. static const char* const kStringPolicyNames[]; static const int kStringPolicyNamesNum; private: scoped_refptr<base::SingleThreadTaskRunner> task_runner_; PolicyCallback policy_callback_; scoped_ptr<base::DictionaryValue> old_policies_; // Allows us to cancel any inflight FileWatcher events or scheduled reloads. base::WeakPtrFactory<PolicyWatcher> weak_factory_; }; } // namespace policy_hack } // namespace remoting #endif // REMOTING_HOST_POLICY_HACK_POLICY_WATCHER_H_
/** * This file has no copyright assigned and is placed in the Public Domain. * This file is part of the mingw-w64 runtime package. * No warranty is given; refer to the file DISCLAIMER.PD within this package. */ #define __FP_SIGNBIT 0x0200 int __signbitf (float x); typedef union __mingw_flt_type_t { float x; unsigned int val; } __mingw_flt_type_t; int __signbitf (float x) { #if defined(__x86_64__) || defined(_AMD64_) || defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_) __mingw_flt_type_t hlp; hlp.x = x; return ((hlp.val & 0x80000000) != 0); #elif defined(__i386__) || defined(_X86_) unsigned short sw; __asm__ __volatile__ ("fxam; fstsw %%ax;" : "=a" (sw) : "t" (x) ); return (sw & __FP_SIGNBIT) != 0; #endif } int __attribute__ ((alias ("__signbitf"))) signbitf (float);
/* Copyright (C) 1989, 1990 Aladdin Enterprises. All rights reserved. Distributed by Free Software Foundation, Inc. This file is part of Ghostscript. Ghostscript is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY. No author or distributor accepts responsibility to anyone for the consequences of using it or for whether it serves any particular purpose or works at all, unless he says so in writing. Refer to the Ghostscript General Public License for full details. Everyone is granted permission to copy, modify and redistribute Ghostscript, but only under the conditions described in the Ghostscript General Public License. A copy of this license is supposed to have been given to you along with Ghostscript so you can know your rights and responsibilities. It should be in a file named COPYING. Among other things, the copyright notice and this notice must be preserved on all copies. */ /* gspaint.h */ /* Painting interface for GhostScript library */ /* Requires gsstate.h and gsmatrix.h */ /* Painting */ int gs_erasepage(P1(gs_state *)), gs_fill(P1(gs_state *)), gs_eofill(P1(gs_state *)), gs_stroke(P1(gs_state *)); /* Image painting */ int gs_colorimage(P7(gs_state *, int, int, int, int, gs_matrix *, byte *)), gs_image(P6(gs_state *, int, int, int, gs_matrix *, byte *)), gs_imagemask(P6(gs_state *, int, int, int, gs_matrix *, byte *)); /* Enumeration-style image painting */ typedef struct gs_image_enum_s gs_image_enum; extern int gs_image_enum_sizeof; int gs_image_init(P7(gs_image_enum *, gs_state *, int, int, int, int, gs_matrix *)), gs_imagemask_init(P6(gs_image_enum *, gs_state *, int, int, int, gs_matrix *)), gs_image_next(P3(gs_image_enum *, byte *, uint));
// // Copyright (c) 2008-2017 the Urho3D project. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #pragma once #include "../Scene/Component.h" #include "../Urho2D/TileMapDefs2D.h" #ifdef GetObject #undef GetObject #endif namespace Urho3D { class DebugRenderer; class Node; class TileMap2D; class TmxImageLayer2D; class TmxLayer2D; class TmxObjectGroup2D; class TmxTileLayer2D; /// Tile map component. class URHO3D_API TileMapLayer2D : public Component { URHO3D_OBJECT(TileMapLayer2D, Component); public: /// Construct. TileMapLayer2D(Context* context); /// Destruct. virtual ~TileMapLayer2D() override; /// Register object factory. static void RegisterObject(Context* context); /// Add debug geometry to the debug renderer. virtual void DrawDebugGeometry(DebugRenderer* debug, bool depthTest) override; /// Initialize with tile map and tmx layer. void Initialize(TileMap2D* tileMap, const TmxLayer2D* tmxLayer); /// Set draw order void SetDrawOrder(int drawOrder); /// Set visible. void SetVisible(bool visible); /// Return tile map. TileMap2D* GetTileMap() const; /// Return tmx layer. const TmxLayer2D* GetTmxLayer() const { return tmxLayer_; } /// Return draw order. int GetDrawOrder() const { return drawOrder_; } /// Return visible. bool IsVisible() const { return visible_; } /// Return has property bool HasProperty(const String& name) const; /// Return property. const String& GetProperty(const String& name) const; /// Return layer type. TileMapLayerType2D GetLayerType() const; /// Return width (for tile layer only). int GetWidth() const; /// Return height (for tile layer only). int GetHeight() const; /// Return tile node (for tile layer only). Node* GetTileNode(int x, int y) const; /// Return tile (for tile layer only). Tile2D* GetTile(int x, int y) const; /// Return number of tile map objects (for object group only). unsigned GetNumObjects() const; /// Return tile map object (for object group only). TileMapObject2D* GetObject(unsigned index) const; /// Return object node (for object group only). Node* GetObjectNode(unsigned index) const; /// Return image node (for image layer only). Node* GetImageNode() const; private: /// Set tile layer. void SetTileLayer(const TmxTileLayer2D* tileLayer); /// Set object group. void SetObjectGroup(const TmxObjectGroup2D* objectGroup); /// Set image layer. void SetImageLayer(const TmxImageLayer2D* imageLayer); /// Tile map. WeakPtr<TileMap2D> tileMap_; /// Tmx layer. const TmxLayer2D* tmxLayer_; /// Tile layer. const TmxTileLayer2D* tileLayer_; /// Object group. const TmxObjectGroup2D* objectGroup_; /// Image layer. const TmxImageLayer2D* imageLayer_; /// Draw order. int drawOrder_; /// Visible. bool visible_; /// Tile node or image nodes. Vector<SharedPtr<Node> > nodes_; }; }
/** * Copyright (c) 2014 rxi * * This library is free software; you can redistribute it and/or modify it * under the terms of the MIT license. See LICENSE for details. */ #include "vec.h" int vec_expand_(char **data, int *length, int *capacity, int memsz) { if (*length + 1 > *capacity) { void *ptr; int n = (*capacity == 0) ? 1 : *capacity << 1; ptr = realloc(*data, n * memsz); if (ptr == NULL) return -1; *data = ptr; *capacity = n; } return 0; } int vec_reserve_(char **data, int *length, int *capacity, int memsz, int n) { (void) length; if (n > *capacity) { void *ptr = realloc(*data, n * memsz); if (ptr == NULL) return -1; *data = ptr; *capacity = n; } return 0; } int vec_reserve_po2_( char **data, int *length, int *capacity, int memsz, int n ) { int n2 = 1; if (n == 0) return 0; while (n2 < n) n2 <<= 1; return vec_reserve_(data, length, capacity, memsz, n2); } int vec_compact_(char **data, int *length, int *capacity, int memsz) { if (*length == 0) { free(*data); *data = NULL; *capacity = 0; return 0; } else { void *ptr; int n = *length; ptr = realloc(*data, n * memsz); if (ptr == NULL) return -1; *capacity = n; *data = ptr; } return 0; } int vec_insert_(char **data, int *length, int *capacity, int memsz, int idx ) { int err = vec_expand_(data, length, capacity, memsz); if (err) return err; memmove(*data + (idx + 1) * memsz, *data + idx * memsz, (*length - idx) * memsz); return 0; } void vec_splice_(char **data, int *length, int *capacity, int memsz, int start, int count ) { (void) capacity; memmove(*data + start * memsz, *data + (start + count) * memsz, (*length - start - count) * memsz); } void vec_swapsplice_(char **data, int *length, int *capacity, int memsz, int start, int count ) { (void) capacity; memmove(*data + start * memsz, *data + (*length - count) * memsz, count * memsz); } void vec_swap_(char **data, int *length, int *capacity, int memsz, int idx1, int idx2 ) { unsigned char *a, *b, tmp; int count; (void) length; (void) capacity; if (idx1 == idx2) return; a = (unsigned char*) *data + idx1 * memsz; b = (unsigned char*) *data + idx2 * memsz; count = memsz; while (count--) { tmp = *a; *a = *b; *b = tmp; a++, b++; } }
//****************************************************************************** // // Copyright (c) 2015 Microsoft Corporation. All rights reserved. // // This code is licensed under the MIT License (MIT). // // 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. // //****************************************************************************** // WindowsSystemThreading.h // Generated from winmd2objc #pragma once #include "interopBase.h" @class WSTThreadPoolTimer, WSTThreadPool; @protocol WSTIThreadPoolStatics , WSTIThreadPoolTimer, WSTIThreadPoolTimerStatics; // Windows.System.Threading.WorkItemPriority enum _WSTWorkItemPriority { WSTWorkItemPriorityLow = -1, WSTWorkItemPriorityNormal = 0, WSTWorkItemPriorityHigh = 1, }; typedef unsigned WSTWorkItemPriority; // Windows.System.Threading.WorkItemOptions enum _WSTWorkItemOptions { WSTWorkItemOptionsNone = 0, WSTWorkItemOptionsTimeSliced = 1, }; typedef unsigned WSTWorkItemOptions; #include "WindowsFoundation.h" // Windows.System.Threading.TimerDestroyedHandler #ifndef __WSTTimerDestroyedHandler__DEFINED #define __WSTTimerDestroyedHandler__DEFINED typedef void (^WSTTimerDestroyedHandler)(WSTThreadPoolTimer* timer); #endif // __WSTTimerDestroyedHandler__DEFINED // Windows.System.Threading.TimerElapsedHandler #ifndef __WSTTimerElapsedHandler__DEFINED #define __WSTTimerElapsedHandler__DEFINED typedef void (^WSTTimerElapsedHandler)(WSTThreadPoolTimer* timer); #endif // __WSTTimerElapsedHandler__DEFINED // Windows.System.Threading.WorkItemHandler #ifndef __WSTWorkItemHandler__DEFINED #define __WSTWorkItemHandler__DEFINED typedef void (^WSTWorkItemHandler)(RTObject<WFIAsyncAction>* operation); #endif // __WSTWorkItemHandler__DEFINED #import <Foundation/Foundation.h> // Windows.System.Threading.TimerElapsedHandler #ifndef __WSTTimerElapsedHandler__DEFINED #define __WSTTimerElapsedHandler__DEFINED typedef void (^WSTTimerElapsedHandler)(WSTThreadPoolTimer* timer); #endif // __WSTTimerElapsedHandler__DEFINED // Windows.System.Threading.TimerDestroyedHandler #ifndef __WSTTimerDestroyedHandler__DEFINED #define __WSTTimerDestroyedHandler__DEFINED typedef void (^WSTTimerDestroyedHandler)(WSTThreadPoolTimer* timer); #endif // __WSTTimerDestroyedHandler__DEFINED // Windows.System.Threading.WorkItemHandler #ifndef __WSTWorkItemHandler__DEFINED #define __WSTWorkItemHandler__DEFINED typedef void (^WSTWorkItemHandler)(RTObject<WFIAsyncAction>* operation); #endif // __WSTWorkItemHandler__DEFINED // Windows.System.Threading.ThreadPoolTimer #ifndef __WSTThreadPoolTimer_DEFINED__ #define __WSTThreadPoolTimer_DEFINED__ WINRT_EXPORT @interface WSTThreadPoolTimer : RTObject + (WSTThreadPoolTimer*)createPeriodicTimer:(WSTTimerElapsedHandler)handler period:(WFTimeSpan*)period; + (WSTThreadPoolTimer*)createTimer:(WSTTimerElapsedHandler)handler delay:(WFTimeSpan*)delay; + (WSTThreadPoolTimer*)createPeriodicTimerWithCompletion:(WSTTimerElapsedHandler)handler period:(WFTimeSpan*)period destroyed:(WSTTimerDestroyedHandler)destroyed; + (WSTThreadPoolTimer*)createTimerWithCompletion:(WSTTimerElapsedHandler)handler delay:(WFTimeSpan*)delay destroyed:(WSTTimerDestroyedHandler)destroyed; @property (readonly) WFTimeSpan* delay; @property (readonly) WFTimeSpan* period; - (void)cancel; @end #endif // __WSTThreadPoolTimer_DEFINED__ // Windows.System.Threading.ThreadPool #ifndef __WSTThreadPool_DEFINED__ #define __WSTThreadPool_DEFINED__ WINRT_EXPORT @interface WSTThreadPool : RTObject + (RTObject<WFIAsyncAction>*)runAsync:(WSTWorkItemHandler)handler; + (RTObject<WFIAsyncAction>*)runWithPriorityAsync:(WSTWorkItemHandler)handler priority:(WSTWorkItemPriority)priority; + (RTObject<WFIAsyncAction>*)runWithPriorityAndOptionsAsync:(WSTWorkItemHandler)handler priority:(WSTWorkItemPriority)priority options:(WSTWorkItemOptions)options; @end #endif // __WSTThreadPool_DEFINED__
// // BaiduMobAdInterstitialDelegate.h // BaiduMobAdWebSDK // // Created by deng jinxiang on 13-8-1. // // #import "BaiduMobAdCommonConfig.h" #import <Foundation/Foundation.h> @class BaiduMobAdInterstitial; @protocol BaiduMobAdInterstitialDelegate <NSObject> @required /** * 应用的APPID */ - (NSString *)publisherId; @optional /** * 启动位置信息 */ -(BOOL) enableLocation; /** * 广告预加载成功 */ - (void)interstitialSuccessToLoadAd:(BaiduMobAdInterstitial *)interstitial; /** * 广告预加载失败 */ - (void)interstitialFailToLoadAd:(BaiduMobAdInterstitial *)interstitial; /** * 广告即将展示 */ - (void)interstitialWillPresentScreen:(BaiduMobAdInterstitial *)interstitial; /** * 广告展示成功 */ - (void)interstitialSuccessPresentScreen:(BaiduMobAdInterstitial *)interstitial; /** * 广告展示失败 */ - (void)interstitialFailPresentScreen:(BaiduMobAdInterstitial *)interstitial withError:(BaiduMobFailReason) reason; /** * 广告展示被用户点击时的回调 */ - (void)interstitialDidAdClicked:(BaiduMobAdInterstitial *)interstitial; /** * 广告展示结束 */ - (void)interstitialDidDismissScreen:(BaiduMobAdInterstitial *)interstitial; ///--------------------------------------------------------------------------------------- /// @name 人群属性板块 ///--------------------------------------------------------------------------------------- /** * 关键词数组 */ -(NSArray*) keywords; /** * 用户性别 */ -(BaiduMobAdUserGender) userGender; /** * 用户生日 */ -(NSDate*) userBirthday; /** * 用户城市 */ -(NSString*) userCity; /** * 用户邮编 */ -(NSString*) userPostalCode; /** * 用户职业 */ -(NSString*) userWork; /** * - 用户最高教育学历 * - 学历输入数字,范围为0-6 * - 0代表小学,1代表初中,2代表中专/高中,3代表专科 * - 4代表本科,5代表硕士,6代表博士 */ -(NSInteger) userEducation; /** * - 用户收入 * - 收入输入数字,以元为单位 */ -(NSInteger) userSalary; /** * 用户爱好 */ -(NSArray*) userHobbies; /** * 其他自定义字段,key以及value都为NSString */ -(NSDictionary*) userOtherAttributes; @end
#ifndef MYSTRING_H_HEADER_INCLUDED #define MYSTRING_H_HEADER_INCLUDED #ifdef __cplusplus extern "C" { #endif int mystrcasecmp (const char *s1, const char *s2); int mystrncasecmp (const char *s1, const char *s2, size_t n); int mystrcmp (const char *s1, const char *s2); #ifndef mystrdup char *mystrdup (const char *str); #endif #ifndef mystrndup char *mystrndup (const char *str, size_t n); #endif /* using macro causes excessive compiler warnings. Stupid GCC 4 !!!!! */ /* #define destroy_string(ps) do{ if(ps && *(ps)){free(*(ps)); *(ps)=NULL;}}while(0) */ void destroy_string(char **ps); /* use it to set string as well as flags and deallocate memory referred to by the pointer */ void set_string (char **target, char *string); #ifdef __cplusplus } #endif #endif /* MYSTRING_H_HEADER_INCLUDED */
#ifdef __IPHONE_6_0 #include_next <UIKit/UICollectionView.h> #else #import "UICollectionViewCell.h" @interface UICollectionView : UIView - (NSIndexPath *)indexPathForCell:(UICollectionViewCell *)cell; @end #endif
/******************************************************************* * * * Using SDL With OpenGL * * * * Tutorial by Kyle Foley (sdw) * * * * http://gpwiki.org/index.php/SDL:Tutorials:Using_SDL_with_OpenGL * * * *******************************************************************/ /* THIS WORK, INCLUDING THE SOURCE CODE, DOCUMENTATION AND RELATED MEDIA AND DATA, IS PLACED INTO THE PUBLIC DOMAIN. THE ORIGINAL AUTHOR IS KYLE FOLEY. THIS SOFTWARE IS PROVIDED AS-IS WITHOUT WARRANTY OF ANY KIND, NOT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY. THE AUTHOR OF THIS SOFTWARE, ASSUMES _NO_ RESPONSIBILITY FOR ANY CONSEQUENCE RESULTING FROM THE USE, MODIFICATION, OR REDISTRIBUTION OF THIS SOFTWARE. */ #include "SDL/SDL.h" #include "SDL/SDL_image.h" #include "SDL/SDL_opengl.h" #include <stdio.h> #include <string.h> int main(int argc, char *argv[]) { SDL_Surface *screen; // Slightly different SDL initialization if ( SDL_Init(SDL_INIT_VIDEO) != 0 ) { printf("Unable to initialize SDL: %s\n", SDL_GetError()); return 1; } SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); // *new* screen = SDL_SetVideoMode( 640, 480, 16, SDL_OPENGL ); // *changed* if ( !screen ) { printf("Unable to set video mode: %s\n", SDL_GetError()); return 1; } // Set the OpenGL state after creating the context with SDL_SetVideoMode glClearColor( 0, 0, 0, 0 ); glEnable( GL_TEXTURE_2D ); // Needed when we're using the fixed-function pipeline. glViewport( 0, 0, 640, 480 ); glMatrixMode( GL_PROJECTION ); glPushMatrix(); // just for testing glLoadIdentity(); glOrtho( 0, 640, 480, 0, -1, 1 ); glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); // Load the OpenGL texture GLuint texture; // Texture object handle SDL_Surface *surface; // Gives us the information to make the texture if ( (surface = IMG_Load("screenshot.png")) ) { // Check that the image's width is a power of 2 if ( (surface->w & (surface->w - 1)) != 0 ) { printf("warning: image.bmp's width is not a power of 2\n"); } // Also check if the height is a power of 2 if ( (surface->h & (surface->h - 1)) != 0 ) { printf("warning: image.bmp's height is not a power of 2\n"); } // Have OpenGL generate a texture object handle for us glGenTextures( 1, &texture ); // Bind the texture object glBindTexture( GL_TEXTURE_2D, texture ); // Set the texture's stretching properties glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); //SDL_LockSurface(surface); // Add some greyness memset(surface->pixels, 0x66, surface->w*surface->h); // Edit the texture object's image data using the information SDL_Surface gives us glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, surface->w, surface->h, 0, GL_RGBA, GL_UNSIGNED_BYTE, surface->pixels ); //SDL_UnlockSurface(surface); } else { printf("SDL could not load image.bmp: %s\n", SDL_GetError()); SDL_Quit(); return 1; } // Free the SDL_Surface only if it was successfully created if ( surface ) { SDL_FreeSurface( surface ); } // Clear the screen before drawing glClear( GL_COLOR_BUFFER_BIT ); // Bind the texture to which subsequent calls refer to glBindTexture( GL_TEXTURE_2D, texture ); glBegin( GL_QUADS ); glTexCoord2i( 0, 0 ); glVertex3f( 10, 10, 0 ); glTexCoord2i( 1, 0 ); glVertex3f( 300, 10, 0 ); glTexCoord2i( 1, 1 ); glVertex3f( 300, 128, 0 ); glTexCoord2i( 0, 1 ); glVertex3f( 10, 128, 0 ); glTexCoord2f( 0, 0.5 ); glVertex3f( 410, 10, 0 ); glTexCoord2f( 1, 0.5 ); glVertex3f( 600, 10, 0 ); glTexCoord2f( 1, 1 ); glVertex3f( 630, 200, 0 ); glTexCoord2f( 0.5, 1 ); glVertex3f( 310, 250, 0 ); glEnd(); glBegin( GL_TRIANGLE_STRIP ); glTexCoord2i( 0, 0 ); glVertex3f( 100, 300, 0 ); glTexCoord2i( 1, 0 ); glVertex3f( 300, 300, 0 ); glTexCoord2i( 1, 1 ); glVertex3f( 300, 400, 0 ); glTexCoord2i( 0, 1 ); glVertex3f( 500, 410, 0 ); glEnd(); glDisable(GL_TEXTURE_2D); glColor3ub(90, 255, 255); glBegin( GL_QUADS ); glVertex3f( 10, 410, 0 ); glVertex3f( 300, 410, 0 ); glVertex3f( 300, 480, 0 ); glVertex3f( 10, 470, 0 ); glEnd(); glBegin( GL_QUADS ); glColor3f(1.0, 0, 1.0); glVertex3f( 410, 410, 0 ); glColor3f(0, 1.0, 0); glVertex3f( 600, 410, 0 ); glColor3f(0, 0, 1.0); glVertex3f( 600, 480, 0 ); glColor3f(1.0, 1.0, 1.0); glVertex3f( 410, 470, 0 ); glEnd(); SDL_GL_SwapBuffers(); #if !EMSCRIPTEN // Wait for 3 seconds to give us a chance to see the image SDL_Delay(3000); #endif // Now we can delete the OpenGL texture and close down SDL glDeleteTextures( 1, &texture ); SDL_Quit(); return 0; }
#pragma once #include "Account.h" namespace AppSecInc { namespace LSA { //! A local group namespace LocalGroup { //! create a local group void Create(const std::wstring& name, const std::wstring& servername = L""); //! create a local group void Create(GROUP_INFO_1 gi, const std::wstring& servername = L""); //! delete a local group void Delete(const std::wstring& name, const std::wstring& servername = L""); //! returns true if a local group exists bool Exists(const std::wstring& name, const std::wstring& servername = L""); //! add a user to the local group void AddMember(const std::wstring& groupname, const std::wstring& username, const std::wstring& servername = L""); //! add a user to the local group void DeleteMember(const std::wstring& groupname, const std::wstring& username, const std::wstring& servername = L""); //! check whether the user is a member of a group bool IsMember(const std::wstring& groupname, const std::wstring& username, const std::wstring& servername = L""); //! get local group members std::vector<Account> GetMembers(const std::wstring& groupname, const std::wstring& servername = L""); }; } }
/* SPDX-License-Identifier: GPL-2.0-only */ /* SPDX-FileCopyrightText: 1996-2003 Russell King */ /* arch/arm/include/asm/ptrace.h */ #ifndef __ASM_ARM_PTRACE_H #define __ASM_ARM_PTRACE_H #ifdef CONFIG_CPU_64 #ifndef __ASSEMBLY__ /* * This struct defines the way the registers are stored * on the stack during an exception. */ struct pt_regs { unsigned long elr; unsigned long regs[31]; }; void show_regs(struct pt_regs *); #endif /* __ASSEMBLY__ */ #else /* CONFIG_CPU_64 */ #define PTRACE_GETREGS 12 #define PTRACE_SETREGS 13 #define PTRACE_GETFPREGS 14 #define PTRACE_SETFPREGS 15 #define PTRACE_SETOPTIONS 21 /* options set using PTRACE_SETOPTIONS */ #define PTRACE_O_TRACESYSGOOD 0x00000001 /* * PSR bits */ #define USR26_MODE 0x00000000 #define FIQ26_MODE 0x00000001 #define IRQ26_MODE 0x00000002 #define SVC26_MODE 0x00000003 #define USR_MODE 0x00000010 #define FIQ_MODE 0x00000011 #define IRQ_MODE 0x00000012 #define SVC_MODE 0x00000013 #define ABT_MODE 0x00000017 #define HYP_MODE 0x0000001a #define UND_MODE 0x0000001b #define SYSTEM_MODE 0x0000001f #define MODE32_BIT 0x00000010 #define MODE_MASK 0x0000001f #define PSR_T_BIT 0x00000020 #define PSR_F_BIT 0x00000040 #define PSR_I_BIT 0x00000080 #define PSR_A_BIT 0x00000100 #define PSR_E_BIT 0x00000200 #define PSR_J_BIT 0x01000000 #define PSR_Q_BIT 0x08000000 #define PSR_V_BIT 0x10000000 #define PSR_C_BIT 0x20000000 #define PSR_Z_BIT 0x40000000 #define PSR_N_BIT 0x80000000 #define PCMASK 0 #ifndef __ASSEMBLY__ /* this struct defines the way the registers are stored on the stack during a system call. */ struct pt_regs { long uregs[18]; }; #define ARM_cpsr uregs[16] #define ARM_pc uregs[15] #define ARM_lr uregs[14] #define ARM_sp uregs[13] #define ARM_ip uregs[12] #define ARM_fp uregs[11] #define ARM_r10 uregs[10] #define ARM_r9 uregs[9] #define ARM_r8 uregs[8] #define ARM_r7 uregs[7] #define ARM_r6 uregs[6] #define ARM_r5 uregs[5] #define ARM_r4 uregs[4] #define ARM_r3 uregs[3] #define ARM_r2 uregs[2] #define ARM_r1 uregs[1] #define ARM_r0 uregs[0] #define ARM_ORIG_r0 uregs[17] #ifdef __KERNEL__ #define user_mode(regs) \ (((regs)->ARM_cpsr & 0xf) == 0) #ifdef CONFIG_ARM_THUMB #define thumb_mode(regs) \ (((regs)->ARM_cpsr & PSR_T_BIT)) #else #define thumb_mode(regs) (0) #endif #define processor_mode(regs) \ ((regs)->ARM_cpsr & MODE_MASK) #define interrupts_enabled(regs) \ (!((regs)->ARM_cpsr & PSR_I_BIT)) #define fast_interrupts_enabled(regs) \ (!((regs)->ARM_cpsr & PSR_F_BIT)) #define condition_codes(regs) \ ((regs)->ARM_cpsr & (PSR_V_BIT | PSR_C_BIT | PSR_Z_BIT | PSR_N_BIT)) /* Are the current registers suitable for user mode? * (used to maintain security in signal handlers) */ static inline int valid_user_regs(struct pt_regs *regs) { if ((regs->ARM_cpsr & 0xf) == 0 && (regs->ARM_cpsr & (PSR_F_BIT | PSR_I_BIT)) == 0) return 1; /* * Force CPSR to something logical... */ regs->ARM_cpsr &= (PSR_V_BIT | PSR_C_BIT | PSR_Z_BIT | PSR_N_BIT | 0x10); return 0; } #endif /* __KERNEL__ */ #endif /* __ASSEMBLY__ */ #ifndef __ASSEMBLY__ #define pc_pointer(v) \ ((v) & ~PCMASK) #define instruction_pointer(regs) \ (pc_pointer((regs)->ARM_pc)) #ifdef __KERNEL__ extern void show_regs(struct pt_regs *); #define predicate(x) (x & 0xf0000000) #define PREDICATE_ALWAYS 0xe0000000 #endif #endif /* __ASSEMBLY__ */ #endif /* CONFIG_CPU_64 */ #endif
void shortenurl(char *url,int urllen);
/* Copyright (C) 2002 Rainmeter Project Developers * * This Source Code Form is subject to the terms of the GNU General Public * License; either version 2 of the License, or (at your option) any later * version. If a copy of the GPL was not distributed with this file, You can * obtain one at <https://www.gnu.org/licenses/gpl-2.0.html>. */ #ifndef __METERIMAGE_H__ #define __METERIMAGE_H__ #include "Meter.h" #include "TintedImage.h" class MeterImage : public Meter { public: MeterImage(Skin* skin, const WCHAR* name); virtual ~MeterImage(); MeterImage(const MeterImage& other) = delete; MeterImage& operator=(MeterImage other) = delete; virtual UINT GetTypeID() { return TypeID<MeterImage>(); } virtual void Initialize(); virtual bool Update(); virtual bool Draw(Gfx::Canvas& canvas); protected: virtual void ReadOptions(ConfigParser& parser, const WCHAR* section); virtual void BindMeasures(ConfigParser& parser, const WCHAR* section); virtual bool IsFixedSize(bool overwrite = false) { return overwrite ? true : m_ImageName.empty(); } private: enum DRAWMODE { DRAWMODE_NONE = 0, DRAWMODE_TILE, DRAWMODE_KEEPRATIO, DRAWMODE_KEEPRATIOANDCROP }; void LoadImage(const std::wstring& imageName, bool bLoadAlways); TintedImage m_Image; std::wstring m_ImageName; std::wstring m_ImageNameResult; TintedImage m_MaskImage; std::wstring m_MaskImageName; bool m_NeedsRedraw; DRAWMODE m_DrawMode; RECT m_ScaleMargins; static const WCHAR* c_MaskOptionArray[TintedImage::OptionCount]; }; #endif
/* TomsFastMath, a fast ISO C bignum library. * * This project is meant to fill in where LibTomMath * falls short. That is speed ;-) * * This project is public domain and free for all purposes. * * Tom St Denis, tomstdenis@gmail.com */ #include <tfm.h> /* c = a - b */ void fp_sub_d(fp_int *a, fp_digit b, fp_int *c) { fp_int tmp; fp_set(&tmp, b); fp_sub(a, &tmp, c); } /* $Source$ */ /* $Revision$ */ /* $Date$ */
/* mga_drv.c -- Matrox G200/G400 driver -*- linux-c -*- * Created: Mon Dec 13 01:56:22 1999 by jhartmann@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) 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 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS 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. * * Authors: * Rickard E. (Rik) Faith <faith@valinux.com> * Gareth Hughes <gareth@valinux.com> */ #include <linux/config.h> #include "drmP.h" #include "drm.h" #include "mga_drm.h" #include "mga_drv.h" #include "drm_pciids.h" static int mga_driver_device_is_agp(drm_device_t * dev); static int postinit( struct drm_device *dev, unsigned long flags ) { drm_mga_private_t * const dev_priv = (drm_mga_private_t *) dev->dev_private; dev_priv->mmio_base = pci_resource_start(dev->pdev, 1); dev_priv->mmio_size = pci_resource_len(dev->pdev, 1); dev->counters += 3; dev->types[6] = _DRM_STAT_IRQ; dev->types[7] = _DRM_STAT_PRIMARY; dev->types[8] = _DRM_STAT_SECONDARY; DRM_INFO( "Initialized %s %d.%d.%d %s on minor %d: %s\n", DRIVER_NAME, DRIVER_MAJOR, DRIVER_MINOR, DRIVER_PATCHLEVEL, DRIVER_DATE, dev->primary.minor, pci_pretty_name(dev->pdev) ); return 0; } static int version( drm_version_t *version ) { int len; version->version_major = DRIVER_MAJOR; version->version_minor = DRIVER_MINOR; version->version_patchlevel = DRIVER_PATCHLEVEL; DRM_COPY( version->name, DRIVER_NAME ); DRM_COPY( version->date, DRIVER_DATE ); DRM_COPY( version->desc, DRIVER_DESC ); return 0; } static struct pci_device_id pciidlist[] = { mga_PCI_IDS }; extern drm_ioctl_desc_t mga_ioctls[]; extern int mga_max_ioctl; static struct drm_driver driver = { .driver_features = DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR | DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_IRQ_VBL, .preinit = mga_driver_preinit, .postcleanup = mga_driver_postcleanup, .pretakedown = mga_driver_pretakedown, .dma_quiescent = mga_driver_dma_quiescent, .device_is_agp = mga_driver_device_is_agp, .vblank_wait = mga_driver_vblank_wait, .irq_preinstall = mga_driver_irq_preinstall, .irq_postinstall = mga_driver_irq_postinstall, .irq_uninstall = mga_driver_irq_uninstall, .irq_handler = mga_driver_irq_handler, .reclaim_buffers = drm_core_reclaim_buffers, .get_map_ofs = drm_core_get_map_ofs, .get_reg_ofs = drm_core_get_reg_ofs, .postinit = postinit, .version = version, .ioctls = mga_ioctls, .dma_ioctl = mga_dma_buffers, .fops = { .owner = THIS_MODULE, .open = drm_open, .release = drm_release, .ioctl = drm_ioctl, .mmap = drm_mmap, .poll = drm_poll, .fasync = drm_fasync, #ifdef CONFIG_COMPAT .compat_ioctl = mga_compat_ioctl, #endif }, .pci_driver = { .name = DRIVER_NAME, .id_table = pciidlist, } }; static int __init mga_init(void) { driver.num_ioctls = mga_max_ioctl; return drm_init(&driver); } static void __exit mga_exit(void) { drm_exit(&driver); } module_init(mga_init); module_exit(mga_exit); MODULE_AUTHOR( DRIVER_AUTHOR ); MODULE_DESCRIPTION( DRIVER_DESC ); MODULE_LICENSE("GPL and additional rights"); /** * Determine if the device really is AGP or not. * * In addition to the usual tests performed by \c drm_device_is_agp, this * function detects PCI G450 cards that appear to the system exactly like * AGP G450 cards. * * \param dev The device to be tested. * * \returns * If the device is a PCI G450, zero is returned. Otherwise 2 is returned. */ int mga_driver_device_is_agp(drm_device_t * dev) { const struct pci_dev * const pdev = dev->pdev; /* There are PCI versions of the G450. These cards have the * same PCI ID as the AGP G450, but have an additional PCI-to-PCI * bridge chip. We detect these cards, which are not currently * supported by this driver, by looking at the device ID of the * bus the "card" is on. If vendor is 0x3388 (Hint Corp) and the * device is 0x0021 (HB6 Universal PCI-PCI bridge), we reject the * device. */ if ( (pdev->device == 0x0525) && (pdev->bus->self->vendor == 0x3388) && (pdev->bus->self->device == 0x0021) ) { return 0; } return 2; }
#include <defs.h> #include <x86.h> #include <stdio.h> #include <string.h> #include <swap.h> #include <swap_fifo.h> #include <list.h> /* [wikipedia]The simplest Page Replacement Algorithm(PRA) is a FIFO algorithm. The first-in, first-out * page replacement algorithm is a low-overhead algorithm that requires little book-keeping on * the part of the operating system. The idea is obvious from the name - the operating system * keeps track of all the pages in memory in a queue, with the most recent arrival at the back, * and the earliest arrival in front. When a page needs to be replaced, the page at the front * of the queue (the oldest page) is selected. While FIFO is cheap and intuitive, it performs * poorly in practical application. Thus, it is rarely used in its unmodified form. This * algorithm experiences Belady's anomaly. * * Details of FIFO PRA * (1) Prepare: In order to implement FIFO PRA, we should manage all swappable pages, so we can * link these pages into pra_list_head according the time order. At first you should * be familiar to the struct list in list.h. struct list is a simple doubly linked list * implementation. You should know howto USE: list_init, list_add(list_add_after), * list_add_before, list_del, list_next, list_prev. Another tricky method is to transform * a general list struct to a special struct (such as struct page). You can find some MACRO: * le2page (in memlayout.h), (in future labs: le2vma (in vmm.h), le2proc (in proc.h),etc. */ list_entry_t pra_list_head; /* * (2) _fifo_init_mm: init pra_list_head and let mm->sm_priv point to the addr of pra_list_head. * Now, From the memory control struct mm_struct, we can access FIFO PRA */ static int _fifo_init_mm(struct mm_struct *mm) { list_init(&pra_list_head); mm->sm_priv = &pra_list_head; //cprintf(" mm->sm_priv %x in fifo_init_mm\n",mm->sm_priv); return 0; } /* * (3)_fifo_map_swappable: According FIFO PRA, we should link the most recent arrival page at the back of pra_list_head qeueue */ static int _fifo_map_swappable(struct mm_struct *mm, uintptr_t addr, struct Page *page, int swap_in) { list_entry_t *head=(list_entry_t*) mm->sm_priv; list_entry_t *entry=&(page->pra_page_link); assert(entry != NULL && head != NULL); //record the page access situlation /*LAB3 EXERCISE 2: YOUR CODE*/ //(1)link the most recent arrival page at the back of the pra_list_head qeueue. list_add(head,entry); //逐一查到head后面,这样的话,head前面一个即是最后一个,即最早调入内存的 //所以这样的话,以后只要删除head前面就是最早的一个,head后面就是最晚的那个 return 0; } /* * (4)_fifo_swap_out_victim: According FIFO PRA, we should unlink the earliest arrival page in front of pra_list_head qeueue, * then set the addr of addr of this page to ptr_page. */ static int _fifo_swap_out_victim(struct mm_struct *mm, struct Page ** ptr_page, int in_tick) { list_entry_t *head=(list_entry_t*) mm->sm_priv; assert(head != NULL); assert(in_tick==0); /* Select the victim */ /*LAB3 EXERCISE 2: 2012011370*/ //(1) unlink the earliest arrival page in front of pra_list_head qeueue list_entry_t* le = list_prev(head); list_del(le); //(2) set the addr of addr of this page to ptr_page struct Page* page = le2page(le,pra_page_link); //注意,因为FIFO链表是用pra_page_link成员串起来的,根据le2page的原理,member应该选pra_page_link *ptr_page = page; return 0; } static int _fifo_check_swap(void) { cprintf("write Virt Page c in fifo_check_swap\n"); *(unsigned char *)0x3000 = 0x0c; assert(pgfault_num==4); cprintf("write Virt Page a in fifo_check_swap\n"); *(unsigned char *)0x1000 = 0x0a; assert(pgfault_num==4); cprintf("write Virt Page d in fifo_check_swap\n"); *(unsigned char *)0x4000 = 0x0d; assert(pgfault_num==4); cprintf("write Virt Page b in fifo_check_swap\n"); *(unsigned char *)0x2000 = 0x0b; assert(pgfault_num==4); cprintf("write Virt Page e in fifo_check_swap\n"); *(unsigned char *)0x5000 = 0x0e; assert(pgfault_num==5); cprintf("write Virt Page b in fifo_check_swap\n"); *(unsigned char *)0x2000 = 0x0b; assert(pgfault_num==5); cprintf("write Virt Page a in fifo_check_swap\n"); *(unsigned char *)0x1000 = 0x0a; assert(pgfault_num==6); cprintf("write Virt Page b in fifo_check_swap\n"); *(unsigned char *)0x2000 = 0x0b; assert(pgfault_num==7); cprintf("write Virt Page c in fifo_check_swap\n"); *(unsigned char *)0x3000 = 0x0c; assert(pgfault_num==8); cprintf("write Virt Page d in fifo_check_swap\n"); *(unsigned char *)0x4000 = 0x0d; assert(pgfault_num==9); return 0; } static int _fifo_init(void) { return 0; } static int _fifo_set_unswappable(struct mm_struct *mm, uintptr_t addr) { return 0; } static int _fifo_tick_event(struct mm_struct *mm) { return 0; } struct swap_manager swap_manager_fifo = { .name = "fifo swap manager", .init = &_fifo_init, .init_mm = &_fifo_init_mm, .tick_event = &_fifo_tick_event, .map_swappable = &_fifo_map_swappable, .set_unswappable = &_fifo_set_unswappable, .swap_out_victim = &_fifo_swap_out_victim, .check_swap = &_fifo_check_swap, };
/* ** PTYWindow.h ** ** Copyright (c) 2002, 2003 ** ** Author: Fabian, Ujwal S. Setlur ** Initial code by Kiichi Kusama ** ** Project: iTerm ** ** Description: NSWindow subclass. Implements smart window placement and blur. ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #import <Cocoa/Cocoa.h> @protocol PTYWindowDelegateProtocol<NSObject,NSWindowDelegate > - (BOOL)lionFullScreen; - (void)windowWillShowInitial; - (void)toggleTraditionalFullScreenMode; @end @interface PTYWindow : NSWindow @property(nonatomic, readonly) int screenNumber; @property(nonatomic, readonly, getter=isTogglingLionFullScreen) BOOL togglingLionFullScreen; - (void)smartLayout; - (void)setLayoutDone; - (void)enableBlur:(double)radius; - (void)disableBlur; - (void)setRestoreState:(NSObject *)restoreState; // Returns the approximate fraction of this window that is occluded by other windows in this app. - (double)approximateFractionOccluded; // See comments in iTermDelayedTitleSetter for why this is so. - (void)delayedSetTitle:(NSString *)title; @end @interface PTYWindow (Private) // Private NSWindow method, needed to avoid ghosting when using transparency. - (BOOL)_setContentHasShadow:(BOOL)contentHasShadow; @end
/**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtGui module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage ** This file may be used under the terms of the GNU Lesser General Public ** License version 2.1 as published by the Free Software Foundation and ** appearing in the file LICENSE.LGPL included in the packaging of this ** file. Please review the following information to ensure the GNU Lesser ** General Public License version 2.1 requirements will be met: ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU General ** Public License version 3.0 as published by the Free Software Foundation ** and appearing in the file LICENSE.GPL included in the packaging of this ** file. Please review the following information to ensure the GNU General ** Public License version 3.0 requirements will be met: ** http://www.gnu.org/copyleft/gpl.html. ** ** Other Usage ** Alternatively, this file may be used in accordance with the terms and ** conditions contained in a signed written agreement between you and Nokia. ** ** ** ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QTEXTBROWSER_H #define QTEXTBROWSER_H #include <QtGui/qtextedit.h> #include <QtCore/qurl.h> QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Gui) #ifndef QT_NO_TEXTBROWSER class QTextBrowserPrivate; class Q_GUI_EXPORT QTextBrowser : public QTextEdit { Q_OBJECT Q_PROPERTY(QUrl source READ source WRITE setSource) Q_OVERRIDE(bool modified SCRIPTABLE false) Q_OVERRIDE(bool readOnly DESIGNABLE false SCRIPTABLE false) Q_OVERRIDE(bool undoRedoEnabled DESIGNABLE false SCRIPTABLE false) Q_PROPERTY(QStringList searchPaths READ searchPaths WRITE setSearchPaths) Q_PROPERTY(bool openExternalLinks READ openExternalLinks WRITE setOpenExternalLinks) Q_PROPERTY(bool openLinks READ openLinks WRITE setOpenLinks) public: explicit QTextBrowser(QWidget* parent = 0); virtual ~QTextBrowser(); QUrl source() const; QStringList searchPaths() const; void setSearchPaths(const QStringList &paths); virtual QVariant loadResource(int type, const QUrl &name); bool isBackwardAvailable() const; bool isForwardAvailable() const; void clearHistory(); QString historyTitle(int) const; QUrl historyUrl(int) const; int backwardHistoryCount() const; int forwardHistoryCount() const; bool openExternalLinks() const; void setOpenExternalLinks(bool open); bool openLinks() const; void setOpenLinks(bool open); public Q_SLOTS: virtual void setSource(const QUrl &name); virtual void backward(); virtual void forward(); virtual void home(); virtual void reload(); Q_SIGNALS: void backwardAvailable(bool); void forwardAvailable(bool); void historyChanged(); void sourceChanged(const QUrl &); void highlighted(const QUrl &); void highlighted(const QString &); void anchorClicked(const QUrl &); protected: bool event(QEvent *e); virtual void keyPressEvent(QKeyEvent *ev); virtual void mouseMoveEvent(QMouseEvent *ev); virtual void mousePressEvent(QMouseEvent *ev); virtual void mouseReleaseEvent(QMouseEvent *ev); virtual void focusOutEvent(QFocusEvent *ev); virtual bool focusNextPrevChild(bool next); virtual void paintEvent(QPaintEvent *e); #if defined(QT3_SUPPORT) public: QT3_SUPPORT_CONSTRUCTOR QTextBrowser(QWidget *parent, const char *name); #endif private: Q_DISABLE_COPY(QTextBrowser) Q_DECLARE_PRIVATE(QTextBrowser) Q_PRIVATE_SLOT(d_func(), void _q_documentModified()) Q_PRIVATE_SLOT(d_func(), void _q_activateAnchor(const QString &)) Q_PRIVATE_SLOT(d_func(), void _q_highlightLink(const QString &)) }; #endif // QT_NO_TEXTBROWSER QT_END_NAMESPACE QT_END_HEADER #endif // QTEXTBROWSER_H
/** @file Copyright (c) 2017, Intel Corporation. All rights reserved.<BR> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY 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. This file is automatically generated. Please do NOT modify !!! **/ #ifndef __FSPUPD_H__ #define __FSPUPD_H__ #include <FspEas.h> #pragma pack(1) #define FSPT_UPD_SIGNATURE 0x545F4450554C424B /* 'KBLUPD_T' */ #define FSPM_UPD_SIGNATURE 0x4D5F4450554C424B /* 'KBLUPD_M' */ #define FSPS_UPD_SIGNATURE 0x535F4450554C424B /* 'KBLUPD_S' */ #pragma pack() #endif
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* NetworkManager -- Network link manager * * 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. * * Copyright (C) 2007 - 2008 Novell, Inc. * Copyright (C) 2007 - 2012 Red Hat, Inc. */ #ifndef NM_BLUEZ_MANAGER_H #define NM_BLUEZ_MANAGER_H #include <glib.h> #include <glib-object.h> #include "nm-connection-provider.h" G_BEGIN_DECLS #define NM_TYPE_BLUEZ_MANAGER (nm_bluez_manager_get_type ()) #define NM_BLUEZ_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_BLUEZ_MANAGER, NMBluezManager)) #define NM_BLUEZ_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_BLUEZ_MANAGER, NMBluezManagerClass)) #define NM_IS_BLUEZ_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_BLUEZ_MANAGER)) #define NM_IS_BLUEZ_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_BLUEZ_MANAGER)) #define NM_BLUEZ_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_BLUEZ_MANAGER, NMBluezManagerClass)) #define NM_BLUEZ_MANAGER_BDADDR_ADDED "bdaddr-added" #define NM_BLUEZ_MANAGER_BDADDR_REMOVED "bdaddr-removed" typedef struct { GObject parent; } NMBluezManager; typedef struct { GObjectClass parent; /* Virtual functions */ void (*bdaddr_added) (NMBluezManager *manager, const char *bdaddr, const char *name, const char *object_path, guint uuids); void (*bdaddr_removed) (NMBluezManager *manager, const char *bdaddr, const char *object_path); } NMBluezManagerClass; GType nm_bluez_manager_get_type (void); NMBluezManager *nm_bluez_manager_get (NMConnectionProvider *provider); void nm_bluez_manager_query_devices (NMBluezManager *manager); #endif /* NM_BLUEZ_MANAGER_H */
// Copyright 2015, VIXL authors // 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 ARM Limited 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 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. // --------------------------------------------------------------------- // This file is auto generated using tools/generate_simulator_traces.py. // // PLEASE DO NOT EDIT. // --------------------------------------------------------------------- #ifndef VIXL_SIM_SADDLP_1D_TRACE_AARCH64_H_ #define VIXL_SIM_SADDLP_1D_TRACE_AARCH64_H_ const uint64_t kExpected_NEON_saddlp_1D[] = { 0xfffffffffffffffb, 0xfffffffffffffffd, 0xffffffffffffffff, 0x0000000000000001, 0x0000000000000003, 0x0000000000000022, 0x000000000000009d, 0x00000000000000fb, 0x00000000000000fd, 0x000000000000807c, 0x000000000000fffb, 0x000000000000fffd, 0x000000003333b332, 0x0000000088888888, 0x00000000d5555552, 0x00000000fffffffb, 0x00000000fffffffd, 0xffffffffffffffff, 0xffffffff00000001, 0xffffffff2aaaaaab, 0xffffffff77777776, 0xffffffffcccc4ccc, 0xffffffffffff0001, 0xffffffffffff0003, 0xffffffffffff0005, 0xffffffffffff7f83, 0xffffffffffffff01, 0xffffffffffffff03, 0xffffffffffffff05, 0xffffffffffffff63, 0xffffffffffffffdd, }; const unsigned kExpectedCount_NEON_saddlp_1D = 31; #endif // VIXL_SIM_SADDLP_1D_TRACE_AARCH64_H_
// -*-c++-*- /* $Id$ */ /* * * Copyright (C) 2004 David Mazieres (dm@uun.org) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * */ #ifndef _SFSMISC_SFSSESSCRYPT_H_ #define _SFSMISC_SFSSESSCRYPT_H_ 1 #include "sfsagent.h" #include "srp.h" struct sfs_autharg2; struct sfs_authreq2; /* sfsauthorizer.C */ struct sfs_authorizer { bool mutual; sfs_authorizer () : mutual (true) {} static bool setres (sfsagent_auth_res *resp, const sfs_autharg2 &aa); static bool reqinit (sfs_authreq2 *reqp, const sfsagent_authinit_arg *ap); static bool reqinit (sfs_authreq2 *reqp, const sfsagent_authmore_arg *ap); // Warning: in next 2 funcs can't delete argp's before cb is called virtual void authinit (const sfsagent_authinit_arg *argp, sfsagent_auth_res *resp, cbv cb) = 0; virtual void authmore (const sfsagent_authmore_arg *argp, sfsagent_auth_res *resp, cbv cb); virtual ~sfs_authorizer () {} }; class sfskey_authorizer : virtual public sfs_authorizer { virtual void sigdone (ref<sfs_autharg2> aarg, sfsagent_auth_res *resp, cbv cb, str err, ptr<sfs_sig2> sig); protected: ptr<sfspriv> khold; virtual bool ntries_ok (int ntries) { return !ntries; } void authinit_v1 (const sfsagent_authinit_arg *argp, sfsagent_auth_res *resp, cbv cb); void authinit_v2 (const sfsagent_authinit_arg *argp, sfsagent_auth_res *resp, cbv cb); public: sfspriv *k; bool cred; sfskey_authorizer () : cred (true) { mutual = false; } void setkey (ptr<sfspriv> kk) { k = khold = kk; } void setkey (ref<sfspriv> kk) { k = khold = kk; } void setkey (sfspriv *kk) { k = kk; khold = NULL; } void authinit (const sfsagent_authinit_arg *argp, sfsagent_auth_res *resp, cbv cb); }; class sfspw_authorizer : virtual public sfs_authorizer { static void getpwd_2 (ref<bool> d, cbs cb, str pwd) { if (!*d) (*cb) (pwd); } protected: const ref<bool> destroyed; bool ntries_ok (int ntries) { return ntries < 5; } public: bool dont_get_pwd; static str printable (str msg); sfspw_authorizer () : destroyed (New refcounted<bool> (false)), dont_get_pwd (false) {} ~sfspw_authorizer () { *destroyed = true; } virtual void getpwd (str prompt, bool echo, cbs cb); }; class sfsunixpw_authorizer : public sfspw_authorizer { void authmore_2 (sfsagent_auth_res *resp, ref<sfs_autharg2> aargp, cbv cb, str pwd); public: str unixuser; void authinit (const sfsagent_authinit_arg *argp, sfsagent_auth_res *resp, cbv cb); void authmore (const sfsagent_authmore_arg *argp, sfsagent_auth_res *resp, cbv cb); }; class sfssrp_authorizer : public sfspw_authorizer { void authmore_2 (const sfsagent_authmore_arg *argp, sfsagent_auth_res *resp, cbv cb, str pwd); public: str pwd; srp_client *srpc; bool delete_srpc; sfssrp_authorizer () : srpc (NULL), delete_srpc (false) {} ~sfssrp_authorizer () { if (delete_srpc) delete srpc; } void authinit (const sfsagent_authinit_arg *argp, sfsagent_auth_res *resp, cbv cb); void authmore (const sfsagent_authmore_arg *argp, sfsagent_auth_res *resp, cbv cb); }; /* sfssesskey.C */ inline const sfs_kmsg * sfs_get_kmsg (const str &s) { return reinterpret_cast<const sfs_kmsg *> (s.cstr ()); } void sfs_get_sesskey (sfs_hash *ksc, sfs_hash *kcs, const sfs_servinfo &si, const sfs_kmsg *smsg, const sfs_connectinfo &ci, const bigint &kc, const sfs_kmsg *cmsg); void sfs_get_sessid (sfs_hash *sessid, const sfs_hash *ksc, const sfs_hash *kcs); void sfs_get_authid (sfs_hash *authid, sfs_service service, sfs_hostname name, const sfs_hash *hostid, const sfs_hash *sessid, sfs_authinfo *authinfo = NULL); void sfs_server_crypt (svccb *sbp, sfspriv *sk, const sfs_connectinfo &ci, ref<const sfs_servinfo_w> s, sfs_hash *sessid, const sfs_hashcharge &charge, axprt_crypt *cx = NULL, int PVERS = 2); /* N.B., sfs_client_crypt might make callback immediately (on failure) * and return NULL. The callback argument is sessid, for use with * sfs_get_authid. */ struct callbase; callbase *sfs_client_crypt (ptr<aclnt> c, ptr<sfspriv> clntkey, const sfs_connectinfo &ci, const sfs_connectok &cres, ref<const sfs_servinfo_w> si, callback<void, const sfs_hash *>::ref cb, ptr<axprt_crypt> cx = NULL); #endif /* _SFSMISC_SFSSESSCRYPT_H_ */
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*- * vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Copyright (C) 2008 Sun Microsystems, 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; version 2 of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #pragma once #include <drizzled/hybrid_type_traits.h> namespace drizzled { class Hybrid_type_traits_decimal: public Hybrid_type_traits { public: virtual Item_result type() const; virtual void fix_length_and_dec(Item *arg, Item *item) const; /* Hybrid_type operations. */ virtual void set_zero(Hybrid_type *val) const; virtual void add(Hybrid_type *val, Field *f) const; virtual void div(Hybrid_type *val, uint64_t u) const; virtual int64_t val_int(Hybrid_type *val, bool unsigned_flag) const; virtual double val_real(Hybrid_type *val) const; virtual type::Decimal *val_decimal(Hybrid_type *val, type::Decimal *buf) const; virtual String *val_str(Hybrid_type *val, String *buf, uint8_t decimals) const; static const Hybrid_type_traits_decimal *instance(); Hybrid_type_traits_decimal(); }; } /* namespace drizzled */
/* * sleep.c - x86-specific ACPI sleep support. * * Copyright (C) 2001-2003 Patrick Mochel * Copyright (C) 2001-2003 Pavel Machek <pavel@ucw.cz> */ #include <linux/acpi.h> #include <linux/bootmem.h> #include <linux/memblock.h> #include <linux/dmi.h> #include <linux/cpumask.h> #include <asm/segment.h> #include <asm/desc.h> #include <asm/pgtable.h> #include <asm/cacheflush.h> #include <asm/realmode.h> #include "../../realmode/rm/wakeup.h" #include "sleep.h" unsigned long acpi_realmode_flags; #if defined(CONFIG_SMP) && defined(CONFIG_64BIT) static char temp_stack[4096]; #endif /** * x86_acpi_enter_sleep_state - enter sleep state * @state: Sleep state to enter. * * Wrapper around acpi_enter_sleep_state() to be called by assmebly. */ acpi_status asmlinkage x86_acpi_enter_sleep_state(u8 state) { return acpi_enter_sleep_state(state); } /** * x86_acpi_suspend_lowlevel - save kernel state * * Create an identity mapped page table and copy the wakeup routine to * low memory. */ int x86_acpi_suspend_lowlevel(void) { struct wakeup_header *header = (struct wakeup_header *) __va(real_mode_header->wakeup_header); if (header->signature != WAKEUP_HEADER_SIGNATURE) { printk(KERN_ERR "wakeup header does not match\n"); return -EINVAL; } header->video_mode = saved_video_mode; header->pmode_behavior = 0; #ifndef CONFIG_64BIT native_store_gdt((struct desc_ptr *)&header->pmode_gdt); /* * We have to check that we can write back the value, and not * just read it. At least on 90 nm Pentium M (Family 6, Model * 13), reading an invalid MSR is not guaranteed to trap, see * Erratum X4 in "Intel Pentium M Processor on 90 nm Process * with 2-MB L2 Cache and Intel® Processor A100 and A110 on 90 * nm process with 512-KB L2 Cache Specification Update". */ if (!rdmsr_safe(MSR_EFER, &header->pmode_efer_low, &header->pmode_efer_high) && !wrmsr_safe(MSR_EFER, header->pmode_efer_low, header->pmode_efer_high)) header->pmode_behavior |= (1 << WAKEUP_BEHAVIOR_RESTORE_EFER); #endif /* !CONFIG_64BIT */ header->pmode_cr0 = read_cr0(); if (__this_cpu_read(cpu_info.cpuid_level) >= 0) { header->pmode_cr4 = read_cr4(); header->pmode_behavior |= (1 << WAKEUP_BEHAVIOR_RESTORE_CR4); } if (!rdmsr_safe(MSR_IA32_MISC_ENABLE, &header->pmode_misc_en_low, &header->pmode_misc_en_high) && !wrmsr_safe(MSR_IA32_MISC_ENABLE, header->pmode_misc_en_low, header->pmode_misc_en_high)) header->pmode_behavior |= (1 << WAKEUP_BEHAVIOR_RESTORE_MISC_ENABLE); header->realmode_flags = acpi_realmode_flags; header->real_magic = 0x12345678; #ifndef CONFIG_64BIT header->pmode_entry = (u32)&wakeup_pmode_return; header->pmode_cr3 = (u32)__pa_symbol(initial_page_table); saved_magic = 0x12345678; #else /* CONFIG_64BIT */ #ifdef CONFIG_SMP stack_start = (unsigned long)temp_stack + sizeof(temp_stack); pax_open_kernel(); early_gdt_descr.address = (unsigned long)get_cpu_gdt_table(smp_processor_id()); pax_close_kernel(); initial_gs = per_cpu_offset(smp_processor_id()); #endif initial_code = (unsigned long)wakeup_long64; saved_magic = 0x123456789abcdef0L; #endif /* CONFIG_64BIT */ do_suspend_lowlevel(); return 0; } static int __init acpi_sleep_setup(char *str) { while ((str != NULL) && (*str != '\0')) { if (strncmp(str, "s3_bios", 7) == 0) acpi_realmode_flags |= 1; if (strncmp(str, "s3_mode", 7) == 0) acpi_realmode_flags |= 2; if (strncmp(str, "s3_beep", 7) == 0) acpi_realmode_flags |= 4; #ifdef CONFIG_HIBERNATION if (strncmp(str, "s4_nohwsig", 10) == 0) acpi_no_s4_hw_signature(); #endif if (strncmp(str, "nonvs", 5) == 0) acpi_nvs_nosave(); if (strncmp(str, "nonvs_s3", 8) == 0) acpi_nvs_nosave_s3(); if (strncmp(str, "old_ordering", 12) == 0) acpi_old_suspend_ordering(); str = strchr(str, ','); if (str != NULL) str += strspn(str, ", \t"); } return 1; } __setup("acpi_sleep=", acpi_sleep_setup);
/* Copyright 2009 Gary Briggs This file is part of obdgpslogger. obdgpslogger 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. obdgpslogger 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 obdgpslogger. If not, see <http://www.gnu.org/licenses/>. */ /** \file \brief OBD service commands */ #include "obdservicecommands.h" #include <string.h> #include <stdio.h> #include <stdlib.h> struct obdservicecmd *obdGetCmdForColumn(const char *db_column) { int i; int numrows = sizeof(obdcmds_mode1)/sizeof(obdcmds_mode1[0]); for(i=0;i<numrows;i++) { struct obdservicecmd *o = &obdcmds_mode1[i]; if(NULL == o->db_column) { continue; } if(0 == strcmp(db_column,o->db_column)) { return o; } } return NULL; } /// O(log(n)) PID finder /** Profiling, it usually ends up slower than the linear one, which is because we're normally in the lower end of the PID scale and the linear one is much simpler */ static struct obdservicecmd *obdGetCmdForPID_recursive(const unsigned int pid, const int first_idx, const int last_idx) { // printf("%i %i\n", first_idx, last_idx); // const unsigned int first_pid = obdcmds_mode1[first_idx].cmdid; const unsigned int last_pid = obdcmds_mode1[last_idx].cmdid; // if(pid == first_pid) return &obdcmds_mode1[first_idx]; if(pid == last_pid) return &obdcmds_mode1[last_idx]; if(first_idx >= last_idx) { return NULL; } int middle_idx = (last_idx + first_idx)/2; const unsigned int middle_pid = obdcmds_mode1[middle_idx].cmdid; if(pid == middle_pid) return &obdcmds_mode1[middle_idx]; if(middle_pid < pid) { return obdGetCmdForPID_recursive(pid, middle_idx+1, last_idx-1); } else { return obdGetCmdForPID_recursive(pid, first_idx, middle_idx-1); } } struct obdservicecmd *obdGetCmdForPID(const unsigned int pid) { int i; int numrows = sizeof(obdcmds_mode1)/sizeof(obdcmds_mode1[0]); for(i=0;i<numrows;i++) { struct obdservicecmd *o = &obdcmds_mode1[i]; if(pid == o->cmdid) { return o; } } return NULL; // return obdGetCmdForPID_recursive(pid, 0, sizeof(obdcmds_mode1)/sizeof(obdcmds_mode1[0])); } int obderrconvert_r(char *buf, int n, unsigned int A, unsigned int B) { unsigned int partcode = (A>>4)&0x0F; unsigned int numbercode = 0; char strpartcode; switch(partcode) { // Powertrain codes case 0x00: case 0x01: case 0x02: case 0x03: strpartcode = 'P'; numbercode = partcode; break; // Chassis codes case 0x04: case 0x05: case 0x06: case 0x07: strpartcode = 'C'; numbercode = partcode-4; break; // Body codes case 0x08: case 0x09: case 0x0A: case 0x0B: strpartcode = 'B'; numbercode = partcode-8; break; // Network codes case 0x0C: case 0x0D: case 0x0E: case 0x0F: strpartcode = 'U'; numbercode = partcode-12; break; default: fprintf(stderr, "Could not decode error code.\n"); return 0; break; } return snprintf(buf, n, "%c%u%01X%02X", strpartcode, numbercode, A&0x0F, B); } const char *obderrconvert(unsigned int A, unsigned int B) { static char strerr[6]; // Letter, four digits, \0 strerr[0] = '\0'; obderrconvert_r(strerr, sizeof(strerr), A, B); return strerr; }
/* LibTomCrypt, modular cryptographic library -- Tom St Denis * * LibTomCrypt is a library that provides various cryptographic * algorithms in a highly modular and flexible manner. * * The library is free for all purposes without any express * guarantee it works. * * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "../../headers/tomcrypt.h" /** @file der_decode_printable_string.c ASN.1 DER, encode a printable STRING, Tom St Denis */ #ifdef LTC_DER /** Store a printable STRING @param in The DER encoded printable STRING @param inlen The size of the DER printable STRING @param out [out] The array of octets stored (one per char) @param outlen [in/out] The number of octets stored @return CRYPT_OK if successful */ int der_decode_printable_string(const unsigned char *in, unsigned long inlen, unsigned char *out, unsigned long *outlen) { unsigned long x, y, len; int t; LTC_ARGCHK(in != NULL); LTC_ARGCHK(out != NULL); LTC_ARGCHK(outlen != NULL); /* must have header at least */ if (inlen < 2) { return CRYPT_INVALID_PACKET; } /* check for 0x13 */ if ((in[0] & 0x1F) != 0x13) { return CRYPT_INVALID_PACKET; } x = 1; /* decode the length */ if (in[x] & 0x80) { /* valid # of bytes in length are 1, 2, 3 */ y = in[x] & 0x7F; if ((y == 0) || (y > 3) || ((x + y) > inlen)) { return CRYPT_INVALID_PACKET; } /* read the length in */ len = 0; ++x; while (y--) { len = (len << 8) | in[x++]; } } else { len = in[x++] & 0x7F; } /* is it too long? */ if (len > *outlen) { *outlen = len; return CRYPT_BUFFER_OVERFLOW; } if (len + x > inlen) { return CRYPT_INVALID_PACKET; } /* read the data */ for (y = 0; y < len; y++) { t = der_printable_value_decode(in[x++]); if (t == -1) { return CRYPT_INVALID_ARG; } out[y] = t; } *outlen = y; return CRYPT_OK; } #endif /* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/printable_string/der_decode_printable_string.c, v $ */ /* $Revision: 1.4 $ */ /* $Date: 2006/12/28 01:27:24 $ */
/* Õâ·ÝdemoÓÃÓÚÑÝʾ»·Ðλº³åÇø */ #include <rtthread.h> #include "rtdevice.h" //for rt_ringbuffer #ifdef RT_USING_FINSH #include <finsh.h> #include <shell.h> #endif static rt_sem_t sem = RT_NULL; static rt_uint8_t working_buffer[256]; struct rt_ringbuffer rb; /* Ö¸ÏòÏ߳̿ØÖÆ¿éµÄÖ¸Õë */ static rt_thread_t tid1 = RT_NULL; static rt_thread_t tid2 = RT_NULL; /* Ïß³Ì1Èë¿Ú */ static void thread1_entry(void* parameter) { rt_bool_t result=RT_FALSE; rt_uint8_t data_buffer[33]; rt_uint32_t i = 1; while(i--) { rt_sem_take (sem,RT_WAITING_FOREVER); result = rt_ringbuffer_get(&rb,&data_buffer[0],33); rt_sem_release(sem); if(RT_TRUE==result) { rt_kprintf("%s\n",data_buffer); } rt_thread_delay(5); } } /* Ïß³Ì2Èë¿Ú£¬Ïß³Ì2µÄÓÅÏȼ¶±ÈÏß³Ì1µÍ£¬Ó¦¸ÃÏß³Ì1ÏÈ»ñµÃÖ´ÐС£*/ static void thread2_entry(void *parameter) { rt_bool_t result=RT_FALSE; rt_uint32_t index,setchar,i = 1; rt_uint8_t data_buffer[33]; setchar = 0x21; while(i--) { for (index = 0; index < 32; index++) { data_buffer[index] = setchar; if (++setchar == 0x7f) { setchar = 0x21; } } data_buffer[32] = '\0'; rt_sem_take(sem,RT_WAITING_FOREVER); result = rt_ringbuffer_put(&rb,&data_buffer[0],33); if(RT_TRUE==result) { rt_kprintf("write buffer success!\n"); } rt_sem_release(sem); rt_thread_delay(10); } } int demo_init(void) { rt_ringbuffer_init(&rb,working_buffer,256); sem = rt_sem_create("sem",1,RT_IPC_FLAG_FIFO); if (sem == RT_NULL) { return 0; } /* ´´½¨Ïß³Ì1 */ tid1 = rt_thread_create("t1", thread1_entry, RT_NULL, /* Ïß³ÌÈë¿ÚÊÇthread1_entry, Èë¿Ú²ÎÊýÊÇRT_NULL */ 512, 8, 10); if (tid1 != RT_NULL) rt_thread_startup(tid1); /* ´´½¨Ïß³Ì2 */ tid2 = rt_thread_create("t2", thread2_entry, RT_NULL, /* Ïß³ÌÈë¿ÚÊÇthread2_entry, Èë¿Ú²ÎÊýÊÇRT_NULL */ 512, 7, 10); if (tid2 != RT_NULL) rt_thread_startup(tid2); return 0; }
#include <unistd.h> #include "timestamp.h" #include "buffer.h" int mywrite(int fd,char *buf,int len) { int w; w = buffer_unixwrite(fd,buf,len); if (w == -1) _exit(111); return w; } char outbuf[2048]; buffer out = BUFFER_INIT(mywrite,1,outbuf,sizeof outbuf); int myread(int fd,char *buf,int len) { int r; buffer_flush(&out); r = buffer_unixread(fd,buf,len); if (r == -1) _exit(111); return r; } char inbuf[1024]; buffer in = BUFFER_INIT(myread,0,inbuf,sizeof inbuf); char stamp[TIMESTAMP + 1]; int main() { char ch; for (;;) { if (buffer_GETC(&in,&ch) != 1) _exit(0); timestamp(stamp); stamp[TIMESTAMP] = ' '; buffer_put(&out,stamp,TIMESTAMP + 1); for (;;) { buffer_PUTC(&out,ch); if (ch == '\n') break; if (buffer_GETC(&in,&ch) != 1) _exit(0); } } }
#include <stic.h> #include <stddef.h> /* NULL */ #include "../../src/io/ioeta.h" TEST(free_of_null_is_ok) { ioeta_free(NULL); } TEST(alloc_initializes_all_fields) { ioeta_estim_t *const estim = ioeta_alloc(NULL); assert_int_equal(0, estim->total_items); assert_int_equal(0, estim->current_item); assert_int_equal(0, estim->total_bytes); assert_int_equal(0, estim->current_byte); assert_string_equal(NULL, estim->item); ioeta_free(estim); } /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 : */ /* vim: set cinoptions+=t0 filetype=c : */
/* Freezer declarations */ #ifndef FREEZER_H_INCLUDED #define FREEZER_H_INCLUDED #include <linux/sched.h> #include <linux/wait.h> #ifdef CONFIG_FREEZER /* * Check if a process has been frozen */ static inline int frozen(struct task_struct *p) { return p->flags & PF_FROZEN; } /* * Check if there is a request to freeze a process */ static inline int freezing(struct task_struct *p) { return test_tsk_thread_flag(p, TIF_FREEZE); } /* * Request that a process be frozen */ static inline void set_freeze_flag(struct task_struct *p) { set_tsk_thread_flag(p, TIF_FREEZE); } /* * Sometimes we may need to cancel the previous 'freeze' request */ static inline void clear_freeze_flag(struct task_struct *p) { clear_tsk_thread_flag(p, TIF_FREEZE); } static inline bool should_send_signal(struct task_struct *p) { return !(p->flags & PF_FREEZER_NOSIG); } /* Takes and releases task alloc lock using task_lock() */ extern int thaw_process(struct task_struct *p); extern void refrigerator(void); extern int freeze_processes(void); extern int cpufreq_freeze_processes(void); extern void thaw_processes(void); static inline int try_to_freeze(void) { if (freezing(current)) { refrigerator(); return 1; } else return 0; } extern bool freeze_task(struct task_struct *p, bool sig_only); extern void cancel_freezing(struct task_struct *p); #ifdef CONFIG_CGROUP_FREEZER extern int cgroup_frozen(struct task_struct *task); #else /* !CONFIG_CGROUP_FREEZER */ static inline int cgroup_frozen(struct task_struct *task) { return 0; } #endif /* !CONFIG_CGROUP_FREEZER */ /* * The PF_FREEZER_SKIP flag should be set by a vfork parent right before it * calls wait_for_completion(&vfork) and reset right after it returns from this * function. Next, the parent should call try_to_freeze() to freeze itself * appropriately in case the child has exited before the freezing of tasks is * complete. However, we don't want kernel threads to be frozen in unexpected * places, so we allow them to block freeze_processes() instead or to set * PF_NOFREEZE if needed and PF_FREEZER_SKIP is only set for userland vfork * parents. Fortunately, in the ____call_usermodehelper() case the parent won't * really block freeze_processes(), since ____call_usermodehelper() (the child) * does a little before exec/exit and it can't be frozen before waking up the * parent. */ /* * If the current task is a user space one, tell the freezer not to count it as * freezable. */ static inline void freezer_do_not_count(void) { if (current->mm) current->flags |= PF_FREEZER_SKIP; } /* * If the current task is a user space one, tell the freezer to count it as * freezable again and try to freeze it. */ static inline void freezer_count(void) { if (current->mm) { current->flags &= ~PF_FREEZER_SKIP; try_to_freeze(); } } /* * Check if the task should be counted as freezeable by the freezer */ static inline int freezer_should_skip(struct task_struct *p) { return !!(p->flags & PF_FREEZER_SKIP); } /* * Tell the freezer that the current task should be frozen by it */ static inline void set_freezable(void) { current->flags &= ~PF_NOFREEZE; } /* * Tell the freezer that the current task should be frozen by it and that it * should send a fake signal to the task to freeze it. */ static inline void set_freezable_with_signal(void) { current->flags &= ~(PF_NOFREEZE | PF_FREEZER_NOSIG); } /* * Freezer-friendly wrappers around wait_event_interruptible() and * wait_event_interruptible_timeout(), originally defined in <linux/wait.h> */ #define wait_event_freezable(wq, condition) \ ({ \ int __retval; \ do { \ __retval = wait_event_interruptible(wq, \ (condition) || freezing(current)); \ if (__retval && !freezing(current)) \ break; \ else if (!(condition)) \ __retval = -ERESTARTSYS; \ } while (try_to_freeze()); \ __retval; \ }) #define wait_event_freezable_timeout(wq, condition, timeout) \ ({ \ long __retval = timeout; \ do { \ __retval = wait_event_interruptible_timeout(wq, \ (condition) || freezing(current), \ __retval); \ } while (try_to_freeze()); \ __retval; \ }) #else /* !CONFIG_FREEZER */ static inline int frozen(struct task_struct *p) { return 0; } static inline int freezing(struct task_struct *p) { return 0; } static inline void set_freeze_flag(struct task_struct *p) {} static inline void clear_freeze_flag(struct task_struct *p) {} static inline int thaw_process(struct task_struct *p) { return 1; } static inline void refrigerator(void) {} static inline int freeze_processes(void) { BUG(); return 0; } static inline int cpufreq_freeze_processes(void) { BUG(); return 0; } static inline void thaw_processes(void) {} static inline int try_to_freeze(void) { return 0; } static inline void freezer_do_not_count(void) {} static inline void freezer_count(void) {} static inline int freezer_should_skip(struct task_struct *p) { return 0; } static inline void set_freezable(void) {} static inline void set_freezable_with_signal(void) {} #define wait_event_freezable(wq, condition) \ wait_event_interruptible(wq, condition) #define wait_event_freezable_timeout(wq, condition, timeout) \ wait_event_interruptible_timeout(wq, condition, timeout) #endif /* !CONFIG_FREEZER */ #endif /* FREEZER_H_INCLUDED */
/* Copyright (C) Max Kastanas 2010 * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef _LOGUTILS_H #define _LOGUTILS_H #ifdef __cplusplus extern "C" { #endif #ifdef __cplusplus } #endif #endif /* _LOGUTILS_H */
#include <stdio.h> int xerbla_(char *, int *); /* Subroutine */ int xerbla_(char *srname, int *info) { /* -- LAPACK auxiliary routine (version 2.0) -- Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd., Courant Institute, Argonne National Lab, and Rice University September 30, 1994 Purpose ======= XERBLA is an error handler for the LAPACK routines. It is called by an LAPACK routine if an input parameter has an invalid value. A message is printed and execution stops. Installers may consider modifying the STOP statement in order to call system-specific exception-handling facilities. Arguments ========= SRNAME (input) CHARACTER*6 The name of the routine which called XERBLA. INFO (input) INT The position of the invalid parameter in the parameter list of the calling routine. ===================================================================== */ printf("xerbla: On entry to %6s, parameter number %2d had an illegal value.\n", srname, *info); /* End of XERBLA */ return 0; } /* xerbla_ */
// BouncingBalls2014 is a program that lets you animate an LED strip // to look like a group of bouncing balls // // https://github.com/fibonacci162/LEDs/blob/master/BouncingBalls2014/BouncingBalls2014.ino // // Daniel Wilson, 2014 // // With BIG thanks to the FastLED community! /////////////////////////////////////////////////////////////////////////////////////////// #define GRAVITY -9.81 // Downward (negative) acceleration of gravity in m/s^2 #define h0 1 // Starting height, in meters, of the ball (strip length) #define NUM_BALLS 3 // Number of bouncing balls you want (recommend < 7, but 20 is fun in its own way) float h[NUM_BALLS]; // An array of heights float vImpact0 = sqrt(-2 * GRAVITY * h0); // Impact velocity of the ball when it hits the ground if "dropped" from the top of the strip float vImpact[NUM_BALLS]; // As time goes on the impact velocity will change, so make an array to store those values float tCycle[NUM_BALLS]; // The time since the last time the ball struck the ground int pos[NUM_BALLS]; // The integer position of the dot on the strip (LED index) long tLast[NUM_BALLS]; // The clock time of the last ground strike float COR[NUM_BALLS]; // Coefficient of Restitution (bounce damping) bool initialized = false; uint32_t bouncingBalls2014() { if (!initialized) { initialized = true; for (int i = 0; i < NUM_BALLS; i++) { // Initialize variables tLast[i] = millis(); h[i] = h0; pos[i] = 0; // Balls start on the ground vImpact[i] = vImpact0; // And "pop" up at vImpact0 tCycle[i] = 0; COR[i] = 0.90 - float(i) / pow(NUM_BALLS, 2); } } dimAll(120); for (int i = 0; i < NUM_BALLS; i++) { tCycle[i] = millis() - tLast[i]; // Calculate the time since the last time the ball was on the ground // A little kinematics equation calculates positon as a function of time, acceleration (gravity) and intial velocity h[i] = 0.5 * GRAVITY * pow(tCycle[i] / 1000, 2.0) + vImpact[i] * tCycle[i] / 1000; if (h[i] < 0) { h[i] = 0; // If the ball crossed the threshold of the "ground," put it back on the ground vImpact[i] = COR[i] * vImpact[i]; // and recalculate its new upward velocity as it's old velocity * COR tLast[i] = millis(); if (vImpact[i] < 0.01) vImpact[i] = vImpact0; // If the ball is barely moving, "pop" it back up at vImpact0 } pos[i] = round(h[i] * (NUM_LEDS - 1) / h0); // Map "h" to a "pos" integer index position on the LED strip } //Choose color of LEDs, then the "pos" LED on for (int i = 0; i < NUM_BALLS; i++) leds[pos[i]] = CHSV(uint8_t(i * 40), 255, 255); return 0; }
// // Copyright (C) 2014-2015 LunarG, 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 3Dlabs Inc. Ltd. 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 HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. // // Disassembler for SPIR-V. // #pragma once #ifndef disassembler_H #define disassembler_H #include <iostream> #include <vector> namespace spv { // disassemble with glslang custom disassembler void Disassemble(std::ostream& out, const std::vector<unsigned int>&); }; // end namespace spv #endif // disassembler_H
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef EXTENSIONS_BROWSER_API_SOCKET_SOCKET_H_ #define EXTENSIONS_BROWSER_API_SOCKET_SOCKET_H_ #include <stdint.h> #include <queue> #include <string> #include <utility> #include "base/callback.h" #include "base/memory/ref_counted.h" #include "build/build_config.h" #include "extensions/browser/api/api_resource.h" #include "extensions/browser/api/api_resource_manager.h" #include "net/base/completion_callback.h" #include "net/base/io_buffer.h" #include "net/base/ip_endpoint.h" #include "net/socket/tcp_client_socket.h" #if defined(OS_CHROMEOS) #include "extensions/browser/api/socket/app_firewall_hole_manager.h" #endif // OS_CHROMEOS namespace net { class AddressList; class IPEndPoint; class Socket; } namespace extensions { using CompletionCallback = base::Callback<void(int)>; using ReadCompletionCallback = base::Callback< void(int, scoped_refptr<net::IOBuffer> io_buffer, bool socket_destroying)>; using RecvFromCompletionCallback = base::Callback<void(int, scoped_refptr<net::IOBuffer> io_buffer, bool socket_destroying, const std::string&, uint16_t)>; using AcceptCompletionCallback = base::Callback<void(int, std::unique_ptr<net::TCPClientSocket>)>; // A Socket wraps a low-level socket and includes housekeeping information that // we need to manage it in the context of an extension. class Socket : public ApiResource { public: enum SocketType { TYPE_TCP, TYPE_UDP, TYPE_TLS }; ~Socket() override; // The hostname of the remote host that this socket is connected to. This // may be the empty string if the client does not intend to ever upgrade the // socket to TLS, and thusly has not invoked set_hostname(). const std::string& hostname() const { return hostname_; } // Set the hostname of the remote host that this socket is connected to. // Note: This may be an IP literal. In the case of IDNs, this should be a // series of U-LABELs (UTF-8), not A-LABELs. IP literals for IPv6 will be // unbracketed. void set_hostname(const std::string& hostname) { hostname_ = hostname; } #if defined(OS_CHROMEOS) void set_firewall_hole( std::unique_ptr<AppFirewallHole, content::BrowserThread::DeleteOnUIThread> firewall_hole) { firewall_hole_ = std::move(firewall_hole); } #endif // OS_CHROMEOS // Note: |address| contains the resolved IP address, not the hostname of // the remote endpoint. In order to upgrade this socket to TLS, callers // must also supply the hostname of the endpoint via set_hostname(). virtual void Connect(const net::AddressList& address, const CompletionCallback& callback) = 0; // |socket_destroying| is true if disconnect is due to destruction of the // socket. virtual void Disconnect(bool socket_destroying) = 0; virtual int Bind(const std::string& address, uint16_t port) = 0; // The |callback| will be called with the number of bytes read into the // buffer, or a negative number if an error occurred. virtual void Read(int count, const ReadCompletionCallback& callback) = 0; // The |callback| will be called with |byte_count| or a negative number if an // error occurred. void Write(scoped_refptr<net::IOBuffer> io_buffer, int byte_count, const CompletionCallback& callback); virtual void RecvFrom(int count, const RecvFromCompletionCallback& callback) = 0; virtual void SendTo(scoped_refptr<net::IOBuffer> io_buffer, int byte_count, const net::IPEndPoint& address, const CompletionCallback& callback) = 0; virtual bool SetKeepAlive(bool enable, int delay); virtual bool SetNoDelay(bool no_delay); virtual int Listen(const std::string& address, uint16_t port, int backlog, std::string* error_msg); virtual void Accept(const AcceptCompletionCallback& callback); virtual bool IsConnected() = 0; virtual bool GetPeerAddress(net::IPEndPoint* address) = 0; virtual bool GetLocalAddress(net::IPEndPoint* address) = 0; virtual SocketType GetSocketType() const = 0; static bool StringAndPortToIPEndPoint(const std::string& ip_address_str, uint16_t port, net::IPEndPoint* ip_end_point); static void IPEndPointToStringAndPort(const net::IPEndPoint& address, std::string* ip_address_str, uint16_t* port); protected: explicit Socket(const std::string& owner_extension_id_); void WriteData(); virtual int WriteImpl(net::IOBuffer* io_buffer, int io_buffer_size, const net::CompletionCallback& callback) = 0; virtual void OnWriteComplete(int result); std::string hostname_; bool is_connected_; private: friend class ApiResourceManager<Socket>; static const char* service_name() { return "SocketManager"; } struct WriteRequest { WriteRequest(scoped_refptr<net::IOBuffer> io_buffer, int byte_count, const CompletionCallback& callback); WriteRequest(const WriteRequest& other); ~WriteRequest(); scoped_refptr<net::IOBuffer> io_buffer; int byte_count; CompletionCallback callback; int bytes_written; }; std::queue<WriteRequest> write_queue_; scoped_refptr<net::IOBuffer> io_buffer_write_; #if defined(OS_CHROMEOS) // Represents a hole punched in the system firewall for this socket. std::unique_ptr<AppFirewallHole, content::BrowserThread::DeleteOnUIThread> firewall_hole_; #endif // OS_CHROMEOS }; } // namespace extensions #endif // EXTENSIONS_BROWSER_API_SOCKET_SOCKET_H_
#include<stdio.h> // Part of Cosmos by OpenGenus Foundation int main() { int n,i,j,min,temp; printf("\n Enter the number of Elements: "); scanf("%d",&n); int a[n]; printf("\n Enter thr %d Elements: ",n); for(i=0;i<n;i++) { scanf("%d",&a[i]); } for(i=0;i<n-1;i++) { min=i; for(j=i+1;j<n;j++) { if(a[min]>a[j]) min=j; } if(min!=i) { temp=a[i]; a[i]=a[min]; a[min]=temp; } } printf("\n The Sorted array is : "); for(i=0;i<n;i++) { printf("%d ",a[i]); } return 0; }
#include <stdio.h> #include <stdlib.h> #include<limits.h> typedef struct Stack { int top; unsigned capacity; int* array; }Stack; Stack* createStack(unsigned capacity) { struct Stack* stack = (Stack*) malloc(sizeof(Stack)); stack->capacity = capacity; stack->top = -1; stack->array = (int*) malloc(stack->capacity * sizeof(int)); return stack; } int Full(Stack* stack) { return stack->top == stack->capacity - 1; } int Empty(Stack* stack) { return stack->top == -1; } void push(Stack* stack, int item) { if (Full(stack)) return; stack->array[++stack->top] = item; printf("%d pushed to stack\n", item); } int pop(Stack* stack) { if (Empty(stack)) return INT_MIN; return stack->array[stack->top--]; } int peek(Stack* stack) { if (Empty(stack)) return INT_MIN; return stack->array[stack->top]; } int main() { Stack* stack = createStack(100); push(stack, 14); push(stack, 25); push(stack, 38); push(stack, 48); printf("%d popped from stack\n", pop(stack)); printf("Top item is %d\n", peek(stack)); return 0; } //output /*14 pushed to stack 25 pushed to stack 38 pushed to stack 48 pushed to stack 48 popped from stack Top item is 38*/
/* * Generated by asn1c-0.9.24 (http://lionet.info/asn1c) * From ASN.1 module "EUTRA-RRC-Definitions" * found in "fixed_grammar.asn" * `asn1c -gen-PER` */ #include "CellsToAddModListUTRA-TDD.h" static asn_per_constraints_t asn_PER_type_CellsToAddModListUTRA_TDD_constr_1 GCC_NOTUSED = { { APC_UNCONSTRAINED, -1, -1, 0, 0 }, { APC_CONSTRAINED, 5, 5, 1, 32 } /* (SIZE(1..32)) */, 0, 0 /* No PER value map */ }; static asn_TYPE_member_t asn_MBR_CellsToAddModListUTRA_TDD_1[] = { { ATF_POINTER, 0, 0, (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, &asn_DEF_CellsToAddModUTRA_TDD, 0, /* Defer constraints checking to the member type */ 0, /* No PER visible constraints */ 0, "" }, }; static ber_tlv_tag_t asn_DEF_CellsToAddModListUTRA_TDD_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_CellsToAddModListUTRA_TDD_specs_1 = { sizeof(struct CellsToAddModListUTRA_TDD), offsetof(struct CellsToAddModListUTRA_TDD, _asn_ctx), 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_CellsToAddModListUTRA_TDD = { "CellsToAddModListUTRA-TDD", "CellsToAddModListUTRA-TDD", SEQUENCE_OF_free, SEQUENCE_OF_print, SEQUENCE_OF_constraint, SEQUENCE_OF_decode_ber, SEQUENCE_OF_encode_der, SEQUENCE_OF_decode_xer, SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, SEQUENCE_OF_decode_aper, SEQUENCE_OF_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_CellsToAddModListUTRA_TDD_tags_1, sizeof(asn_DEF_CellsToAddModListUTRA_TDD_tags_1) /sizeof(asn_DEF_CellsToAddModListUTRA_TDD_tags_1[0]), /* 1 */ asn_DEF_CellsToAddModListUTRA_TDD_tags_1, /* Same as above */ sizeof(asn_DEF_CellsToAddModListUTRA_TDD_tags_1) /sizeof(asn_DEF_CellsToAddModListUTRA_TDD_tags_1[0]), /* 1 */ &asn_PER_type_CellsToAddModListUTRA_TDD_constr_1, asn_MBR_CellsToAddModListUTRA_TDD_1, 1, /* Single element */ &asn_SPC_CellsToAddModListUTRA_TDD_specs_1 /* Additional specs */ };
// ====================================================================== // // Copyright (c) 2002 SurfLab of CISE of University of Florida // // File : libs/src/cgalExt/Polyhedron_memory_builder.h // Description : Build the polyhedron from the input stream // (.10/.mesh format) // Creation_date : 31 Jan 2002 // Author(s) : Le-Jeng Shiue <sle-jeng@cise.ufl.edu> // // ====================================================================== // $Id: Polyhedron_memory_builder.h,v 1.7 2004/05/19 19:59:07 sle-jeng Exp $ #ifndef _POLYHEDRON_MEMORY_BUILDER_H_01312002 #define _POLYHEDRON_MEMORY_BUILDER_H_01312002 #include <CGAL/Cartesian.h> #include <CGAL/Polyhedron_3.h> #include <CGAL/Polyhedron_incremental_builder_3.h> #include <sstream> /** * Polyhedron_memory_builder is a modifier (check CGAL ref.) creating * a polyhedron from a input stream that has .10/.mesh format. */ template <class _Poly> // P should be a class type of polyhedron class Polyhedron_memory_builder : public CGAL::Modifier_base<typename _Poly::HalfedgeDS> { protected: typedef _Poly Polyhedron; typedef typename Polyhedron::Traits Traits; typedef typename Traits::Kernel Kernel; typedef typename Polyhedron::HalfedgeDS HDS; typedef typename Polyhedron::Point_3 Point; typedef typename Kernel::FT FT; typedef CGAL::Polyhedron_incremental_builder_3<HDS> PIB; public: /// Polyhedron_memory_builder() : num_point(0), point_buffer(NULL), num_facet(0), facet_buffer(NULL) {} /// Polyhedron_memory_builder(int nump, FT* pb, int numf, int** fb) : num_point(nump), point_buffer(pb), num_facet(numf), facet_buffer(fb), c_pointer(true) {} /// Polyhedron_memory_builder(int nump, Point* pb, int numf, int** fb) : num_point(nump), point_buffer(pb), num_facet(numf), facet_buffer(fb), c_pointer(false) {} /// inline void setInputMemory(int nump, FT* pb, int numf, int** fb) { num_point = nump; point_buffer = pb; num_facet = numf; facet_buffer = fb; c_pointer = true; } /// inline void setInputMemory(int nump, Point* pb, int numf, int** fb) { num_point = nump; point_buffer = pb; num_facet = numf; facet_buffer = fb; c_pointer = false; } /// inline void operator()(HDS& hds) { if (point_buffer != NULL && facet_buffer != NULL) { PIB pib(hds, true); c_pointer ? buildPolyhedron_c(pib) : buildPolyhedron_pt(pib); } } private: inline void buildPolyhedron_c(PIB& B); inline void buildPolyhedron_pt(PIB& B); protected: int num_point; void* point_buffer; int num_facet; int** facet_buffer; bool c_pointer; }; template <class HDS> void Polyhedron_memory_builder<HDS>::buildPolyhedron_c(PIB& pb) { FT* p = (FT*) point_buffer; pb.begin_surface(num_point, num_facet); { for (int i = 0; i < num_point; ++i) pb.add_vertex(Point(p[i*3+0], p[i*3+1], p[i*3+2])); for (int i = 0; i < num_facet; ++i) { pb.begin_facet(); { for (int n = 0; n < facet_buffer[i][0]; ++n) pb.add_vertex_to_facet(facet_buffer[i][n+1]); } pb.end_facet(); } } pb.end_surface(); } template <class HDS> void Polyhedron_memory_builder<HDS>::buildPolyhedron_pt(PIB& pb) { Point* p = (Point*) point_buffer; pb.begin_surface(num_point, num_facet); { for (int i = 0; i < num_point; ++i) pb.add_vertex(p[i]); for (int i = 0; i < num_facet; ++i) { pb.begin_facet(); { for (int n = 0; n < facet_buffer[i][0]; ++n) pb.add_vertex_to_facet(facet_buffer[i][n+1]); } pb.end_facet(); } } pb.end_surface(); } #endif //_POLYHEDRON_MEMORY_BUILDER_H_01312002
#ifdef INTER_TETHER #ifndef MCMD_MC_TETHER_POTENTIAL_H #define MCMD_MC_TETHER_POTENTIAL_H /* * Simpatico - Simulation Package for Polymeric and Molecular Liquids * * Copyright 2010 - 2014, The Regents of the University of Minnesota * Distributed under the terms of the GNU General Public License. */ #include <mcMd/potentials/tether/TetherPotential.h> // base class namespace McMd { using namespace Util; class System; /** * A TetherPotential for MC simulations. * * \ingroup McMd_Tether_Module */ class McTetherPotential : public TetherPotential { #if 0 public: /** * Constructor. */ McTetherPotential(); /** * Destructor. */ virtual ~McTetherPotential(); /** * Calculate the tether energy for a specified Atom. * * \param atom Atom object of interest * \return tether potential energy of atom */ virtual double atomEnergy(const Atom& atom) const = 0; #endif }; } #endif #endif
/** * Copyright 2013-2015 Seagate Technology LLC. * * This Source Code Form is subject to the terms of the Mozilla * Public License, v. 2.0. If a copy of the MPL was not * distributed with this file, You can obtain one at * https://mozilla.org/MP:/2.0/. * * This program is distributed in the hope that it will be useful, * but is provided AS-IS, WITHOUT ANY WARRANTY; including without * the implied warranty of MERCHANTABILITY, NON-INFRINGEMENT or * FITNESS FOR A PARTICULAR PURPOSE. See the Mozilla Public * License for more details. * * See www.openkinetic.org for more project information */ #include "kinetic_types_internal.h" uint32_t KineticNBO_FromHostU32(uint32_t valueHost); uint32_t KineticNBO_ToHostU32(uint32_t valueNBO); uint64_t KineticNBO_FromHostU64(uint64_t valueHost); uint64_t KineticNBO_ToHostU64(uint64_t valueNBO);
/**************************************************************** * * * Copyright 2009, 2011 Fidelity Information Services, Inc * * * * This source code contains the intellectual property * * of its copyright holder(s), and is made available * * under a license. If you do not know the terms of * * the license, please stop and do not read further. * * * ****************************************************************/ #include "mdef.h" #include "gtm_stdio.h" #include "gtm_string.h" #include <rtnhdr.h> #include "stack_frame.h" #include "op.h" #include "lv_val.h" #include "gdsroot.h" #include "gtm_facility.h" #include "fileinfo.h" #include "gdsbt.h" #include "gdsfhead.h" #include "alias.h" #include "min_max.h" GBLREF stack_frame *frame_pointer; GBLREF symval *curr_symval; GBLREF uint4 dollar_tlevel; LITREF mval literal_null; /* Operation - The destination variable becomes a container variable holding a pointer to source alias * * 1) Convert the src lvval to an alias variable if necessary (by manipulating the reference counts * 2) Save the address of the source lv_val in the destination var, setting the mval container flag. * 3) Whichever symval of source or destination is greatest, that is the earliest symval affected. We * feed that to the MARK_ALIAS_ACTIVE macro to mark all intervening symvals as having alias * activity and that covers both potential symvals so we don't have to call the macro twice. */ void op_setalsin2alsct(lv_val *srclv, lv_val *dstlv) { lv_val *dst_lvbase; symval *sym_srclv, *sym_dstlv; assert(srclv); assert(LV_IS_BASE_VAR(srclv)); /* Verify base var */ assert(dstlv); assert(!LV_IS_BASE_VAR(dstlv)); /* Verify subscripted var */ dst_lvbase = LV_GET_BASE_VAR(dstlv); if (dollar_tlevel && (NULL != dst_lvbase->tp_var) && !dst_lvbase->tp_var->var_cloned) TP_VAR_CLONE(dst_lvbase); /* clone the tree. */ /* Decrement alias container refs (if any) and cleanup if necessary */ DECR_AC_REF(dstlv, TRUE); /* Reset value of lv_val to now be a container ref to the supplied base var */ memcpy(&dstlv->v, &literal_null, SIZEOF(mval)); dstlv->v.mvtype |= MV_ALIASCONT; /* Set the magic container flag */ dstlv->v.str.addr = (char *)srclv; /* And save our reference */ assert(0 < srclv->stats.trefcnt); assert(0 <= srclv->stats.crefcnt); INCR_TREFCNT(srclv); /* Total reference counts */ INCR_CREFCNT(srclv); /* .. and a contain reference at that.. */ assert(srclv->stats.trefcnt >= srclv->stats.crefcnt); /* These symvals have had alias activity */ sym_srclv = LV_GET_SYMVAL(srclv); sym_dstlv = LV_GET_SYMVAL(dst_lvbase); MARK_ALIAS_ACTIVE(MIN(sym_srclv->symvlvl, sym_dstlv->symvlvl)); /* Last operation is to mark the base var for our container array that it now has a container in it. * But first it must be found by going backwards through the levels. */ MARK_CONTAINER_ONBOARD(dst_lvbase); }
/* Copyright (C) 2004 by Jorrit Tyberghein (C) 2004 by Frank Richter This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __CS_CSTOOL_RBUFLOCK_H__ #define __CS_CSTOOL_RBUFLOCK_H__ /**\file * Helper class for convenient locking/unlocking of an iRenderBuffer. */ #include "csutil/ref.h" #include "ivideo/rndbuf.h" /** * Helper class for convenient locking/unlocking of an iRenderBuffer. * * The buffer is locked upon construction of the csRenderBufferLock<> object * and unlocked on destruction. * * The contents can be accessed either directly, array-style or iterator-style * in a typed way. * \remarks The TbufferKeeper template argument can be used to have the * lock store the buffer in a csRef<iRenderBuffer> (instead a iRenderBuffer*) * in case there is a risk that the buffer gets destroyed while thelock * exists. */ template <class T, class TbufferKeeper = iRenderBuffer*> class csRenderBufferLock { /// Buffer that is being locked TbufferKeeper buffer; /// Buffer data T* lockBuf; /// Distance between two elements size_t bufStride; #ifdef CS_DEBUG /// Number of elements size_t elements; #endif /// Index of current element size_t currElement; typedef csRenderBufferLock<T, TbufferKeeper> LockType; /** * Helper class used when returning values from operators such as * ++ or +=. The idea is that these operators should return a pointer * to the element, yet should check accesses for validity in debug mode. * However, it is quite common to increment the element pointer beyond * the last element in loops, but not use it. Checking the element number * for validity may throw a false alarm in this cases. Hence this class * to allow for "delayed" checking. */ struct PointerProxy { #ifdef CS_DEBUG const LockType& parent; size_t elemNum; #else T* p; #endif PointerProxy (const LockType& parent, size_t elemNum) #ifdef CS_DEBUG : parent (parent), elemNum (elemNum) #else : p (&parent.Get (elemNum)) #endif { } T& operator*() { #ifdef CS_DEBUG return parent.Get (elemNum); #else return *p; #endif } const T& operator*() const { #ifdef CS_DEBUG return parent.Get (elemNum); #else return *p; #endif } operator T*() const { #ifdef CS_DEBUG return &(parent.Get (elemNum)); #else return p; #endif } }; csRenderBufferLock() {} // Copying the locking stuff is somewhat nasty so ... prevent it csRenderBufferLock (const csRenderBufferLock& other) {} /// Unlock the renderbuffer. void Unlock () { if (buffer) buffer->Release(); } public: /** * Construct the helper. Locks the buffer. */ csRenderBufferLock (iRenderBuffer* buf, csRenderBufferLockType lock = CS_BUF_LOCK_NORMAL) : buffer(buf), lockBuf(0), bufStride(buf ? buf->GetElementDistance() : 0), currElement(0) { #ifdef CS_DEBUG elements = buf ? buf->GetElementCount() : 0; #endif lockBuf = buffer ? ((T*)((uint8*)buffer->Lock (lock))) : (T*)-1; } /** * Destruct the helper. Unlocks the buffer. */ ~csRenderBufferLock() { Unlock(); } /** * Lock the renderbuffer. Returns a pointer to the contained data. * \remarks Watch the stride of the buffer. */ T* Lock () const { return lockBuf; } /** * Retrieve a pointer to the contained data. * \remarks Watch the stride of the buffer. **/ operator T* () const { return Lock(); } /// Get current element. T& operator*() const { return Get (currElement); } /// Set current element to the next, pre-increment version. PointerProxy operator++ () { currElement++; return PointerProxy (*this, currElement); } /// Set current element to the next, post-increment version. PointerProxy operator++ (int) { size_t n = currElement; currElement++; return PointerProxy (*this, n); } /// Add a value to the current element index. PointerProxy operator+= (int n) { currElement += n; return PointerProxy (*this, currElement); } /// Retrieve an item in the render buffer. T& operator [] (size_t n) const { return Get (n); } /// Retrieve an item in the render buffer. T& Get (size_t n) const { CS_ASSERT (n < elements); return *((T*)((uint8*)Lock() + n * bufStride)); } /// Retrieve number of items in buffer. size_t GetSize() const { return buffer ? buffer->GetElementCount() : 0; } /// Returns whether the buffer is valid (ie not null). bool IsValid() const { return buffer.IsValid(); } }; #endif // __CS_CSTOOL_RBUFLOCK_H__
/**************************************************************************** ** ** 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://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional ** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef SETTINGSPAGE_H #define SETTINGSPAGE_H #include "ui_settingspage.h" #include <coreplugin/dialogs/ioptionspage.h> #include <QPointer> namespace UpdateInfo { namespace Internal { class UpdateInfoPlugin; class SettingsPage : public Core::IOptionsPage { Q_OBJECT public: explicit SettingsPage(UpdateInfoPlugin *plugin); QWidget *widget(); void apply(); void finish(); private: QPointer<QWidget> m_widget; Ui::SettingsWidget m_ui; UpdateInfoPlugin *m_plugin; }; } // namespace Internal } // namespace UpdateInfo #endif // SETTINGSPAGE_H
/** * MltFilter.h - MLT Wrapper * Copyright (C) 2004-2015 Meltytech, LLC * Author: Charles Yates <charles.yates@gmail.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef MLTPP_FRAME_H #define MLTPP_FRAME_H #include "MltConfig.h" #include <framework/mlt.h> #include "MltProperties.h" namespace Mlt { class Properties; class Producer; class Service; class MLTPP_DECLSPEC Frame : public Properties { private: mlt_frame instance; public: Frame(); Frame( mlt_frame frame ); Frame( Frame &frame ); Frame( const Frame &frame ); virtual ~Frame( ); Frame& operator=( const Frame &frame ); virtual mlt_frame get_frame( ); mlt_properties get_properties( ); uint8_t *get_image( mlt_image_format &format, int &w, int &h, int writable = 0 ); unsigned char *fetch_image( mlt_image_format format, int w, int h, int writable = 0 ); void *get_audio( mlt_audio_format &format, int &frequency, int &channels, int &samples ); unsigned char *get_waveform( int w, int h ); Producer *get_original_producer( ); int get_position( ); mlt_properties get_unique_properties( Service &service ); int set_image( uint8_t *image, int size, mlt_destructor destroy ); int set_alpha( uint8_t *alpha, int size, mlt_destructor destroy ); }; } #endif
/****************************************************************/ /* DO NOT MODIFY THIS HEADER */ /* MOOSE - Multiphysics Object Oriented Simulation Environment */ /* */ /* (c) 2010 Battelle Energy Alliance, LLC */ /* ALL RIGHTS RESERVED */ /* */ /* Prepared by Battelle Energy Alliance, LLC */ /* Under Contract No. DE-AC07-05ID14517 */ /* With the U. S. Department of Energy */ /* */ /* See COPYRIGHT for full restrictions */ /****************************************************************/ #ifndef LIBMESHPARTITIONER_H #define LIBMESHPARTITIONER_H #include "MoosePartitioner.h" class LibmeshPartitioner; template<> InputParameters validParams<LibmeshPartitioner>(); class LibmeshPartitioner : public MoosePartitioner { public: LibmeshPartitioner(const InputParameters & params); virtual ~LibmeshPartitioner(); virtual std::unique_ptr<Partitioner> clone() const; virtual void partition(MeshBase &mesh, const unsigned int n); virtual void partition(MeshBase &mesh); protected: virtual void _do_partition(MeshBase & mesh, const unsigned int n); std::unique_ptr<Partitioner> _partitioner; MooseEnum _partitioner_name; }; #endif /* LIBMESHPARTITIONER_H */
/**************************************************************************** ** ** Copyright (C) 2013 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://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional ** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef CLASSNAMEVALIDATINGLINEEDIT_H #define CLASSNAMEVALIDATINGLINEEDIT_H #include "basevalidatinglineedit.h" namespace Utils { struct ClassNameValidatingLineEditPrivate; class QTCREATOR_UTILS_EXPORT ClassNameValidatingLineEdit : public Utils::BaseValidatingLineEdit { Q_OBJECT Q_PROPERTY(bool namespacesEnabled READ namespacesEnabled WRITE setNamespacesEnabled DESIGNABLE true) Q_PROPERTY(bool lowerCaseFileName READ lowerCaseFileName WRITE setLowerCaseFileName) public: explicit ClassNameValidatingLineEdit(QWidget *parent = 0); virtual ~ClassNameValidatingLineEdit(); bool namespacesEnabled() const; void setNamespacesEnabled(bool b); QString namespaceDelimiter(); void setNamespaceDelimiter(const QString &delimiter); bool lowerCaseFileName() const; void setLowerCaseFileName(bool v); bool forceFirstCapitalLetter() const; void setForceFirstCapitalLetter(bool b); // Clean an input string to get a valid class name. static QString createClassName(const QString &name); signals: // Will be emitted with a suggestion for a base name of the // source/header file of the class. void updateFileName(const QString &t); protected: virtual bool validate(const QString &value, QString *errorMessage) const; virtual void slotChanged(const QString &t); virtual QString fixInputString(const QString &string); private: void updateRegExp() const; ClassNameValidatingLineEditPrivate *d; }; } // namespace Utils #endif // CLASSNAMEVALIDATINGLINEEDIT_H
/****************************************************************/ /* DO NOT MODIFY THIS HEADER */ /* MOOSE - Multiphysics Object Oriented Simulation Environment */ /* */ /* (c) 2010 Battelle Energy Alliance, LLC */ /* ALL RIGHTS RESERVED */ /* */ /* Prepared by Battelle Energy Alliance, LLC */ /* Under Contract No. DE-AC07-05ID14517 */ /* With the U. S. Department of Energy */ /* */ /* See COPYRIGHT for full restrictions */ /****************************************************************/ #ifndef SETUPINTERFACECOUT_H #define SETUPINTERFACECOUT_H // MOOSE includes #include "GeneralPostprocessor.h" #include "ElementPostprocessor.h" #include "SidePostprocessor.h" #include "InternalSidePostprocessor.h" #include "NodalPostprocessor.h" // Forward declarations class GeneralSetupInterfaceCount; class ElementSetupInterfaceCount; class SideSetupInterfaceCount; class InternalSideSetupInterfaceCount; class NodalSetupInterfaceCount; template <> InputParameters validParams<GeneralSetupInterfaceCount>(); template <> InputParameters validParams<ElementSetupInterfaceCount>(); template <> InputParameters validParams<SideSetupInterfaceCount>(); template <> InputParameters validParams<InternalSideSetupInterfaceCount>(); template <> InputParameters validParams<NodalSetupInterfaceCount>(); /** * A class for testing the number of calls to the various SetupInterface methods. */ template <class T> class SetupInterfaceCount : public T { public: SetupInterfaceCount(const InputParameters & parameters); ///@{ /** * Each setup methods simply increments a counter. */ virtual void initialSetup() { _counts["initial"]++; } virtual void timestepSetup() { _counts["timestep"]++; } virtual void residualSetup() { _counts["linear"]++; } virtual void jacobianSetup() { _counts["nonlinear"]++; } virtual void initialize(); virtual void finalize(); virtual void execute() { _execute++; } ///@} ///@{ /** * Helper functions to account for final on subdomainSetup and threadJoin */ void subdomainSetupHelper() { _counts["subdomain"]++; } void threadJoinHelper(const UserObject & uo); ///@} /** * Return the count base on the count type supplied in the input file. */ PostprocessorValue getValue(); private: /// The type of count to report MooseEnum _count_type; /// Local count of execute (allows execute count to work with parallel and threading) unsigned int _execute; /// Storage for the various counts std::map<std::string, unsigned int> & _counts; }; template <class T> SetupInterfaceCount<T>::SetupInterfaceCount(const InputParameters & parameters) : T(parameters), _count_type(T::template getParam<MooseEnum>("count_type")), _execute(0), _counts(T::template declareRestartableData<std::map<std::string, unsigned int>>("counts")) { // Initialize the count storage map const std::vector<std::string> & names = _count_type.getNames(); for (std::vector<std::string>::const_iterator it = names.begin(); it != names.end(); ++it) _counts[*it] = 0; } template <class T> PostprocessorValue SetupInterfaceCount<T>::getValue() { unsigned int count = _counts[_count_type]; return count; } template <class T> void SetupInterfaceCount<T>::initialize() { _counts["initialize"]++; _execute = 0; } template <class T> void SetupInterfaceCount<T>::finalize() { T::gatherSum(_execute); _counts["execute"] += _execute; _counts["finalize"]++; } template <class T> void SetupInterfaceCount<T>::threadJoinHelper(const UserObject & uo) { // Accumulate 'execute' count from other threads const SetupInterfaceCount<T> & sic = static_cast<const SetupInterfaceCount<T> &>(uo); _execute += sic._execute; _counts["threadjoin"]++; } // Define objects for each of the UserObject base classes class GeneralSetupInterfaceCount : public SetupInterfaceCount<GeneralPostprocessor> { public: GeneralSetupInterfaceCount(const InputParameters & parameters); }; class ElementSetupInterfaceCount : public SetupInterfaceCount<ElementPostprocessor> { public: ElementSetupInterfaceCount(const InputParameters & parameters); protected: virtual void threadJoin(const UserObject & uo) { threadJoinHelper(uo); } virtual void subdomainSetup() { subdomainSetupHelper(); } }; class SideSetupInterfaceCount : public SetupInterfaceCount<SidePostprocessor> { public: SideSetupInterfaceCount(const InputParameters & parameters); protected: virtual void threadJoin(const UserObject & uo) { threadJoinHelper(uo); } virtual void subdomainSetup() { subdomainSetupHelper(); } }; class InternalSideSetupInterfaceCount : public SetupInterfaceCount<InternalSidePostprocessor> { public: InternalSideSetupInterfaceCount(const InputParameters & parameters); protected: virtual void threadJoin(const UserObject & uo) { threadJoinHelper(uo); } virtual void subdomainSetup() { subdomainSetupHelper(); } }; class NodalSetupInterfaceCount : public SetupInterfaceCount<NodalPostprocessor> { public: NodalSetupInterfaceCount(const InputParameters & parameters); protected: virtual void threadJoin(const UserObject & uo) { threadJoinHelper(uo); } virtual void subdomainSetup() { subdomainSetupHelper(); } }; #endif // SETUPINTERFACECOUT_H
/* * filter_freeze.c -- simple frame freezing filter * Copyright (C) 2007 Jean-Baptiste Mardelle <jb@kdenlive.org> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <framework/mlt_filter.h> #include <framework/mlt_frame.h> #include <framework/mlt_producer.h> #include <framework/mlt_service.h> #include <framework/mlt_factory.h> #include <framework/mlt_property.h> #include <stdio.h> #include <string.h> static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format *format, int *width, int *height, int writable ) { // Get the image mlt_filter filter = mlt_frame_pop_service( frame ); mlt_properties properties = MLT_FILTER_PROPERTIES( filter ); mlt_properties props = MLT_FRAME_PROPERTIES( frame ); mlt_frame freeze_frame = NULL;; int freeze_before = mlt_properties_get_int( properties, "freeze_before" ); int freeze_after = mlt_properties_get_int( properties, "freeze_after" ); mlt_position pos = mlt_properties_get_position( properties, "frame" ) + mlt_producer_get_in( mlt_frame_get_original_producer( frame ) ); mlt_position currentpos = mlt_filter_get_position( filter, frame ); int do_freeze = 0; if (freeze_before == 0 && freeze_after == 0) { do_freeze = 1; } else if (freeze_before != 0 && pos > currentpos) { do_freeze = 1; } else if (freeze_after != 0 && pos < currentpos) { do_freeze = 1; } if (do_freeze == 1) { mlt_service_lock( MLT_FILTER_SERVICE( filter ) ); freeze_frame = mlt_properties_get_data( properties, "freeze_frame", NULL ); if ( !freeze_frame || mlt_properties_get_position( properties, "_frame" ) != pos ) { // freeze_frame has not been fetched yet or is not useful, so fetch it and cache it. // get parent producer mlt_producer producer = mlt_producer_cut_parent( mlt_frame_get_original_producer( frame ) ); mlt_producer_seek( producer, pos ); // Get the frame mlt_service_get_frame( mlt_producer_service(producer), &freeze_frame, 0 ); mlt_properties freeze_properties = MLT_FRAME_PROPERTIES( freeze_frame ); mlt_properties_set( freeze_properties, "rescale.interp", mlt_properties_get( props, "rescale.interp" ) ); mlt_properties_set_double( freeze_properties, "aspect_ratio", mlt_frame_get_aspect_ratio( frame ) ); mlt_properties_set_int( freeze_properties, "progressive", mlt_properties_get_int( props, "progressive" ) ); mlt_properties_set_int( freeze_properties, "consumer_deinterlace", mlt_properties_get_int( props, "consumer_deinterlace" ) || mlt_properties_get_int( properties, "deinterlace" ) ); mlt_properties_set_data( properties, "freeze_frame", freeze_frame, 0, ( mlt_destructor )mlt_frame_close, NULL ); mlt_properties_set_position( properties, "_frame", pos ); } mlt_service_unlock( MLT_FILTER_SERVICE( filter ) ); // Get frozen image uint8_t *buffer = NULL; int error = mlt_frame_get_image( freeze_frame, &buffer, format, width, height, 1 ); // Copy it to current frame int size = mlt_image_format_size( *format, *width, *height, NULL ); uint8_t *image_copy = mlt_pool_alloc( size ); memcpy( image_copy, buffer, size ); *image = image_copy; mlt_frame_set_image( frame, *image, size, mlt_pool_release ); uint8_t *alpha_buffer = mlt_frame_get_alpha_mask( freeze_frame ); int alphasize = *width * *height; uint8_t *alpha_copy = mlt_pool_alloc( alphasize ); memcpy( alpha_copy, alpha_buffer, alphasize ); mlt_frame_set_alpha( frame, alpha_copy, alphasize, mlt_pool_release ); return error; } int error = mlt_frame_get_image( frame, image, format, width, height, 1 ); return error; } /** Filter processing. */ static mlt_frame filter_process( mlt_filter filter, mlt_frame frame ) { // Push the filter on to the stack mlt_frame_push_service( frame, filter ); // Push the frame filter mlt_frame_push_get_image( frame, filter_get_image ); return frame; } /** Constructor for the filter. */ mlt_filter filter_freeze_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg ) { mlt_filter filter = mlt_filter_new( ); if ( filter != NULL ) { filter->process = filter_process; // Set the frame which will be chosen for freeze mlt_properties_set( MLT_FILTER_PROPERTIES( filter ), "frame", "0" ); // If freeze_after = 1, only frames after the "frame" value will be frozen mlt_properties_set( MLT_FILTER_PROPERTIES( filter ), "freeze_after", "0" ); // If freeze_before = 1, only frames before the "frame" value will be frozen mlt_properties_set( MLT_FILTER_PROPERTIES( filter ), "freeze_before", "0" ); } return filter; }
/*************************************************************************** * include/stxxl/bits/libstxxl.h * * Part of the STXXL. See http://stxxl.sourceforge.net * * Copyright (C) 2011 Andreas Beckmann <beckmann@cs.uni-frankfurt.de> * * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) **************************************************************************/ #ifndef STXXL_LIBSTXXL_HEADER #define STXXL_LIBSTXXL_HEADER #include <stxxl/bits/config.h> #if STXXL_MSVC #ifndef STXXL_LIBNAME #define STXXL_LIBNAME "stxxl" #endif //-tb #pragma comment (lib, "lib" STXXL_LIBNAME ".lib") #endif #endif // !STXXL_LIBSTXXL_HEADER
/***************************************************************************** * * * OpenNI 2.x Alpha * * Copyright (C) 2012 PrimeSense Ltd. * * * * This file is part of OpenNI. * * * * 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 _ONI_ENUMS_H_ #define _ONI_ENUMS_H_ namespace kinect { /** Possible failure values */ typedef enum { STATUS_OK = 0, STATUS_ERROR = 1, STATUS_NOT_IMPLEMENTED = 2, STATUS_NOT_SUPPORTED = 3, STATUS_BAD_PARAMETER = 4, STATUS_OUT_OF_FLOW = 5, STATUS_NO_DEVICE = 6, STATUS_TIME_OUT = 102, } Status; /** The source of the stream */ typedef enum { SENSOR_IR = 1, SENSOR_COLOR = 2, SENSOR_DEPTH = 3, } SensorType; /** All available formats of the output of a stream */ typedef enum { // Depth PIXEL_FORMAT_DEPTH_1_MM = 100, PIXEL_FORMAT_DEPTH_100_UM = 101, PIXEL_FORMAT_SHIFT_9_2 = 102, PIXEL_FORMAT_SHIFT_9_3 = 103, // Color PIXEL_FORMAT_RGB888 = 200, PIXEL_FORMAT_YUV422 = 201, PIXEL_FORMAT_GRAY8 = 202, PIXEL_FORMAT_GRAY16 = 203, PIXEL_FORMAT_JPEG = 204, } PixelFormat; typedef enum { DEVICE_STATE_OK = 0, DEVICE_STATE_ERROR = 1, DEVICE_STATE_NOT_READY = 2, DEVICE_STATE_EOF = 3 } DeviceState; typedef enum { IMAGE_REGISTRATION_OFF = 0, IMAGE_REGISTRATION_DEPTH_TO_COLOR = 1, } ImageRegistrationMode; static const int TIMEOUT_NONE = 0; static const int TIMEOUT_FOREVER = -1; } // namespace openni #endif // _ONI_ENUMS_H_