text
stringlengths
4
6.14k
/* * FDIOStream.h * * Created on: Sep 27, 2012 * Author: Mitchell Wills */ #ifndef FDIOSTREAM_H_ #define FDIOSTREAM_H_ class FDIOStream; #include "IOStream.h" #include <stdio.h> class FDIOStream : public IOStream{ private: //FILE* f; int fd; public: FDIOStream(int fd); virtual ~FDIOStream(); int read(void* ptr, int numbytes); int write(const void* ptr, int numbytes); void flush(); void close(); }; #endif /* FDIOSTREAM_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 COMPONENTS_SYNC_BASE_PREF_NAMES_H_ #define COMPONENTS_SYNC_BASE_PREF_NAMES_H_ #include "build/build_config.h" namespace syncer { namespace prefs { extern const char kSyncLastSyncedTime[]; extern const char kSyncLastPollTime[]; extern const char kSyncPollIntervalSeconds[]; extern const char kSyncFirstSetupComplete[]; extern const char kSyncKeepEverythingSynced[]; #if defined(OS_CHROMEOS) extern const char kOsSyncPrefsMigrated[]; extern const char kOsSyncFeatureEnabled[]; extern const char kSyncAllOsTypes[]; extern const char kSyncOsApps[]; extern const char kSyncOsPreferences[]; #endif extern const char kSyncApps[]; extern const char kSyncAutofill[]; extern const char kSyncBookmarks[]; extern const char kSyncExtensions[]; extern const char kSyncPasswords[]; extern const char kSyncPreferences[]; extern const char kSyncReadingList[]; extern const char kSyncTabs[]; extern const char kSyncThemes[]; extern const char kSyncTypedUrls[]; extern const char kSyncWifiConfigurations[]; extern const char kSyncManaged[]; extern const char kSyncRequested[]; extern const char kSyncEncryptionBootstrapToken[]; extern const char kSyncKeystoreEncryptionBootstrapToken[]; extern const char kSyncGaiaId[]; extern const char kSyncCacheGuid[]; extern const char kSyncBirthday[]; extern const char kSyncBagOfChips[]; extern const char kSyncPassphrasePrompted[]; extern const char kSyncInvalidationVersions[]; extern const char kSyncLastRunVersion[]; extern const char kEnableLocalSyncBackend[]; extern const char kLocalSyncBackendDir[]; extern const char kSyncDemographics[]; extern const char kSyncDemographicsBirthYearOffset[]; // These are not prefs, they are paths inside of kSyncDemographics. extern const char kSyncDemographics_BirthYearPath[]; extern const char kSyncDemographics_GenderPath[]; } // namespace prefs } // namespace syncer #endif // COMPONENTS_SYNC_BASE_PREF_NAMES_H_
/* * olsr_callbacks.h * * Created on: Feb 8, 2011 * Author: henning */ #ifndef OLSR_CALLBACKS_H_ #define OLSR_CALLBACKS_H_ #include "common/list.h" #include "common/avl.h" #include "defs.h" /* general notes: * * memory allocation: we are completely independent of the memory manager! * Therefore you have to allocate all memory yourself and in general pass pointers * to your memory region for each function */ struct olsr_callback_provider { struct avl_node node; char *name; /* key for avl node . The consumers need this name as key */ struct list_entity callbacks; uint32_t obj_count; /* bookkeeping */ bool in_use; /* protection against recursive callbacks. Set to true if we are in a callback */ /* convert pointer to object into char * (name of the key). * This helps for debugging. You can now print identifiers * of the object pointed to */ const char *(*getKey)(void *); }; struct olsr_callback_consumer { struct list_entity node; struct olsr_callback_provider *provider; /* backptr to the provider */ char *name; /* name of the consumer */ void (*add)(void *); /* callback ptr when something gets added . Parameter is pointer to the object */ void (*change)(void *); /* same, but for change */ void (*remove)(void *); /* same, but for remove */ }; void olsr_callback_init(void); void olsr_callback_cleanup(void); int EXPORT(olsr_callback_prv_create)(struct olsr_callback_provider *, const char *); void EXPORT(olsr_callback_prv_destroy)(struct olsr_callback_provider *); int EXPORT(olsr_callback_cons_register)( const char *, const char *, struct olsr_callback_consumer *); void EXPORT(olsr_callback_cons_unregister)(struct olsr_callback_consumer *); void EXPORT(olsr_callback_add_object)(struct olsr_callback_provider *, void *); void EXPORT(olsr_callback_change_object)(struct olsr_callback_provider *, void *); void EXPORT(olsr_callback_remove_object)(struct olsr_callback_provider *, void *); #define OLSR_FOR_ALL_CALLBACK_PROVIDERS(provider, iterator) avl_for_each_element_safe(&callback_provider_tree, provider, node, iterator) #define OLSR_FOR_ALL_CALLBACK_CONSUMERS(provider, consumer, iterator) list_for_each_element_safe(&provider->callbacks, consumer, node, iterator) extern struct avl_tree EXPORT(callback_provider_tree); #endif /* OLSR_CALLBACKS_H_ */
/*========================================================================= Program: Visualization Toolkit Module: vtkExtractPolyDataPiece.h Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ // .NAME vtkExtractPolyDataPiece - Return specified piece, including specified // number of ghost levels. #ifndef __vtkExtractPolyDataPiece_h #define __vtkExtractPolyDataPiece_h #include "vtkPolyDataAlgorithm.h" class vtkIdList; class vtkIntArray; class VTK_PARALLEL_EXPORT vtkExtractPolyDataPiece : public vtkPolyDataAlgorithm { public: static vtkExtractPolyDataPiece *New(); vtkTypeRevisionMacro(vtkExtractPolyDataPiece, vtkPolyDataAlgorithm); void PrintSelf(ostream& os, vtkIndent indent); // Description: // Turn on/off creating ghost cells (on by default). vtkSetMacro(CreateGhostCells, int); vtkGetMacro(CreateGhostCells, int); vtkBooleanMacro(CreateGhostCells, int); protected: vtkExtractPolyDataPiece(); ~vtkExtractPolyDataPiece() {}; // Usual data generation method int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *); int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *); // A method for labeling which piece the cells belong to. void ComputeCellTags(vtkIntArray *cellTags, vtkIdList *pointOwnership, int piece, int numPieces, vtkPolyData *input); void AddGhostLevel(vtkPolyData *input, vtkIntArray *cellTags, int ghostLevel); int CreateGhostCells; private: vtkExtractPolyDataPiece(const vtkExtractPolyDataPiece&); // Not implemented. void operator=(const vtkExtractPolyDataPiece&); // Not implemented. }; #endif
/* openjs-gdome -- gdome -- OpenJS Extension * $Id: int_pointer_type.h 10465 2009-12-31 18:18:53Z jheusala $ * $Date: 2009-12-31 20:18:53 +0200 (Thu, 31 Dec 2009) $ */ #ifndef OPENJS_CORE_INT_POINTER_TYPE_H #define OPENJS_CORE_INT_POINTER_TYPE_H 1 #include <stdint.h> // for intptr_t #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /* Integer type to be used inside v8 for pointers */ typedef uintptr_t int_pointer_type; #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* EOF */
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_PAGE_ACTION_IMAGE_VIEW_H_ #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_PAGE_ACTION_IMAGE_VIEW_H_ #include <map> #include <string> #include "base/memory/scoped_ptr.h" #include "chrome/browser/extensions/extension_action.h" #include "chrome/browser/extensions/extension_action_icon_factory.h" #include "chrome/browser/extensions/extension_context_menu_model.h" #include "chrome/browser/ui/views/extensions/extension_popup.h" #include "ui/views/context_menu_controller.h" #include "ui/views/controls/image_view.h" #include "ui/views/widget/widget_observer.h" class Browser; class LocationBarView; namespace content { class WebContents; } namespace views { class MenuRunner; } // PageActionImageView is used by the LocationBarView to display the icon for a // given PageAction and notify the extension when the icon is clicked. class PageActionImageView : public views::ImageView, public ExtensionContextMenuModel::PopupDelegate, public views::WidgetObserver, public views::ContextMenuController, public ExtensionActionIconFactory::Observer { public: PageActionImageView(LocationBarView* owner, ExtensionAction* page_action, Browser* browser); virtual ~PageActionImageView(); ExtensionAction* page_action() { return page_action_; } int current_tab_id() { return current_tab_id_; } void set_preview_enabled(bool preview_enabled) { preview_enabled_ = preview_enabled; } // Overridden from views::View: virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; // Overridden from ExtensionContextMenuModel::Delegate virtual void InspectPopup(ExtensionAction* action) OVERRIDE; // Overridden from views::WidgetObserver: virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE; // Overridden from views::ContextMenuController. virtual void ShowContextMenuForView(View* source, const gfx::Point& point, ui::MenuSourceType source_type) OVERRIDE; // Overriden from ExtensionActionIconFactory::Observer. virtual void OnIconUpdated() OVERRIDE; // Overridden from ui::AcceleratorTarget: virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; virtual bool CanHandleAccelerators() const OVERRIDE; // Called to notify the PageAction that it should determine whether to be // visible or hidden. |contents| is the WebContents that is active, |url| is // the current page URL. void UpdateVisibility(content::WebContents* contents, const GURL& url); // Either notify listeners or show a popup depending on the page action. void ExecuteAction(ExtensionPopup::ShowAction show_action); private: // Overridden from View. virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE; // Shows the popup, with the given URL. void ShowPopupWithURL(const GURL& popup_url, ExtensionPopup::ShowAction show_action); // Hides the active popup, if there is one. void HidePopup(); // The location bar view that owns us. LocationBarView* owner_; // The PageAction that this view represents. The PageAction is not owned by // us, it resides in the extension of this particular profile. ExtensionAction* page_action_; // The corresponding browser. Browser* browser_; // The object that will be used to get the page action icon for us. // It may load the icon asynchronously (in which case the initial icon // returned by the factory will be transparent), so we have to observe it for // updates to the icon. scoped_ptr<ExtensionActionIconFactory> icon_factory_; // The tab id we are currently showing the icon for. int current_tab_id_; // The URL we are currently showing the icon for. GURL current_url_; // The string to show for a tooltip; std::string tooltip_; // This is used for post-install visual feedback. The page_action icon is // briefly shown even if it hasn't been enabled by its extension. bool preview_enabled_; // The current popup and the button it came from. NULL if no popup. ExtensionPopup* popup_; // The extension command accelerator this page action is listening for (to // show the popup). scoped_ptr<ui::Accelerator> page_action_keybinding_; scoped_ptr<views::MenuRunner> menu_runner_; DISALLOW_IMPLICIT_CONSTRUCTORS(PageActionImageView); }; #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_PAGE_ACTION_IMAGE_VIEW_H_
/************************************************************************** *** *** Copyright (c) 1995-2000 Regents of the University of California, *** Andrew E. Caldwell, Andrew B. Kahng and Igor L. Markov *** Copyright (c) 2000-2007 Regents of the University of Michigan, *** Saurabh N. Adya, Jarrod A. Roy, David A. Papa and *** Igor L. Markov *** *** Contact author(s): abk@cs.ucsd.edu, imarkov@umich.edu *** Original Affiliation: UCLA, Computer Science Department, *** Los Angeles, CA 90095-1596 USA *** *** 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. *** *** ***************************************************************************/ // created on 10/05/98 by Andrew Caldwell (caldwell@cs.ucla.edu) #ifndef _CLUSTHGRAPH_BestHEM_CLUSTERTREE_H_ #define _CLUSTHGRAPH_BestHEM_CLUSTERTREE_H_ #include "clustHGTreeBase.h" class BestHEMClusteredHGraph : public virtual ClHG_ClusterTreeBase { std::vector<double> _edgeWeights; std::vector<ClHG_Cluster*> _adjNodes; std::vector<double> _heavyEdges; public: BestHEMClusteredHGraph(const HGraphFixed& graph, const Parameters& params, const Partitioning* fixed = NULL, const Partitioning* curPart = NULL) : ClHG_ClusterTreeBase(graph, params, fixed, curPart) {} virtual ~BestHEMClusteredHGraph() {} protected: void populateTree(); void heavyEdgeMatchingLevel(double maxChildArea, double maxNewArea, unsigned targetNum, bool useBHEM); }; #endif
/* * Copyright (C) 2006-2009 Vincent Hanquez <tab@snarc.org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation; version 2.1 or version 3.0 only. * * 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. * * Sha384 implementation */ #include <unistd.h> #include <fcntl.h> #include "sha512.h" static inline int sha384_file(char *filename, uint8_t *digest) { #define BLKSIZE 4096 unsigned char buf[BLKSIZE]; int fd; ssize_t n; struct sha384_ctx ctx; fd = open(filename, O_RDONLY); if (fd == -1) return 1; sha384_init(&ctx); while ((n = read(fd, buf, BLKSIZE)) > 0) sha384_update(&ctx, buf, n); if (n == 0) sha384_finalize(&ctx, digest); close(fd); return n < 0; #undef BLKSIZE } /* this part implement the OCaml binding */ #include <caml/mlvalues.h> #include <caml/memory.h> #include <caml/alloc.h> #include <caml/custom.h> #include <caml/fail.h> #define GET_CTX_STRUCT(a) ((struct sha384_ctx *) a) CAMLexport value stub_sha384_init(value unit) { CAMLparam1(unit); CAMLlocal1(result); result = caml_alloc(sizeof(struct sha384_ctx), Abstract_tag); sha384_init(GET_CTX_STRUCT(result)); CAMLreturn(result); } CAMLprim value stub_sha384_update(value ctx, value data, value ofs, value len) { CAMLparam4(ctx, data, ofs, len); sha384_update(GET_CTX_STRUCT(ctx), String_val(data) + Int_val(ofs), Int_val(len)); CAMLreturn(Val_unit); } CAMLprim value stub_sha384_finalize(value ctx) { CAMLparam1(ctx); CAMLlocal1(result); result = caml_alloc_string(48); sha384_finalize(GET_CTX_STRUCT(ctx), String_val(result)); CAMLreturn(result); } CAMLprim value stub_sha384_file(value name) { CAMLparam1(name); CAMLlocal1(result); result = caml_alloc_string(48); if (sha384_file(String_val(name), String_val(result))) caml_failwith("file error"); CAMLreturn(result); } CAMLprim value stub_sha384_to_hex(value digest) { CAMLparam1(digest); CAMLlocal1(result); char *s, r; int i; result = caml_alloc_string(96); s = String_val(digest); r = String_val(result); for (i = 0; i < 48; i++, r += 2) snprintf(r, 2, "%02x", s[i]); CAMLreturn(result); }
// 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 WEBKIT_MEDIA_CRYPTO_PPAPI_DECRYPTOR_H_ #define WEBKIT_MEDIA_CRYPTO_PPAPI_DECRYPTOR_H_ #include <string> #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "media/base/decryptor.h" #include "media/base/video_decoder_config.h" namespace base { class MessageLoopProxy; } namespace media { class DecryptorClient; } namespace webkit { namespace ppapi { class PluginInstance; } } namespace webkit_media { // PpapiDecryptor implements media::Decryptor and forwards all calls to the // PluginInstance. // This class should always be created & destroyed on the main renderer thread. class PpapiDecryptor : public media::Decryptor { public: PpapiDecryptor( media::DecryptorClient* client, const scoped_refptr<webkit::ppapi::PluginInstance>& plugin_instance); virtual ~PpapiDecryptor(); // media::Decryptor implementation. virtual bool GenerateKeyRequest(const std::string& key_system, const std::string& type, const uint8* init_data, int init_data_length) OVERRIDE; virtual void AddKey(const std::string& key_system, const uint8* key, int key_length, const uint8* init_data, int init_data_length, const std::string& session_id) OVERRIDE; virtual void CancelKeyRequest(const std::string& key_system, const std::string& session_id) OVERRIDE; virtual void Decrypt(StreamType stream_type, const scoped_refptr<media::DecoderBuffer>& encrypted, const DecryptCB& decrypt_cb) OVERRIDE; virtual void CancelDecrypt(StreamType stream_type) OVERRIDE; virtual void InitializeAudioDecoder( scoped_ptr<media::AudioDecoderConfig> config, const DecoderInitCB& init_cb, const KeyAddedCB& key_added_cb) OVERRIDE; virtual void InitializeVideoDecoder( scoped_ptr<media::VideoDecoderConfig> config, const DecoderInitCB& init_cb, const KeyAddedCB& key_added_cb) OVERRIDE; virtual void DecryptAndDecodeAudio( const scoped_refptr<media::DecoderBuffer>& encrypted, const AudioDecodeCB& audio_decode_cb) OVERRIDE; virtual void DecryptAndDecodeVideo( const scoped_refptr<media::DecoderBuffer>& encrypted, const VideoDecodeCB& video_decode_cb) OVERRIDE; virtual void ResetDecoder(StreamType stream_type) OVERRIDE; virtual void DeinitializeDecoder(StreamType stream_type) OVERRIDE; private: void ReportFailureToCallPlugin(const std::string& key_system, const std::string& session_id); void OnDecoderInitialized(StreamType stream_type, const KeyAddedCB& key_added_cb, bool success); media::DecryptorClient* client_; scoped_refptr<webkit::ppapi::PluginInstance> cdm_plugin_; scoped_refptr<base::MessageLoopProxy> render_loop_proxy_; DecoderInitCB audio_decoder_init_cb_; DecoderInitCB video_decoder_init_cb_; KeyAddedCB audio_key_added_cb_; KeyAddedCB video_key_added_cb_; base::WeakPtrFactory<PpapiDecryptor> weak_ptr_factory_; base::WeakPtr<PpapiDecryptor> weak_this_; DISALLOW_COPY_AND_ASSIGN(PpapiDecryptor); }; } // namespace webkit_media #endif // WEBKIT_MEDIA_CRYPTO_PPAPI_DECRYPTOR_H_
/* * The Yices SMT Solver. Copyright 2014 SRI International. * * This program may only be used subject to the noncommercial end user * license agreement which is downloadable along with this program. */ /* * ARITHMETIC OPERATIONS INVOLVING BUFFERS AND TERMS */ #ifndef __ARITH_BUFFER_TERMS_H #define __ARITH_BUFFER_TERMS_H #include "terms/arith_buffers.h" #include "terms/terms.h" /* * Binary operations: * - t must be defined in table and must be an arithmetic term * (i.e., t must have type int or real) * - b->ptbl must be the same as table->pprods * * All operations update the buffer. */ extern void arith_buffer_add_term(arith_buffer_t *b, term_table_t *table, term_t t); extern void arith_buffer_sub_term(arith_buffer_t *b, term_table_t *table, term_t t); extern void arith_buffer_mul_term(arith_buffer_t *b, term_table_t *table, term_t t); extern void arith_buffer_add_const_times_term(arith_buffer_t *b, term_table_t *table, rational_t *a, term_t t); extern void arith_buffer_mul_term_power(arith_buffer_t *b, term_table_t *table, term_t t, uint32_t d); #endif /* __ARITH_BUFFER_TERMS_H */
/* $OpenBSD: vioscsireg.h,v 1.1 2013/12/20 21:50:49 matthew Exp $ */ /* * Copyright (c) 2013 Google Inc. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* Configuration registers */ #define VIRTIO_SCSI_CONFIG_NUM_QUEUES 0 /* 32bit */ #define VIRTIO_SCSI_CONFIG_SEG_MAX 4 /* 32bit */ #define VIRTIO_SCSI_CONFIG_MAX_SECTORS 8 /* 32bit */ #define VIRTIO_SCSI_CONFIG_CMD_PER_LUN 12 /* 32bit */ #define VIRTIO_SCSI_CONFIG_EVENT_INFO_SIZE 16 /* 32bit */ #define VIRTIO_SCSI_CONFIG_SENSE_SIZE 20 /* 32bit */ #define VIRTIO_SCSI_CONFIG_CDB_SIZE 24 /* 32bit */ #define VIRTIO_SCSI_CONFIG_MAX_CHANNEL 28 /* 16bit */ #define VIRTIO_SCSI_CONFIG_MAX_TARGET 30 /* 16bit */ #define VIRTIO_SCSI_CONFIG_MAX_LUN 32 /* 32bit */ /* Feature bits */ #define VIRTIO_SCSI_F_INOUT (1<<0) #define VIRTIO_SCSI_F_HOTPLUG (1<<1) /* Response status values */ #define VIRTIO_SCSI_S_OK 0 #define VIRTIO_SCSI_S_OVERRUN 1 #define VIRTIO_SCSI_S_ABORTED 2 #define VIRTIO_SCSI_S_BAD_TARGET 3 #define VIRTIO_SCSI_S_RESET 4 #define VIRTIO_SCSI_S_BUSY 5 #define VIRTIO_SCSI_S_TRANSPORT_FAILURE 6 #define VIRTIO_SCSI_S_TARGET_FAILURE 7 #define VIRTIO_SCSI_S_NEXUS_FAILURE 8 #define VIRTIO_SCSI_S_FAILURE 9 /* Task attributes */ #define VIRTIO_SCSI_S_SIMPLE 0 #define VIRTIO_SCSI_S_ORDERED 1 #define VIRTIO_SCSI_S_HEAD 2 #define VIRTIO_SCSI_S_ACA 3 /* Request header structure */ struct virtio_scsi_req_hdr { uint8_t lun[8]; uint64_t id; uint8_t task_attr; uint8_t prio; uint8_t crn; uint8_t cdb[32]; } __packed; /* Followed by data-out. */ /* Response header structure */ struct virtio_scsi_res_hdr { uint32_t sense_len; uint32_t residual; uint16_t status_qualifier; uint8_t status; uint8_t response; uint8_t sense[96]; } __packed; /* Followed by data-in. */
/* * Copyright (c) 2013 Stanford University * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR(S) DISCLAIM ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL AUTHORS BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef __KVSERIALIZER_H__ #define __KVSERIALIZER_H__ #include "serializationexception.h" class KVSerializer { public: enum KVType { KVTypeNull, KVTypeString, KVTypeBool, KVTypeU8, KVTypeU16, KVTypeU32, KVTypeU64, }; KVSerializer(); ~KVSerializer(); void putStr(const std::string &key, const std::string &value); void putU8(const std::string &key, uint8_t value); void putU16(const std::string &key, uint16_t value); void putU32(const std::string &key, uint32_t value); void putU64(const std::string &key, uint64_t value); std::string getStr(const std::string &key) const; uint8_t getU8(const std::string &key) const; uint16_t getU16(const std::string &key) const; uint32_t getU32(const std::string &key) const; uint64_t getU64(const std::string &key) const; KVType getType(const std::string &key) const; bool hasKey(const std::string &key) const; void remove(const std::string &key); void removeAll(); void fromBlob(const std::string &blob); std::string getBlob() const; void dump() const; private: std::map<std::string, std::string> table; }; #endif /* __KVSERIALIZER_H__ */
/* * RAW MPEG-4 video demuxer * Copyright (c) 2006 Thijs Vermeir <thijs.vermeir@barco.com> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "avformat.h" #include "rawdec.h" #define VISUAL_OBJECT_START_CODE 0x000001b5 #define VOP_START_CODE 0x000001b6 static int mpeg4video_probe(AVProbeData *probe_packet) { uint32_t temp_buffer = -1; int VO = 0, VOL = 0, VOP = 0, VISO = 0, res = 0; int i; for (i = 0; i < probe_packet->buf_size; i++) { temp_buffer = (temp_buffer << 8) + probe_packet->buf[i]; if (temp_buffer & 0xfffffe00) continue; if (temp_buffer < 2) continue; if (temp_buffer == VOP_START_CODE) VOP++; else if (temp_buffer == VISUAL_OBJECT_START_CODE) VISO++; else if (temp_buffer >= 0x100 && temp_buffer < 0x120) VO++; else if (temp_buffer >= 0x120 && temp_buffer < 0x130) VOL++; else if (!(0x1AF < temp_buffer && temp_buffer < 0x1B7) && !(0x1B9 < temp_buffer && temp_buffer < 0x1C4)) res++; } if (VOP >= VISO && VOP >= VOL && VO >= VOL && VOL > 0 && res == 0) return VOP+VO > 4 ? AVPROBE_SCORE_EXTENSION : AVPROBE_SCORE_EXTENSION/2; return 0; } FF_DEF_RAWVIDEO_DEMUXER(m4v, "raw MPEG-4 video", mpeg4video_probe, "m4v", AV_CODEC_ID_MPEG4)
/**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional ** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QDECLARATIVECUSTOMPARSER_H #define QDECLARATIVECUSTOMPARSER_H // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists purely as an // implementation detail. This header file may change from version to // version without notice, or even be removed. // // We mean it. // #include "private/qdeclarativemetatype_p.h" #include "qdeclarativeerror.h" #include "private/qdeclarativeparser_p.h" #include "private/qdeclarativebinding_p.h" #include <QtCore/qbytearray.h> #include <QtCore/qxmlstream.h> QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativeCompiler; class QDeclarativeCustomParserPropertyPrivate; class Q_DECLARATIVE_EXPORT QDeclarativeCustomParserProperty { public: QDeclarativeCustomParserProperty(); QDeclarativeCustomParserProperty(const QDeclarativeCustomParserProperty &); QDeclarativeCustomParserProperty &operator=(const QDeclarativeCustomParserProperty &); ~QDeclarativeCustomParserProperty(); QByteArray name() const; QDeclarativeParser::Location location() const; bool isList() const; // Will be one of QDeclarativeParser::Variant, QDeclarativeCustomParserProperty or // QDeclarativeCustomParserNode QList<QVariant> assignedValues() const; private: friend class QDeclarativeCustomParserNodePrivate; friend class QDeclarativeCustomParserPropertyPrivate; QDeclarativeCustomParserPropertyPrivate *d; }; class QDeclarativeCustomParserNodePrivate; class Q_DECLARATIVE_EXPORT QDeclarativeCustomParserNode { public: QDeclarativeCustomParserNode(); QDeclarativeCustomParserNode(const QDeclarativeCustomParserNode &); QDeclarativeCustomParserNode &operator=(const QDeclarativeCustomParserNode &); ~QDeclarativeCustomParserNode(); QByteArray name() const; QDeclarativeParser::Location location() const; QList<QDeclarativeCustomParserProperty> properties() const; private: friend class QDeclarativeCustomParserNodePrivate; QDeclarativeCustomParserNodePrivate *d; }; class Q_DECLARATIVE_EXPORT QDeclarativeCustomParser { public: enum Flag { NoFlag = 0x00000000, AcceptsAttachedProperties = 0x00000001 }; Q_DECLARE_FLAGS(Flags, Flag) QDeclarativeCustomParser() : compiler(0), object(0), m_flags(NoFlag) {} QDeclarativeCustomParser(Flags f) : compiler(0), object(0), m_flags(f) {} virtual ~QDeclarativeCustomParser() {} void clearErrors(); Flags flags() const { return m_flags; } virtual QByteArray compile(const QList<QDeclarativeCustomParserProperty> &)=0; virtual void setCustomData(QObject *, const QByteArray &)=0; QList<QDeclarativeError> errors() const { return exceptions; } protected: void error(const QString& description); void error(const QDeclarativeCustomParserProperty&, const QString& description); void error(const QDeclarativeCustomParserNode&, const QString& description); int evaluateEnum(const QByteArray&) const; const QMetaObject *resolveType(const QByteArray&) const; QDeclarativeBinding::Identifier rewriteBinding(const QString&, const QByteArray&); private: QList<QDeclarativeError> exceptions; QDeclarativeCompiler *compiler; QDeclarativeParser::Object *object; Flags m_flags; friend class QDeclarativeCompiler; }; Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarativeCustomParser::Flags); #if 0 #define QML_REGISTER_CUSTOM_TYPE(URI, VERSION_MAJ, VERSION_MIN, NAME, TYPE, CUSTOMTYPE) \ qmlRegisterCustomType<TYPE>(#URI, VERSION_MAJ, VERSION_MIN, #NAME, #TYPE, new CUSTOMTYPE) #endif QT_END_NAMESPACE Q_DECLARE_METATYPE(QDeclarativeCustomParserProperty) Q_DECLARE_METATYPE(QDeclarativeCustomParserNode) QT_END_HEADER #endif
/* * Threefish-512 * (C) 2013,2014 Jack Lloyd * * Botan is released under the Simplified BSD License (see license.txt) */ #ifndef BOTAN_THREEFISH_512_H_ #define BOTAN_THREEFISH_512_H_ #include <botan/block_cipher.h> BOTAN_FUTURE_INTERNAL_HEADER(threefish_512.h) namespace Botan { /** * Threefish-512 */ class BOTAN_PUBLIC_API(2,0) Threefish_512 final : public Block_Cipher_Fixed_Params<64, 64, 0, 1, Tweakable_Block_Cipher> { public: void encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const override; void decrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const override; void set_tweak(const uint8_t tweak[], size_t len) override; void clear() override; std::string provider() const override; std::string name() const override { return "Threefish-512"; } BlockCipher* clone() const override { return new Threefish_512; } size_t parallelism() const override; private: #if defined(BOTAN_HAS_THREEFISH_512_AVX2) void avx2_encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const; void avx2_decrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const; #endif void key_schedule(const uint8_t key[], size_t key_len) override; // Interface for Skein friend class Skein_512; void skein_feedfwd(const secure_vector<uint64_t>& M, const secure_vector<uint64_t>& T); // Private data secure_vector<uint64_t> m_T; secure_vector<uint64_t> m_K; }; } #endif
// This code contains NVIDIA Confidential Information and is disclosed to you // under a form of NVIDIA software license agreement provided separately to you. // // Notice // NVIDIA Corporation and its licensors retain all intellectual property and // proprietary rights in and to this software and related documentation and // any modifications thereto. Any use, reproduction, disclosure, or // distribution of this software and related documentation without an express // license agreement from NVIDIA Corporation is strictly prohibited. // // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. // // Information and code furnished is believed to be accurate and reliable. // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such // information or for any infringement of patents or other rights of third parties that may // result from its use. No license is granted by implication or otherwise under any patent // or patent rights of NVIDIA Corporation. Details are subject to change without notice. // This code supersedes and replaces all information previously supplied. // NVIDIA Corporation products are not authorized for use as critical // components in life support devices or systems without express written approval of // NVIDIA Corporation. // // Copyright (c) 2008-2014 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. #ifndef NP_FIXEDJOINTCONSTRAINT_H #define NP_FIXEDJOINTCONSTRAINT_H #include "ExtJoint.h" #include "PxFixedJoint.h" #include "CmUtils.h" namespace physx { struct PxFixedJointGeneratedValues; namespace Ext { struct FixedJointData : public JointData { //= ATTENTION! ===================================================================================== // Changing the data layout of this class breaks the binary serialization format. See comments for // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION // accordingly. //================================================================================================== PxReal projectionLinearTolerance; PxReal projectionAngularTolerance; }; typedef Joint<PxFixedJoint, PxFixedJointGeneratedValues> FixedJointT; class FixedJoint : public FixedJointT { //= ATTENTION! ===================================================================================== // Changing the data layout of this class breaks the binary serialization format. See comments for // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION // accordingly. //================================================================================================== public: // PX_SERIALIZATION FixedJoint(PxBaseFlags baseFlags) : FixedJointT(baseFlags) {} virtual void exportExtraData(PxSerializationContext& context) const; void importExtraData(PxDeserializationContext& context); void resolveReferences(PxDeserializationContext& context); static FixedJoint* createObject(PxU8*& address, PxDeserializationContext& context); static void getBinaryMetaData(PxOutputStream& stream); //~PX_SERIALIZATION virtual ~FixedJoint() { if(getBaseFlags()&PxBaseFlag::eOWNS_MEMORY) PX_FREE(mData); } PxReal getProjectionLinearTolerance() const; void setProjectionLinearTolerance(PxReal tolerance); PxReal getProjectionAngularTolerance() const; void setProjectionAngularTolerance(PxReal tolerance); FixedJoint(const PxTolerancesScale& /*scale*/, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1) : FixedJointT(PxJointConcreteType::eFIXED, PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE) { FixedJointData* data = reinterpret_cast<FixedJointData*>(PX_ALLOC(sizeof(FixedJointData), PX_DEBUG_EXP("FixedJointData"))); Cm::markSerializedMem(data, sizeof(FixedJointData)); mData = data; data->projectionLinearTolerance = 1e10f; data->projectionAngularTolerance = PxPi; initCommonData(*data, actor0, localFrame0, actor1, localFrame1); } bool attach(PxPhysics &physics, PxRigidActor* actor0, PxRigidActor* actor1); private: static PxConstraintShaderTable sShaders; PX_FORCE_INLINE FixedJointData& data() const { return *static_cast<FixedJointData*>(mData); } }; } // namespace Ext namespace Ext { extern "C" PxU32 FixedJointSolverPrep(Px1DConstraint* constraints, PxVec3& body0WorldOffset, PxU32 maxConstraints, PxConstraintInvMassScale& invMassScale, const void* constantBlock, const PxTransform& bA2w, const PxTransform& bB2w); } } #endif
// RUN: %check -e %s f(struct A { int i; } *p) { // should be able to initialise this - decl should be picked up struct A a = { 1 }; // CHECK: !/error/ *p = a; } main() { struct A a; // CHECK: error: "a" has incomplete type 'struct A' f(&a); }
//****************************************************************************** // // 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. // //****************************************************************************** // WindowsSecurityCredentialsUI.h // Generated from winmd2objc #pragma once #include "interopBase.h" @class WSCUUserConsentVerifier, WSCUCredentialPickerOptions, WSCUCredentialPickerResults, WSCUCredentialPicker; @protocol WSCUIUserConsentVerifierStatics , WSCUICredentialPickerOptions, WSCUICredentialPickerStatics, WSCUICredentialPickerResults; // Windows.Security.Credentials.UI.UserConsentVerifierAvailability enum _WSCUUserConsentVerifierAvailability { WSCUUserConsentVerifierAvailabilityAvailable = 0, WSCUUserConsentVerifierAvailabilityDeviceNotPresent = 1, WSCUUserConsentVerifierAvailabilityNotConfiguredForUser = 2, WSCUUserConsentVerifierAvailabilityDisabledByPolicy = 3, WSCUUserConsentVerifierAvailabilityDeviceBusy = 4, }; typedef unsigned WSCUUserConsentVerifierAvailability; // Windows.Security.Credentials.UI.UserConsentVerificationResult enum _WSCUUserConsentVerificationResult { WSCUUserConsentVerificationResultVerified = 0, WSCUUserConsentVerificationResultDeviceNotPresent = 1, WSCUUserConsentVerificationResultNotConfiguredForUser = 2, WSCUUserConsentVerificationResultDisabledByPolicy = 3, WSCUUserConsentVerificationResultDeviceBusy = 4, WSCUUserConsentVerificationResultRetriesExhausted = 5, WSCUUserConsentVerificationResultCanceled = 6, }; typedef unsigned WSCUUserConsentVerificationResult; // Windows.Security.Credentials.UI.AuthenticationProtocol enum _WSCUAuthenticationProtocol { WSCUAuthenticationProtocolBasic = 0, WSCUAuthenticationProtocolDigest = 1, WSCUAuthenticationProtocolNtlm = 2, WSCUAuthenticationProtocolKerberos = 3, WSCUAuthenticationProtocolNegotiate = 4, WSCUAuthenticationProtocolCredSsp = 5, WSCUAuthenticationProtocolCustom = 6, }; typedef unsigned WSCUAuthenticationProtocol; // Windows.Security.Credentials.UI.CredentialSaveOption enum _WSCUCredentialSaveOption { WSCUCredentialSaveOptionUnselected = 0, WSCUCredentialSaveOptionSelected = 1, WSCUCredentialSaveOptionHidden = 2, }; typedef unsigned WSCUCredentialSaveOption; #include "WindowsFoundation.h" #include "WindowsStorageStreams.h" // Windows.Security.Credentials.UI.UserConsentVerifier #ifndef __WSCUUserConsentVerifier_DEFINED__ #define __WSCUUserConsentVerifier_DEFINED__ WINRT_EXPORT @interface WSCUUserConsentVerifier : RTObject + (void)checkAvailabilityAsyncWithSuccess:(void (^)(WSCUUserConsentVerifierAvailability))success failure:(void (^)(NSError*))failure; + (void)requestVerificationAsync:(NSString*)message success:(void (^)(WSCUUserConsentVerificationResult))success failure:(void (^)(NSError*))failure; @end #endif // __WSCUUserConsentVerifier_DEFINED__ // Windows.Security.Credentials.UI.CredentialPickerOptions #ifndef __WSCUCredentialPickerOptions_DEFINED__ #define __WSCUCredentialPickerOptions_DEFINED__ WINRT_EXPORT @interface WSCUCredentialPickerOptions : RTObject + (instancetype)create ACTIVATOR; @property (copy) NSString* targetName; @property (copy) RTObject<WSSIBuffer>* previousCredential; @property (copy) NSString* message; @property unsigned errorCode; @property (copy) NSString* customAuthenticationProtocol; @property WSCUCredentialSaveOption credentialSaveOption; @property (copy) NSString* caption; @property BOOL callerSavesCredential; @property WSCUAuthenticationProtocol authenticationProtocol; @property BOOL alwaysDisplayDialog; @end #endif // __WSCUCredentialPickerOptions_DEFINED__ // Windows.Security.Credentials.UI.CredentialPickerResults #ifndef __WSCUCredentialPickerResults_DEFINED__ #define __WSCUCredentialPickerResults_DEFINED__ WINRT_EXPORT @interface WSCUCredentialPickerResults : RTObject @property (readonly) RTObject<WSSIBuffer>* credential; @property (readonly) NSString* credentialDomainName; @property (readonly) NSString* credentialPassword; @property (readonly) WSCUCredentialSaveOption credentialSaveOption; @property (readonly) BOOL credentialSaved; @property (readonly) NSString* credentialUserName; @property (readonly) unsigned errorCode; @end #endif // __WSCUCredentialPickerResults_DEFINED__ // Windows.Security.Credentials.UI.CredentialPicker #ifndef __WSCUCredentialPicker_DEFINED__ #define __WSCUCredentialPicker_DEFINED__ WINRT_EXPORT @interface WSCUCredentialPicker : RTObject + (void)pickWithOptionsAsync:(WSCUCredentialPickerOptions*)options success:(void (^)(WSCUCredentialPickerResults*))success failure:(void (^)(NSError*))failure; + (void)pickWithMessageAsync:(NSString*)targetName message:(NSString*)message success:(void (^)(WSCUCredentialPickerResults*))success failure:(void (^)(NSError*))failure; + (void)pickWithCaptionAsync:(NSString*)targetName message:(NSString*)message caption:(NSString*)caption success:(void (^)(WSCUCredentialPickerResults*))success failure:(void (^)(NSError*))failure; @end #endif // __WSCUCredentialPicker_DEFINED__
/* * Phusion Passenger - https://www.phusionpassenger.com/ * Copyright (c) 2010-2014 Phusion * * "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #ifndef _PASSENGER_UNION_STATION_STOPWATCH_LOG_H_ #define _PASSENGER_UNION_STATION_STOPWATCH_LOG_H_ #include <boost/noncopyable.hpp> #include <sys/resource.h> #include <string> #include <StaticString.h> #include <Exceptions.h> #include <UnionStation/Transaction.h> #include <Utils/StrIntUtils.h> #include <Utils/SystemTime.h> namespace Passenger { namespace UnionStation { using namespace std; using namespace boost; class StopwatchLog: public noncopyable { private: Transaction * const transaction; union { const char *name; struct { const char *endMessage; const char *abortMessage; } granular; } data; enum { NAME, GRANULAR } type: 1; bool ok; static string timevalToString(struct timeval &tv) { unsigned long long i = (unsigned long long) tv.tv_sec * 1000000 + tv.tv_usec; return usecToString(i); } static string usecToString(unsigned long long usec) { char timestamp[2 * sizeof(unsigned long long) + 1]; integerToHexatri<unsigned long long>(usec, timestamp); return timestamp; } public: StopwatchLog() : transaction(NULL) { } StopwatchLog(const TransactionPtr &_transaction, const char *name) : transaction(_transaction.get()) { type = NAME; data.name = name; ok = false; char message[150]; char *pos = message; const char *end = message + sizeof(message); struct rusage usage; pos = appendData(pos, end, "BEGIN: "); pos = appendData(pos, end, name); pos = appendData(pos, end, " ("); pos = appendData(pos, end, usecToString(SystemTime::getUsec())); pos = appendData(pos, end, ","); if (getrusage(RUSAGE_SELF, &usage) == -1) { int e = errno; throw SystemException("getrusage() failed", e); } pos = appendData(pos, end, timevalToString(usage.ru_utime)); pos = appendData(pos, end, ","); pos = appendData(pos, end, timevalToString(usage.ru_stime)); pos = appendData(pos, end, ") "); if (transaction != NULL) { transaction->message(StaticString(message, pos - message)); } } StopwatchLog(const TransactionPtr &_transaction, const char *beginMessage, const char *endMessage, const char *abortMessage = NULL) : transaction(_transaction.get()) { if (_transaction != NULL) { type = GRANULAR; data.granular.endMessage = endMessage; data.granular.abortMessage = abortMessage; ok = abortMessage == NULL; _transaction->message(beginMessage); } } ~StopwatchLog() { if (transaction == NULL) { return; } if (type == NAME) { char message[150]; char *pos = message; const char *end = message + sizeof(message); struct rusage usage; if (ok) { pos = appendData(pos, end, "END: "); } else { pos = appendData(pos, end, "FAIL: "); } pos = appendData(pos, end, data.name); pos = appendData(pos, end, " ("); pos = appendData(pos, end, usecToString(SystemTime::getUsec())); pos = appendData(pos, end, ","); if (getrusage(RUSAGE_SELF, &usage) == -1) { int e = errno; throw SystemException("getrusage() failed", e); } pos = appendData(pos, end, timevalToString(usage.ru_utime)); pos = appendData(pos, end, ","); pos = appendData(pos, end, timevalToString(usage.ru_stime)); pos = appendData(pos, end, ")"); transaction->message(StaticString(message, pos - message)); } else { if (ok) { transaction->message(data.granular.endMessage); } else { transaction->message(data.granular.abortMessage); } } } void success() { ok = true; } }; } // namespace UnionStation } // namespace Passenger #endif /* _PASSENGER_UNION_STATION_STOPWATCH_LOG_H_ */
#pragma once #pragma pack(push,1) /********************************************************** * command data structure * **********************************************************/ // Command identitys typedef enum _CommandIdentity { Cmd_BoneSize, // Id can be used to request bone size from server or register avatar name command. Cmd_AvatarName, // Id can be used to request avatar name from server or register avatar name command. Cmd_FaceDirection, // Id used to request face direction from server Cmd_DataFrequency, // Id can be used to request data frequency from server or register data frequency command. Cmd_BvhInheritanceTxt, // Id can be used to request bvh header txt from server or register bvh header txt command. Cmd_AvatarCount, // Id can be used to request avatar count from server or register avatar count command. Cmd_CombinationMode, // Id can be used to request combination mode from server or register combination mode command. Cmd_RegisterEvent, // Id can be used to register event. Cmd_UnRegisterEvent, // Id can be used to unregister event. }CmdId; // Sensor binding combination mode typedef enum _SensorCombinationModes { SC_ArmOnly, // Left arm or right arm only SC_UpperBody, // Upper body, include one arm or both arm, must have chest node SC_FullBody, // Full body mode }SensorCombinationModes; // Header format of Command returned from server typedef struct _CommandPack { UINT16 Token1; // Command start token: 0xAAFF UINT32 DataVersion; // Version of community data format. e.g.: 1.0.0.2 UINT32 DataLength; // Package length of command data, by byte. UINT32 DataCount; // Count in data array, related to the specific command. CmdId CommandId; // Identity of command. UCHAR CmdParaments[40]; // Parameters depend on identity. UINT32 Reserved1; // Reserved, only enable this package has 32bytes length. Maybe used in the future. UINT16 Token2; // Package end token: 0xBBFF }CommandPack; // Fetched bone size from server typedef struct _CmdResponseBoneSize { UCHAR BoneName[60]; // Bone name float BoneLength; // Bone length }CmdResponseBoneSize; #pragma pack(pop)
#pragma once #include "EllipticOrbit.h" #include "libscene/ParticleSystem.h" #include "libscene/Tesselator.h" #include "libgeometry/Transform.h" #include <functional> #include <anax/Component.hpp> #include <anax/Entity.hpp> class CMeshComponent : public anax::Component { public: enum Category { // Объект заднего плана, сливающийся с окружением. Environment, // Объект переднего плана. Foreground, }; CStaticGeometry m_geometry; CTexture2DSharedPtr m_pDiffuse; CTexture2DSharedPtr m_pSpecular; CTexture2DSharedPtr m_pEmissive; Category m_category = Category::Foreground; }; class CParticleSystemComponent : public anax::Component { public: std::shared_ptr<CParticleSystem> m_pSystem; float m_particleScale = 1.f; }; class CTransformComponent : public anax::Component , public CTransform3D { public: }; class CSpaceBodyComponent : public anax::Component { public: float m_dayDuration = 0; float m_bodySize = 0; glm::vec3 m_rotationAxis; std::string m_name; }; class CEllipticOrbitComponent : public anax::Component , public CEllipticOrbit { public: CEllipticOrbitComponent( double const& largeAxis, // большая полуось эллипса double const& eccentricity, // эксцентриситет орбиты double const& meanMotion, // среднее движение (градуcов за единицу времени) double const& periapsisEpoch // начальная эпоха прохождения через перигелий ) : CEllipticOrbit(largeAxis, eccentricity, meanMotion, periapsisEpoch) { } std::string m_ownerName; };
#ifndef V4R_COMMON_MACROS_H_ #define V4R_COMMON_MACROS_H_ #if (defined WIN32 || defined _WIN32 || defined WINCE || defined __CYGWIN__) && defined V4RAPI_EXPORTS # define V4R_EXPORTS __declspec(dllexport) #elif defined __GNUC__ && __GNUC__ >= 4 # define V4R_EXPORTS __attribute__ ((visibility ("default"))) #else # define V4R_EXPORTS #endif #ifdef __GNUC__ #define DEPRECATED(func) func __attribute__ ((deprecated)) #elif defined(_MSC_VER) #define DEPRECATED(func) __declspec(deprecated) func #else #pragma message("WARNING: You need to implement DEPRECATED for this compiler") #define DEPRECATED(func) func #endif #endif /* V4R_COMMON_MACROS_H_ */
// The MIT License (MIT) // // Copyright (c) 2014 Todd Ditchendorf // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. #import "PGBaseNode.h" @interface PGRootNode : PGBaseNode @property (nonatomic, retain) NSString *grammarName; @property (nonatomic, retain) NSString *startMethodName; @property (nonatomic, retain) NSMutableArray *tokenKinds; @end
#if defined(PEGASUS_OS_HPUX) # include "UNIX_BGPServiceStatisticsPrivate_HPUX.h" #elif defined(PEGASUS_OS_LINUX) # include "UNIX_BGPServiceStatisticsPrivate_LINUX.h" #elif defined(PEGASUS_OS_DARWIN) # include "UNIX_BGPServiceStatisticsPrivate_DARWIN.h" #elif defined(PEGASUS_OS_AIX) # include "UNIX_BGPServiceStatisticsPrivate_AIX.h" #elif defined(PEGASUS_OS_FREEBSD) # include "UNIX_BGPServiceStatisticsPrivate_FREEBSD.h" #elif defined(PEGASUS_OS_SOLARIS) # include "UNIX_BGPServiceStatisticsPrivate_SOLARIS.h" #elif defined(PEGASUS_OS_ZOS) # include "UNIX_BGPServiceStatisticsPrivate_ZOS.h" #elif defined(PEGASUS_OS_VMS) # include "UNIX_BGPServiceStatisticsPrivate_VMS.h" #elif defined(PEGASUS_OS_TRU64) # include "UNIX_BGPServiceStatisticsPrivate_TRU64.h" #else # include "UNIX_BGPServiceStatisticsPrivate_STUB.h" #endif
/* * This file is part of the OpenKinect Project. http://www.openkinect.org * * Copyright (c) 2014 individual OpenKinect contributors. See the CONTRIB file * for details. * * This code is licensed to you under the terms of the Apache License, version * 2.0, or, at your option, the terms of the GNU General Public License, * version 2.0. See the APACHE20 and GPL2 files for the text of the licenses, * or the following URLs: * http://www.apache.org/licenses/LICENSE-2.0 * http://www.gnu.org/licenses/gpl-2.0.txt * * If you redistribute this file in source form, modified or unmodified, you * may: * 1) Leave this header intact and distribute it under the same terms, * accompanying it with the APACHE20 and GPL20 files, or * 2) Delete the Apache 2.0 clause and accompany it with the GPL2 file, or * 3) Delete the GPL v2 clause and accompany it with the APACHE20 file * In all cases you must keep the copyright notice intact and include a copy * of the CONTRIB file. * * Binary distributions must follow the binary distribution requirements of * either License. */ #ifndef TRANSFER_POOL_H_ #define TRANSFER_POOL_H_ #include <libusb.h> #include <deque> namespace libfreenect2 { namespace usb { class TransferPool { public: struct DataReceivedCallback { virtual void onDataReceived(unsigned char *buffer, size_t n) = 0; }; TransferPool(libusb_device_handle *device_handle, unsigned char device_endpoint); virtual ~TransferPool(); void deallocate(); void enableSubmission(); void disableSubmission(); void submit(size_t num_parallel_transfers); void cancel(); void setCallback(DataReceivedCallback *callback); protected: void allocateTransfers(size_t num_transfers, size_t transfer_size); virtual libusb_transfer *allocateTransfer() = 0; virtual void fillTransfer(libusb_transfer *transfer) = 0; virtual void processTransfer(libusb_transfer *transfer) = 0; DataReceivedCallback *callback_; private: typedef std::deque<libusb_transfer *> TransferQueue; libusb_device_handle *device_handle_; unsigned char device_endpoint_; TransferQueue idle_transfers_, pending_transfers_; unsigned char *buffer_; size_t buffer_size_; bool enable_submit_; static void onTransferCompleteStatic(libusb_transfer *transfer); void onTransferComplete(libusb_transfer *transfer); }; class BulkTransferPool : public TransferPool { public: BulkTransferPool(libusb_device_handle *device_handle, unsigned char device_endpoint); virtual ~BulkTransferPool(); void allocate(size_t num_transfers, size_t transfer_size); protected: virtual libusb_transfer *allocateTransfer(); virtual void fillTransfer(libusb_transfer *transfer); virtual void processTransfer(libusb_transfer *transfer); }; class IsoTransferPool : public TransferPool { public: IsoTransferPool(libusb_device_handle *device_handle, unsigned char device_endpoint); virtual ~IsoTransferPool(); void allocate(size_t num_transfers, size_t num_packets, size_t packet_size); protected: virtual libusb_transfer *allocateTransfer(); virtual void fillTransfer(libusb_transfer *transfer); virtual void processTransfer(libusb_transfer *transfer); private: size_t num_packets_; size_t packet_size_; }; } /* namespace usb */ } /* namespace libfreenect2 */ #endif /* TRANSFER_POOL_H_ */
#if defined(PEGASUS_OS_HPUX) # include "UNIX_HelpServiceDeps_HPUX.h" #elif defined(PEGASUS_OS_LINUX) # include "UNIX_HelpServiceDeps_LINUX.h" #elif defined(PEGASUS_OS_DARWIN) # include "UNIX_HelpServiceDeps_DARWIN.h" #elif defined(PEGASUS_OS_AIX) # include "UNIX_HelpServiceDeps_AIX.h" #elif defined(PEGASUS_OS_FREEBSD) # include "UNIX_HelpServiceDeps_FREEBSD.h" #elif defined(PEGASUS_OS_SOLARIS) # include "UNIX_HelpServiceDeps_SOLARIS.h" #elif defined(PEGASUS_OS_ZOS) # include "UNIX_HelpServiceDeps_ZOS.h" #elif defined(PEGASUS_OS_VMS) # include "UNIX_HelpServiceDeps_VMS.h" #elif defined(PEGASUS_OS_TRU64) # include "UNIX_HelpServiceDeps_TRU64.h" #else # include "UNIX_HelpServiceDeps_STUB.h" #endif
#pragma config(Hubs, S1, HTMotor, HTMotor, HTMotor, HTMotor) #pragma config(Hubs, S2, HTServo, none, none, none) #pragma config(Sensor, S1, , sensorI2CMuxController) #pragma config(Sensor, S2, , sensorI2CMuxController) #pragma config(Sensor, S3, HTSMUX, sensorI2CCustom) #pragma config(Sensor, S4, HTGYRO, sensorAnalogInactive) #pragma config(Motor, motorA, , tmotorNXT, openLoop) #pragma config(Motor, motorB, , tmotorNXT, openLoop) #pragma config(Motor, motorC, , tmotorNXT, openLoop) #pragma config(Motor, mtr_S1_C1_1, Rf, tmotorTetrix, openLoop, reversed) #pragma config(Motor, mtr_S1_C1_2, Rb, tmotorTetrix, openLoop, reversed) #pragma config(Motor, mtr_S1_C2_1, Lf, tmotorTetrix, openLoop) #pragma config(Motor, mtr_S1_C2_2, Lb, tmotorTetrix, openLoop) #pragma config(Motor, mtr_S1_C3_1, Intake, tmotorTetrix, openLoop) #pragma config(Motor, mtr_S1_C3_2, BlowerA, tmotorTetrix, openLoop) #pragma config(Motor, mtr_S1_C4_1, BlowerB, tmotorTetrix, openLoop) #pragma config(Motor, mtr_S1_C4_2, BlowerC, tmotorTetrix, openLoop) #pragma config(Servo, srvo_S2_C1_1, servo1, tServoNone) #pragma config(Servo, srvo_S2_C1_2, BallStorage, tServoStandard) #pragma config(Servo, srvo_S2_C1_3, TubeWinch, tServoContinuousRotation) #pragma config(Servo, srvo_S2_C1_4, Kickstand, tServoStandard) #pragma config(Servo, srvo_S2_C1_5, TouchSensor, tServoStandard) #pragma config(Servo, srvo_S2_C1_6, GoalRetainer, tServoStandard) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*// /***** DEFINES *****/ //#define _FORCE_DEBUG //Uncomment to force using debug (non-optimized) mode //#define _DISABLE_JOYDISPLAY //Uncomment to disable joystick display #define _ENABLE_LCDDISPLAY //Uncomment to enable live NXT LCD display task main() { servo[TubeWinch] = 137; servo[GoalRetainer] = 25; servo[TouchSensor] = 190; servo[BallStorage] = 140; nxtDisplayCenteredTextLine(2, "Winding Program"); nxtDisplayCenteredTextLine(3, "Left - Back"); nxtDisplayCenteredTextLine(4, "Right - Forward"); while (true) { /***** Intake Control *****/ if (nNxtButtonPressed == 2){ motor[Intake] = -50; } else if (nNxtButtonPressed == 1){ motor[Intake] = 50; } else{ motor[Intake] = 0; } } }
/* complex_min.c */ #include <stdio.h> #include "complex.h" struct complex mul(struct complex x, struct complex y) { struct complex z; z.real = (x.real * y.real - x.imaginary * y.imaginary); z.imaginary = (x.real * y.imaginary + y.real * x.imaginary); return z; }
/* * File: logger.h * Author: dskaster * * Created on 12 de Janeiro de 2009, 11:27 */ #ifndef _LOGGER_H #define _LOGGER_H #include <fstream> #include <time.h> using namespace std; class Logger { public: Logger(string logFile); virtual ~Logger(); void message(string msg); void warning(string msg); void error(string msg); private: ofstream logFile; time_t currtime; struct tm *strtime; void write(string level, string msg); }; #endif /* _LOGGER_H */
// // MKPolygonView.h // MapKit // // Copyright (c) 2010-2014, Apple Inc. All rights reserved. // #import <MapKit/MKPolygon.h> #import <MapKit/MKOverlayPathView.h> #import <MapKit/MKFoundation.h> // Prefer MKPolygonRenderer MK_CLASS_AVAILABLE(NA, 4_0) __WATCHOS_PROHIBITED @interface MKPolygonView : MKOverlayPathView - (instancetype)initWithPolygon:(MKPolygon *)polygon NS_DEPRECATED_IOS(4_0, 7_0); @property (nonatomic, readonly) MKPolygon *polygon NS_DEPRECATED_IOS(4_0, 7_0); @end
/* Copyright(c) Microsoft Open Technologies, Inc. All rights reserved. The MIT License(MIT) 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 Text_h #define Text_h #include <ArduinoJson.h> #include "Attr.h" #include "Sensor.h" #include "SensorModels.h" #include "ShieldEvent.h" #include "VirtualShield.h" const PROGMEM char Y[] = "Y"; const PROGMEM char CLEAR[] = "CLEAR"; const PROGMEM char RGBAKEY[] = "ARGB"; const PROGMEM char PID[] = "Pid"; class Text : public Sensor { public: Text(const VirtualShield &shield); int clear(ARGB argb = static_cast<uint32_t>(0)); int clearLine(unsigned int line); int clearId(unsigned int id); int print(const char * text, ARGB argb = static_cast<uint32_t>(0)); int printAt(unsigned int line, const char * text, ARGB argb); int printAt(unsigned int line, const char * text, Attr extraAttributes[] = NULL, int extraAttributeCount = 0); int print(const String &text, ARGB argb = static_cast<uint32_t>(0)); int printAt(unsigned int line, const String &text, ARGB argb); int printAt(unsigned int line, const String &text, Attr extraAttributes[] = NULL, int extraAttributeCount = 0); int printAt(unsigned int line, EPtr text, Attr extraAttributes[] = NULL, int extraAttributeCount = 0); int printAt(unsigned int line, double value, ARGB argb = static_cast<uint32_t>(0)); void onJsonReceived(JsonObject& root, ShieldEvent* shieldEvent) override; }; #endif
// // Copyright (c) 2015 Supersonic. All rights reserved. // #ifndef SUPERSONIC_IS_DELEGATE_H #define SUPERSONIC_IS_DELEGATE_H #import <Foundation/Foundation.h> @protocol SupersonicISDelegate <NSObject> @required - (void)supersonicISInitSuccess; - (void)supersonicISInitFailedWithError:(NSError *)error; - (void)supersonicISShowSuccess; - (void)supersonicISShowFailWithError:(NSError *)error; - (void)supersonicISAdAvailable:(BOOL)available; - (void)supersonicISAdClicked; - (void)supersonicISAdClosed; @end #endif
/*------------------------------------------------------------------------- * * pg_auth_members.h * definition of the system "authorization identifier members" relation * (pg_auth_members) along with the relation's initial contents. * * * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * $PostgreSQL: pgsql/src/include/catalog/pg_auth_members.h,v 1.6 2009/01/01 17:23:56 momjian Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki * information from the DATA() statements. * *------------------------------------------------------------------------- */ #ifndef PG_AUTH_MEMBERS_H #define PG_AUTH_MEMBERS_H #include "catalog/genbki.h" /* ---------------- * pg_auth_members definition. cpp turns this into * typedef struct FormData_pg_auth_members * ---------------- */ #define AuthMemRelationId 1261 CATALOG(pg_auth_members,1261) BKI_SHARED_RELATION BKI_WITHOUT_OIDS { Oid roleid; /* ID of a role */ Oid member; /* ID of a member of that role */ Oid grantor; /* who granted the membership */ bool admin_option; /* granted with admin option? */ } FormData_pg_auth_members; /* ---------------- * Form_pg_auth_members corresponds to a pointer to a tuple with * the format of pg_auth_members relation. * ---------------- */ typedef FormData_pg_auth_members *Form_pg_auth_members; /* ---------------- * compiler constants for pg_auth_members * ---------------- */ #define Natts_pg_auth_members 4 #define Anum_pg_auth_members_roleid 1 #define Anum_pg_auth_members_member 2 #define Anum_pg_auth_members_grantor 3 #define Anum_pg_auth_members_admin_option 4 #endif /* PG_AUTH_MEMBERS_H */
// // KTElementPermissions.h // Pods // // Created by Thorsten Claus on 23.07.15. // // #import <Foundation/Foundation.h> #import "KTElementPermissionList.h" @interface KTElementPermissions : NSObject /** Provides the object Mapping for this class and given objectManager @param manager A shared RKObjectmanager that contains the connection data to the API */ +(RKObjectMapping*)mappingWithManager:(RKObjectManager*)manager; @property (nonatomic) NSString *elementKey; /** If given, the link permissions between the elementKey and childelement will be returned. Can be null */ @property (nonatomic) NSString *childElementKey; /// The user shortname @property (nonatomic) NSString *userKey; /// The list of permissions @property (nonatomic) KTElementPermissionList *permissions; /** Loads the current elementPerimssion for this moment in time. @param elementKey The elementKey to get the permissions from. @param childElementKey If not nil, the link poermission between elementKey and this childelememt is returned. @param success A block to execute after the permission list is loaded @param failure A block to execute if loading fails */ +(void)loadWithElementKey:(NSString*)elementKey childElementkey:(NSString*)childElementKey success:(void (^)(KTElementPermissions *elementPermission))success failure:(void (^)(NSError *error))failure; /** Loads the current elementPerimssion for this moment in time. @param elementKey The elementKey to get the permissions from. @param success A block to execute after the permission list is loaded @param failure A block to execute if loading fails */ +(void)loadWithElementKey:(NSString*)elementKey success:(void (^)(KTElementPermissions *elementPermission))success failure:(void (^)(NSError *error))failure; @end
// // GJGCChatSystemInviteFriendJoinGroupCell.h // ZYChat // // Created by ZYVincent QQ:1003081775 on 14-12-10. // Copyright (c) 2014年 ZYProSoft. All rights reserved. // #import "GJGCChatAuthorizAskCell.h" @interface GJGCChatSystemInviteFriendJoinGroupCell : GJGCChatAuthorizAskCell @end
// // Created by Andrew Podkovyrin // Copyright © 2019 Dash Core Group. All rights reserved. // // Licensed under the MIT License (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://opensource.org/licenses/MIT // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #import "DWButton.h" #import "UIView+DWAnimations.h" NS_ASSUME_NONNULL_BEGIN @interface DWPressableButton : DWButton @property (nonatomic, assign) DWPressedAnimationStrength pressedStrength; @end NS_ASSUME_NONNULL_END
#include "NUS_population.h" #include <stdlib.h> NUS_population nus_population_build(void) { NUS_population h_population = malloc(sizeof(NUS_REC_HANDLE(h_population))); NUS_REC_HANDLE(h_population).entities = NULL; NUS_REC_HANDLE(h_population).entity_count = 0; return h_population; } void nus_population_free(NUS_population h_population) { free(NUS_REC_HANDLE(h_population).entities); free(h_population); } void nus_population_add(NUS_population h_population, NUS_entity h_entity) { if(nus_population_contains_entity(h_population, h_entity)) return; NUS_REC_HANDLE(h_population).entities = realloc(NUS_REC_HANDLE(h_population).entities, sizeof(*NUS_REC_HANDLE(h_population).entities) * ++NUS_REC_HANDLE(h_population).entity_count); NUS_REC_HANDLE(h_population).entities [NUS_REC_HANDLE(h_population).entity_count - 1] = h_entity; } void nus_population_remove(NUS_population h_population, NUS_entity h_entity) { if(!nus_population_contains_entity(h_population, h_entity)) return; NUS_entity *ph_tmp_entities = NUS_REC_HANDLE(h_population).entities; NUS_REC_HANDLE(h_population).entities = malloc(sizeof(*NUS_REC_HANDLE(h_population).entities) * --NUS_REC_HANDLE(h_population).entity_count); for(int i = 0; i < NUS_REC_HANDLE(h_population).entity_count + 1; ++i){ if(ph_tmp_entities[i] == h_entity) continue; *NUS_REC_HANDLE(h_population).entities = ph_tmp_entities[i]; ++NUS_REC_HANDLE(h_population).entities; } NUS_REC_HANDLE(h_population).entities -= NUS_REC_HANDLE(h_population).entity_count; } NUS_bool nus_population_contains_entity (NUS_population h_population, NUS_entity h_entity) { int i; for(i = 0; i < NUS_REC_HANDLE(h_population).entity_count; ++i){ if(NUS_REC_HANDLE(h_population).entities[i] == h_entity) return NUS_TRUE; } return NUS_FALSE; }
#ifndef LEDDEVICEWS281X_H_ #define LEDDEVICEWS281X_H_ #pragma once #include <leddevice/LedDevice.h> #include <ws2811.h> class LedDeviceWS281x : public LedDevice { public: /// /// Constructs the LedDevice for WS281x (one wire 800kHz) /// /// @param gpio The gpio pin to use (BCM chip counting, default is 18) /// @param leds The number of leds attached to the gpio pin /// @param freq The target frequency for the data line, default is 800000 /// @param dmanum The DMA channel to use, default is 5 /// @param pwmchannel The pwm channel to use /// @param invert Invert the output line to support an inverting level shifter /// @param rgbw Send 32 bit rgbw colour data for sk6812 /// LedDeviceWS281x(const int gpio, const int leds, const uint32_t freq, int dmanum, int pwmchannel, int invert, int rgbw, const std::string& whiteAlgorithm); /// /// Destructor of the LedDevice, waits for DMA to complete and then cleans up /// ~LedDeviceWS281x(); /// /// Writes the led color values to the led-device /// /// @param ledValues The color-value per led /// @return Zero on succes else negative /// virtual int write(const std::vector<ColorRgb> &ledValues); /// Switch the leds off virtual int switchOff(); private: ws2811_t led_string; int chan; bool initialized; std::string _whiteAlgorithm; ColorRgbw _temp_rgbw; }; #endif /* LEDDEVICEWS281X_H_ */
/* The MIT License (MIT) Copyright (c) 2015 VISUEM LTD Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * author: noyan gunday * date: dec 24th, 2006 * abstract: typeless data container */ #ifndef __VISUEM_GENERIC_H__ #define __VISUEM_GENERIC_H__ #ifdef __cplusplus extern "C" { #endif /** * \brief typeless data container */ typedef struct { void* pointer; /* pointer to data */ int tag; /* additional information about data */ } generic; #ifdef __cplusplus } /* extern "C" */ #endif #endif
/* * Generated by class-dump 3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2012 by Steve Nygard. */ #import <IDEKit/IDENavigableItemDomainProvider.h> @interface IDENavigableItemWorkspaceBotLogDomainProvider : IDENavigableItemDomainProvider { } + (id)domainObjectForWorkspace:(id)arg1; @end
// // BaseTreeViewController.h // MTreeViewFramework // // Created by Micker on 16/3/31. // Copyright © 2016年 micker. All rights reserved. // #import <UIKit/UIKit.h> #import "MTreeView.h" @interface BaseTreeViewController : UIViewController<UITableViewDelegate, UITableViewDataSource, MTreeViewDelegate> @property (nonatomic, strong) IBOutlet MTreeView *treeView; /** * 钩子函数,子类对TreeView进行配置 * * @parames * */ - (void) doConfigTreeView; @end
// // FLTextView.h // FishLamp // // Created by Mike Fullerton on 2/1/11. // Copyright (c) 2013 GreenTongue Software LLC, Mike Fullerton. // The FishLamp Framework is released under the MIT License: http://fishlamp.com/license // #import <Foundation/Foundation.h> #import "FLTextDescriptor.h" #import "FLLabel.h" @interface FLTextView : UITextView { @private BOOL _canResign; FLTextDescriptor* _textDescriptor; FLTextDescriptorState _state; UIEdgeInsets _edgeInsets; BOOL _useEnforceEdgeInsets; FLLabel* _placeholderTextLabel; UIEdgeInsets _viewLayoutMargins; } @property (readwrite, assign, nonatomic) UIEdgeInsets enforcedEdgeInsets; @property (readwrite, assign, nonatomic) BOOL useEnforcedEdgeInsets; @property (readwrite, copy, nonatomic) FLTextDescriptor* textDescriptor; @property (readwrite, nonatomic, assign, getter=isEnabled) BOOL enabled; // same as editable (superclass), here for compatibility @property (readonly, retain, nonatomic) FLLabel* placeholderTextLabel; @property (readwrite, retain, nonatomic) NSString* placeholderText; - (void) updatePlaceholderTextVisibility; - (void) setCanResignFirstResponder:(BOOL) canResign; @property (readwrite, assign, nonatomic) UIEdgeInsets viewLayoutMargins;// these are deltas when used with @end @interface UITextView (Extras) - (void) insertStringAtSelection:(NSString*) string; @end
/** @file contact_test.h @author Mike Helmick // Change me! @date 09-22-2013 // Change me! Contains unit tests for the Contact class. */ #ifndef CONTACT_TEST_H #define CONTACT_TEST_H #include <phone_number.h> #include <contact.h> #include <string> #include <cxxtest/TestSuite.h> using namespace std; class ContactTest : public CxxTest::TestSuite { public: void testConstructor() { string name = "Bart Simpson"; Contact c(name); TS_ASSERT_EQUALS(name, c.getName()); TS_ASSERT_EQUALS(0, c.getPhoneNumbers()->size()); } void testAddPhoneNumber() { string name = "Bart Simpson"; Contact c(name); PhoneNumber pn("Mobile Phone", "123-456-7890"); c.addPhoneNumber(pn); TS_ASSERT_EQUALS(name, c.getName()); TS_ASSERT_EQUALS(1, c.getPhoneNumbers()->size()); TS_ASSERT_EQUALS(PT_CUSTOM, c.getPhoneNumbers()->at(0)->getType()); TS_ASSERT_EQUALS("Mobile Phone", c.getPhoneNumbers()->at(0)->getLabel()); TS_ASSERT_EQUALS("123-456-7890", c.getPhoneNumbers()->at(0)->getDigits()); } void testAddABunchOfPhoneNumbers() { string name = "Stephen Colbert"; string number = "347-1111"; Contact c(name); // 1,000,000 is overkill, just showing what can be done here. for (int i = 0; i < 1000000; i++) { PhoneNumber pn(PT_HOME, number); c.addPhoneNumber(pn); TS_ASSERT_EQUALS(i + 1, c.getPhoneNumbers()->size()); TS_ASSERT_EQUALS(PT_HOME, c.getPhoneNumbers()->at(i)->getType()); TS_ASSERT_EQUALS(number, c.getPhoneNumbers()->at(i)->getDigits()); } // Retest another value TS_ASSERT_EQUALS(PT_HOME, c.getPhoneNumbers()->at(400)->getType()); TS_ASSERT_EQUALS(number, c.getPhoneNumbers()->at(400)->getDigits()); } }; #endif
#import <Foundation/Foundation.h> //parse and facebook 登入 #import <Parse/Parse.h> #import <ParseFacebookUtilsV4/PFFacebookUtils.h> #import <ParseUI/ParseUI.h> #import <FBSDKCoreKit/FBSDKGraphRequestConnection.h> #import <FBSDKCoreKit/FBSDKGraphRequest.h> #import "PFLogInViewController.h" #import <FBSDKCoreKit/FBSDKCoreKit.h> @interface NSObject (SaveParse) //更新物件-->可Parse取得指定的物件,然後再用block更新資料 +(void) getObjectWithClassName:(NSString*)className withObjectID:(NSString*)ObjectID fetchBlock:(void(^)(PFObject *pfObject))fetchBlock; //刪除user已按喜歡的文章 +(void)removeFocusUserLikeWithPhotoID:(NSString*)photoID withUserID:(NSString*)userID completions:(void(^)())completions; //創建特定Table的記錄->採Block方法 +(void)saveOneObjectWithClassName:(NSString*)className complection:(void(^)(PFObject *pfObject))complection; //刪除指定user的追蹤 +(void)removeFolloweringWithUser:(PFUser*)user withOtherUser:(PFUser*)otherUser completions:(void(^)(BOOL completion))completion; @end
#ifndef _INSPIRE_NET_REACTOR_ENGINE_H_ #define _INSPIRE_NET_REACTOR_ENGINE_H_ #include "util/inspire.h" #include "overlapped.h" #include "util/container/deque.h" namespace inspire { class Reactor : public EventHandler { public: Reactor(); virtual ~Reactor(); public: int initailize(); int bind(asyncConnection* conn); int run(); void stop(); void destroy(); void associate(overlappedContext* overlapped); bool stopped() const; int handle(overlappedContext* overlapped); private: bool _stop; uint _maxEventCount; #ifdef _WIN32 HANDLE _hIOCP; // IOCP handle #else int _epoll; // epoll handle struct epoll_event* _events; #endif deque<overlappedContext*> _dequeOverlapped; }; } #endif
/** * \file * \brief pmap management wrappers */ /* * Copyright (c) 2010, ETH Zurich. * Copyright (c) 2015, Hewlett Packard Enterprise Development LP. * All rights reserved. * * This file is distributed under the terms in the attached LICENSE file. * If you do not find this file, copies can be found by writing to: * ETH Zurich D-INFK, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group. */ #ifndef ARCH_AARCH64_BARRELFISH_PMAP_H #define ARCH_AARCH64_BARRELFISH_PMAP_H #include <target/aarch64/barrelfish/pmap_target.h> #define ARCH_DEFAULT_PMAP_SIZE sizeof(struct pmap_aarch64) errval_t pmap_init(struct pmap *p, struct vspace *v, struct capref vnode, struct slot_allocator *opt_slot_alloc); errval_t pmap_current_init(bool); #endif // ARCH_AARCH64_BARRELFISH_PMAP_H
#ifndef EIRVARIABLE_H #define EIRVARIABLE_H #include "eirVariable_global.h" class EIRVARIABLESHARED_EXPORT eirVariable { public: eirVariable(); }; #endif // EIRVARIABLE_H
// // TSStringValidatorItem.h // TSStringDataValidator // // Created by Tomasz Szulc on 21.12.2013. // Copyright (c) 2013 Tomasz Szulc. All rights reserved. // #import <Foundation/Foundation.h> @interface TSStringValidatorItem : NSObject /** string value to validate */ @property (nonatomic, readonly, copy) NSString *stringValue; /** identifier of TSStringValidatorPattern object */ @property (nonatomic, readonly, copy) NSString *patternIdentifier; /** Used during validation process. If allowsEmpty set to yes, empty string will be valid. Default set to YES */ @property (nonatomic, readonly, assign) BOOL allowsEmpty; /** @define Creates item with passed parameters @abstract Method used to create item which will be validated @param string String to validate @param identifier Identifier of TSStringValidatorPattern object @param allowsEmpty It tells the validator that stringValue may be empty (but not nil) and validation returns success. Default set to YES. If allowsEmpty should be set to YES you should consider use shorter initializer */ + (instancetype)itemWithString:(NSString *)string patternIdentifier:(NSString *)identifier allowsEmpty:(BOOL)allowsEmpty; /** @define Creates item with passed parameters @abstract Method used to create item which will be validated @param string String to validate @param identifier Identifier of TSStringValidatorPattern object */ + (instancetype)itemWithString:(NSString *)string patternIdentifier:(NSString *)identifier; @end
/**************************************************************************** ** libmatroska : parse Matroska files, see http://www.matroska.org/ ** ** <file/class description> ** ** Copyright (C) 2002-2010 Steve Lhomme. All rights reserved. ** ** This file is part of libmatroska. ** ** 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 ** ** See http://www.matroska.org/license/lgpl/ for LGPL licensing information.** ** Contact license@matroska.org if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ /*! \file \version \$Id: KaxTrackEntryData.h,v 1.9 2004/04/14 23:26:17 robux4 Exp $ \author Steve Lhomme <robux4 @ users.sf.net> \author John Cannon <spyder2555 @ users.sf.net> */ #ifndef LIBMATROSKA_TRACK_ENTRY_DATA_H #define LIBMATROSKA_TRACK_ENTRY_DATA_H #include "matroska/KaxTypes.h" #include "ebml/EbmlUInteger.h" #include "ebml/EbmlFloat.h" #include "ebml/EbmlString.h" #include "ebml/EbmlUnicodeString.h" #include "ebml/EbmlBinary.h" #include "ebml/EbmlMaster.h" #include "matroska/KaxDefines.h" using namespace LIBEBML_NAMESPACE; START_LIBMATROSKA_NAMESPACE DECLARE_MKX_UINTEGER(KaxTrackNumber) }; DECLARE_MKX_UINTEGER(KaxTrackUID) }; DECLARE_MKX_UINTEGER(KaxTrackType) }; #if MATROSKA_VERSION >= 2 DECLARE_MKX_UINTEGER(KaxTrackFlagEnabled) }; #endif // MATROSKA_VERSION DECLARE_MKX_UINTEGER(KaxTrackFlagDefault) }; DECLARE_MKX_UINTEGER(KaxTrackFlagForced) }; DECLARE_MKX_UINTEGER(KaxTrackFlagLacing) }; DECLARE_MKX_UINTEGER(KaxTrackMinCache) }; DECLARE_MKX_UINTEGER(KaxTrackMaxCache) }; DECLARE_MKX_UINTEGER(KaxTrackDefaultDuration) }; DECLARE_MKX_FLOAT(KaxTrackTimecodeScale) }; DECLARE_MKX_UINTEGER(KaxMaxBlockAdditionID) }; DECLARE_MKX_UNISTRING(KaxTrackName) }; DECLARE_MKX_STRING(KaxTrackLanguage) }; DECLARE_MKX_STRING(KaxCodecID) }; DECLARE_MKX_BINARY(KaxCodecPrivate) }; DECLARE_MKX_UNISTRING(KaxCodecName) }; DECLARE_MKX_BINARY(KaxTrackAttachmentLink) }; DECLARE_MKX_UINTEGER(KaxTrackOverlay) }; DECLARE_MKX_MASTER(KaxTrackTranslate) }; DECLARE_MKX_UINTEGER(KaxTrackTranslateCodec) }; DECLARE_MKX_UINTEGER(KaxTrackTranslateEditionUID) }; DECLARE_MKX_BINARY(KaxTrackTranslateTrackID) }; #if MATROSKA_VERSION >= 2 DECLARE_MKX_UNISTRING(KaxCodecSettings) }; DECLARE_MKX_STRING(KaxCodecInfoURL) }; DECLARE_MKX_STRING(KaxCodecDownloadURL) }; DECLARE_MKX_UINTEGER(KaxCodecDecodeAll) }; #endif // MATROSKA_VERSION END_LIBMATROSKA_NAMESPACE #endif // LIBMATROSKA_TRACK_ENTRY_DATA_H
// // Created by Andrew Podkovyrin // Copyright © 2019 Dash Core Group. All rights reserved. // // Licensed under the MIT License (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://opensource.org/licenses/MIT // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #import <Foundation/Foundation.h> NS_ASSUME_NONNULL_BEGIN @class UIFont; @class UIColor; @interface DWBalanceModel : NSObject @property (readonly, nonatomic, assign) uint64_t value; - (NSAttributedString *)dashAmountStringWithFont:(UIFont *)font tintColor:(UIColor *)tintColor; - (NSString *)fiatAmountString; - (instancetype)initWithValue:(uint64_t)value; - (instancetype)init NS_UNAVAILABLE; @end NS_ASSUME_NONNULL_END
#include "lmice_eal_inc.h" #include "lmice_trace.h" #include <errno.h> #include <stdlib.h> int eal_inc_create_client(eal_inc_param* pm) { int ret = 0; int flag_on = 1; struct addrinfo hints; struct addrinfo *remote = pm->remote; struct addrinfo *local = NULL; /* create a socket for sending to the multicast address */ if ((pm->sock_client = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) { ret = errno; lmice_error_print("eal_inc_create_client call socket failed[%d]\n", ret); return ret; } /* set the TTL (time to live/hop count) for the send */ if ((setsockopt(pm->sock_client, IPPROTO_IP, IP_MULTICAST_TTL, (void*) &pm->ttl, sizeof(pm->ttl))) < 0) { ret = errno; lmice_error_print("eal_inc_create_client call setsockopt(TTL) failed[%d]\n", ret); return ret; } /* set reuse port to on to allow multiple binds per host */ if ((setsockopt(pm->sock_client, SOL_SOCKET, SO_REUSEADDR, &flag_on, sizeof(flag_on))) < 0) { ret = errno; lmice_error_print("eal_inc_create_client call setsockopt(REUSEADDR) failed[%d]\n", ret); return ret; } /* getaddrinfo hints addrinfo */ memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */ hints.ai_socktype = SOCK_DGRAM; /* Stream socket */ hints.ai_flags = AI_PASSIVE; /* For wildcard IP address */ hints.ai_protocol = IPPROTO_IP; /* IP protocol */ hints.ai_canonname = NULL; hints.ai_addr = NULL; hints.ai_next = NULL; ret = getaddrinfo(pm->local_addr, pm->local_port, &hints, &local); if (ret != 0) { ret = errno; lmice_error_print("eal_inc_create_client call getaddrinfo[%s] failed[%d (%s)]\n", pm->local_addr, ret, gai_strerror(ret)); return ret; } /* bind to multicast address to socket */ if ((bind(pm->sock_client, (struct sockaddr *) local->ai_addr, local->ai_addrlen)) < 0) { ret = errno; lmice_error_print("eal_inc_create_client call bind() failed[%d]\n", ret); return ret; } ret = getaddrinfo(pm->remote_addr, pm->remote_port, &hints, &remote); if (ret != 0) { ret = errno; lmice_error_print("eal_inc_create_client call 2 getaddrinfo[%s] failed[%d (%s)]\n", pm->remote_addr, ret, gai_strerror(ret)); return ret; } return ret; } int eal_inc_create_server(eal_inc_param *pm) { int ret = 0; int flag_on = 1; struct sockaddr_in mc_addr; struct ip_mreq mc_req; /* create a socket for sending to the multicast address */ if ((pm->sock_server = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) { ret = errno; lmice_error_print("eal_inc_create_server call socket failed[%d]\n", ret); return ret; } /* set reuse port to on to allow multiple binds per host */ if ((setsockopt(pm->sock_server, SOL_SOCKET, SO_REUSEADDR, (const char*)&flag_on, sizeof(flag_on))) < 0) { ret = errno; lmice_error_print("eal_inc_create_server call setsockopt(REUSEADDR) failed[%d]\n", ret); return ret; } /* construct a multicast address structure */ memset(&mc_addr, 0, sizeof(mc_addr)); mc_addr.sin_family = AF_INET; if(strncmp(pm->local_addr, "127.0.0.1", 10) == 0) { mc_addr.sin_addr.s_addr = htonl(INADDR_ANY); } else { mc_addr.sin_addr.s_addr = inet_addr(pm->local_addr); } mc_addr.sin_port = htons(atoi(pm->local_port)); /* bind to multicast address to socket */ if ((bind(pm->sock_server, (struct sockaddr *) &mc_addr, sizeof(mc_addr))) < 0) { ret = errno; lmice_error_print("eal_inc_create_server call bind() failed[%d]\n", ret); return ret; } /* construct an IGMP join request structure */ mc_req.imr_multiaddr.s_addr = inet_addr(pm->remote_addr); mc_req.imr_interface.s_addr = inet_addr(pm->local_addr); /* send an ADD MEMBERSHIP message via setsockopt */ if ((setsockopt(pm->sock_server, IPPROTO_IP, IP_ADD_MEMBERSHIP, (void*) &mc_req, sizeof(mc_req))) < 0) { ret = errno; lmice_error_print("eal_inc_create_server call setsockopt(ADD_MEMBERSHIP) failed[%d]", ret); } return ret; }
/*! \file mm.h \brief RSX memory management. */ #ifndef __RSX_MM_H__ #define __RSX_MM_H__ #include <ppu-types.h> #ifdef __cplusplus extern "C" { #endif /*! \brief Initialize the RSX heap. \return 0 if no error, nonzero otherwise. */ s32 rsxHeapInit(); /*! \brief Dynamic allocation of RSX memory. \param size Size in bytes of buffer to be allocated. \return Pointer to the allocated buffer, or \c NULL if an error occured. */ void* rsxMalloc(u32 size); /*! \brief Dynamic allocation of aligned RSX memory. \param alignment The required alignment value. \param size Size in bytes of buffer to be allocated. \return Pointer to the allocated buffer, or \c NULL if an error occured. */ void* rsxMemalign(u32 alignment,u32 size); /*! \brief Deallocation of a previously dynamically allocated RSX buffer. The buffer must have been allocated with \ref rsxMalloc or \ref rsxMemalign. \param ptr Pointer to the allocated buffer. */ void rsxFree(void *ptr); #ifdef __cplusplus } #endif #endif
#pragma once #include <Kore/Audio2/Audio.h> namespace Kore { struct Sound { public: Sound(const char* filename); ~Sound(); Audio2::BufferFormat format; float volume(); void setVolume(float value); s16* left; s16* right; int size; float sampleRatePos; private: float myVolume; }; }
/* * tid_table.h * * Created on: Aug 2, 2012 * Author: alexey */ #ifndef TID_TABLE_H_ #define TID_TABLE_H_ #include "data.h" typedef struct __cnt_user_threads { char username[USERNAMEMAXLEN]; int max_simultaneous_requests; } cnt_user_threads; typedef struct __tid_table { char username[USERNAMEMAXLEN]; long long cpu; long long read; long long write; time_t update_time; long naoseconds; pid_t pid; int fd; } tid_table; typedef struct __Stat_counters { Stats s; double tm; } Stat_counters; void free_tid (gpointer ti); void free_tid_key (gpointer ti); int init_tid_table (); void free_tid_table (); void add_new_tid_data (client_data * tbl, int fd); tid_table *get_tid_data (pid_t tid, tid_table * buf); void remove_tid_data (pid_t tid); void proceed_tid_data (GHFunc func, gpointer user_data); void add_new_tid_data2 (pid_t tid, tid_table * tbl); void remove_tid_data_by_fd (int fd); void reset_counters (char *username); void increment_counters (char *username, long long cpu, long long read, long long write, double tm); GHashTable *get_counters_table (); void add_tid_to_bad_list (pid_t pid); long get_tid_size (); void unlock_tid_data (); void lock_tid_data (); int get_cnt_threads (const char *username); #ifdef TEST void print_tid_data (); #endif #endif /* TID_TABLE_H_ */
/* * Copyright 2008 Benjamin C. Meyer <ben@meyerhome.net> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA */ /**************************************************************************** ** ** Copyright (C) 2007-2008 Trolltech ASA. All rights reserved. ** ** This file is part of the demonstration applications of the Qt Toolkit. ** ** This file may be used under the terms of the GNU General Public ** License versions 2.0 or 3.0 as published by the Free Software ** Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3 ** included in the packaging of this file. Alternatively you may (at ** your option) use any later version of the GNU General Public ** License if such license has been publicly approved by Trolltech ASA ** (or its successors, if any) and the KDE Free Qt Foundation. In ** addition, as a special exception, Trolltech gives you certain ** additional rights. These rights are described in the Trolltech GPL ** Exception version 1.2, which can be found at ** http://www.trolltech.com/products/qt/gplexception/ and in the file ** GPL_EXCEPTION.txt in this package. ** ** Please review the following information to ensure GNU General ** Public Licensing requirements will be met: ** http://trolltech.com/products/qt/licenses/licensing/opensource/. If ** you are unsure which license is appropriate for your use, please ** review the following information: ** http://trolltech.com/products/qt/licenses/licensing/licensingoverview ** or contact the sales department at sales@trolltech.com. ** ** In addition, as a special exception, Trolltech, as the sole ** copyright holder for Qt Designer, grants users of the Qt/Eclipse ** Integration plug-in the right for the Qt/Eclipse Integration to ** link to functionality provided by Qt Designer and its related ** libraries. ** ** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, ** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE. Trolltech reserves all rights not expressly ** granted herein. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ****************************************************************************/ #ifndef CLEARBUTTON_H #define CLEARBUTTON_H #include <qabstractbutton.h> /* Clear button on the right hand side of the search widget. Hidden by default "A circle with an X in it" */ class ClearButton : public QAbstractButton { Q_OBJECT public: ClearButton(QWidget *parent = 0); void paintEvent(QPaintEvent *event); public slots: void textChanged(const QString &text); }; #endif // CLEARBUTTON_H
// This defines the interfaces to various odd and ends. // // Copyright (c) 2013 Riverbank Computing Limited <info@riverbankcomputing.com> // // This file is part of PyQt. // // This file may be used under the terms of the GNU General Public // License versions 2.0 or 3.0 as published by the Free Software // Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3 // included in the packaging of this file. Alternatively you may (at // your option) use any later version of the GNU General Public // License if such license has been publicly approved by Riverbank // Computing Limited (or its successors, if any) and the KDE Free Qt // Foundation. In addition, as a special exception, Riverbank gives you // certain additional rights. These rights are described in the Riverbank // GPL Exception version 1.1, which can be found in the file // GPL_EXCEPTION.txt in this package. // // If you are unsure which license is appropriate for your use, please // contact the sales department at sales@riverbankcomputing.com. // // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. #ifndef _QPYCORE_MISC_H #define _QPYCORE_MISC_H #include <Python.h> #include "qpycore_shared.h" #include "qpycore_sip.h" bool qpycore_is_pyqt4_class(const sipTypeDef *td); #endif
/**************************************************************************** ** ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtLocation module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL21$ ** 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 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional ** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QPLACEDESCRIPTION_P_H #define QPLACEDESCRIPTION_P_H #include <QtCore/QUrl> #include <QtLocation/QPlaceSupplier> #include "qplacecontent_p.h" QT_BEGIN_NAMESPACE class QPlaceEditorialPrivate : public QPlaceContentPrivate { public: QPlaceEditorialPrivate(); QPlaceEditorialPrivate(const QPlaceEditorialPrivate &other); ~QPlaceEditorialPrivate(); bool compare(const QPlaceContentPrivate *other) const; Q_DEFINE_CONTENT_PRIVATE_HELPER(QPlaceEditorial, QPlaceContent::EditorialType) QString text; QString contentTitle; QString language; }; QT_END_NAMESPACE #endif // QPLACEDESCRIPTION_P_H
/* smplayer, GUI front-end for mplayer. Copyright (C) 2006-2015 Ricardo Villalba <rvm@users.sourceforge.net> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License 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 FONTCACHE_H #define FONTCACHE_H #include <QProgressDialog> class QProcess; class FontCacheDialog : public QProgressDialog { Q_OBJECT public: FontCacheDialog(QWidget * parent = 0, Qt::WindowFlags f = 0); ~FontCacheDialog(); void run(QString mplayer_bin, QString file); /* protected slots: void readOutput(); */ protected: QProcess * process; }; #endif
/***************************************************************************** * stream.h: Input stream functions ***************************************************************************** * Copyright (C) 1998-2008 VLC authors and VideoLAN * Copyright (C) 2008 Laurent Aimar * $Id$ * * Authors: Laurent Aimar <fenrir@via.ecp.fr> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ #ifndef LIBVLC_INPUT_STREAM_H #define LIBVLC_INPUT_STREAM_H 1 #include <vlc_common.h> #include <vlc_stream.h> /* */ stream_t *stream_CommonNew( vlc_object_t *, void (*destroy)(stream_t *) ); void stream_CommonDelete( stream_t *s ); /** * This function creates a stream_t with an access_t back-end. */ stream_t *stream_AccessNew(vlc_object_t *, input_thread_t *, bool, const char *); /** * This function creates a new stream_t filter. * * You must release it using stream_Delete unless it is used as a * source to another filter. */ stream_t *stream_FilterNew( stream_t *p_source, const char *psz_stream_filter ); /** * Automatically wraps a stream with any applicable stream filter. * @return the (outermost/downstream) stream filter; if no filters were added, * then the function return the source parameter. * @note The function never returns NULL. */ stream_t *stream_FilterAutoNew( stream_t *source ) VLC_USED; /** * This function creates a chain of filters according to the colon-separated * list. * * You must release the returned value using stream_Delete unless it is used as a * source to another filter. */ stream_t *stream_FilterChainNew( stream_t *p_source, const char *psz_chain ); char *get_path(const char *location); #endif
/**************************************************************************** ** ** 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 QtCore 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 QSHAREDMEMORY_P_H #define QSHAREDMEMORY_P_H // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists purely as an // implementation detail. This header file may change from version to // version without notice, or even be removed. // // We mean it. // #include "qsharedmemory.h" #ifdef QT_NO_SHAREDMEMORY # ifndef QT_NO_SYSTEMSEMAPHORE namespace QSharedMemoryPrivate { int createUnixKeyFile(const QString &fileName); QString makePlatformSafeKey(const QString &key, const QString &prefix = QLatin1String("qipc_sharedmemory_")); } #endif #else #include "qsystemsemaphore.h" #include "private/qobject_p.h" #ifdef Q_OS_WIN # include <qt_windows.h> #elif defined(Q_OS_SYMBIAN) # include <e32std.h> # include <sys/types.h> #else # include <sys/types.h> #endif QT_BEGIN_NAMESPACE #ifndef QT_NO_SYSTEMSEMAPHORE /*! Helper class */ class QSharedMemoryLocker { public: inline QSharedMemoryLocker(QSharedMemory *sharedMemory) : q_sm(sharedMemory) { Q_ASSERT(q_sm); } inline ~QSharedMemoryLocker() { if (q_sm) q_sm->unlock(); } inline bool lock() { if (q_sm && q_sm->lock()) return true; q_sm = 0; return false; } private: QSharedMemory *q_sm; }; #endif // QT_NO_SYSTEMSEMAPHORE class Q_AUTOTEST_EXPORT QSharedMemoryPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QSharedMemory) public: QSharedMemoryPrivate(); void *memory; int size; QString key; QString nativeKey; QSharedMemory::SharedMemoryError error; QString errorString; #ifndef QT_NO_SYSTEMSEMAPHORE QSystemSemaphore systemSemaphore; bool lockedByMe; #endif static int createUnixKeyFile(const QString &fileName); static QString makePlatformSafeKey(const QString &key, const QString &prefix = QLatin1String("qipc_sharedmemory_")); #ifdef Q_OS_WIN HANDLE handle(); #elif defined(QT_POSIX_IPC) int handle(); #else key_t handle(); #endif bool initKey(); void cleanHandle(); bool create(int size); bool attach(QSharedMemory::AccessMode mode); bool detach(); #ifdef Q_OS_SYMBIAN void setErrorString(const QString &function, TInt errorCode); #else void setErrorString(const QString &function); #endif #ifndef QT_NO_SYSTEMSEMAPHORE inline bool tryLocker(QSharedMemoryLocker *locker, const QString &function) { if (!locker->lock()) { errorString = QSharedMemory::tr("%1: unable to lock").arg(function); error = QSharedMemory::LockError; return false; } return true; } #endif // QT_NO_SYSTEMSEMAPHORE private: #ifdef Q_OS_WIN HANDLE hand; #elif defined(Q_OS_SYMBIAN) RChunk chunk; #elif defined(QT_POSIX_IPC) int hand; #else key_t unix_key; #endif }; QT_END_NAMESPACE #endif // QT_NO_SHAREDMEMORY #endif // QSHAREDMEMORY_P_H
/****************************************************************************** * $Id$ * * Project: Common Portability Library * Purpose: Functions for reading and scaning CSV (comma separated, * variable length text files holding tables) files. * Author: Frank Warmerdam, warmerdam@pobox.com * ****************************************************************************** * Copyright (c) 1999, Frank Warmerdam * Copyright (c) 2010, Even Rouault <even dot rouault at mines-paris dot 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 GDAL_CSV_H_INCLUDED #define GDAL_CSV_H_INCLUDED #include "cpl_port.h" CPL_C_START const char * GDALDefaultCSVFilename( const char *pszBasename ); CPL_C_END #endif
/* * Based on arch/arm/include/asm/processor.h * * Copyright (C) 1995-1999 Russell King * Copyright (C) 2012 ARM Ltd. * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef __ASM_PROCESSOR_H #define __ASM_PROCESSOR_H /* * Default implementation of macro that returns current * instruction pointer ("program counter"). */ #define current_text_addr() ({ __label__ _l; _l: &&_l;}) #ifdef __KERNEL__ #include <linux/string.h> #include <asm/fpsimd.h> #include <asm/hw_breakpoint.h> #include <asm/ptrace.h> #include <asm/types.h> #include <asm/relaxed.h> #ifdef __KERNEL__ #define STACK_TOP_MAX TASK_SIZE_64 #ifdef CONFIG_COMPAT #define AARCH32_VECTORS_BASE 0xffff0000 #define STACK_TOP (test_thread_flag_relaxed(TIF_32BIT) ? \ AARCH32_VECTORS_BASE : STACK_TOP_MAX) #else #define STACK_TOP STACK_TOP_MAX #endif /* CONFIG_COMPAT */ #define ARCH_LOW_ADDRESS_LIMIT PHYS_MASK #endif /* __KERNEL__ */ struct debug_info { /* Have we suspended stepping by a debugger? */ int suspended_step; /* Allow breakpoints and watchpoints to be disabled for this thread. */ int bps_disabled; int wps_disabled; /* Hardware breakpoints pinned to this task. */ struct perf_event *hbp_break[ARM_MAX_BRP]; struct perf_event *hbp_watch[ARM_MAX_WRP]; }; struct cpu_context { unsigned long x19; unsigned long x20; unsigned long x21; unsigned long x22; unsigned long x23; unsigned long x24; unsigned long x25; unsigned long x26; unsigned long x27; unsigned long x28; unsigned long fp; unsigned long sp; unsigned long pc; }; struct thread_struct { struct cpu_context cpu_context; /* cpu context */ unsigned long tp_value; struct fpsimd_state fpsimd_state; unsigned long fault_address; /* fault info */ struct debug_info debug; /* debugging */ }; #define INIT_THREAD { } static inline void start_thread_common(struct pt_regs *regs, unsigned long pc) { memset(regs, 0, sizeof(*regs)); regs->syscallno = ~0UL; regs->pc = pc; } static inline void start_thread(struct pt_regs *regs, unsigned long pc, unsigned long sp) { start_thread_common(regs, pc); regs->pstate = PSR_MODE_EL0t; regs->sp = sp; } #ifdef CONFIG_COMPAT static inline void compat_start_thread(struct pt_regs *regs, unsigned long pc, unsigned long sp) { start_thread_common(regs, pc); regs->pstate = COMPAT_PSR_MODE_USR; if (pc & 1) regs->pstate |= COMPAT_PSR_T_BIT; #ifdef __AARCH64EB__ regs->pstate |= COMPAT_PSR_E_BIT; #endif regs->compat_sp = sp; } #endif /* Forward declaration, a strange C thing */ struct task_struct; /* Free all resources held by a thread. */ extern void release_thread(struct task_struct *); /* Prepare to copy thread state - unlazy all lazy status */ #define prepare_to_copy(tsk) do { } while (0) unsigned long get_wchan(struct task_struct *p); static inline void cpu_relax(void) { asm volatile("yield" ::: "memory"); } #define cpu_read_relax() wfe() #define cpu_read_relax() wfe() /* Thread switching */ extern struct task_struct *cpu_switch_to(struct task_struct *prev, struct task_struct *next); #define task_pt_regs(p) \ ((struct pt_regs *)(THREAD_START_SP + task_stack_page(p)) - 1) #define KSTK_EIP(tsk) ((unsigned long)task_pt_regs(tsk)->pc) #define KSTK_ESP(tsk) user_stack_pointer(task_pt_regs(tsk)) /* * Prefetching support */ #define ARCH_HAS_PREFETCH static inline void prefetch(const void *ptr) { asm volatile("prfm pldl1keep, %a0\n" : : "p" (ptr)); } #define ARCH_HAS_PREFETCHW static inline void prefetchw(const void *ptr) { asm volatile("prfm pstl1keep, %a0\n" : : "p" (ptr)); } #define ARCH_HAS_SPINLOCK_PREFETCH static inline void spin_lock_prefetch(const void *x) { prefetchw(x); } #define HAVE_ARCH_PICK_MMAP_LAYOUT #endif #include <asm-generic/processor.h> #endif /* __ASM_PROCESSOR_H */
/* 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://libtomcrypt.org */ #include "tomcrypt.h" /** @file dsa_verify_key.c DSA implementation, verify a key, Tom St Denis */ #ifdef MDSA /** Verify a DSA key for validity @param key The key to verify @param stat [out] Result of test, 1==valid, 0==invalid @return CRYPT_OK if successful */ int dsa_verify_key(dsa_key *key, int *stat) { mp_int tmp, tmp2; int res, err; LTC_ARGCHK(key != NULL); LTC_ARGCHK(stat != NULL); /* default to an invalid key */ *stat = 0; /* first make sure key->q and key->p are prime */ if ((err = is_prime(&key->q, &res)) != CRYPT_OK) { return err; } if (res == 0) { return CRYPT_OK; } if ((err = is_prime(&key->p, &res)) != CRYPT_OK) { return err; } if (res == 0) { return CRYPT_OK; } /* now make sure that g is not -1, 0 or 1 and <p */ if (mp_cmp_d(&key->g, 0) == MP_EQ || mp_cmp_d(&key->g, 1) == MP_EQ) { return CRYPT_OK; } if ((err = mp_init_multi(&tmp, &tmp2, NULL)) != MP_OKAY) { goto error; } if ((err = mp_sub_d(&key->p, 1, &tmp)) != MP_OKAY) { goto error; } if (mp_cmp(&tmp, &key->g) == MP_EQ || mp_cmp(&key->g, &key->p) != MP_LT) { err = CRYPT_OK; goto done; } /* 1 < y < p-1 */ if (!(mp_cmp_d(&key->y, 1) == MP_GT && mp_cmp(&key->y, &tmp) == MP_LT)) { err = CRYPT_OK; goto done; } /* now we have to make sure that g^q = 1, and that p-1/q gives 0 remainder */ if ((err = mp_div(&tmp, &key->q, &tmp, &tmp2)) != MP_OKAY) { goto error; } if (mp_iszero(&tmp2) != MP_YES) { err = CRYPT_OK; goto done; } if ((err = mp_exptmod(&key->g, &key->q, &key->p, &tmp)) != MP_OKAY) { goto error; } if (mp_cmp_d(&tmp, 1) != MP_EQ) { err = CRYPT_OK; goto done; } /* now we have to make sure that y^q = 1, this makes sure y \in g^x mod p */ if ((err = mp_exptmod(&key->y, &key->q, &key->p, &tmp)) != MP_OKAY) { goto error; } if (mp_cmp_d(&tmp, 1) != MP_EQ) { err = CRYPT_OK; goto done; } /* at this point we are out of tests ;-( */ err = CRYPT_OK; *stat = 1; goto done; error: err = mpi_to_ltc_error(err); done : mp_clear_multi(&tmp, &tmp2, NULL); return err; } #endif /* $Source: /usr/local/dslrepos/uClinux-dist/user/dropbear-0.48.1/libtomcrypt/src/pk/dsa/dsa_verify_key.c,v $ */ /* $Revision: 1.1 $ */ /* $Date: 2006/06/08 13:50:33 $ */
#include <unistd.h> #include <fcntl.h> #include <string.h> #include <stdlib.h> #include <errno.h> #include <sys/xattr.h> #include "selinux_internal.h" #include "policy.h" int fsetfilecon(int fd, const security_context_t context) { return fsetxattr(fd, XATTR_NAME_SELINUX, context, strlen(context) + 1, 0); }
// This file is part of Chaotic Rage (c) 2010 Josh Heidenreich // // kate: tab-width 4; indent-width 4; space-indent off; word-wrap off; #pragma once #include <guichan.hpp> #include "../rage.h" using namespace std; class DialogNewGame; /** * Sub-dialog from the new game dialog for mucking about with weapons **/ class DialogNewGameWeapons : public Dialog, public gcn::ActionListener, public gcn::SelectionListener { public: DialogNewGameWeapons(DialogNewGame* parent, GameSettings* gs, GameType* gt); virtual ~DialogNewGameWeapons(); protected: DialogNewGame* parent; GameSettings* gs; GametypeFactionsListModel* factions_list; int faction; vector<WeaponType*> *wts; gcn::DropDown* dd_faction; gcn::CheckBox* chk_unit; gcn::CheckBox* chk_gametype; vector<gcn::CheckBox*> chk_custom; public: virtual gcn::Container * setup(); virtual void action(const gcn::ActionEvent& actionEvent); virtual void valueChanged(const gcn::SelectionEvent& selectionEvent); virtual const DialogName getName() { return WEAPONS; } private: void saveWeapons(); void loadWeapons(); unsigned int findWeaponType(WeaponType* wt); };
#ifndef _MAP_CAMERA_H #define _MAP_CAMERA_H #include <media/v4l2-common.h> #include <media/v4l2-ioctl.h> #include <media/v4l2-device.h> #include <media/v4l2-ctrls.h> #include <media/b52socisp/b52socisp-pdev.h> #define ISPSD_PAD_MAX 15 #define GID_ISP_SUBDEV 0xBEEFCAFE #define GID_SENSOR_SUBDEV 0xAEEFCAFE enum isp_gdev_type { ISP_GDEV_NONE = 0, ISP_GDEV_BLOCK, ISP_GDEV_SUBDEV, /* Means this device is a host subdev */ DEV_V4L2_SUBDEV, }; enum isp_subdev_type { ISD_TYPE_NONE = 0, ISD_TYPE_NORMAL, ISD_TYPE_DMA_OUT, ISD_TYPE_DMA_IN, ISD_TYPE_SENSOR, }; struct isp_subdev { struct v4l2_subdev subdev; struct list_head hook; struct media_pad pads[ISPSD_PAD_MAX]; __u8 pads_cnt; __u8 single; /* SINGLE/COMBINED? */ __u8 sd_type; /* NORMAL / DMA_IN / DMA_OUT */ __u8 sd_code; /* unique id code */ struct list_head gdev_list; /* guest device list */ struct list_head hdev_list; struct v4l2_mbus_framefmt fmt_pad[ISPSD_PAD_MAX]; struct v4l2_rect crop_pad[ISPSD_PAD_MAX]; struct v4l2_ctrl_handler ctrl_handler; /* point to the driver specific structure that contains this struct */ void *drv_priv; struct isp_build *build; struct isp_subdev_ops *ops; }; struct isp_subdev_ops { /* Called before register to build */ int (*add)(struct isp_subdev *ispsd); /* Called after remove from build */ void (*remove)(struct isp_subdev *ispsd); /* Called before add to pipeline */ int (*open)(struct isp_subdev *ispsd); /* Called after remove from pipeline */ void (*close)(struct isp_subdev *ispsd); }; struct isp_dev_ptr { struct list_head hook; void *ptr; enum isp_gdev_type type; }; int isp_subdev_add_guest(struct isp_subdev *ispsd, void *guest, enum isp_gdev_type type); int isp_subdev_add_host(struct isp_subdev *isd, void *host, enum isp_gdev_type type); int isp_subdev_remove_guest(struct isp_subdev *isd, void *guest); int isp_subdev_remove_host(struct isp_subdev *isd, void *host); static inline struct isp_block *isp_sd2blk(struct isp_subdev *sd) { struct isp_dev_ptr *desc; if (!sd->single) return NULL; desc = list_first_entry(&(sd->gdev_list), struct isp_dev_ptr, hook); if (desc->type != ISP_GDEV_BLOCK) return NULL; return desc->ptr; }; static inline struct isp_subdev *me_to_ispsd(struct media_entity *me) { struct v4l2_subdev *sd; if (media_entity_type(me) == MEDIA_ENT_T_V4L2_SUBDEV) sd = media_entity_to_v4l2_subdev(me); else return NULL; if (sd->grp_id == GID_ISP_SUBDEV) return v4l2_get_subdev_hostdata(sd); else return NULL; }; struct isp_subdev *isp_subdev_find(struct isp_build *build, int sd_code); int isp_subdev_register(struct isp_subdev *ispsd, struct isp_build *build); void isp_subdev_unregister(struct isp_subdev *ispsd); int isp_entity_get_fmt(struct media_entity *me, struct v4l2_subdev_format *fmt); int isp_link_try_set_fmt(struct media_link *link, struct v4l2_mbus_framefmt *fmt, __u32 which); int isp_entity_try_set_fmt(struct media_entity *me, struct v4l2_subdev_format *fmt); static inline void isp_subdev_reset_format(struct isp_subdev *ispsd) { memset(ispsd->fmt_pad, 0, ISPSD_PAD_MAX * sizeof(struct v4l2_mbus_framefmt)); } struct isp_build { struct v4l2_device v4l2_dev; struct media_device media_dev; struct device *dev; struct mutex graph_mutex; const char *name; /* MAP related */ struct list_head resrc_pool; struct list_head pipeline_pool; int pipeline_cnt; struct list_head ispsd_list; struct list_head event_pool; void *plat_priv; int (*add_vdev)(struct isp_build *build, struct isp_subdev *ispsd); void (*close_vdev)(struct isp_build *build); }; void isp_build_exit(struct isp_build *mngr); int isp_build_init(struct isp_build *mngr); int isp_build_attach_ispsd(struct isp_build *mngr); #define subdev_has_fn(sd, o, f) ((sd) && (sd->ops) && (sd->ops->o) && \ (sd->ops->o->f)) #endif
/* * Copyright 2011, Blender Foundation. * * 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. * * Contributor: * Jeroen Bakker * Monique Dewanchand */ #ifndef _COM_SetAlphaNode_h_ #define _COM_SetAlphaNode_h_ #include "COM_Node.h" /** * @brief SetAlphaNode * @ingroup Node */ class SetAlphaNode : public Node { public: SetAlphaNode(bNode *editorNode) : Node(editorNode) {} void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; }; #endif
/* * libcsync -- a library to sync a directory with another * * Copyright (c) 2008-2013 by Andreas Schneider <asn@cryptomilk.org> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef _CSYNC_EXCLUDE_H #define _CSYNC_EXCLUDE_H enum csync_exclude_type_e { CSYNC_NOT_EXCLUDED = 0, CSYNC_FILE_SILENTLY_EXCLUDED, CSYNC_FILE_EXCLUDE_AND_REMOVE, CSYNC_FILE_EXCLUDE_LIST, CSYNC_FILE_EXCLUDE_INVALID_CHAR }; typedef enum csync_exclude_type_e CSYNC_EXCLUDE_TYPE; /** * @brief Load exclude list * * @param ctx The context of the synchronizer. * @param fname The filename to load. * * @return 0 on success, -1 if an error occured with errno set. */ int csync_exclude_load(CSYNC *ctx, const char *fname); /** * @brief Clear the exclude list in memory. * * @param ctx The synchronizer context. */ void csync_exclude_clear(CSYNC *ctx); /** * @brief Destroy the exclude list in memory. * * @param ctx The synchronizer context. */ void csync_exclude_destroy(CSYNC *ctx); /** * @brief Check if the given path should be excluded. * * This excludes also paths which can't be used without unix extensions. * * @param ctx The synchronizer context. * @param path The patch to check. * * @return 2 if excluded and needs cleanup, 1 if excluded, 0 if not. */ CSYNC_EXCLUDE_TYPE csync_excluded(CSYNC *ctx, const char *path, int filetype); #endif /* _CSYNC_EXCLUDE_H */ /* vim: set ft=c.doxygen ts=8 sw=2 et cindent: */
/* * Michael MIC implementation - optimized for TKIP MIC operations * Copyright 2002-2003, Instant802 Networks, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #include <linux/types.h> #include "ieee80211_i.h" #include "michael.h" static inline u32 rotr(u32 val, int bits) { return (val >> bits) | (val << (32 - bits)); } static inline u32 rotl(u32 val, int bits) { return (val << bits) | (val >> (32 - bits)); } static inline u32 xswap(u32 val) { return ((val & 0xff00ff00) >> 8) | ((val & 0x00ff00ff) << 8); } #define michael_block(l, r) \ do { \ r ^= rotl(l, 17); \ l += r; \ r ^= xswap(l); \ l += r; \ r ^= rotl(l, 3); \ l += r; \ r ^= rotr(l, 2); \ l += r; \ } while (0) static inline u32 michael_get32(const u8 *data) { return data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24); } static inline void michael_put32(u32 val, u8 *data) { data[0] = val & 0xff; data[1] = (val >> 8) & 0xff; data[2] = (val >> 16) & 0xff; data[3] = (val >> 24) & 0xff; } void michael_mic(const u8 *key, struct ieee80211_hdr *hdr, const u8 *data, size_t data_len, u8 *mic) { u32 l, r, val; size_t block, blocks, left; u8 *da, *sa, tid; da = ieee80211_get_DA(hdr); sa = ieee80211_get_SA(hdr); if (ieee80211_is_data_qos(hdr->frame_control)) tid = *ieee80211_get_qos_ctl(hdr) & IEEE80211_QOS_CTL_TID_MASK; else tid = 0; l = michael_get32(key); r = michael_get32(key + 4); /* A pseudo header (DA, SA, Priority, 0, 0, 0) is used in Michael MIC * calculation, but it is _not_ transmitted */ l ^= michael_get32(da); michael_block(l, r); l ^= da[4] | (da[5] << 8) | (sa[0] << 16) | (sa[1] << 24); michael_block(l, r); l ^= michael_get32(&sa[2]); michael_block(l, r); l ^= tid; michael_block(l, r); /* Real data */ blocks = data_len / 4; left = data_len % 4; for (block = 0; block < blocks; block++) { l ^= michael_get32(&data[block * 4]); michael_block(l, r); } /* Partial block of 0..3 bytes and padding: 0x5a + 4..7 zeros to make * total length a multiple of 4. */ val = 0x5a; while (left > 0) { val <<= 8; left--; val |= data[blocks * 4 + left]; } l ^= val; michael_block(l, r); /* last block is zero, so l ^ 0 = l */ michael_block(l, r); michael_put32(l, mic); michael_put32(r, mic + 4); }
/* ScummVM - Graphic Adventure Engine * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT * file distributed with this source distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef GRAPHICS_FONTS_BDF_H #define GRAPHICS_FONTS_BDF_H #include "common/system.h" #include "common/types.h" #include "graphics/font.h" namespace Common { class SeekableReadStream; } namespace Graphics { struct BdfBoundingBox { uint8 width, height; int8 xOffset, yOffset; }; struct BdfFontData { int maxAdvance; int height; BdfBoundingBox defaultBox; int ascent; int firstCharacter; int defaultCharacter; int numCharacters; const byte *const *bitmaps; const byte *advances; const BdfBoundingBox *boxes; }; class BdfFont : public Font { public: BdfFont(const BdfFontData &data, DisposeAfterUse::Flag dispose); ~BdfFont(); virtual int getFontHeight() const; virtual int getMaxCharWidth() const; virtual int getCharWidth(byte chr) const; virtual void drawChar(Surface *dst, byte chr, int x, int y, uint32 color) const; static BdfFont *loadFont(Common::SeekableReadStream &stream); static bool cacheFontData(const BdfFont &font, const Common::String &filename); static BdfFont *loadFromCache(Common::SeekableReadStream &stream); private: int mapToIndex(byte ch) const; const BdfFontData _data; const DisposeAfterUse::Flag _dispose; }; #define DEFINE_FONT(n) \ const BdfFont *n = 0; \ void create_##n() { \ n = new BdfFont(desc, DisposeAfterUse::YES); \ } #define FORWARD_DECLARE_FONT(n) \ extern const BdfFont *n; \ extern void create_##n() #define INIT_FONT(n) \ create_##n() } // End of namespace Graphics #endif
/* common.h * * Copyright (c) 1998-2002 Mike Oliphant <oliphant@gtk.org> * * http://www.nostatic.org/grip * * 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 GRIP_COMMON_H #define GRIP_COMMON_H #include <gnome.h> /* Routines from main.c */ void Debug(char *fmt,...); /* Routines from uihelper.c */ GtkTooltips *MakeToolTip(void); GdkColor *MakeColor(int red,int green,int blue); GtkStyle *MakeStyle(GdkColor *fg,GdkColor *bg,gboolean do_grade); GtkWidget *BuildMenuItemXpm(GtkWidget *xpm, gchar *text); GtkWidget *BuildMenuItem(gchar *impath, gchar *text, gboolean stock); GtkWidget *NewBlankPixmap(GtkWidget *widget); GtkWidget *ImageButton(GtkWidget *widget,GtkWidget *image); GtkWidget *Loadxpm(GtkWidget *widget,char **xpm); void CopyPixmap(GtkPixmap *src,GtkPixmap *dest); gint SizeInDubs(GdkFont *font,gint numchars); void UpdateGTK(void); #endif /* GRIP_COMMON_H */
#ifndef MRIM_PACKAGE_H #define MRIM_PACKAGE_H #include "mrim.h" /* manual: http://www.unixwiz.net/techtips/gnu-c-attributes.html */ #ifndef __GNUC__ # define __attribute__(x) /*NOTHING*/ #endif typedef struct { mrim_packet_header_t *header; gchar *data; gsize cur; gsize data_size; } MrimPackage; MrimPackage *mrim_package_new(guint32 seq, guint32 type); void mrim_package_free(MrimPackage *pack); gboolean mrim_package_send(MrimPackage *pack, MrimData *mrim); MrimPackage *mrim_package_read(MrimData *mrim); gboolean mrim_package_read_raw(MrimPackage *pack, gpointer buffer, gsize size); guint32 mrim_package_read_UL(MrimPackage *pack); gchar *mrim_package_read_LPSA(MrimPackage *pack); gchar *mrim_package_read_LPSW(MrimPackage *pack); gchar *mrim_package_read_UIDL(MrimPackage *pack); gchar *mrim_package_read_LPS(MrimPackage *pack); void mrim_package_add_raw(MrimPackage *pack, gchar *data, gsize data_size); void mrim_package_add_UL(MrimPackage *pack, guint32 value); void mrim_package_add_LPSA(MrimPackage *pack, gchar *string); void mrim_package_add_LPSW(MrimPackage *pack, gchar *string); void mrim_package_add_UIDL(MrimPackage *pack, gchar *uidl); void mrim_package_add_base64(MrimPackage *pack, gchar *fmt, ...) __attribute__((format(printf,2,3))); #endif
/* * Copyright (c) 2002, 2017 Jens Keiner, Stefan Kunis, Daniel Potts * * 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. */ /* NFFT mex internal header file */ #ifndef MEXUTIL_H #define MEXUTIL_H #include <math.h> #ifdef HAVE_MATLAB_GCC_REQUIRE_UNDEF_STDC_UTF_16 #undef __STDC_UTF_16__ #endif #include <mex.h> #ifndef HAVE_OCTAVE #include <matrix.h> #endif #ifdef HAVE_MATLAB_GCC_REQUIRE_UNDEF_STDC_UTF_16 #define __STDC_UTF_16__ #endif #ifndef INT_MAX #define INT_MAX 2147483647 /* from limits.h */ #endif /*----------------------------------------------------------------------------*/ /* Replacements for nfft_malloc and nfft_free plus install routine */ extern void *nfft_mex_malloc(size_t n); extern void nfft_mex_free(void *p); extern void nfft_mex_install_mem_hooks(void); int nfft_mex_get_int(const mxArray *p, const char *errmsg); double nfft_mex_get_double(const mxArray *p, const char *errmsg); void nfft_mex_get_nm(const mxArray *prhs[], int *n, int *m); void nfft_mex_get_n1n2m(const mxArray *prhs[], int *n1, int *n2, int *m); void nfft_mex_get_n1n2n3m(const mxArray *prhs[], int *n1, int *n2, int *n3, int *m); void nfft_mex_check_nargs(const int nrhs, const int n, const char* errmsg); int nfft_mex_set_num_threads_check(const int nrhs, const mxArray *prhs[], void **plans, const int plans_num_allocated); #ifdef MATLAB_ARGCHECKS #define DM(Y) Y #else #define DM(Y) #endif /*----------------------------------------------------------------------------*/ /* Checks if argument is a scalar. */ #define ARG_CHECK_SCALAR(x,y) \ if (mxGetM(prhs[x]) != 1 || mxGetN(prhs[x]) != 1 || mxIsDouble(prhs[x]) != 1) \ mexErrMsgTxt(#y " argument must be a scalar."); /* Gets and stores pointer to argument data. */ #define ARG_GET_PTR(x,y) \ y = mxGetPr(prhs[x]); /* Checks and get argument as nonnegative integer. */ #define ARG_GET_NONNEG_INT(x,y,z) \ ARG_CHECK_SCALAR(x,y) \ ARG_GET_PTR(x,z) \ if (z[0] != round(z[0]) || z[0] < 0) \ mexErrMsgTxt(#y " argument must be a nonnegative integer."); /* Checks and get argument as positive integer. */ #define ARG_GET_POS_INT(x,y,z) \ ARG_CHECK_SCALAR(x,y) \ ARG_GET_PTR(x,z) \ if (z[0] != round(z[0]) || z[0] < 1) \ mexErrMsgTxt(#y " argument must be a nonnegative integer."); /* Checks and get argument as nonnegative double. */ #define ARG_GET_NONNEG_DOUBLE(x,y,z) \ ARG_CHECK_SCALAR(x,y) \ ARG_GET_PTR(x,z) \ if (z[0] < 0) \ mexErrMsgTxt(#y " argument must be a nonnegative number."); #endif
/* * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* **************************************************************************** * (C) 2003 - Rolf Neugebauer - Intel Research Cambridge **************************************************************************** * * File: string.c * Author: Rolf Neugebauer (neugebar@dcs.gla.ac.uk) * Changes: * * Date: Aug 2003 * * Environment: Guest VM microkernel evolved from Xen Minimal OS * Description: Library function for string and memory manipulation * Origin unknown * */ #if !defined HAVE_LIBC #include <guk/os.h> #include <guk/xmalloc.h> #include <lib.h> #include <types.h> int memcmp(const void * cs,const void * ct,size_t count) { const unsigned char *su1, *su2; signed char res = 0; for( su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--) if ((res = *su1 - *su2) != 0) break; return res; } void * memcpy(void * dest,const void *src,size_t count) { char *tmp = (char *) dest; const char *s = src; while (count--) *tmp++ = *s++; return dest; } int strncmp(const char * cs,const char * ct,size_t count) { register signed char __res = 0; while (count) { if ((__res = *cs - *ct++) != 0 || !*cs++) break; count--; } return __res; } int strcmp(const char * cs,const char * ct) { register signed char __res; while (1) { if ((__res = *cs - *ct++) != 0 || !*cs++) break; } return __res; } char * strcpy(char * dest,const char *src) { char *tmp = dest; while ((*dest++ = *src++) != '\0') /* nothing */; return tmp; } char * strncpy(char * dest,const char *src,size_t count) { char *tmp = dest; while (count-- && (*dest++ = *src++) != '\0') /* nothing */; return tmp; } void * memset(void * s,int c,size_t count) { char *xs = (char *) s; while (count--) *xs++ = c; return s; } size_t strnlen(const char * s, size_t count) { const char *sc; for (sc = s; count-- && *sc != '\0'; ++sc) /* nothing */; return sc - s; } char * strcat(char * dest, const char * src) { char *tmp = dest; while (*dest) dest++; while ((*dest++ = *src++) != '\0'); return tmp; } size_t strlen(const char * s) { const char *sc; for (sc = s; *sc != '\0'; ++sc) /* nothing */; return sc - s; } char * strchr(const char * s, int c) { for(; *s != (char) c; ++s) if (*s == '\0') return NULL; return (char *)s; } char * strstr(const char * s1,const char * s2) { int l1, l2; l2 = strlen(s2); if (!l2) return (char *) s1; l1 = strlen(s1); while (l1 >= l2) { l1--; if (!memcmp(s1,s2,l2)) return (char *) s1; s1++; } return NULL; } char *strdup(const char *x) { int l = strlen(x); char *res = malloc(l + 1); if (!res) return NULL; memcpy(res, x, l + 1); return res; } #endif
/* * Copyright (C) 2015 Jakub Kruszona-Zawadzki, Core Technology Sp. z o.o. * * This file is part of MooseFS. * * MooseFS 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 (only). * * MooseFS 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 MooseFS; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * or visit http://www.gnu.org/licenses/gpl-2.0.html */ #ifdef HAVE_CONFIG_H #include "config.h" #else # if defined(__APPLE__) # define HAVE_MACH_MACH_H 1 # define HAVE_MACH_MACH_TIME_H 1 # define HAVE_MACH_ABSOLUTE_TIME 1 # define HAVE_MACH_TIMEBASE_INFO 1 # endif # if defined(__linux__) || defined(__FreeBSD__) # define HAVE_CLOCK_GETTIME 1 # endif # if defined(__posix__) # define HAVE_SYS_TIME_H 1 # define HAVE_GETTIMEOFDAY 1 # endif #endif #include <time.h> #if defined(HAVE_SYS_TIME_H) # include <sys/time.h> #endif #if defined(HAVE_MACH_MACH_H) && defined(HAVE_MACH_MACH_TIME_H) # include <mach/mach.h> # include <mach/mach_time.h> #endif #include <inttypes.h> #if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC) double monotonic_seconds() { struct timespec ts; clock_gettime(CLOCK_MONOTONIC,&ts); return ts.tv_sec + (ts.tv_nsec * 0.000000001); } uint64_t monotonic_nseconds() { struct timespec ts; clock_gettime(CLOCK_MONOTONIC,&ts); return (uint64_t)(ts.tv_sec)*UINT64_C(1000000000)+(uint64_t)(ts.tv_nsec); } uint64_t monotonic_useconds() { return monotonic_nseconds()/1000; } const char* monotonic_method() { return "clock_gettime"; } uint32_t monotonic_speed(void) { uint32_t i; uint64_t st,en; i = 0; st = monotonic_nseconds() + 10000000; do { en = monotonic_nseconds(); i++; } while (en < st); return i; } #elif defined(HAVE_MACH_ABSOLUTE_TIME) && defined(HAVE_MACH_TIMEBASE_INFO) double monotonic_seconds() { uint64_t c; static double coef = 0.0; c = mach_absolute_time(); if (coef==0.0) { mach_timebase_info_data_t sti; mach_timebase_info(&sti); coef = (double)(sti.numer); coef /= (double)(sti.denom); coef /= 1000000000.0; } return c * coef; } uint64_t monotonic_nseconds() { uint64_t c; static uint8_t i = 0; static mach_timebase_info_data_t sti; c = mach_absolute_time(); if (i==0) { mach_timebase_info(&sti); i = 1; } return c * sti.numer / sti.denom; } uint64_t monotonic_useconds() { return monotonic_nseconds()/1000; } const char* monotonic_method() { (void)monotonic_seconds(); // init static variables (void)monotonic_nseconds(); // init static variables return "mach_absolute_time"; } uint32_t monotonic_speed(void) { uint32_t i; uint64_t st,en; i = 0; st = monotonic_nseconds() + 10000000; do { en = monotonic_nseconds(); i++; } while (en < st); return i; } #elif defined(HAVE_GETTIMEOFDAY) double monotonic_seconds() { struct timeval tv; gettimeofday(&tv,NULL); return tv.tv_sec + (tv.tv_usec * 0.000001); } uint64_t monotonic_useconds() { struct timeval tv; gettimeofday(&tv,NULL); return (uint64_t)(tv.tv_sec)*UINT64_C(1000000)+(uint64_t)(tv.tv_usec); } uint64_t monotonic_nseconds() { return monotonic_useconds()*1000; } const char* monotonic_method() { return "gettimeofday"; } uint32_t monotonic_speed(void) { uint32_t i; uint64_t st,en; i = 0; st = monotonic_useconds() + 10000; do { en = monotonic_useconds(); i++; } while (en < st); return i; } #else double monotonic_seconds() { return time(NULL); } uint64_t monotonic_useconds() { return UINT64_C(1000000)*time(NULL); } uint64_t monotonic_nseconds() { return UINT64_C(1000000000)*time(NULL); } const char* monotonic_method() { return "time"; } uint32_t monotonic_speed(void) { uint32_t i; uint64_t st,en; i = 0; st = monotonic_useconds(); do { en = monotonic_nseconds(); } while (en==st); st = monotonic_useconds() + 1000000; do { en = monotonic_useconds(); i++; } while (en < st); return i / 100; } #endif #if 0 #include <unistd.h> #include <stdio.h> int main(void) { double st,en; uint64_t stusec,enusec; uint64_t stnsec,ennsec; printf("used method: %s\n",monotonic_method()); st = monotonic_seconds(); stusec = monotonic_useconds(); stnsec = monotonic_nseconds(); sleep(1); en = monotonic_seconds(); enusec = monotonic_useconds(); ennsec = monotonic_nseconds(); printf("%.6lf ; %"PRIu64" ; %"PRIu64"\n",en-st,enusec-stusec,ennsec-stnsec); } #endif
#ifndef FASTREAD_QI_EURODOUBLE #define FASTREAD_QI_EURODOUBLE #include <boost/spirit/include/qi.hpp> #include <boost/spirit/include/phoenix_core.hpp> #include <boost/spirit/include/phoenix_operator.hpp> struct DoubleEuroPolicy : public boost::spirit::qi::real_policies<double> { template <typename Iterator> static bool parse_dot(Iterator& first, Iterator const& last) { if (first == last || *first != ',') return false; ++first; return true; } }; #endif
//===- PathTest.h ---------------------------------------------------------===// // // The MCLinker Project // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef PATH_TEST_H #define PATH_TEST_H #include "mcld/Support/Path.h" #include <gtest.h> namespace mcldtest { /** \class PathTest * \brief a testcase for mcld::Path and its non-member funtions. * * \see Path */ class PathTest : public ::testing::Test { public: // Constructor can do set-up work for all test here. PathTest(); // Destructor can do clean-up work that doesn't throw exceptions here. virtual ~PathTest(); // SetUp() will be called immediately before each test. virtual void SetUp(); // TearDown() will be called immediately after each test. virtual void TearDown(); protected: mcld::sys::fs::Path* m_pTestee; }; } // namespace of mcldtest #endif
/* * @file S2.h * @author Simon Brummer * @desc Tutorium 6. Deklaration von State S2. */ #ifndef S2_H_ #define S2_H_ #include "State.cpp" #include "Context.cpp" class S2: public State{ public: S2(Context* con); virtual ~S2(); virtual void Transition1(void); virtual void Transition2(void); private: S2(const S2& other); S2& operator=(const S2& other); }; #endif /* S2_H_ */
/* PCV.c */ #include "../Utilities.h" /*--------------------------------------------------------------------*/ /* -------------------------------------------- purpose -- to free a pointer to char vector must have been created by PCVinit created -- 95sep22, cca -------------------------------------------- */ void PCVfree ( char **p_cvec ) { if ( p_cvec != NULL ) { FREE(p_cvec) ; } return ; } /*--------------------------------------------------------------------*/ /* --------------------------------------------- purpose -- to allocate and initialize to NULL a vector of pointer to char created -- 95sep22, cca --------------------------------------------- */ char ** PCVinit ( int size ) { char **p_cvec = NULL ; if ( size > 0 ) { int i ; ALLOCATE(p_cvec, char *, size) ; for ( i = 0 ; i < size ; i++ ) { p_cvec[i] = NULL ; } } return(p_cvec) ; } /*--------------------------------------------------------------------*/ /* ------------------------------------- purpose -- to set up a pointer vector created -- 95sep22, cca ------------------------------------- */ void PCVsetup ( int length, int sizes[], char cvec[], char *p_cvec[] ) { if ( length > 0 ) { if ( sizes == NULL || cvec == NULL || p_cvec == NULL ) { fprintf(stderr, "\n fatal error in PCVsetup, invalid data" "\n length = %d, sizes = %p, cvec = %p, p_cvec = %p\n", length, sizes, cvec, p_cvec) ; exit(-1) ; } else { int j ; for ( j = 0 ; j < length ; j++ ) { if ( sizes[j] > 0 ) { p_cvec[j] = cvec ; cvec += sizes[j] ; } else { p_cvec[j] = NULL ; } } } } return ; } /*--------------------------------------------------------------------*/ /* ----------------------------------- purpose -- to copy a pointer vector created -- 95sep22, cca ----------------------------------- */ void PCVcopy ( int length, char *p_cvec1[], char *p_cvec2[] ) { if ( length > 0 ) { if ( p_cvec1 == NULL || p_cvec2 == NULL ) { fprintf(stdout, "\n fatal error in PCVcopy, invalid data" "\n length = %d, p_cvec1 = %p, p_cvec2 = %p\n", length, p_cvec1, p_cvec2) ; exit(-1) ; } else { int j ; for ( j = 0 ; j < length ; j++ ) { p_cvec1[j] = p_cvec2[j] ; } } } return ; } /*--------------------------------------------------------------------*/
/* * This file is part of the UCB release of Plan 9. It is subject to the license * terms in the LICENSE file found in the top-level directory of this * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No * part of the UCB release of Plan 9, including this file, may be copied, * modified, propagated, or distributed except according to the terms contained * in the LICENSE file. */ #include "e.h" /* YOU MAY WANT TO CHANGE THIS */ char *typesetter = "post"; /* type of typesetter today */ int ttype = DEVPOST; int minsize = 4; /* min size it can handle */ int dbg; /* debugging print if non-zero */ int lp[200]; /* stack for things like piles and matrices */ int ct; /* pointer to lp */ int used[100]; /* available registers */ int ps; /* default init point size */ int deltaps = 3; /* default change in ps */ int dps_set = 0; /* 1 => -p option used */ int gsize = 10; /* default initial point size */ int ft = '2'; Font ftstack[10] = { '2', "2" }; /* bottom is global font */ Font *ftp = ftstack; int szstack[10]; /* non-zero if absolute size set at this level */ int nszstack = 0; int display = 0; /* 1=>display, 0=>.EQ/.EN */ int synerr; /* 1 if syntax err in this eqn */ double eht[100]; /* height in ems at gsize */ double ebase[100]; /* base: where one enters above bottom */ int lfont[100]; /* leftmost and rightmost font associated with this thing */ int rfont[100]; int lclass[100]; /* leftmost and rightmost class associated with this thing */ int rclass[100]; int eqnreg; /* register where final string appears */ double eqnht; /* final height of equation */ int lefteq = '\0'; /* left in-line delimiter */ int righteq = '\0'; /* right in-line delimiter */ int markline = 0; /* 1 if this EQ/EN contains mark; 2 if lineup */
/* * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009 * The President and Fellows of Harvard College. * * 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 UNIVERSITY 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 UNIVERSITY 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 <types.h> #include <lib.h> #include <bitmap.h> #include <test.h> #define TESTSIZE 533 int bitmaptest(int nargs, char **args) { struct bitmap *b; char data[TESTSIZE]; uint32_t x; int i; (void)nargs; (void)args; kprintf("Starting bitmap test...\n"); for (i=0; i<TESTSIZE; i++) { data[i] = random()%2; } b = bitmap_create(TESTSIZE); KASSERT(b != NULL); for (i=0; i<TESTSIZE; i++) { KASSERT(bitmap_isset(b, i)==0); } for (i=0; i<TESTSIZE; i++) { if (data[i]) { bitmap_mark(b, i); } } for (i=0; i<TESTSIZE; i++) { if (data[i]) { KASSERT(bitmap_isset(b, i)); } else { KASSERT(bitmap_isset(b, i)==0); } } for (i=0; i<TESTSIZE; i++) { if (data[i]) { bitmap_unmark(b, i); } else { bitmap_mark(b, i); } } for (i=0; i<TESTSIZE; i++) { if (data[i]) { KASSERT(bitmap_isset(b, i)==0); } else { KASSERT(bitmap_isset(b, i)); } } while (bitmap_alloc(b, &x)==0) { KASSERT(x < TESTSIZE); KASSERT(bitmap_isset(b, x)); KASSERT(data[x]==1); data[x] = 0; } for (i=0; i<TESTSIZE; i++) { KASSERT(bitmap_isset(b, i)); KASSERT(data[i]==0); } kprintf("Bitmap test complete\n"); return 0; }
/* * linux/sound/oss/waveartist.h * * def file for Rockwell RWA010 chip set, as installed in Rebel.com NetWinder */ //registers #define CMDR 0 #define DATR 2 #define CTLR 4 #define STATR 5 #define IRQSTAT 12 //bit defs //reg STATR #define CMD_WE 0x80 #define CMD_RF 0x40 #define DAT_WE 0x20 #define DAT_RF 0x10 #define IRQ_REQ 0x08 #define DMA1 0x04 #define DMA0 0x02 //bit defs //reg CTLR #define CMD_WEIE 0x80 #define CMD_RFIE 0x40 #define DAT_WEIE 0x20 #define DAT_RFIE 0x10 #define RESET 0x08 #define DMA1_IE 0x04 #define DMA0_IE 0x02 #define IRQ_ACK 0x01 //commands #define WACMD_SYSTEMID 0x00 #define WACMD_GETREV 0x00 #define WACMD_INPUTFORMAT 0x10 //0-8S, 1-16S, 2-8U #define WACMD_INPUTCHANNELS 0x11 //1-Mono, 2-Stereo #define WACMD_INPUTSPEED 0x12 //sampling rate #define WACMD_INPUTDMA 0x13 //0-8bit, 1-16bit, 2-PIO #define WACMD_INPUTSIZE 0x14 //samples to interrupt #define WACMD_INPUTSTART 0x15 //start ADC #define WACMD_INPUTPAUSE 0x16 //pause ADC #define WACMD_INPUTSTOP 0x17 //stop ADC #define WACMD_INPUTRESUME 0x18 //resume ADC #define WACMD_INPUTPIO 0x19 //PIO ADC #define WACMD_OUTPUTFORMAT 0x20 //0-8S, 1-16S, 2-8U #define WACMD_OUTPUTCHANNELS 0x21 //1-Mono, 2-Stereo #define WACMD_OUTPUTSPEED 0x22 //sampling rate #define WACMD_OUTPUTDMA 0x23 //0-8bit, 1-16bit, 2-PIO #define WACMD_OUTPUTSIZE 0x24 //samples to interrupt #define WACMD_OUTPUTSTART 0x25 //start ADC #define WACMD_OUTPUTPAUSE 0x26 //pause ADC #define WACMD_OUTPUTSTOP 0x27 //stop ADC #define WACMD_OUTPUTRESUME 0x28 //resume ADC #define WACMD_OUTPUTPIO 0x29 //PIO ADC #define WACMD_GET_LEVEL 0x30 #define WACMD_SET_LEVEL 0x31 #define WACMD_SET_MIXER 0x32 #define WACMD_RST_MIXER 0x33 #define WACMD_SET_MONO 0x34 /* * Definitions for left/right recording input mux */ #define ADC_MUX_NONE 0 #define ADC_MUX_MIXER 1 #define ADC_MUX_LINE 2 #define ADC_MUX_AUX2 3 #define ADC_MUX_AUX1 4 #define ADC_MUX_MIC 5 /* * Definitions for mixer gain settings */ #define MIX_GAIN_LINE 0 /* line in */ #define MIX_GAIN_AUX1 1 /* aux1 */ #define MIX_GAIN_AUX2 2 /* aux2 */ #define MIX_GAIN_XMIC 3 /* crossover mic */ #define MIX_GAIN_MIC 4 /* normal mic */ #define MIX_GAIN_PREMIC 5 /* preamp mic */ #define MIX_GAIN_OUT 6 /* output */ #define MIX_GAIN_MONO 7 /* mono in */ int wa_sendcmd(unsigned int cmd); int wa_writecmd(unsigned int cmd, unsigned int arg);
/*MT* MediaTomb - http://www.mediatomb.cc/ io_handler_buffer_helper.h - this file is part of MediaTomb. Copyright (C) 2005 Gena Batyan <bgeradz@mediatomb.cc>, Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc> Copyright (C) 2006-2010 Gena Batyan <bgeradz@mediatomb.cc>, Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>, Leonhard Wimmer <leo@mediatomb.cc> MediaTomb is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. MediaTomb is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License version 2 along with MediaTomb; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. $Id$ */ /// \file io_handler_buffer_helper.h #ifndef __IO_HANDLER_BUFFER_HELPER_H__ #define __IO_HANDLER_BUFFER_HELPER_H__ #include <condition_variable> #include <mutex> #include <pthread.h> #include <upnp.h> #include "common.h" #include "io_handler.h" /// \brief a IOHandler with buffer support /// the buffer is only for read(). write() is not supported /// the public functions of this class are *not* thread safe! class IOHandlerBufferHelper : public IOHandler { public: /// \brief get an instance of a IOHandlerBufferHelper /// \param bufSize the size of the buffer in bytes /// \param maxChunkSize the maximum size of the chunks which are read by the buffer /// \param initialFillSize the number of bytes which have to be in the buffer /// before the first read at the very beginning or after a seek returns; /// 0 disables the delay IOHandlerBufferHelper(size_t bufSize, size_t initialFillSize); ~IOHandlerBufferHelper() noexcept override; // inherited from IOHandler void open(enum UpnpOpenFileMode mode) override; size_t read(char* buf, size_t length) override; void seek(off_t offset, int whence) override; void close() override; protected: size_t bufSize; size_t initialFillSize; char* buffer; bool isOpen; bool eof; bool readError; bool waitForInitialFillSize; bool signalAfterEveryRead; bool checkSocket; // buffer stuff.. bool empty; size_t a; size_t b; off_t posRead; // seek stuff... bool seekEnabled; bool doSeek; off_t seekOffset; int seekWhence; // thread stuff.. void startBufferThread(); void stopBufferThread(); static void* staticThreadProc(void* arg); virtual void threadProc() = 0; pthread_t bufferThread; bool threadShutdown; std::condition_variable cond; std::mutex mutex; }; #endif // __IO_HANDLER_BUFFER_HELPER_H__
/* This file is part of the KDE project * Copyright (c) 2009 Jan Hambrecht <jaham@gmx.net> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef FILTEREFFECTSCENE_H #define FILTEREFFECTSCENE_H #include <QtGui/QGraphicsScene> #include <QtCore/QString> #include <QtCore/QSet> #include <QtCore/QMap> class KoShape; class KoFilterEffect; class KoFilterEffectStack; class QGraphicsItem; class EffectItemBase; class EffectItem; class DefaultInputItem; class ConnectionItem; class KComboBox; class ConnectionSource { public: enum SourceType { Effect, ///< a complete effect item SourceGraphic, ///< SourceGraphic predefined input image SourceAlpha, ///< SourceAlpha predefined input image BackgroundImage, ///< BackgroundImage predefined input image BackgroundAlpha, ///< BackgroundAlpha predefined input image FillPaint, ///< FillPaint predefined input image StrokePaint ///< StrokePaint predefined input image }; ConnectionSource(); ConnectionSource(KoFilterEffect *effect, SourceType type); /// Returns the source type SourceType type() const; /// Returns the corresponding filter effect, or 0 if type == Effect KoFilterEffect * effect() const; static SourceType typeFromString(const QString &str); static QString typeToString(SourceType type); private: SourceType m_type; ///< the source type KoFilterEffect * m_effect; ///< the corresponding effect if type == Effect, 0 otherwise }; class ConnectionTarget { public: ConnectionTarget(); ConnectionTarget(KoFilterEffect *effect, int inputIndex); /// Returns the target input index int inputIndex() const; /// Returns the corresponding filter effect KoFilterEffect * effect() const; private: int m_inputIndex; ///< the index of the input of the target effect KoFilterEffect * m_effect; ///< the target effect }; class FilterEffectScene : public QGraphicsScene { Q_OBJECT public: FilterEffectScene(QObject *parent = 0); virtual ~FilterEffectScene(); /// initializes the scene from the filter effect stack void initialize(KoFilterEffectStack *effectStack); /// Returns list of selected effect items QList<ConnectionSource> selectedEffectItems() const; signals: void connectionCreated(ConnectionSource source, ConnectionTarget target); protected: /// reimplemented from QGraphicsScene virtual void dropEvent(QGraphicsSceneDragDropEvent * event); private slots: void selectionChanged(); private: void createEffectItems(KoFilterEffect *effect); void addSceneItem(QGraphicsItem *item); void layoutConnections(); void layoutEffects(); QList<QString> m_defaultInputs; KoFilterEffectStack * m_effectStack; QList<EffectItemBase*> m_items; QList<ConnectionItem*> m_connectionItems; QMap<QString, EffectItemBase*> m_outputs; QGraphicsProxyWidget *m_defaultInputProxy; }; #endif // FILTEREFFECTSCENE_H
#ifndef EIGEN_WARNINGS_DISABLED #define EIGEN_WARNINGS_DISABLED #ifdef _MSC_VER // 4100 - unreferenced formal parameter (occurred e.g. in aligned_allocator::destroy(pointer p)) // 4101 - unreferenced local variable // 4127 - conditional expression is constant // 4181 - qualifier applied to reference type ignored // 4211 - nonstandard extension used : redefined extern to static // 4244 - 'argument' : conversion from 'type1' to 'type2', possible loss of data // 4273 - QtAlignedMalloc, inconsistent DLL linkage // 4324 - structure was padded due to declspec(align()) // 4512 - assignment operator could not be generated // 4522 - 'class' : multiple assignment operators specified // 4700 - uninitialized local variable 'xyz' used // 4717 - 'function' : recursive on all control paths, function will cause runtime stack overflow #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS #pragma warning( push ) #endif #pragma warning( disable : 4100 4101 4127 4181 4211 4244 4273 4324 4512 4522 4700 4717 ) #elif defined __INTEL_COMPILER // 2196 - routine is both "inline" and "noinline" ("noinline" assumed) // ICC 12 generates this warning even without any inline keyword, when defining class methods 'inline' i.e. inside of class body // typedef that may be a reference type. // 279 - controlling expression is constant // ICC 12 generates this warning on assert(constant_expression_depending_on_template_params) and frankly this is a legitimate use case. #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS #pragma warning push #endif #pragma warning disable 2196 279 #elif defined __clang__ // -Wconstant-logical-operand - warning: use of logical && with constant operand; switch to bitwise & or remove constant // this is really a stupid warning as it warns on compile-time expressions involving enums #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS #pragma clang diagnostic push #endif #pragma clang diagnostic ignored "-Wconstant-logical-operand" #elif defined __GNUC__ && __GNUC__>=6 #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS #pragma GCC diagnostic push #endif #pragma GCC diagnostic ignored "-Wignored-attributes" #endif #endif // not EIGEN_WARNINGS_DISABLED
/* Definitions of target machine for GNU compiler, for PowerPC machines running Linux. Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Contributed by Michael Meissner (meissner@cygnus.com). This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #undef MD_EXEC_PREFIX #undef MD_STARTFILE_PREFIX /* Linux doesn't support saving and restoring 64-bit regs in a 32-bit process. */ #define OS_MISSING_POWERPC64 1 /* glibc has float and long double forms of math functions. */ #undef TARGET_C99_FUNCTIONS #define TARGET_C99_FUNCTIONS 1 #undef TARGET_OS_CPP_BUILTINS #define TARGET_OS_CPP_BUILTINS() \ do \ { \ builtin_define_std ("PPC"); \ builtin_define_std ("powerpc"); \ builtin_assert ("cpu=powerpc"); \ builtin_assert ("machine=powerpc"); \ TARGET_OS_SYSV_CPP_BUILTINS (); \ } \ while (0) #undef CPP_OS_DEFAULT_SPEC #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)" /* The GNU C++ standard library currently requires _GNU_SOURCE being defined on glibc-based systems. This temporary hack accomplishes this, it should go away as soon as libstdc++-v3 has a real fix. */ #undef CPLUSPLUS_CPP_SPEC #define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)" #undef LINK_SHLIB_SPEC #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}" #undef LIB_DEFAULT_SPEC #define LIB_DEFAULT_SPEC "%(lib_linux)" #undef STARTFILE_DEFAULT_SPEC #define STARTFILE_DEFAULT_SPEC "%(startfile_linux)" #undef ENDFILE_DEFAULT_SPEC #define ENDFILE_DEFAULT_SPEC "%(endfile_linux)" #undef LINK_START_DEFAULT_SPEC #define LINK_START_DEFAULT_SPEC "%(link_start_linux)" #undef LINK_OS_DEFAULT_SPEC #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)" #define LINK_GCC_C_SEQUENCE_SPEC \ "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}" /* Use --as-needed -lgcc_s for eh support. */ #ifdef HAVE_LD_AS_NEEDED #define USE_LD_AS_NEEDED 1 #endif #undef TARGET_VERSION #define TARGET_VERSION fprintf (stderr, " (PowerPC GNU/Linux)"); /* Override rs6000.h definition. */ #undef ASM_APP_ON #define ASM_APP_ON "#APP\n" /* Override rs6000.h definition. */ #undef ASM_APP_OFF #define ASM_APP_OFF "#NO_APP\n" /* For backward compatibility, we must continue to use the AIX structure return convention. */ #undef DRAFT_V4_STRUCT_RET #define DRAFT_V4_STRUCT_RET 1 /* We are 32-bit all the time, so optimize a little. */ #undef TARGET_64BIT #define TARGET_64BIT 0 /* We don't need to generate entries in .fixup, except when -mrelocatable or -mrelocatable-lib is given. */ #undef RELOCATABLE_NEEDS_FIXUP #define RELOCATABLE_NEEDS_FIXUP \ (target_flags & target_flags_explicit & MASK_RELOCATABLE) #define TARGET_ASM_FILE_END file_end_indicate_exec_stack #define TARGET_HAS_F_SETLKW #define MD_UNWIND_SUPPORT "config/rs6000/linux-unwind.h"
/* * vdc-color.c - Colors for the VDC emulation. * * Written by * groepaz <groepaz@gmx.net> * * This file is part of VICE, the Versatile Commodore Emulator. * See README for copyright notice. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * 02111-1307 USA. * */ #include "vice.h" #include "vdctypes.h" #include "vdc-color.h" #include "vdc-resources.h" #include "video.h" /* FIXME: the VDC (CGA) colors are not evenly saturated, which means they can not be accurately defined with the current system */ /* base saturation of all colors except the grey tones */ #define VDC_SATURATION (128.0f) /* phase shift of all colors */ #define VDC_PHASE 0.0f /* chroma angles in UV space */ #define ANGLE_BLU 0.0f #define ANGLE_RED 120.0f #define ANGLE_GRN -120.0f #define ANGLE_YEL ANGLE_BLU // neg #define ANGLE_BRN 150.0f #define ANGLE_CYN ANGLE_RED // neg #define ANGLE_PUR ANGLE_GRN // neg #define ANGLE_BLK 0.0f /* luminances */ #define LUMA(r,g,b) (0.2989f * (r) + 0.5866f * (g) + 0.1145f * (b)) #define VDC_LUMA_0 LUMA( 0.0f, 0.0f, 0.0f) #define VDC_LUMA_1 LUMA( 85.0f, 85.0f, 85.0f) #define VDC_LUMA_2 LUMA( 0.0f, 0.0f, 170.0f) #define VDC_LUMA_3 LUMA( 85.0f, 85.0f, 255.0f) #define VDC_LUMA_4 LUMA( 0.0f, 170.0f, 0.0f) #define VDC_LUMA_5 LUMA( 85.0f, 255.0f, 85.0f) #define VDC_LUMA_6 LUMA( 0.0f, 170.0f, 170.0f) #define VDC_LUMA_7 LUMA( 85.0f, 255.0f, 255.0f) #define VDC_LUMA_8 LUMA(170.0f, 0.0f, 0.0f) #define VDC_LUMA_9 LUMA(255.0f, 85.0f, 85.0f) #define VDC_LUMA_10 LUMA(170.0f, 0.0f, 170.0f) #define VDC_LUMA_11 LUMA(255.0f, 85.0f, 255.0f) #define VDC_LUMA_12 LUMA(170.0f, 85.0f, 0.0f) #define VDC_LUMA_13 LUMA(255.0f, 255.0f, 85.0f) #define VDC_LUMA_14 LUMA(170.0f, 170.0f, 170.0f) #define VDC_LUMA_15 LUMA(255.0f, 255.0f, 255.0f) /* the VDC palette converted to yuv space */ static video_cbm_color_t vdc_colors[VDC_NUM_COLORS]= { /* r g b y u v sat hue */ { VDC_LUMA_0, ANGLE_BLK, -0, "Black" }, /* 000000 -> 0.0% 0.0% 0.0% 0.0% */ { VDC_LUMA_1, ANGLE_BLK, 0, "Medium Gray" }, /* 555555 -> 33.3% 0.0% 0.0% 0.0% */ { VDC_LUMA_2, ANGLE_BLU, 1, "Blue" }, /* 0000AA -> 7.6% 29.1% -6.7% 66.7% 240 */ { VDC_LUMA_3, ANGLE_BLU, 1, "Light Blue" }, /* 5555FF -> 40.9% 29.1% -6.7% 66.7% */ { VDC_LUMA_4, ANGLE_GRN, 1, "Green" }, /* 00AA00 -> 39.1% -19.3% -34.3% 66.7% 120 */ { VDC_LUMA_5, ANGLE_GRN, 1, "Light Green" }, /* 55FF55 -> 72.5% -19.3% -34.3% 66.7% */ { VDC_LUMA_6, ANGLE_CYN, -1, "Cyan" }, /* 00AAAA -> 46.7% 9.8% -41.0% 66.7% 180 */ { VDC_LUMA_7, ANGLE_CYN, -1, "Light Cyan" }, /* 55FFFF -> 80.1% 9.8% -41.0% 66.7% */ { VDC_LUMA_8, ANGLE_RED, 1, "Red" }, /* AA0000 -> 19.9% -9.8% 41.0% 66.7% 0 */ { VDC_LUMA_9, ANGLE_RED, 1, "Light Red" }, /* FF5555 -> 53.3% -9.8% 41.0% 66.7% */ { VDC_LUMA_10, ANGLE_PUR, -1, "Purple" }, /* AA00AA -> 27.5% 19.3% 34.3% 66.7% -60 */ { VDC_LUMA_11, ANGLE_PUR, -1, "Light Purple"}, /* FF55FF -> 60.9% 19.3% 34.3% 66.7% */ { VDC_LUMA_12, ANGLE_BRN, 1, "Brown" }, /* AA5500 -> 39.5% -19.4% 23.8% 66.7% 30 */ { VDC_LUMA_13, ANGLE_YEL, -1, "Yellow" }, /* FFFF55 -> 92.4% -29.1% 6.7% 66.7% 60 */ { VDC_LUMA_14, ANGLE_BLK, -0, "Light Gray" }, /* AAAAAA -> 66.7% 0.0% 0.0% 0.0% */ { VDC_LUMA_15, ANGLE_BLK, 0, "White" }, /* FFFFFF -> 100.0% 0.0% 0.0% 0.0% */ }; static video_cbm_palette_t vdc_palette = { VDC_NUM_COLORS, vdc_colors, VDC_SATURATION, VDC_PHASE }; int vdc_color_update_palette(struct video_canvas_s *canvas) { video_color_palette_internal(canvas, &vdc_palette); return video_color_update_palette(canvas); }
/* -*- Mode: C++ -*- KDChart - a multi-platform charting engine */ /**************************************************************************** ** Copyright (C) 2005-2007 Klarälvdalens Datakonsult AB. All rights reserved. ** ** This file is part of the KD Chart library. ** ** This file may be used under the terms of the GNU General Public ** License versions 2.0 or 3.0 as published by the Free Software ** Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3 ** included in the packaging of this file. Alternatively you may (at ** your option) use any later version of the GNU General Public ** License if such license has been publicly approved by ** Klarälvdalens Datakonsult AB (or its successors, if any). ** ** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, ** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE. Klarälvdalens Datakonsult AB reserves all rights ** not expressly granted herein. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** **********************************************************************/ #ifndef KDCHARTGRIDATTRIBUTES_H #define KDCHARTGRIDATTRIBUTES_H #include <QMetaType> #include "KDChartGlobal.h" #include "KDChartEnums.h" class QPen; namespace KDChart { /** * @brief A set of attributes controlling the appearance of grids */ class KDCHART_EXPORT GridAttributes { public: GridAttributes(); GridAttributes( const GridAttributes& ); GridAttributes &operator= ( const GridAttributes& ); ~GridAttributes(); void setGridVisible( bool visible ); bool isGridVisible() const; void setGridStepWidth( qreal stepWidth=0.0 ); qreal gridStepWidth() const; void setGridSubStepWidth( qreal subStepWidth=0.0 ); qreal gridSubStepWidth() const; /** * Specify which granularity sequence is to be used to find a matching * grid granularity. * * See details explained at KDChartEnums::GranularitySequence. * * You might also want to use setAdjustBoundsToGrid for fine-tuning the * start/end value. * * \sa setAdjustBoundsToGrid, GranularitySequence */ void setGridGranularitySequence( KDChartEnums::GranularitySequence sequence ); KDChartEnums::GranularitySequence gridGranularitySequence() const; /** * By default visible bounds of the data area are adjusted to match * a main grid line. * If you set the respective adjust flag to false the bound will * not start at a grid line's value but it will be the exact value * of the data range set. * * \sa CartesianCoordinatePlane::setHorizontalRange * \sa CartesianCoordinatePlane::setVerticalRange */ void setAdjustBoundsToGrid( bool adjustLower, bool adjustUpper ); bool adjustLowerBoundToGrid() const; bool adjustUpperBoundToGrid() const; void setGridPen( const QPen & pen ); QPen gridPen() const; void setSubGridVisible( bool visible ); bool isSubGridVisible() const; void setSubGridPen( const QPen & pen ); QPen subGridPen() const; void setZeroLinePen( const QPen & pen ); QPen zeroLinePen() const; bool operator==( const GridAttributes& ) const; inline bool operator!=( const GridAttributes& other ) const { return !operator==(other); } private: KDCHART_DECLARE_PRIVATE_BASE_VALUE( GridAttributes ) }; // End of class GridAttributes } #if !defined(QT_NO_DEBUG_STREAM) KDCHART_EXPORT QDebug operator<<(QDebug, const KDChart::GridAttributes& ); #endif /* QT_NO_DEBUG_STREAM */ KDCHART_DECLARE_SWAP_SPECIALISATION( KDChart::GridAttributes ) Q_DECLARE_METATYPE( KDChart::GridAttributes ) Q_DECLARE_TYPEINFO( KDChart::GridAttributes, Q_MOVABLE_TYPE ); #endif // KDCHARTGRIDATTRIBUTES_H
/* * This file is part of libsharp. * * libsharp 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. * * libsharp 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 libsharp; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * libsharp is being developed at the Max-Planck-Institut fuer Astrophysik * and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt * (DLR). */ /*! \file sharp_cxx.h * Spherical transform library * * Copyright (C) 2012-2015 Max-Planck-Society * \author Martin Reinecke */ #ifndef PLANCK_SHARP_CXX_H #define PLANCK_SHARP_CXX_H #include "sharp_lowlevel.h" #include "sharp_geomhelpers.h" #include "sharp_almhelpers.h" class sharp_base { protected: sharp_alm_info *ainfo; sharp_geom_info *ginfo; public: sharp_base() : ainfo(0), ginfo(0) {} ~sharp_base() { sharp_destroy_geom_info(ginfo); sharp_destroy_alm_info(ainfo); } void set_general_geometry (int nrings, const int *nph, const ptrdiff_t *ofs, const int *stride, const double *phi0, const double *theta, const double *wgt) { if (ginfo) sharp_destroy_geom_info(ginfo); sharp_make_geom_info (nrings, nph, ofs, stride, phi0, theta, wgt, &ginfo); } void set_ECP_geometry (int nrings, int nphi) { if (ginfo) sharp_destroy_geom_info(ginfo); sharp_make_ecp_geom_info (nrings, nphi, 0., 1, nphi, &ginfo); } void set_Gauss_geometry (int nrings, int nphi) { if (ginfo) sharp_destroy_geom_info(ginfo); sharp_make_gauss_geom_info (nrings, nphi, 0., 1, nphi, &ginfo); } void set_Healpix_geometry (int nside) { if (ginfo) sharp_destroy_geom_info(ginfo); sharp_make_healpix_geom_info (nside, 1, &ginfo); } void set_weighted_Healpix_geometry (int nside, const double *weight) { if (ginfo) sharp_destroy_geom_info(ginfo); sharp_make_weighted_healpix_geom_info (nside, 1, weight, &ginfo); } void set_triangular_alm_info (int lmax, int mmax) { if (ainfo) sharp_destroy_alm_info(ainfo); sharp_make_triangular_alm_info (lmax, mmax, 1, &ainfo); } const sharp_geom_info* get_geom_info() const { return ginfo; } const sharp_alm_info* get_alm_info() const { return ainfo; } }; template<typename T> struct cxxjobhelper__ {}; template<> struct cxxjobhelper__<double> { enum {val=SHARP_DP}; }; template<> struct cxxjobhelper__<float> { enum {val=0}; }; template<typename T> class sharp_cxxjob: public sharp_base { private: static void *conv (T *ptr) { return reinterpret_cast<void *>(ptr); } static void *conv (const T *ptr) { return const_cast<void *>(reinterpret_cast<const void *>(ptr)); } public: void alm2map (const T *alm, T *map, bool add) { void *aptr=conv(alm), *mptr=conv(map); int flags=cxxjobhelper__<T>::val | (add ? SHARP_ADD : 0); sharp_execute (SHARP_ALM2MAP, 0, &aptr, &mptr, ginfo, ainfo, 1, flags,0,0); } void alm2map_spin (const T *alm1, const T *alm2, T *map1, T *map2, int spin, bool add) { void *aptr[2], *mptr[2]; aptr[0]=conv(alm1); aptr[1]=conv(alm2); mptr[0]=conv(map1); mptr[1]=conv(map2); int flags=cxxjobhelper__<T>::val | (add ? SHARP_ADD : 0); sharp_execute (SHARP_ALM2MAP,spin,aptr,mptr,ginfo,ainfo,1,flags,0,0); } void alm2map_der1 (const T *alm, T *map1, T *map2, bool add) { void *aptr=conv(alm), *mptr[2]; mptr[0]=conv(map1); mptr[1]=conv(map2); int flags=cxxjobhelper__<T>::val | (add ? SHARP_ADD : 0); sharp_execute (SHARP_ALM2MAP_DERIV1,1,&aptr,mptr,ginfo,ainfo,1,flags,0,0); } void map2alm (const T *map, T *alm, bool add) { void *aptr=conv(alm), *mptr=conv(map); int flags=cxxjobhelper__<T>::val | (add ? SHARP_ADD : 0); sharp_execute (SHARP_MAP2ALM,0,&aptr,&mptr,ginfo,ainfo,1,flags,0,0); } void map2alm_spin (const T *map1, const T *map2, T *alm1, T *alm2, int spin, bool add) { void *aptr[2], *mptr[2]; aptr[0]=conv(alm1); aptr[1]=conv(alm2); mptr[0]=conv(map1); mptr[1]=conv(map2); int flags=cxxjobhelper__<T>::val | (add ? SHARP_ADD : 0); sharp_execute (SHARP_MAP2ALM,spin,aptr,mptr,ginfo,ainfo,1,flags,0,0); } }; #endif
/********************************************************************** * This file is part of Search and Rescue II (SaR2). * * * * SaR2 is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License v.2 as * * published by the Free Software Foundation. * * * * SaR2 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 SaR2. If not, see <http://www.gnu.org/licenses/>. * ***********************************************************************/ #ifndef SARMEMORY_H #define SARMEMORY_H #include "obj.h" #include "sar.h" /* * Memory stats structure: */ typedef struct _sar_memory_stat_struct sar_memory_stat_struct; struct _sar_memory_stat_struct { /* All memory units are in bytes unless noted otherwise */ unsigned long total, texture, vmodel, scene, object; int ntextures, nvmodels, nobjects; }; extern void SARMemoryStat( sar_core_struct *core_ptr, sar_scene_struct *scene, sar_object_struct **object, int total_objects, sar_memory_stat_struct *stat_buf ); #endif /* SARMEMORY_H */
/* Copyright (C) 1996,2001,02 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 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "iohelp.h" error_t iohelp_create_iouser (struct iouser **user, struct idvec *uids, struct idvec *gids) { struct iouser *new; *user = new = malloc (sizeof (struct iouser)); if (!new) return ENOMEM; new->uids = uids; new->gids = gids; new->hook = 0; return 0; } #define E(err) \ do { \ if (err) \ { \ *user = 0; \ if (! uids) \ return err; \ idvec_free (uids); \ if (! gids) \ return err; \ idvec_free (gids); \ return err; \ } \ } while (0) error_t iohelp_create_empty_iouser (struct iouser **user) { struct idvec *uids, *gids; uids = make_idvec (); if (! uids) E (ENOMEM); gids = make_idvec (); if (! gids) E (ENOMEM); E (iohelp_create_iouser (user, uids, gids)); return 0; } error_t iohelp_create_simple_iouser (struct iouser **user, uid_t uid, gid_t gid) { struct idvec *uids, *gids; uids = make_idvec (); if (! uids) E (ENOMEM); gids = make_idvec (); if (! gids) E (ENOMEM); E (idvec_add (uids, uid)); E (idvec_add (gids, gid)); E (iohelp_create_iouser (user, uids, gids)); return 0; } error_t iohelp_create_complex_iouser (struct iouser **user, const uid_t *uvec, int nuids, const gid_t *gvec, int ngids) { struct idvec *uids, *gids; uids = make_idvec (); if (! uids) E (ENOMEM); gids = make_idvec (); if (! gids) E (ENOMEM); E (idvec_set_ids (uids, uvec, nuids)); E (idvec_set_ids (gids, gvec, ngids)); E (iohelp_create_iouser (user, uids, gids)); return 0; }
/* * drivers/net/ibm_newemac/tah.c * * Driver for PowerPC 4xx on-chip ethernet controller, TAH support. * * Copyright 2007 Benjamin Herrenschmidt, IBM Corp. * <benh@kernel.crashing.org> * * Based on the arch/ppc version of the driver: * * Copyright 2004 MontaVista Software, Inc. * Matt Porter <mporter@kernel.crashing.org> * * Copyright (c) 2005 Eugene Surovegin <ebs@ebshome.net> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. */ #include <asm/io.h> #include "emac.h" #include "core.h" int __devinit tah_attach(struct platform_device *ofdev, int channel) { struct tah_instance *dev = dev_get_drvdata(&ofdev->dev); mutex_lock(&dev->lock); /* Reset has been done at probe() time... nothing else to do for now */ ++dev->users; mutex_unlock(&dev->lock); return 0; } void tah_detach(struct platform_device *ofdev, int channel) { struct tah_instance *dev = dev_get_drvdata(&ofdev->dev); mutex_lock(&dev->lock); --dev->users; mutex_unlock(&dev->lock); } void tah_reset(struct platform_device *ofdev) { struct tah_instance *dev = dev_get_drvdata(&ofdev->dev); struct tah_regs __iomem *p = dev->base; int n; /* Reset TAH */ out_be32(&p->mr, TAH_MR_SR); n = 100; while ((in_be32(&p->mr) & TAH_MR_SR) && n) --n; if (unlikely(!n)) printk(KERN_ERR "%s: reset timeout\n", ofdev->dev.of_node->full_name); /* 10KB TAH TX FIFO accomodates the max MTU of 9000 */ out_be32(&p->mr, TAH_MR_CVR | TAH_MR_ST_768 | TAH_MR_TFS_10KB | TAH_MR_DTFP | TAH_MR_DIG); } int tah_get_regs_len(struct platform_device *ofdev) { return sizeof(struct emac_ethtool_regs_subhdr) + sizeof(struct tah_regs); } void *tah_dump_regs(struct platform_device *ofdev, void *buf) { struct tah_instance *dev = dev_get_drvdata(&ofdev->dev); struct emac_ethtool_regs_subhdr *hdr = buf; struct tah_regs *regs = (struct tah_regs *)(hdr + 1); hdr->version = 0; hdr->index = 0; /* for now, are there chips with more than one * zmii ? if yes, then we'll add a cell_index * like we do for emac */ memcpy_fromio(regs, dev->base, sizeof(struct tah_regs)); return regs + 1; } static int __devinit tah_probe(struct platform_device *ofdev) { struct device_node *np = ofdev->dev.of_node; struct tah_instance *dev; struct resource regs; int rc; rc = -ENOMEM; dev = kzalloc(sizeof(struct tah_instance), GFP_KERNEL); if (dev == NULL) { printk(KERN_ERR "%s: could not allocate TAH device!\n", np->full_name); goto err_gone; } mutex_init(&dev->lock); dev->ofdev = ofdev; rc = -ENXIO; if (of_address_to_resource(np, 0, &regs)) { printk(KERN_ERR "%s: Can't get registers address\n", np->full_name); goto err_free; } rc = -ENOMEM; dev->base = (struct tah_regs __iomem *)ioremap(regs.start, sizeof(struct tah_regs)); if (dev->base == NULL) { printk(KERN_ERR "%s: Can't map device registers!\n", np->full_name); goto err_free; } dev_set_drvdata(&ofdev->dev, dev); /* Initialize TAH and enable IPv4 checksum verification, no TSO yet */ tah_reset(ofdev); printk(KERN_INFO "TAH %s initialized\n", ofdev->dev.of_node->full_name); wmb(); return 0; err_free: kfree(dev); err_gone: return rc; } static int __devexit tah_remove(struct platform_device *ofdev) { struct tah_instance *dev = dev_get_drvdata(&ofdev->dev); dev_set_drvdata(&ofdev->dev, NULL); WARN_ON(dev->users != 0); iounmap(dev->base); kfree(dev); return 0; } static struct of_device_id tah_match[] = { { .compatible = "ibm,tah", }, /* For backward compat with old DT */ { .type = "tah", }, {}, }; static struct platform_driver tah_driver = { .driver = { .name = "emac-tah", .owner = THIS_MODULE, .of_match_table = tah_match, }, .probe = tah_probe, .remove = tah_remove, }; int __init tah_init(void) { return platform_driver_register(&tah_driver); } void tah_exit(void) { platform_driver_unregister(&tah_driver); }
/* * This file is part of the coreboot project. * * Copyright (c) 2011 Sven Schnelle <svens@stackframe.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; 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. */ #include <device/device.h> #include <device/pci.h> #include <console/console.h> #include <arch/smp/mpspec.h> #include <arch/ioapic.h> #include <string.h> #include <stdint.h> static void *smp_write_config_table(void *v) { struct mp_config_table *mc; int isa_bus; mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN); mptable_init(mc, LOCAL_APIC_ADDR); smp_write_processors(mc); mptable_write_buses(mc, NULL, &isa_bus); /* I/O APICs: APIC ID Version State Address */ smp_write_ioapic(mc, 2, 0x20, VIO_APIC_VADDR); /* Legacy Interrupts */ mptable_add_isa_interrupts(mc, isa_bus, 0x2, 0); smp_write_intsrc(mc, mp_ExtINT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, isa_bus, 0x00, MP_APIC_ALL, 0x00); smp_write_intsrc(mc, mp_NMI, MP_IRQ_TRIGGER_DEFAULT|MP_IRQ_POLARITY_DEFAULT, isa_bus, 0x00, MP_APIC_ALL, 0x01); smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x00, (0x01 << 2), 0x02, 0x10); /* PCIe root 0.02.0 */ smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x00, (0x02 << 2), 0x02, 0x10); /* VGA 0.02.0 */ smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x00, (0x1b << 2), 0x02, 0x11); /* HD Audio 0:1b.0 */ smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x00, (0x1c << 2), 0x02, 0x14); /* PCIe 0:1c.0 */ smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x00, (0x1c << 2) | 0x01, 0x02, 0x15); /* PCIe 0:1c.1 */ smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x00, (0x1c << 2) | 0x02, 0x02, 0x16); /* PCIe 0:1c.2 */ smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x00, (0x1c << 2) | 0x03, 0x02, 0x17); /* PCIe 0:1c.3 */ smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x00, (0x1d << 2) , 0x02, 0x10); /* USB 0:1d.0 */ smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x00, (0x1d << 2) | 0x01, 0x02, 0x11); /* USB 0:1d.1 */ smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x00, (0x1d << 2) | 0x02, 0x02, 0x12); /* USB 0:1d.2 */ smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x00, (0x1d << 2) | 0x03, 0x02, 0x13); /* USB 0:1d.3 */ smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x00, (0x1f << 2) , 0x02, 0x17); /* LPC 0:1f.0 */ smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x00, (0x1f << 2) | 0x01, 0x02, 0x10); /* IDE 0:1f.1 */ smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x00, (0x1f << 2) | 0x02, 0x02, 0x10); /* SATA 0:1f.2 */ smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x05, (0x00 << 2) | 0x00, 0x02, 0x10); /* Cardbus 5:00.0 */ smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x05, (0x00 << 2) | 0x01, 0x02, 0x11); /* Firewire 5:00.1 */ smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x05, (0x00 << 2) | 0x02, 0x02, 0x12); /* SDHC 5:00.2 */ mptable_lintsrc(mc, isa_bus); return mptable_finalize(mc); } unsigned long write_smp_table(unsigned long addr) { void *v; v = smp_write_floating_table(addr, 0); return (unsigned long)smp_write_config_table(v); }
// license:BSD-3-Clause // copyright-holders:Miodrag Milanovic /*************************************************************************** Chips & Technologies CS8221 chipset a.k.a. NEW ENHANCED AT (NEAT) Consists of four individual chips: * 82C211 - CPU/Bus controller * 82C212 - Page/Interleave and EMS Memory controller * 82C215 - Data/Address buffer * 82C206 - Integrated Peripherals Controller(IPC) ***************************************************************************/ #pragma once #ifndef __CS8221_H__ #define __CS8221_H__ #include "emu.h" //************************************************************************** // INTERFACE CONFIGURATION MACROS //************************************************************************** #define MCFG_CS8221_ADD(_tag, _cputag, _isatag, _biostag) \ MCFG_DEVICE_ADD(_tag, CS8221, 0) \ cs8221_device::static_set_cputag(*device, _cputag); \ cs8221_device::static_set_isatag(*device, _isatag); \ cs8221_device::static_set_biostag(*device, _biostag); //************************************************************************** // TYPE DEFINITIONS //************************************************************************** // ======================> cs8221_device class cs8221_device : public device_t { public: // construction/destruction cs8221_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); DECLARE_WRITE8_MEMBER( address_w ); DECLARE_READ8_MEMBER( data_r ); DECLARE_WRITE8_MEMBER( data_w ); DECLARE_ADDRESS_MAP(map, 16); // inline configuration static void static_set_cputag(device_t &device, const char *tag); static void static_set_isatag(device_t &device, const char *tag); static void static_set_biostag(device_t &device, const char *tag); protected: // device-level overrides virtual void device_start() override; virtual void device_reset() override; private: // internal state //address_space *m_space; //UINT8 *m_isa; //UINT8 *m_bios; //UINT8 *m_ram; // address selection UINT8 m_address; bool m_address_valid; const char *m_cputag; const char *m_isatag; const char *m_biostag; UINT8 m_registers[0x10]; }; // device type definition extern const device_type CS8221; #endif /* __CS8221_H__ */
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * THE FILE HAS BEEN AUTOGENERATED BY THE IJH TOOL. * Please be aware that all changes made to this file manually * will be overwritten by the tool if it runs again. */ #include <jni.h> /* Header for class org.apache.harmony.niochar.charset.additional.GB2312 */ #ifndef _ORG_APACHE_HARMONY_NIOCHAR_CHARSET_ADDITIONAL_GB2312_H #define _ORG_APACHE_HARMONY_NIOCHAR_CHARSET_ADDITIONAL_GB2312_H #ifdef __cplusplus extern "C" { #endif #ifdef __cplusplus } #endif #endif /* _ORG_APACHE_HARMONY_NIOCHAR_CHARSET_ADDITIONAL_GB2312_H */ /* Header for class org.apache.harmony.niochar.charset.additional.GB2312$Encoder */ #ifndef _ORG_APACHE_HARMONY_NIOCHAR_CHARSET_ADDITIONAL_GB2312_ENCODER_H #define _ORG_APACHE_HARMONY_NIOCHAR_CHARSET_ADDITIONAL_GB2312_ENCODER_H #ifdef __cplusplus extern "C" { #endif /* Static final fields */ #undef org_apache_harmony_niochar_charset_additional_GB2312_Encoder_INIT #define org_apache_harmony_niochar_charset_additional_GB2312_Encoder_INIT 0L #undef org_apache_harmony_niochar_charset_additional_GB2312_Encoder_ONGOING #define org_apache_harmony_niochar_charset_additional_GB2312_Encoder_ONGOING 1L #undef org_apache_harmony_niochar_charset_additional_GB2312_Encoder_END #define org_apache_harmony_niochar_charset_additional_GB2312_Encoder_END 2L #undef org_apache_harmony_niochar_charset_additional_GB2312_Encoder_FLUSH #define org_apache_harmony_niochar_charset_additional_GB2312_Encoder_FLUSH 3L /* Native methods */ /* * Method: org.apache.harmony.niochar.charset.additional.GB2312$Encoder.nEncode(JII[CI[I)V */ JNIEXPORT void JNICALL Java_org_apache_harmony_niochar_charset_additional_GB2312_00024Encoder_nEncode(JNIEnv *, jobject, jlong, jint, jint, jcharArray, jint, jintArray); #ifdef __cplusplus } #endif #endif /* _ORG_APACHE_HARMONY_NIOCHAR_CHARSET_ADDITIONAL_GB2312_ENCODER_H */ /* Header for class org.apache.harmony.niochar.charset.additional.GB2312$Decoder */ #ifndef _ORG_APACHE_HARMONY_NIOCHAR_CHARSET_ADDITIONAL_GB2312_DECODER_H #define _ORG_APACHE_HARMONY_NIOCHAR_CHARSET_ADDITIONAL_GB2312_DECODER_H #ifdef __cplusplus extern "C" { #endif /* Static final fields */ #undef org_apache_harmony_niochar_charset_additional_GB2312_Decoder_INIT #define org_apache_harmony_niochar_charset_additional_GB2312_Decoder_INIT 0L #undef org_apache_harmony_niochar_charset_additional_GB2312_Decoder_ONGOING #define org_apache_harmony_niochar_charset_additional_GB2312_Decoder_ONGOING 1L #undef org_apache_harmony_niochar_charset_additional_GB2312_Decoder_END #define org_apache_harmony_niochar_charset_additional_GB2312_Decoder_END 2L #undef org_apache_harmony_niochar_charset_additional_GB2312_Decoder_FLUSH #define org_apache_harmony_niochar_charset_additional_GB2312_Decoder_FLUSH 3L /* Native methods */ /* * Method: org.apache.harmony.niochar.charset.additional.GB2312$Decoder.nDecode([CIIJI[I)V */ JNIEXPORT void JNICALL Java_org_apache_harmony_niochar_charset_additional_GB2312_00024Decoder_nDecode(JNIEnv *, jobject, jcharArray, jint, jint, jlong, jint, jintArray); #ifdef __cplusplus } #endif #endif /* _ORG_APACHE_HARMONY_NIOCHAR_CHARSET_ADDITIONAL_GB2312_DECODER_H */
#ifndef LINUX_INTEL_PMIC_H #define LINUX_INTEL_PMIC_H struct intel_pmic_gpio_platform_data { /* the first IRQ of the chip */ unsigned irq_base; /* number assigned to the first GPIO */ unsigned gpio_base; /* sram address for gpiointr register, the langwell chip will map * the PMIC spi GPIO expander's GPIOINTR register in sram. */ unsigned gpiointr; }; #endif
// Copyright (c) 2008-2011 Raynaldo (Wildicv) Rivera, Joshua (Dark_Kilauea) Jones, Murat (wolfmanfx) Sari // This file is part of the "cAudio Engine" // For conditions of distribution and use, see copyright notice in cAudio.h #pragma once #include "cAudioDefines.h" #include <cstring> namespace cAudio { //! Interface for a class that allocates and frees memory used by cAudio. class IMemoryProvider { public: //! Allocates memory and returns a pointer to it. /** \param size: Size of the memory chunk to allocate in bytes. \param filename: Filename of the source file that this allocation took place in (in Debug) or NULL otherwise. \param line: Line of the source file where this allocation took place (in Debug) or -1 otherwise. \param function: Function that this allocation took place in (in Debug) or NULL otherwise. \return Pointer to the allocated memory or NULL if allocation failed. */ virtual void* Allocate(size_t size, const char* filename, int line, const char* function) = 0; //! Frees memory previously allocated. /** \param pointer: Pointer to the memory location to free. */ virtual void Free(void* pointer) = 0; //! Returns the largest possible single allocation that can be made. virtual size_t getMaxAllocationSize() = 0; }; };
/* * Copyright (C) 1996-2022 The Squid Software Foundation and contributors * * Squid software is distributed under GPLv2+ license and includes * contributions from numerous individuals and organizations. * Please see the COPYING and CONTRIBUTORS files for details. */ #ifndef _SQUID_SRC_AUTH_DIGEST_USERREQUEST_H #define _SQUID_SRC_AUTH_DIGEST_USERREQUEST_H #if HAVE_AUTH_MODULE_DIGEST #include "auth/UserRequest.h" class ConnStateData; class HttpReply; class HttpRequest; namespace Auth { namespace Digest { /** * The UserRequest structure is what follows the http_request around */ class UserRequest : public Auth::UserRequest { MEMPROXY_CLASS(Auth::Digest::UserRequest); public: UserRequest(); virtual ~UserRequest(); virtual int authenticated() const; virtual void authenticate(HttpRequest * request, ConnStateData * conn, Http::HdrType type); virtual Direction module_direction(); virtual void addAuthenticationInfoHeader(HttpReply * rep, int accel); #if WAITING_FOR_TE virtual void addAuthenticationInfoTrailer(HttpReply * rep, int accel); #endif virtual void startHelperLookup(HttpRequest *request, AccessLogEntry::Pointer &al, AUTHCB *, void *); virtual const char *credentialsStr(); char *noncehex; /* "dcd98b7102dd2f0e8b11d0f600bfb0c093" */ char *cnonce; /* "0a4f113b" */ char *realm; /* = "testrealm@host.com" */ char *pszPass; /* = "Circle Of Life" */ char *algorithm; /* = "md5" */ char nc[9]; /* = "00000001" */ char *pszMethod; /* = "GET" */ char *qop; /* = "auth" */ char *uri; /* = "/dir/index.html" */ char *response; struct { bool authinfo_sent; bool invalid_password; bool helper_queried; } flags; digest_nonce_h *nonce; private: static HLPCB HandleReply; }; } // namespace Digest } // namespace Auth #endif /* HAVE_AUTH_MODULE_DIGEST */ #endif /* _SQUID_SRC_AUTH_DIGEST_USERREQUEST_H */
//-------------------------------------------------------------------------- // mamer - Tournament Director for the Free Internet Chess Server // // Copyright (C) 1995 Fred Baumgarten // Copyright (C) 1996-2001 Michael A. Long // Copyright (C) 1996-2001 Matthew E. Moses // Copyright (C) 2002 Richard Archer // // $Id: types.h,v 1.16 2002/08/08 02:53:35 rha Exp $ // // mamer 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. // // mamer 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 mamer; if not, write to the Free Software Foundation, // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // //-------------------------------------------------------------------------- // types.h - Header file for types // // Matthew E. Moses & Michael A. Long // // $Revision: 1.16 $ // $Date: 2002/08/08 02:53:35 $ // // $Author: rha $ // $Locker: $ // // $Log: types.h,v $ // Revision 1.16 2002/08/08 02:53:35 rha // Relicense code under the GPL. // // Revision 1.15 2002/08/08 01:45:15 rha // Merge in changes made to mamer outside the RCS // environment from March 1999 to January 2000. // // Revision 1.14 1999/01/02 21:47:49 mlong // added bughouse support // // Revision 1.13 1998/10/12 16:01:10 mlong // *** empty log message *** // // Revision 1.12 1998/09/22 15:49:32 mlong // added gametype // // Revision 1.11 1998/09/10 19:58:20 mlong // *** empty log message *** // // Revision 1.10 1998/06/18 18:42:09 mlong // prepairing for yet another move. // // Revision 1.9 1998/06/04 19:56:02 mlong // *** empty log message *** // // Revision 1.8 1998/04/18 19:00:07 mlong // fixed delete bug and added delete tourney fuction // // Revision 1.7 1998/02/12 18:44:34 mlong // *** empty log message *** // // Revision 1.6 1997/11/06 20:51:29 chess // *** empty log message *** // // Revision 1.5 1997/10/08 21:03:08 chess // no log message // // Revision 1.4 1997/05/15 18:30:27 chess // *** empty log message *** // // Revision 1.3 1997/04/13 03:24:42 chess // added several enumerated types for params stuff and for TellUser outputs // // Revision 1.2 1997/04/07 22:22:26 chess // added enum ranks // and added enum reasons for why we are calling a centralized telluser function // // Revision 1.1 1996/10/01 20:17:34 moses // Initial revision // // //-------------------------------------------------------------------------- #ifndef _TYPES_ #define _TYPES_ class Mamer; class User; class Tourney; class CommandEntry; class Player; class Storage; //#define MAX(X,Y) ((X) > (Y) ? (X) : (Y)) //#define MIN(X,Y) ((X) < (Y) ? (X) : (Y)) typedef enum { USER=0, DIRECTOR=10, MANAGER=25, VICE=50, PRESIDENT=100 } ranks; typedef enum { WILD, BLITZ, STAND, LIGHT, BUG, SUICIDE, CRAZY } ttypes; typedef enum { AddedComment, AlreadyOut, BadCommand, ByeRound, MultiCommand, CanNotChange, ChangedManagerLevel, ChangedCommandLevel, ChangedInfo, ChangedAbuse, GenericTell, JoinedTourney, WillKeepTourney, NoPermissions, NotEnoughPlayers, NotFound, NotKeepTourney, NoPlayers, PlayerRemoved, PrivateGame, TourneyDeleted, TourneyNotFound, TourneyNotNew, TourneyNotOpen, TourneyNotClosed, TourneyNotSet, TourneyDone, TourneyClosed, TourneyStarted, GameResultNotFound, GameResultSet } reasons; #define COM_OK 0 #define COM_FAILED 1 #define COM_AMBIGUOUS 2 #define COM_BADPARAMETERS 3 #define COM_BADCOMMAND 4 typedef enum { ONLINE, GONE, } locations; /* bics types GENSTRUCT enum gametype {TYPE_UNTIMED, TYPE_BLITZ(zh), TYPE_STAND, TYPE_NONSTANDARD, TYPE_WILD, TYPE_LIGHT, TYPE_BUGHOUSE}; */ typedef enum { TYPE_UNTIMED, TYPE_CRAZY, TYPE_STAND, TYPE_NONSTANDARD, TYPE_WILD, TYPE_LIGHT, TYPE_BUGHOUSE, TYPE_NONE=-1, TYPE_SUICIDE, TYPE_FR, TYPE_BLITZ } gametype; typedef enum { NEW, OPEN, SET, CLOSED, DONE } status; typedef enum { TYPE_NULL, TYPE_WORD, TYPE_STRING, TYPE_INT } types; typedef struct u_parameter { types type; union { char *word; char *string; int integer; } val; } parameter; struct string_list { char *string; int number; }; typedef struct string_list strings; #define MAXNUMPARAMS 10 typedef parameter param_list[MAXNUMPARAMS]; typedef int (Mamer::*USERFP) (User *, param_list); typedef int (Mamer::*TOURNFP) (User *, param_list, Tourney *); #endif
/*************************************************************************** qgstransaction.h ---------------- begin : May 5, 2014 copyright : (C) 2014 by Marco Hugentobler email : marco dot hugentobler at sourcepole dot ch ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef QGSTRANSACTION_H #define QGSTRANSACTION_H #include <QSet> #include <QString> #include <QObject> class QgsVectorDataProvider; class QgsVectorLayer; /** * This class allows to include a set of layers in a database-side transaction, * provided the layer data providers support transactions and are compatible * with each other. * * Only layers which are not in edit mode can be included in a transaction, * and all layers need to be in read-only mode for a transaction to be committed * or rolled back. * * Layers cannot only be included in one transaction at a time. * * When editing layers which are part of a transaction group, all changes are * sent directly to the data provider (bypassing the undo/redo stack), and the * changes can either be committed or rolled back on the database side via the * QgsTransaction::commit and QgsTransaction::rollback methods. * * As long as the transaction is active, the state of all layer features reflects * the current state in the transaction. * * Edits on features can get rejected if another conflicting transaction is active. */ class CORE_EXPORT QgsTransaction : public QObject { Q_OBJECT public: /** Creates a transaction for the specified connection string and provider */ static QgsTransaction* create( const QString& connString, const QString& providerKey ); /** Creates a transaction which includes the specified layers. Connection string * and data provider are taken from the first layer */ static QgsTransaction* create( const QStringList& layerIds ); virtual ~QgsTransaction(); /** Add layer to the transaction. The layer must not be in edit mode. The transaction must not be active. */ bool addLayer( const QString& layerId ); /** Add layer to the transaction. The layer must not be in edit mode. The transaction must not be active. */ bool addLayer( QgsVectorLayer* layer ); /** Begin transaction * The statement timeout, in seconds, specifies how long an sql statement * is allowed to block QGIS before it is aborted. Statements can block, * depending on the provider, if multiple transactions are active and a * statement would produce a conflicting state. In these cases, the * statements block until the conflicting transaction is committed or * rolled back. * Some providers might not honour the statement timeout. */ bool begin( QString& errorMsg, int statementTimeout = 20 ); /** Commit transaction. All layers need to be in read-only mode. */ bool commit( QString& errorMsg ); /** Roll back transaction. All layers need to be in read-only mode. */ bool rollback( QString& errorMsg ); /** Executes sql */ virtual bool executeSql( const QString& sql, QString& error ) = 0; signals: /** * Emitted after a rollback */ void afterRollback(); private slots: void onLayersDeleted( const QStringList& layerids ); protected: QgsTransaction( const QString& connString ); QString mConnString; private: QgsTransaction( const QgsTransaction& other ); const QgsTransaction& operator=( const QgsTransaction& other ); bool mTransactionActive; QSet<QgsVectorLayer*> mLayers; void setLayerTransactionIds( QgsTransaction *transaction ); virtual bool beginTransaction( QString& error, int statementTimeout ) = 0; virtual bool commitTransaction( QString& error ) = 0; virtual bool rollbackTransaction( QString& error ) = 0; }; #endif // QGSTRANSACTION_H