text
stringlengths
4
6.14k
#include "../../src/oauth/qabstractoauthreplyhandler.h"
/* Goblin Library Loader v1.0 - A loader for loading dynamic libraries for Windows and Linux Copyright (C) 2016 Daniel McCarthy 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 GOBLINLIBRARYLOADER_H #define GOBLINLIBRARYLOADER_H #define EXPORT __declspec(dllexport) #ifdef __CYGWIN__ #define _WIN32 #endif #ifdef __cplusplus extern "C" { #endif #ifndef _WIN32 #error Goblin Library Loader is only compatible with windows at the moment #endif void* EXPORT GoblinLoadLibrary(const char* filename); void* EXPORT GoblinGetAddress(void* library, const char* entity_name); #ifdef __cplusplus } #endif #endif /* GOBLINLIBRARYLOADER_H */
/** ****************************************************************************** * @file usb_endp.c * @author MCD Application Team * @version V4.0.0 * @date 21-January-2013 * @brief Endpoint routines ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT 2013 STMicroelectronics</center></h2> * * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); * You may not use this file except in compliance with the License. * You may obtain a copy of the License at: * * http://www.st.com/software_license_agreement_liberty_v2 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ****************************************************************************** */ /* Includes ------------------------------------------------------------------*/ #include "hw_config.h" #include "usb_desc.h" #include "usb_lib.h" #include "usb_istr.h" /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ uint8_t Receive_Buffer[9]; extern __IO uint8_t PrevXferComplete; extern uint8_t Buffer[RPT4_COUNT+1]; /* Private function prototypes -----------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ /******************************************************************************* * Function Name : EP1_OUT_Callback. * Description : EP1 OUT Callback Routine. * Input : None. * Output : None. * Return : None. *******************************************************************************/ void EP1_OUT_Callback(void) { BitAction Led_State; /* Read received data (2 bytes) */ USB_SIL_Read(EP1_OUT, Receive_Buffer); if (Receive_Buffer[1] == 0) { Led_State = Bit_RESET; } else { Led_State = Bit_SET; } switch (Receive_Buffer[0]) { case 1: /* Led 1 */ if (Led_State != Bit_RESET) { // GPIO_SetBits(LED_PORT,LED1_PIN); } else { // GPIO_ResetBits(LED_PORT,LED1_PIN); } break; case 2: /* Led 2 */ if (Led_State != Bit_RESET) { // GPIO_SetBits(LED_PORT,LED2_PIN); } else { // GPIO_ResetBits(LED_PORT,LED2_PIN); } break; case 3: /* Led 1&2 */ Buffer[4]=Receive_Buffer[1]; break; } SetEPRxStatus(ENDP1, EP_RX_VALID); } /******************************************************************************* * Function Name : EP1_OUT_Callback. * Description : EP1 OUT Callback Routine. * Input : None. * Output : None. * Return : None. *******************************************************************************/ void EP1_IN_Callback(void) { /* Set the transfer complete token to inform upper layer that the current transfer has been complete */ PrevXferComplete = 1; } /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
/* * This file is part of the libemb project. * * Copyright (C) 2011 Stefan Wendler <sw@kaltpost.de> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef __CONIO_H_ #define __CONIO_H_ /** * Print a character to the console. * * @param[in] c character to print */ void cio_printc(char c); /** * Print a string to the console. * * @param[in] *line string to print */ void cio_print(char *line); /** * Print an integer to the console. * * @param[in] n number to print */ void cio_printi(int n); /** * Print a number in binary to the console. * * @param[in] n number to print * @param[in] size number of bits to use */ void cio_printb(int n, int size); /** * Print a formated string. The following formt specifiers could * be used in the format string: * <pre> * String %s * Char %c * Integer %i * Unsigned %u * Long %l * unsigned long %n * heX %x * </pre> * @param[in] *format the format string * @param[in] ... the values to put into the format string */ void cio_printf(char *format, ...); /** * Read a character form the console. * * @return character read from the console */ char cio_getc(); #endif
/** * 2011 * (c) Z.Vova */ #include <unistd.h> #include <swilib.h> #include <errno.h> int rmdir(const char *dir) { return _rmdir(dir, (unsigned int*)__errno_location()); }
/******************************************************************************* OpenAirInterface Copyright(c) 1999 - 2014 Eurecom OpenAirInterface is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenAirInterface is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenAirInterface.The full GNU General Public License is included in this distribution in the file called "COPYING". If not, see <http://www.gnu.org/licenses/>. Contact Information OpenAirInterface Admin: openair_admin@eurecom.fr OpenAirInterface Tech : openair_tech@eurecom.fr OpenAirInterface Dev : openair4g-devel@eurecom.fr Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06410 Biot Sophia Antipolis cedex, FRANCE *******************************************************************************/ /** @addtogroup _mesh_layer3_ @{ */ /** \brief Establish a new classification rule. @returns status indication */ int cmm_class_setup_req(L3ID_T L3id, //!< L3 ID type (IPv4 Addr,IPv6 Addr,MPLS Labels) void *InA, //!< L3 ID A void *InB, //!< L3 ID B RBID_T Rbid, //!< L2 RBID L3QOS_T L3QoS, //!< L3 QoS type (DSCP,EXP,ICMPV6) void *QoS_id, //!< L3 QoS id (DSCP #, EXP #, ICMPv6 message type) Transaction_t Trans_id //!< Transaction ID ); /** \brief Release a classification rule which was previously established. @returns status indication */ int cmm_class_release_req(L3ID_T L3id, //!< L3 ID type (IPv4 Addr,IPv6 Addr,MPLS Labels) void *InA, //!< L3 ID A void *InB, //!< L3 ID B RBID_T Rbid, //!< L2 RBID L3QOS_T L3QoS, //!< L3 QoS type (DSCP,EXP,ICMPV6) void *QoS_id, //!< L3 QoS id (DSCP #, EXP #, ICMPv6 message type) Transaction_t Trans_id //!< Transaction ID ); /** @} */
/******************************************************************************* * Project: IECC (IEC 61131-3 Languages Compiler for Arduino). * * Authors: Paulo H. Torrens <paulotorrens AT gnu DOT org>. * * License: GNU GPLv3+. * * * * Language: (Legacy) Objective-C. * * Description: * ******************************************************************************** * Copyright (C) 2015 - Paulo H. Torrens. All rights reserved. * * * * This program is free software: you can redistribute it and/or modify it * * under the terms of the GNU General Public License as published by the Free * * Software Foundation, either version 3 of the License, or (at your option) * * any later version. * * * * This program is distributed in the hope that it will be useful, but WITHOUT * * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * * more details. * * * * You should have received a copy of the GNU General Public License along with * * this program. If not, see <http://www.gnu.org/licenses/>. * *******************************************************************************/ // #ifndef __IECC_INCLUDE_IECC_TYPES_ANY_NUM_INCLUDE__ #define __IECC_INCLUDE_IECC_TYPES_ANY_NUM_INCLUDE__ #include "types/IECCAnyMagnitude.h" #endif // #ifndef __IECC_INCLUDE_IECC_TYPES_ANY_NUM_DEFINE__ #ifdef __IECC_INCLUDE_IECC_TYPES_ANY_MAGNITUDE_DEFINE__ #define __IECC_INCLUDE_IECC_TYPES_ANY_NUM_DEFINE__ // @interface IECCAnyNum: IECCAnyMagnitude @end #endif #endif
#pragma once #include "EventController.h" #include "InputKeyboard.h" #include "InputMouse.h" #include "InputGamepad.h" #include "DLL_DEF.h" struct SDL_Window; namespace ge { class GEDLL InputManager { public: enum InterfaceType { NoInterface = 0, KeyboardInterface = 1, MouseInterface = 2, GamepadInterface = 4, AllInterfaces = 7 }; private: EventController* eventController; SDL_Window* window; std::unique_ptr<InputKeyboard> keyboard; std::unique_ptr<InputMouse> mouse; std::unique_ptr<InputGamepad> gamepad; public: InputManager (EventController* eventCtrl, SDL_Window* window); virtual ~InputManager (); void Update (); InputManager& Reset (InterfaceType what); InputManager& ShutDown (InterfaceType what); InputKeyboard* Keyboard () { if (keyboard == nullptr) Reset(KeyboardInterface); return keyboard.get(); } InputMouse* Mouse () { if (mouse == nullptr) Reset(MouseInterface); return mouse.get(); } InputGamepad* Gamepad () { if (gamepad == nullptr) Reset(GamepadInterface); return gamepad.get(); } }; }
#ifndef tourmaline_Class_h #define tourmaline_Class_h #include "tour.h" #include "messaging.h" _EXTERN_C_BEGIN #define _C_ID '@' #define _C_CLASS '#' #define _C_SEL ':' #define _C_CHR 'c' #define _C_UCHR 'C' #define _C_SHT 's' #define _C_USHT 'S' #define _C_INT 'i' #define _C_UINT 'I' #define _C_LNG 'l' #define _C_ULNG 'L' #define _C_LNG_LNG 'q' #define _C_ULNG_LNG 'Q' #define _C_FLT 'f' #define _C_DBL 'd' #define _C_BFLD 'b' #define _C_BOOL 'B' #define _C_VOID 'v' #define _C_UNDEF '?' #define _C_PTR '^' #define _C_CHARPTR '*' #define _C_ATOM '%' #define _C_ARY_B '[' #define _C_ARY_E ']' #define _C_UNION_B '(' #define _C_UNION_E ')' #define _C_STRUCT_B '{' #define _C_STRUCT_E '}' #define _C_VECTOR '!' #define _C_COMPLEX 'j' typedef struct tour_superclass { id self; #ifdef __cplusplus Class_ref super_class; #else Class_ref class; #endif /* def __cplusplus */ } Super, *Super_ref; #define CLASS_CLASSOF(_class_) OBJ_CLASSOF(_class_) #define CLASS_SUPER_CLASSOF(_class_) ((_class_)->super_class) #define CLASS_GET_CLASSNAME(_class_) ((_class_)->name) #define CLASS_INFO(_class_) ((_class_)->info) #define CLASS_INSTANCE_SIZE(_class_) ((_class_)->instance_size) #define CLASS_GC_OBJECT_TYPE(_class_) ((_class_)->gc_object_type) #define __CLASS_IS_INFO(_class_, _mask_) ((CLASS_INFO(_class_) & _mask_) == _mask_) #define __CLASS_SETINFO(_class_, _mask_) (CLASS_INFO(_class_) |= _mask_) #define _CLASSID_META 0x01L #define CLASS_IS_META(_class_) __CLASS_IS_INFO(_class_, _CLASSID_META) #define _CLASSID_CLASS 0x02L #define CLASS_IS_CLASS(_class_) __CLASS_IS_INFO(_class_, _CLASSID_CLASS) #define _CLASSID_INITIALIZED 0x04L #define CLASS_IS_INITIALIZED(_class_) __CLASS_IS_INFO(_class_, _CLASSID_INITIALIZED) #define CLASS_SETINITIALIZED(_class_) __CLASS_SETINFO(_class_, _CLASSID_INITIALIZED) #define _CLASSID_RESOLV 0x08L #define CLASS_IS_RESOLV(_class_) __CLASS_IS_INFO(_class_, _CLASSID_RESOLV) #define CLASS_SETRESOLV(_class_) __CLASS_SETINFO(_class_, _CLASSID_RESOLV) #define CLASS_GETNUMBER(_class_) (CLASS_INFO(_class_) >> (HOST_BITS_PER_LONG / 2)) #define CLASS_SETNUMBER(_class_, _num_) \ ({ (_class_)->info <<= (HOST_BITS_PER_LONG / 2); \ (_class_)->info >>= (HOST_BITS_PER_LONG / 2); \ __CLASS_SETINFO(_class_, (((unsigned long)_num_) << (HOST_BITS_PER_LONG / 2))); }) Method_ref Class_get_class_method(MetaClass_ref _class, SEL op); Method_ref Class_get_instance_method(Class_ref _class, SEL op); Class_ref Class_pose_as(Class_ref impostor, Class_ref superclass); Class_ref tour_get_class(const char* name); Class_ref tour_lookup_class(const char* name); Class_ref tour_next_class(void** enume_state); extern id Class_create_instance(Class_ref _class); static inline const char* Class_get_class_name(Class_ref _class) { return CLASS_IS_CLASS(_class) ? CLASS_GET_CLASSNAME(_class) : ( (_class == Nil) ? "Nil": NULL ); } static inline int Class_get_instance_size(Class_ref _class) { return CLASS_IS_CLASS(_class) ? _class->instance_size: 0; } static inline MetaClass_ref Class_get_meta_class(Class_ref _class) { return CLASS_IS_CLASS(_class) ? _class->class_pointer: Nil; } static inline Class_ref Class_get_super_class(Class_ref _class) { return CLASS_IS_CLASS(_class) ? _class->super_class: Nil; } static inline int Class_get_version(Class_ref _class) { return CLASS_IS_CLASS(_class) ? _class->version: -1; } static inline Boolean Class_is_class(Class_ref _class) { return CLASS_IS_CLASS(_class); } static inline Boolean Class_is_metaclass(Class_ref _class) { return CLASS_IS_META(_class); } static inline void Class_set_version(Class_ref _class, int version) { if ( CLASS_IS_CLASS(_class) ) _class->version = version; } static inline void* Class_get_gc_object_type(Class_ref _class) { return CLASS_IS_CLASS(_class) ? _class->gc_object_type: NULL; } _EXTERN_C_END #endif /* tourmaline_Class_h */
/* * Parser.c * * Created on: Aug 26, 2017 * Author: maanu */ #include "Main.h" #include "Lexer.h" #include "Parser.h" /* * <program> ::= <statement> * <statement> ::= <id> = <expr> * | <expr> * <expr> ::= <str> * | <func>(<expr>) * | <addtive_expr> * <multiplicative_expr> ::= <term> * | <multiplicative_expr> * <term> * | <multiplicative_expr> / <term> * | <multiplicative_expr> % <term> * <addtive_expr> ::= <multiplicative_expr> * | <addtive_expr> + <multiplicative_expr> * | <addtive_expr> - <multiplicative_expr> * <term> ::= <id> * | <int> * | (<expr>) * <id> ::= TOK_ID * <int> ::= TOK_INT * <str> ::= TOK_STR * <func> ::= TOK_FUNC */ static ParserNode_t* newNode(Bnf_t type); static void clearAllNode(ParserNode_t* ); static ParserNode_t* program(void); static ParserNode_t* statement(void); static ParserNode_t* expr(void); static ParserNode_t* additiv_expr(void); static ParserNode_t* mutipli_expr(void); static ParserNode_t* term(void); static char* getTokIdName(void); static uint64_t getSymIntVal(void); static Token_t* tokStart; static Token_t *tokCurrent; static bool syntaxError; #define SYNERR_RETURN {syntaxError = true; return NULL;} #define CHK_SYNERR_RETURN {if(syntaxError) {return NULL;}} ParserNode_t* Parser_Parse(Token_t* toklist) { syntaxError = false; tokStart = toklist; tokCurrent = toklist; ParserNode_t* parseResult = program(); if(*tokCurrent != TOK_NOSYM) { // syntax error return NULL; } if(syntaxError) { clearAllNode(parseResult); return NULL; } return parseResult; } void Parser_Release(ParserNode_t* parseResult) { clearAllNode(parseResult); } static char* getTokIdName(void) { int index = (int)(tokCurrent - tokStart); return Lexer_GetIdName(index); } static uint64_t getSymIntVal(void) { int index = (int)(tokCurrent - tokStart); return Lexer_GetIntVal(index); } static ParserNode_t* newNode(Bnf_t type) { ParserNode_t* node; node = (ParserNode_t*)malloc(sizeof(ParserNode_t)); memset(node, 0, sizeof(ParserNode_t)); node->type = type; return node; } static void clearAllNode(ParserNode_t* node) { if(node != NULL) { free(node); clearAllNode(node->child1); clearAllNode(node->child2); } } // <program> ::= <statement> static ParserNode_t* program(void) { ParserNode_t* nodeProgram = newNode(BNF_program); nodeProgram->child1 = statement(); return nodeProgram; } // <statement> ::= <id> = <expr> // | <expr> static ParserNode_t* statement(void) { ParserNode_t* nodeStatement; if(*tokCurrent == TOK_ID) { char* idName = getTokIdName(); tokCurrent++; if(*tokCurrent == TOK_EQU) { ParserNode_t* nodeId = newNode(BNF_var); nodeId->name = idName; nodeStatement = newNode(BNF_assign); nodeStatement->child1 = nodeId; tokCurrent++; nodeStatement->child2 = expr(); CHK_SYNERR_RETURN; } else { // rewind tokCurrent--; nodeStatement = expr(); CHK_SYNERR_RETURN; } } else { nodeStatement = expr(); CHK_SYNERR_RETURN; } return nodeStatement; } // <expr> ::= <str> // | <func>(<expr>) // | <addtive_expr> static ParserNode_t* expr(void) { ParserNode_t* nodeExpr; if(*tokCurrent == TOK_STR) { nodeExpr = newNode(BNF_str); nodeExpr->name = getTokIdName(); tokCurrent++; } else if(*tokCurrent == TOK_FUNC) { char* funcName = getTokIdName(); tokCurrent++; if(*tokCurrent == TOK_LPAR) { tokCurrent++; ParserNode_t* subExpr = expr(); CHK_SYNERR_RETURN; if(*tokCurrent == TOK_RPAR) { nodeExpr = newNode(BNF_call); nodeExpr->name = funcName; nodeExpr->child1 = subExpr; tokCurrent++; } else { SYNERR_RETURN; } } else { SYNERR_RETURN; } } else { nodeExpr = additiv_expr(); CHK_SYNERR_RETURN; } return nodeExpr; } // <addtive_expr> ::= <multiplicative_expr> // | <addtive_expr> + <multiplicative_expr> // | <addtive_expr> - <multiplicative_expr> static ParserNode_t* additiv_expr(void) { ParserNode_t* nodeAdditiv; nodeAdditiv = mutipli_expr(); CHK_SYNERR_RETURN; while(*tokCurrent == TOK_PLUS || *tokCurrent == TOK_MIN) { ParserNode_t* nodeAdd = newNode((*tokCurrent == TOK_PLUS)?BNF_add:BNF_sub); nodeAdd->child1 = nodeAdditiv; tokCurrent++; nodeAdd->child2 = mutipli_expr(); CHK_SYNERR_RETURN; nodeAdditiv = nodeAdd; } return nodeAdditiv; } // <multiplicative_expr> ::= <term> // | <multiplicative_expr> * <term> // | <multiplicative_expr> / <term> // | <multiplicative_expr> % <term> static ParserNode_t* mutipli_expr(void) { ParserNode_t* nodeMutipli; nodeMutipli = term(); CHK_SYNERR_RETURN; while(*tokCurrent == TOK_MUL || *tokCurrent == TOK_DIV || *tokCurrent == TOK_RIM) { ParserNode_t* nodeMul; if(*tokCurrent == TOK_MUL) { nodeMul = newNode(BNF_mul); } else if(*tokCurrent == TOK_DIV) { nodeMul = newNode(BNF_div); } else if(*tokCurrent == TOK_RIM) { nodeMul = newNode(BNF_rem); } nodeMul->child1 = nodeMutipli; tokCurrent++; nodeMul->child2 = term(); CHK_SYNERR_RETURN; nodeMutipli = nodeMul; } return nodeMutipli; } // <term> ::= <id> // | <int> // | (<expr>) static ParserNode_t* term(void) { ParserNode_t* nodeTerm; if(*tokCurrent == TOK_ID) { nodeTerm = newNode(BNF_var); nodeTerm->name = getTokIdName(); tokCurrent++; } else if(*tokCurrent == TOK_INT) { nodeTerm = newNode(BNF_const); nodeTerm->val = getSymIntVal(); tokCurrent++; } else if(*tokCurrent == TOK_LPAR) { tokCurrent++; nodeTerm = expr(); CHK_SYNERR_RETURN; if(*tokCurrent == TOK_RPAR) { tokCurrent++; } else { SYNERR_RETURN; } } else { SYNERR_RETURN; } return nodeTerm; }
/* This file is part of Desperion. Copyright 2010, 2011 LittleScaraby, Nekkro Desperion 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. Desperion 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 Desperion. If not, see <http://www.gnu.org/licenses/>. */ #ifndef __EXCHANGE_STARTED_WITH_PODS_MESSAGE__ #define __EXCHANGE_STARTED_WITH_PODS_MESSAGE__ class ExchangeStartedWithPodsMessage : public ExchangeStartedMessage { public: int firstCharacterId; int firstCharacterCurrentWeight; int firstCharacterMaxWeight; int secondCharacterId; int secondCharacterCurrentWeight; int secondCharacterMaxWeight; uint16 GetOpcode() const { return SMSG_EXCHANGE_STARTED_WITH_PODS; } ExchangeStartedWithPodsMessage() { } ExchangeStartedWithPodsMessage(int8 exchangeType, int firstCharacterId, int firstCharacterCurrentWeight, int firstCharacterMaxWeight, int secondCharacterId, int secondCharacterCurrentWeight, int secondCharacterMaxWeight) : ExchangeStartedMessage(exchangeType), firstCharacterId(firstCharacterId), firstCharacterCurrentWeight(firstCharacterCurrentWeight), firstCharacterMaxWeight(firstCharacterMaxWeight), secondCharacterId(secondCharacterId), secondCharacterCurrentWeight(secondCharacterCurrentWeight), secondCharacterMaxWeight(secondCharacterMaxWeight) { } void Serialize(ByteBuffer& data) const { ExchangeStartedMessage::Serialize(data); data<<firstCharacterId<<firstCharacterCurrentWeight<<firstCharacterMaxWeight<<secondCharacterId<<secondCharacterCurrentWeight<<secondCharacterMaxWeight; } void Deserialize(ByteBuffer& data) { ExchangeStartedMessage::Deserialize(data); data>>firstCharacterId>>firstCharacterCurrentWeight>>firstCharacterMaxWeight>>secondCharacterId>>secondCharacterCurrentWeight>>secondCharacterMaxWeight; } }; #endif
#pragma once #ifdef WIN32 #define localtime_r(timep, result) localtime_s(result, timep) #define gmtime_r(timep, result) gmtime_s(result, timep) #define strncasecmp _strnicmp #define stat _stat #endif
/* Test of dropping uid/gid privileges of the current process permanently. Copyright (C) 2009-2014 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> #include "idpriv.h" #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include "macros.h" static void show_uids () { #if HAVE_GETRESUID /* glibc, FreeBSD, OpenBSD, HP-UX */ uid_t real; uid_t effective; uid_t saved; ASSERT (getresuid (&real, &effective, &saved) >= 0); printf ("uids: real=%d effective=%d saved=%d", (int) real, (int) effective, (int) saved); #elif HAVE_GETEUID printf ("uids: real=%d effective=%d", (int) getuid (), (int) geteuid ()); #elif HAVE_GETUID printf ("uids: real=%d", (int) getuid ()); #endif } static void show_gids () { #if HAVE_GETRESGID /* glibc, FreeBSD, OpenBSD, HP-UX */ gid_t real; gid_t effective; gid_t saved; ASSERT (getresgid (&real, &effective, &saved) >= 0); printf ("gids: real=%d effective=%d saved=%d", (int) real, (int) effective, (int) saved); #elif HAVE_GETEGID printf ("gids: real=%d effective=%d", (int) getgid (), (int) getegid ()); #elif HAVE_GETGID printf ("gids: real=%d", (int) getgid ()); #endif } static void show (const char *prefix) { printf ("%s ", prefix); show_uids (); printf (" "); show_gids (); printf ("\n"); } int main (int argc, char *argv[]) { bool verbose = false; int i; #if HAVE_GETUID int uid = getuid (); #endif #if HAVE_GETGID int gid = getgid (); #endif /* Parse arguments. -v enables verbose output. */ for (i = 1; i < argc; i++) { const char *arg = argv[i]; if (strcmp (arg, "-v") == 0) verbose = true; } if (verbose) show ("before drop:"); ASSERT (idpriv_drop () == 0); if (verbose) show ("after drop: "); /* Verify that the privileges have really been dropped. */ #if HAVE_GETRESUID /* glibc, FreeBSD, OpenBSD, HP-UX */ { uid_t real; uid_t effective; uid_t saved; if (getresuid (&real, &effective, &saved) < 0 || real != uid || effective != uid || saved != uid) abort (); } #else # if HAVE_GETEUID if (geteuid () != uid) abort (); # endif # if HAVE_GETUID if (getuid () != uid) abort (); # endif #endif #if HAVE_GETRESGID /* glibc, FreeBSD, OpenBSD, HP-UX */ { gid_t real; gid_t effective; gid_t saved; if (getresgid (&real, &effective, &saved) < 0 || real != gid || effective != gid || saved != gid) abort (); } #else # if HAVE_GETEGID if (getegid () != gid) abort (); # endif # if HAVE_GETGID if (getgid () != gid) abort (); # endif #endif return 0; }
/************************************************************************************* *filename: rudp_ccc.h * *to do: RUDP·¢ËÍÂëÂÊ¿ØÖÆÆ÷£¬ÊµÏÖ´ø¿íÆÀ¹À¡¢·¢ËÍ´°¿Ú¾ö²ß¡¢RTT¼ÆËãµÈ *Create on: 2013-04 *Author: zerok *check list: *************************************************************************************/ #ifndef __RUDP_CCC_H_ #define __RUDP_CCC_H_ #include "base_typedef.h" #include "base_namespace.h" #include "rudp_packet.h" BASE_NAMESPACE_BEGIN_DECL //CCCÏÞËÙ¿ØÖÆÆ÷ class RUDPCCCObject { public: RUDPCCCObject(); virtual ~RUDPCCCObject(); void init(uint64_t last_ack_id); void reset(); void on_ack(uint64_t ack_seq); void on_loss(uint64_t base_seq, const LossIDArray& loss_ids); void on_timer(uint64_t now_ts); public: uint32_t get_send_window_size() const {return snd_cwnd_;}; void set_max_segment_size(uint16_t mss); void set_rtt(uint32_t keep_live_rtt); uint32_t get_rtt() const { return (uint32_t)(rtt_ * rtt_scale_); }; uint32_t get_rtt_var() const { return (uint32_t)(rtt_var_ * rtt_scale_); }; void add_resend(); void add_recv(uint32_t count); protected: void set_max_cwnd(uint32_t rtt); private: //µ±Ç°·¢ËÍ´°¿Ú uint32_t snd_cwnd_; uint32_t rtt_; uint32_t rtt_var_; double rtt_scale_; uint64_t last_ack_id_; uint64_t prev_on_ts_; bool slow_start_; bool loss_flag_; //µÚÒ»´ÎÉèÖÃRTT bool rtt_first_; uint32_t resend_count_; uint32_t recv_count_; uint16_t max_cwnd_; uint16_t min_cwnd_; uint16_t limit_cwnd_; uint32_t print_count_; }; BASE_NAMESPACE_END_DECL #endif /************************************************************************************/
#ifndef COMBAIN_HTTP_H #define COMBAIN_HTTP_H #include "legato.h" #include "interfaces.h" #include "ThreadSafeQueue.h" void CombainHttpInit( ThreadSafeQueue<std::tuple<ma_combainLocation_LocReqHandleRef_t, std::string>> *requestJson, ThreadSafeQueue<std::tuple<ma_combainLocation_LocReqHandleRef_t, std::string>> *responseJson, le_event_Id_t responseAvailableEvent); void CombainHttpDeinit(void); void *CombainHttpThreadFunc(void *context); #define MAX_LEN_API_KEY 32 extern char combainApiKey[MAX_LEN_API_KEY]; #endif // COMBAIN_HTTP_H
#ifndef QGCTABBEDINFOVIEW_H #define QGCTABBEDINFOVIEW_H #include <QWidget> #include "ui_QGCTabbedInfoView.h" #include "MAVLinkDecoder.h" #include "QGCMessageView.h" #include "UASQuickView.h" #include "UASRawStatusView.h" class QGCTabbedInfoView : public QWidget { Q_OBJECT public: explicit QGCTabbedInfoView(QWidget *parent = 0); ~QGCTabbedInfoView(); void addSource(MAVLinkDecoder *decoder); private: MAVLinkDecoder *m_decoder; Ui::QGCTabbedInfoView ui; QGCMessageView *messageView; UASQuickView *quickView; UASRawStatusView *rawView; }; #endif // QGCTABBEDINFOVIEW_H
/* * ARCEMU MMORPG Server Software * Copyright (c) 2008-2012 ARCEMU Server Team * See COPYING for license details. */ #pragma once #define WINTERGRASP 4197 #define A_NUMVEH_WORLDSTATE 3680 #define A_MAXVEH_WORLDSTATE 3681 #define H_NUMVEH_WORLDSTATE 3490 #define H_MAXVEH_WORLDSTATE 3491 #define HORDE_CONTROLLED 3802 #define ALLIANCE_CONTROLLED 3803 #define WGSPELL_ESSENCE_OF_WINTERGRASP 57940 #define WGSPELL_TENACITY 59911 #define DEFENDERS_PORTAL 190763 const uint32 ClockWorldState[5] = { 3785, 3784, 3782, 3976, 3975}; typedef std::set<Creature*> CreatureSwapSet; typedef std::set<Player*> WintergraspPlayerSet; class Wintergrasp { public: Wintergrasp(WintergraspInternal* WGI, MapMgr* mgr); ~Wintergrasp(); static Wintergrasp* Create( WintergraspInternal* i, MapMgr* m) { return new Wintergrasp(i, m); } void Init(); void End(); void OnAddPlayer(Player* plr); void OnRemovePlayer(Player* plr); WintergraspPlayerSet WGPlayers; CreatureSwapSet WGCreatures[2]; uint32 GetNumVehicles(uint32 team) { if(team > 1) return 0; return numvehicles[team]; }; uint32 GetNumWorkshops(uint32 team) { if(team > 1) return 0; return numworkshop[team]; }; ARCEMU_INLINE uint64 GetID() { return WGID; }; private: WintergraspInternal Internal; // Counts uint32 playercount[3]; // Buildings // Vehicles uint32 numvehicles[2]; // Workshops uint32 numworkshop[2]; // Same as BattleGround id uint64 WGID; };
#ifndef SRC_LIB_NGSI9_UPDATECONTEXTAVAILABILITYSUBSCRIPTIONRESPONSE_H_ #define SRC_LIB_NGSI9_UPDATECONTEXTAVAILABILITYSUBSCRIPTIONRESPONSE_H_ /* * * Copyright 2013 Telefonica Investigacion y Desarrollo, S.A.U * * This file is part of Orion Context Broker. * * Orion Context Broker 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. * * Orion Context Broker 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 Orion Context Broker. If not, see http://www.gnu.org/licenses/. * * For those usages not covered by this license please contact with * iot_support at tid dot es * * Author: Ken Zangelin */ #include <string> #include <vector> #include "ngsi/SubscriptionId.h" #include "ngsi/Duration.h" #include "ngsi/StatusCode.h" #include "ngsi/Request.h" /* **************************************************************************** * * UpdateContextAvailabilitySubscriptionResponse - */ typedef struct UpdateContextAvailabilitySubscriptionResponse { SubscriptionId subscriptionId; // Mandatory Duration duration; // Optional StatusCode errorCode; // Optional UpdateContextAvailabilitySubscriptionResponse(); UpdateContextAvailabilitySubscriptionResponse(StatusCode& _errorCode); ~UpdateContextAvailabilitySubscriptionResponse(); std::string toJsonV1(void); std::string check(const std::string& predetectedError); } UpdateContextAvailabilitySubscriptionResponse; #endif // SRC_LIB_NGSI9_UPDATECONTEXTAVAILABILITYSUBSCRIPTIONRESPONSE_H_
#pragma once #include <QObject> class QByteArray; class QString; class I_CommDevice : public QObject { Q_OBJECT public: virtual ~I_CommDevice() {} signals: void dataReceived(QByteArray data); };
// // Copyright (C) 2013-2017 University of Amsterdam // // 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/>. // #ifndef ANOVAREPEATEDMEASURESFORM_H #define ANOVAREPEATEDMEASURESFORM_H #include "analysisform.h" #include "widgets/tablemodelvariablesassigned.h" #include "widgets/tablemodelanovamodel.h" #include "widgets/tablemodelvariablesoptions.h" #include "widgets/tablemodelanovadesign.h" #include "widgets/tablemodelanovawithinsubjectcells.h" namespace Ui { class AnovaRepeatedMeasuresForm; } class AnovaRepeatedMeasuresForm : public AnalysisForm { Q_OBJECT public: explicit AnovaRepeatedMeasuresForm(QWidget *parent = 0); ~AnovaRepeatedMeasuresForm(); virtual void bindTo(Options *options, DataSet *dataSet) OVERRIDE; private slots: void factorsChanging(); void factorsChanged(); void termsChanged(); void withinSubjectsDesignChanged(); void anovaDesignTableClicked(QModelIndex index); private: Ui::AnovaRepeatedMeasuresForm *ui; TableModelAnovaDesign *_designTableModel; TableModelAnovaWithinSubjectCells *_withinSubjectCellsListModel; TableModelVariablesAssigned *_betweenSubjectsFactorsListModel; TableModelVariablesAssigned *_covariatesListModel; TableModelVariablesAssigned *_wlsWeightsListModel; TableModelAnovaModel *_withinSubjectsTermsModel; TableModelAnovaModel *_betweenSubjectsTermsModel; TableModelVariablesOptions *_contrastsModel; TableModelVariablesAvailable *_factorsAvailableListModel; TableModelVariablesAvailable *_plotFactorsAvailableTableModel; TableModelVariablesAssigned *_horizontalAxisTableModel; TableModelVariablesAssigned *_seperateLinesTableModel; TableModelVariablesAssigned *_seperatePlotsTableModel; }; #endif // ANOVAREPEATEDMEASURESFORM_H
/** * Copyright (C) 2016 splone UG * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License, version 3, * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU 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/>. */ #pragma once #include <msgpack/sbuffer.h> // for msgpack_sbuffer #include <msgpack/unpack.h> // for msgpack_unpacker #include <stdbool.h> // for bool #include <stddef.h> // for size_t #include <stdint.h> // for uint64_t, uint32_t #include <uv.h> // for uv_stream_t, uv_timer_t #include "kvec.h" // for kvec_t #include "rpc/connection/event.h" // for multiqueue #include "rpc/sb-rpc.h" // for crypto_context, hashmap_cstr_t_ptr_t #include "sb-common.h" // for hashmap struct connection { uint64_t id; uint32_t msgid; size_t pending_requests; size_t refcount; msgpack_unpacker *mpac; msgpack_sbuffer *sbuf; char *unpackbuf; bool closed; multiqueue *events; struct { inputstream *read; outputstream *write; uv_stream_t *uv; } streams; kvec_t(struct callinfo *) callvector; kvec_t(wbuffer *) delayed_notifications; struct crypto_context cc; struct { uint64_t start; uint64_t end; uint64_t pos; uint64_t length; unsigned char *data; } packet; uv_timer_t minutekey_timer; hashmap(cstr_t, ptr_t) *subscribed_events; };
#ifndef _OPENCOG_ATOMTABLE_WRAP_H #define _OPENCOG_ATOMTABLE_WRAP_H /** Exposes the AtomTable class. */ void init_AtomTable_py(); #endif // _OPENCOG_ATOMTABLE_WRAP_H
/* * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * * 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 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 <https://www.gnu.org/licenses/>. */ #ifndef OGS_IPFW_H #define OGS_IPFW_H #ifdef __cplusplus extern "C" { #endif #include "ogs-core.h" typedef struct ogs_ipfw_rule_s { uint8_t proto; uint8_t ipv4_src; uint8_t ipv4_dst; uint8_t ipv6_src; uint8_t ipv6_dst; struct { struct { uint32_t addr[4]; uint32_t mask[4]; } src; struct { uint32_t addr[4]; uint32_t mask[4]; } dst; } ip; struct { struct { uint16_t low; uint16_t high; } src; struct { uint16_t low; uint16_t high; } dst; } port; uint16_t tos_traffic_class; uint32_t security_parameter_index; uint32_t flow_label; /* 24bit */ uint32_t sdf_filter_id; } ogs_ipfw_rule_t; int ogs_ipfw_compile_rule(ogs_ipfw_rule_t *ipfw_rule, char *flow_description); char *ogs_ipfw_encode_flow_description(ogs_ipfw_rule_t *ipfw_rule); /* * Refer to lib/ipfw/ogs-ipfw.h * Issue #338 * * <DOWNLINK> * RX : permit out from <P-CSCF_RTP_IP> <P-CSCF_RTP_PORT> to <UE_IP> <UE_PORT> * GX : permit out from <P-CSCF_RTP_IP> <P-CSCF_RTP_PORT> to <UE_IP> <UE_PORT> * PFCP : permit out from <P-CSCF_RTP_IP> <P-CSCF_RTP_PORT> to <UE_IP> <UE_PORT> * RULE : Source <P-CSCF_RTP_IP> <P-CSCF_RTP_PORT> Destination <UE_IP> <UE_PORT> * TFT : Local <UE_IP> <UE_PORT> REMOTE <P-CSCF_RTP_IP> <P-CSCF_RTP_PORT> * * <UPLINK> * RX : permit in from <UE_IP> <UE_PORT> to <P-CSCF_RTP_IP> <P-CSCF_RTP_PORT> * GX : permit out from <P-CSCF_RTP_IP> <P-CSCF_RTP_PORT> to <UE_IP> <UE_PORT> * PFCP : permit out from <P-CSCF_RTP_IP> <P-CSCF_RTP_PORT> to <UE_IP> <UE_PORT> * RULE : Source <UE_IP> <UE_PORT> Destination <P-CSCF_RTP_IP> <P-CSCF_RTP_PORT> * TFT : Local <UE_IP> <UE_PORT> REMOTE <P-CSCF_RTP_IP> <P-CSCF_RTP_PORT> */ ogs_ipfw_rule_t *ogs_ipfw_copy_and_swap( ogs_ipfw_rule_t *dst, ogs_ipfw_rule_t *src); void ogs_ipfw_rule_swap(ogs_ipfw_rule_t *ipfw_rule); #define OGS_MAX_NUM_OF_PACKET_FILTER_COMPONENT 16 typedef struct ogs_pf_content_s { uint8_t length; #define OGS_PACKET_FILTER_MATCH_ALL 1 #define OGS_PACKET_FILTER_PROTOCOL_IDENTIFIER_NEXT_HEADER_TYPE 48 #define OGS_PACKET_FILTER_IPV4_REMOTE_ADDRESS_TYPE 16 #define OGS_PACKET_FILTER_IPV4_LOCAL_ADDRESS_TYPE 17 #define OGS_PACKET_FILTER_IPV6_REMOTE_ADDRESS_TYPE 32 #define OGS_PACKET_FILTER_IPV6_REMOTE_ADDRESS_PREFIX_LENGTH_TYPE 33 #define OGS_PACKET_FILTER_IPV6_LOCAL_ADDRESS_TYPE 34 #define OGS_PACKET_FILTER_IPV6_LOCAL_ADDRESS_PREFIX_LENGTH_TYPE 35 #define OGS_PACKET_FILTER_SINGLE_LOCAL_PORT_TYPE 64 #define OGS_PACKET_FILTER_LOCAL_PORT_RANGE_TYPE 65 #define OGS_PACKET_FILTER_SINGLE_REMOTE_PORT_TYPE 80 #define OGS_PACKET_FILTER_REMOTE_PORT_RANGE_TYPE 81 #define OGS_PACKET_FILTER_SECURITY_PARAMETER_INDEX_TYPE 96 #define OGS_PACKET_FILTER_TOS_TRAFFIC_CLASS_TYPE 112 #define OGS_PACKET_FILTER_FLOW_LABEL_TYPE 128 struct { uint8_t type; union { uint8_t proto; struct { uint32_t addr; uint32_t mask; } ipv4; struct { uint32_t addr[4]; uint8_t prefixlen; } ipv6; struct { uint32_t addr[4]; uint32_t mask[4]; } ipv6_mask; struct { uint16_t low; uint16_t high; } port; }; } component[OGS_MAX_NUM_OF_PACKET_FILTER_COMPONENT]; uint8_t num_of_component; } ogs_pf_content_t; void ogs_pf_content_from_ipfw_rule( uint8_t direction, ogs_pf_content_t *content, ogs_ipfw_rule_t *rule); #ifdef __cplusplus } #endif #endif /* OGS_IPFW_H */
#include "util.h" #include "ihm.h" int main ( int argc, char *argv[] ) { static const char* database_filename = "data.db"; char *mot, *nom_joueur; short choix, nombre_tours, numero_tour, score = 0; short numero_mot_courant = 0; LISTE_MOT *liste_mots; TABLEAU_SCORE *tableau_scores_1, *tableau_scores_2, *tableau_scores_3; db_creer_si_existepas(database_filename); tableau_scores_1 = db_get(database_filename, 3); tableau_scores_2 = db_get(database_filename, 5); tableau_scores_3 = db_get(database_filename, 10); rand_init(); // Initialiser CURSES et créer les constantes pour le placement // des divers éléments dans la fenêtre. curses_init(); init_fenetre(); curses_fenetre_constantes(0); signal(SIGWINCH, curses_fenetre_constantes); // Ici, un message d'avertissement peut apparaître. liste_mots = curses_manage_arguments(fenetre, argc, argv); do { choix = ecran_accueil(fenetre); if (choix == 1) { score = 0; if (liste_mots == NULL) { mot = ecran_demander_mot(fenetre); ecran_jeu(fenetre, mot); } else { nombre_tours = ecran_niveau(fenetre); for (numero_tour = 0 ; numero_tour < nombre_tours ; numero_tour++) { mot = liste_mots->mots[numero_mot_courant]; numero_mot_courant++; if (numero_mot_courant >= liste_mots->nombre) { // On n'a pas assez de mot: on mélange et on recommence melanger_mots(liste_mots); numero_mot_courant = 0; } score += ecran_jeu(fenetre, mot); } nom_joueur = ecran_resultat(fenetre, score); switch (nombre_tours) { case 3: { ajouter_score(tableau_scores_1, score, nom_joueur); break; } case 5: { ajouter_score(tableau_scores_2, score, nom_joueur); break; } case 10: { ajouter_score(tableau_scores_3, score, nom_joueur); break; } } } } else if (choix == 2) { ecran_scores(fenetre, tableau_scores_1, tableau_scores_2, tableau_scores_3); } } while (choix != 3); db_set(database_filename, 3, tableau_scores_1); db_set(database_filename, 5, tableau_scores_2); db_set(database_filename, 10, tableau_scores_3); curses_stop(); printf("\nBye.\n"); return 0; }
/* * AscEmu Framework based on ArcEmu MMORPG Server * Copyright (c) 2014-2022 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 ADT_FILE_H #define ADT_FILE_H #include "mpq_libmpq04.h" #include "wmo.h" #include "model.h" #define TILESIZE (533.33333f) #define CHUNKSIZE ((TILESIZE) / 16.0f) #define UNITSIZE (CHUNKSIZE / 8.0f) class Liquid; typedef struct { float x; float y; float z; }svec; struct vec { double x; double y; double z; }; struct triangle { vec v[3]; }; typedef struct { float v9[16*8+1][16*8+1]; float v8[16*8][16*8]; }Cell; typedef struct { double v9[9][9]; double v8[8][8]; uint16 area_id; //Liquid *lq; float waterlevel[9][9]; uint8 flag; }chunk; typedef struct { chunk ch[16][16]; }mcell; struct MapChunkHeader { uint32 flags; uint32 ix; uint32 iy; uint32 nLayers; uint32 nDoodadRefs; uint32 ofsHeight; uint32 ofsNormal; uint32 ofsLayer; uint32 ofsRefs; uint32 ofsAlpha; uint32 sizeAlpha; uint32 ofsShadow; uint32 sizeShadow; uint32 areaid; uint32 nMapObjRefs; uint32 holes; uint16 s1; uint16 s2; uint32 d1; uint32 d2; uint32 d3; uint32 predTex; uint32 nEffectDoodad; uint32 ofsSndEmitters; uint32 nSndEmitters; uint32 ofsLiquid; uint32 sizeLiquid; float zpos; float xpos; float ypos; uint32 textureId; uint32 props; uint32 effectId; }; class ADTFile { private: MPQFile ADT; std::string Adtfilename; public: ADTFile(char* filename); ~ADTFile(); int nWMO; int nMDX; std::string* WmoInstansName; std::string* ModelInstansName; bool init(uint32 map_num, uint32 tileX, uint32 tileY); }; const char* GetPlainName(const char* FileName); char* GetPlainName(char* FileName); char* GetExtension(char* FileName); void fixnamen(char *name, size_t len); void fixname2(char *name, size_t len); #endif //ADT_FILE_H
// SPDX-FileCopyrightText: 2019 Jean-Louis Fuchs <ganwell@fangorn.ch> // // SPDX-License-Identifier: AGPL-3.0-or-later // ============= // Common header // ============= // // .. code-block:: cpp // #ifndef ch_libchirp_common_h #define ch_libchirp_common_h // Project includes // ================ // // .. code-block:: cpp // #include "libchirp/const.h" #include "libchirp/error.h" // Library export // ============== // // .. code-block:: cpp // #ifdef CH_BUILD #if defined __GNUC__ || __clang__ #define CH_EXPORT __attribute__((visibility("default"))) #endif #else // CH_BUILD #define CH_EXPORT #endif // System includes // =============== // // .. code-block:: cpp // #include <stdint.h> #include <stdio.h> #include <uv.h> // Typedefs // ======== // // .. code-block:: cpp typedef char ch_buf; /* Used to show it is not a c-string but a buffer. */ // .. c:type:: ch_text_address_t // // Type to be used with :c:func:`ch_msg_get_address`. Used for the textual // representation of the IP-address. // // .. code-block:: cpp // typedef struct ch_text_address_s { char data[INET6_ADDRSTRLEN]; } ch_text_address_t; // .. c:type:: ch_identity_t // // Struct containing the chirp identity. // // .. c:member:: unsigned uint8_t[16] data // // The chirp identity is uint8_t array of length 16. // // .. code-block:: cpp // typedef struct ch_identity_s { uint8_t data[CH_ID_SIZE]; } ch_identity_t; // Forward declarations // ===================== // // .. code-block:: cpp struct ch_chirp_s; typedef struct ch_chirp_s ch_chirp_t; struct ch_config_s; typedef struct ch_config_s ch_config_t; struct ch_message_s; typedef struct ch_message_s ch_message_t; // Logging // ======= // .. c:macro:: CH_WRITE_LOG // // Logs the given message including arbitrary arguments to a custom callback // in debug-/development-mode. // // The logging macro CH_WRITE_LOG(chirp, message, ...) behaves like printf // and allows to log to a custom callback. Usually used to log into pythons // logging facility. // // The logging macro CH_WRITE_LOGC(chirp, message, clear, ...) behaves like // CH_WRITE_LOG except you can add part that isn't highlighted. // // :param chirp: Pointer to a chirp object. // :param message: The highlighted message to report. // :param clear: The clear message (not highlighted to report. // :param ...: Variadic arguments for xprintf // // .. code-block:: cpp // #define CH_WRITE_LOGC(chirp, message, clear, ...) \ ch_write_log(chirp, __FILE__, __LINE__, message, clear, 0, __VA_ARGS__); #define CH_WRITE_LOG(chirp, message, ...) \ CH_WRITE_LOGC(chirp, message, "", __VA_ARGS__) #define CH_NO_ARG 1 // .. c:function:: CH_EXPORT void ch_write_log( ch_chirp_t* chirp, char* file, int line, char* message, char* clear, int error, ...); // // Write log message, either to logging callback (if defined) or to stderr. // // :param char* file: file to log // :param int line: line to log // :param char* message: message to log // :param char* clear: clear message to log // :param int error: message is an error // :param ...: variable args passed to vsnprintf #endif // ch_libchirp_common_h
/* * Thread Pool Class * Copyright (C) 2011 - 2013 <http://arcpro.sexyi.am/> * Copyright (C) Burlex <burlex@gmail.com> * * 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 * 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 "../Common.h" #ifndef __THREADPOOL_H #define __THREADPOOL_H #ifdef WIN32 class SERVER_DECL ThreadController { public: HANDLE hThread; uint32 thread_id; void Setup(HANDLE h) { hThread = h; // whoops! GetThreadId is for windows 2003 and up only! :< - Burlex //thread_id = (uint32)GetThreadId(h); } void Suspend() { // We can't be suspended by someone else. That is a big-no-no and will lead to crashes. ASSERT(GetCurrentThreadId() == thread_id); SuspendThread(hThread); } void Resume() { // This SHOULD be called by someone else. ASSERT(GetCurrentThreadId() != thread_id); if(ResumeThread(hThread) == DWORD(-1)) { DWORD le = GetLastError(); printf("lasterror: %u\n", le); } } void Join() { WaitForSingleObject(hThread, INFINITE); } uint32 GetId() { return thread_id; } }; #else #ifndef HAVE_DARWIN #include <semaphore.h> int GenerateThreadId(); class ThreadController { sem_t sem; pthread_t handle; int thread_id; public: void Setup(pthread_t h) { handle = h; sem_init(&sem, PTHREAD_PROCESS_PRIVATE, 0); thread_id = GenerateThreadId(); } ~ThreadController() { sem_destroy(&sem); } void Suspend() { ASSERT(pthread_equal(pthread_self(), handle)); sem_wait(&sem); } void Resume() { ASSERT(!pthread_equal(pthread_self(), handle)); sem_post(&sem); } void Join() { // waits until the thread finishes then returns pthread_join(handle, NULL); } ARCPRO_INLINE uint32 GetId() { return (uint32)thread_id; } }; #else int GenerateThreadId(); class ThreadController { pthread_cond_t cond; pthread_mutex_t mutex; int thread_id; pthread_t handle; public: void Setup(pthread_t h) { handle = h; pthread_mutex_init(&mutex, NULL); pthread_cond_init(&cond, NULL); thread_id = GenerateThreadId(); } ~ThreadController() { pthread_mutex_destroy(&mutex); pthread_cond_destroy(&cond); } void Suspend() { pthread_cond_wait(&cond, &mutex); } void Resume() { pthread_cond_signal(&cond); } void Join() { pthread_join(handle, NULL); } ARCPRO_INLINE uint32 GetId() { return (uint32)thread_id; } }; #endif #endif struct SERVER_DECL Thread { ThreadBase* ExecutionTarget; ThreadController ControlInterface; Mutex SetupMutex; bool DeleteAfterExit; }; typedef std::set<Thread*> ThreadSet; class SERVER_DECL CThreadPool { int GetNumCpus(); uint32 _threadsRequestedSinceLastCheck; uint32 _threadsFreedSinceLastCheck; uint32 _threadsExitedSinceLastCheck; uint32 _threadsToExit; int32 _threadsEaten; Mutex _mutex; ThreadSet m_activeThreads; ThreadSet m_freeThreads; public: CThreadPool(); // call every 2 minutes or so. void IntegrityCheck(); // call at startup void Startup(); // shutdown all threads void Shutdown(); // return true - suspend ourselves, and wait for a future task. // return false - exit, we're shutting down or no longer needed. bool ThreadExit(Thread* t); // creates a thread, returns a handle to it. Thread* StartThread(ThreadBase* ExecutionTarget); // grabs/spawns a thread, and tells it to execute a task. void ExecuteTask(ThreadBase* ExecutionTarget); // prints some neat debug stats void ShowStats(); // kills x free threads void KillFreeThreads(uint32 count); // resets the gobble counter ARCPRO_INLINE void Gobble() { _threadsEaten = (int32)m_freeThreads.size(); } // gets active thread count ARCPRO_INLINE uint32 GetActiveThreadCount() { return (uint32)m_activeThreads.size(); } // gets free thread count ARCPRO_INLINE uint32 GetFreeThreadCount() { return (uint32)m_freeThreads.size(); } }; extern SERVER_DECL CThreadPool ThreadPool; #endif
/* * (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 * */ #pragma once #include "RtfChar.h" class RtfBookmarkStart : public IDocumentElement { public: int nFirstColumn; int nLastColumn; std::wstring m_sName; RtfBookmarkStart() { nFirstColumn = PROP_DEF; nLastColumn = PROP_DEF; } int GetType() { return TYPE_RTF_BOOKMARKSTART; } std::wstring RenderToRtf(RenderParameter oRenderParameter); std::wstring RenderToOOX(RenderParameter oRenderParameter); }; class RtfBookmarkEnd : public IDocumentElement { public: std::wstring m_sName; RtfBookmarkEnd() { } int GetType() { return TYPE_RTF_BOOKMARKEND; } std::wstring RenderToRtf(RenderParameter oRenderParameter); std::wstring RenderToOOX(RenderParameter oRenderParameter); }; class RtfAnnotElem : public IDocumentElement { public: std::wstring m_sValue; int m_nType; RtfAnnotElem(int type = 0) : m_nType (type) { } int GetType() { return TYPE_RTF_ANNOTVALUE; } std::wstring RenderToRtf(RenderParameter oRenderParameter); std::wstring RenderToOOX(RenderParameter oRenderParameter); }; typedef boost::shared_ptr<RtfAnnotElem> RtfAnnotElemPtr; class RtfAnnotation : public IDocumentElement { public: RtfAnnotElemPtr m_oRef; RtfAnnotElemPtr m_oDate; RtfAnnotElemPtr m_oParent; TextItemContainerPtr m_oContent; RtfCharProperty m_oCharProp; RtfAnnotation() { m_oContent = TextItemContainerPtr( new TextItemContainer() ); } int GetType() { return TYPE_RTF_ANNOTATION; } std::wstring RenderToRtf(RenderParameter oRenderParameter); std::wstring RenderToOOX(RenderParameter oRenderParameter); }; typedef boost::shared_ptr<RtfAnnotation> RtfAnnotationPtr; class RtfFootnote : public IDocumentElement { public: bool m_bEndNote; TextItemContainerPtr m_oContent; RtfCharProperty m_oCharProp; RtfFootnote() { m_bEndNote = false; m_oContent = TextItemContainerPtr( new TextItemContainer() ); } int GetType() { return TYPE_RTF_FOOTNOTE; } std::wstring RenderToRtf(RenderParameter oRenderParameter); std::wstring RenderToOOX(RenderParameter oRenderParameter); }; typedef boost::shared_ptr<RtfFootnote> RtfFootnotePtr; typedef boost::shared_ptr<RtfBookmarkEnd> RtfBookmarkEndPtr; typedef boost::shared_ptr<RtfBookmarkStart> RtfBookmarkStartPtr;
/* * File: ximamng.h * Purpose: Declaration of the MNG Image Class * Author: Davide Pizzolato - www.xdp.it * Created: 2001 */ /* ========================================================== * CxImageMNG (c) 07/Aug/2001 Davide Pizzolato - www.xdp.it * For conditions of distribution and use, see copyright notice in ximage.h * * Special thanks to Frank Haug <f.haug(at)jdm(dot)de> for suggestions and code. * * original mng.cpp code created by Nikolaus Brennig, November 14th, 2000. <virtualnik(at)nol(dot)at> * * LIBMNG Copyright (c) 2000,2001 Gerard Juyn (gerard@libmng.com) * ========================================================== */ #if !defined(__ximaMNG_h) #define __ximaMNG_h #include "ximage.h" #if CXIMAGE_SUPPORT_MNG //#define MNG_NO_CMS #define MNG_SUPPORT_DISPLAY #define MNG_SUPPORT_READ #define MNG_SUPPORT_WRITE #define MNG_ACCESS_CHUNKS #define MNG_STORE_CHUNKS extern "C" { #include "../mng/libmng.h" #include "../mng/libmng_data.h" #include "../mng/libmng_error.h" } //uint32_t _stdcall RunMNGThread(void *lpParam); typedef struct tagmngstuff { CxFile *file; uint8_t *image; uint8_t *alpha; HANDLE thread; mng_uint32 delay; mng_uint32 width; mng_uint32 height; mng_uint32 effwdt; mng_int16 bpp; mng_bool animation; mng_bool animation_enabled; float speed; int32_t nBkgndIndex; RGBQUAD nBkgndColor; } mngstuff; class CxImageMNG: public CxImage { public: CxImageMNG(); ~CxImageMNG(); bool Load(const TCHAR * imageFileName); bool Decode(CxFile * hFile); bool Decode(FILE *hFile) { CxIOFile file(hFile); return Decode(&file); } #if CXIMAGE_SUPPORT_ENCODE bool Encode(CxFile * hFile); bool Encode(FILE *hFile) { CxIOFile file(hFile); return Encode(&file); } bool Save(const TCHAR * imageFileName){ return CxImage::Save(imageFileName,CXIMAGE_FORMAT_MNG);} #endif // CXIMAGE_SUPPORT_ENCODE int32_t Resume(); void SetSpeed(float speed); mng_handle hmng; mngstuff mnginfo; protected: void WritePNG(mng_handle hMNG, int32_t Frame, int32_t FrameCount ); void SetCallbacks(mng_handle mng); }; #endif #endif
#pragma once namespace nui { namespace Data { NUI_API nui::Base::tstring utf82t(LPCSTR arg, size_t length); NUI_API nui::Base::tstring utf82t(LPCSTR arg); NUI_API std::string t2utf8(LPCTSTR arg, size_t length); NUI_API std::string t2utf8(LPCTSTR arg); } }
/* * bfin_sram.h - userspace interface to L1 memory allocator * * Copyright (c) 2007 Analog Devices Inc. * * Licensed under the GPL-2 or later. */ #ifndef __BFIN_SRAM_H__ #define __BFIN_SRAM_H__ #include <features.h> #include <sys/types.h> __BEGIN_DECLS #define L1_INST_SRAM 0x00000001 #define L1_DATA_A_SRAM 0x00000002 #define L1_DATA_B_SRAM 0x00000004 #define L1_DATA_SRAM 0x00000006 extern void *sram_alloc(size_t size, unsigned long flags) __attribute_malloc__ __attribute_warn_unused_result__; extern int sram_free(const void *addr); extern void *dma_memcpy(void *dest, const void *src, size_t len) __nonnull((1, 2)); __END_DECLS #endif
/* * Copyright (C) 2021 Grilo Project * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 of * the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA * */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <locale.h> #include <glib.h> #include <glib-object.h> #include <grilo.h> /* Simple iteration to see that max and mix set in GrlOperationOptions is being * respected. The values cannot be outside bounderies of what is registered for * that metadata-key, e.g: GRL_METADATA_KEY_ORIENTATION has min: 0, max: 359 so * negative numbers or >=360 are not allowed */ static void range_filters_max_min_int(void) { static struct { gint key_id; gint min_registered; gint max_registered; gint min_test; gint max_test; gboolean result_registered; } int_keys[] = { { GRL_METADATA_KEY_ORIENTATION, 0, 359, 90, 180, FALSE }, { GRL_METADATA_KEY_ORIENTATION, 0, 359, -1, 999, TRUE } }; gint i; for (i = 0; i < G_N_ELEMENTS (int_keys); i++) { GrlOperationOptions *options = grl_operation_options_new (NULL); gboolean ret; GValue *min = NULL; GValue *max = NULL; ret = grl_operation_options_set_key_range_filter (options, GRL_METADATA_KEY_ORIENTATION, int_keys[i].min_test, int_keys[i].max_test, NULL); g_assert_true(ret); grl_operation_options_get_key_range_filter (options, GRL_METADATA_KEY_ORIENTATION, &min, &max); if (int_keys[i].result_registered) { g_assert_cmpint(g_value_get_int (min), ==, int_keys[i].min_registered); g_assert_cmpint(g_value_get_int (max), ==, int_keys[i].max_registered); } else { g_assert_cmpint(g_value_get_int (min), ==, int_keys[i].min_test); g_assert_cmpint(g_value_get_int (max), ==, int_keys[i].max_test); } } } static void range_filters_max_min_null(void) { GrlOperationOptions *options = grl_operation_options_new (NULL); gboolean ret; GValue value = G_VALUE_INIT; GValue *max, *min; g_test_bug ("148"); /* Before */ grl_operation_options_get_key_range_filter (options, GRL_METADATA_KEY_ORIENTATION, &min, &max); /* TODO: this is actually a bug. Should get default min/max for this metadata-key 0/359. * Seems that grilo stores the range in GParamSpec but does not set it in the HashTable * GrlOperationsOptions look at. */ g_assert_null(min); g_assert_null(max); /* Test MIN */ g_value_init (&value, G_TYPE_INT); g_value_set_int (&value, 90); ret = grl_operation_options_set_key_range_filter_value (options, GRL_METADATA_KEY_ORIENTATION, &value, NULL); g_assert_true(ret); grl_operation_options_get_key_range_filter (options, GRL_METADATA_KEY_ORIENTATION, &min, &max); g_assert_cmpint(g_value_get_int (min), ==, 90); // TODO: Same bug, as max was not set we receive NULL instead g_assert_null(max); g_value_unset(min); /* Test MAX */ g_value_set_int (&value, 180); ret = grl_operation_options_set_key_range_filter_value (options, GRL_METADATA_KEY_ORIENTATION, NULL, &value); g_assert_true(ret); grl_operation_options_get_key_range_filter (options, GRL_METADATA_KEY_ORIENTATION, &min, &max); /* TODO: This is another bug. When we set max above, the min should not be changed. * g_assert_cmpint(g_value_get_int (min), ==, 90); */ g_assert_null(min); g_assert_cmpint(g_value_get_int (max), ==, 180); g_value_unset(max); } int main (int argc, char **argv) { setlocale (LC_ALL, ""); g_test_init (&argc, &argv, NULL); g_test_bug_base ("http://gitlab.gnome.org/GNOME/grilo/issues/%s"); grl_init (&argc, &argv); /* registry tests */ g_test_add_func ("/operation/range-filters/max-min/int", range_filters_max_min_int); g_test_add_func ("/operation/range-filters/max-min/null", range_filters_max_min_null); return g_test_run (); }
// // Copyright (C) 2007-2008 Sebastian Kuzminsky // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // #define HM2_SOCFPGA_VERSION "0.9" #define HM2_LLIO_NAME "hm2_soc_ol" #define HM2_SOC_MAX_BOARDS 2 typedef struct { hal_u32_t *irq_count; hal_u32_t *irq_missed; hal_u32_t *read_errors; hal_u32_t *write_errors; } hm2_soc_pins_t; typedef struct { int fpga_state; int uio_fd; int firmware_given; const char *name; const char *uio_dev; void __iomem *base; int len; unsigned long ctrl_base_addr; unsigned long data_base_addr; char *firmware; hm2_lowlevel_io_t llio; hm2_soc_pins_t *pins; } hm2_soc_t; struct compatible { char vendor[32]; char name[32]; }; struct dts_device_id { unsigned short address_width; //address width / unsigned short clocks; // clocks / struct compatible compatible; unsigned short data_width; /* (class,subclass,prog-if) triplet */ char name[32]; unsigned long reg[3]; };
/* StarPU --- Runtime system for heterogeneous multicore architectures. * * Copyright (C) 2012, 2013, 2015 CNRS * * StarPU 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. * * StarPU 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 in COPYING.LGPL for more details. */ #include <starpu.h> #include <mpi.h> #include "helper.h" /* * Codelet to create a neutral element */ void init_cpu_func(void *descr[], void *cl_arg) { long int *dot = (long int *)STARPU_VARIABLE_GET_PTR(descr[0]); *dot = 0; FPRINTF_MPI(stderr, "Init dot\n"); } /* * Codelet to perform the reduction of two elements */ void redux_cpu_func(void *descr[], void *cl_arg) { long int *dota = (long int *)STARPU_VARIABLE_GET_PTR(descr[0]); long int *dotb = (long int *)STARPU_VARIABLE_GET_PTR(descr[1]); *dota = *dota + *dotb; FPRINTF_MPI(stderr, "Calling redux %ld=%ld+%ld\n", *dota, *dota-*dotb, *dotb); } /* * Dot product codelet */ void dot_cpu_func(void *descr[], void *cl_arg) { long int *local_x = (long int *)STARPU_VECTOR_GET_PTR(descr[0]); unsigned n = STARPU_VECTOR_GET_NX(descr[0]); long int *dot = (long int *)STARPU_VARIABLE_GET_PTR(descr[1]); //FPRINTF_MPI(stderr, "Before dot=%ld (adding %d elements...)\n", *dot, n); unsigned i; for (i = 0; i < n; i++) { //FPRINTF_MPI(stderr, "Adding %ld\n", local_x[i]); *dot += local_x[i]; } //FPRINTF_MPI(stderr, "After dot=%ld\n", *dot); } /* * Display codelet */ void display_cpu_func(void *descr[], void *cl_arg) { long int *local_x = (long int *)STARPU_VECTOR_GET_PTR(descr[0]); FPRINTF_MPI(stderr, "Local=%ld\n", *local_x); }
/* * GPAC - Multimedia Framework C SDK * * Authors: Jean Le Feuvre * Copyright (c) Telecom ParisTech 2012 * All rights reserved * * This file is part of GPAC - sample DASH library usage * */ #ifndef __DEF_BENCH_H__ #define __DEF_BENCH_H__ #include <gpac/isomedia.h> #include <openHevcWrapper.h> #include <windows.h> #define SDL_MAIN_HANDLED #include <SDL.h> #include <gpac/maths.h> #define GL_GLEXT_PROTOTYPES #include <GL/GL.h> #include <gpac/isomedia.h> #define GL_CHECK_ERR {s32 res = glGetError(); if (res) GF_LOG(GF_LOG_ERROR, GF_LOG_MMIO, ("GL Error %d file %s line %d\n", res, __FILE__, __LINE__)); } /*macros for GL proto and fun declaration*/ #ifdef _WIN32_WCE #define GLAPICAST * #elif defined(WIN32) #include <windows.h> #define GLAPICAST APIENTRY * #else #define GLAPICAST * #endif #define GLDECL(ret, funname, args) \ typedef ret (GLAPICAST proc_ ## funname)args; \ extern proc_ ## funname funname; \ #define GLDECL_STATIC(funname) proc_ ## funname funname = NULL #if defined GPAC_USE_TINYGL //no extensions with TinyGL #elif defined (GPAC_USE_OGL_ES) //no extensions with OpenGL ES #elif defined(WIN32) || defined (GPAC_CONFIG_WIN32) #define LOAD_GL_FUNCS #define GET_GLFUN(funname) funname = (proc_ ## funname) wglGetProcAddress(#funname) #elif defined(CONFIG_DARWIN_GL) extern void (*glutGetProcAddress(const GLubyte *procname))( void ); #define GET_GLFUN(funname) funname = (proc_ ## funname) glutGetProcAddress(#funname) #else #define LOAD_GL_FUNCS extern void (*glXGetProcAddress(const GLubyte *procname))( void ); #define GET_GLFUN(funname) funname = (proc_ ## funname) glXGetProcAddress(#funname) #endif #define DEL_SHADER(_a) if (_a) { glDeleteShader(_a); _a = 0; } #define DEL_PROGRAM(_a) if (_a) { glDeleteProgram(_a); _a = 0; } GLDECL(GLuint, glCreateProgram, (void) ) GLDECL(void, glDeleteProgram, (GLuint ) ) GLDECL(void, glLinkProgram, (GLuint program) ) GLDECL(void, glUseProgram, (GLuint program) ) GLDECL(GLuint, glCreateShader, (GLenum shaderType) ) GLDECL(void, glDeleteShader, (GLuint shader) ) GLDECL(void, glShaderSource, (GLuint shader, GLsizei count, const char **string, const GLint *length) ) GLDECL(void, glCompileShader, (GLuint shader) ) GLDECL(void, glAttachShader, (GLuint program, GLuint shader) ) GLDECL(void, glDetachShader, (GLuint program, GLuint shader) ) GLDECL(void, glGetShaderiv, (GLuint shader, GLenum type, GLint *res) ) GLDECL(void, glGetInfoLogARB, (GLuint shader, GLint size, GLsizei *rsize, const char *logs) ) GLDECL(GLint, glGetUniformLocation, (GLuint prog, const char *name) ) GLDECL(void, glUniform1f, (GLint location, GLfloat v0) ) GLDECL(void, glUniform1i, (GLint location, GLint v0) ) GLDECL(void, glActiveTexture, (GLenum texture) ) GLDECL(void, glClientActiveTexture, (GLenum texture) ) GLDECL(void, glGenBuffers, (GLsizei , GLuint *) ) GLDECL(void, glDeleteBuffers, (GLsizei , GLuint *) ) GLDECL(void, glBindBuffer, (GLenum, GLuint ) ) GLDECL(void, glBufferData, (GLenum, int, void *, GLenum) ) GLDECL(void, glBufferSubData, (GLenum, int, int, void *) ) GLDECL(void *, glMapBuffer, (GLenum, GLenum) ) GLDECL(void *, glUnmapBuffer, (GLenum) ) #define GL_TEXTURE_RECTANGLE_EXT 0x84F5 #define GL_INFO_LOG_LENGTH 0x8B84 #define GL_FRAGMENT_SHADER 0x8B30 #define GL_VERTEX_SHADER 0x8B31 #define GL_PIXEL_UNPACK_BUFFER_ARB 0x88EC #define GL_STREAM_DRAW_ARB 0x88E0 #define GL_WRITE_ONLY_ARB 0x88B9 #define GL_DYNAMIC_DRAW_ARB 0x88E8 #define GL_TEXTURE0 0x84C0 #define GL_TEXTURE1 0x84C1 #define GL_TEXTURE2 0x84C2 #endif
#pragma once class SoapServer; class SoapServerInternal; class ClassBinding; class FieldBinding; #include <string> #include <functional> #include <memory> #include <typeinfo> #include <vector> using namespace std; #include "NativeSoapServer.h" #include "ProtobufSoapServer.h" enum FieldFlags { FF_Optional, FF_Repeated, FF_Enum, FF_Class, }; class SoapServer { public: SoapServer(int rpcPort, int mexPort); ~SoapServer(); void Start(); void Stop(); template <typename T> void BindProtobufInbound(const shared_ptr<T>& t) { BindProtobuf<T>(t, true); } template <typename T> shared_ptr<T> BindProtobufOutput() { BindProtobuf<T>(0, false); shared_ptr<T> stub(new T(GetRpcChannel())); m_protobufStubs.push_back(stub); return stub; } template <typename T> void BindProtobuf(const shared_ptr<T>& t, bool isInput) { const ::google::protobuf::ServiceDescriptor* descriptor = T::descriptor(); string service = descriptor->name(); AddService(service); for (int x = 0; x < descriptor->method_count(); ++x) { const ::google::protobuf::MethodDescriptor* method = descriptor->method(x); string methodname = method->name(); const ::google::protobuf::Descriptor* input = method->input_type(); const ::google::protobuf::Descriptor* output = method->output_type(); if (t) { ProtobufCallback callback = bind(&CallProtobuf<T>, t, method, placeholders::_1, placeholders::_2); AddMethod(service, methodname, GetClassBinding(input), GetClassBinding(output), callback, isInput); } else { AddMethod(service, methodname, GetClassBinding(input), GetClassBinding(output), ProtobufCallback(), isInput); } } } template <typename T> SoapNativeFunctionBinderInbound<T> BindNativeInbound(const string& serviceName, const shared_ptr<T>& t) { string name = serviceName; AddService(name); return SoapNativeFunctionBinderInbound<T>(this, t, name); } template <typename T> SoapNativeFunctionBinderOutbound<T> BindNativeOutbound(const string& serviceName, const shared_ptr<T>& t) { string name = serviceName; AddService(name); return SoapNativeFunctionBinderOutbound<T>(this, t, name); } void AddService(string& serviceName); void AddMethod(const string& serviceName, const string& name, const ClassBinding& request, const ClassBinding& response, NativeCallback callback, bool isInput, bool isOneWay = false); void AddMethod(const string& serviceName, const string& name, const ClassBinding& request, const ClassBinding& response, ProtobufCallback callback, bool isInput, bool isOneWay = false); bool HasClassBinding(const type_info& type); const ClassBinding& GetClassBinding(const type_info& type); const ClassBinding& GetClassBinding(const ::google::protobuf::Descriptor* descriptor); void RegisterClassBinding(const type_info& type, vector<const FieldBinding*>& fields, CreateObjectCallback callback); const FieldBinding& GetFieldBinding(const string& name, const string& type, size_t offset, size_t size, int flags); template <typename T> const ClassBinding& GetClassBinding() { if (!HasClassBinding(typeid(T))) { T t; SoapTypeVisitor visitor(this); visitor << t; RegisterClassBinding(typeid(T), visitor.GetFields(), bind(&ObjectWrapper::Create<T>)); } return GetClassBinding(typeid(T)); } static int GetFieldFlags(string& typeName) { int flags = FF_Optional; if (typeName.find("vector<") == 0 && typeName.back() == '>') { flags |= FF_Repeated; typeName = typeName.substr(7, typeName.size() - 8); } if (typeName.find("class") == 0) { flags |= FF_Class; typeName = typeName.substr(5); } return flags; } template <typename T> const FieldBinding& GetFieldBinding(const string& name, size_t offset) { //dont support pointers, use inline classes assert(!is_pointer<T>::value); string typeName = GetSoapTypeName<T>(); int flags = GetFieldFlags(typeName); if (flags & FF_Class) { GetClassBinding<T>(); } return GetFieldBinding(name, typeName, offset, sizeof(T), flags); } void CallMethod(const string& serviceName, const string& methodName, const google::protobuf::Message& request, ::google::protobuf::Message* response, ::google::protobuf::Closure* done); void CallMethod(const string& serviceName, const string& methodName, const void* request, function<void(const void*)> callback, const type_info& reqType, const type_info& respType); private: vector<shared_ptr<::google::protobuf::Service> > m_protobufStubs; SoapServerInternal *m_internal; };
/**************************************************************************** ** ** 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 examples 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 RENDERAREA_H #define RENDERAREA_H #include <QPainterPath> #include <QWidget> //! [0] class RenderArea : public QWidget { Q_OBJECT public: RenderArea(const QPainterPath &path, QWidget *parent = 0); QSize minimumSizeHint() const; QSize sizeHint() const; public slots: void setFillRule(Qt::FillRule rule); void setFillGradient(const QColor &color1, const QColor &color2); void setPenWidth(int width); void setPenColor(const QColor &color); void setRotationAngle(int degrees); protected: void paintEvent(QPaintEvent *event); //! [0] //! [1] private: QPainterPath path; QColor fillColor1; QColor fillColor2; int penWidth; QColor penColor; int rotationAngle; }; //! [1] #endif
/* * Copyright (C) 2012-2014 Red Hat, Inc. * * Licensed under the GNU Lesser General Public License Version 2.1 * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef HY_TYPES_H #define HY_TYPES_H #ifdef __cplusplus namespace libdnf { struct Goal; struct Nevra; struct Query; struct Selector; } typedef struct libdnf::Goal * HyGoal; typedef struct libdnf::Nevra * HyNevra; typedef struct libdnf::Query * HyQuery; typedef struct libdnf::Selector * HySelector; #else typedef struct Goal * HyGoal; typedef struct Nevra * HyNevra; typedef struct Query * HyQuery; typedef struct Selector * HySelector; #endif typedef struct _HyRepo * HyRepo; typedef char * HySubject; typedef const unsigned char HyChecksum; typedef int (*hy_solution_callback)(HyGoal goal, void *callback_data); #define HY_SYSTEM_REPO_NAME "@System" #define HY_CMDLINE_REPO_NAME "@commandline" #define HY_EXT_FILENAMES "-filenames" #define HY_EXT_UPDATEINFO "-updateinfo" #define HY_EXT_PRESTO "-presto" #define HY_EXT_OTHER "-other" enum _hy_key_name_e { HY_PKG = 0, HY_PKG_ALL = 1, /* DEPRECATED, used only to make empty query. Replaced by HY_PKG_EMPTY */ HY_PKG_ARCH = 2, HY_PKG_CONFLICTS = 3, HY_PKG_DESCRIPTION = 4, HY_PKG_EPOCH = 5, HY_PKG_EVR = 6, HY_PKG_FILE = 7, HY_PKG_NAME = 8, HY_PKG_NEVRA = 9, HY_PKG_OBSOLETES = 10, HY_PKG_PROVIDES = 11, HY_PKG_RELEASE = 12, HY_PKG_REPONAME = 13, HY_PKG_REQUIRES = 14, HY_PKG_SOURCERPM = 15, HY_PKG_SUMMARY = 16, HY_PKG_URL = 17, HY_PKG_VERSION = 18, HY_PKG_LOCATION = 19, HY_PKG_ENHANCES = 20, HY_PKG_RECOMMENDS = 21, HY_PKG_SUGGESTS = 22, HY_PKG_SUPPLEMENTS = 23, HY_PKG_ADVISORY = 24, HY_PKG_ADVISORY_BUG = 25, HY_PKG_ADVISORY_CVE = 26, HY_PKG_ADVISORY_SEVERITY = 27, HY_PKG_ADVISORY_TYPE = 28, HY_PKG_DOWNGRADABLE = 29, HY_PKG_DOWNGRADES = 30, HY_PKG_EMPTY = 31, HY_PKG_LATEST_PER_ARCH = 32, HY_PKG_LATEST = 33, HY_PKG_UPGRADABLE = 34, HY_PKG_UPGRADES = 35, /** * @brief Use for strings of whole NEVRA (missing epoch is handled as epoch 0) * Allowed compare types - only HY_EQ or HY_NEQ */ HY_PKG_NEVRA_STRICT = 36 }; enum _hy_comparison_type_e { /* part 1: flags that mix with all types */ HY_ICASE = 1 << 0, HY_NOT = 1 << 1, HY_COMPARISON_FLAG_MASK = HY_ICASE | HY_NOT, /* part 2: comparison types that mix with each other */ HY_EQ = (1 << 8), HY_LT = (1 << 9), HY_GT = (1 << 10), /* part 3: comparison types that only make sense for strings */ HY_SUBSTR = (1 << 11), HY_GLOB = (1 << 12), /* part 4: frequently used combinations */ HY_NEQ = HY_EQ | HY_NOT, /* part 5: additional flags, not necessarily used for queries */ HY_NAME_ONLY = (1 << 16), }; #endif /* HY_TYPES_H */
/****************************************************************************** * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN */ #pragma once #include "converters.h" namespace Quotient { /// Identification information for a user struct UserIdentifier { /// The type of identification. See `Identifier types`_ for supported /// values and additional property descriptions. QString type; /// Identification information for a user QVariantHash additionalProperties; }; template <> struct JsonObjectConverter<UserIdentifier> { static void dumpTo(QJsonObject& jo, const UserIdentifier& pod) { fillJson(jo, pod.additionalProperties); addParam<>(jo, QStringLiteral("type"), pod.type); } static void fillFrom(QJsonObject jo, UserIdentifier& pod) { fromJson(jo.take("type"_ls), pod.type); fromJson(jo, pod.additionalProperties); } }; } // namespace Quotient
/*************************************************************************** ** ** 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 UT_STATUSBARVIEW_H #define UT_STATUSBARVIEW_H #include <QtTest/QtTest> #include <QObject> class MApplication; class MButton; class MBasicSheetHeaderView; class MBasicSheetHeader; class Ut_MBasicSheetHeaderView : public QObject { Q_OBJECT public: Ut_MBasicSheetHeaderView(); private slots: void initTestCase(); void cleanupTestCase(); void init(); void cleanup(); void testClickingPositiveButtonTriggersPositiveAction(); void testClickingNegativeButtonTriggersNegativeAction(); void testDisablingPositiveActionDisablesPositiveButton(); void testDisablingNegativeActionDisablesNegativeButton(); void testPositiveButtonTextUsesActionText(); void testNegativeButtonTextUsesActionText(); private: // helpers void testClickingButtonTriggersAction(MButton *button, QAction *action); void testDisablingActionDisablesButton(QAction *action, MButton *button); MBasicSheetHeaderView *subject; MBasicSheetHeader *controller; MApplication *app; }; #endif
/**************************************************************************** ** ** Copyright (C) 2013 Jolla Ltd ** Contact: lorn.potter@jollamobile.com This file is part of Sensord. Sensord 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. Sensord 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 Sensord. If not, see <http://www.gnu.org/licenses/>. */ #ifndef ROTATIONFILTER_H #define ROTATIONFILTER_H #include <QObject> #include "orientationdata.h" #include "filter.h" class AvgAccFilter : public QObject, public Filter<TimedXyzData, AvgAccFilter, TimedXyzData> { Q_OBJECT public: static FilterBase* factoryMethod() { return new AvgAccFilter(); } void reset(); void setFactor(qreal); qreal factor(); private: AvgAccFilter(); void interpret(unsigned, const TimedXyzData*); typedef QList<TimedXyzData> XyzAvgAccBuffer; TimedXyzData avgAccdata; XyzAvgAccBuffer avgBuffer; unsigned int avgBufferSize; qreal filterFactor; qreal averageX; qreal averageY; qreal averageZ; QList<TimedXyzData> avgAccelBuffer; }; #endif // ROTATIONFILTER_H
/**************************************************************************** ** ** 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 test suite 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$ ** ****************************************************************************/ #include <QObject> class Object4 : public QObject { Q_OBJECT };
/** @file dsmetool.c Dsmetool can be used to send commands to DSME. <p> Copyright (C) 2004-2010 Nokia Corporation. @author Ismo Laitinen <ismo.laitinen@nokia.com> @author Semi Malinen <semi.malinen@nokia.com> This file is part of Dsme. Dsme 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. Dsme 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 Dsme. If not, see <http://www.gnu.org/licenses/>. */ #include <dsme/protocol.h> #include <dsme/messages.h> #include <dsme/state.h> #include "../modules/malf.h" #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <sys/time.h> #include <unistd.h> #include <errno.h> #include <getopt.h> #include <stdio.h> #include <string.h> #include <stdbool.h> void usage(const char *name); void send_shutdown_req(bool battlow); void send_powerup_req(void); void send_reboot_req(void); void send_alarm_state(bool alarm_set); void send_malf_req(void); static dsmesock_connection_t *conn; void usage(const char *name) { printf("USAGE: %s <options>\n", name); printf("THESE ARE JUST FOR DEBUGGING\n"); printf(" -U --powerup Request powerup from the ActDead from DSME\n"); printf(" -s --shutdown Request normal shutdown from DSME\n"); printf(" -B --battlow Request battery low shutdown from DSME\n"); printf(" -R --reboot Request reboot from DSME\n"); printf(" -a --alarm Change alarm state (0 = not set, 1 = set)\n"); printf(" -M --malf Request MALF state\n"); printf(" -h --help Print usage\n"); } void send_shutdown_req(bool battlow) { if (battlow) { DSM_MSGTYPE_SET_BATTERY_STATE msg = DSME_MSG_INIT(DSM_MSGTYPE_SET_BATTERY_STATE); msg.empty = true; dsmesock_send(conn, &msg); printf("battery empty sent!\n"); } else { DSM_MSGTYPE_SHUTDOWN_REQ msg = DSME_MSG_INIT(DSM_MSGTYPE_SHUTDOWN_REQ); dsmesock_send(conn, &msg); printf("shutdown request sent!\n"); } } void send_alarm_state(bool alarm_set) { DSM_MSGTYPE_SET_ALARM_STATE msg = DSME_MSG_INIT(DSM_MSGTYPE_SET_ALARM_STATE); msg.alarm_set = alarm_set; dsmesock_send(conn, &msg); printf("alarm state sent!\n"); } void send_powerup_req(void) { DSM_MSGTYPE_POWERUP_REQ msg = DSME_MSG_INIT(DSM_MSGTYPE_POWERUP_REQ); dsmesock_send(conn, &msg); printf("Powerup request sent!\n"); } void send_reboot_req(void) { DSM_MSGTYPE_REBOOT_REQ msg = DSME_MSG_INIT(DSM_MSGTYPE_REBOOT_REQ); dsmesock_send(conn, &msg); printf("Reboot request sent!\n"); } void send_malf_req(void) { char* details = strdup("Entering malf from dsmetest"); DSM_MSGTYPE_ENTER_MALF msg = DSME_MSG_INIT(DSM_MSGTYPE_ENTER_MALF); msg.reason = DSME_MALF_SOFTWARE; msg.component = NULL; dsmesock_send_with_extra(conn, &msg, sizeof(details), details); printf("MALF request sent!\n"); } int main(int argc, char *argv[]) { const char *program_name = argv[0]; int next_option; int retval = 0; int new_state = -1; int powerup = -1; int reboot = -1; int alarm_tmp = -1; int malf = -1; const char *short_options = "UBshRMa:"; const struct option long_options[] = { {"shutdown", 0, NULL, 's'}, {"battlow", 0, NULL, 'B'}, {"alarm", 1, NULL, 'a'}, {"help", 0, NULL, 'h'}, {"powerup", 0, NULL, 'U'}, {"reboot", 0, NULL, 'R'}, {"malf", 0, NULL, 'M'}, {0, 0, 0, 0} }; do { next_option = getopt_long(argc, argv, short_options, long_options, NULL); switch (next_option) { case 's': new_state = 0; break; case 'U': powerup = 1; break; case 'R': reboot = 1; break; case 'B': new_state = 1; break; case 'a': alarm_tmp = atoi(optarg); break; case 'M': malf = 1; break; case 'h': usage(program_name); return EXIT_SUCCESS; break; break; case '?': usage(program_name); return EXIT_FAILURE; break; } } while (next_option != -1); /* check if unknown parameters or no parameters at all were given */ if (argc == 1 || optind < argc) { usage(program_name); return EXIT_FAILURE; } conn = dsmesock_connect(); if (conn == 0) { perror("dsmesock_connect"); return EXIT_FAILURE; } if (powerup != -1) send_powerup_req(); if (reboot != -1) send_reboot_req(); if (new_state != -1) send_shutdown_req(new_state); if (alarm_tmp != -1) send_alarm_state(alarm_tmp != 0); if (malf != -1) send_malf_req(); dsmesock_close(conn); return retval; }
/************************************************************************** ** ** This file is part of Qt Creator ** ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** ** GNU Lesser General Public License Usage ** ** This file may be used under the terms of the GNU Lesser General Public ** License version 2.1 as published by the Free Software Foundation and ** appearing in the file LICENSE.LGPL included in the packaging of this file. ** Please review the following information to ensure the GNU Lesser General ** Public License version 2.1 requirements will be met: ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** Other Usage ** ** Alternatively, this file may be used in accordance with the terms and ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. ** **************************************************************************/ #ifndef DEBUGGER_SNAPSHOTWINDOW_H #define DEBUGGER_SNAPSHOTWINDOW_H #include "basewindow.h" namespace Debugger { namespace Internal { class SnapshotHandler; class SnapshotWindow : public BaseWindow { Q_OBJECT public: explicit SnapshotWindow(SnapshotHandler *handler); private: void rowActivated(const QModelIndex &index); void removeSnapshot(int i); void keyPressEvent(QKeyEvent *ev); void contextMenuEvent(QContextMenuEvent *ev); SnapshotHandler *m_snapshotHandler; }; } // namespace Internal } // namespace Debugger #endif // DEBUGGER_SNAPSHOTWINDOW_H
/* -*- C++ -*- * mapredo * Copyright (C) 2015 Kjell Irgens <hextremist@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. * */ #ifndef _HEXTREME_MAPREDO_DATA_READER_QUEUE_H #define _HEXTREME_MAPREDO_DATA_READER_QUEUE_H #include <queue> #include "data_reader.h" /** This is a priority queue used when traversing files during merge */ template <class T> class data_reader_queue { public: data_reader_queue (const bool reverse = false) : _reverse (reverse) {} bool empty() {return (_reverse ? _rqueue.empty() : _queue.empty());} size_t size() {return (_reverse ? _rqueue.size() : _queue.size());} void push (data_reader<T>* const reader) { if (_reverse) _rqueue.push (reader); else _queue.push(reader); } data_reader<T>* const top() { return (_reverse ? _rqueue.top() : _queue.top()); } void pop() {_reverse ? _rqueue.pop() : _queue.pop();} data_reader_queue (const data_reader_queue&) = delete; data_reader_queue& operator=(const data_reader_queue&) = delete; private: template <class U> struct comparison { template<class V = U, typename std::enable_if<std::is_fundamental<V>::value> ::type* = nullptr> bool operator()(data_reader<U>* dr1, data_reader<U>* dr2) { return *dr1->next_key() > *dr2->next_key(); } template<class V = U, typename std::enable_if<std::is_same<V,char*>::value, bool>::type* = nullptr> bool operator()(data_reader<U>* dr1, data_reader<U>* dr2) { return strcmp (*dr1->next_key(), *dr2->next_key()) > 0; } }; template <class U> struct reverse_comparison { template<class V = U, typename std::enable_if<std::is_fundamental<V>::value> ::type* = nullptr> bool operator()(data_reader<U>* dr1, data_reader<U>* dr2) { return *dr1->next_key() < *dr2->next_key(); } template<class V = U, typename std::enable_if<std::is_same<V,char*>::value, bool>::type* = nullptr> bool operator()(data_reader<U>* dr1, data_reader<U>* dr2) { return strcmp (*dr1->next_key(), *dr2->next_key()) < 0; } }; bool _reverse; std::priority_queue<data_reader<T>*, std::vector<data_reader<T>*>, comparison<T>> _queue; std::priority_queue<data_reader<T>*, std::vector<data_reader<T>*>, reverse_comparison<T>> _rqueue; }; #endif
/* * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef JSNotAnObject_h #define JSNotAnObject_h #include "JSObject.h" namespace JSC { // This unholy class is used to allow us to avoid multiple exception checks // in certain SquirrelFish bytecodes -- effectively it just silently consumes // any operations performed on the result of a failed toObject call. class JSNotAnObject : public JSNonFinalObject { private: JSNotAnObject(ExecState* exec) : JSNonFinalObject(exec->globalData(), exec->globalData().notAnObjectStructure.get()) { } public: typedef JSNonFinalObject Base; static JSNotAnObject* create(ExecState* exec) { JSNotAnObject* object = new (allocateCell<JSNotAnObject>(*exec->heap())) JSNotAnObject(exec); object->finishCreation(exec->globalData()); return object; } static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype) { return Structure::create(globalData, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), &s_info); } private: static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesGetPropertyNames | JSObject::StructureFlags; // JSValue methods virtual JSValue toPrimitive(ExecState*, PreferredPrimitiveType) const; virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue&); virtual bool toBoolean(ExecState*) const; virtual double toNumber(ExecState*) const; virtual UString toString(ExecState*) const; virtual JSObject* toObject(ExecState*, JSGlobalObject*) const; // JSObject methods virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&); virtual bool getOwnPropertySlot(ExecState*, unsigned propertyName, PropertySlot&); virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&); virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); virtual void put(ExecState*, unsigned propertyName, JSValue); virtual bool deleteProperty(ExecState*, const Identifier& propertyName); virtual bool deleteProperty(ExecState*, unsigned propertyName); virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&, EnumerationMode mode = ExcludeDontEnumProperties); }; } // namespace JSC #endif // JSNotAnObject_h
// @(#)root/smatrix:$Id$ // Authors: T. Glebe, L. Moneta 2005 #ifndef ROOT_Math_Dfinv #define ROOT_Math_Dfinv // ******************************************************************** // // source: // // type: source code // // created: 03. Apr 2001 // // author: Thorsten Glebe // HERA-B Collaboration // Max-Planck-Institut fuer Kernphysik // Saupfercheckweg 1 // 69117 Heidelberg // Germany // E-mail: T.Glebe@mpi-hd.mpg.de // // Description: Matrix inversion // Code was taken from CERNLIB::kernlib dfinv function, translated // from FORTRAN to C++ and optimized. // // changes: // 03 Apr 2001 (TG) creation // // ******************************************************************** namespace ROOT { namespace Math { /** Dfinv. Function to compute the inverse of a square matrix ($A^{-1}$) of dimension $idim$ and order $n$. The routine Dfactir must be called before Dfinv! @author T. Glebe */ template <class Matrix, unsigned int n, unsigned int idim> bool Dfinv(Matrix& rhs, unsigned int* ir) { #ifdef XXX if (idim < n || n <= 0 || n==1) { return false; } #endif typename Matrix::value_type* a = rhs.Array(); /* Local variables */ unsigned int nxch, i, j, k, m, ij; unsigned int im2, nm1, nmi; typename Matrix::value_type s31, s34, ti; /* Parameter adjustments */ a -= idim + 1; --ir; /* Function Body */ /* finv.inc */ a[idim + 2] = -a[(idim << 1) + 2] * (a[idim + 1] * a[idim + 2]); a[(idim << 1) + 1] = -a[(idim << 1) + 1]; if (n != 2) { for (i = 3; i <= n; ++i) { const unsigned int ii = i * idim; const unsigned int iii = i + ii; const unsigned int imi = ii - idim; const unsigned int iimi = i + imi; im2 = i - 2; for (j = 1; j <= im2; ++j) { const unsigned int ji = j * idim; const unsigned int jii = j + ii; s31 = 0.; for (k = j; k <= im2; ++k) { s31 += a[k + ji] * a[i + k * idim]; a[jii] += a[j + (k + 1) * idim] * a[k + 1 + ii]; } // for k a[i + ji] = -a[iii] * (a[i - 1 + ji] * a[iimi] + s31); a[jii] *= -1; } // for j a[iimi] = -a[iii] * (a[i - 1 + imi] * a[iimi]); a[i - 1 + ii] *= -1; } // for i } // if n!=2 nm1 = n - 1; for (i = 1; i <= nm1; ++i) { const unsigned int ii = i * idim; nmi = n - i; for (j = 1; j <= i; ++j) { const unsigned int ji = j * idim; const unsigned int iji = i + ji; for (k = 1; k <= nmi; ++k) { a[iji] += a[i + k + ji] * a[i + (i + k) * idim]; } // for k } // for j for (j = 1; j <= nmi; ++j) { const unsigned int ji = j * idim; s34 = 0.; for (k = j; k <= nmi; ++k) { s34 += a[i + k + ii + ji] * a[i + (i + k) * idim]; } // for k a[i + ii + ji] = s34; } // for j } // for i nxch = ir[n]; if (nxch == 0) { return true; } for (m = 1; m <= nxch; ++m) { k = nxch - m + 1; ij = ir[k]; i = ij / 4096; j = ij % 4096; const unsigned int ii = i * idim; const unsigned int ji = j * idim; for (k = 1; k <= n; ++k) { ti = a[k + ii]; a[k + ii] = a[k + ji]; a[k + ji] = ti; } // for k } // for m return true; } // Dfinv } // namespace Math } // namespace ROOT #endif /* ROOT_Math_Dfinv */
/* # $Id: memory_storage.h 1754 2006-05-05 12:43:18Z nlehuen $ # Copyright (C) 2004-2005 Nicolas Lehuen <nicolas@lehuen.com> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __MEMORY_STORAGE__H_INCLUDED__ #define __MEMORY_STORAGE__H_INCLUDED__ #include <vector> #include <map> #include <algorithm> template <typename charT,typename valueT> class memory_storage { public: typedef typename std::vector< tst_node<charT,valueT> > array_type; typedef typename array_type::iterator iterator_type; typedef typename array_type::reverse_iterator reverse_iterator_type; typedef typename array_type::size_type size_type; memory_storage(int initial_size) : array(), empty(UNDEFINED_INDEX) { array.reserve(initial_size); } ~memory_storage() { } inline tst_node<charT,valueT>* get(int index) { return &(array[index]); } inline void delete_node(int index) { get(index)->next = empty; empty = index; } void new_node(node_info<charT,valueT>* info); void pack(int& root); void erase() { array_type().swap(array); }; typename array_type::size_type size() { return array.size(); } protected: array_type array; int empty; }; template <typename charT,typename valueT> void memory_storage<charT,valueT>::new_node(node_info<charT,valueT>* info) { if(empty!=UNDEFINED_INDEX) { // si on a un noeud vide on l'utilise. info->index=empty; info->node=get(empty); info->node->reset(); // on passe au noeud vide suivant. empty = get(empty)->next; } else { // on construit un noeud supplémentaire dans le tableau. info->index = (int)array.size(); array.resize(array.size()+1); // array.push_back(tst_node<charT,valueT>()); // Plus ou moins rapide ? info->node=get(info->index); } } template <typename charT,typename valueT> void memory_storage<charT,valueT>::pack(int& root) { if(empty == UNDEFINED_INDEX) { return; } // Etape 1 : on construit un vector des numéros de noeuds vide std::vector<int> empty_nodes; while(empty!=UNDEFINED_INDEX) { empty_nodes.push_back(empty); empty = get(empty)->next; } // Etape 2 : on trie ce vecteur std::sort(empty_nodes.begin(),empty_nodes.end()); // Etape 3 : on remplit les noeuds vides avec des noeuds pleins pris en // fin du storage std::map<int,int> mapping; // sera utile en étape 4 int current_empty_node=0, last_empty_node = static_cast<int>(empty_nodes.size())-1; int last_node_index = static_cast<int>(array.size())-1 ; while(current_empty_node<=last_empty_node) { int last_empty_node_index = empty_nodes[last_empty_node]; if(last_empty_node_index<last_node_index) { // le dernier noeud est plein // on l'échange avec le premier noeud vide int current_empty_node_index = empty_nodes[current_empty_node]; mapping[last_node_index] = current_empty_node_index; array[current_empty_node_index] = array[last_node_index]; --last_node_index; ++current_empty_node; } else { // le dernier noeud est vide // on le supprime --last_node_index; --last_empty_node; } } // Etape 4 : on réécrit les indices std::map<int,int>::const_iterator item,end(mapping.end()); // La racine a peut-être bougé ? item = mapping.find(root); if(item!=end) { root = item->second; } last_empty_node = 0; while(last_empty_node <= last_node_index) { tst_node<charT,valueT>* node = get(last_empty_node); if(node->left!=UNDEFINED_INDEX) { item = mapping.find(node->left); if(item!=end) { node->left = item->second; } } if(node->right!=UNDEFINED_INDEX) { item = mapping.find(node->right); if(item!=end) { node->right = item->second; } } if(node->next!=UNDEFINED_INDEX) { item = mapping.find(node->next); if(item!=end) { node->next = item->second; } } ++last_empty_node; } // Etape 5 : on redimensionne le tableau array.resize(last_node_index+1); array_type(array).swap(array); } #endif
#include <stdlib.h> #include <stdio.h> #include <mpi.h> #define SIZE 10 #define DATATYPE MPI_DOUBLE #define ROOT 1 #define REPEAT 5 int main( int argc, char* argv[] ) { int i, j; int myrank, nprocs; char *sbuf, *rbuf; int *rcnt, *rdpl; int dsize; MPI_Init( &argc, &argv ); MPI_Comm_rank( MPI_COMM_WORLD, &myrank ); MPI_Comm_size( MPI_COMM_WORLD, &nprocs ); PMPI_Type_size(DATATYPE, &dsize); rbuf=0; rcnt=0; rdpl=0; if( myrank==ROOT ) { rbuf=(char*)malloc(SIZE*dsize * ((nprocs*(nprocs+1))/2+nprocs) ); rcnt=(int*) malloc(sizeof(int)*nprocs); rdpl=(int*) malloc(sizeof(int)*nprocs); for( i=0; i<nprocs; i++ ) { rcnt[i] = SIZE*(i+1); rdpl[i] = SIZE*(i*((i+1)/2)+i+1); } } sbuf=(char*)malloc(SIZE*dsize * (myrank+1) ); for( i=0; i<REPEAT; i++ ) { MPI_Gatherv( sbuf, SIZE*(myrank+1), DATATYPE, rbuf, rcnt, rdpl, DATATYPE, ROOT, MPI_COMM_WORLD ); } MPI_Finalize(); return 0; }
/* * Copyright (C) 2002 Red Hat, Inc. * * This 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 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 Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <config.h> #include <sys/types.h> #include <string.h> #include <glib-object.h> #include "debug.h" #include "caps.h" #include "matcher.h" #include "table.h" #include "trie.h" struct _vte_matcher { _vte_matcher_match_func match; /* shortcut to the most common op */ struct _vte_matcher_impl *impl; GValueArray *free_params; }; static GStaticMutex _vte_matcher_mutex = G_STATIC_MUTEX_INIT; static GCache *_vte_matcher_cache = NULL; static struct _vte_matcher_impl dummy_vte_matcher_trie = { &_vte_matcher_trie }; static struct _vte_matcher_impl dummy_vte_matcher_table = { &_vte_matcher_table }; /* Add a string to the matcher. */ static void _vte_matcher_add(const struct _vte_matcher *matcher, const char *pattern, gssize length, const char *result, GQuark quark) { matcher->impl->klass->add(matcher->impl, pattern, length, result, quark); } /* Loads all sequences into matcher */ static void _vte_matcher_init(struct _vte_matcher *matcher, const char *emulation) { const char *code, *value; gboolean found_cr = FALSE, found_lf = FALSE; int i; _vte_debug_print(VTE_DEBUG_LIFECYCLE, "_vte_matcher_init()\n"); /* Add emulator-specific sequences. */ if (strstr(emulation, "xterm") || strstr(emulation, "dtterm")) { /* Add all of the xterm-specific stuff. */ for (i = 0; _vte_xterm_capability_strings[i].value != NULL; i++) { code = _vte_xterm_capability_strings[i].code; value = _vte_xterm_capability_strings[i].value; _vte_matcher_add(matcher, code, strlen (code), value, 0); } } /* Always define cr and lf. */ if (!found_cr) { _vte_matcher_add(matcher, "\r", 1, "cr", 0); } if (!found_lf) { _vte_matcher_add(matcher, "\n", 1, "sf", 0); } _VTE_DEBUG_IF(VTE_DEBUG_TRIE) { g_printerr("Trie contents:\n"); _vte_matcher_print(matcher); g_printerr("\n"); } } /* Allocates new matcher structure. */ static gpointer _vte_matcher_create(gpointer key) { char *emulation = key; struct _vte_matcher *ret = NULL; _vte_debug_print(VTE_DEBUG_LIFECYCLE, "_vte_matcher_create()\n"); ret = g_slice_new(struct _vte_matcher); ret->impl = &dummy_vte_matcher_trie; ret->match = NULL; ret->free_params = NULL; if (strcmp(emulation, "xterm") == 0) { ret->impl = &dummy_vte_matcher_table; } else if (strcmp(emulation, "dtterm") == 0) { ret->impl = &dummy_vte_matcher_table; } return ret; } /* Noone uses this matcher, free it. */ static void _vte_matcher_destroy(gpointer value) { struct _vte_matcher *matcher = value; _vte_debug_print(VTE_DEBUG_LIFECYCLE, "_vte_matcher_destroy()\n"); if (matcher->free_params != NULL) { g_value_array_free (matcher->free_params); } if (matcher->match != NULL) /* do not call destroy on dummy values */ matcher->impl->klass->destroy(matcher->impl); g_slice_free(struct _vte_matcher, matcher); } /* Create and init matcher. */ struct _vte_matcher * _vte_matcher_new(const char *emulation) { struct _vte_matcher *ret = NULL; g_static_mutex_lock(&_vte_matcher_mutex); if (emulation == NULL) { emulation = ""; } if (_vte_matcher_cache == NULL) { _vte_matcher_cache = g_cache_new(_vte_matcher_create, _vte_matcher_destroy, (GCacheDupFunc) g_strdup, g_free, g_str_hash, g_direct_hash, g_str_equal); } ret = g_cache_insert(_vte_matcher_cache, (gpointer) emulation); if (ret->match == NULL) { ret->impl = ret->impl->klass->create(); ret->match = ret->impl->klass->match; _vte_matcher_init(ret, emulation); } g_static_mutex_unlock(&_vte_matcher_mutex); return ret; } /* Free a matcher. */ void _vte_matcher_free(struct _vte_matcher *matcher) { g_assert(_vte_matcher_cache != NULL); g_static_mutex_lock(&_vte_matcher_mutex); g_cache_remove(_vte_matcher_cache, matcher); g_static_mutex_unlock(&_vte_matcher_mutex); } /* Check if a string matches a sequence the matcher knows about. */ const char * _vte_matcher_match(struct _vte_matcher *matcher, const gunichar *pattern, gssize length, const char **res, const gunichar **consumed, GQuark *quark, GValueArray **array) { if (G_UNLIKELY (array != NULL && matcher->free_params != NULL)) { *array = matcher->free_params; matcher->free_params = NULL; } return matcher->match(matcher->impl, pattern, length, res, consumed, quark, array); } /* Dump out the contents of a matcher, mainly for debugging. */ void _vte_matcher_print(struct _vte_matcher *matcher) { matcher->impl->klass->print(matcher->impl); } /* Free a parameter array. Most of the GValue elements can clean up after * themselves, but we're using gpointers to hold unicode character strings, and * we need to free those ourselves. */ void _vte_matcher_free_params_array(struct _vte_matcher *matcher, GValueArray *params) { guint i; for (i = 0; i < params->n_values; i++) { GValue *value = &params->values[i]; if (G_UNLIKELY (g_type_is_a (value->g_type, G_TYPE_POINTER))) { g_free (g_value_get_pointer (value)); } } if (G_UNLIKELY (matcher == NULL || matcher->free_params != NULL)) { g_value_array_free (params); } else { matcher->free_params = params; params->n_values = 0; } }
/* * ISS Live Qt * Copyright (C) 2014, John Pritchard, Syntelos * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * (LGPL and GPL) 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 LGPL * and GPL for more details. * * You should have received a copy of the LGPL and GPL along with this * program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _ISSL_AIRLOCK000051_H #define _ISSL_AIRLOCK000051_H #include "ISSLSchematic.h" /*! * */ struct AIRLOCK000051 : public ISSLSchematic { AIRLOCK000051(); static const AIRLOCK000051 I; }; #endif
/* * File name : CoreMutex.h * * Copyright (c) 2008 Scientific Software * * Modification History: * Date Name Description * 2008-12-29 Egor Pushkin Initial version */ #ifndef COREMUTEX_H__MINCOM__INCLUDED_ #define COREMUTEX_H__MINCOM__INCLUDED_ namespace MinCOM { /** * Minimal portable mutex implementation. */ class CoreMutex { public: CoreMutex() #if defined(WIN32) : mutex_(::CreateMutex(NULL, FALSE, NULL)) #elif defined(POSIX) : mutex_() #endif { #if defined(WIN32) #elif defined(POSIX) pthread_mutexattr_t attr; pthread_mutexattr_init(&attr); pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); pthread_mutex_init(&mutex_, &attr); pthread_mutexattr_destroy(&attr); #endif } ~CoreMutex() { #if defined(WIN32) ::CloseHandle(mutex_); #elif defined(POSIX) pthread_mutex_destroy(&mutex_); #endif } bool Lock() { #if defined(WIN32) return SUCCEEDED(::WaitForSingleObject(mutex_, INFINITE)); #elif defined(POSIX) return pthread_mutex_lock(&mutex_); #endif } void Unlock() { #if defined(WIN32) ::ReleaseMutex(mutex_); #elif defined(POSIX) pthread_mutex_unlock(&mutex_); #endif } private: /** Copy-constructor not implemented and denied. */ CoreMutex( const CoreMutex & ); /** Copy-assignment operator not implemented and denied. */ CoreMutex & operator = ( const CoreMutex & ); private: #if defined(WIN32) HANDLE mutex_; #elif defined(POSIX) pthread_mutex_t mutex_; #endif }; class CoreMutexLock { public: CoreMutexLock(CoreMutex & mutex) : mutex_(mutex) { mutex_.Lock(); } ~CoreMutexLock() { mutex_.Unlock(); } private: /** Copy-constructor not implemented and denied. */ CoreMutexLock( const CoreMutexLock & ); /** Copy-assignment operator not implemented and denied. */ CoreMutexLock & operator = ( const CoreMutexLock & ); private: CoreMutex & mutex_; }; } #endif // !COREMUTEX_H__MINCOM__INCLUDED_
// Created file "Lib\src\Uuid\X64\wdmguids" 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(GUID_PARTITION_UNIT_INTERFACE_STANDARD, 0x52363f5b, 0xd891, 0x429b, 0x81, 0x95, 0xae, 0xc5, 0xfe, 0xf6, 0x85, 0x3c);
// // Created by Gregory Istratov on 11/13/16. // #ifndef LIBSTRATUM_TYPES_H #define LIBSTRATUM_TYPES_H enum { ST_OK, ST_ERR, ST_NOT_FOUND, ST_EMPTY, ST_EXISTS, ST_OUT_OF_RANGE, ST_SIZE_EXCEED, ST_UNKNOWN }; #endif //LIBSTRATUM_TYPES_H
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <pthread.h> #include <errno.h> #include "thread_barrier.h" const thread_barrier_t THREAD_BARRIER_INITIALIZER = { PTHREAD_COND_INITIALIZER, PTHREAD_MUTEX_INITIALIZER, 0, 0, 0, false, false, }; int thread_barrier_init(thread_barrier_t* b, int n) { if (b->initialized) return THREAD_BARRIER_EINIT_INITIALIZED; if (b->released != b->total) return THREAD_BARRIER_EINIT_BUSY; pthread_mutex_lock(&(b->m)); pthread_cond_init(&(b->c),NULL); b->remain = n; b->total = n; b->released = 0; b->initialized = true; pthread_mutex_unlock(&(b->m)); return 0; } int thread_barrier_destroy(thread_barrier_t* b) { if (! b->initialized) return THREAD_BARRIER_EDSTRY_UNINIT; if (b->released != b->total) return THREAD_BARRIER_EDSTRY_BUSY; if (! b->to_be_destroyed) return THREAD_BARRIER_EDSTRY_NOTYET; pthread_mutex_lock(&(b->m)); b->remain = 0; pthread_cond_destroy(&(b->c)); b->released = b->total; b->to_be_destroyed = false; b->initialized = false; pthread_mutex_unlock(&(b->m)); return 0; } int thread_barrier_wait(thread_barrier_t* b) { bool wait_until_reinit; do { pthread_mutex_lock(&(b->m)); wait_until_reinit = b->to_be_destroyed || (! b->initialized); pthread_mutex_unlock(&(b->m)); } while (wait_until_reinit); pthread_mutex_lock(&(b->m)); b->remain--; int retval = 0; if (b->remain == 0) { b->to_be_destroyed = true; pthread_cond_broadcast(&(b->c)); retval = PTHREAD_BARRIER_SERIAL_THREAD; } else { while(b->remain != 0) pthread_cond_wait(&(b->c),&(b->m)); } b->released++; pthread_mutex_unlock(&(b->m)); return retval; } int thread_barrier_wait_reinit(thread_barrier_t* b, int n) { int r = thread_barrier_wait(b); if (r == PTHREAD_BARRIER_SERIAL_THREAD) { int d; do { d = thread_barrier_destroy(b); } while(d == THREAD_BARRIER_EDSTRY_BUSY); int ie; do {ie = thread_barrier_init(b,n);} while(ie == THREAD_BARRIER_EINIT_BUSY); } else { bool to_be_destroyed,initialized; do { pthread_mutex_lock(&(b->m)); to_be_destroyed = b->to_be_destroyed; initialized = b->initialized; pthread_mutex_unlock(&(b->m)); } while (to_be_destroyed || (!initialized)); } return r; }
/** * Copyright(C) 2009-2012 * @author Jing HUANG * @file KosarajuSharirSCC.h * @brief * @date 1/2/2011 */ #pragma once #include "DirectedGraph.h" #include "DepthFirstOrder.h" namespace Etoile { /* * KosarajuSharirStrongly Connected Components **/ class KosarajuSharirSCC { protected: bool * _marked; int * _sccId; int _count; public: KosarajuSharirSCC(DirectedGraph * directedGraph) { _count = 0; _marked = new bool[directedGraph->numberOfVertices()]; for(int i = 0; i < directedGraph->numberOfVertices(); ++i) { _marked[i] = false; } _sccId = new int[directedGraph->numberOfVertices()]; for(int i = 0; i < directedGraph->numberOfVertices(); ++i) { _sccId[i] = -1; } // first do depth first order DepthFirstOrder dfo( &(directedGraph->reverse())); std::vector<int> reversePost = dfo.reversePost(); //depthfirstsearch for(int i = 0; i < reversePost.size(); ++i) { if(!_marked[i]) { dfs(directedGraph, i); ++_count; } } } ~KosarajuSharirSCC() { } virtual bool stronglyConnected(int v0, int v1) { return _sccId[v0] == _sccId[v1]; } /* * cc numbers **/ int count(){ return _count;} int connectedComponentIdOfVertex(int v) { return _sccId[v]; } private: /* * DepthFirstSearch */ void dfs(UndirectedGraph * undirectedGraph, int v) { _marked[v] = true; _sccId[v] = _count; Adjacents adj = undirectedGraph->adjacentsOfVertex(v); for(int i = 0; i < adj.size(); ++i) { int w = adj[i]; if(_marked[w] != true) { dfs(undirectedGraph, w); } } } }; }
#ifndef MESSAGE_H #define MESSAGE_H #include <QString> #include "enums.h" #include "abstractdata.h" namespace QAprs { class Message : public AbstractData { public: Message(); // Getters QString inline getRecipient() { return recipient; } QString inline getText() { return text; } int inline getId() { return id; } MessageType inline getType() { return type; } bool inline isMessage() { return (type == NORMAL); } // Setters bool setRecipient(QString recipient); bool setText(QString text); bool setId(int id = 1); void inline setType(MessageType type = NORMAL) { this->type = type; } protected: QString recipient; QString text; int id; MessageType type; }; } #endif // MESSAGE_H
/* * server/zone/objects/tangible/Container.h generated by engine3 IDL compiler 0.55 */ #ifndef CONTAINER_H_ #define CONTAINER_H_ #include "engine/orb/DistributedObjectBroker.h" class SceneObject; class Player; class TangibleObject; #include "TangibleObject.h" class Container : public TangibleObject { public: Container(unsigned long long oid); void generateAttributes(SceneObject* obj); protected: Container(DummyConstructorParameter* param); virtual ~Container(); friend class ContainerHelper; }; class ContainerImplementation; class ContainerAdapter : public TangibleObjectAdapter { public: ContainerAdapter(ContainerImplementation* impl); Packet* invokeMethod(sys::uint32 methid, DistributedMethod* method); void generateAttributes(SceneObject* obj); }; class ContainerHelper : public DistributedObjectClassHelper, public Singleton<ContainerHelper> { static ContainerHelper* staticInitializer; public: ContainerHelper(); void finalizeHelper(); DistributedObject* instantiateObject(); DistributedObjectAdapter* createAdapter(DistributedObjectStub* obj); friend class SingletonWrapper<ContainerHelper>; }; #include "TangibleObjectImplementation.h" class ContainerServant : public TangibleObjectImplementation { public: Container* _this; public: ContainerServant(unsigned long long oid); virtual ~ContainerServant(); void _setStub(DistributedObjectStub* stub); DistributedObjectStub* _getStub(); }; #endif /*CONTAINER_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_CREATELAUNCHTEMPLATEREQUEST_P_H #define QTAWS_CREATELAUNCHTEMPLATEREQUEST_P_H #include "ec2request_p.h" #include "createlaunchtemplaterequest.h" namespace QtAws { namespace EC2 { class CreateLaunchTemplateRequest; class CreateLaunchTemplateRequestPrivate : public Ec2RequestPrivate { public: CreateLaunchTemplateRequestPrivate(const Ec2Request::Action action, CreateLaunchTemplateRequest * const q); CreateLaunchTemplateRequestPrivate(const CreateLaunchTemplateRequestPrivate &other, CreateLaunchTemplateRequest * const q); private: Q_DECLARE_PUBLIC(CreateLaunchTemplateRequest) }; } // namespace EC2 } // namespace QtAws #endif
#pragma once #include "Opcode.h" namespace AISCRIPT { class If_Dif : public Opcode { public: // Ctor If_Dif() : Opcode(Enum::IF_DIF) {}; // Execute virtual bool execute(aithread &thread) const; }; }
/* 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_DESCRIBEINSTANCEHEALTHRESPONSE_H #define QTAWS_DESCRIBEINSTANCEHEALTHRESPONSE_H #include "elasticloadbalancingresponse.h" #include "describeinstancehealthrequest.h" namespace QtAws { namespace ElasticLoadBalancing { class DescribeInstanceHealthResponsePrivate; class QTAWSELASTICLOADBALANCING_EXPORT DescribeInstanceHealthResponse : public ElasticLoadBalancingResponse { Q_OBJECT public: DescribeInstanceHealthResponse(const DescribeInstanceHealthRequest &request, QNetworkReply * const reply, QObject * const parent = 0); virtual const DescribeInstanceHealthRequest * request() const Q_DECL_OVERRIDE; protected slots: virtual void parseSuccess(QIODevice &response) Q_DECL_OVERRIDE; private: Q_DECLARE_PRIVATE(DescribeInstanceHealthResponse) Q_DISABLE_COPY(DescribeInstanceHealthResponse) }; } // namespace ElasticLoadBalancing } // namespace QtAws #endif
#include <assert.h> #include <stdio.h> #include <stdlib.h> #include <MemoryModule.h> typedef void (*FooFunc)(const char *name); unsigned char *ReadAllBytes(const char *filePath, size_t *size) { assert(filePath != NULL); assert(size != NULL); FILE *fp; fopen_s(&fp, filePath, "rb"); if (fp == NULL) return NULL; if (fseek(fp, 0, SEEK_END) != 0) { fclose(fp); return NULL; } *size = (size_t)ftell(fp); if (*size == EOF) { fclose(fp); return NULL; } unsigned char *bytes = malloc(*size); if (bytes == NULL) { fclose(fp); return NULL; } if (fseek(fp, 0, SEEK_SET) != 0 || fread(bytes, 1, *size, fp) != *size) { free(bytes); fclose(fp); return NULL; } fclose(fp); return bytes; } int main(void) { size_t size; void *dll = ReadAllBytes("mylib.dll", &size); if (dll == NULL) { fprintf(stderr, "Failed to read DLL data into memory.\n"); return EXIT_FAILURE; } HMEMORYMODULE hMM = MemoryLoadLibrary(dll, size); if (hMM == NULL) { fprintf(stderr, "Failed to load DLL from memory.\n"); free(dll); return EXIT_FAILURE; } FooFunc foo = (FooFunc)MemoryGetProcAddress(hMM, "Foo"); if (foo == NULL) { fprintf(stderr, "Failed to get procedure address.\n"); MemoryFreeLibrary(hMM); free(dll); return EXIT_FAILURE; } foo("Sam"); MemoryFreeLibrary(hMM); free(dll); return 0; } // References: // https://github.com/fancycode/MemoryModule/blob/master/tests/LoadDll.cpp
/** * 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 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * **/ #pragma once /** * @file TrueLocalEstimatorOnPoints.h * @brief Computes the true quantity to each element of a range associated to a parametric shape. * @author David Coeurjolly (\c david.coeurjolly@liris.cnrs.fr ) * Laboratoire d'InfoRmatique en Image et Systèmes d'information - LIRIS (CNRS, UMR 5205), CNRS, France * * @date 2011/06/27 * * Header file for module TrueLocalEstimatorOnPoints.cpp * * This file is part of the DGtal library. * * @see testLengthEstimators.cpp, testTrueLocalEstimator.cpp */ #if defined(TrueLocalEstimatorOnPoints_RECURSES) #error Recursive header files inclusion detected in TrueLocalEstimatorOnPoints.h #else // defined(TrueLocalEstimatorOnPoints_RECURSES) /** Prevents recursive inclusion of headers. */ #define TrueLocalEstimatorOnPoints_RECURSES #if !defined TrueLocalEstimatorOnPoints_h /** Prevents repeated inclusion of headers. */ #define TrueLocalEstimatorOnPoints_h ////////////////////////////////////////////////////////////////////////////// // Inclusions #include <iostream> #include "DGtal/base/Common.h" ////////////////////////////////////////////////////////////////////////////// namespace DGtal { ///////////////////////////////////////////////////////////////////////////// // template class TrueLocalEstimatorOnPoints /** * Description of template class 'TrueLocalEstimatorOnPoints' <p> * \brief Aim: Computes the true quantity to each element of a range associated to * a parametric shape. * * @tparam TConstIteratorOnPoints type of iterator on points used as * query points. * @tparam TParametricShape type of the parametric shape. * @tparam TParametricShapeFunctor type of Functor used to evaluate * the quantity. */ template <typename TConstIteratorOnPoints, typename TParametricShape, typename TParametricShapeFunctor> class TrueLocalEstimatorOnPoints { // ----------------------- Types ------------------------------ public: typedef TConstIteratorOnPoints ConstIterator; typedef TParametricShape ParametricShape; typedef typename TParametricShape::RealPoint RealPoint; typedef TParametricShapeFunctor ParametricShapeFunctor; typedef typename ParametricShapeFunctor::Quantity Quantity; // ----------------------- Standard services ------------------------------ public: /** * Default constructor. */ TrueLocalEstimatorOnPoints(); /** * Destructor. */ ~TrueLocalEstimatorOnPoints(); // ----------------------- Interface -------------------------------------- public: /** * Initialisation. * @param h grid size (must be >0). * @param itb begin iterator * @param ite end iterator */ void init(const double h, const ConstIterator& itb, const ConstIterator& ite); /** * Attach a shape * @param aShapePtr parametric shape */ void attach(ParametricShape* aShapePtr); /** * Estimation at *it * @return the estimated quantity at *it */ Quantity eval(const ConstIterator& it) const; /** * Estimation at each element of [@e itb , @e ite ) * @param itb begin iterator * @param ite end iterator * @return the estimated quantity * from itb till ite (excluded) */ template <typename OutputIterator> OutputIterator eval(const ConstIterator& itb, const ConstIterator& ite, OutputIterator result) const; /** * Checks the validity/consistency of the object. * @return 'true' if the object is valid, 'false' otherwise. */ bool isValid() const; // ------------------------- Protected Datas ------------------------------ protected: // ------------------------- Private Datas -------------------------------- private: ///Grid size double myH; ///Copy of the begin iterator ConstIterator myBegin; ///Copy of the end iterator ConstIterator myEnd; ///Owning pointer on a parametric shape functor ParametricShapeFunctor* myFunctorPtr; // ------------------------- Hidden services ------------------------------ private: /** * Copy constructor. * @param other the object to clone. * Forbidden by default. */ TrueLocalEstimatorOnPoints ( const TrueLocalEstimatorOnPoints & other ); /** * Assignment. * @param other the object to copy. * @return a reference on 'this'. * Forbidden by default. */ TrueLocalEstimatorOnPoints & operator= ( const TrueLocalEstimatorOnPoints & other ); }; // end of class TrueLocalEstimatorOnPoints } // namespace DGtal /////////////////////////////////////////////////////////////////////////////// // Includes inline functions. #include "DGtal/geometry/curves/estimation/TrueLocalEstimatorOnPoints.ih" // // /////////////////////////////////////////////////////////////////////////////// #endif // !defined TrueLocalEstimatorOnPoints_h #undef TrueLocalEstimatorOnPoints_RECURSES #endif // else defined(TrueLocalEstimatorOnPoints_RECURSES)
/* 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_GETAWSDEFAULTSERVICEQUOTARESPONSE_H #define QTAWS_GETAWSDEFAULTSERVICEQUOTARESPONSE_H #include "servicequotasresponse.h" #include "getawsdefaultservicequotarequest.h" namespace QtAws { namespace ServiceQuotas { class GetAWSDefaultServiceQuotaResponsePrivate; class QTAWSSERVICEQUOTAS_EXPORT GetAWSDefaultServiceQuotaResponse : public ServiceQuotasResponse { Q_OBJECT public: GetAWSDefaultServiceQuotaResponse(const GetAWSDefaultServiceQuotaRequest &request, QNetworkReply * const reply, QObject * const parent = 0); virtual const GetAWSDefaultServiceQuotaRequest * request() const Q_DECL_OVERRIDE; protected slots: virtual void parseSuccess(QIODevice &response) Q_DECL_OVERRIDE; private: Q_DECLARE_PRIVATE(GetAWSDefaultServiceQuotaResponse) Q_DISABLE_COPY(GetAWSDefaultServiceQuotaResponse) }; } // namespace ServiceQuotas } // namespace QtAws #endif
#include <libgen.h> #include <string.h> #include <stdlib.h> char *dirname(char *path) { char *slash = path; if(strrchr (path, '/') == NULL) { slash = NULL; } if (slash == path) { ++slash; } else if (slash != NULL && slash[1] == '\0') { slash = memchr (path, slash - path, '/'); } if (slash != NULL) { char *buffer = malloc(1+slash-path); memcpy(buffer,path,slash-path); buffer[slash-path] = '\0'; return buffer; } char *dot = malloc(sizeof(char)*2); dot[0] = '.'; dot[1] = '\0'; return dot; }
/* GKApplication, copyright © 2007-2016 Gen Kiyooka, is distributed under the GNU Lesser General Public License (GNU LGPL). This file is part of the submodule https://github.com/genkiyooka/GKApplication in Nibitaph framework for Mac and iOS https://github.com/genkiyooka/Nibitaph GKApplication 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. */ #import "GKControlValueBindingProtocol.h" #if !TARGET_OS_IPHONE @interface NSPopUpButton(GKControlBindingValueKeyPathCoding)<GKControlBindingValueKeyPathProtocol> @end @interface NSButton(GKControlBindingValueKeyPathCoding)<GKControlBindingValueKeyPathProtocol> @end @interface NSSlider(GKControlBindingValueKeyPathCoding)<GKControlBindingValueKeyPathProtocol> @end @interface NSStepper(GKControlBindingValueKeyPathCoding)<GKControlBindingValueKeyPathProtocol> @end @interface NSSegmentedControl(GKControlBindingValueKeyPathCoding)<GKControlBindingValueKeyPathProtocol> @end @interface NSColorWell(GKControlBindingValueKeyPathCoding)<GKControlBindingValueKeyPathProtocol> @end #endif /* !TARGET_OS_IPHONE */
/** * @file * Test driver for stack library. * * @author Matthew Balint, mbalint@gmail.com * @date November 2014 * * @copyright * Copyright (c) 2014 by Matthew Balint. * * This file is part of https://github.com/mjbalint/stack * * https://github.com/mjbalint/stack 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. * * https://github.com/mjbalint/stack 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 https://github.com/mjbalint/stack. If not, * see <http://www.gnu.org/licenses/>. */ #include "../include/stack.h" #include <stdio.h> #include <stdlib.h> /** * Command line interface. * * @param argc * Number of arguments. Currently ignored. * @param argv * Argument list. Currently ignored. * @retval 0 * Successful completion. * @retval -1 * An error occurred. */ int main (__attribute__((unused)) int argc, __attribute__((unused)) char* argv[]) { stack_t *stack_p = NULL; /* Stack to manipulate */ stack_err_e err = STACK_E_OK; /* Operation return code */ int i = 0; /* Loop index counter */ int val = 0; /* Popped value */ size_t val_size = 0; /* Size of popped value */ size_t num_entries = 0; /* # of entries in stack */ /* * Allocate a new stack. */ stack_p = stack_alloc(); if (NULL == stack_p) { printf("Error: Can't init stack\n"); return (-1); } if (! stack_is_empty(stack_p)) { printf("Error: Newly created stack not empty.\n"); return (-1); } /* * Add some elements to stack. */ for (i = 0; i < 10; i++) { err = stack_push(stack_p, &i, sizeof(i)); if (stack_err_e_is_error(err)) { printf("Error: Push #%d: Can't push '%d' onto stack: %d(%s)\n", (i+1), i, err, stack_err_e_to_string(err)); return (-1); } num_entries = stack_get_num_entries(stack_p); if (num_entries != (size_t)(i+1)) { printf("Error: Push #%d: %lu entries after push but expected %d\n", (i+1), num_entries, (i+1)); return (-1); } printf("<<<<< After push #%d >>>>>\n", (i+1)); stack_print(stack_p); printf("\n"); } /* * Remove elements from stack and verify LIFO order. */ for (i = 0; i < 10; i++) { val_size = sizeof(val); err = stack_pop(stack_p, &val, &val_size); if (stack_err_e_is_error(err)) { printf("Error: Pop #%d: Can't pop from stack: %d(%s)\n", (i+1), err, stack_err_e_to_string(err)); return (-1); } if (val_size != sizeof(val)) { printf("Error: Pop #%d: Value of size %lu but expected %lu\n", (i+1), val_size, sizeof(val)); return (-1); } if (val != (9 - i)) { printf("Error: Pop #%d: Value '%d' but expected %d\n", (i+1), val, (9 - i)); return (-1); } num_entries = stack_get_num_entries(stack_p); if (num_entries != (size_t)(9 - i)) { printf("Error: Pop %d: %lu entries after pop but expected %d\n", (i+1), num_entries, (9 - i)); return (-1); } printf("<<<<< After pop #%d >>>>>\n", (i+1)); stack_print(stack_p); printf("\n"); } /* * Free stack */ stack_free_and_clear(&stack_p); if (NULL != stack_p) { printf("Error: Popped value '%d' but expected %d\n", val, i); return (-1); } return (0); }
#ifndef R_PKCS7_H #define R_PKCS7_H #ifdef __cplusplus extern "C" { #endif typedef struct r_pkcs7_certificaterevocationlists_t { ut32 length; RX509CertificateRevocationList **elements; } RPKCS7CertificateRevocationLists; typedef struct r_pkcs7_extendedcertificatesandcertificates_t { ut32 length; RX509Certificate **elements; } RPKCS7ExtendedCertificatesAndCertificates; typedef struct r_pkcs7_digestalgorithmidentifiers_t { ut32 length; RX509AlgorithmIdentifier **elements; } RPKCS7DigestAlgorithmIdentifiers; typedef struct r_pkcs7_contentinfo_t { RASN1String *contentType; //OID RASN1Binary *content; // optional. oid structure definition } RPKCS7ContentInfo; typedef struct r_pkcs7_issuerandserialnumber_t { RX509Name issuer; RASN1Binary *serialNumber; } RPKCS7IssuerAndSerialNumber; typedef struct r_pkcs7_attribute_t { RASN1String *oid; //OID RASN1Binary *data; // optional. oid structure definition } RPKCS7Attribute; typedef struct r_pkcs7_attributes_t { ut32 length; RPKCS7Attribute **elements; } RPKCS7Attributes; typedef struct r_pkcs7_signerinfo_t { ut32 version; RPKCS7IssuerAndSerialNumber issuerAndSerialNumber; RX509AlgorithmIdentifier digestAlgorithm; RPKCS7Attributes authenticatedAttributes; //Optional RX509AlgorithmIdentifier digestEncryptionAlgorithm; RASN1Binary *encryptedDigest; RPKCS7Attributes unauthenticatedAttributes; //Optional } RPKCS7SignerInfo; typedef struct r_pkcs7_signerinfos_t { ut32 length; RPKCS7SignerInfo **elements; } RPKCS7SignerInfos; typedef struct r_pkcs7_signeddata_t { ut32 version; RPKCS7DigestAlgorithmIdentifiers digestAlgorithms; RPKCS7ContentInfo contentInfo; RPKCS7ExtendedCertificatesAndCertificates certificates; //Optional RPKCS7CertificateRevocationLists crls; //Optional RPKCS7SignerInfos signerinfos; } RPKCS7SignedData; typedef struct r_pkcs7_container_t { RASN1String *contentType; RPKCS7SignedData signedData; } RCMS; R_API RCMS *r_pkcs7_parse_cms(const ut8 *buffer, ut32 length); R_API void r_pkcs7_free_cms(RCMS* container); R_API char *r_pkcs7_cms_to_string(RCMS* container); R_API RJSVar *r_pkcs7_cms_json(RCMS* container); #ifdef __cplusplus } #endif #endif /* R_PKCS7_H */
// 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(GUID_DISK_SUBGROUP, 0x0012ee47, 0x9041, 0x4b5d, 0x9b, 0x77, 0x53, 0x5f, 0xba, 0x8b, 0x14, 0x42);
#ifndef RENDER_DEBUG_H #define RENDER_DEBUG_H #include <stdint.h> #include <SDL2/SDL_platform.h> #include <SDL2/SDL_opengl.h> #define R_DRAW_WIRE 0x00000001 // Wireframe rendering #define R_DRAW_ROOMBOXES 0x00000002 // Show room bounds #define R_DRAW_BOXES 0x00000004 // Show boxes #define R_DRAW_PORTALS 0x00000008 // Show portals #define R_DRAW_FRUSTUMS 0x00000010 // Show frustums #define R_DRAW_NORMALS 0x00000020 // Show normals #define R_DRAW_AXIS 0x00000040 // Show axes #define R_SKIP_ROOM 0x00000080 // Hide rooms #define R_SKIP_STATIC 0x00000100 // Hide statics #define R_SKIP_ENTITIES 0x00000200 // Hide entities #define R_DRAW_NULLMESHES 0x00000400 // Draw nullmesh entities #define R_DRAW_DUMMY_STATICS 0x00000800 // Draw empty static meshes #define R_DRAW_COLL 0x00001000 // Draw Bullet physics world #define R_DRAW_SKYBOX 0x00002000 // Draw skybox #define R_DRAW_POINTS 0x00004000 // Points rendering #define R_DRAW_FLYBY 0x00008000 // FlyBy cameras spline rendering #define R_DRAW_CINEMATICS 0x00010000 // Cinematics path rendering #define R_DRAW_CAMERAS 0x00020000 // Cameras and sinks drawing #define R_DRAW_TRIGGERS 0x00040000 // Trigger sectors drawing #define R_DRAW_AI_BOXES 0x00080000 // AI boxes drawing #define R_DRAW_AI_OBJECTS 0x00100000 // AI objects drawing #define R_DRAW_AI_PATH 0x00200000 // AI character target path drawing struct portal_s; struct frustum_s; struct world_s; struct room_s; struct camera_s; struct entity_s; struct sprite_s; struct base_mesh_s; struct obb_s; class CRenderDebugDrawer { struct vertex_s { GLfloat pos[3]; uint8_t rgba[4]; }; public: // engine debug function CRenderDebugDrawer(); virtual ~CRenderDebugDrawer(); bool IsEmpty() { return m_lines == 0; } void Reset(); void Render(); void SetColor(uint8_t r, uint8_t g, uint8_t b, uint8_t a/* = 255*/) { m_rgba[0] = r; m_rgba[1] = g; m_rgba[2] = b; m_rgba[3] = a; } void DrawAxis(float r, float transform[16]); void DrawPortal(struct portal_s *p); void DrawFrustum(struct frustum_s *f); void DrawBBox(float bb_min[3], float bb_max[3], float *transform); void DrawOBB(struct obb_s *obb); void DrawMeshDebugLines(struct base_mesh_s *mesh, float transform[16], const float *overrideVertices, const float *overrideNormals); void DrawSkeletalModelDebugLines(struct ss_bone_frame_s *bframe, float transform[16]); void DrawEntityDebugLines(struct entity_s *entity); void DrawSectorDebugLines(struct room_sector_s *rs); void DrawRoomDebugLines(struct room_s *room, struct camera_s *cam); // physics debug interface void DrawLine(const float from[3], const float to[3], const float color_from[3], const float color_to[3]); void DrawContactPoint(const float pointOnB[3], const float normalOnB[3], float distance, int lifeTime, const float color[3]); void SetDrawFlags(uint32_t flags) {m_drawFlags = flags;}; uint32_t GetDrawFlags() const {return m_drawFlags;} private: uint32_t m_drawFlags; uint32_t m_max_lines; uint32_t m_lines; bool m_need_realloc; GLuint m_gl_vbo; uint8_t m_rgba[4]; struct vertex_s *m_buffer; }; #endif
/* * 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_rmd_hash_h_ #define _ccr_rmd_hash_h_ #if HAVE_CRYPTOPP==1 #include "hash.h" #if CRYPTOPP_DIR_PLUS # include <crypto++/ripemd.h> #else # include <cryptopp/ripemd.h> #endif //it's used just like SHA, so create it from SHA class rmd128hash : public shahash<CryptoPP::RIPEMD128> {}; class rmd128proc : public shaproc<CryptoPP::RIPEMD128> {}; #endif //HAVE_CRYPTOPP==1 #endif
/* ------------------------------------------------------------------------ * * XSquare 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 of the Licence, or * * (at your option) any later version. * * * * XSquare 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 copies of the GNU General Public License and * * the GNU Lesser General Public License along with this program. If * * not, see http://www.gnu.org/licenses/. * * ------------------------------------------------------------------------- */ #ifndef XS_KERN__ #define XS_KERN__ #ifdef __cplusplus extern "C" { #endif /* Get a hint about what os were using and make sure were using a compatable OS -1 - unsupported 0 - windows 1 - mac 2 - linux 3 - android 4 - other */ #ifdef __APPLE__ #ifndef __MACH__ #define __KERN_OS_APPLE #define __KERN_OS 1 #else #define __KERN_OS -1 // os 9 #define _KERN_OS_DEBUG = OS9 #endif #endif #ifdef __linux__ // TODO make sure were running a fairly recent kernel 2.6+ (or something?) #define __KERN_OS_LINUX #ifndef __ANDROID__ #define __KERN_OS 2 // linux #else #define __KERN_OS_ANDROID #define __KERN_OS 3 // android (linux) #endif #endif #ifdef _WIN32 // TODO check that were using windows 7 or greater #define __KERN_OS_WIN #define __KERN_OS 0 #endif #ifndef __KERN_OS /*# define __KERN_OS 4 TODO other */ #define __KERN_OS -1 #endif #if (__KERN_OS == -1) #error Unsupported OS or OS version. #endif #undef __KERN_OS /* bitness */ #if defined(__ppc64__) || defined(__PPC64__) || defined(__x86_64__) || defined(__ia64__) || defined(_M_X64) # define __KERN_64_BIT__ #else # error Requires a 64bit (or greater) system. #endif #ifdef __cplusplus } #endif #endif // XS_KERN__
#ifndef TAGDAO_H #define TAGDAO_H #include <QtSql/QSqlQuery> #include <QList> #include <QString> #include <QSharedPointer> #include "Common/MySQLHandler.h" #include "Common/protobufs/models/Tag.pb.h" using namespace SolasMatch::Common::Protobufs::Models; class TagDao { public: static QList<QSharedPointer<Tag> > getUserTags(QSharedPointer<MySQLHandler> db, int user_id); static QList<QSharedPointer<Tag> > getTaskTags(QSharedPointer<MySQLHandler> db, int task_id); }; #endif // TAGDAO_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_GETACCOUNTSETTINGSRESPONSE_H #define QTAWS_GETACCOUNTSETTINGSRESPONSE_H #include "chimeresponse.h" #include "getaccountsettingsrequest.h" namespace QtAws { namespace Chime { class GetAccountSettingsResponsePrivate; class QTAWSCHIME_EXPORT GetAccountSettingsResponse : public ChimeResponse { Q_OBJECT public: GetAccountSettingsResponse(const GetAccountSettingsRequest &request, QNetworkReply * const reply, QObject * const parent = 0); virtual const GetAccountSettingsRequest * request() const Q_DECL_OVERRIDE; protected slots: virtual void parseSuccess(QIODevice &response) Q_DECL_OVERRIDE; private: Q_DECLARE_PRIVATE(GetAccountSettingsResponse) Q_DISABLE_COPY(GetAccountSettingsResponse) }; } // namespace Chime } // namespace QtAws #endif
/* ---------------------------------------------------------------------------- */ /* Atmel Microcontroller Software Support */ /* SAM Software Package License */ /* ---------------------------------------------------------------------------- */ /* Copyright (c) 2013, Atmel Corporation */ /* */ /* All rights reserved. */ /* */ /* Redistribution and use in source and binary forms, with or without */ /* modification, are permitted provided that the following condition is met: */ /* */ /* - Redistributions of source code must retain the above copyright notice, */ /* this list of conditions and the disclaimer below. */ /* */ /* Atmel's name may not be used to endorse or promote products derived from */ /* this software without specific prior written permission. */ /* */ /* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */ /* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */ /* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, */ /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */ /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */ /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */ /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */ /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* ---------------------------------------------------------------------------- */ #ifndef _SAM3U_WDT_INSTANCE_ #define _SAM3U_WDT_INSTANCE_ /* ========== Register definition for WDT peripheral ========== */ #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) #define REG_WDT_CR (0x400E1250U) /**< \brief (WDT) Control Register */ #define REG_WDT_MR (0x400E1254U) /**< \brief (WDT) Mode Register */ #define REG_WDT_SR (0x400E1258U) /**< \brief (WDT) Status Register */ #else #define REG_WDT_CR (*(__O uint32_t*)0x400E1250U) /**< \brief (WDT) Control Register */ #define REG_WDT_MR (*(__IO uint32_t*)0x400E1254U) /**< \brief (WDT) Mode Register */ #define REG_WDT_SR (*(__I uint32_t*)0x400E1258U) /**< \brief (WDT) Status Register */ #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */ #endif /* _SAM3U_WDT_INSTANCE_ */
/*---------------------------------------------------------------------------------- * * MARKUS : a manager for video analysis modules * * author : Laurent Winkler <lwinkler888@gmail.com> * * * This file is part of Markus. * * Markus 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. * * Markus 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 Markus. If not, see <http://www.gnu.org/licenses/>. -------------------------------------------------------------------------------------*/ #ifndef ANNOTATION_FILE_WRITER_H #define ANNOTATION_FILE_WRITER_H #include <log4cxx/logger.h> #include <fstream> #include "define.h" namespace mk { /** * @brief Read an annotation file (in .srt format) */ class AnnotationFileWriter { public: AnnotationFileWriter(); virtual ~AnnotationFileWriter(); void Open(const std::string& x_file); void WriteAnnotation(TIME_STAMP x_start, TIME_STAMP x_end, std::stringstream& x_in); private: static log4cxx::LoggerPtr m_logger; protected: int m_subId; std::ofstream m_file; }; } // namespace mk #endif
/** @file log.c @brief create .log file @author Eugene Kolivoshko (ekolivoshko@gmail.com) @date August 9 2015 @version 1.0 @copyright GNU Public License. */ #include <stdlib.h> #include <stdio.h> #include <stdarg.h> #include <Windows.h> #define LOGFILE "mdRun.log" /**< all ReportMessage(); messages will be appended to this file */ int LogCreated = 0; enum ConsoleColor { Black = 0, Blue = 1, Green = 2, Cyan = 3, Red = 4, Magenta = 5, Brown = 6, LightGray = 7, DarkGray = 8, LightBlue = 9, LightGreen = 10, LightCyan = 11, LightRed = 12, LightMagenta = 13, Yellow = 14, White = 15, Default = 15 }; /** \brief print message to stdout and to log file */ void printLog (const char *format, va_list args) { FILE *file; if (LogCreated == 0) { file = fopen(LOGFILE, "w"); LogCreated = 1; } else file = fopen(LOGFILE, "a"); if (file == NULL) { if (LogCreated == 1) LogCreated = 0; return; } else { vfprintf(file, format, (va_list)args); fclose(file); } if (file) fclose(file); } /** \brief print error message to to log file */ void printErrorLog (const char *format, va_list args) { FILE *file; if (LogCreated == 0) { file = fopen(LOGFILE, "w"); LogCreated = 1; } else file = fopen(LOGFILE, "a"); if (file == NULL) { if (LogCreated == 1) LogCreated = 0; return; } else { vfprintf(file, format, (va_list)args); fclose(file); } if (file) fclose(file); } /** \brief Report from Error message to stderr and to log file */ void ReportErrorMesage (const char *format, ...) { HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleTextAttribute(hConsole, (WORD) (LightRed)); va_list args; va_start( args, format ); vfprintf(stderr, format, (va_list)args); printErrorLog(format, args); va_end(args); SetConsoleTextAttribute(hConsole, (WORD) (Default)); exit(EXIT_FAILURE); } /** \brief Report from Warning message to stderr and to log file */ void ReportWarningMessage (const char *format, ...){ HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleTextAttribute(hConsole, (WORD) (Yellow)); va_list args; va_start( args, format ); vfprintf(stderr, format, (va_list)args); printErrorLog(format, args); va_end(args); SetConsoleTextAttribute(hConsole, (WORD) (Default)); } /** \brief Report from message to stderr and to log file */ void ReportMessage (const char *format, ...){ HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleTextAttribute(hConsole, (WORD) (Default)); va_list args; va_start( args, format ); vprintf(format, (va_list)args); printLog(format, args); va_end(args); SetConsoleTextAttribute(hConsole, (WORD) (Default)); }
/*======================================================================*\ * Safe Recursive mutex implementation. * Diego Nehab, 12/3/2001 * RCS Id: $Id: srm.c,v 1.2 2001/12/14 21:55:13 diego Exp $ \*======================================================================*/ #include <stdlib.h> #include "pt.h" #include "srm.h" int srm_init(srm_t *srm) { srm->locks = 0; srm->mutex = (pthread_mutex_t *) malloc(pthread_mutex_sizeof()); srm->barrier = (pthread_mutex_t *) malloc(pthread_mutex_sizeof()); if (!srm->mutex || !srm->barrier) goto failure; if (pthread_mutex_init(srm->mutex, NULL) == 0) { if (pthread_mutex_init(srm->barrier, NULL) == 0) return 0; else pthread_mutex_destroy(srm->mutex); } failure: /* sorry about the goto */ free(srm->mutex); free(srm->barrier); srm->barrier = NULL; srm->mutex = NULL; return -1; } int srm_destroy(srm_t *srm) { pthread_mutex_destroy(srm->mutex); pthread_mutex_destroy(srm->barrier); free(srm->mutex); free(srm->barrier); srm->mutex = NULL; srm->barrier = NULL; return 0; } int srm_lock(srm_t *srm) { pthread_t self = pthread_self(); pthread_mutex_lock(srm->barrier); if (srm->locks <= 0 || !pthread_equal(self, srm->owner)) { pthread_mutex_unlock(srm->barrier); pthread_mutex_lock(srm->mutex); pthread_mutex_lock(srm->barrier); srm->owner = self; srm->locks = 1; } else srm->locks++; pthread_mutex_unlock(srm->barrier); return 0; } int srm_unlock(srm_t *srm) { pthread_t self = pthread_self(); pthread_mutex_lock(srm->barrier); if (srm->locks > 0 && pthread_equal(self, srm->owner)) { srm->locks--; if (srm->locks <= 0) pthread_mutex_unlock(srm->mutex); pthread_mutex_unlock(srm->barrier); return 0; } else { pthread_mutex_unlock(srm->barrier); return -1; } } int srm_cond_wait(pthread_cond_t *cond, srm_t *srm) { pthread_t owner; int locks; int ret; pthread_mutex_lock(srm->barrier); locks = srm->locks; owner = srm->owner; srm->locks = 0; pthread_mutex_unlock(srm->barrier); ret = pthread_cond_wait(cond, srm->mutex); pthread_mutex_lock(srm->barrier); srm->owner = owner; srm->locks = locks; pthread_mutex_unlock(srm->barrier); return ret; }
/* 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_UPDATEREQUESTVALIDATORREQUEST_H #define QTAWS_UPDATEREQUESTVALIDATORREQUEST_H #include "apigatewayrequest.h" namespace QtAws { namespace APIGateway { class UpdateRequestValidatorRequestPrivate; class QTAWSAPIGATEWAY_EXPORT UpdateRequestValidatorRequest : public APIGatewayRequest { public: UpdateRequestValidatorRequest(const UpdateRequestValidatorRequest &other); UpdateRequestValidatorRequest(); virtual bool isValid() const Q_DECL_OVERRIDE; protected: virtual QtAws::Core::AwsAbstractResponse * response(QNetworkReply * const reply) const Q_DECL_OVERRIDE; private: Q_DECLARE_PRIVATE(UpdateRequestValidatorRequest) }; } // namespace APIGateway } // namespace QtAws #endif
/*+@@file@@----------------------------------------------------------------*//*! \file listeneradapter.h \par Description Extension and update of headers for PellesC compiler suite. \par Project: PellesC Headers extension \date Created on Sun Jul 17 22:03:03 2016 \date Modified on Sun Jul 17 22:03:03 2016 \author frankie \*//*-@@file@@----------------------------------------------------------------*/ #ifndef _LISTENER_ADAPTER_H_ #define _LISTENER_ADAPTER_H_ #if __POCC__ >= 500 #pragma once #endif typedef VOID(*PFN_WEBHOST_LISTENER_CONFIG_MANAGER_CONNECTED) (VOID *pContext); typedef VOID(*PFN_WEBHOST_LISTENER_CONFIG_MANAGER_DISCONNECT) (VOID *pContext, HRESULT hr); typedef VOID(*PFN_WEBHOST_LISTENER_CONFIG_MANAGER_INITIALIZATION_COMPLETED) (VOID *pContext); typedef VOID(*PFN_WEBHOST_LISTENER_APPLICATION_POOL_CREATED) (VOID *pContext, LPCWSTR AppPoolId, PSID PSID); typedef VOID(*PFN_WEBHOST_LISTENER_APPLICATION_POOL_DELETED) (VOID *pContext, LPCWSTR AppPoolId); typedef VOID(*PFN_WEBHOST_LISTENER_APPLICATION_POOL_IDENTITY_CHANGED) (VOID *pContext, LPCWSTR AppPoolId, PSID PSID); typedef VOID(*PFN_WEBHOST_LISTENER_APPLICATION_POOL_STATE_CHANGED) (VOID *pContext, LPCWSTR AppPoolId, BOOL fIsEnabled); typedef VOID(*PFN_WEBHOST_LISTENER_APPLICATION_POOL_CAN_OPEN_NEW_LISTENER_CHANNEL_INSTANCE) (VOID *pContext, LPCWSTR AppPoolId, DWORD ListenerChannelId); typedef VOID(*PFN_WEBHOST_LISTENER_APPLICATION_POOL_ALL_LISTENER_CHANNEL_INSTANCES_STOPPED) (VOID *pContext, LPCWSTR AppPoolId, DWORD ListenerChannelId); typedef VOID(*PFN_WEBHOST_LISTENER_APPLICATION_CREATED) (VOID *pContext, LPCWSTR AppKey, LPCWSTR Path, DWORD SiteId, LPCWSTR AppPoolId, PBYTE Bindings, DWORD NumberOfBindings, BOOL RequestsBlocked); typedef VOID(*PFN_WEBHOST_LISTENER_APPLICATION_DELETED) (VOID *pContext, LPCWSTR AppKey); typedef VOID(*PFN_WEBHOST_LISTENER_APPLICATION_BINDINGS_CHANGED) (VOID *pContext, LPCWSTR AppKey, PBYTE Bindings, DWORD NumberOfBindings); typedef VOID(*PFN_WEBHOST_LISTENER_APPLICATION_APP_POOL_CHANGED) (VOID *pContext, LPCWSTR AppKey, LPCWSTR AppPoolId); typedef VOID(*PFN_WEBHOST_LISTENER_APPLICATION_REQUESTS_BLOCKED_CHANGED) (VOID *pContext, LPCWSTR AppKey, BOOL RequestsBlocked); struct WEBHOST_LISTENER_CALLBACKS { DWORD dwBytesInCallbackStructure; PFN_WEBHOST_LISTENER_CONFIG_MANAGER_CONNECTED pfnWebhostListenerConfigManagerConnected; PFN_WEBHOST_LISTENER_CONFIG_MANAGER_DISCONNECT pfnWebhostListenerConfigManagerDisconnected; PFN_WEBHOST_LISTENER_CONFIG_MANAGER_INITIALIZATION_COMPLETED pfnWebhostListenerConfigManagerInitializationCompleted; PFN_WEBHOST_LISTENER_APPLICATION_POOL_CREATED pfnWebhostListenerApplicationPoolCreated; PFN_WEBHOST_LISTENER_APPLICATION_POOL_DELETED pfnWebhostListenerApplicationPoolDeleted; PFN_WEBHOST_LISTENER_APPLICATION_POOL_IDENTITY_CHANGED pfnWebhostListenerApplicationPoolIdentityChanged; PFN_WEBHOST_LISTENER_APPLICATION_POOL_STATE_CHANGED pfnWebhostListenerApplicationPoolStateChanged; PFN_WEBHOST_LISTENER_APPLICATION_POOL_CAN_OPEN_NEW_LISTENER_CHANNEL_INSTANCE pfnWebhostListenerApplicationPoolCanOpenNewListenerChannelInstance; PFN_WEBHOST_LISTENER_APPLICATION_POOL_ALL_LISTENER_CHANNEL_INSTANCES_STOPPED pfnWebhostListenerApplicationPoolAllListenerChannelInstancesStopped; PFN_WEBHOST_LISTENER_APPLICATION_CREATED pfnWebhostListenerApplicationCreated; PFN_WEBHOST_LISTENER_APPLICATION_DELETED pfnWebhostListenerApplicationDeleted; PFN_WEBHOST_LISTENER_APPLICATION_BINDINGS_CHANGED pfnWebhostListenerApplicationBindingsChanged; PFN_WEBHOST_LISTENER_APPLICATION_APP_POOL_CHANGED pfnWebhostListenerApplicationAppPoolChanged; PFN_WEBHOST_LISTENER_APPLICATION_REQUESTS_BLOCKED_CHANGED pfnWebhostListenerApplicationRequestsBlockedChanged; }; HRESULT WebhostGetVersion(DWORD *pMajorVersion, DWORD *pMinorVersion); HRESULT WebhostRegisterProtocol(LPCWSTR ProtocolId, VOID *pListenerCallbacks, VOID *pContext, DWORD *pProtocolHandle); HRESULT WebhostUnregisterProtocol(DWORD ProtocolHandle); HRESULT WebhostOpenListenerChannelInstance(DWORD ProtocolHandle, LPCWSTR AppPoolId, DWORD ListenerChannelId, PBYTE ListenerChannelBlob, DWORD ListenerChannelBlobByteCount); HRESULT WebhostCloseAllListenerChannelInstances(DWORD ProtocolHandle, LPCWSTR AppPoolId, DWORD ListenerChannelId); #endif
/* * * This file is part of Tulip (http://tulip.labri.fr) * * Authors: David Auber and the Tulip development Team * from LaBRI, University of Bordeaux * * Tulip 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. * * Tulip is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. * */ #ifndef TULIP_PROPERTY_H #define TULIP_PROPERTY_H #include <tulip/Algorithm.h> #include <tulip/Graph.h> #include <sstream> namespace tlp { class PluginContext; static const std::string PROPERTY_ALGORITHM_CATEGORY = "Property"; /** * @ingroup Plugins * @brief A non-template interface for tlp::TemplateAlgorithm * @see tlp::TemplateAlgorithm **/ class TLP_SCOPE PropertyAlgorithm : public tlp::Algorithm { public: PropertyAlgorithm(const tlp::PluginContext *context) : Algorithm(context) {} std::string category() const override { return PROPERTY_ALGORITHM_CATEGORY; } }; /** * @ingroup Plugins * @brief The TemplateAlgorithm class describes a plugin that can operate on a single graph's * property. * @param Property The property template arguments gives the type of the property the algorithm * operates on. * * A TemplateAlgorithm takes a graph as input (plus additional parameters defined via * tlp::WithParameter) and outputs its results in a tlp::PropertyInterface subclass. * The output property is defined as an output parameter named "result" and as a class member called * result. * * @warning Subclassing TemplateAlgorithm is not recommended since template specifications are * available for every Tulip property types. * * @see tlp::BooleanAlgorithm * @see tlp::StringAlgorithm * @see tlp::DoubleAlgorithm * @see tlp::IntegerAlgorithm * @see tlp::LayoutAlgorithm * @see tlp::SizeAlgorithm */ template <class Property> class TLP_SCOPE TemplateAlgorithm : public PropertyAlgorithm { public: Property *result; TemplateAlgorithm(const tlp::PluginContext *context) : tlp::PropertyAlgorithm(context), result(nullptr) { if (dataSet != nullptr) { if (!dataSet->exists("result")) { std::stringstream propname; propname << "result"; unsigned number = 0; while (graph->existProperty(propname.str())) { propname.clear(); propname << "result" << number; ++number; } result = graph->getProperty<Property>(propname.str()); } else { dataSet->get("result", result); } } } }; } // namespace tlp #endif
/*************************************************************** RayCaster - A Simple C++ Ray Caster Game Copyright 2013 Core S2 - See License.txt for details This source file is developed and maintained by: + Jeremy Bridon jbridon@cores2.com File: Utilities.cpp/h Desc: Dozen helpful structures or functions for general use. Read the inline function definition for details on the purpose and usage of each func. ***************************************************************/ #ifndef __UTILITIES_H__ #define __UTILITIES_H__ // Window includes #ifdef _WIN32 #pragma warning(disable:4996) #include <windows.h> // Need to define infinity #ifndef INFINITY #define INFINITY (std::numeric_limits<float>::infinity()) #endif // Linux includes #elif __linux__ // Todo... // Apple/OSX includes #elif __APPLE__ // Todo... #endif // OpenGL Uiser Interface extensions #include "SDL.h" // Standard includes #include <sys/types.h> #include <stdlib.h> #include <stdarg.h> #include <string.h> #include <stdio.h> #include <math.h> // C++ specific includes #include <iostream> using namespace std; // Define PI #define UtilPI (3.141592653589793) // A custom assert function-like macro // Replace the UtilAssert call with a location setting (file/line) function and then correct util assert // This is done via a Variadic Macro; C99 standard // Nov-6-2010: Small bug fix, removed semi-colon on the end #define UtilAssert(...) __UtilAssert(__FILE__, __LINE__, __VA_ARGS__) #define UtilAbort(...) __UtilAssert(__FILE__, __LINE__, false, __VA_ARGS__) // Internal assertion functions // Checks if the assertion is true (if given); if not a critical error is posted. See __UtilAssert(...) // If Assertion is false, it posts the failure string, file name, and line number in a pop-up window or stdout // There is a variable param list at the end to support printf-like arguments void __UtilAssert(const char* FileName, int LineNumber, bool Assertion, const char* FailText, ...); // Unix and Win32 wrappers for high-resolution sleep // Takes in a fraction of a second (as a float) void UtilSleep(float SleepTime); // Random number generator; "Linear Congruential Generator" // Based on http://en.wikipedia.org/wiki/Linear_congruential_generator class UtilRand { public: // Constructs a random number generator (RNG) based on a seed UtilRand(unsigned int seed); UtilRand(const char* seed); // Returns a random number between 0 and UINT_MAX unsigned int Rand(); // Get the seed that was generated inline unsigned int GetSeed() { return seed; } private: // The internal seed / previous numbers unsigned int seed; // Constants based on the LCG algo (comes from GCC's chosen numbers) static const unsigned int a = 1103515245; static const unsigned int c = 12345; }; // Windows version #if _WIN32 // High-resolution clock (In fraction of seconds) class UtilHighresClock { public: UtilHighresClock(bool StartTiming = false) { // Setup the high-resolution timer QueryPerformanceFrequency(&TicksPerSec); // High-resolution timers, iniitalized timer QueryPerformanceCounter(&startTime); // Start off the timer Start(); Stop(); // Star the timer if we want if(StartTiming) Start(); } void Stop() { QueryPerformanceCounter(&endTime); } // In seconds float GetTime() { // Measure the cycle time cpuTime.QuadPart = endTime.QuadPart - startTime.QuadPart; return (float)cpuTime.QuadPart / (float)TicksPerSec.QuadPart; } void Start() { QueryPerformanceCounter(&startTime); } private: LARGE_INTEGER TicksPerSec; LARGE_INTEGER startTime, endTime, cpuTime; }; // UNIX / Linux / OSX interface #else // High-resolution clock (In fraction of seconds) class UtilHighresClock { public: UtilHighresClock(bool StartTiming = false) { // High-resolution timers, iniitalized timer gettimeofday(&startTime, NULL); // Start off the timer Start(); Stop(); // Star the timer if we want if(StartTiming) Start(); } void Stop() { gettimeofday(&endTime, NULL); } float GetTime() { // Measure the cycle time (Convert from micro to milli to seconds) // If the end time is one second more than the start time, modify the float secondDif = float(endTime.tv_sec - startTime.tv_sec); return float(float(endTime.tv_usec) / 1000.0f - float(startTime.tv_usec) / 1000.0f) / 1000.0f + secondDif; } void Start() { gettimeofday(&startTime, NULL); } private: struct timeval startTime, endTime; }; // End of UNIX version #endif #endif
// Created file "Lib\src\Uuid\X64\propkeys" 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_Journal_EntryType, 0x95beb1fc, 0x326d, 0x4644, 0xb3, 0x96, 0xcd, 0x3e, 0xd9, 0x0e, 0x6d, 0xdf);
/*! @file @author Albert Semenov @date 07/2012 */ #ifndef _1628df4a_ba95_4128_a0af_236fa36a402b_ #define _1628df4a_ba95_4128_a0af_236fa36a402b_ #include "IPropertyInitialisator.h" #include "Property.h" namespace tools { class MYGUI_EXPORT_DLL TexturePropertyInitialisator : public IPropertyInitialisator { public: TexturePropertyInitialisator(); virtual ~TexturePropertyInitialisator(); virtual void initialise(PropertyPtr _property); }; } #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 PXV_SIM_STATS_H #define PXV_SIM_STATS_H #include "foundation/PxAssert.h" #include "foundation/PxMemory.h" #include "CmPhysXCommon.h" #include "PxGeometry.h" namespace physx { /*! \file Context handling */ /************************************************************************/ /* Context handling, types */ /************************************************************************/ /*! Description: contains statistics for the simulation. */ struct PxvSimStats { PxvSimStats() { clearAll(); } void clearAll() { PxMemZero(this, sizeof(PxvSimStats)); } // set counters to zero PX_FORCE_INLINE void incCCDPairs(PxGeometryType::Enum g0, PxGeometryType::Enum g1) { PX_ASSERT(g0 <= g1); // That's how they should be sorted mNbCCDPairs[g0][g1]++; } PX_FORCE_INLINE void decCCDPairs(PxGeometryType::Enum g0, PxGeometryType::Enum g1) { PX_ASSERT(g0 <= g1); // That's how they should be sorted PX_ASSERT(mNbCCDPairs[g0][g1]); mNbCCDPairs[g0][g1]--; } PX_FORCE_INLINE void incModifiedContactPairs(PxGeometryType::Enum g0, PxGeometryType::Enum g1) { PX_ASSERT(g0 <= g1); // That's how they should be sorted mNbModifiedContactPairs[g0][g1]++; } PX_FORCE_INLINE void decModifiedContactPairs(PxGeometryType::Enum g0, PxGeometryType::Enum g1) { PX_ASSERT(g0 <= g1); // That's how they should be sorted PX_ASSERT(mNbModifiedContactPairs[g0][g1]); mNbModifiedContactPairs[g0][g1]--; } // PT: those guys are now persistent and shouldn't be cleared each frame PxU32 mNbDiscreteContactPairs [PxGeometryType::eGEOMETRY_COUNT][PxGeometryType::eGEOMETRY_COUNT]; PxU32 mNbCCDPairs [PxGeometryType::eGEOMETRY_COUNT][PxGeometryType::eGEOMETRY_COUNT]; PxU32 mNbModifiedContactPairs [PxGeometryType::eGEOMETRY_COUNT][PxGeometryType::eGEOMETRY_COUNT]; PxU32 mNbDiscreteContactPairsTotal; // PT: sum of mNbDiscreteContactPairs, i.e. number of pairs reaching narrow phase PxU32 mNbDiscreteContactPairsWithCacheHits; PxU32 mNbDiscreteContactPairsWithContacts; PxU32 mNbActiveConstraints; PxU32 mNbActiveDynamicBodies; PxU32 mNbActiveKinematicBodies; PxU32 mNbAxisSolverConstraints; PxU32 mTotalCompressedContactSize; PxU32 mTotalConstraintSize; PxU32 mPeakConstraintBlockAllocations; PxU32 mNbNewPairs; PxU32 mNbLostPairs; PxU32 mNbNewTouches; PxU32 mNbLostTouches; PxU32 mNbPartitions; }; } #endif
/** * ArUco: Augmented Reality library from the University of Cordoba * * ArUco is a minimal C++ library for detection of Augmented Reality * markers based on OpenCv exclusively. * * It is an educational project to show student how to detect augmented * reality markers and it is provided under BSD license. * * This software is released under BSD license, see * http://www.uco.es/investiga/grupos/ava/node/26 for details. */ #ifndef _Aruco_BoardDetector_H #define _Aruco_BoardDetector_H // #include <opencv2/core/core.hpp> #include "board.h" #include "cameraparameters.h" using namespace std; using namespace cv; namespace aruco { /**\brief This class detects AR boards */ class BoardDetector { public: /** Given the markers detected, determines if there is the board passed * @param detectedMarkers result provided by aruco::ArMarkerDetector * @param BConf the board you want to see if is present * @param Bdetected output information of the detected board * @param camMatrix camera matrix with intrinsics * @param distCoeff camera distorsion coeff * @param camMatrix intrinsic camera information. * @param distCoeff camera distorsion coefficient. If set Mat() if is assumed no camera distorion * @param markerSizeMeters size of the marker sides expressed in meters * @return value indicating the likelihood of having found the marker */ float detect(const vector<Marker> &detectedMarkers,const BoardConfiguration &BConf, Board &Bdetected, Mat camMatrix=Mat(),Mat distCoeff=Mat(), float markerSizeMeters=-1 )throw (cv::Exception); float detect(const vector<Marker> &detectedMarkers,const BoardConfiguration &BConf, Board &Bdetected, CameraParameters cp, float markerSizeMeters=-1 )throw (cv::Exception); private: void rotateXAxis(Mat &rotation); }; } #endif
/* lela/matrix/traits.h * Copyright 2011 Bradford Hovinen * * Properties of matrices on which algorithms are specialised * * ------------------------------------ * * This file is part of LELA, licensed under the GNU Lesser General * Public License version 3. See COPYING for more information. */ #ifndef __LELA_MATRIX_TRAITS_H #define __LELA_MATRIX_TRAITS_H namespace LELA { /** Matrix-iterator-types * * These tags indicate which iterators a matrix supports: generic * (unspecified), row-iterators only, column-iterators only, or both * row- and column-iterators. * * \ingroup matrix */ namespace MatrixIteratorTypes { struct Generic {}; struct Row : public virtual Generic {}; struct Col : public virtual Generic {}; struct RowCol : public Row, public Col {}; } /** Matrix-storage-types * * These tags indicate how a matrix is stored. * * \ingroup matrix */ namespace MatrixStorageTypes { /** Unspecified storage-type * * Generic means that no assumptions are made about storage. This can * be used for "virtual" matrices which do not physically exist in * memory. */ struct Generic {}; /** Storage by rows * * Rows means that the matrix maintains a vector of row-vectors. */ struct Rows : public Generic {}; /** Dense storage * * Dense means that the matrix is stored as an array of elements. The * matrix should provide the method disp () which indicates the * displacement from one row to the next in the array. */ struct Dense : public Generic {}; /** Transposed dense storage * * DenseTranspose is similar to dense, but the matrix is stored in * column-major order rather than row-major order, i.e. it is the * transpose of an ordinary dense matrix. */ struct DenseTranspose : public Generic {}; /** M4RI matrix * * M4RI means that the matrix is a wrapper for a matrix in * libm4ri. This is only meaningful if libm4ri is enabled. */ struct M4RI : public Generic {}; /** Transposed M4RI matrix * * M4RITranspose refers to the transpose of a M4RI-matrix. This is * only meaningful if libm4ri is enabled. */ struct M4RITranspose : public Generic {}; } } // namespace LELA #endif // __LELA_MATRIX_TRAITS_H // Local Variables: // mode: C++ // tab-width: 8 // indent-tabs-mode: t // c-basic-offset: 8 // End: // vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s:syntax=cpp.doxygen:foldmethod=syntax
/* 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 "sesrequest_p.h" #include "putconfigurationsetdeliveryoptionsrequest.h" namespace QtAws { namespace SES { class PutConfigurationSetDeliveryOptionsRequest; class PutConfigurationSetDeliveryOptionsRequestPrivate : public SesRequestPrivate { public: PutConfigurationSetDeliveryOptionsRequestPrivate(const SesRequest::Action action, PutConfigurationSetDeliveryOptionsRequest * const q); PutConfigurationSetDeliveryOptionsRequestPrivate(const PutConfigurationSetDeliveryOptionsRequestPrivate &other, PutConfigurationSetDeliveryOptionsRequest * const q); private: Q_DECLARE_PUBLIC(PutConfigurationSetDeliveryOptionsRequest) }; } // namespace SES } // namespace QtAws #endif
// Created file "Lib\src\Uuid\X64\fwpapi" 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(FWPM_CONDITION_AUTHENTICATION_TYPE, 0xeb458cd5, 0xda7b, 0x4ef9, 0x8d, 0x43, 0x7b, 0x0a, 0x84, 0x03, 0x32, 0xf2);
/* 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_DESCRIBEACTIONREQUEST_P_H #define QTAWS_DESCRIBEACTIONREQUEST_P_H #include "sagemakerrequest_p.h" #include "describeactionrequest.h" namespace QtAws { namespace SageMaker { class DescribeActionRequest; class DescribeActionRequestPrivate : public SageMakerRequestPrivate { public: DescribeActionRequestPrivate(const SageMakerRequest::Action action, DescribeActionRequest * const q); DescribeActionRequestPrivate(const DescribeActionRequestPrivate &other, DescribeActionRequest * const q); private: Q_DECLARE_PUBLIC(DescribeActionRequest) }; } // namespace SageMaker } // namespace QtAws #endif
/* * KOI8-U codepage (Ukrainian Cyrillic) functions * * Copyright (c) 2008-2012, Joachim Metz <jbmetz@users.sourceforge.net> * * Refer to AUTHORS for acknowledgements. * * This software 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 software 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 this software. If not, see <http://www.gnu.org/licenses/>. */ #if !defined( _LIBUNA_CODEPAGE_KOI8_U_H ) #define _LIBUNA_CODEPAGE_KOI8_U_H #include <common.h> #include <types.h> #if defined( __cplusplus ) extern "C" { #endif extern const uint16_t libuna_codepage_koi8_u_byte_stream_to_unicode_base_0x80[ 128 ]; extern const uint8_t libuna_codepage_koi8_u_unicode_to_byte_stream_base_0x0410[ 64 ]; extern const uint8_t libuna_codepage_koi8_u_unicode_to_byte_stream_base_0x2550[ 32 ]; #if defined( __cplusplus ) } #endif #endif
// Created file "Lib\src\Uuid\X64\propkeys" 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(GUID_VIDEO_ADAPTIVE_PERCENT_INCREASE, 0xeed904df, 0xb142, 0x4183, 0xb1, 0x0b, 0x5a, 0x11, 0x97, 0xa3, 0x78, 0x64);
/* 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_GETREPORTDEFINITIONREQUEST_H #define QTAWS_GETREPORTDEFINITIONREQUEST_H #include "applicationcostprofilerrequest.h" namespace QtAws { namespace ApplicationCostProfiler { class GetReportDefinitionRequestPrivate; class QTAWSAPPLICATIONCOSTPROFILER_EXPORT GetReportDefinitionRequest : public ApplicationCostProfilerRequest { public: GetReportDefinitionRequest(const GetReportDefinitionRequest &other); GetReportDefinitionRequest(); virtual bool isValid() const Q_DECL_OVERRIDE; protected: virtual QtAws::Core::AwsAbstractResponse * response(QNetworkReply * const reply) const Q_DECL_OVERRIDE; private: Q_DECLARE_PRIVATE(GetReportDefinitionRequest) }; } // namespace ApplicationCostProfiler } // namespace QtAws #endif
/* * Support functions * * Copyright (c) 2010-2013, Joachim Metz <joachim.metz@gmail.com> * * Refer to AUTHORS for acknowledgements. * * This software 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 software 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 this software. If not, see <http://www.gnu.org/licenses/>. */ #if !defined( _LIBFCACHE_SUPPORT_H ) #define _LIBFCACHE_SUPPORT_H #include <common.h> #include <types.h> #include "libfcache_extern.h" #if defined( __cplusplus ) extern "C" { #endif #if !defined( HAVE_LOCAL_LIBFCACHE ) LIBFCACHE_EXTERN \ const char *libfcache_get_version( void ); #endif /* !defined( HAVE_LOCAL_LIBFCACHE ) */ #if defined( __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_LISTACTIONSREQUEST_H #define QTAWS_LISTACTIONSREQUEST_H #include "sagemakerrequest.h" namespace QtAws { namespace SageMaker { class ListActionsRequestPrivate; class QTAWSSAGEMAKER_EXPORT ListActionsRequest : public SageMakerRequest { public: ListActionsRequest(const ListActionsRequest &other); ListActionsRequest(); virtual bool isValid() const Q_DECL_OVERRIDE; protected: virtual QtAws::Core::AwsAbstractResponse * response(QNetworkReply * const reply) const Q_DECL_OVERRIDE; private: Q_DECLARE_PRIVATE(ListActionsRequest) }; } // namespace SageMaker } // namespace QtAws #endif
/* * ISO 8859-13 codepage (Baltic) functions * * Copyright (C) 2008-2020, Joachim Metz <joachim.metz@gmail.com> * * Refer to AUTHORS for acknowledgements. * * 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ #if !defined( _LIBUNA_CODEPAGE_ISO_8859_13_H ) #define _LIBUNA_CODEPAGE_ISO_8859_13_H #include <common.h> #include <types.h> #include "libuna_extern.h" #if defined( __cplusplus ) extern "C" { #endif LIBUNA_EXTERN_VARIABLE \ const uint16_t libuna_codepage_iso_8859_13_byte_stream_to_unicode_base_0xa0[ 96 ]; LIBUNA_EXTERN_VARIABLE \ const uint8_t libuna_codepage_iso_8859_13_unicode_to_byte_stream_base_0x00a0[ 224 ]; LIBUNA_EXTERN_VARIABLE \ const uint8_t libuna_codepage_iso_8859_13_unicode_to_byte_stream_base_0x2018[ 8 ]; #if defined( __cplusplus ) } #endif #endif /* !defined( _LIBUNA_CODEPAGE_ISO_8859_13_H ) */
#ifndef __HELLO_WORLD_H__ #define __HELLO_WORLD_H__ // When you import this file, you import all the cocos2d classes #include "cocos2d.h" #include "Box2D.h" #include "MyContactListener.h" #include "GameSprite.h" USING_NS_CC; class PhysicsSprite : public cocos2d::CCSprite { public: PhysicsSprite(); void setPhysicsBody(b2Body * body); virtual bool isDirty(void); virtual cocos2d::CCAffineTransform nodeToParentTransform(void); private: b2Body* m_pBody; // strong ref }; class HelloWorld : public cocos2d::CCLayer { CCSize _screenSize; public: ~HelloWorld(); HelloWorld(); // returns a Scene that contains the HelloWorld as the only child static cocos2d::CCScene* scene(); void initPhysics(); // adds a new sprite at a given coordinate void addNewSpriteAtPosition(cocos2d::CCPoint p); void gameReset(); void playerScore(int player); void createEdge(float x1, float y1, float x2, float y2, int groupIndex); virtual void draw(); virtual void ccTouchesBegan(cocos2d::CCSet* touches, cocos2d::CCEvent* event); virtual void ccTouchesMoved(cocos2d::CCSet* touches, cocos2d::CCEvent* event); virtual void ccTouchesEnded(cocos2d::CCSet* touches, cocos2d::CCEvent* event); void update(float dt); void updateTime(float dt); private: CCSize s = CCDirector::sharedDirector()->getWinSize(); b2Body* _groundBody; b2Body *_player1Body; b2Body *_player2Body; b2Body *_ballBody; b2Fixture *_player1Fixture; b2Fixture *_player2Fixture; b2Fixture *_ballFixture; b2Fixture *lowerMiddle; b2Fixture *higherMiddle; GameSprite *_player1; GameSprite *_player2; CCSprite *_ball; CCSprite *_player1ScoreLabel1; CCSprite *_player1ScoreLabel2; CCSprite *_player2ScoreLabel1; CCSprite *_player2ScoreLabel2; int _player1Score = 0; int _sc1Tens; int _sc1SingleDigit; int _player2Score = 0; int _sc2Tens; int _sc2SingleDigit; bool p1touched = false; bool p2touched = false; CCArray *_players; b2World* world; cocos2d::CCTexture2D* m_pSpriteTexture; // weak ref b2MouseJoint *_mouseJoint1; b2MouseJoint *_mouseJoint2; MyContactListener *_contactListener; int minutes; int seconds; bool playing; cocos2d:: CCSprite *spriteTime ; }; #endif // __HELLO_WORLD_H__
/***************************************************************************** * Product: Blinky example, Arduino-UNO board, preemptive QK-nano kernel * Last Updated for Version: 5.4.0 * Date of the Last Update: 2015-04-08 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. state-machine.com. * * This program is open source 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. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * 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/>. * * Contact information: * Web: www.state-machine.com * Email: info@state-machine.com *****************************************************************************/ #include "qpn.h" #include "blinky.h" #include "bsp.h" /* the AVR device specific header <avr/io.h> is already included */ /* add other drivers if necessary... */ //Q_DEFINE_THIS_FILE /* Local-scope objects -----------------------------------------------------*/ /* Arduino-UNO runs off the 16MHz oscillator */ #define F_CPU 16000000UL /* the on-board LED labeled "L" on Arduino-UNO */ #define LED_L (1U << 5) /* ISRs used in this project ===============================================*/ ISR(TIMER2_COMPA_vect) { QK_ISR_ENTRY(); /* inform QK about entering an ISR */ QF_tickXISR(0U); /* process time events for rate 0 */ QK_ISR_EXIT(); /* inform QK about exiting an ISR */ } /* BSP functions ===========================================================*/ void BSP_init(void) { DDRB = 0xFFU; // All PORTB pins are outputs (user LED) PORTB = 0x00U; // drive all pins low } /*..........................................................................*/ void BSP_ledOff(void) { PORTB &= ~LED_L; } /*..........................................................................*/ void BSP_ledOn(void) { PORTB |= LED_L; } /*..........................................................................*/ void BSP_terminate(int16_t result) { (void)result; } /* QF callbacks ============================================================*/ void QF_onStartup(void) { /* set Timer2 in CTC mode, 1/1024 prescaler, start the timer ticking... */ TCCR2A = (1U << WGM21) | (0U << WGM20); TCCR2B = (1U << CS22 ) | (1U << CS21) | (1U << CS20); /* 1/2^10 */ ASSR &= ~(1U << AS2); TIMSK2 = (1U << OCIE2A); /* Enable TIMER2 compare Interrupt */ TCNT2 = 0U; OCR2A = (F_CPU / BSP_TICKS_PER_SEC / 1024U) - 1U; } /*..........................................................................*/ void QF_onCleanup(void) { } /*..........................................................................*/ void QK_onIdle(void) { /* toggle the User LED, see NOTE1 , not enough LEDs to implement! */ //QF_INT_DISABLE(); //PORTB |= LED_L; //PORTB &= ~LED_L; //QF_INT_ENABLE(); #ifdef NDEBUG /* Put the CPU and peripherals to the low-power mode. * you might need to customize the clock management for your application, * see the datasheet for your particular AVR MCU. */ SMCR = (0 << SM0) | (1 << SE); /* idle mode, adjust to your project */ QK_CPU_SLEEP(); /* put CPU to sleep */ #endif } /*..........................................................................*/ void Q_onAssert(char const Q_ROM * const file, int line) { /* implement the error-handling policy for your application!!! */ QF_INT_DISABLE(); /* disable all interrupts */ QF_RESET(); /* reset the CPU */ } /***************************************************************************** * NOTE1: * The User LED is used to visualize the idle loop activity. The brightness * of the LED is proportional to the frequency of invcations of the idle loop. * Please note that the LED is toggled with interrupts locked, so no interrupt * execution time contributes to the brightness of the User LED. */
#import "_UILegibilityView.h" @interface _UILegibilityLabel : _UILegibilityView @end
/* * Modification History * * 2000-December-19 Jason Rohrer * Created. * * 2010-April-6 Jason Rohrer * Blocked event passing to handlers that were added by event. */ #ifndef MOUSE_HANDLER_GL_INCLUDED #define MOUSE_HANDLER_GL_INCLUDED /** * Interface for an object that can field OpenGL mouse events. * * @author Jason Rohrer */ class MouseHandlerGL { public: virtual ~MouseHandlerGL() { } /** * Callback function for when mouse moves. * * @param inX x position of mouse. * @param inY y position of mouse. */ virtual void mouseMoved( int inX, int inY ) = 0; /** * Callback function for when mouse moves with button depressed. * * @param inX x position of mouse. * @param inY y position of mouse. */ virtual void mouseDragged( int inX, int inY ) = 0; /** * Callback function for when the mouse button is depressed. * * @param inX x position of mouse. * @param inY y position of mouse. */ virtual void mousePressed( int inX, int inY ) = 0; /** * Callback function for when the mouse button is released. * * @param inX x position of mouse. * @param inY y position of mouse. */ virtual void mouseReleased( int inX, int inY ) = 0; char mHandlerFlagged; protected: MouseHandlerGL() : mHandlerFlagged( false ) { } }; #endif