text
stringlengths
4
6.14k
#include "legato.h" #include "interfaces.h" #define dhubIO_DataType_t io_DataType_t static bool IsEnabled = false; static le_timer_Ref_t Timer; #define LATITUDE_NAME "location/value/latitude" #define LONGITUDE_NAME "location/value/longitude" #define PERIOD_NAME "location/period" #define ENABLE_NAME "location/enable" //-------------------------------------------------------------------------------------------------- /** * Function called when the timer expires. */ //-------------------------------------------------------------------------------------------------- static void TimerExpired ( le_timer_Ref_t timer ///< Timer reference ) //-------------------------------------------------------------------------------------------------- { static unsigned int counter = 0; int32_t latitude = 0; int32_t longitude = 0; int32_t horizontalAccuracy = 0; counter += 1; le_result_t result = le_pos_Get2DLocation(&latitude, &longitude, &horizontalAccuracy); if (LE_OK != result) { LE_ERROR("Error %d getting position", result); } LE_INFO("Location: Latitude %d Longitude %d Accuracy %d", latitude, longitude, horizontalAccuracy); // introduce oscillations (20 meters) to latitude latitude += counter % 200; // Location units have to be converted from 1e-6 degrees to degrees io_PushNumeric(LATITUDE_NAME, IO_NOW, latitude * 0.000001); io_PushNumeric(LONGITUDE_NAME, IO_NOW, longitude * 0.000001); } //-------------------------------------------------------------------------------------------------- /** * Call-back function called when an update is received from the Data Hub for the "period" * config setting. */ //-------------------------------------------------------------------------------------------------- static void PeriodUpdateHandler ( double timestamp, ///< time stamp double value, ///< period value, seconds void* contextPtr ///< not used ) //-------------------------------------------------------------------------------------------------- { LE_INFO("Received update to 'period' setting: %lf (timestamped %lf)", value, timestamp); uint32_t ms = (uint32_t)(value * 1000); if (ms == 0) { le_timer_Stop(Timer); } else { le_timer_SetMsInterval(Timer, ms); // If the sensor is enabled and the timer is not already running, start it now. if (IsEnabled && (!le_timer_IsRunning(Timer))) { le_timer_Start(Timer); } } } //-------------------------------------------------------------------------------------------------- /** * Call-back function called when an update is received from the Data Hub for the "enable" * control. */ //-------------------------------------------------------------------------------------------------- static void EnableUpdateHandler ( double timestamp, ///< time stamp bool value, ///< whether input is enabled void* contextPtr ///< not used ) //-------------------------------------------------------------------------------------------------- { LE_INFO("Received update to 'enable' setting: %s (timestamped %lf)", value == false ? "false" : "true", timestamp); IsEnabled = value; if (value) { // If the timer has a non-zero interval and is not already running, start it now. if ((le_timer_GetMsInterval(Timer) != 0) && (!le_timer_IsRunning(Timer))) { le_timer_Start(Timer); } } else { le_timer_Stop(Timer); } } //-------------------------------------------------------------------------------------------------- /** * Call-back for receiving notification that an update is happening. */ //-------------------------------------------------------------------------------------------------- static void UpdateStartEndHandler ( bool isStarting, //< input is starting void* contextPtr //< Not used. ) //-------------------------------------------------------------------------------------------------- { LE_INFO("Configuration update %s.", isStarting ? "starting" : "finished"); } COMPONENT_INIT { le_result_t result; io_AddUpdateStartEndHandler(UpdateStartEndHandler, NULL); // This will be provided to the Data Hub. result = io_CreateInput(LATITUDE_NAME, IO_DATA_TYPE_NUMERIC, "degrees"); LE_ASSERT(result == LE_OK); result = io_CreateInput(LONGITUDE_NAME, IO_DATA_TYPE_NUMERIC, "degrees"); LE_ASSERT(result == LE_OK); // This is my configuration setting. result = io_CreateOutput(PERIOD_NAME, IO_DATA_TYPE_NUMERIC, "s"); LE_ASSERT(result == LE_OK); // Register for notification of updates to our configuration setting. io_AddNumericPushHandler(PERIOD_NAME, PeriodUpdateHandler, NULL); // This is my enable/disable control. result = io_CreateOutput(ENABLE_NAME, IO_DATA_TYPE_BOOLEAN, ""); LE_ASSERT(result == LE_OK); // Set the defaults: enable the sensor, set period to 1s io_SetBooleanDefault(ENABLE_NAME, true); io_SetNumericDefault(PERIOD_NAME, 1); // Register for notification of updates to our enable/disable control. io_AddBooleanPushHandler(ENABLE_NAME, EnableUpdateHandler, NULL); // Create a repeating timer that will call TimerExpired() each time it expires. // Note: we'll start the timer when we receive our configuration setting. Timer = le_timer_Create("gpsSensorTimer"); le_timer_SetRepeat(Timer, 0); le_timer_SetHandler(Timer, TimerExpired); }
/* Copyright (C) 2015, Hsiang Kao (e0e1e) <0xe0e1e@gmail.com> * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include <openssl/evp.h> #include "highway/encrypt.h" _record(methodinfo) _methodinfo_0 *_0; char *name; const EVP_CIPHER *cipher; int ivsiz; _end_record(methodinfo) #include "highway/encrypt_openssl_impl.h" int encrypt_rc4_md5_iv_length(_methodinfo *method) { return method->ivsiz; } extern _methodinfo_0 methodinfo_0_rc4_md5; static _methodinfo method_supported[] = { {&methodinfo_0_rc4_md5, "rc4-md5", NULL, 16}, {&methodinfo_0_rc4_md5, "rc4-md5_8", NULL, 8} }; #define N_METHODS (sizeof(method_supported)/sizeof(_methodinfo)) #include <string.h> #ifdef _POSIX_C_SOURCE #define stricmp strcasecmp #endif _methodinfo * encrypt_rc4_md5_get_methodbyname(const char *name) { _methodinfo *p = method_supported; for(;p < &method_supported[N_METHODS]; ++p) { if (!stricmp(name, p->name)) { if (p->cipher == NULL) p->cipher = EVP_rc4(); return p; } } return NULL; } #include <string.h> #include <openssl/md5.h> _cipher * encrypt_rc4_md5_cipher_init(_methodinfo *method, char *key, char *iv, int op) { char md5_key[EVP_MAX_KEY_LENGTH + EVP_MAX_IV_LENGTH]; int keysiz = encrypt_openssl_key_length(method); memcpy(md5_key, key, keysiz); memcpy(md5_key + keysiz, iv, method->ivsiz); MD5(md5_key, keysiz+method->ivsiz, md5_key); return encrypt_openssl_cipher_init(method, md5_key, NULL, op); } _methodinfo_0 methodinfo_0_rc4_md5 = { encrypt_openssl_key_length, encrypt_rc4_md5_iv_length, encrypt_rc4_md5_cipher_init, encrypt_openssl_cipher_update, encrypt_openssl_cipher_final, encrypt_openssl_cipher_exit }; void encryptor_rc4_md5_init(void) { }
// // KPFairPlayAssetResourceLoaderHandler.h // KALTURAPlayerSDK // // Created by Noam Tamim on 09/08/2016. // Copyright © 2016 Kaltura. All rights reserved. // @import AVFoundation; @interface KPFairPlayAssetResourceLoaderHandler : NSObject <AVAssetResourceLoaderDelegate> @property (nonatomic, copy) NSString* licenseUri; @property (nonatomic, copy) NSData* certificate; +(dispatch_queue_t)globalNotificationQueue; @end
/* * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #include "internal/cryptlib.h" #include "buildinf.h" unsigned long OpenSSL_version_num(void) { return OPENSSL_VERSION_NUMBER; } unsigned int OPENSSL_version_major(void) { return OPENSSL_VERSION_MAJOR; } unsigned int OPENSSL_version_minor(void) { return OPENSSL_VERSION_MINOR; } unsigned int OPENSSL_version_patch(void) { return OPENSSL_VERSION_PATCH; } const char *OPENSSL_version_pre_release(void) { return OPENSSL_VERSION_PRE_RELEASE_STR; } const char *OPENSSL_version_build_metadata(void) { return OPENSSL_VERSION_BUILD_METADATA_STR; } extern char ossl_cpu_info_str[]; const char *OpenSSL_version(int t) { switch (t) { case OPENSSL_VERSION: return OPENSSL_VERSION_TEXT; case OPENSSL_VERSION_STRING: return OPENSSL_VERSION_STR; case OPENSSL_FULL_VERSION_STRING: return OPENSSL_FULL_VERSION_STR; case OPENSSL_BUILT_ON: return DATE; case OPENSSL_CFLAGS: return compiler_flags; case OPENSSL_PLATFORM: return PLATFORM; case OPENSSL_DIR: #ifdef OPENSSLDIR return "OPENSSLDIR: \"" OPENSSLDIR "\""; #else return "OPENSSLDIR: N/A"; #endif case OPENSSL_ENGINES_DIR: #ifdef ENGINESDIR return "ENGINESDIR: \"" ENGINESDIR "\""; #else return "ENGINESDIR: N/A"; #endif case OPENSSL_MODULES_DIR: #ifdef MODULESDIR return "MODULESDIR: \"" MODULESDIR "\""; #else return "MODULESDIR: N/A"; #endif case OPENSSL_CPU_INFO: if (OPENSSL_info(OPENSSL_INFO_CPU_SETTINGS) != NULL) return ossl_cpu_info_str; else return "CPUINFO: N/A"; } return "not available"; }
/* * opencog/embodiment/Control/Procedure/ComboInterpreter.h * * Copyright (C) 2002-2009 Novamente LLC * All Rights Reserved * Author(s): Novamente team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License v3 as * published by the Free Software Foundation and including the exceptions * at http://opencog.org/wiki/Licenses * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program; if not, write to: * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef _COMBO_INTERPRETER_H #define _COMBO_INTERPRETER_H #include <opencog/comboreduct/combo/vertex.h> #include <opencog/comboreduct/combo/variable_unifier.h> #include <opencog/embodiment/Control/PerceptionActionInterface/PAI.h> #include <opencog/embodiment/RuleValidation/VirtualWorldData/VirtualWorldState.h> #include <opencog/embodiment/WorldWrapper/PAIWorldWrapper.h> #include <opencog/embodiment/WorldWrapper/RuleValidationWorldWrapper.h> #include "RunningProcedureId.h" #include "RunningComboProcedure.h" #include <vector> #include <boost/noncopyable.hpp> #include <opencog/server/CogServer.h> #include <opencog/embodiment/Control/MessagingSystem/NetworkElement.h> namespace Procedure { typedef std::map<RunningProcedureId, RunningComboProcedure> Map; typedef std::vector<Map::iterator> Vec; // class DonePred : public std::unary_function<Vec::iterator, bool> { private: std::set<RunningProcedureId> _set; public: explicit DonePred(const std::set<RunningProcedureId>& s) : _set(s) {} // return true if the element is not in the set and false otherwise. // This will be used to split the predicates that are not finished yet // from the ones that already finished and must be removed from the // running procedure list bool operator()(Map::iterator& elem) { return _set.find((*elem).first) == _set.end(); } }; // DoneSet // class ComboInterpreter : public boost::noncopyable { public: ComboInterpreter(PerceptionActionInterface::PAI& p, opencog::RandGen& rng); ComboInterpreter(VirtualWorldData::VirtualWorldState& v, opencog::RandGen& rng); virtual ~ComboInterpreter(); //run executes a single action plan of some procedure (if any are ready) void run(MessagingSystem::NetworkElement *ne); //add a procedure to be run by the interpreter RunningProcedureId runProcedure(const combo::combo_tree& tr, const std::vector<combo::vertex>& arguments); //add a procedure to be run by the interpreter with variable unifier RunningProcedureId runProcedure(const combo::combo_tree& tr, const std::vector<combo::vertex>& arguments, combo::variable_unifier& vu); bool isFinished(RunningProcedureId id); // Note: this will return false if the stopProcedure() method was previously called for this same procedure id, // even if the procedure execution has failed before bool isFailed(RunningProcedureId id); // Get the result of the procedure with the given id // Can be called only if the following conditions are true: // - procedure execution is finished (checked by isFinished() method) // - procedure execution has not failed (checked by isFailed() method) // - procedure execution was not stopped (by calling stopProcedure() method) combo::vertex getResult(RunningProcedureId id); // Get the result of the variable unification carried within the procedure // execution. // Can be called only if the following conditions are true: // - procedure execution is finished (checked by isFinished() method) // - procedure execution has not failed (checked by isFailed() method) // - procedure execution was not stopped (by calling stopProcedure() method) combo::variable_unifier& getUnifierResult(RunningProcedureId id); // makes the procedure with the given id to stop and remove it from the interpreter void stopProcedure(RunningProcedureId id); protected: typedef std::set<RunningProcedureId> Set; typedef std::map<RunningProcedureId, combo::vertex> ResultMap; typedef std::map<RunningProcedureId, combo::variable_unifier> UnifierResultMap; opencog::RandGen& rng; // WorldWrapper::PAIWorldWrapper _ww; WorldWrapper::WorldWrapperBase * _ww; Map _map; Vec _vec; Set _failed; ResultMap _resultMap; UnifierResultMap _unifierResultMap; unsigned long _next; }; // ComboInterpreter } //~namespace Procedure #endif
/** ****************************************************************************** * @file USB_Host/DynamicSwitch_Standalon/Inc/lcd_log_conf.h * @author MCD Application Team * @version V1.0.3 * @date 29-January-2016 * @brief LCD Log configuration file. ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2> * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of STMicroelectronics nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************** */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __LCD_LOG_CONF_H #define __LCD_LOG_CONF_H /* Includes ------------------------------------------------------------------*/ #include "stm32469i_discovery_lcd.h" #include "stm32469i_discovery.h" #include <stdio.h> /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ /* Define the LCD default text color */ #define LCD_LOG_DEFAULT_COLOR LCD_COLOR_WHITE /* Comment the line below to disable the scroll back and forward features */ #define LCD_SCROLL_ENABLED 1 #define LCD_LOG_HEADER_FONT Font16 #define LCD_LOG_FOOTER_FONT Font16 #define LCD_LOG_TEXT_FONT Font16 /* Define the LCD LOG Color */ #define LCD_LOG_BACKGROUND_COLOR LCD_COLOR_BLACK #define LCD_LOG_TEXT_COLOR LCD_COLOR_WHITE #define LCD_LOG_SOLID_BACKGROUND_COLOR LCD_COLOR_BLUE #define LCD_LOG_SOLID_TEXT_COLOR LCD_COLOR_WHITE /* Define the cache depth */ #define CACHE_SIZE 100 #define YWINDOW_SIZE 10 #if (YWINDOW_SIZE > 14) #error "Wrong YWINDOW SIZE" #endif /* Redirect the printf to the LCD */ #ifdef __GNUC__ /* With GCC/RAISONANCE, small printf (option LD Linker->Libraries->Small printf set to 'Yes') calls __io_putchar() */ #define LCD_LOG_PUTCHAR int __io_putchar(int ch) #else #define LCD_LOG_PUTCHAR int fputc(int ch, FILE *f) #endif /* __GNUC__ */ /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ #endif /* __LCD_LOG_CONF_H */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
// OCC_2dView.h: interface for the OCC_2dView class. // ////////////////////////////////////////////////////////////////////// #if !defined(AFX_OCC_2dVIEW_H__2E048CC9_38F9_11D7_8611_0060B0EE281E__INCLUDED_) #define AFX_OCC_2dVIEW_H__2E048CC9_38F9_11D7_8611_0060B0EE281E__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include "OCC_BaseView.h" #include "OCC_2dDoc.h" #include "Resource2d/RectangularGrid.h" #include "Resource2d/CircularGrid.h" enum CurrentAction2d { CurAction2d_Nothing, CurAction2d_DynamicZooming, CurAction2d_WindowZooming, CurAction2d_DynamicPanning, CurAction2d_GlobalPanning, }; class AFX_EXT_CLASS OCC_2dView : public OCC_BaseView { DECLARE_DYNCREATE(OCC_2dView) public: OCC_2dView(); virtual ~OCC_2dView(); CDocument* GetDocument(); Handle_V2d_View& GetV2dView() {return myV2dView;}; void FitAll(); // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(OCC_2dView) public: virtual void OnDraw(CDC* pDC); // overridden to draw this view virtual BOOL PreCreateWindow(CREATESTRUCT& cs); protected: virtual void OnInitialUpdate(); // called first time after construct //}}AFX_VIRTUAL #ifdef _DEBUG virtual void AssertValid() const; virtual void Dump(CDumpContext& dc) const; #endif protected: // Generated message map functions protected: //{{AFX_MSG(OCC_2dView) // NOTE - the ClassWizard will add and remove member functions here. // DO NOT EDIT what you see in these blocks of generated code ! afx_msg void OnFileExportImage(); afx_msg void OnBUTTONGridRectLines(); afx_msg void OnBUTTONGridRectPoints(); afx_msg void OnBUTTONGridCircLines(); afx_msg void OnBUTTONGridCircPoints(); afx_msg void OnBUTTONGridValues(); afx_msg void OnUpdateBUTTONGridValues(CCmdUI* pCmdUI); afx_msg void OnBUTTONGridCancel(); afx_msg void OnUpdateBUTTONGridCancel(CCmdUI* pCmdUI); afx_msg void OnLButtonDown(UINT nFlags, CPoint point); afx_msg void OnLButtonUp(UINT nFlags, CPoint point); afx_msg void OnMButtonDown(UINT nFlags, CPoint point); afx_msg void OnMButtonUp(UINT nFlags, CPoint point); afx_msg void OnRButtonDown(UINT nFlags, CPoint point); afx_msg void OnRButtonUp(UINT nFlags, CPoint point); afx_msg void OnMouseMove(UINT nFlags, CPoint point); afx_msg void OnSize(UINT nType, int cx, int cy); afx_msg void OnBUTTONFitAll(); afx_msg void OnBUTTONGlobPanning(); afx_msg void OnBUTTONPanning(); afx_msg void OnBUTTONZoomProg(); afx_msg void OnBUTTONZoomWin(); afx_msg void OnUpdateBUTTON2DGlobPanning(CCmdUI* pCmdUI); afx_msg void OnUpdateBUTTON2DPanning(CCmdUI* pCmdUI); afx_msg void OnUpdateBUTTON2DZoomProg(CCmdUI* pCmdUI); afx_msg void OnUpdateBUTTON2DZoomWin(CCmdUI* pCmdUI); afx_msg void OnChangeBackground(); //}}AFX_MSG DECLARE_MESSAGE_MAP() protected: CurrentAction2d myCurrentMode; Standard_Integer myXmin; Standard_Integer myYmin; Standard_Integer myXmax; Standard_Integer myYmax; Quantity_Factor myCurZoom; enum LineStyle { Solid, Dot, ShortDash, LongDash, Default }; CPen* m_Pen; virtual void DrawRectangle2D (const Standard_Integer MinX , const Standard_Integer MinY , const Standard_Integer MaxX , const Standard_Integer MaxY , const Standard_Boolean Draw , const LineStyle aLineStyle = Default ); virtual void DragEvent2D (const Standard_Integer x , const Standard_Integer y , const Standard_Integer TheState); virtual void InputEvent2D (const Standard_Integer x , const Standard_Integer y ); virtual void MoveEvent2D (const Standard_Integer x , const Standard_Integer y ); virtual void MultiMoveEvent2D (const Standard_Integer x , const Standard_Integer y ); virtual void MultiDragEvent2D (const Standard_Integer x , const Standard_Integer y , const Standard_Integer TheState); virtual void MultiInputEvent2D (const Standard_Integer x , const Standard_Integer y ); virtual void Popup2D (const Standard_Integer x , const Standard_Integer y ); protected: CRectangularGrid TheRectangularGridDialog; CCircularGrid TheCircularGridDialog; Handle_V2d_View myV2dView; }; #ifndef _DEBUG // debug version in 2DDisplayView.cpp inline CDocument* OCC_2dView::GetDocument() { return m_pDocument; } #endif #endif // !defined(AFX_OCC_2dVIEW_H__2E048CC9_38F9_11D7_8611_0060B0EE281E__INCLUDED_)
#pragma once class cosmos; #include "game/transcendental/step_declaration.h" class position_copying_system { public: void update_transforms(const logic_step step); };
/* Copyright (c) 2014-2022 AscEmu Team <http://www.ascemu.org> This file is released under the MIT license. See README-MIT for more information. */ #pragma once #include <cstdint> #include "ManagedPacket.h" #include "WorldPacket.h" namespace AscEmu::Packets { class CmsgQuestgiverRequestReward : public ManagedPacket { public: WoWGuid questgiverGuid; uint32_t questId; CmsgQuestgiverRequestReward() : CmsgQuestgiverRequestReward(0, 0) { } CmsgQuestgiverRequestReward(uint64_t questgiverGuid, uint32_t questId) : ManagedPacket(CMSG_QUESTGIVER_REQUEST_REWARD, 12), questgiverGuid(questgiverGuid), questId(questId) { } bool internalSerialise(WorldPacket& /*packet*/) override { return false; } bool internalDeserialise(WorldPacket& packet) override { uint64_t unpackedGuid; packet >> unpackedGuid >> questId; questgiverGuid.Init(unpackedGuid); return true; } }; }
/* Copyright (C) 2018 by Claude SIMON (http://zeusw.org/epeios/contact.html). This file is part of XDHWebQ. XDHWebQ is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. XDHWebQ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with XDHWebQ. If not, see <http://www.gnu.org/licenses/>. */ #ifndef REGISTRY_INC_ # define REGISTRY_INC_ # include "xdwrgstry.h" namespace registry { using namespace xdwrgstry; namespace parameter { using namespace xdwrgstry::parameter; } namespace definition { using namespace xdwrgstry::definition; } } #endif
/* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-IEs" * found in "../support/s1ap-r16.4.0/36413-g40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps -no-gen-BER -no-gen-XER -no-gen-OER -no-gen-UPER` */ #ifndef _S1AP_LastVisitedGERANCellInformation_H_ #define _S1AP_LastVisitedGERANCellInformation_H_ #include <asn_application.h> /* Including external dependencies */ #include <NULL.h> #include <constr_CHOICE.h> #ifdef __cplusplus extern "C" { #endif /* Dependencies */ typedef enum S1AP_LastVisitedGERANCellInformation_PR { S1AP_LastVisitedGERANCellInformation_PR_NOTHING, /* No components present */ S1AP_LastVisitedGERANCellInformation_PR_undefined /* Extensions may appear below */ } S1AP_LastVisitedGERANCellInformation_PR; /* S1AP_LastVisitedGERANCellInformation */ typedef struct S1AP_LastVisitedGERANCellInformation { S1AP_LastVisitedGERANCellInformation_PR present; union S1AP_LastVisitedGERANCellInformation_u { NULL_t undefined; /* * This type is extensible, * possible extensions are below. */ } choice; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } S1AP_LastVisitedGERANCellInformation_t; /* Implementation */ extern asn_TYPE_descriptor_t asn_DEF_S1AP_LastVisitedGERANCellInformation; extern asn_CHOICE_specifics_t asn_SPC_S1AP_LastVisitedGERANCellInformation_specs_1; extern asn_TYPE_member_t asn_MBR_S1AP_LastVisitedGERANCellInformation_1[1]; extern asn_per_constraints_t asn_PER_type_S1AP_LastVisitedGERANCellInformation_constr_1; #ifdef __cplusplus } #endif #endif /* _S1AP_LastVisitedGERANCellInformation_H_ */ #include <asn_internal.h>
//Copyright (c) 2018 Ultimaker B.V. //CuraEngine is released under the terms of the AGPLv3 or higher. #ifndef INFILL_SUBDIVCUBE_H #define INFILL_SUBDIVCUBE_H #include "../settings/types/Ratio.h" #include "../utils/IntPoint.h" #include "../utils/Point3.h" namespace cura { struct LayerIndex; class Polygons; class SliceMeshStorage; class SubDivCube { public: /*! * Constructor for SubDivCube. Recursively calls itself eight times to flesh out the octree. * \param mesh contains infill layer data and settings * \param my_center the center of the cube * \param depth the recursion depth of the cube (0 is most recursed) */ SubDivCube(SliceMeshStorage& mesh, Point3& center, size_t depth); ~SubDivCube(); //!< destructor (also destroys children) /*! * Precompute the octree of subdivided cubes * \param mesh contains infill layer data and settings */ static void precomputeOctree(SliceMeshStorage& mesh, const Point& infill_origin); /*! * Generates the lines of subdivision of the specific cube at the specific layer. It recursively calls itself, so it ends up drawing all the subdivision lines of sub-cubes too. * \param z the specified layer height * \param result (output) The resulting lines */ void generateSubdivisionLines(const coord_t z, Polygons& result); private: /*! * Generates the lines of subdivision of the specific cube at the specific layer. It recursively calls itself, so it ends up drawing all the subdivision lines of sub-cubes too. * \param z the specified layer height * \param result (output) The resulting lines * \param directional_line_groups Array of 3 times a polylines. Used to keep track of line segments that are all pointing the same direction for line segment combining */ void generateSubdivisionLines(const coord_t z, Polygons (&directional_line_groups)[3]); struct CubeProperties { coord_t side_length; //!< side length of cubes coord_t height; //!< height of cubes based. This is the distance from one point of a cube to its 3d opposite. coord_t square_height; //!< square cut across lengths. This is the diagonal distance across a face of the cube. coord_t max_draw_z_diff; //!< maximum draw z differences. This is the maximum difference in z at which lines need to be drawn. coord_t max_line_offset; //!< maximum line offsets. This is the maximum distance at which subdivision lines should be drawn from the 2d cube center. }; /*! * Rotates a point 120 degrees about the origin. * \param target the point to rotate. */ static void rotatePoint120(Point& target); /*! * Rotates a point to align it with the orientation of the infill. * \param target the point to rotate. */ static void rotatePointInitial(Point& target); /*! * Determines if a described theoretical cube should be subdivided based on if a sphere that encloses the cube touches the infill mesh. * \param mesh contains infill layer data and settings * \param center the center of the described cube * \param radius the radius of the enclosing sphere * \return the described cube should be subdivided */ static bool isValidSubdivision(SliceMeshStorage& mesh, Point3& center, coord_t radius); /*! * Finds the distance to the infill border at the specified layer from the specified point. * \param mesh contains infill layer data and settings * \param layer_nr the number of the specified layer * \param location the location of the specified point * \param[out] distance2 the squared distance to the infill border * \return Code 0: outside, 1: inside, 2: boundary does not exist at specified layer */ static coord_t distanceFromPointToMesh(SliceMeshStorage& mesh, const LayerIndex layer_nr, Point& location, coord_t* distance2); /*! * Adds the defined line to the specified polygons. It assumes that the specified polygons are all parallel lines. Combines line segments with touching ends closer than epsilon. * \param[out] group the polygons to add the line to * \param from the first endpoint of the line * \param to the second endpoint of the line */ void addLineAndCombine(Polygons& group, Point from, Point to); size_t depth; //!< the recursion depth of the cube (0 is most recursed) Point3 center; //!< center location of the cube in absolute coordinates SubDivCube* children[8] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}; //!< pointers to this cube's eight octree children static std::vector<CubeProperties> cube_properties_per_recursion_step; //!< precomputed array of basic properties of cubes based on recursion depth. static Ratio radius_multiplier; //!< multiplier for the bounding radius when determining if a cube should be subdivided static Point3Matrix rotation_matrix; //!< The rotation matrix to get from axis aligned cubes to cubes standing on a corner point aligned with the infill_angle static PointMatrix infill_rotation_matrix; //!< Horizontal rotation applied to infill static coord_t radius_addition; //!< addition to the bounding radius when determining if a cube should be subdivided }; } #endif //INFILL_SUBDIVCUBE_H
// License: MIT #pragma once //\brief: TypeFlags, mostly used to define updatePackets. //\note: check out class inheritance. it is not true that every unit is "just" a creature. /* object - unit - - player - - creature - - - pet <- probably wrong inheritance from summon not from creature - - - totem <- probably wrong inheritance from summon not from creature - - - vehicle - - - summon (pets and totems are always summons) - - - - pet - - - - totem - gameobject - dynamicobject - corpse - item - - container */ enum TYPE { TYPE_OBJECT = 1, TYPE_ITEM = 2, TYPE_CONTAINER = 4, TYPE_UNIT = 8, TYPE_PLAYER = 16, TYPE_GAMEOBJECT = 32, TYPE_DYNAMICOBJECT = 64, TYPE_CORPSE = 128, //TYPE_AIGROUP = 256, not used //TYPE_AREATRIGGER = 512, not used //TYPE_IN_GUILD = 1024 not used }; //\todo: remove these typeIds and use flags instead. No reason to use two different enums to define a object type. enum TYPEID { TYPEID_OBJECT = 0, TYPEID_ITEM = 1, TYPEID_CONTAINER = 2, TYPEID_UNIT = 3, TYPEID_PLAYER = 4, TYPEID_GAMEOBJECT = 5, TYPEID_DYNAMICOBJECT = 6, TYPEID_CORPSE = 7, //TYPEID_AIGROUP = 8, not used //TYPEID_AREATRIGGER = 9 not used (WoWTrigger is a thing on Cata) }; #ifdef AE_CATA enum OBJECT_UPDATE_TYPE { UPDATETYPE_VALUES = 0, UPDATETYPE_CREATE_OBJECT = 1, UPDATETYPE_CREATE_OBJECT2 = 2, UPDATETYPE_OUT_OF_RANGE_OBJECTS = 3 }; #else enum OBJECT_UPDATE_TYPE { UPDATETYPE_VALUES = 0, UPDATETYPE_MOVEMENT = 1, UPDATETYPE_CREATE_OBJECT = 2, UPDATETYPE_CREATE_YOURSELF = 3, UPDATETYPE_OUT_OF_RANGE_OBJECTS = 4 }; #endif enum PHASECOMMANDS { PHASE_SET = 0, /// overwrites the phase value with the supplied one PHASE_ADD = 1, /// adds the new bits to the current phase value PHASE_DEL = 2, /// removes the given bits from the current phase value PHASE_RESET = 3 /// sets the default phase of 1, same as PHASE_SET with 1 as the new value };
/* * This file is part of Kotaka, a mud library for DGD * http://github.com/shentino/kotaka * * Copyright (C) 2018, 2021 Raymond Jennings * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <kotaka/paths/account.h> #include <kotaka/paths/verb.h> inherit LIB_VERB; inherit "/lib/sort"; inherit "~/lib/banlist"; inherit "~System/lib/string/align"; string *query_parse_methods() { return ({ "raw" }); } int compare_sites(string a, string b) { int o1a, o2a, o3a, o4a, cidra; int o1b, o2b, o3b, o4b, cidrb; sscanf(a, "%d.%d.%d.%d/%d", o1a, o2a, o3a, o4a, cidra); sscanf(b, "%d.%d.%d.%d/%d", o1b, o2b, o3b, o4b, cidrb); if (o1a < o1b) { return -1; } if (o1a > o1b) { return 1; } if (o2a < o2b) { return -1; } if (o2a > o2b) { return 1; } if (o3a < o3b) { return -1; } if (o3a > o3b) { return 1; } if (o4a < o4b) { return -1; } if (o4a > o4b) { return 1; } if (cidra < cidrb) { return -1; } if (cidra > cidrb) { return 1; } return 0; } string query_help_title() { return "Sitebans"; } string *query_help_contents() { return ({ "Lists sitebans" }); } void main(object actor, mapping roles) { string *sites; object user; int sz; user = query_user(); if (user->query_class() < 3) { send_out("You do not have sufficient access rights to list sitebans.\n"); return; } if (roles["raw"]) { send_out("Usage: sitebans\n"); return; } sites = BAND->query_sitebans(); sz = sizeof(sites); qsort(sites, 0, sz, "compare_sites"); if (sz) { mapping *bans; int i; bans = allocate(sz); for (i = 0; i < sz; i++) { mapping ban; ban = BAND->query_siteban(sites[i]); if (!ban) { sites[i] = nil; continue; } bans[i] = ban; } sites -= ({ nil }); bans -= ({ nil }); send_out(print_bans("Site", sites, bans)); send_out("\n"); } else { send_out("There are no banned sites.\n"); } }
// regversion.c - Oniguruma (regular expression library) // Copyright (c) 2002-2020 K.Kosako All rights reserved. // #include "regint.h" #pragma hdrstop extern const char * onig_version(void) { static char s[12]; /*xsnprintf*/slsprintf_s(s, sizeof(s), "%d.%d.%d", ONIGURUMA_VERSION_MAJOR, ONIGURUMA_VERSION_MINOR, ONIGURUMA_VERSION_TEENY); return s; } extern const char * onig_copyright(void) { static char s[58]; /*xsnprintf*/slsprintf_s(s, sizeof(s), "Oniguruma %d.%d.%d : Copyright (C) 2002-2018 K.Kosako", ONIGURUMA_VERSION_MAJOR, ONIGURUMA_VERSION_MINOR, ONIGURUMA_VERSION_TEENY); return s; }
/* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "NGAP-IEs" * found in "../support/ngap-r16.4.0/38413-g40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps -no-gen-BER -no-gen-XER -no-gen-OER -no-gen-UPER` */ #ifndef _NGAP_RATRestrictions_H_ #define _NGAP_RATRestrictions_H_ #include <asn_application.h> /* Including external dependencies */ #include <asn_SEQUENCE_OF.h> #include <constr_SEQUENCE_OF.h> #ifdef __cplusplus extern "C" { #endif /* Forward declarations */ struct NGAP_RATRestrictions_Item; /* NGAP_RATRestrictions */ typedef struct NGAP_RATRestrictions { A_SEQUENCE_OF(struct NGAP_RATRestrictions_Item) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } NGAP_RATRestrictions_t; /* Implementation */ extern asn_TYPE_descriptor_t asn_DEF_NGAP_RATRestrictions; extern asn_SET_OF_specifics_t asn_SPC_NGAP_RATRestrictions_specs_1; extern asn_TYPE_member_t asn_MBR_NGAP_RATRestrictions_1[1]; extern asn_per_constraints_t asn_PER_type_NGAP_RATRestrictions_constr_1; #ifdef __cplusplus } #endif #endif /* _NGAP_RATRestrictions_H_ */ #include <asn_internal.h>
#pragma once #include <memory> #include "FullBlock.h" #include "BlockEntity.h" class BlockSource; class BlockPos; class BlockSourceListener { public: virtual ~BlockSourceListener(); virtual void onSourceCreated(BlockSource &); virtual void onSourceDestroyed(BlockSource &); virtual void onBlocksDirty(BlockSource &, int, int, int, int, int, int); virtual void onAreaChanged(BlockSource &, BlockPos const &, BlockPos const &); virtual void onBlockChanged(BlockSource &, BlockPos const &, FullBlock, FullBlock, int); virtual void onBrightnessChanged(BlockSource &, BlockPos const &); virtual void onBlockEntityChanged(BlockSource &, BlockEntity &); virtual void onBlockEntityRemoved(BlockSource &, std::unique_ptr<BlockEntity>); virtual void onBlockEvent(BlockSource &, int, int, int, int, int); };
#ifndef __SEGMENTER_H__ #define __SEGMENTER_H__ // includes #include "media_set.h" #include "common.h" // constants #define INVALID_SEGMENT_COUNT UINT_MAX #define SEGMENT_FROM_TIMESTAMP_MARGIN (100) // in case of clipping, a segment may start up to 2 frames before the segment boundary #define MIN_SEGMENT_DURATION (500) #define MAX_SEGMENT_DURATION (600000) // enums enum { MDP_MAX, MDP_MIN, }; // typedefs struct segmenter_conf_s; typedef struct segmenter_conf_s segmenter_conf_t; typedef struct { uint32_t segment_index; uint32_t repeat_count; uint64_t time; uint64_t duration; bool_t discontinuity; } segment_duration_item_t; typedef struct { segment_duration_item_t* items; uint32_t item_count; uint32_t segment_count; uint32_t timescale; uint32_t discontinuities; uint64_t start_time; uint64_t end_time; uint64_t duration; } segment_durations_t; typedef struct { request_context_t* request_context; segmenter_conf_t* conf; media_clip_timing_t timing; uint32_t segment_index; int64_t first_key_frame_offset; vod_array_part_t* key_frame_durations; bool_t allow_last_segment; // no discontinuity uint64_t last_segment_end; // discontinuity uint32_t initial_segment_index; // gop uint64_t time; } get_clip_ranges_params_t; typedef struct { uint32_t min_clip_index; uint32_t max_clip_index; uint64_t clip_time; media_range_t* clip_ranges; uint32_t clip_count; uint32_t clip_relative_segment_index; } get_clip_ranges_result_t; typedef uint32_t (*segmenter_get_segment_count_t)(segmenter_conf_t* conf, uint64_t duration_millis); typedef vod_status_t (*segmenter_get_segment_durations_t)( request_context_t* request_context, segmenter_conf_t* conf, media_set_t* media_set, media_sequence_t* sequence, uint32_t media_type, segment_durations_t* result); struct segmenter_conf_s { // config fields uintptr_t segment_duration; vod_array_t* bootstrap_segments; // array of vod_str_t bool_t align_to_key_frames; intptr_t live_window_duration; segmenter_get_segment_count_t get_segment_count; // last short / last long / last rounded segmenter_get_segment_durations_t get_segment_durations; // estimate / accurate vod_uint_t manifest_duration_policy; uintptr_t gop_look_behind; uintptr_t gop_look_ahead; // derived fields uint32_t parse_type; uint32_t bootstrap_segments_count; uint32_t* bootstrap_segments_durations; uint32_t max_segment_duration; uint32_t max_bootstrap_segment_duration; uint32_t bootstrap_segments_total_duration; uint32_t* bootstrap_segments_start; uint32_t* bootstrap_segments_mid; uint32_t* bootstrap_segments_end; }; typedef struct { request_context_t* request_context; vod_array_part_t* part; int64_t* cur_pos; int64_t offset; } align_to_key_frames_context_t; // init vod_status_t segmenter_init_config(segmenter_conf_t* conf, vod_pool_t* pool); // get segment count modes uint32_t segmenter_get_segment_count_last_short(segmenter_conf_t* conf, uint64_t duration_millis); uint32_t segmenter_get_segment_count_last_long(segmenter_conf_t* conf, uint64_t duration_millis); uint32_t segmenter_get_segment_count_last_rounded(segmenter_conf_t* conf, uint64_t duration_millis); // key frames int64_t segmenter_align_to_key_frames( align_to_key_frames_context_t* context, int64_t offset, int64_t limit); // live window vod_status_t segmenter_get_live_window( request_context_t* request_context, segmenter_conf_t* conf, media_set_t* media_set, bool_t parse_all_clips, get_clip_ranges_result_t* clip_ranges, uint32_t* base_clip_index); // manifest duration uint64_t segmenter_get_total_duration( segmenter_conf_t* conf, media_set_t* media_set, media_sequence_t* sequence, media_sequence_t* sequences_end, uint32_t media_type); // get segment durations modes vod_status_t segmenter_get_segment_durations_estimate( request_context_t* request_context, segmenter_conf_t* conf, media_set_t* media_set, media_sequence_t* sequence, uint32_t media_type, segment_durations_t* result); vod_status_t segmenter_get_segment_durations_accurate( request_context_t* request_context, segmenter_conf_t* conf, media_set_t* media_set, media_sequence_t* sequence, uint32_t media_type, segment_durations_t* result); // get segment index uint32_t segmenter_get_segment_index_no_discontinuity( segmenter_conf_t* conf, uint64_t time_millis); vod_status_t segmenter_get_segment_index_discontinuity( request_context_t* request_context, segmenter_conf_t* conf, uint32_t initial_segment_index, media_clip_timing_t* timing, uint64_t time_millis, uint32_t* result); // get start end ranges vod_status_t segmenter_get_start_end_ranges_gop( get_clip_ranges_params_t* params, get_clip_ranges_result_t* result); vod_status_t segmenter_get_start_end_ranges_no_discontinuity( get_clip_ranges_params_t* params, get_clip_ranges_result_t* result); vod_status_t segmenter_get_start_end_ranges_discontinuity( get_clip_ranges_params_t* params, get_clip_ranges_result_t* result); #endif // __SEGMENTER_H__
// // Copyright (C) 2015-2016 University of Amsterdam // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. // #ifndef INTEGERINFORECORD_H #define INTEGERINFORECORD_H #include "datainforecord.h" namespace spss { /** * @brief The IntegerInfoRecord class * * Associated with record type rectype_value_labels = rectype_meta_data = 7, sub type recsubtype_integer = 3, */ class IntegerInfoRecord : public DataInfoRecord<recsubtype_integer> { public: /** * @brief IntegerInfoRecord default Ctor */ IntegerInfoRecord(); /** * @brief IntegerInfoRecord Ctor * @param Converters fixer Fixes endainness. * @param fileSubType The record subtype value, as found in the file. * @param fileType The record type value, as found in the file. * @param fromStream The file to read from. * * NB This constructor will modify the contents of fixer! */ IntegerInfoRecord(NumericConverter &fixer, RecordSubTypes fileSubType, RecordTypes fileType, SPSSStream &fromStream); virtual ~IntegerInfoRecord(); /* * Data! */ SPSSIMPORTER_READ_ATTRIB(int32_t, version_major) SPSSIMPORTER_READ_ATTRIB(int32_t, version_minor) SPSSIMPORTER_READ_ATTRIB(int32_t, version_revision) SPSSIMPORTER_READ_ATTRIB(int32_t, machine_code) SPSSIMPORTER_READ_ATTRIB(int32_t, floating_point_rep) SPSSIMPORTER_READ_ATTRIB(int32_t, compression_code) SPSSIMPORTER_READ_ATTRIB(int32_t, endianness) SPSSIMPORTER_READ_ATTRIB(int32_t, character_code) /** * @brief process Manipulates columns by adding the contents of thie record. * @param columns * * Implematations should examine columns to determine the record history. */ virtual void process(SPSSColumns & columns); }; } #endif // INTEGERINFORECORD_H
/* * (c) Copyright Ascensio System SIA 2010-2019 * * This program is a free software product. You can redistribute it and/or * modify it under the terms of the GNU Affero General Public License (AGPL) * version 3 as published by the Free Software Foundation. In accordance with * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect * that Ascensio System SIA expressly excludes the warranty of non-infringement * of any third-party rights. * * This program is distributed WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html * * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha * street, Riga, Latvia, EU, LV-1050. * * The interactive user interfaces in modified source and object code versions * of the Program must display Appropriate Legal Notices, as required under * Section 5 of the GNU AGPL version 3. * * Pursuant to Section 7(b) of the License you must retain the original Product * logo when distributing the program. Pursuant to Section 7(e) we decline to * grant you any rights under trademark law for use of our trademarks. * * All the Product's GUI elements, including illustrations and icon sets, as * well as technical writing content are licensed under the terms of the * Creative Commons Attribution-ShareAlike 4.0 International. See the License * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode * */ #ifndef _BUILD_BASE64_CROSSPLATFORM_DEFINE #define _BUILD_BASE64_CROSSPLATFORM_DEFINE #include <stdio.h> #include <limits.h> #include "Types.h" #include "../../Common/kernel_config.h" namespace NSBase64 { const int B64_BASE64_FLAG_NONE = 0; const int B64_BASE64_FLAG_NOPAD = 1; const int B64_BASE64_FLAG_NOCRLF = 2; #define _BASE64_INT_MAX 2147483647 KERNEL_DECL int Base64EncodeGetRequiredLength(int nSrcLen, DWORD dwFlags = B64_BASE64_FLAG_NONE); KERNEL_DECL int Base64DecodeGetRequiredLength(int nSrcLen); KERNEL_DECL int Base64Encode(const BYTE *pbSrcData, int nSrcLen, BYTE* szDest, int *pnDestLen, DWORD dwFlags = B64_BASE64_FLAG_NONE); KERNEL_DECL int DecodeBase64Char(unsigned int ch); KERNEL_DECL int Base64Decode(const char* szSrc, int nSrcLen, BYTE *pbDest, int *pnDestLen); } #endif//_BUILD_BASE64_CROSSPLATFORM_DEFINE
/* * AscEmu Framework based on ArcEmu MMORPG Server * Copyright (c) 2014-2021 AscEmu Team <http://www.ascemu.org> * Copyright (C) 2005-2011 MaNGOS <http://getmangos.com/> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef WDTFILE_H #define WDTFILE_H #include "mpq_libmpq04.h" #include <string> class ADTFile; class WDTFile { public: WDTFile(char* file_name, char* file_name1); ~WDTFile(void); bool init(char* map_id, unsigned int mapID); ADTFile* GetMap(int x, int z); std::string* gWmoInstansName; int gnWMO; private: MPQFile WDT; std::string filename; }; #endif //WDTFILE_H
/* $OpenBSD: bcrypt_pbkdf.c,v 1.4 2013/07/29 00:55:53 tedu Exp $ */ /* * Copyright (c) 2013 Ted Unangst <tedu@openbsd.org> * * 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. */ #ifndef HAVE_BCRYPT_PBKDF #include "libssh2_priv.h" #include <stdlib.h> #include <sys/types.h> #ifdef HAVE_SYS_PARAM_H #include <sys/param.h> #endif #include "blf.h" #define MINIMUM(a,b) (((a) < (b)) ? (a) : (b)) /* * pkcs #5 pbkdf2 implementation using the "bcrypt" hash * * The bcrypt hash function is derived from the bcrypt password hashing * function with the following modifications: * 1. The input password and salt are preprocessed with SHA512. * 2. The output length is expanded to 256 bits. * 3. Subsequently the magic string to be encrypted is lengthened and modified * to "OxychromaticBlowfishSwatDynamite" * 4. The hash function is defined to perform 64 rounds of initial state * expansion. (More rounds are performed by iterating the hash.) * * Note that this implementation pulls the SHA512 operations into the caller * as a performance optimization. * * One modification from official pbkdf2. Instead of outputting key material * linearly, we mix it. pbkdf2 has a known weakness where if one uses it to * generate (i.e.) 512 bits of key material for use as two 256 bit keys, an * attacker can merely run once through the outer loop below, but the user * always runs it twice. Shuffling output bytes requires computing the * entirety of the key material to assemble any subkey. This is something a * wise caller could do; we just do it for you. */ #define BCRYPT_BLOCKS 8 #define BCRYPT_HASHSIZE (BCRYPT_BLOCKS * 4) static void bcrypt_hash(uint8_t *sha2pass, uint8_t *sha2salt, uint8_t *out) { blf_ctx state; uint8_t ciphertext[BCRYPT_HASHSIZE] = "OxychromaticBlowfishSwatDynamite"; uint32_t cdata[BCRYPT_BLOCKS]; int i; uint16_t j; size_t shalen = SHA512_DIGEST_LENGTH; /* key expansion */ Blowfish_initstate(&state); Blowfish_expandstate(&state, sha2salt, shalen, sha2pass, shalen); for(i = 0; i < 64; i++) { Blowfish_expand0state(&state, sha2salt, shalen); Blowfish_expand0state(&state, sha2pass, shalen); } /* encryption */ j = 0; for(i = 0; i < BCRYPT_BLOCKS; i++) cdata[i] = Blowfish_stream2word(ciphertext, sizeof(ciphertext), &j); for(i = 0; i < 64; i++) blf_enc(&state, cdata, sizeof(cdata) / sizeof(uint64_t)); /* copy out */ for(i = 0; i < BCRYPT_BLOCKS; i++) { out[4 * i + 3] = (cdata[i] >> 24) & 0xff; out[4 * i + 2] = (cdata[i] >> 16) & 0xff; out[4 * i + 1] = (cdata[i] >> 8) & 0xff; out[4 * i + 0] = cdata[i] & 0xff; } /* zap */ _libssh2_explicit_zero(ciphertext, sizeof(ciphertext)); _libssh2_explicit_zero(cdata, sizeof(cdata)); _libssh2_explicit_zero(&state, sizeof(state)); } int bcrypt_pbkdf(const char *pass, size_t passlen, const uint8_t *salt, size_t saltlen, uint8_t *key, size_t keylen, unsigned int rounds) { uint8_t sha2pass[SHA512_DIGEST_LENGTH]; uint8_t sha2salt[SHA512_DIGEST_LENGTH]; uint8_t out[BCRYPT_HASHSIZE]; uint8_t tmpout[BCRYPT_HASHSIZE]; uint8_t *countsalt; size_t i, j, amt, stride; uint32_t count; size_t origkeylen = keylen; libssh2_sha512_ctx ctx; /* nothing crazy */ if(rounds < 1) return -1; if(passlen == 0 || saltlen == 0 || keylen == 0 || keylen > sizeof(out) * sizeof(out) || saltlen > 1<<20) return -1; countsalt = calloc(1, saltlen + 4); if(countsalt == NULL) return -1; stride = (keylen + sizeof(out) - 1) / sizeof(out); amt = (keylen + stride - 1) / stride; memcpy(countsalt, salt, saltlen); /* collapse password */ libssh2_sha512_init(&ctx); libssh2_sha512_update(ctx, pass, passlen); libssh2_sha512_final(ctx, sha2pass); /* generate key, sizeof(out) at a time */ for(count = 1; keylen > 0; count++) { countsalt[saltlen + 0] = (count >> 24) & 0xff; countsalt[saltlen + 1] = (count >> 16) & 0xff; countsalt[saltlen + 2] = (count >> 8) & 0xff; countsalt[saltlen + 3] = count & 0xff; /* first round, salt is salt */ libssh2_sha512_init(&ctx); libssh2_sha512_update(ctx, countsalt, saltlen + 4); libssh2_sha512_final(ctx, sha2salt); bcrypt_hash(sha2pass, sha2salt, tmpout); memcpy(out, tmpout, sizeof(out)); for(i = 1; i < rounds; i++) { /* subsequent rounds, salt is previous output */ libssh2_sha512_init(&ctx); libssh2_sha512_update(ctx, tmpout, sizeof(tmpout)); libssh2_sha512_final(ctx, sha2salt); bcrypt_hash(sha2pass, sha2salt, tmpout); for(j = 0; j < sizeof(out); j++) out[j] ^= tmpout[j]; } /* * pbkdf2 deviation: output the key material non-linearly. */ amt = MINIMUM(amt, keylen); for(i = 0; i < amt; i++) { size_t dest = i * stride + (count - 1); if(dest >= origkeylen) { break; } key[dest] = out[i]; } keylen -= i; } /* zap */ _libssh2_explicit_zero(out, sizeof(out)); free(countsalt); return 0; } #endif /* HAVE_BCRYPT_PBKDF */
//////////////////////////////////////////////////////////////// // // Copyright (C) 2008 Affymetrix, Inc. // // This library is free software; you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License // (version 2.1) as published by the Free Software Foundation. // // This library is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License // for more details. // // You should have received a copy of the GNU Lesser General Public License // along with this library; if not, write to the Free Software Foundation, Inc., // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // //////////////////////////////////////////////////////////////// #ifndef _FamilialMultiDataData_HEADER_ #define _FamilialMultiDataData_HEADER_ /*! \file FamilialMultiDataData.h This file provides types to store results for a familial file. */ // #include "calvin_files/parameter/src/ParameterNameValueType.h" #include "calvin_files/portability/src/AffymetrixBaseTypes.h" // #include <cstring> #include <sstream> #include <string> #include <vector> // namespace affymetrix_calvin_data { /*! Stores the segment overlap from a familial file. */ typedef struct _FamilialSegmentOverlap { /*! The type of segment; the name of the data set in which the segment appears in the CYCHP file. */ std::string segmentType; /*! The key identifying the sample from the Samples data set. */ u_int32_t referenceSampleKey; /*! The ID of the segment of the reference sample. */ std::string referenceSegmentID; /*! The key identifying the sample from the Samples data set. */ u_int32_t familialSampleKey; /*! The ID of the segment of the compare sample. */ std::string familialSegmentID; } FamilialSegmentOverlap; /*! Stores information about the sample for a familial file. */ typedef struct _FamilialSample { /*! Local arbitrary unique sample identifier used within the file. */ u_int32_t sampleKey; /*! The identifier of the ARR file associated with the sample. If no ARR file was used in generating the associated CYCHP files, this value will be the empty string. */ std::string arrID; /*! The identifier of the CYCHP file containing the sample data. */ std::string chpID; /*! The filename (not the complete path) of the CYCHP file containing the sample data. */ std::wstring chpFilename; /*! The role of the identified sample, such as “index”, “mother”, or “father”. */ std::string role; /*! The call of whether the assigned role is correct. */ bool roleValidity; /*! The confidence that the assigned role is correct */ float roleConfidence; } FamilialSample; } #endif
/* Copyright 2009 Will Stephenson <wstephenson@kde.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) version 3, or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 6 of version 3 of the license. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library. If not, see <http://www.gnu.org/licenses/>. */ #ifndef KNM_INTERNALS_UNCONFIGUREDINTERFACE_H #define KNM_INTERNALS_UNCONFIGUREDINTERFACE_H #include "activatable.h" namespace Knm { class UnconfiguredInterface : public Activatable { Q_OBJECT public: UnconfiguredInterface(const QString &deviceUni, QObject *parent); virtual ~UnconfiguredInterface(); }; } #endif // KNM_INTERNALS_UNCONFIGUREDINTERFACE_H
/* table.h - Iterative table interface. * Copyright (C) 2006 g10 Code GmbH * * This file is part of Scute. * * Scute 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. * * Scute is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, see <https://gnu.org/licenses/>. * SPDX-License-Identifier: LGPL-2.1-or-later */ #ifndef TABLE_H #define TABLE_H 1 #include <stdbool.h> #include <gpg-error.h> /* The indexed list type. */ struct scute_table; typedef struct scute_table *scute_table_t; /* TABLE interface. */ /* A table entry allocator function callback. Should return the new table entry in DATA_R. */ typedef gpg_error_t (*scute_table_alloc_cb_t) (void **data_r, void *hook); /* A table entry deallocator function callback. */ typedef void (*scute_table_dealloc_cb_t) (void *data); /* Allocate a new table and return it in TABLE_R. */ gpg_error_t scute_table_create (scute_table_t *table_r, scute_table_alloc_cb_t alloc, scute_table_dealloc_cb_t dealloc); /* Destroy the indexed list TABLE. This also calls the deallocator on all entries. */ void scute_table_destroy (scute_table_t table); /* Allocate a new table entry with a free index. Returns the index pointing to the new list entry in INDEX_R. This calls the allocator on the new entry before returning. Also returns the table entry in *DATA_R if this is not NULL. */ gpg_error_t scute_table_alloc (scute_table_t table, int *index_r, void **data_r, void *hook); /* Deallocate the list entry index. Afterwards, INDEX points to the following entry. This calls the deallocator on the entry before returning. */ void scute_table_dealloc (scute_table_t table, int *index); /* Return the index for the beginning of the list TABLE. */ int scute_table_first (scute_table_t table); /* Return the index following INDEX. If INDEX is the last element in the list, return 0. */ int scute_table_next (scute_table_t table, int index); /* Return true iff INDEX is the end-of-list marker. */ bool scute_table_last (scute_table_t table, int index); /* Return the user data associated with INDEX. Return NULL if INDEX is the end-of-list marker. */ void *scute_table_data (scute_table_t table, int index); /* Return the number of entries in the table TABLE. */ int scute_table_used (scute_table_t table); #endif /* !TABLE_H */
// The libMesh Finite Element Library. // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner // 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 #ifndef LIBMESH_CELL_INF_PRISM_H #define LIBMESH_CELL_INF_PRISM_H #include "libmesh/libmesh_config.h" #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS // Local includes #include "libmesh/cell_inf.h" namespace libMesh { /** * The \p InfPrism is an element in 3D with 4 sides. * The \f$ 5^{th} \f$ side is theoretically located at infinity, * and therefore not accounted for. * However, one could say that the \f$ 5^{th} \f$ side actually * @e does exist in the mesh, since the outer nodes are located * at a specific distance from the mesh origin (and therefore * define a side). Still, this face is not to be used! */ class InfPrism : public InfCell { public: /** * Default infinite prism element, takes number of nodes and * parent. Derived classes implement 'true' elements. */ InfPrism(const unsigned int nn, Elem* p, Node** nodelinkdata); // /** // * @returns 4 for the base \p s=0 and 2 for side faces. // */ // unsigned int n_children_per_side(const unsigned int s) const; /** * @returns 4. Infinite elements have one side less * than their conventional counterparts, since one * side is supposed to be located at infinity. */ unsigned int n_sides() const { return 4; } /** * @returns 6. All infinite prisms (in our * setting) have 6 vertices. */ unsigned int n_vertices() const { return 6; } /** * @returns 6. All infinite prismahedrals have 6 edges, * 3 lying in the base, and 3 perpendicular to the base. */ unsigned int n_edges() const { return 6; } /** * @returns 4. All prisms have 4 faces. */ unsigned int n_faces() const { return 4; } /** * @returns 4 */ unsigned int n_children() const { return 4; } /* * @returns true iff the specified child is on the * specified side */ virtual bool is_child_on_side(const unsigned int c, const unsigned int s) const; /* * @returns true iff the specified edge is on the specified side */ virtual bool is_edge_on_side(const unsigned int e, const unsigned int s) const; /** * @returns an id associated with the \p s side of this element. * The id is not necessariy unique, but should be close. This is * particularly useful in the \p MeshBase::find_neighbors() routine. */ dof_id_type key (const unsigned int s) const; /** * @returns a primitive (3-noded) tri or (4-noded) infquad for * face i. */ AutoPtr<Elem> side (const unsigned int i) const; protected: /** * Data for links to parent/neighbor/interior_parent elements. */ Elem* _elemlinks_data[5+(LIBMESH_DIM>3)]; }; // ------------------------------------------------------------ // InfPrism class member functions inline InfPrism::InfPrism(const unsigned int nn, Elem* p, Node** nodelinkdata) : InfCell(nn, InfPrism::n_sides(), p, _elemlinks_data, nodelinkdata) { } // inline // unsigned int InfPrism::n_children_per_side(const unsigned int s) const // { // libmesh_assert_less (s, this->n_sides()); // switch (s) // { // case 0: // // every infinite prism has 4 children in the base side // return 4; // default: // // on infinite faces (sides), only 2 children exist // // // // note that the face at infinity is already caught by the libmesh_assertion // return 2; // } // } } // namespace libMesh #endif // ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS #endif // LIBMESH_CELL_INF_PRISM_H
/* Copyright (C) 1991,92,96,97,99,2000,2001,2009 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #ifndef _STRINGS_H #define _STRINGS_H 1 /* We don't need and should not read this file if <string.h> was already read. The one exception being that if __USE_BSD isn't defined, then these aren't defined in string.h, so we need to define them here. */ /* keep this file in sync w/ string.h, the glibc version is out of date */ #if !defined _STRING_H || !defined __USE_BSD # include <features.h> # define __need_size_t # include <stddef.h> __BEGIN_DECLS # ifdef __UCLIBC_SUSV3_LEGACY__ /* Copy N bytes of SRC to DEST (like memmove, but args reversed). */ extern void bcopy (__const void *__src, void *__dest, size_t __n) __THROW __nonnull ((1, 2)); /* Set N bytes of S to 0. */ extern void bzero (void *__s, size_t __n) __THROW __nonnull ((1)); /* Compare N bytes of S1 and S2 (same as memcmp). */ extern int bcmp (__const void *__s1, __const void *__s2, size_t __n) __THROW __attribute_pure__ __nonnull ((1, 2)); /* Find the first occurrence of C in S (same as strchr). */ extern char *index (__const char *__s, int __c) __THROW __attribute_pure__ __nonnull ((1)); /* Find the last occurrence of C in S (same as strrchr). */ extern char *rindex (__const char *__s, int __c) __THROW __attribute_pure__ __nonnull ((1)); # else # ifdef __UCLIBC_SUSV3_LEGACY_MACROS__ /* bcopy/bzero/bcmp/index/rindex are marked LEGACY in SuSv3. * They are replaced as proposed by SuSv3. Don't sync this part * with glibc and keep it in sync with string.h. */ # define bcopy(src,dest,n) (memmove((dest), (src), (n)), (void) 0) # define bzero(s,n) (memset((s), '\0', (n)), (void) 0) # define bcmp(s1,s2,n) memcmp((s1), (s2), (size_t)(n)) # define index(s,c) strchr((s), (c)) # define rindex(s,c) strrchr((s), (c)) # endif # endif /* Return the position of the first bit set in I, or 0 if none are set. The least-significant bit is position 1, the most-significant 32. */ extern int ffs (int __i) __THROW __attribute__ ((__const__)); libc_hidden_proto(ffs) /* The following two functions are non-standard but necessary for non-32 bit platforms. */ # ifdef __USE_GNU extern int ffsl (long int __l) __THROW __attribute__ ((__const__)); # ifdef __GNUC__ __extension__ extern int ffsll (long long int __ll) __THROW __attribute__ ((__const__)); # endif # endif /* Compare S1 and S2, ignoring case. */ extern int strcasecmp (__const char *__s1, __const char *__s2) __THROW __attribute_pure__ __nonnull ((1, 2)); libc_hidden_proto(strcasecmp) /* Compare no more than N chars of S1 and S2, ignoring case. */ extern int strncasecmp (__const char *__s1, __const char *__s2, size_t __n) __THROW __attribute_pure__ __nonnull ((1, 2)); libc_hidden_proto(strncasecmp) #if defined __USE_XOPEN2K8 && defined __UCLIBC_HAS_XLOCALE__ /* The following functions are equivalent to the both above but they take the locale they use for the collation as an extra argument. This is not standardsized but something like will come. */ # include <xlocale.h> /* Again versions of a few functions which use the given locale instead of the global one. */ extern int strcasecmp_l (__const char *__s1, __const char *__s2, __locale_t __loc) __THROW __attribute_pure__ __nonnull ((1, 2, 3)); libc_hidden_proto(strcasecmp_l) extern int strncasecmp_l (__const char *__s1, __const char *__s2, size_t __n, __locale_t __loc) __THROW __attribute_pure__ __nonnull ((1, 2, 4)); libc_hidden_proto(strncasecmp_l) #endif __END_DECLS #ifdef _LIBC /* comment is wrong and will face this, when HAS_GNU option will be added * header is SuSv standard */ #error "<strings.h> should not be included from libc." #endif #endif /* string.h */ #endif /* strings.h */
/* aim_rxqueue.c This file contains the management routines for the receive (incoming packet) queue. The actual packet handlers are in aim_rxhandlers.c. */ #include "aim.h" /* This is a modified read() to make SURE we get the number of bytes we are told to, otherwise block. */ int Read(int fd, u_char *buf, int len) { int i = 0; int j = 0; while ((i < len) && (!(i < 0))) { j = read(fd, &(buf[i]), len-i); if ( (j < 0) && (errno != EAGAIN)) return -errno; /* fail */ else i += j; /* success, continue */ } #if 0 printf("\nRead Block: (%d/%04x)\n", len, len); printf("\t"); for (j = 0; j < len; j++) { if (j % 8 == 0) printf("\n\t"); if (buf[j] >= ' ' && buf[j] < 127) printf("%c=%02x ",buf[j], buf[j]); else printf("0x%02x ", buf[j]); } printf("\n\n"); #endif return i; } /* struct command_struct * get_generic( struct connection_info struct *, struct command_struct * ) Grab as many command sequences as we can off the socket, and enqueue each command in the incoming event queue in a seperate struct. */ int aim_get_command(void) { int i, readgood, j, isav, err; int s; fd_set fds; struct timeval tv; char generic[6]; struct command_rx_struct *workingStruct = NULL; struct command_rx_struct *workingPtr = NULL; struct aim_conn_t *conn = NULL; #if debug > 0 printf("Reading generic/unknown response..."); #endif /* dont wait at all (ie, never call this unless something is there) */ tv.tv_sec = 0; tv.tv_usec = 0; conn = aim_select(&tv); if (conn==NULL) return 0; /* nothing waiting */ s = conn->fd; FD_ZERO(&fds); FD_SET(s, &fds); tv.tv_sec = 0; /* wait, but only for 10us */ tv.tv_usec = 10; generic[0] = 0x00; readgood = 0; i = 0; j = 0; /* read first 6 bytes (the FLAP header only) off the socket */ while ( (select(s+1, &fds, NULL, NULL, &tv) == 1) && (i < 6)) { if ((err = Read(s, &(generic[i]), 1)) < 0) { /* error is probably not recoverable...(must be a pessimistic day) */ aim_conn_close(conn); return err; } if (readgood == 0) { if (generic[i] == 0x2a) { readgood = 1; #if debug > 1 printf("%x ", generic[i]); fflush(stdout); #endif i++; } else { #if debug > 1 printf("skipping 0x%d ", generic[i]); fflush(stdout); #endif j++; } } else { #if debug > 1 printf("%x ", generic[i]); #endif i++; } FD_ZERO(&fds); FD_SET(s, &fds); tv.tv_sec= 2; tv.tv_usec= 2; } if (generic[0] != 0x2a) { /* this really shouldn't happen, since the main loop select() should protect us from entering this function without data waiting */ printf("Bad incoming data!"); return -1; } isav = i; /* allocate a new struct */ workingStruct = (struct command_rx_struct *) malloc(sizeof(struct command_rx_struct)); workingStruct->lock = 1; /* lock the struct */ /* store type -- byte 2 */ workingStruct->type = (char) generic[1]; /* store seqnum -- bytes 3 and 4 */ workingStruct->seqnum = ( (( (unsigned int) generic[2]) & 0xFF) << 8); workingStruct->seqnum += ( (unsigned int) generic[3]) & 0xFF; /* store commandlen -- bytes 5 and 6 */ workingStruct->commandlen = ( (( (unsigned int) generic[4]) & 0xFF ) << 8); workingStruct->commandlen += ( (unsigned int) generic[5]) & 0xFF; /* malloc for data portion */ workingStruct->data = (char *) malloc(workingStruct->commandlen); /* read the data portion of the packet */ i = Read(s, workingStruct->data, workingStruct->commandlen); if (i < 0) { aim_conn_close(conn); return i; } #if debug > 0 printf(" done. (%db+%db read, %db skipped)\n", isav, i, j); #endif workingStruct->conn = conn; workingStruct->next = NULL; /* this will always be at the bottom */ workingStruct->lock = 0; /* unlock */ /* enqueue this packet */ if (aim_queue_incoming == NULL) aim_queue_incoming = workingStruct; else { workingPtr = aim_queue_incoming; while (workingPtr->next != NULL) workingPtr = workingPtr->next; workingPtr->next = workingStruct; } return 0; } /* purge_rxqueue() This is just what it sounds. It purges the receive (rx) queue of all handled commands. This is normally called from inside aim_rxdispatch() after it's processed all the commands in the queue. */ struct command_rx_struct *aim_purge_rxqueue(struct command_rx_struct *queue) { int i = 0; struct command_rx_struct *workingPtr = NULL; struct command_rx_struct *workingPtr2 = NULL; workingPtr = queue; if (queue == NULL) { return queue; } else if (queue->next == NULL) { if (queue->handled == 1) { workingPtr2 = queue; queue = NULL; free(workingPtr2->data); free(workingPtr2); } return queue; } else { for (i = 0; workingPtr != NULL; i++) { if (workingPtr->next->handled == 1) { /* save struct */ workingPtr2 = workingPtr->next; /* dequeue */ workingPtr->next = workingPtr2->next; /* free */ free(workingPtr2->data); free(workingPtr2); } workingPtr = workingPtr->next; } } return queue; }
// // Created by Ulrich Eck on 26/07/2015. // #ifndef UBITRACK_GLFW_RENDERMANAGER_H #define UBITRACK_GLFW_RENDERMANAGER_H #include <string> #ifdef HAVE_GLEW #include "GL/glew.h" #endif #include <GLFW/glfw3.h> #include <utVisualization/utRenderAPI.h> namespace Ubitrack { namespace Visualization { class GLFWWindowImpl : public VirtualWindow { public: GLFWWindowImpl(int _width, int _height, const std::string& _title); ~GLFWWindowImpl(); virtual void pre_render(); virtual void post_render(); virtual void reshape(int w, int h); //custom extensions virtual void setFullscreen(bool fullscreen); virtual void onExit(); // Implementation of Public interface virtual bool is_valid(); virtual bool create(); virtual void initGL(boost::shared_ptr<CameraHandle>& cam); virtual void destroy(); private: GLFWwindow* m_pWindow; boost::shared_ptr<CameraHandle> m_pEventHandler; }; // callback implementations for GLFW inline static void WindowResizeCallback( GLFWwindow *win, int w, int h) { CameraHandle *cam = static_cast<CameraHandle*>(glfwGetWindowUserPointer(win)); cam->on_window_size(w, h); } inline static void WindowRefreshCallback(GLFWwindow *win) { CameraHandle *cam = static_cast<CameraHandle*>(glfwGetWindowUserPointer(win)); cam->on_render(glfwGetTime()); } inline static void WindowCloseCallback(GLFWwindow *win) { CameraHandle *cam = static_cast<CameraHandle*>(glfwGetWindowUserPointer(win)); cam->on_window_close(); } inline static void WindowKeyCallback(GLFWwindow *win, int key, int scancode, int action, int mods) { CameraHandle *cam = static_cast<CameraHandle*>(glfwGetWindowUserPointer(win)); if ((action == GLFW_PRESS) && (mods & GLFW_MOD_ALT)) { switch (key) { case GLFW_KEY_F: cam->on_fullscreen(); return; default: break; } } if (action == GLFW_PRESS) { switch (key) { case GLFW_KEY_ESCAPE: cam->on_exit(); return; default: cam->on_keypress(key, scancode, action, mods); break; } } } inline static void WindowCursorPosCallback(GLFWwindow *win, double xpos, double ypos) { CameraHandle *cam = static_cast<CameraHandle*>(glfwGetWindowUserPointer(win)); cam->on_cursorpos(xpos, ypos); } } } #endif //UBITRACK_GLFW_RENDERMANAGER_H
// BESWWW.h // This file is part of bes, A C++ back-end server implementation framework // for the OPeNDAP Data Access Protocol. // Copyright (c) 2004,2005 University Corporation for Atmospheric Research // Author: Patrick West <pwest@ucar.edu> and Jose Garcia <jgarcia@ucar.edu> // // 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 // // You can contact University Corporation for Atmospheric Research at // 3080 Center Green Drive, Boulder, CO 80301 // (c) COPYRIGHT University Corporation for Atmospheric Research 2004-2005 // Please read the full copyright statement in the file COPYRIGHT_UCAR. // // Authors: // pwest Patrick West <pwest@ucar.edu> // jgarcia Jose Garcia <jgarcia@ucar.edu> #ifndef I_BESWWW_h #define I_BESWWW_h 1 #include "BESResponseObject.h" #include "BESDASResponse.h" #include "BESDDSResponse.h" /** @brief container for a DAS and DDS needed to write out the usage * information for a dataset. * * This is a container for the usage response information, which needs a DAS * and a DDS. An instances of BESWWW takes ownership of the das and dds * passed to it and deletes it in the destructor. * * @see BESResponseObject * @see DAS * @see DDS */ class BESWWW : public BESResponseObject { private: #if 0 BESDASResponse *_das ; #endif BESDDSResponse *_dds ; BESWWW() {} public: BESWWW( /* BESDASResponse *das,*/ BESDDSResponse *dds ) : /*_das( das ),*/ _dds( dds ) {} virtual ~ BESWWW() { #if 0 if (_das) delete _das; #endif if (_dds) delete _dds; } #if 0 BESDASResponse *get_das() { return _das ; } #endif BESDDSResponse *get_dds() { return _dds ; } /** @brief dumps information about this object * * Displays the pointer value of this instance along with the das object * created * * @param strm C++ i/o stream to dump the information to */ virtual void dump(ostream & strm) const { strm << BESIndent::LMarg << "dump - (" << (void *) this << ")" << endl; BESIndent::Indent(); #if 0 strm << BESIndent::LMarg << "das: " << *_das << endl; #endif strm << BESIndent::LMarg << "dds: " << *_dds << endl; BESIndent::UnIndent(); } } ; #endif // I_BESWWW_h
/* Copyright (C) 2008-2011 D. V. Wiebe * *************************************************************************** * * This file is part of the GetData project. * * GetData 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. * * GetData 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 GetData; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* Attempt to read INT32 as INT64 */ #include "test.h" #include <inttypes.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <string.h> #include <errno.h> int main(void) { const char *filedir = "dirfile"; const char *format = "dirfile/format"; const char *data = "dirfile/data"; const char *format_data = "data RAW INT32 8\n"; int32_t data_data[256]; int64_t c[8]; int fd, i, n, error, r = 0; DIRFILE *D; memset(c, 0, 8); rmdirfile(); mkdir(filedir, 0777); for (fd = 0; fd < 256; ++fd) data_data[fd] = fd; fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666); write(fd, format_data, strlen(format_data)); close(fd); fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666); write(fd, data_data, 256 * sizeof(int32_t)); close(fd); D = gd_open(filedir, GD_RDONLY | GD_VERBOSE); n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT64, c); error = gd_error(D); gd_close(D); unlink(data); unlink(format); rmdir(filedir); CHECKI(error, 0); CHECKI(n, 8); for (i = 0; i < 8; ++i) CHECKIi(i,c[i], 40 + i); return r; }
// // Copyright (c) 2013, Ford Motor Company // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // Redistributions of source code must retain the above copyright notice, this // list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following // disclaimer in the documentation and/or other materials provided with the // distribution. // // Neither the name of the Ford Motor Company nor the names of its contributors // may be used to endorse or promote products derived from this software // without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. // #ifndef NSSMARTDEVICELINKRPCV2_SCROLLABLEMESSAGE_RESPONSEMARSHALLER_INCLUDE #define NSSMARTDEVICELINKRPCV2_SCROLLABLEMESSAGE_RESPONSEMARSHALLER_INCLUDE #include <string> #include <json/json.h> #include "../include/JSONHandler/SDLRPCObjects/V2/ScrollableMessage_response.h" /* interface Ford Sync RAPI version 2.0O date 2012-11-02 generated at Thu Jan 24 06:36:23 2013 source stamp Thu Jan 24 06:35:41 2013 author RC */ namespace NsSmartDeviceLinkRPCV2 { struct ScrollableMessage_responseMarshaller { static bool checkIntegrity(ScrollableMessage_response& e); static bool checkIntegrityConst(const ScrollableMessage_response& e); static bool fromString(const std::string& s,ScrollableMessage_response& e); static const std::string toString(const ScrollableMessage_response& e); static bool fromJSON(const Json::Value& s,ScrollableMessage_response& e); static Json::Value toJSON(const ScrollableMessage_response& e); }; } #endif
/* * crypt.c - blowfish-cbc code * * This file is part of the SSH Library * * Copyright (c) 2003 by Aris Adamantiadis * * The SSH Library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or (at your * option) any later version. * * The SSH Library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with the SSH Library; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. */ #include "config.h" #include <assert.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #ifndef _WIN32 #include <netinet/in.h> #include <arpa/inet.h> #endif #ifdef OPENSSL_CRYPTO #include <openssl/blowfish.h> #include <openssl/evp.h> #include <openssl/hmac.h> #endif #include "libssh/priv.h" #include "libssh/session.h" #include "libssh/wrapper.h" #include "libssh/crypto.h" #include "libssh/buffer.h" uint32_t packet_decrypt_len(ssh_session session, char *crypted){ uint32_t decrypted; if (session->current_crypto) { if (packet_decrypt(session, crypted, session->current_crypto->in_cipher->blocksize) < 0) { return 0; } } memcpy(&decrypted,crypted,sizeof(decrypted)); return ntohl(decrypted); } int packet_decrypt(ssh_session session, void *data,uint32_t len) { struct ssh_cipher_struct *crypto = session->current_crypto->in_cipher; char *out = NULL; assert(len); if(len % session->current_crypto->in_cipher->blocksize != 0){ ssh_set_error(session, SSH_FATAL, "Cryptographic functions must be set on at least one blocksize (received %d)",len); return SSH_ERROR; } out = malloc(len); if (out == NULL) { return -1; } if (crypto->set_decrypt_key(crypto, session->current_crypto->decryptkey, session->current_crypto->decryptIV) < 0) { SAFE_FREE(out); return -1; } crypto->cbc_decrypt(crypto,data,out,len); memcpy(data,out,len); memset(out,0,len); SAFE_FREE(out); return 0; } unsigned char *packet_encrypt(ssh_session session, void *data, uint32_t len) { struct ssh_cipher_struct *crypto = NULL; HMACCTX ctx = NULL; char *out = NULL; unsigned int finallen; uint32_t seq; assert(len); if (!session->current_crypto) { return NULL; /* nothing to do here */ } if(len % session->current_crypto->in_cipher->blocksize != 0){ ssh_set_error(session, SSH_FATAL, "Cryptographic functions must be set on at least one blocksize (received %d)",len); return NULL; } out = malloc(len); if (out == NULL) { return NULL; } seq = ntohl(session->send_seq); crypto = session->current_crypto->out_cipher; if (crypto->set_encrypt_key(crypto, session->current_crypto->encryptkey, session->current_crypto->encryptIV) < 0) { SAFE_FREE(out); return NULL; } if (session->version == 2) { ctx = hmac_init(session->current_crypto->encryptMAC,20,SSH_HMAC_SHA1); if (ctx == NULL) { SAFE_FREE(out); return NULL; } hmac_update(ctx,(unsigned char *)&seq,sizeof(uint32_t)); hmac_update(ctx,data,len); hmac_final(ctx,session->current_crypto->hmacbuf,&finallen); #ifdef DEBUG_CRYPTO ssh_print_hexa("mac: ",data,len); if (finallen != 20) { printf("Final len is %d\n",finallen); } ssh_print_hexa("Packet hmac", session->current_crypto->hmacbuf, 20); #endif } crypto->cbc_encrypt(crypto, data, out, len); memcpy(data, out, len); memset(out, 0, len); SAFE_FREE(out); if (session->version == 2) { return session->current_crypto->hmacbuf; } return NULL; } /** * @internal * * @brief Verify the hmac of a packet * * @param session The session to use. * @param buffer The buffer to verify the hmac from. * @param mac The mac to compare with the hmac. * * @return 0 if hmac and mac are equal, < 0 if not or an error * occurred. */ int packet_hmac_verify(ssh_session session, ssh_buffer buffer, unsigned char *mac) { unsigned char hmacbuf[EVP_MAX_MD_SIZE] = {0}; HMACCTX ctx; unsigned int len; uint32_t seq; ctx = hmac_init(session->current_crypto->decryptMAC, 20, SSH_HMAC_SHA1); if (ctx == NULL) { return -1; } seq = htonl(session->recv_seq); hmac_update(ctx, (unsigned char *) &seq, sizeof(uint32_t)); hmac_update(ctx, buffer_get_rest(buffer), buffer_get_rest_len(buffer)); hmac_final(ctx, hmacbuf, &len); #ifdef DEBUG_CRYPTO ssh_print_hexa("received mac",mac,len); ssh_print_hexa("Computed mac",hmacbuf,len); ssh_print_hexa("seq",(unsigned char *)&seq,sizeof(uint32_t)); #endif if (memcmp(mac, hmacbuf, len) == 0) { return 0; } return -1; } /* vim: set ts=2 sw=2 et cindent: */
#include "sparrowPrimitives.h"
/*************************************************************************** ** ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (directui@nokia.com) ** ** This file is part of libmeegotouch. ** ** If you have questions regarding the use of this file, please contact ** Nokia at directui@nokia.com. ** ** This library is free software; you can redistribute it and/or ** modify it under the terms of the GNU Lesser General Public ** License version 2.1 as published by the Free Software Foundation ** and appearing in the file LICENSE.LGPL included in the packaging ** of this file. ** ****************************************************************************/ #ifndef MABSTRACTWIDGETANIMATION_H #define MABSTRACTWIDGETANIMATION_H #include <mabstractwidgetanimationstyle.h> #include <mparallelanimationgroup.h> class MAbstractWidgetAnimationPrivate; /*! \class MAbstractWidgetAnimation \brief MAbstractWidgetAnimation class is a base class for all widget animations. */ class M_CORE_EXPORT MAbstractWidgetAnimation : public MParallelAnimationGroup { Q_OBJECT Q_DECLARE_PRIVATE(MAbstractWidgetAnimation) M_ANIMATION_GROUP(MAbstractWidgetAnimationStyle) protected: /*! \brief Constructs the widget animation. This constructor is meant to be used inside the libmeegotouch to share the private data class pointer. */ MAbstractWidgetAnimation(MAbstractWidgetAnimationPrivate *dd, QObject *parent); public: /*! * This enum defines the direction of the widget animation. */ enum TransitionDirection { In, //!< transitioning into the screen/display Out //!< transitioning out of the screen/display }; /*! \brief Constructs the widget animation. */ MAbstractWidgetAnimation(QObject *parent = NULL); /*! \brief Destructs the widget animation. */ virtual ~MAbstractWidgetAnimation(); /*! Restores the properties of the target widget back to their original state, before the animation changed them. */ virtual void restoreTargetWidgetState() = 0; virtual void setTargetWidget(MWidgetController *widget); virtual void setTransitionDirection(MAbstractWidgetAnimation::TransitionDirection direction) = 0; MWidgetController *targetWidget(); const MWidgetController *targetWidget() const; }; #endif
/************************************************************************** ** ** This file is part of Qt Creator ** ** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** Commercial Usage ** ** Licensees holding valid Qt Commercial licenses may use this file in ** accordance with the Qt Commercial License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Nokia. ** ** 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. ** ** If you are unsure which license is appropriate for your use, please ** contact the sales department at http://qt.nokia.com/contact. ** **************************************************************************/ #ifndef OPENWITHDIALOG_H #define OPENWITHDIALOG_H #include <QtGui/QDialog> #include "ui_openwithdialog.h" namespace Core { class ICore; namespace Internal { // Present the user with a file name and a list of available // editor kinds to choose from. class OpenWithDialog : public QDialog, public Ui::OpenWithDialog { Q_OBJECT public: OpenWithDialog(const QString &fileName, QWidget *parent); void setEditors(const QStringList &); QString editor() const; void setCurrentEditor(int index); private slots: void currentItemChanged(QListWidgetItem *, QListWidgetItem *); private: void setOkButtonEnabled(bool); }; } // namespace Internal } // namespace Core #endif // OPENWITHDIALOG_H
/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qt Creator. ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms and ** conditions see http://www.qt.io/terms-conditions. For further information ** use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef DIFFUTILS_H #define DIFFUTILS_H #include "diffeditor_global.h" #include <QString> #include <QMap> #include <QTextEdit> #include "texteditor/texteditorconstants.h" namespace TextEditor { class FontSettings; } namespace DiffEditor { class Diff; class DIFFEDITOR_EXPORT DiffFileInfo { public: DiffFileInfo() {} DiffFileInfo(const QString &file) : fileName(file) {} DiffFileInfo(const QString &file, const QString &type) : fileName(file), typeInfo(type) {} QString fileName; QString typeInfo; }; class DIFFEDITOR_EXPORT TextLineData { public: enum TextLineType { TextLine, Separator, Invalid }; TextLineData() : textLineType(Invalid) {} TextLineData(const QString &txt) : textLineType(TextLine), text(txt) {} TextLineData(TextLineType t) : textLineType(t) {} TextLineType textLineType; QString text; /* * <start position, end position> * <-1, n> means this is a continuation from the previous line * <n, -1> means this will be continued in the next line * <-1, -1> the whole line is a continuation (from the previous line to the next line) */ QMap<int, int> changedPositions; // counting from the beginning of the line }; class DIFFEDITOR_EXPORT RowData { public: RowData() : equal(false) {} RowData(const TextLineData &l) : leftLine(l), rightLine(l), equal(true) {} RowData(const TextLineData &l, const TextLineData &r) : leftLine(l), rightLine(r), equal(false) {} TextLineData leftLine; TextLineData rightLine; bool equal; }; class DIFFEDITOR_EXPORT ChunkData { public: ChunkData() : contextChunk(false), leftStartingLineNumber(0), rightStartingLineNumber(0) {} QList<RowData> rows; bool contextChunk; int leftStartingLineNumber; int rightStartingLineNumber; QString contextInfo; }; class DIFFEDITOR_EXPORT FileData { public: enum FileOperation { ChangeFile, NewFile, DeleteFile, CopyFile, RenameFile }; FileData() : fileOperation(ChangeFile), binaryFiles(false), lastChunkAtTheEndOfFile(false), contextChunksIncluded(false) {} FileData(const ChunkData &chunkData) : fileOperation(ChangeFile), binaryFiles(false), lastChunkAtTheEndOfFile(false), contextChunksIncluded(false) { chunks.append(chunkData); } QList<ChunkData> chunks; DiffFileInfo leftFileInfo; DiffFileInfo rightFileInfo; FileOperation fileOperation; bool binaryFiles; bool lastChunkAtTheEndOfFile; bool contextChunksIncluded; }; class DIFFEDITOR_EXPORT DiffUtils { public: enum PatchFormattingFlags { AddLevel = 0x1, // Add 'a/' , '/b' for git am GitFormat = AddLevel | 0x2, // Add line 'diff ..' as git does }; static ChunkData calculateOriginalData(const QList<Diff> &leftDiffList, const QList<Diff> &rightDiffList); static FileData calculateContextData(const ChunkData &originalData, int contextLinesNumber, int joinChunkThreshold = 1); static QString makePatchLine(const QChar &startLineCharacter, const QString &textLine, bool lastChunk, bool lastLine); static QString makePatch(const ChunkData &chunkData, bool lastChunk = false); static QString makePatch(const ChunkData &chunkData, const QString &leftFileName, const QString &rightFileName, bool lastChunk = false); static QString makePatch(const QList<FileData> &fileDataList, unsigned formatFlags = 0); static QList<FileData> readPatch(const QString &patch, bool *ok = 0); }; } // namespace DiffEditor #endif // DIFFUTILS_H
/* * bsb2png.c - Convert a bsb raster image to a Portable Network Graphics (png). * See http://www.libpng.org for details of the PNG format and how * to use libpng. * * Copyright (C) 2004 Stefan Petersen <spetm@users.sourceforge.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.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 * * $Id: bsb2png.c,v 1.7 2007/02/05 17:08:18 mikrom Exp $ * */ #include <stdlib.h> #include <stdio.h> #include <bsb.h> #include <png.h> static void copy_bsb_to_png(BSBImage *image, png_structp png_ptr) { int row, bp, pp; uint8_t *bsb_row, *png_row; bsb_row = (uint8_t *)malloc(image->height * sizeof(uint8_t *)); png_row = (uint8_t *)malloc(image->height * sizeof(uint8_t *) * image->depth); /* Copy row by row */ for (row = 0; row < image->height; row++) { bsb_seek_to_row(image, row); bsb_read_row(image, bsb_row); for (bp = 0, pp = 0; bp < image->width; bp++) { png_row[pp++] = image->red[bsb_row[bp]]; png_row[pp++] = image->green[bsb_row[bp]]; png_row[pp++] = image->blue[bsb_row[bp]]; } png_write_row(png_ptr, png_row); } free(bsb_row); free(png_row); } /* copy_bsb_to_png */ int main(int argc, char *argv[]) { BSBImage image; FILE *png_fd; png_structp png_ptr; png_infop info_ptr; png_text text[2]; if (argc != 3) { fprintf(stderr, "Usage:\n\tbsb2png input.kap output.png\n"); exit(1); } png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); if (png_ptr == NULL) { fprintf(stderr, "png_ptr == NULL\n"); exit(1); } info_ptr = png_create_info_struct(png_ptr); if (info_ptr == NULL) { fprintf(stderr, "info_ptr == NULL\n"); png_destroy_write_struct(&png_ptr, (png_infopp)NULL); exit(1); } if ((png_fd = fopen(argv[2], "wb")) == NULL) { perror("fopen"); exit(1); } png_init_io(png_ptr, png_fd); if (! bsb_open_header(argv[1], &image)) { exit(1); } png_set_IHDR(png_ptr, info_ptr, image.width, image.height, 8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); /* Some text to go with the png image */ text[0].key = "Title"; text[0].text = argv[2]; text[0].compression = PNG_TEXT_COMPRESSION_NONE; text[1].key = "Generator"; text[1].text = "bsb2png"; text[1].compression = PNG_TEXT_COMPRESSION_NONE; png_set_text(png_ptr, info_ptr, text, 2); /* Write header data */ png_write_info(png_ptr, info_ptr); /* Copy the image in itself */ copy_bsb_to_png(&image, png_ptr); png_write_end(png_ptr, NULL); fclose(png_fd); png_destroy_write_struct(&png_ptr, &info_ptr); bsb_close(&image); return 0; }
/* mgrp_test.c * * Test messenger group broadcast/receive functionality and concurrency. * Each thread broadcasts a counter from 0 to ITERS, to all other threads * (but not itself). * Every receiving thread should sum received integers into a per-thread * rx_sum variable. * Every thread should accumulate the same rx_sum, which is: * (ITERS -1) * ITERS * (THREAD_CNT -1) * 0.5 * (see memorywell/test/well_test.c for more details). * * (c) 2018 Sirio Balmelli and Anthony Soenen */ #include <ndebug.h> #include <posigs.h> /* use atomic PSG kill flag as a global error flag */ #include <pcg_rand.h> #include <messenger.h> #include <pthread.h> #include <stdbool.h> #include <unistd.h> #include <fcntl.h> #define THREAD_CNT 2 #define ITERS 2 /* How many messages each thread should send. * TODO: increase once registration/rcu issue is resolved. */ /* thread() */ void *thread(void* arg) { struct mgrp *group = arg; int pvc[2] = { 0, 0 }; size_t rx_sum = 0, rx_i = 0; size_t message; NB_die_if( pipe(pvc) || fcntl(pvc[0], F_SETFL, fcntl(pvc[0], F_GETFL) | O_NONBLOCK) , ""); NB_die_if( mgrp_subscribe(group, pvc[1]) , ""); /* Don't start broadcasting until everyone is subscribed. * We could use pthread_barrier_t but that's not implemented on macOS, * and anyways messenger()'s mgrp_count uses acquire/release semantics. */ while (mgrp_count(group) != THREAD_CNT && !psg_kill_check()) sched_yield(); /* generate ITERS broadcasts; receive others' broadcasts */ for (size_t i = 0; i < ITERS && !psg_kill_check(); i++) { NB_die_if( mgrp_broadcast(group, pvc[1], &i, sizeof(i)) , ""); while ((mg_recv(pvc[0], &message) > 0) && !psg_kill_check()) { rx_sum += message; rx_i++; sched_yield(); /* prevent deadlock: give other threads a chance to write */ } errno = 0; /* _should_ be EINVAL: don't pollute later prints */ } /* wait for all other senders */ while (rx_i < ITERS * (THREAD_CNT -1) && !psg_kill_check()) { if ((mg_recv(pvc[0], &message) > 0)) { rx_sum += message; rx_i++; } else { sched_yield(); } } die: NB_err_if( mgrp_unsubscribe(group, pvc[1]) , "fd %d unsubscribe fail", pvc[1]); if (err_cnt) psg_kill(); if (pvc[0]) { close(pvc[1]); close(pvc[0]); } return (void *)rx_sum; } /* main() */ int main() { int err_cnt = 0; struct mgrp *group = NULL; pthread_t threads[THREAD_CNT]; NB_die_if(!( group = mgrp_new() ), ""); /* run all threads */ for (unsigned int i=0; i < THREAD_CNT; i++) { NB_die_if(pthread_create(&threads[i], NULL, thread, group), ""); } /* test results */ size_t expected = (ITERS -1) * ITERS * (THREAD_CNT -1) * 0.5; for (unsigned int i=0; i < THREAD_CNT; i++) { size_t rx_sum; NB_die_if( pthread_join(threads[i], (void **)&rx_sum) , ""); NB_err_if(rx_sum != expected, "thread %zu != expected %zu", rx_sum, expected); } die: mgrp_free(group); err_cnt += psg_kill_check(); /* return any error from any thread */ return err_cnt; }
/**************************************************************************** ** ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the Qt Mobility Components. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial Usage ** Licensees holding valid Qt Commercial licenses may use this file in ** accordance with the Qt Commercial License Agreement provided with ** the Software or, alternatively, in accordance with the terms ** contained in a written agreement between you and Nokia. ** ** 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, 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. ** ** If you are unsure which license is appropriate for your use, please ** contact the sales department at qt-sales@nokia.com. ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QGEOMAPPINGMANAGERENGINE_H #define QGEOMAPPINGMANAGERENGINE_H #include "qgraphicsgeomap.h" #include <QObject> #include <QSize> #include <QPair> class QLocale; QTM_BEGIN_NAMESPACE class QGeoBoundingBox; class QGeoCoordinate; class QGeoMapData; class QGeoMappingManagerPrivate; class QGeoMapRequestOptions; class QGeoMappingManagerEnginePrivate; class Q_LOCATION_EXPORT QGeoMappingManagerEngine : public QObject { Q_OBJECT public: QGeoMappingManagerEngine(const QMap<QString, QVariant> &parameters, QObject *parent = 0); virtual ~QGeoMappingManagerEngine(); QString managerName() const; int managerVersion() const; virtual QGeoMapData* createMapData() = 0; QList<QGraphicsGeoMap::MapType> supportedMapTypes() const; QList<QGraphicsGeoMap::ConnectivityMode> supportedConnectivityModes() const; qreal minimumZoomLevel() const; qreal maximumZoomLevel() const; void setLocale(const QLocale &locale); QLocale locale() const; protected: QGeoMappingManagerEngine(QGeoMappingManagerEnginePrivate *dd, QObject *parent = 0); void setSupportedMapTypes(const QList<QGraphicsGeoMap::MapType> &mapTypes); void setSupportedConnectivityModes(const QList<QGraphicsGeoMap::ConnectivityMode> &connectivityModes); void setMinimumZoomLevel(qreal minimumZoom); void setMaximumZoomLevel(qreal maximumZoom); QGeoMappingManagerEnginePrivate* d_ptr; private: void setManagerName(const QString &managerName); void setManagerVersion(int managerVersion); Q_DECLARE_PRIVATE(QGeoMappingManagerEngine) Q_DISABLE_COPY(QGeoMappingManagerEngine) friend class QGeoServiceProvider; }; QTM_END_NAMESPACE #endif
/* MAX1464 library for Arduino Copyright (C) 2016 Giacomo Mazzamuto <gmazzamuto@gmail.com> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library. If not, see <http://www.gnu.org/licenses/>. */ /** * \file */ #ifndef MAX1464_H #define MAX1464_H #include "lib/AbstractMAX1464.h" #include <SPI.h> /** * @brief Interface to the Maxim %MAX1464 Multichannel Sensor Signal Processor, * Arduino SPI library version. * * This class makes use of the Arduino SPI library with 4-wire data transfer * mode. */ class MAX1464 : public AbstractMAX1464 { public: MAX1464(const int chipSelect); virtual void begin(); virtual void end(); virtual void byteShiftOut( const uint8_t b, const char *debugMsg = NULL) const; virtual uint16_t wordShiftIn() const; private: SPISettings settings; }; #endif // MAX1464_H
#include <errno.h> #include <sys/types.h> #include <unistd.h> #include "ibuf.h" /** Set the effective read position. */ int ibuf_seek(ibuf* in, unsigned offset) { iobuf* io; unsigned buf_start; io = &(in->io); buf_start = io->offset - io->buflen; if (offset >= buf_start && offset <= io->offset) io->bufstart = offset - buf_start; else { if (lseek(io->fd, offset, SEEK_SET) != (off_t)offset) IOBUF_SET_ERROR(io); io->offset = offset; io->buflen = 0; io->bufstart = 0; } in->count = 0; io->flags &= ~IOBUF_EOF; return 1; }
#define _XOPEN_SOURCE #include <stdlib.h> #include "zdtmtst.h" #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <sys/wait.h> #include <termios.h> #include <sys/ioctl.h> const char *test_doc = "Check a controlling terminal, if a proper fd belongs to another session leader"; const char *test_author = "Andrey Vagin <avagin@openvz.org>"; int main(int argc, char ** argv) { int fdm, fds, exit_code = 1, status; task_waiter_t t; char *slavename; pid_t sid_b, sid_a, pid; int pfd[2]; test_init(argc, argv); task_waiter_init(&t); if (pipe(pfd) == -1) { pr_perror("pipe"); return 1; } fdm = open("/dev/ptmx", O_RDWR); if (fdm == -1) { pr_perror("Can't open a master pseudoterminal"); return 1; } grantpt(fdm); unlockpt(fdm); slavename = ptsname(fdm); pid = test_fork(); if (pid == 0) { if (setsid() == -1) { pr_perror("setsid"); return 1; } close(pfd[0]); /* set up a controlling terminal */ fds = open(slavename, O_RDWR | O_NOCTTY); if (fds == -1) { pr_perror("Can't open a slave pseudoterminal %s", slavename); return 1; } ioctl(fds, TIOCSCTTY, 1); pid = test_fork(); if (pid == 0) { if (setsid() == -1) { pr_perror("setsid"); return 1; } close(pfd[1]); task_waiter_complete(&t, 1); test_waitsig(); exit(0); } close(fds); close(pfd[1]); task_waiter_wait4(&t, 1); task_waiter_complete(&t, 0); test_waitsig(); kill(pid, SIGTERM); wait(&status); exit(status); } close(pfd[1]); if (read(pfd[0], &sid_a, 1) != 0) { pr_perror("read"); goto out; } if (ioctl(fdm, TIOCGSID, &sid_b) == -1) { pr_perror("The tty is not a controlling"); goto out; } task_waiter_wait4(&t, 0); test_daemon(); test_waitsig(); if (ioctl(fdm, TIOCGSID, &sid_a) == -1) { fail("The tty is not a controlling"); goto out; } if (sid_b != sid_a) { fail("The tty is controlling for someone else"); goto out; } exit_code = 0; out: kill(pid, SIGTERM); wait(&status); if (status == 0 && exit_code == 0) pass(); return exit_code; }
/********************************************************************** * $Id$ * * GEOS - Geometry Engine Open Source * http://geos.refractions.net * * Copyright (C) 2001-2002 Vivid Solutions Inc. * * This is free software; you can redistribute and/or modify it under * the terms of the GNU Lesser General Public Licence as published * by the Free Software Foundation. * See the COPYING file for more information. * ********************************************************************** * $Log$ * Revision 1.3 2004/03/17 02:00:33 ybychkov * "Algorithm" upgraded to JTS 1.4 * * Revision 1.2 2003/11/07 01:23:43 pramsey * Add standard CVS headers licence notices and copyrights to all cpp and h * files. * * **********************************************************************/ /*//////////////////////////////////////////////////////////////////////////// * Project: * Memory_and_Exception_Trace * * /////////////////////////////////////////////////////////////////////////// * File: * Stackwalker.h * * Remarks: * * * Note: * * * Author: * Jochen Kalmbach * *//////////////////////////////////////////////////////////////////////////// #ifndef __STACKWALKER_H__ #define __STACKWALKER_H__ // Only valid in the following environment: Intel platform, MS VC++ 5/6/7 #ifndef _X86_ #error Only INTEL envirnoments are supported! #endif // Only MS VC++ 5 to 7 #if (_MSC_VER < 1100) || (_MSC_VER > 1300) //#warning Only MS VC++ 5/6/7 supported. Check if the '_CrtMemBlockHeader' has not changed with this compiler! #endif typedef enum eAllocCheckOutput { ACOutput_Simple, ACOutput_Advanced, ACOutput_XML }; // Make extern "C", so it will also work with normal C-Programs #ifdef __cplusplus extern "C" { #endif extern int InitAllocCheckWN(eAllocCheckOutput eOutput, LPCTSTR pszFilename, ULONG ulShowStackAtAlloc = 0); extern int InitAllocCheck(eAllocCheckOutput eOutput = ACOutput_Simple, BOOL bSetUnhandledExeptionFilter = TRUE, ULONG ulShowStackAtAlloc = 0); // will create the filename by itself extern ULONG DeInitAllocCheck(); extern DWORD StackwalkFilter( EXCEPTION_POINTERS *ep, DWORD status, LPCTSTR pszLogFile); #ifdef __cplusplus } #endif #endif // __STACKWALKER_H__
/****************************************************************************** JPtrArray-JString16.h Copyright © 1997 by John Lindal. All rights reserved. ******************************************************************************/ #ifndef _H_JPtrArray_JString16 #define _H_JPtrArray_JString16 #if !defined _J_UNIX && !defined ACE_LACKS_PRAGMA_ONCE #pragma once #endif #include <JPtrArray.h> #ifdef _TODO #include <JString16PtrMap.h> #endif #include <JString16.h> istream& operator>>(istream&, JPtrArray<JString16>&); ostream& operator<<(ostream&, const JPtrArray<JString16>&); #ifdef _TODO istream& operator>>(istream&, JString16PtrMap<JString16>&); ostream& operator<<(ostream&, const JString16PtrMap<JString16>&); #endif JBoolean JSameStrings(const JPtrArray<JString16>&, const JPtrArray<JString16>&, const JBoolean caseSensitive); JOrderedSetT::CompareResult JCompareStringsCaseSensitive(JString16* const &, JString16* const &); JOrderedSetT::CompareResult JCompareStringsCaseInsensitive(JString16* const &, JString16* const &); #endif
/* -*- OpenSAF -*- * * (C) Copyright 2010 The OpenSAF 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. This file and program are licensed * under the GNU Lesser General Public License Version 2.1, February 1999. * The complete license can be accessed from the following location: * http://opensource.org/licenses/lgpl-license.php * See the Copying file included with the OpenSAF distribution for full * licensing terms. * * Author(s): Wind River Systems * */ #include <ncssysf_tsk.h> #include <logtrace.h> #include <daemon.h> #include "cpd.h" static int __init_cpd(void) { NCS_LIB_REQ_INFO lib_create; /* Init LIB_CREATE request for Server */ memset(&lib_create, 0, sizeof(lib_create)); lib_create.i_op = NCS_LIB_REQ_CREATE; lib_create.info.create.argc = 0; lib_create.info.create.argv = NULL; if (ncs_agents_startup() != NCSCC_RC_SUCCESS) return m_LEAP_DBG_SINK(NCSCC_RC_FAILURE); /* Init CPD */ m_NCS_DBG_PRINTF("\nCPSV:CPD:ON"); if (cpd_lib_req(&lib_create) != NCSCC_RC_SUCCESS) { fprintf(stderr, "cpd_lib_req FAILED\n"); return m_LEAP_DBG_SINK(NCSCC_RC_FAILURE); } return (NCSCC_RC_SUCCESS); } int main(int argc, char *argv[]) { daemonize(argc, argv); if (__init_cpd() != NCSCC_RC_SUCCESS) { syslog(LOG_ERR, "__init_dts() failed"); exit(EXIT_FAILURE); } while (1) { m_NCS_TASK_SLEEP(0xfffffff0); } exit(1); }
#ifndef EPubCaseElement_h #define EPubCaseElement_h #include "epubElement.h" namespace WebCore { class EPubCaseElement : public epubElement { public: static PassRefPtr<EPubCaseElement> create(const QualifiedName&, Document*); void finishParsingChildren(); private: EPubCaseElement(const QualifiedName&, Document*); }; } // namespace WebCore #endif // EPubCaseElement_h
/* $Id: glade-databox.c 4 2008-06-22 09:19:11Z rbock $ */ /* -*- Mode: C; c-basic-offset: 4 -*- * libglade - a library for building interfaces from XML files at runtime * Copyright (C) 1998-2001 James Henstridge <james@daa.com.au> * Copyright 2001 Ximian, Inc. * * glade-databox.c: support for canvas widgets in libglade. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * * Authors: * Jacob Berkman <jacob@ximian.com> * James Henstridge <james@daa.com.au> * * Modified for gtkdatabox by (based on gnome-canvas glade interface): * H. Nieuwenhuis <vzzbx@xs4all.nl> */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include <stdlib.h> #include <string.h> #include <glade/glade-init.h> #include <glade/glade-build.h> #include <gtkdatabox.h> #include <gtkdatabox_ruler.h> /* this macro puts a version check function into the module */ GLADE_MODULE_CHECK_INIT void glade_module_register_widgets (void) { glade_require ("gtk"); glade_register_widget (GTK_TYPE_DATABOX, glade_standard_build_widget, NULL, NULL); glade_register_widget (GTK_DATABOX_TYPE_RULER, glade_standard_build_widget, NULL, NULL); glade_provide ("databox"); }
/* Test driver for thbrk */ #define MAXLINELENGTH 1000 #include <stdio.h> #include <stdlib.h> #include <string.h> #include <thai/thbrk.h> /* run with "-i" argument to get the interactive version otherwise it will run the self test and exit */ int main (int argc, char* argv[]) { thchar_t str[MAXLINELENGTH]; thchar_t out[MAXLINELENGTH*6+1]; int pos[MAXLINELENGTH]; int outputLength; int numCut, i; int interactive = 0; ThBrk *brk; if (argc >= 2) { if (0 == strcmp (argv[1], "-i")) interactive = 1; } brk = th_brk_new (NULL); if (!brk) { printf ("Unable to create word breaker!\n"); exit (-1); } if (interactive) { while (!feof (stdin)) { printf ("Please enter thai words/sentences: "); if (!fgets ((char *)str, MAXLINELENGTH-1, stdin)) { numCut = th_brk_find_breaks (brk, str, pos, MAXLINELENGTH); printf ("Total %d cut points.", numCut); if (numCut > 0) { printf ("Cut points list: %d", pos[0]); for (i = 1; i < numCut; i++) { printf(", %d", pos[i]); } } printf("\n"); outputLength = th_brk_insert_breaks (brk, str, out, sizeof out, "<WBR>"); printf ("Output string length is %d\n", outputLength-1); /* the penultimate is \n */ printf ("Output string is %s", out); printf("***********************************************************************\n"); } } } else { strcpy ((char *)str, "ÊÇÑÊ´Õ¤ÃѺ ¡Í.ÃÁ¹. ¹Õèà»ç¹¡Ò÷´ÊͺµÑÇàͧ"); printf ("Testing with string: %s\n", str); numCut = th_brk_find_breaks (brk, str, pos, MAXLINELENGTH); printf ("Total %d cut points.", numCut); if (numCut != 7) { printf("Error! should be 7.. test th_brk_find_breaks() failed...\n"); exit (-1); } printf("Cut points list: %d", pos[0]); for (i = 1; i < numCut; i++) { printf(", %d", pos[i]); } printf("\n"); outputLength = th_brk_insert_breaks (brk, str, out, sizeof out, "<WBR>"); printf ("Output string is %s\n", out); printf ("Output string length is %d\n", outputLength); if (outputLength != 75) { printf ("Error! should be 75.. test th_brk_insert_breaks() failed...\n"); exit (-1); } printf ("*** End of thbrk self test ******\n"); } th_brk_delete (brk); return 0; }
#ifndef __NEURO_H #define __NEURO_H #define OK 0 #define rassert(x) if (!(x)) { void exit(int); fprintf(stderr, "FAIL: %s:%d:%s\n", __FILE__, __LINE__, #x); exit(1); } #include <neuro/stringtable.h> #include <neuro/cmdhandler.h> #include <neuro/ns2net.h> #endif
/**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtGui module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage ** This file contains pre-release code and may not be distributed. ** You may use this file in accordance with the terms and conditions ** contained in the Technology Preview License Agreement accompanying ** this package. ** ** 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, 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. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. ** ** ** ** ** ** ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QRGB_H #define QRGB_H #include <QtCore/qglobal.h> QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Gui) typedef unsigned int QRgb; // RGB triplet const QRgb RGB_MASK = 0x00ffffff; // masks RGB values Q_GUI_EXPORT_INLINE int qRed(QRgb rgb) // get red part of RGB { return ((rgb >> 16) & 0xff); } Q_GUI_EXPORT_INLINE int qGreen(QRgb rgb) // get green part of RGB { return ((rgb >> 8) & 0xff); } Q_GUI_EXPORT_INLINE int qBlue(QRgb rgb) // get blue part of RGB { return (rgb & 0xff); } Q_GUI_EXPORT_INLINE int qAlpha(QRgb rgb) // get alpha part of RGBA { return ((rgb >> 24) & 0xff); } Q_GUI_EXPORT_INLINE QRgb qRgb(int r, int g, int b)// set RGB value { return (0xffu << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff); } Q_GUI_EXPORT_INLINE QRgb qRgba(int r, int g, int b, int a)// set RGBA value { return ((a & 0xff) << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff); } Q_GUI_EXPORT_INLINE int qGray(int r, int g, int b)// convert R,G,B to gray 0..255 { return (r*11+g*16+b*5)/32; } Q_GUI_EXPORT_INLINE int qGray(QRgb rgb) // convert RGB to gray 0..255 { return qGray(qRed(rgb), qGreen(rgb), qBlue(rgb)); } Q_GUI_EXPORT_INLINE bool qIsGray(QRgb rgb) { return qRed(rgb) == qGreen(rgb) && qRed(rgb) == qBlue(rgb); } QT_END_NAMESPACE QT_END_HEADER #endif // QRGB_H
/** * @defgroup Win Win * @ingroup Elementary * * @image html win_inheritance_tree.png * @image latex win_inheritance_tree.eps * * @image html img/widget/win/preview-00.png * @image latex img/widget/win/preview-00.eps * * The window class of Elementary. Contains functions to manipulate * windows. The Evas engine used to render the window contents is specified * in the system or user elementary config files (whichever is found last), * and can be overridden with the ELM_ENGINE environment variable for * testing. Engines that may be supported (depending on Evas and Ecore-Evas * compilation setup and modules actually installed at runtime) are (listed * in order of best supported and most likely to be complete and work to * lowest quality). Note that ELM_ENGINE is really only needed for special * cases and debugging. you should normally use ELM_DISPLAY and ELM_ACCEL * environment variables, or core elementary config. ELM_DISPLAY can be set to * "x11" or "wl" to indicate the target display system (as on Linux systems * you may have both display systems available, so this selects which to use). * ELM_ACCEL may also be set to indicate if you want accelerations and which * kind to use. see elm_config_accel_preference_set(0 for details on this * environment variable values. * * @li "x11", "x", "software-x11", "software_x11" (Software rendering in X11) * @li "gl", "opengl", "opengl-x11", "opengl_x11" (OpenGL or OpenGL-ES2 * rendering in X11) * @li "shot:..." (Virtual screenshot renderer - renders to output file and * exits) * @li "fb", "software-fb", "software_fb" (Linux framebuffer direct software * rendering) * @li "fb", "software-fb", "software_fb" (Linux framebuffer accelerated * rendering) * @li "sdl", "software-sdl", "software_sdl" (SDL software rendering to SDL * buffer) * @li "gl-sdl", "gl_sdl", "opengl-sdl", "opengl_sdl" (OpenGL or OpenGL-ES2 * rendering using SDL as the buffer) * @li "gdi", "software-gdi", "software_gdi" (Windows WIN32 rendering via * GDI with software) * @li "ews" (rendering to EWS - Ecore + Evas Single Process Windowing System) * @li "gl-cocoa", "gl_cocoa", "opengl-cocoa", "opengl_cocoa" (OpenGL rendering in Cocoa) * @li "wayland_shm" (Wayland client SHM rendering) * @li "wayland_egl" (Wayland client OpenGL/EGL rendering) * @li "drm" (Linux drm/kms etc. direct display) * * All engines use a simple string to select the engine to render, EXCEPT * the "shot" engine. This actually encodes the output of the virtual * screenshot and how long to delay in the engine string. The engine string * is encoded in the following way: * * "shot:[delay=XX][:][repeat=DDD][:][file=XX]" * * Where options are separated by a ":" char if more than one option is * given, with delay, if provided being the first option and file the last * (order is important). The delay specifies how long to wait after the * window is shown before doing the virtual "in memory" rendering and then * save the output to the file specified by the file option (and then exit). * If no delay is given, the default is 0.5 seconds. If no file is given the * default output file is "out.png". Repeat option is for continuous * capturing screenshots. Repeat range is from 1 to 999 and filename is * fixed to "out001.png" Some examples of using the shot engine: * * ELM_ENGINE="shot:delay=1.0:repeat=5:file=elm_test.png" elementary_test * ELM_ENGINE="shot:delay=1.0:file=elm_test.png" elementary_test * ELM_ENGINE="shot:file=elm_test2.png" elementary_test * ELM_ENGINE="shot:delay=2.0" elementary_test * ELM_ENGINE="shot:" elementary_test * * Signals that you can add callbacks for are: * * @li "delete,request": the user requested to close the window. See * elm_win_autodel_set() and elm_win_autohide_set(). * @li "focus,in": window got focus (deprecated. use "focused" instead.) * @li "focus,out": window lost focus (deprecated. use "unfocused" instead.) * @li "moved": window that holds the canvas was moved * @li "withdrawn": window is still managed normally but removed from view * @li "iconified": window is minimized (perhaps into an icon or taskbar) * @li "normal": window is in a normal state (not withdrawn or iconified) * @li "stick": window has become sticky (shows on all desktops) * @li "unstick": window has stopped being sticky * @li "fullscreen": window has become fullscreen * @li "unfullscreen": window has stopped being fullscreen * @li "maximized": window has been maximized * @li "unmaximized": window has stopped being maximized * @li "ioerr": there has been a low-level I/O error with the display system * @li "indicator,prop,changed": an indicator's property has been changed * @li "rotation,changed": window rotation has been changed * @li "profile,changed": profile of the window has been changed * @li "focused" : When the win has received focus. (since 1.8) * @li "unfocused" : When the win has lost focus. (since 1.8) * @li "theme,changed" - The theme was changed. (since 1.13) * * Note that calling evas_object_show() after window contents creation is * recommended. It will trigger evas_smart_objects_calculate() and some backend * calls directly. For example, XMapWindow is called directly during * evas_object_show() in X11 engine. * * Examples: * @li @ref win_example_01 * * @{ */ #include <elm_win_common.h> #ifdef EFL_EO_API_SUPPORT #include <elm_win_eo.h> #endif #ifndef EFL_NOLEGACY_API_SUPPORT #include <elm_win_legacy.h> #endif /** * @} */
/* * Interfaces MIB group interface - interfaces.h * */ #ifndef _MIBGROUP_INTERFACES_H #define _MIBGROUP_INTERFACES_H /*********************************************************************** * configure macros */ config_require(util_funcs) /* * conflicts with the new MFD rewrite */ config_exclude(if-mib/ifTable/ifTable) #if !defined(WIN32) && !defined(cygwin) config_require(if-mib/data_access/interface) #endif config_arch_require(solaris2, kernel_sunos5) /* * need get_address in var_route for some platforms (USE_SYSCTL_IFLIST). * Not sure if that can be translated into a config_arch_require, so be * indiscriminate for now. */ config_require(mibII/var_route) /*********************************************************************** */ #ifndef USING_IF_MIB_IFTABLE_MODULE #ifdef hpux11 #include <sys/mib.h> #else struct in_ifaddr; struct ifnet; #endif int Interface_Scan_Get_Count(void); int Interface_Index_By_Name(char *, int); void Interface_Scan_Init(void); #if defined(linux) || defined(sunV3) struct in_ifaddr { int dummy; }; #endif #if defined(hpux11) int Interface_Scan_Next(short *, char *, nmapi_phystat *); #else int Interface_Scan_Next(short *, char *, struct ifnet *, struct in_ifaddr *); #endif void init_interfaces(void); extern FindVarMethod var_interfaces; extern FindVarMethod var_ifEntry; #endif /* USING_IF_MIB_IFTABLE_MODULE */ #define IFNUMBER 0 #define IFINDEX 1 #define IFDESCR 2 #define NETSNMP_IFTYPE 3 #define IFMTU 4 #define IFSPEED 5 #define IFPHYSADDRESS 6 #define IFADMINSTATUS 7 #define IFOPERSTATUS 8 #define IFLASTCHANGE 9 #define IFINOCTETS 10 #define IFINUCASTPKTS 11 #define IFINNUCASTPKTS 12 #define IFINDISCARDS 13 #define IFINERRORS 14 #define IFINUNKNOWNPROTOS 15 #define IFOUTOCTETS 16 #define IFOUTUCASTPKTS 17 #define IFOUTNUCASTPKTS 18 #define IFOUTDISCARDS 19 #define IFOUTERRORS 20 #define IFOUTQLEN 21 #define IFSPECIFIC 22 #ifdef linux /* * this struct ifnet is cloned from the generic type and somewhat modified. * it will not work for other un*x'es... */ struct ifnet { char *if_name; /* name, e.g. ``en'' or ``lo'' */ char *if_unit; /* sub-unit for lower level driver */ short if_mtu; /* maximum transmission unit */ short if_flags; /* up/down, broadcast, etc. */ int if_metric; /* routing metric (external only) */ char if_hwaddr[6]; /* ethernet address */ int if_type; /* interface type: 1=generic, * 28=slip, ether=6, loopback=24 */ u_long if_speed; /* interface speed: in bits/sec */ struct sockaddr if_addr; /* interface's address */ struct sockaddr ifu_broadaddr; /* broadcast address */ struct sockaddr ia_subnetmask; /* interface's mask */ struct ifqueue { int ifq_len; int ifq_drops; } if_snd; /* output queue */ u_long if_ibytes; /* octets received on interface */ u_long if_ipackets; /* packets received on interface */ u_long if_ierrors; /* input errors on interface */ u_long if_iqdrops; /* input queue overruns */ u_long if_obytes; /* octets sent on interface */ u_long if_opackets; /* packets sent on interface */ u_long if_oerrors; /* output errors on interface */ u_long if_collisions; /* collisions on csma interfaces */ /* * end statistics */ struct ifnet *if_next; }; #endif /* linux */ #endif /* _MIBGROUP_INTERFACES_H */
/* * GPAC Multimedia Framework * * Authors: Jean Le Feuvre * Copyright (c) Telecom ParisTech 2005-2012 * All rights reserved * * This file is part of GPAC / X11 video output module * * GPAC 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, or (at your option) * any later version. * * GPAC 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; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ #ifndef _X11_OUT_H #define _X11_OUT_H #ifdef __cplusplus extern "C" { #endif #include <gpac/modules/video_out.h> #include <gpac/thread.h> #include <gpac/list.h> #include <X11/Xlib.h> #include <X11/Xutil.h> #include <X11/keysym.h> #if !defined(GPAC_DISABLE_3D) && !defined(GPAC_USE_OGL_ES) && !defined(GPAC_USE_TINYGL) #define GPAC_HAS_OPENGL #endif #ifdef GPAC_HAS_OPENGL #include <GL/glx.h> #endif #ifdef GPAC_HAS_X11_SHM #include <X11/extensions/XShm.h> #include <sys/ipc.h> #include <sys/shm.h> #endif #ifdef GPAC_HAS_X11_XV #include <X11/extensions/Xv.h> #include <X11/extensions/Xvlib.h> #endif #if defined(ENABLE_JOYSTICK) || defined(ENABLE_JOYSTICK_NO_CURSOR) #include <linux/joystick.h> #include <unistd.h> #include <fcntl.h> #endif #define X11VID() XWindow *xWindow = (XWindow *)vout->opaque; #define RGB555(r,g,b) (((r&248)<<7) + ((g&248)<<2) + (b>>3)) #define RGB565(r,g,b) (((r&248)<<8) + ((g&252)<<3) + (b>>3)) typedef struct { Window par_wnd; //main window handler passed to module, NULL otherwise Bool setup_done, no_select_input; //setup is done Display *display; //required by all X11 method, provide by XOpenDisplay, Mozilla wnd ... Window wnd; //window handler created by module Window full_wnd; //full screen Screen *screenptr; //X11 stuff int screennum; //... Visual *visual; //... GC the_gc; //graphics context XImage *surface; //main drawing image: software mode Pixmap pixmap; u32 pwidth, pheight; u32 init_flags; Atom WM_DELETE_WINDOW; //window deletion Bool use_shared_memory; // /*screensaver state*/ int ss_t, ss_b, ss_i, ss_e; #ifdef GPAC_HAS_X11_SHM XShmSegmentInfo *shmseginfo; #endif /*YUV overlay*/ #ifdef GPAC_HAS_X11_XV int xvport; u32 xv_pf_format; XvImage *overlay; #endif Bool is_init, fullscreen, has_focus; /*backbuffer size before entering fullscreen mode (used for restore) */ u32 store_width, store_height; u32 w_width, w_height; u32 depth, bpp, pixel_format; u32 output_3d_mode; #ifdef GPAC_HAS_OPENGL XVisualInfo *glx_visualinfo; GLXContext glx_context; Pixmap gl_pixmap; GLXPixmap gl_offscreen; Window gl_wnd; u32 offscreen_type; #endif #if defined(ENABLE_JOYSTICK) || defined(ENABLE_JOYSTICK_NO_CURSOR) /*joystick device file descriptor*/ s32 prev_x, prev_y, fd; #endif } XWindow; void StretchBits (void *dst, u32 dst_bpp, u32 dst_w, u32 dst_h, u32 dst_pitch, void *src, u32 src_bpp, u32 src_w, u32 src_h, u32 src_pitch, Bool FlipIt); #endif /* _X11_OUT_H */
/* * Copyright (C) 2009-2012 Felipe Contreras * * Author: Felipe Contreras <felipe.contreras@gmail.com> * * This file may be used under the terms of the GNU Lesser General Public * License version 2.1. */ #include "gstav_h264enc.h" #include "gstav_venc.h" #include "plugin.h" #include <libavcodec/avcodec.h> #include <libavutil/opt.h> #include <gst/tag/tag.h> #include <stdlib.h> #include <string.h> /* for memcpy */ #include <stdbool.h> #include "util.h" #define GST_CAT_DEFAULT gstav_debug struct obj { struct gst_av_venc parent; }; struct obj_class { GstElementClass parent_class; }; #if LIBAVUTIL_VERSION_MAJOR < 52 && !(LIBAVUTIL_VERSION_MAJOR == 51 && LIBAVUTIL_VERSION_MINOR >= 12) static int av_opt_set(void *obj, const char *name, const char *val, int search_flags) { return av_set_string3(obj, name, val, 0, NULL); } #endif static void init_ctx(struct gst_av_venc *base, AVCodecContext *ctx) { av_opt_set(ctx->priv_data, "preset", "medium", 0); av_opt_set(ctx->priv_data, "profile", "baseline", 0); av_opt_set(ctx->priv_data, "x264opts", "annexb=1", 0); av_opt_set_int(ctx->priv_data, "aud", 1, 0); } static GstCaps * generate_src_template(void) { GstCaps *caps; GstStructure *struc; caps = gst_caps_new_empty(); struc = gst_structure_new("video/x-h264", "stream-format", G_TYPE_STRING, "byte-stream", "alignment", G_TYPE_STRING, "au", NULL); gst_caps_append_structure(caps, struc); return caps; } static GstCaps * generate_sink_template(void) { GstCaps *caps; caps = gst_caps_new_simple("video/x-raw-yuv", "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC('I', '4', '2', '0'), NULL); return caps; } static void instance_init(GTypeInstance *instance, void *g_class) { struct gst_av_venc *venc = (struct gst_av_venc *)instance; venc->codec_id = CODEC_ID_H264; venc->init_ctx = init_ctx; } static void base_init(void *g_class) { GstElementClass *element_class = g_class; GstPadTemplate *template; gst_element_class_set_details_simple(element_class, "av h264 video encoder", "Coder/Encoder/Video", "H.264 encoder wrapper for libavcodec", "Felipe Contreras"); template = gst_pad_template_new("src", GST_PAD_SRC, GST_PAD_ALWAYS, generate_src_template()); gst_element_class_add_pad_template(element_class, template); template = gst_pad_template_new("sink", GST_PAD_SINK, GST_PAD_ALWAYS, generate_sink_template()); gst_element_class_add_pad_template(element_class, template); } GType gst_av_h264enc_get_type(void) { static GType type; if (G_UNLIKELY(type == 0)) { GTypeInfo type_info = { .class_size = sizeof(struct obj_class), .base_init = base_init, .instance_size = sizeof(struct obj), .instance_init = instance_init, }; type = g_type_register_static(GST_AV_VENC_TYPE, "GstAVH264Enc", &type_info, 0); } return type; }
/* * Copyright (C) 2014 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the licence, 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, see <http://www.gnu.org/licenses/>. * * Author: Matthew Barnes <mbarnes@redhat.com> */ #ifndef __GDAV_SUPPORTED_CALENDAR_COMPONENT_SET_PROPERTY_H__ #define __GDAV_SUPPORTED_CALENDAR_COMPONENT_SET_PROPERTY_H__ #include <libgdav/gdav-property.h> /* Standard GObject macros */ #define GDAV_TYPE_SUPPORTED_CALENDAR_COMPONENT_SET_PROPERTY \ (gdav_supported_calendar_component_set_property_get_type ()) #define GDAV_SUPPORTED_CALENDAR_COMPONENT_SET_PROPERTY(obj) \ (G_TYPE_CHECK_INSTANCE_CAST \ ((obj), GDAV_TYPE_SUPPORTED_CALENDAR_COMPONENT_SET_PROPERTY, GDavSupportedCalendarComponentSetProperty)) #define GDAV_IS_SUPPORTED_CALENDAR_COMPONENT_SET_PROPERTY(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE \ ((obj), GDAV_TYPE_SUPPORTED_CALENDAR_COMPONENT_SET_PROPERTY)) G_BEGIN_DECLS typedef struct _GDavSupportedCalendarComponentSetProperty GDavSupportedCalendarComponentSetProperty; typedef struct _GDavSupportedCalendarComponentSetPropertyClass GDavSupportedCalendarComponentSetPropertyClass; typedef struct _GDavSupportedCalendarComponentSetPropertyPrivate GDavSupportedCalendarComponentSetPropertyPrivate; struct _GDavSupportedCalendarComponentSetProperty { GDavProperty parent; GDavSupportedCalendarComponentSetPropertyPrivate *priv; }; struct _GDavSupportedCalendarComponentSetPropertyClass { GDavPropertyClass parent_class; }; GType gdav_supported_calendar_component_set_property_get_type (void) G_GNUC_CONST; G_END_DECLS #endif /* __GDAV_SUPPORTED_CALENDAR_COMPONENT_SET_PROPERTY_H__ */
/* Static5 is engaged with type BIGINT and ggd(vec) */ #include "lie.h" #ifdef __STDC__ static entry gcd(entry x,entry y); static entry abs_minimum(vector* v_vec); static boolean equal_elements(vector* v_vec); #endif static bigint* bin_from_int(i) intcel* i; { entry k = i->intval; freemem(i); return entry2bigint(k); } static intcel* int_from_bin(b) bigint* b; { entry k = bigint2entry(b); freemem(b); return mkintcel(k); } static object vid_factor_bin(b) object b; { return (object) Factor((bigint *) b); } /* Transform a vector into a matrix with the same components as the vector, when read by rows */ static object mat_matvec_vec_int(object v,object nrows_object) { index size=v->v.ncomp, nrows, ncols=nrows_object->i.intval; if (ncols<=0) error("Number of columns should be positive.\n"); if (size%ncols!=0) error ("Number of columns should divide size of vector.\n"); { matrix* m=mkmatrix(nrows=size/ncols,ncols); index i,j,k=0; for (i=0; i<nrows; ++i) for (j=0; j<ncols; ++j) m->elm[i][j]=v->v.compon[k++]; /* |k==ncols*i+j| before increment */ return (object) m; } } static entry gcd(x,y) entry x,y; { /* Requirement 0<x <= y */ entry r = x; if (y==0) return 0; while (r) { x = y % r; y = r; r = x; /* x <= y */ } return y; } static entry abs_minimum(vector* v_vec) /* return minimal absoulte value of nonzero array elements, or 0 when all elements are 0. */ { index i; boolean is_zero=true; index n = v_vec->ncomp; entry* v = v_vec->compon; index minimum=0; for (i=0; i<n; ++i) if (v[i]!=0) if (is_zero) { is_zero=false; minimum=labs(v[i]); } else { entry c = labs(v[i]); if (c<minimum) minimum = c; } return minimum; } static boolean equal_elements(v_vec) vector* v_vec; /* Do all nonzero elements have the same absolute value? */ { index i, first = 0; index n = v_vec->ncomp; entry* v = v_vec->compon; /* Omit prefixed 0 */ while (first < n && v[first]==0) first++; if (first == n) return true; /* All zero */ i = first + 1; while (i < n && (v[i]== 0 || labs(v[first]) == labs(v[i]))) i++; if (i == n) return true; return false; } object int_gcd_vec(v_vec) vector *v_vec; { entry r = abs_minimum(v_vec); entry *v; index i; index n = v_vec->ncomp; if (isshared(v_vec)) v_vec = copyvector(v_vec); v = v_vec->compon; while (!equal_elements(v_vec)) { for (i=0;i<n;i++) v[i] = gcd(r, v[i]); r = abs_minimum(v_vec); } return (object) mkintcel(r); } Symbrec static5[] = { C1("$bigint", (fobject)bin_from_int, BIGINT, INTEGER) C1("$intbig", (fobject)int_from_bin, INTEGER, BIGINT) C1("factor", vid_factor_bin, VOID, BIGINT) C2("mat_vec", mat_matvec_vec_int,MATRIX,VECTOR,INTEGER) C1("gcd",int_gcd_vec, INTEGER, VECTOR) }; int nstatic5 = array_size(static5); #ifdef __STDC__ # define P(s) s #else # define P(s) () #endif bigint* (*int2bin) P((intcel*)) = bin_from_int; intcel* (*bin2int) P((bigint*)) = int_from_bin;
/*************** <auto-copyright.pl BEGIN do not edit this line> ************** * * VR Juggler is (C) Copyright 1998-2007 by Iowa State University * * Original Authors: * Allen Bierbaum, Christopher Just, * Patrick Hartling, Kevin Meinert, * Carolina Cruz-Neira, Albert Baker * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * *************** <auto-copyright.pl END do not edit this line> ***************/ #ifndef _VRJ_DRAW_MANAGER_H_ #define _VRJ_DRAW_MANAGER_H_ #include <vrj/vrjConfig.h> #include <iostream> #include <jccl/RTRC/ConfigElementHandler.h> #include <vrj/Display/DisplayPtr.h> namespace vrj { class DisplayManager; class App; /** \class DrawManager DrawManager.h vrj/Draw/DrawManager.h * * Abstract base class for API-specific Draw Manager. * * Concrete classes are resonsible for all rendering. * * @date 9-7-97 */ class VJ_CLASS_API DrawManager : public jccl::ConfigElementHandler { public: DrawManager() : mDisplayManager(NULL) { /* Do nothing. */ ; } virtual ~DrawManager() { /* Do nothing. */ ; } /** * Function to initialy config API-specific stuff. * Takes a jccl::Configuration and extracts API-specific stuff. */ //**//virtual void configInitial(jccl::Configuration* cfg) = 0; /// Enable a frame to be drawn virtual void draw() = 0; /** * Blocks until the end of the frame. * @post The frame has been drawn. */ virtual void sync() = 0; /** * Sets the application with which the Draw Manager will interact. * * @note The member variable is not in the base class because its "real" * type is only known in the derived classes. */ virtual void setApp(App* app) = 0; /** * Initializes the drawing API (if not already running). * * @note If the draw manager should be an active object, start the process * here. */ virtual void initAPI() = 0; /** Callback when display is added to Display Manager. */ virtual void addDisplay(DisplayPtr disp) = 0; /** Callback when display is removed to Display Manager. */ virtual void removeDisplay(DisplayPtr disp) = 0; /** * Shuts down the drawing API. * * @note If it was an active object, kill process here. */ virtual void closeAPI() = 0; /** Setter for Display Manager variable. */ void setDisplayManager(DisplayManager* dispMgr); DisplayManager* getDisplayManager(); friend VJ_API(std::ostream&) operator<<(std::ostream& out, DrawManager& drawMgr); virtual void outStream(std::ostream& out) { out << "vrj::DrawManager: outstream\n"; // Set a default } protected: DisplayManager* mDisplayManager; /**< The display manager dealing with */ }; } // End of vrj namespace #endif
/* * CrocoPat is a tool for relational programming. * This file is part of CrocoPat. * * Copyright (C) 2002-2008 Dirk Beyer * * CrocoPat 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. * * CrocoPat 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 CrocoPat; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Please find the GNU Lesser General Public License in file * License_LGPL.txt or at http://www.gnu.org/licenses/lgpl.txt * * Author: * Dirk Beyer (firstname.lastname@sfu.ca) * Simon Fraser University * * With contributions of: Andreas Noack, Michael Vogel */ #ifndef _relStrExpr_h #define _relStrExpr_h #include "relString.h" #include "relNumExpr.h" #include <string> #include <sstream> /// Global variables for interpreter. extern map<string, relDataType*> gVariables; /// Cmd line arg handling for the interpreter. extern char** gArgv; extern int gArgc; /// Global function. extern string double2string(double pNum); ////////////////////////////////////////////////////////////////////////////// class relStrExpr : public relObject { public: virtual relString interpret(bddSymTab* pSymTab) = 0; }; ////////////////////////////////////////////////////////////////////////////// class relStrExprVar : public relStrExpr { private: string* mVar; public: relStrExprVar(string* pVar) : mVar(pVar) {} ~relStrExprVar() { delete mVar; } virtual relString interpret(bddSymTab* pSymTab) { // Fetch result. map<string, relDataType*>::const_iterator lVarIt = gVariables.find(*mVar); assert(lVarIt != gVariables.end()); // Must be declared. assert(lVarIt->second != NULL); relString* lResult = dynamic_cast<relString*>(lVarIt->second); assert(lResult != NULL); // Must be a STRING variable. return *lResult; } }; ////////////////////////////////////////////////////////////////////////////// class relStrExprConst : public relStrExpr { private: string* mVal; public: relStrExprConst(string* pVal) : mVal(pVal) {} ~relStrExprConst() { delete mVal; } virtual relString interpret(bddSymTab* pSymTab) { return relString(*mVal); } }; ////////////////////////////////////////////////////////////////////////////// class relStrExprBinOp : public relStrExpr { public: typedef enum {CONCAT} relStrOP; private: relStrExpr* mExpr1; relStrOP mOp; relStrExpr* mExpr2; public: relStrExprBinOp( relStrExpr* pExpr1, relStrOP pOp, relStrExpr* pExpr2) : mExpr1(pExpr1), mOp(pOp), mExpr2(pExpr2) {} ~relStrExprBinOp() { delete mExpr1; delete mExpr2; } virtual relString interpret(bddSymTab* pSymTab) { relString lExpr1 = mExpr1->interpret(pSymTab); relString lExpr2 = mExpr2->interpret(pSymTab); relString result(""); if (mOp == CONCAT) result.setValue(lExpr1.getValue() + lExpr2.getValue()); else { cerr << "Internal error: Unknown operator in relStrExprBinOp::interpret." << endl; abort(); } return result; } }; ////////////////////////////////////////////////////////////////////////////// class relStrExprElem : public relStrExpr { private: relExpression* mExpr; public: relStrExprElem(relExpression* pExpr) : mExpr(pExpr) {} ~relStrExprElem(); virtual relString interpret(bddSymTab* pSymTab); }; ////////////////////////////////////////////////////////////////////////////// class relStrExprNum : public relStrExpr { private: relNumExpr* mExpr; public: relStrExprNum(relNumExpr* pExpr) : mExpr(pExpr) {} ~relStrExprNum() { delete mExpr; } virtual relString interpret(bddSymTab* pSymTab) { return relString(double2string(mExpr->interpret(pSymTab).getValue())); } }; ////////////////////////////////////////////////////////////////////////////// class relStrCmdArg : public relStrExpr { private: relNumExpr* mExpr; public: relStrCmdArg(relNumExpr* pExpr) : mExpr(pExpr) {} ~relStrCmdArg() { delete mExpr; } virtual relString interpret(bddSymTab* pSymTab) { int lPos = (int) mExpr->interpret(pSymTab).getValue(); if (lPos >= 0 && lPos < gArgc) { return relString(string(gArgv[lPos])); } else { cerr << "Error: Missing command line argument '$" << lPos << "'." << endl; exit(EXIT_FAILURE); } } }; #endif
// Created file "Lib\src\Uuid\oledbdat" typedef struct _GUID { unsigned long Data1; unsigned short Data2; unsigned short Data3; unsigned char Data4[8]; } GUID; #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ extern const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } DEFINE_GUID(DBROWCOL_ISROOT, 0x0c733ab6, 0x2a1c, 0x11ce, 0xad, 0xe5, 0x00, 0xaa, 0x00, 0x44, 0x77, 0x3d);
/* Copyright 2013-2021 Paul Colby This file is part of QtAws. QtAws is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. QtAws is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the QtAws. If not, see <http://www.gnu.org/licenses/>. */ #ifndef QTAWS_DESCRIBEAPPINSTANCEUSERREQUEST_H #define QTAWS_DESCRIBEAPPINSTANCEUSERREQUEST_H #include "chimerequest.h" namespace QtAws { namespace Chime { class DescribeAppInstanceUserRequestPrivate; class QTAWSCHIME_EXPORT DescribeAppInstanceUserRequest : public ChimeRequest { public: DescribeAppInstanceUserRequest(const DescribeAppInstanceUserRequest &other); DescribeAppInstanceUserRequest(); virtual bool isValid() const Q_DECL_OVERRIDE; protected: virtual QtAws::Core::AwsAbstractResponse * response(QNetworkReply * const reply) const Q_DECL_OVERRIDE; private: Q_DECLARE_PRIVATE(DescribeAppInstanceUserRequest) }; } // namespace Chime } // namespace QtAws #endif
/* Copyright 2013-2021 Paul Colby This file is part of QtAws. QtAws is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. QtAws is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the QtAws. If not, see <http://www.gnu.org/licenses/>. */ #ifndef QTAWS_DESCRIBESERVICESRESPONSE_H #define QTAWS_DESCRIBESERVICESRESPONSE_H #include "pricingresponse.h" #include "describeservicesrequest.h" namespace QtAws { namespace Pricing { class DescribeServicesResponsePrivate; class QTAWSPRICING_EXPORT DescribeServicesResponse : public PricingResponse { Q_OBJECT public: DescribeServicesResponse(const DescribeServicesRequest &request, QNetworkReply * const reply, QObject * const parent = 0); virtual const DescribeServicesRequest * request() const Q_DECL_OVERRIDE; protected slots: virtual void parseSuccess(QIODevice &response) Q_DECL_OVERRIDE; private: Q_DECLARE_PRIVATE(DescribeServicesResponse) Q_DISABLE_COPY(DescribeServicesResponse) }; } // namespace Pricing } // namespace QtAws #endif
/***************************************************************************** ** Copyright (c) 2012 Ushahidi Inc ** All rights reserved ** Contact: team@ushahidi.com ** Website: http://www.ushahidi.com ** ** GNU Lesser General Public License Usage ** This file may be used under the terms of the GNU Lesser ** General Public License version 3 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 3 requirements ** will be met: http://www.gnu.org/licenses/lgpl.html. ** ** ** If you have questions regarding the use of this file, please contact ** Ushahidi developers at team@ushahidi.com. ** *****************************************************************************/ #import <Ushahidi/USHAddViewController.h> #import <Ushahidi/USHDatePicker.h> #import <Ushahidi/USHLocator.h> #import <Ushahidi/USHImagePicker.h> #import <Ushahidi/USHVideoPicker.h> #import <Ushahidi/USHLoginDialog.h> #import <Ushahidi/Ushahidi.h> #import <Ushahidi/USHShareController.h> #import "USHInputTableCell.h" #import "USHCustomFieldsAddViewController.h" @class USHCategoryTableViewController; @class USHLocationAddViewController; @class USHSettingsViewController; @class USHMap; @class USHReport; @interface USHReportAddViewController : USHAddViewController<UshahidiDelegate, USHDatePickerDelegate, UIAlertViewDelegate, USHLocatorDelegate, USHImagePickerDelegate, USHVideoPickerDelegate, USHInputTableCellDelegate, USHLoginDialogDelegate, USHShareControllerDelegate> @property (retain, nonatomic) IBOutlet USHCustomFieldsAddViewController *customFiedlsAddViewController; @property (strong, nonatomic) IBOutlet USHCategoryTableViewController *categoryTableController; @property (strong, nonatomic) IBOutlet USHLocationAddViewController *locationAddViewController; @property (strong, nonatomic) IBOutlet USHSettingsViewController *settingsViewController; @property (strong, nonatomic) USHMap *map; @property (strong, nonatomic) USHReport *report; @property (assign, nonatomic) BOOL openGeoSMS; - (IBAction)info:(id)sender event:(UIEvent*)event; @end
// Created file "Lib\src\dxguid\X64\d3d9guid" typedef struct _GUID { unsigned long Data1; unsigned short Data2; unsigned short Data3; unsigned char Data4[8]; } GUID; #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ extern const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } DEFINE_GUID(PPM_THERMAL_POLICY_CHANGE_GUID, 0x48f377b8, 0x6880, 0x4c7b, 0x8b, 0xdc, 0x38, 0x01, 0x76, 0xc6, 0x65, 0x4d);
#pragma once #pragma region Imported API extern "C" NTSYSAPI NTSTATUS NTAPI ZwWaitForSingleObject( __in HANDLE Handle, __in BOOLEAN Alertable, __in_opt PLARGE_INTEGER Timeout); typedef struct _THREAD_BASIC_INFORMATION { NTSTATUS ExitStatus; PVOID TebBaseAddress; CLIENT_ID ClientId; KAFFINITY AffinityMask; KPRIORITY Priority; KPRIORITY BasePriority; } THREAD_BASIC_INFORMATION, *PTHREAD_BASIC_INFORMATION; extern "C" NTSTATUS NTAPI ZwQueryInformationThread(HANDLE ThreadHandle, THREADINFOCLASS ThreadInformationClass, PVOID ThreadInformation, ULONG ThreadInformationLength, PULONG ReturnLength); #pragma endregion namespace BazisLib { namespace _ThreadPrivate { //! Represents a kernel thread. /*! The _BasicThread template class represents a single kernel thread and contains methods for controlling it. The thread body is defined through the template parameter (DescendantClass::ThreadStarter static function is called, passing <b>this</b> as a parameter). That allows declaring VT-less thread classes. However, as VT is not a huge overhead, a classical pure method-based BazisLib::Win32::Thread class is provided. */ template <class DescendantClass> class _BasicThread { private: HANDLE m_hThread; CLIENT_ID m_ID; protected: typedef void _ThreadBodyReturnType; static inline _ThreadBodyReturnType _ReturnFromThread(void *pArg, ULONG retcode) { PsTerminateSystemThread((NTSTATUS)retcode); } public: //! Initializes the thread object, but does not start the thread /*! This constructor does not create actual Win32 thread. To create the thread and to start it, call the Start() method. */ _BasicThread() : m_hThread(NULL) { m_ID.UniqueProcess = m_ID.UniqueThread = 0; } bool Start(HANDLE hProcessToInject = NULL) { if (m_hThread) return false; OBJECT_ATTRIBUTES threadAttr; InitializeObjectAttributes(&threadAttr, NULL, OBJ_KERNEL_HANDLE, 0, NULL); NTSTATUS st = PsCreateSystemThread(&m_hThread, THREAD_ALL_ACCESS, &threadAttr, hProcessToInject, &m_ID, DescendantClass::ThreadStarter, this); if (!NT_SUCCESS(st)) return false; return true; } /*bool Terminate() { return false; }*/ //! Waits for the thread to complete bool Join() { if (!m_hThread) return true; if (PsGetCurrentThreadId() == m_ID.UniqueThread) return true; ZwWaitForSingleObject(m_hThread, FALSE, NULL); return true; } bool Join(unsigned timeoutInMsec) { if (!m_hThread) return true; if (PsGetCurrentThreadId() == m_ID.UniqueThread) return true; LARGE_INTEGER interval; interval.QuadPart = (ULONGLONG)(-((LONGLONG)timeoutInMsec) * 10000); NTSTATUS st = ZwWaitForSingleObject(m_hThread, FALSE, &interval); return st == STATUS_SUCCESS; } bool IsRunning() { if (!m_hThread) return false; LARGE_INTEGER zero = {0,}; return ZwWaitForSingleObject(m_hThread, FALSE, &zero) == STATUS_TIMEOUT; } void Reset() { Join(); m_hThread = NULL; memset(&m_ID, 0, sizeof(m_ID)); } /* bool Suspend() { } bool Resume() { }*/ int GetReturnCode(bool *pbSuccess = NULL) { if (!m_hThread) { if (pbSuccess) *pbSuccess = false; return -1; } THREAD_BASIC_INFORMATION info; NTSTATUS status = ZwQueryInformationThread(m_hThread, ThreadBasicInformation, &info, sizeof(info), NULL); if (!NT_SUCCESS(status)) { if (pbSuccess) *pbSuccess = false; return -1; } if (pbSuccess) *pbSuccess = true; return info.ExitStatus; } unsigned GetThreadID() { return (unsigned)m_ID.UniqueThread; } ~_BasicThread() { Join(); if (m_hThread) ZwClose(m_hThread); } public: static void Sleep(unsigned Millisecs) { LARGE_INTEGER interval; interval.QuadPart = (ULONGLONG)(-((LONGLONG)Millisecs) * 10000); KeDelayExecutionThread(KernelMode, FALSE, &interval); } }; } }
/* Copyright 2013-2021 Paul Colby This file is part of QtAws. QtAws is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. QtAws is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the QtAws. If not, see <http://www.gnu.org/licenses/>. */ #ifndef QTAWS_VOTEONPROPOSALRESPONSE_H #define QTAWS_VOTEONPROPOSALRESPONSE_H #include "managedblockchainresponse.h" #include "voteonproposalrequest.h" namespace QtAws { namespace ManagedBlockchain { class VoteOnProposalResponsePrivate; class QTAWSMANAGEDBLOCKCHAIN_EXPORT VoteOnProposalResponse : public ManagedBlockchainResponse { Q_OBJECT public: VoteOnProposalResponse(const VoteOnProposalRequest &request, QNetworkReply * const reply, QObject * const parent = 0); virtual const VoteOnProposalRequest * request() const Q_DECL_OVERRIDE; protected slots: virtual void parseSuccess(QIODevice &response) Q_DECL_OVERRIDE; private: Q_DECLARE_PRIVATE(VoteOnProposalResponse) Q_DISABLE_COPY(VoteOnProposalResponse) }; } // namespace ManagedBlockchain } // namespace QtAws #endif
/* Copyright 2013-2021 Paul Colby This file is part of QtAws. QtAws is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. QtAws is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the QtAws. If not, see <http://www.gnu.org/licenses/>. */ #ifndef QTAWS_STARTONDEMANDAPPREPLICATIONRESPONSE_P_H #define QTAWS_STARTONDEMANDAPPREPLICATIONRESPONSE_P_H #include "smsresponse_p.h" namespace QtAws { namespace SMS { class StartOnDemandAppReplicationResponse; class StartOnDemandAppReplicationResponsePrivate : public SmsResponsePrivate { public: explicit StartOnDemandAppReplicationResponsePrivate(StartOnDemandAppReplicationResponse * const q); void parseStartOnDemandAppReplicationResponse(QXmlStreamReader &xml); private: Q_DECLARE_PUBLIC(StartOnDemandAppReplicationResponse) Q_DISABLE_COPY(StartOnDemandAppReplicationResponsePrivate) }; } // namespace SMS } // namespace QtAws #endif
/******************************************************************** ** Image Component Library (ICL) ** ** ** ** Copyright (C) 2006-2013 CITEC, University of Bielefeld ** ** Neuroinformatics Group ** ** Website: www.iclcv.org and ** ** http://opensource.cit-ec.de/projects/icl ** ** ** ** File : ICLFilter/src/ICLFilter/InplaceLogicalOp.h ** ** Module : ICLFilter ** ** Authors: Christof Elbrechter ** ** ** ** ** ** GNU LESSER GENERAL PUBLIC LICENSE ** ** This file may be used under the terms of the GNU Lesser General ** ** Public License version 3.0 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 license requirements will ** ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt ** ** ** ** The development of this software was supported by the ** ** Excellence Cluster EXC 277 Cognitive Interaction Technology. ** ** The Excellence Cluster EXC 277 is a grant of the Deutsche ** ** Forschungsgemeinschaft (DFG) in the context of the German ** ** Excellence Initiative. ** ** ** ********************************************************************/ #pragma once #include <ICLUtils/CompatMacros.h> #include <ICLFilter/InplaceOp.h> namespace icl{ namespace filter{ /// Filter class for logical in-place operations \ingroup INPLACE /** The InplaceLogicalOp class provides functionalities for arbitrary logical in-place operations on images. The operator can be set to implement a certain operation using a given optype value. Logical (non-bit-wise) operations result in images of value 0 or 255.\n Operation list can be split into two sections: - pure logical operations (AND OR XOR and NOT) - bit-wise operations (bit-wise-AND bit-wise-OR bit-wise-XOR and bit-wise-NOT) Pure Logical operations are available for all types; bit-wise operations make no sense on floating point data, hence these operations are available for integer types only. Supported operator types (implementation on pixel value P and operator value V in braces) - <b>andOp</b> "logical and" ((P&&V)*255) - <b>orOp</b> "logical or" ((P||V)*255) - <b>xorOp</b> "logical and" ((!!P xor !!V)*255) - <b>notOp</b> "logical not" ((!P)*255) operator value is not used in this case - <b>binAndOp</b> "binary and" (P&V) [integer types only] - <b>binOrOp</b> "binary or" ((P|V) [integer types only] - <b>binXorOp</b> "binary and" (P^V) [integer types only] - <b>binNotOp</b> "binary not" (~P) operator value is not used in this case [integer types only] \section IPP-Optimization IPP-Optimization is possible, but not yet implemented. */ class ICLFilter_API InplaceLogicalOp : public InplaceOp{ public: enum optype{ andOp=0, ///< logical "and" orOp=1, ///< logical "or" xorOp=2, ///< logical "xor" notOp=3, ///< logical "not" binAndOp=4,///< binary "and" (for integer types only) binOrOp=5, ///< binary "or" (for integer types only) binXorOp=6,///< binary "xor" (for integer types only) binNotOp=7 ///< binary "not" (for integer types only) }; /// Creates a new InplaceLogicalOp instance with given optype and value InplaceLogicalOp(optype t, icl64f value=0): m_eOpType(t),m_dValue(value){} /// applies this operation in-place on given source image virtual core::ImgBase *apply(core::ImgBase *src); /// returns current value icl64f getValue() const { return m_dValue; } /// set current value void setValue(icl64f val){ m_dValue = val; } /// returns current optype optype getOpType() const { return m_eOpType; } /// set current optype void setOpType(optype t) { m_eOpType = t; } private: /// optype optype m_eOpType; /// value icl64f m_dValue; }; } // namespace filter }
#ifndef __TESTNGPPST_TEST_HIERARCHY_SANDBOX_RUNNER_H #define __TESTNGPPST_TEST_HIERARCHY_SANDBOX_RUNNER_H #include <testngppst/testngppst.h> #include <testngppst/runner/TestHierarchyRunner.h> TESTNGPPST_NS_START struct TestCaseRunner; struct TestHierarchySandboxRunnerImpl; struct TestHierarchySandboxRunner : public TestHierarchyRunner { TestHierarchySandboxRunner ( unsigned int maxCurrentProcess , TestCaseRunner*); ~TestHierarchySandboxRunner(); void run ( TestHierarchyHandler* , TestFixtureResultCollector*); private: TestHierarchySandboxRunnerImpl* This; }; TESTNGPPST_NS_END #endif
/* Copyright (C) 2007 <SWGEmu> This File is part of Core3. 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 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 St, Fifth Floor, Boston, MA 02110-1301 USA Linking Engine3 statically or dynamically with other modules is making a combined work based on Engine3. Thus, the terms and conditions of the GNU Lesser General Public License cover the whole combination. In addition, as a special exception, the copyright holders of Engine3 give you permission to combine Engine3 program with free software programs or libraries that are released under the GNU LGPL and with code included in the standard release of Core3 under the GNU LGPL license (or modified versions of such code, with unchanged license). You may copy and distribute such a system following the terms of the GNU LGPL for Engine3 and the licenses of the other code concerned, provided that you include the source code of that other code when and as the GNU LGPL requires distribution of source code. Note that people who make modified versions of Engine3 are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception. */ #ifndef STEADYAIMCOMMAND_H_ #define STEADYAIMCOMMAND_H_ #include "server/zone/objects/scene/SceneObject.h" #include "SquadLeaderCommand.h" class SteadyaimCommand : public SquadLeaderCommand { public: SteadyaimCommand(const String& name, ZoneProcessServer* server) : SquadLeaderCommand(name, server) { } int doQueueCommand(CreatureObject* creature, const uint64& target, const UnicodeString& arguments) { if (!checkStateMask(creature)) return INVALIDSTATE; if (!checkInvalidLocomotions(creature)) return INVALIDLOCOMOTION; if (!creature->isPlayerCreature()) return GENERALERROR; ManagedReference<CreatureObject*> player = cast<CreatureObject*>(creature); ManagedReference<GroupObject*> group = player->getGroup(); if (!checkGroupLeader(player, group)) return GENERALERROR; float skillMod = (float) creature->getSkillMod("steadyaim"); int hamCost = (int) (100.0f * (1.0f - (skillMod / 100.0f))) * calculateGroupModifier(group); int healthCost = creature->calculateCostAdjustment(CreatureAttribute::STRENGTH, hamCost); int actionCost = creature->calculateCostAdjustment(CreatureAttribute::QUICKNESS, hamCost); int mindCost = creature->calculateCostAdjustment(CreatureAttribute::FOCUS, hamCost); if (!inflictHAM(player, healthCost, actionCost, mindCost)) return GENERALERROR; // shoutCommand(player, group); int amount = 5 + skillMod; if (!doSteadyAim(player, group, amount)) return GENERALERROR; if (player->isPlayerCreature() && player->getPlayerObject()->getCommandMessageString(String("steadyaim").hashCode()).isEmpty()==false) { UnicodeString shout(player->getPlayerObject()->getCommandMessageString(String("steadyaim").hashCode())); server->getChatManager()->broadcastMessage(player, shout, 0, 0, 80); } return SUCCESS; } bool doSteadyAim(CreatureObject* leader, GroupObject* group, int amount) { if (leader == NULL || group == NULL) return false; for (int i = 0; i < group->getGroupSize(); i++) { ManagedReference<SceneObject*> member = group->getGroupMember(i); if (!member->isPlayerCreature() || member == NULL || member->getZone() != leader->getZone()) continue; ManagedReference<CreatureObject*> memberPlayer = cast<CreatureObject*>( member.get()); Locker clocker(memberPlayer, leader); sendCombatSpam(memberPlayer); ManagedReference<WeaponObject*> weapon = memberPlayer->getWeapon(); if (!weapon->isRangedWeapon()) continue; int duration = 300; ManagedReference<Buff*> buff = new Buff(memberPlayer, actionCRC, duration, BuffType::SKILL); buff->setSkillModifier("private_aim", amount); memberPlayer->addBuff(buff); } return true; } }; #endif //STEADYAIMCOMMAND_H_
/* Copyright 2013-2021 Paul Colby This file is part of QtAws. QtAws is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. QtAws is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the QtAws. If not, see <http://www.gnu.org/licenses/>. */ #ifndef QTAWS_DELETEBOTREQUEST_P_H #define QTAWS_DELETEBOTREQUEST_P_H #include "lexmodelbuildingservicerequest_p.h" #include "deletebotrequest.h" namespace QtAws { namespace LexModelBuildingService { class DeleteBotRequest; class DeleteBotRequestPrivate : public LexModelBuildingServiceRequestPrivate { public: DeleteBotRequestPrivate(const LexModelBuildingServiceRequest::Action action, DeleteBotRequest * const q); DeleteBotRequestPrivate(const DeleteBotRequestPrivate &other, DeleteBotRequest * const q); private: Q_DECLARE_PUBLIC(DeleteBotRequest) }; } // namespace LexModelBuildingService } // namespace QtAws #endif
#include <rlib/rbinfmt.h> static void dump_opt_hdr (RPeOptHdr * opt) { r_print ("\tLinkerVer: %u.%u\n", opt->major_linker_ver, opt->minor_linker_ver); r_print ("\tEntrypoint: 0x%.8x\n", opt->addr_entrypoint); r_print ("\tCode addr: 0x%.8x\n", opt->base_code); r_print ("\tCode size: 0x%.8x\n", opt->size_code); } static void dump_pe32_image (RPe32ImageHdr * img) { dump_opt_hdr (&img->opt); r_print ("\tImage base: 0x%.8x\n", img->winopt.image_base); r_print ("\tSect align: 0x%.8x\n", img->winopt.section_alignment); r_print ("\tFile align: 0x%.8x\n", img->winopt.file_alignment); r_print ("\tImage size: 0x%.8x\n", img->winopt.size_image); r_print ("\tHeaders size: 0x%.8x\n", img->winopt.size_headers); r_print ("\tOS ver: %u.%u\n", img->winopt.major_os_ver, img->winopt.minor_os_ver); r_print ("\tImage ver: %u.%u\n", img->winopt.major_image_ver, img->winopt.minor_image_ver); r_print ("\tSubSys ver: %u.%u\n", img->winopt.major_subsystem_ver, img->winopt.minor_subsystem_ver); r_print ("\tSubSys: %.4x\n", img->winopt.subsystem); r_print ("\tChecksum: 0x%.8x\n", img->winopt.checksum); r_print ("\tDLL flags: 0x%.4x\n", img->winopt.dll_characteristics); r_print ("\tLoader flags: 0x%.8x\n", img->winopt.loader_flags); r_print ("\tStack: 0x%.8x (res) 0x%.8x (commit)\n", img->winopt.size_stack_reserve, img->winopt.size_stack_commit); r_print ("\tHeap: 0x%.8x (res) 0x%.8x (commit)\n", img->winopt.size_stack_reserve, img->winopt.size_stack_commit); } static void dump_pe32p_image (RPe32PlusImageHdr * img) { dump_opt_hdr (&img->opt); r_print ("\tImage base: 0x%.12"RINT64_MODIFIER"x\n", img->winopt.image_base); r_print ("\tSect align: 0x%.8x\n", img->winopt.section_alignment); r_print ("\tFile align: 0x%.8x\n", img->winopt.file_alignment); r_print ("\tImage size: 0x%.8x\n", img->winopt.size_image); r_print ("\tHeaders size: 0x%.8x\n", img->winopt.size_headers); r_print ("\tOS ver: %u.%u\n", img->winopt.major_os_ver, img->winopt.minor_os_ver); r_print ("\tImage ver: %u.%u\n", img->winopt.major_image_ver, img->winopt.minor_image_ver); r_print ("\tSubSys ver: %u.%u\n", img->winopt.major_subsystem_ver, img->winopt.minor_subsystem_ver); r_print ("\tSubSys: %.4x\n", img->winopt.subsystem); r_print ("\tChecksum: 0x%.8x\n", img->winopt.checksum); r_print ("\tDLL flags: 0x%.4x\n", img->winopt.dll_characteristics); r_print ("\tLoader flags: 0x%.8x\n", img->winopt.loader_flags); r_print ("\tStack: 0x%.12"RINT64_MODIFIER"x (res) 0x%.12"RINT64_MODIFIER"x (commit)\n", img->winopt.size_stack_reserve, img->winopt.size_stack_commit); r_print ("\tHeap: 0x%.12"RINT64_MODIFIER"x (res) 0x%.12"RINT64_MODIFIER"x (commit)\n", img->winopt.size_stack_reserve, img->winopt.size_stack_commit); } static void dump_section (RPeParser * parser, RPeSectionHdr * sec) { r_print ("\tSection: '%s'\n", sec->name); r_print ("\t\tvmsize: 0x%.8x\n", sec->vmsize); r_print ("\t\tvmaddr: 0x%.8x\n", sec->vmaddr); r_print ("\t\tSize: 0x%.8x\n", sec->size_raw_data); r_print ("\t\tOffset: 0x%.8x\n", sec->ptr_raw_data); r_print ("\t\tReloc: 0x%.8x\n", sec->ptr_relocs); r_print ("\t\tReloc#: %u\n", sec->nrelocs); r_print ("\t\tLinenum: 0x%.8x\n", sec->ptr_linenos); r_print ("\t\tLinenum#: %u\n", sec->nlinenos); r_print ("\t\tFlags: 0x%.8x\n", sec->characteristics); } int main (int argc, char ** argv) { RPeParser * parser; RPeSectionHdr * sec; RPe32ImageHdr * pe32; RPe32PlusImageHdr * pe32p; ruint16 i; if (argc < 2) { r_printerr ("Usage: %s <filename>\n", argv[0]); return -1; } else if ((parser = r_pe_parser_new (argv[1])) == NULL) { r_printerr ("Unable to parse '%s' as Mach-O\n", argv[1]); return -1; } switch (r_pe_parser_get_pe32_magic (parser)) { case R_PE_PE32_MAGIC: r_print ("PE32\n"); break; case R_PE_PE32PLUS_MAGIC: r_print ("PE32+\n"); break; default: r_print ("Unknown PE format\n"); return -1; } r_print ("\tMachine: %s\n", r_pe_machine_str (r_pe_parser_get_machine (parser))); r_print ("\tSections: %u\n", r_pe_parser_get_section_count (parser)); r_print ("\tSymbols: %u\n", r_pe_parser_get_symbol_count (parser)); r_print ("\tFlags: 0x%.4x\n\n", r_pe_parser_get_characteristics (parser)); if ((pe32 = r_pe_parser_get_pe32_image_hdr (parser)) != NULL) dump_pe32_image (pe32); if ((pe32p = r_pe_parser_get_pe32p_image_hdr (parser)) != NULL) dump_pe32p_image (pe32p); r_print ("\nSections\n"); for (i = 0; (sec = r_pe_parser_get_section_hdr_by_idx (parser, i)) != NULL; i++) dump_section (parser, sec); return 0; }
/* * This file is part of Codecrypt. * * Copyright (C) 2013-2016 Mirek Kratochvil <exa.exa@gmail.com> * * Codecrypt is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. * * Codecrypt 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 Codecrypt. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _ccr_algorithm_h_ #define _ccr_algorithm_h_ #include "algo_suite.h" #include "bvector.h" #include "prng.h" #include "sencode.h" /* * virtual interface definition for all cryptographic algorithm instances. * * Note that the whole class could be defined static, but we really enjoy * having the tiny virtual pointers stored in some cool structure along with * the handy algorithm name. */ class algorithm { public: virtual bool provides_signatures() = 0; virtual bool provides_encryption() = 0; virtual std::string get_alg_id() = 0; void register_into_suite (algorithm_suite&s) { s[this->get_alg_id()] = this; } /* * note that these functions should be ready for different * plaintext/ciphertext/message lengths, usually padding them somehow. */ virtual int encrypt (const bvector&plain, bvector&cipher, sencode* pubkey, prng&rng) { return -1; } virtual int decrypt (const bvector&cipher, bvector&plain, sencode* privkey) { return -1; } virtual int sign (const bvector&msg, bvector&sig, sencode** privkey, bool&dirty, prng&rng) { return -1; } virtual int verify (const bvector&sig, const bvector&msg, sencode* pubkey) { return -1; } virtual int create_keypair (sencode**pub, sencode**priv, prng&rng) { return -1; } }; #endif
// -*- Mode:C++ -*- /************************************************************************\ * * * This file is part of Avango. * * * * Copyright 1997 - 2008 Fraunhofer-Gesellschaft zur Foerderung der * * angewandten Forschung (FhG), Munich, Germany. * * * * Avango 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 3. * * * * Avango 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 Lesser General Public * * License along with Avango. If not, see <http://www.gnu.org/licenses/>. * * * * Avango is a trademark owned by FhG. * * * \************************************************************************/ #ifndef AV_PYTHON_OSG_SHADER #define AV_PYTHON_OSG_SHADER void init_OSGShader(void); #endif
/* * SupplyTask.h - Tasks issued to SupplyManager. Basically, just * produce Supply Depots while nearing capacity. */ #pragma once #include "Task.h" class BuildTask: public Task { };
// Created file "Lib\src\Uuid\tapi3if_i" typedef struct _GUID { unsigned long Data1; unsigned short Data2; unsigned short Data3; unsigned char Data4[8]; } GUID; #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ extern const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } DEFINE_GUID(IID_ITStreamControl, 0xee3bd604, 0x3868, 0x11d2, 0xa0, 0x45, 0x00, 0xc0, 0x4f, 0xb6, 0x80, 0x9f);
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ /* * Copyright (C) 2008 Sven Herzberg * * 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 __DH_ASSISTANT_VIEW_H__ #define __DH_ASSISTANT_VIEW_H__ #include <webkit/webkit.h> #include "dh-base.h" #include "dh-link.h" G_BEGIN_DECLS #define DH_TYPE_ASSISTANT_VIEW (dh_assistant_view_get_type ()) #define DH_ASSISTANT_VIEW(i) (G_TYPE_CHECK_INSTANCE_CAST ((i), DH_TYPE_ASSISTANT_VIEW, DhAssistantView)) #define DH_ASSISTANT_VIEW_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), DH_TYPE_ASSISTANT_VIEW, DhAssistantViewClass)) #define DH_IS_ASSISTANT_VIEW(i) (G_TYPE_CHECK_INSTANCE_TYPE ((i), DH_TYPE_ASSISTANT_VIEW)) #define DH_IS_ASSISTANT_VIEW_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), DH_ASSISTANT_VIEW)) #define DH_ASSISTANT_VIEW_GET_CLASS(i) (G_TYPE_INSTANCE_GET_CLASS ((i), DH_TYPE_ASSISTANT_VIEW, DhAssistantView)) typedef struct _DhAssistantView DhAssistantView; typedef struct _DhAssistantViewClass DhAssistantViewClass; struct _DhAssistantView { WebKitWebView parent_instance; }; struct _DhAssistantViewClass { WebKitWebViewClass parent_class; }; GType dh_assistant_view_get_type (void) G_GNUC_CONST; GtkWidget* dh_assistant_view_new (void); gboolean dh_assistant_view_search (DhAssistantView *view, const gchar *str); DhBase* dh_assistant_view_get_base (DhAssistantView *view); void dh_assistant_view_set_base (DhAssistantView *view, DhBase *base); gboolean dh_assistant_view_set_link (DhAssistantView *view, DhLink *link); G_END_DECLS #endif /* __DH_ASSISTANT_VIEW_H__ */
/* * @BEGIN LICENSE * * Psi4: an open-source quantum chemistry software package * * Copyright (c) 2007-2018 The Psi4 Developers. * * The copyrights for code used from other parties are included in * the corresponding files. * * This file is part of Psi4. * * Psi4 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 3. * * Psi4 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 Psi4; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * @END LICENSE */ #ifndef __math_test_uhf_h__ #define __math_test_uhf_h__ #include "psi4/libpsio/psio.hpp" #include "hf.h" namespace psi { namespace scf { class UHF : public HF { protected: SharedMatrix Dt_, Dt_old_; SharedMatrix Da_old_, Db_old_; SharedMatrix Ga_, Gb_, J_, Ka_, Kb_, wKa_, wKb_; void form_initialF(); void form_C(); void form_V(); void form_D(); double compute_initial_E(); virtual double compute_E(); virtual bool stability_analysis(); bool stability_analysis_pk(); virtual void form_G(); virtual void form_F(); virtual void compute_orbital_gradient(bool save_diis); bool diis(); bool test_convergency(); void save_information(); void common_init(); void save_density_and_energy(); // Finalize memory/files virtual void finalize(); // Scaling factor for orbital rotation double step_scale_; // Increment to explore different scaling factors double step_increment_; // Stability eigenvalue, for doing smart eigenvector following double stab_val; // Compute UHF NOs void compute_nos(); // Damp down the density update virtual void damp_update(); // Second-order convergence code void Hx(SharedMatrix x_a, SharedMatrix IFock_a, SharedMatrix Cocc_a, SharedMatrix Cvir_a, SharedMatrix ret_a, SharedMatrix x_b, SharedMatrix IFock_b, SharedMatrix Cocc_b, SharedMatrix Cvir_b, SharedMatrix ret_b); virtual int soscf_update(void); public: UHF(SharedWavefunction ref_wfn, std::shared_ptr<SuperFunctional> functional); UHF(SharedWavefunction ref_wfn, std::shared_ptr<SuperFunctional> functional, Options& options, std::shared_ptr<PSIO> psio); virtual ~UHF(); virtual bool same_a_b_orbs() const { return false; } virtual bool same_a_b_dens() const { return false; } /// Hessian-vector computers and solvers virtual std::vector<SharedMatrix> onel_Hx(std::vector<SharedMatrix> x); virtual std::vector<SharedMatrix> twoel_Hx(std::vector<SharedMatrix> x, bool combine = true, std::string return_basis = "MO"); virtual std::vector<SharedMatrix> cphf_Hx(std::vector<SharedMatrix> x); virtual std::vector<SharedMatrix> cphf_solve(std::vector<SharedMatrix> x_vec, double conv_tol = 1.e-4, int max_iter = 10, int print_lvl = 1); std::shared_ptr<UHF> c1_deep_copy(std::shared_ptr<BasisSet> basis); }; }} #endif
// Created file "Lib\src\ksuser\X64\guids" typedef struct _GUID { unsigned long Data1; unsigned short Data2; unsigned short Data3; unsigned char Data4[8]; } GUID; #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ extern const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } DEFINE_GUID(IID_IKsAggregateControl, 0x7f40eac0, 0x3947, 0x11d2, 0x87, 0x4e, 0x00, 0xa0, 0xc9, 0x22, 0x31, 0x96);
/**************************************************************************** ** ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage ** This file contains pre-release code and may not be distributed. ** You may use this file in accordance with the terms and conditions ** contained in the Technology Preview License Agreement accompanying ** this package. ** ** 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, 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. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. ** ** ** ** ** ** ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QDECLARATIVECOMPONENT_P_H #define QDECLARATIVECOMPONENT_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 "qdeclarativecomponent.h" #include "private/qdeclarativeengine_p.h" #include "private/qdeclarativetypeloader_p.h" #include "private/qbitfield_p.h" #include "qdeclarativeerror.h" #include "qdeclarative.h" #include <QtCore/QString> #include <QtCore/QStringList> #include <QtCore/QList> #include <private/qobject_p.h> QT_BEGIN_NAMESPACE class QDeclarativeComponent; class QDeclarativeEngine; class QDeclarativeCompiledData; class QDeclarativeComponentAttached; class Q_AUTOTEST_EXPORT QDeclarativeComponentPrivate : public QObjectPrivate, public QDeclarativeTypeData::TypeDataCallback { Q_DECLARE_PUBLIC(QDeclarativeComponent) public: QDeclarativeComponentPrivate() : typeData(0), progress(0.), start(-1), count(-1), cc(0), engine(0), creationContext(0) {} QObject *beginCreate(QDeclarativeContextData *, const QBitField &); void completeCreate(); QDeclarativeTypeData *typeData; virtual void typeDataReady(QDeclarativeTypeData *) {}; virtual void typeDataProgress(QDeclarativeTypeData *, qreal) {}; void fromTypeData(QDeclarativeTypeData *data); QUrl url; qreal progress; int start; int count; QDeclarativeCompiledData *cc; struct ConstructionState { ConstructionState() : componentAttached(0), completePending(false) {} QList<QDeclarativeEnginePrivate::SimpleList<QDeclarativeAbstractBinding> > bindValues; QList<QDeclarativeEnginePrivate::SimpleList<QDeclarativeParserStatus> > parserStatus; QList<QPair<QDeclarativeGuard<QObject>, int> > finalizedParserStatus; QDeclarativeComponentAttached *componentAttached; QList<QDeclarativeError> errors; bool completePending; }; ConstructionState state; static QObject *begin(QDeclarativeContextData *parentContext, QDeclarativeContextData *componentCreationContext, QDeclarativeCompiledData *component, int start, int count, ConstructionState *state, QList<QDeclarativeError> *errors, const QBitField &bindings = QBitField()); static void beginDeferred(QDeclarativeEnginePrivate *enginePriv, QObject *object, ConstructionState *state); static void complete(QDeclarativeEnginePrivate *enginePriv, ConstructionState *state); QScriptValue createObject(QObject *publicParent, const QScriptValue valuemap); QDeclarativeEngine *engine; QDeclarativeGuardedContextData creationContext; void clear(); static QDeclarativeComponentPrivate *get(QDeclarativeComponent *c) { return static_cast<QDeclarativeComponentPrivate *>(QObjectPrivate::get(c)); } }; class QDeclarativeComponentAttached : public QObject { Q_OBJECT public: QDeclarativeComponentAttached(QObject *parent = 0); virtual ~QDeclarativeComponentAttached() {}; void add(QDeclarativeComponentAttached **a) { prev = a; next = *a; *a = this; if (next) next->prev = &next; } void rem() { if (next) next->prev = prev; *prev = next; next = 0; prev = 0; } QDeclarativeComponentAttached **prev; QDeclarativeComponentAttached *next; Q_SIGNALS: void completed(); void destruction(); private: friend class QDeclarativeContextData; friend class QDeclarativeComponentPrivate; }; QT_END_NAMESPACE #endif // QDECLARATIVECOMPONENT_P_H
/* Copyright 2013-2021 Paul Colby This file is part of QtAws. QtAws is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. QtAws is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the QtAws. If not, see <http://www.gnu.org/licenses/>. */ #ifndef QTAWS_DELETEAPPREQUEST_H #define QTAWS_DELETEAPPREQUEST_H #include "sagemakerrequest.h" namespace QtAws { namespace SageMaker { class DeleteAppRequestPrivate; class QTAWSSAGEMAKER_EXPORT DeleteAppRequest : public SageMakerRequest { public: DeleteAppRequest(const DeleteAppRequest &other); DeleteAppRequest(); virtual bool isValid() const Q_DECL_OVERRIDE; protected: virtual QtAws::Core::AwsAbstractResponse * response(QNetworkReply * const reply) const Q_DECL_OVERRIDE; private: Q_DECLARE_PRIVATE(DeleteAppRequest) }; } // namespace SageMaker } // namespace QtAws #endif
/* Copyright 2013-2021 Paul Colby This file is part of QtAws. QtAws is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. QtAws is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the QtAws. If not, see <http://www.gnu.org/licenses/>. */ #ifndef QTAWS_TAGRESOURCEREQUEST_H #define QTAWS_TAGRESOURCEREQUEST_H #include "iot1clickdevicesservicerequest.h" namespace QtAws { namespace IoT1ClickDevicesService { class TagResourceRequestPrivate; class QTAWSIOT1CLICKDEVICESSERVICE_EXPORT TagResourceRequest : public IoT1ClickDevicesServiceRequest { public: TagResourceRequest(const TagResourceRequest &other); TagResourceRequest(); virtual bool isValid() const Q_DECL_OVERRIDE; protected: virtual QtAws::Core::AwsAbstractResponse * response(QNetworkReply * const reply) const Q_DECL_OVERRIDE; private: Q_DECLARE_PRIVATE(TagResourceRequest) }; } // namespace IoT1ClickDevicesService } // namespace QtAws #endif
/* * Copyright (C) 2015 Morwenn * * The SGL is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation, either version 3 of * the License, or (at your option) any later version. * * The SGL is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this program. If not, * see <http://www.gnu.org/licenses/>. */ #ifndef SGL_TYPE_TRAITS_IS_FLOATING_POINT_H_ #define SGL_TYPE_TRAITS_IS_FLOATING_POINT_H_ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include <sgl/detail/common.h> #define sgl_is_floating_point(value) \ _Generic( (value), \ float: true, \ double: true, \ long double: true, \ default: false \ ) #endif // SGL_TYPE_TRAITS_IS_FLOATING_POINT_H_
/*************************************************************************** * Copyright (C) 2010 by Ralf Kaestner, Nikolas Engelhard, Yves Pilat * * ralf.kaestner@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef BOX_H #define BOX_H #include "utils/geometry.h" template <typename T, size_t K> class Box : public Geometry<T, K> { public: template <typename... P> inline Box(const P&... parameters); inline ~Box(); inline Box& operator=(const Box<T, K>& src); }; #include "utils/box.tpp" #endif
/* Copyright 2013-2021 Paul Colby This file is part of QtAws. QtAws is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. QtAws is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the QtAws. If not, see <http://www.gnu.org/licenses/>. */ #ifndef QTAWS_DESCRIBEPULLREQUESTEVENTSREQUEST_H #define QTAWS_DESCRIBEPULLREQUESTEVENTSREQUEST_H #include "codecommitrequest.h" namespace QtAws { namespace CodeCommit { class DescribePullRequestEventsRequestPrivate; class QTAWSCODECOMMIT_EXPORT DescribePullRequestEventsRequest : public CodeCommitRequest { public: DescribePullRequestEventsRequest(const DescribePullRequestEventsRequest &other); DescribePullRequestEventsRequest(); virtual bool isValid() const Q_DECL_OVERRIDE; protected: virtual QtAws::Core::AwsAbstractResponse * response(QNetworkReply * const reply) const Q_DECL_OVERRIDE; private: Q_DECLARE_PRIVATE(DescribePullRequestEventsRequest) }; } // namespace CodeCommit } // namespace QtAws #endif
/* Copyright 2013-2021 Paul Colby This file is part of QtAws. QtAws is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. QtAws is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the QtAws. If not, see <http://www.gnu.org/licenses/>. */ #ifndef QTAWS_DELETEHOSTEDZONEREQUEST_H #define QTAWS_DELETEHOSTEDZONEREQUEST_H #include "route53request.h" namespace QtAws { namespace Route53 { class DeleteHostedZoneRequestPrivate; class QTAWSROUTE53_EXPORT DeleteHostedZoneRequest : public Route53Request { public: DeleteHostedZoneRequest(const DeleteHostedZoneRequest &other); DeleteHostedZoneRequest(); virtual bool isValid() const Q_DECL_OVERRIDE; protected: virtual QtAws::Core::AwsAbstractResponse * response(QNetworkReply * const reply) const Q_DECL_OVERRIDE; private: Q_DECLARE_PRIVATE(DeleteHostedZoneRequest) }; } // namespace Route53 } // namespace QtAws #endif
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * gmpy_mpz_prp.h * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Python interface to the GMP or MPIR, MPFR, and MPC multiple precision * * libraries. * * * * Copyright 2012 - 2022 Case Van Horsen * * * * This file is part of GMPY2. * * * * GMPY2 is free software: you can redistribute it and/or modify it under * * the terms of the GNU Lesser General Public License as published by the * * Free Software Foundation, either version 3 of the License, or (at your * * option) any later version. * * * * GMPY2 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 GMPY2; if not, see <http://www.gnu.org/licenses/> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #ifndef GMPY_PRP_H #define GMPY_PRP_H #ifdef __cplusplus extern "C" { #endif static PyObject * GMPY_mpz_is_fermat_prp(PyObject *self, PyObject *args); static PyObject * GMPY_mpz_is_euler_prp(PyObject *self, PyObject *args); static PyObject * GMPY_mpz_is_strong_prp(PyObject *self, PyObject *args); static PyObject * GMPY_mpz_is_fibonacci_prp(PyObject *self, PyObject *args); static PyObject * GMPY_mpz_is_lucas_prp(PyObject *self, PyObject *args); static PyObject * GMPY_mpz_is_stronglucas_prp(PyObject *self, PyObject *args); static PyObject * GMPY_mpz_is_extrastronglucas_prp(PyObject *self, PyObject *args); static PyObject * GMPY_mpz_is_selfridge_prp(PyObject *self, PyObject *args); static PyObject * GMPY_mpz_is_strongselfridge_prp(PyObject *self, PyObject *args); static PyObject * GMPY_mpz_is_bpsw_prp(PyObject *self, PyObject *args); static PyObject * GMPY_mpz_is_strongbpsw_prp(PyObject *self, PyObject *args); #ifdef __cplusplus } #endif #endif
/* Copyright 2013-2021 Paul Colby This file is part of QtAws. QtAws is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. QtAws is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the QtAws. If not, see <http://www.gnu.org/licenses/>. */ #ifndef QTAWS_PUTCONFIGURATIONSETDELIVERYOPTIONSREQUEST_P_H #define QTAWS_PUTCONFIGURATIONSETDELIVERYOPTIONSREQUEST_P_H #include "pinpointemailrequest_p.h" #include "putconfigurationsetdeliveryoptionsrequest.h" namespace QtAws { namespace PinpointEmail { class PutConfigurationSetDeliveryOptionsRequest; class PutConfigurationSetDeliveryOptionsRequestPrivate : public PinpointEmailRequestPrivate { public: PutConfigurationSetDeliveryOptionsRequestPrivate(const PinpointEmailRequest::Action action, PutConfigurationSetDeliveryOptionsRequest * const q); PutConfigurationSetDeliveryOptionsRequestPrivate(const PutConfigurationSetDeliveryOptionsRequestPrivate &other, PutConfigurationSetDeliveryOptionsRequest * const q); private: Q_DECLARE_PUBLIC(PutConfigurationSetDeliveryOptionsRequest) }; } // namespace PinpointEmail } // namespace QtAws #endif
/* * Copyright (C) 2014 Stuart Howarth <showarth@marxoft.co.uk> * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU Lesser General Public License, * version 3, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU 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 St - Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef MASKEDITEM_H #define MASKEDITEM_H #include "maskeffect.h" #include <QDeclarativeItem> class MaskEffect; class QDeclarativeComponent; class MaskedItem : public QDeclarativeItem { Q_OBJECT Q_PROPERTY(QDeclarativeComponent *mask READ mask WRITE setMask NOTIFY maskChanged) public: MaskedItem(QDeclarativeItem *parent = 0); virtual ~MaskedItem(); QDeclarativeComponent *mask() const; void setMask(QDeclarativeComponent *component); signals: void maskChanged(); private: MaskEffect *m_effect; QDeclarativeComponent *m_maskComponent; }; #endif // MASKEDITEM_H
/* * ===================================================================================== * * Filename: select-sort.c * * Description: * * Version: 1.0 * Created: 12/23/2016 04:47:42 PM * Revision: none * Compiler: gcc * * Author: YOUR NAME (), * Organization: * * ===================================================================================== */ #include <stdio.h> #include <stdlib.h> int icomp = 0; int iswap = 0; int cmp_fun(int a, int b) { icomp++; return a > b; } int swap(int * a, int * b) { *a = *a ^ *b; *b = *a ^ *b; *a = *a ^ *b; iswap ++; return 1; } int select_sort(int *pList, int len) { if(NULL == pList || len < 0) { return -1; } int i = 0; for(i = 0; i < len; i++) { int iTop = pList[i]; int iPos = i; int j = 0; for(j = i + 1; j < len; j++) { if(cmp_fun(iTop, pList[j])) { iTop = pList[j]; iPos = j; } } if(i != iPos) { swap(&pList[i], &pList[iPos]); } } return 0; } int get_list(int *list, int len) { srand(374676); int i = 0; for(i = 0; i < len; i++) { list[i] = rand() % (len * 20); } return 0; } int check_list(int *list, int len) { int i; int iCnt = 0; for(i = 0; i < len - 1; i++) { if(cmp_fun(list[i], list[i + 1])) { iCnt++; } } return iCnt; } void show_list(int *pList, int len) { int i = 0; for(i = 0; i < len; i++) { printf("%d ", pList[i]); } printf("\n"); } int test_sort(int n) { icomp = 0; iswap = 0; int *pList = (int*)malloc(sizeof(int) * n); get_list(pList, n); //show_list(pList, n); select_sort(pList, n); int iThro = n * (n + 1) / 2; printf("n = %d, tcmp = %d, rcmp = %d, dc = %lf\n", n, iThro, icomp, (double)icomp / iThro); printf("n = %d, tswp = %d, rswp = %d, ds = %lf\n", n, n - 1, iswap, (double)iswap / (n - 1)); int iT = check_list(pList, n); if(iT) { printf("sort faild, [%d]\n", iT); } //show_list(pList, n); free(pList); printf("\n"); return 0; } int main() { int i = 0; for(i = 16; i <= 1024 * 16; i *= 2) { test_sort(i); } return 0; }
/* Copyright 2013-2021 Paul Colby This file is part of QtAws. QtAws is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. QtAws is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the QtAws. If not, see <http://www.gnu.org/licenses/>. */ #ifndef QTAWS_CREATERESERVEDINSTANCESLISTINGREQUEST_P_H #define QTAWS_CREATERESERVEDINSTANCESLISTINGREQUEST_P_H #include "ec2request_p.h" #include "createreservedinstanceslistingrequest.h" namespace QtAws { namespace EC2 { class CreateReservedInstancesListingRequest; class CreateReservedInstancesListingRequestPrivate : public Ec2RequestPrivate { public: CreateReservedInstancesListingRequestPrivate(const Ec2Request::Action action, CreateReservedInstancesListingRequest * const q); CreateReservedInstancesListingRequestPrivate(const CreateReservedInstancesListingRequestPrivate &other, CreateReservedInstancesListingRequest * const q); private: Q_DECLARE_PUBLIC(CreateReservedInstancesListingRequest) }; } // namespace EC2 } // namespace QtAws #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-2018 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 PXPVDSDK_PXPVDMEMCLIENT_H #define PXPVDSDK_PXPVDMEMCLIENT_H #include "PxPvdClient.h" #include "PsHashMap.h" #include "PsMutex.h" #include "PsBroadcast.h" #include "PxProfileEventBufferClient.h" #include "PxProfileMemory.h" namespace physx { class PvdDataStream; namespace pvdsdk { class PvdImpl; class PvdMemClient : public PvdClient, public profile::PxProfileEventBufferClient, public shdfnd::UserAllocated { PX_NOCOPY(PvdMemClient) public: PvdMemClient(PvdImpl& pvd); virtual ~PvdMemClient(); bool isConnected() const; void onPvdConnected(); void onPvdDisconnected(); void flush(); PvdDataStream* getDataStream(); PvdUserRenderer* getUserRender(); // memory event void onAllocation(size_t size, const char* typeName, const char* filename, int line, void* allocatedMemory); void onDeallocation(void* addr); private: PvdImpl& mSDKPvd; PvdDataStream* mPvdDataStream; bool mIsConnected; // mem profile shdfnd::Mutex mMutex; // mem onallocation can called from different threads profile::PxProfileMemoryEventBuffer& mMemEventBuffer; void handleBufferFlush(const uint8_t* inData, uint32_t inLength); void handleClientRemoved(); }; } // namespace pvdsdk } // namespace physx #endif // PXPVDSDK_PXPVDMEMCLIENT_H
/* Logic.h -- part of the VaRGB library. Copyright (C) 2013 Pat Deegan. http://www.flyingcarsandstuff.com/projects/vargb/ Created on: 2013-03-05 This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. 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 file LICENSE.txt for further informations on licensing terms. ***************************** OVERVIEW ***************************** Unlike the atomic curves "logical" curves, based on the vargb::Curve::Logic class here, don't specify how the red, green and blue values change with time. Instead, these curves act to combine or otherwise transform other curves. The name "Logic Curve" is mainly historical, as these curves started out as simply AND-combined and OR-combined curves. Now additional derivatives exist, such as Shift and Threshold, but whatevs. Logic curves need at least one, or optionally two, curves on which to operate. These are stored in the (protected member) curves[]. The methods are constructed to always check both children for required updates etc, so in cases where you are only operating on a single child curve, the second curve is a static Dummy curve, which basically never requires an update and never terminates. */ #ifndef LOGIC_H_ #define LOGIC_H_ #include "../VaRGBConfig.h" #include "../Curve.h" #include "Dummy.h" namespace vargb { namespace Curve { #define VARGB_CURVE_LOGIC_NUMCURVES 2 class Logic : public vargb::Curve::Curve { public: /* * Logic Curve constructor * Takes one, or two, pointers to other curves on which to operate. */ Logic(vargb::Curve::Curve * curve_a, vargb::Curve::Curve * curve_b=NULL); #ifdef VaRGB_CLASS_DESTRUCTORS_ENABLE virtual ~Logic() {} #endif virtual bool completed(); virtual void settingsUpdated(); virtual void start(IlluminationSettings* initial_settings = NULL); virtual void setTick(VaRGBTimeValue setTo, IlluminationSettings* initial_settings = NULL); virtual void tick(uint8_t num = 1); virtual void reset(); protected: /* * childUpdated() * This base class will check the children to see if they've been updated * after every tick. If this happens to be the case, the childUpdated() * method will be called so the Logic curve instance can do its thing. * * This is an abstract method, which you must override in any derived classes. */ virtual void childUpdated() = 0; vargb::Curve::Curve * curves[VARGB_CURVE_LOGIC_NUMCURVES]; private: static Dummy dummy_curve; }; } /* namespace Curve */ } /* namespace vargb */ #endif /* LOGIC_H_ */
/* Copyright 2013-2021 Paul Colby This file is part of QtAws. QtAws is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. QtAws 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 QtAws. If not, see <http://www.gnu.org/licenses/>. */ #ifndef SQSPURGEQUEUERESPONSE_P_H #define SQSPURGEQUEUERESPONSE_P_H #include "sqsresponse_p.h" namespace QtAws { namespace SqsOld { class SqsPurgeQueueResponse; class SqsPurgeQueueResponsePrivate : public SqsResponsePrivate { public: QString queueUrl; ///< Created queue URL. SqsPurgeQueueResponsePrivate(SqsPurgeQueueResponse * const q); void parsePurgeQueueResponse(QXmlStreamReader &xml); private: Q_DECLARE_PUBLIC(SqsPurgeQueueResponse) Q_DISABLE_COPY(SqsPurgeQueueResponsePrivate) }; } // namespace SqsOld } // namespace QtAws #endif
/* * partition.h -- a disjoint set of pairwise equivalent items * * Copyright (c) 2007-2010, Dmitry Prokoptsev <dprokoptsev@gmail.com>, * Alexander Gololobov <agololobov@gmail.com> * * This file is part of Pire, the Perl Incompatible * Regular Expressions library. * * Pire is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Pire 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 Public License for more details. * You should have received a copy of the GNU Lesser Public License * along with Pire. If not, see <http://www.gnu.org/licenses>. */ #ifndef PIRE_PARTITION_H #define PIRE_PARTITION_H #include "stub/stl.h" #include "stub/singleton.h" namespace Pire { /* * A class which forms a disjoint set of pairwise equivalent items, * depending on given equivalence relation. */ template<class T, class Eq> class Partition { private: typedef ymap< T, ypair< size_t, yvector<T> > > Set; public: Partition(const Eq& eq) : m_eq(eq) , m_maxidx(0) { } /// Appends a new item into partition, creating new equivalience class if neccessary. void Append(const T& t) { DoAppend(m_set, t); } typedef typename Set::const_iterator ConstIterator; ConstIterator Begin() const { return m_set.begin(); } ConstIterator End() const { return m_set.end(); } size_t Size() const { return m_set.size(); } bool Empty() const { return m_set.empty(); } /// Returns an item equal to @p t. It is guaranteed that: /// - representative(a) equals representative(b) iff a is equivalent to b; /// - representative(a) is equivalent to a. const T& Representative(const T& t) const { typename ymap<T, T>::const_iterator it = m_inv.find(t); if (it != m_inv.end()) return it->second; else return DefaultValue<T>(); } bool Contains(const T& t) const { return m_inv.find(t) != m_inv.end(); } /// Returns an index of set containing @p t. It is guaranteed that: /// - index(a) equals index(b) iff a is equivalent to b; /// - 0 <= index(a) < size(). size_t Index(const T& t) const { typename ymap<T, T>::const_iterator it = m_inv.find(t); if (it == m_inv.end()) throw Error("Partition::index(): attempted to obtain an index of nonexistent item"); typename Set::const_iterator it2 = m_set.find(it->second); YASSERT(it2 != m_set.end()); return it2->second.first; } /// Returns the whole equivalence class of @p t (i.e. item @p i /// is returned iff representative(i) == representative(t)). const yvector<T>& Klass(const T& t) const { typename ymap<T, T>::const_iterator it = m_inv.find(t); if (it == m_inv.end()) throw Error("Partition::index(): attempted to obtain an index of nonexistent item"); ConstIterator it2 = m_set.find(it->second); YASSERT(it2 != m_set.end()); return it2->second.second; } bool operator == (const Partition& rhs) const { return m_set == rhs.m_set; } bool operator != (const Partition& rhs) const { return !(*this == rhs); } /// Splits the current sets into smaller ones, using given equivalence relation. /// Requires given relation imply previous one (set either in ctor or /// in preceeding calls to split()), but performs faster. /// Replaces previous relation with given one. void Split(const Eq& eq) { m_eq = eq; for (typename Set::iterator sit = m_set.begin(), sie = m_set.end(); sit != sie; ++sit) if (sit->second.second.size() > 1) { yvector<T>& v = sit->second.second; typename yvector<T>::iterator bound = std::partition(v.begin(), v.end(), std::bind2nd(m_eq, v[0])); if (bound == v.end()) continue; Set delta; for (typename yvector<T>::iterator it = bound, ie = v.end(); it != ie; ++it) DoAppend(delta, *it); v.erase(bound, v.end()); m_set.insert(delta.begin(), delta.end()); } } private: Eq m_eq; Set m_set; ymap<T, T> m_inv; size_t m_maxidx; void DoAppend(Set& set, const T& t) { typename Set::iterator it = set.begin(); typename Set::iterator end = set.end(); for (; it != end; ++it) if (m_eq(it->first, t)) { it->second.second.push_back(t); m_inv[t] = it->first; break; } if (it == end) { // Begin new set yvector<T> v(1, t); set.insert(ymake_pair(t, ymake_pair(m_maxidx++, v))); m_inv[t] = t; } } }; // Mainly for debugging template<class T, class Eq> yostream& operator << (yostream& stream, const Partition<T, Eq>& partition) { stream << "Partition {\n"; for (typename Partition<T, Eq>::ConstIterator it = partition.Begin(), ie = partition.End(); it != ie; ++it) { stream << " Class " << it->second.first << " \"" << it->first << "\" { "; bool first = false; for (typename yvector<T>::const_iterator iit = it->second.second.begin(), iie = it->second.second.end(); iit != iie; ++iit) { if (first) stream << ", "; else first = true; stream << *iit; } stream << " }\n"; } stream << "}"; return stream; } } #endif
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "fasta.h" #include "util.h" fastap fa_alloc(int maxlen) { fastap fa; fa = (fastap) malloc(sizeof(struct fasta)); fa->id = (char *) malloc(maxlen+1); fa->data = (char *) malloc(maxlen+1); fa->maxlen = maxlen; return fa; } int fa_next(fastap seq,FILE *fd) { fgets(seq->id,seq->maxlen+1,fd); if (feof(fd)) { return 0; } seq->id[0] = ' '; /* white out the ">" */ stripWhiteSpace(seq->id); /* remove blank, newline */ fgets(seq->data,seq->maxlen+1,fd); stripWhiteSpace(seq->data); /* remove newline */ return 1; } void fa_fasta(fastap seq,FILE *fd) { fprintf(fd,">%s\n%s\n",seq->id,seq->data); } void fa_fasta_trunc(fastap seq,FILE *fd,int len) { seq->data[len] = 0; fprintf(fd,">%s\n%s\n",seq->id,seq->data); } void fa_free(fastap seq) { if (seq != NULL) { free(seq->id); free(seq->data); free(seq); } } void fa_mask(fastap seq,unsigned start,unsigned length,char mask) { unsigned i; unsigned seqlen; seqlen = strlen(seq->data); if (start >= seqlen) { return; /* can't start past the end of the sequence */ } if (length == 0 || /* default: from 'start' to end of sequence */ start + length > seqlen) { /* writing past end of sequence */ length = seqlen - start; } for (i=start;i<start+length;i++) { seq->data[i] = mask; } }
/* counters.c - code pertaining to encoders and other counting methods Part of Grbl Copyright (c) 2014 Adam Shelly Grbl is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Grbl 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 Grbl. If not, see <http://www.gnu.org/licenses/>. */ #include "system.h" #include "counters.h" uint32_t alignment_debounce_timer=0; #define PROBE_DEBOUNCE_DELAY_MS 25 counters_t counters = {{0}}; // Counters pin initialization routine. void counters_init() { //encoders and feedback //TODO: move to new file #ifdef KEYME_BOARD FDBK_DDR &= ~(FDBK_MASK); // Configure as input pins FDBK_PORT |= FDBK_MASK; // Enable internal pull-up resistors. Normal high operation. //TODO test #endif counters.state = FDBK_PIN&FDBK_MASK; //record initial state counters_enable(0); //default to no encoder } void counters_enable(int enable) { if (enable) { FDBK_PCMSK |= FDBK_MASK; // Enable specific pins of the Pin Change Interrupt PCICR |= (1 << FDBK_INT); // Enable Pin Change Interrupt } else { FDBK_PCMSK &= ~FDBK_MASK; // Disable specific pins of the Pin Change Interrupt PCICR &= ~(1 << FDBK_INT); // Disable Pin Change Interrupt } } // Resets the counts for an axis void counters_reset(uint8_t axis) { counters.counts[axis]=0; if (axis == Z_AXIS) { counters.idx=0; } } // Returns the counters pin state. Triggered = true. and counters state monitor. count_t counters_get_count(uint8_t axis) { return counters.counts[axis]; } uint8_t counters_get_state(){ return counters.state; } int16_t counters_get_idx(){ return counters.idx; } int debounce(uint32_t* bounce_clock, int16_t lockout_ms) { uint32_t clock = masterclock; //allow another reading if lockout has expired // (or if clock has rolled over - otherwise we could wait forever ) if ( clock > (*bounce_clock + lockout_ms) || (clock < *bounce_clock) ) { *bounce_clock = clock; return 1; } return 0; } ISR(FDBK_INT_vect) { uint8_t state = FDBK_PIN&FDBK_MASK; uint8_t change = (state^counters.state); int8_t dir=0; //look for encoder change if (change & ((1<<Z_ENC_CHA_BIT)|(1<<Z_ENC_CHB_BIT))) { //if a or b changed counters.anew = (state>>Z_ENC_CHA_BIT)&1; dir = counters.anew^counters.bold ? 1 : -1; counters.bold = (state>>Z_ENC_CHB_BIT)&1; counters.counts[Z_AXIS] += dir; } //count encoder indexes if (change & (1<<Z_ENC_IDX_BIT)) { //idx changed uint8_t idx_on = ((state>>Z_ENC_IDX_BIT)&1); if (idx_on) { counters.idx += dir; } } //count rotary axis alignment pulses. if (change & (1<<ALIGN_SENSE_BIT)) { //sensor changed if (debounce(&alignment_debounce_timer, PROBE_DEBOUNCE_DELAY_MS)){ if (!(state&PROBE_MASK)) { //low is on. counters.counts[C_AXIS]++; } } } counters.state = state; }
/* Copyright 2015 Infinitycoding all rights reserved This file is part of the mercury c-library. The mercury c-library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. The mercury c-library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the mercury c-library. If not, see <http://www.gnu.org/licenses/>. */ /** * @author Michael Sippel (Universe Team) <micha@infinitycoding.de> */ #include <syscall.h> #include <sys/types.h> #include <signal.h> #include <unistd.h> sighandler_t signal(int signum, sighandler_t handler) { linux_syscall(SYS_SIGNAL, signum,(uint32_t) handler, 0, 0, 0); return handler; } int kill(pid_t pid, int sig) { return linux_syscall(SYS_KILL, pid, sig, 0, 0, 0); } int raise(int sig) { return kill(getpid(), sig); }
// Created file "Lib\src\Uuid\X64\guids" typedef struct _GUID { unsigned long Data1; unsigned short Data2; unsigned short Data3; unsigned char Data4[8]; } GUID; #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ extern const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } DEFINE_GUID(PKEY_Photo_FocalPlaneYResolutionDenominator, 0x1d6179a6, 0xa876, 0x4031, 0xb0, 0x13, 0x33, 0x47, 0xb2, 0xb6, 0x4d, 0xc8);
/******************************************************************** (c) Copyright 2014-2015 Mettler-Toledo CT. All Rights Reserved. File Name: LogDefinationInternal.h File Path: MTLoggerLib Description: LogDefinationInternal Author: Wang Bin Created: 2015/6/10 16:01 Remark: LogDefinationInternal *********************************************************************/ #pragma once #ifndef _MTLogger_LogDefinationInternal_H #define _MTLogger_LogDefinationInternal_H #include "Platform/COsString.h" #include "Platform/stdutil.h" #define HEARTBEAT "\a" #define LOG_SOCKET_RETRY_TIME 3 #define LOGCONFIG_FILE_NAME "LogService.config" #define DEFAULT_LOG_LENTH 1024 #define LOGCONFIGDIR "LogConfigs/" #define LOGCONFIGEXTENSION ".config" #define LOGFILEEXTENSION ".log" #define DEFAULTLOGDIR "Log/" #define DEFAULTLOGHOSTNAME "Default" /************************************************************************ 日志命令 ************************************************************************/ enum ELogCommand { E_LOGCOMMAND_LOGDELETE, E_LOGCOMMAND_LOGWRITE, E_LOGCOMMAND_LOGCONFIG, E_LOGCOMMAND_LOGSTOP, }; /************************************************************************ 日志对象类型 ************************************************************************/ enum ELogObjType { E_LOGOBJTYPE_LOGMSG, E_LOGOBJTYPE_LOGCONFIG, E_LOGOBJTYPE_NULL, //2015/2/28 add by wangbin 仅在保存日志配置的时候生效,不需要保存这个节点 }; /************************************************************************ 日志服务状态 ************************************************************************/ enum ELogServerStatus { E_LogServerStatus_Unknown, E_LogServerStatus_Outline, E_LogServerStatus_Online, }; /************************************************************************ 调用写日志线程的是服务端还是客户端 ************************************************************************/ enum ELogHostType { E_LogHostType_Server, E_LogHostType_Client, }; inline bool GetLogObjTypeValue(const char *strVal, ELogObjType &val) { if (COsString::Compare(strVal, "LOGMSG", true) == 0) { val = E_LOGOBJTYPE_LOGMSG; return true; } else if (COsString::Compare(strVal, "LOGCONFIG", true) == 0) { val = E_LOGOBJTYPE_LOGCONFIG; return true; } else { return false; } } inline bool GetLogObjTypeString(ELogObjType val, char **strVal) { switch (val) { case E_LOGOBJTYPE_LOGMSG: { COsString::Copy("LOGMSG", strVal); return true; } case E_LOGOBJTYPE_LOGCONFIG: { COsString::Copy("LOGCONFIG", strVal); return true; } case E_LOGOBJTYPE_NULL: { *strVal = NULL; return true; } default: { SAFE_DELETEA(*strVal); return false; } } } #endif // _MTLogger_LogDefinationInternal_H