Dataset Viewer
Auto-converted to Parquet Duplicate
text
stringlengths
4
6.14k
/* ISC license. */ #include <bearssl.h> #include <s6-networking/sbearssl.h> int sbearssl_skey_to (sbearssl_skey const *l, br_skey *k, char *s) { switch (l->type) { case BR_KEYTYPE_RSA : sbearssl_rsa_skey_to(&l->data.rsa, &k->data.rsa, s) ; break ; case BR_KEYTYPE_EC : sbearssl_ec_skey_to(&l->data.ec, &k->data.ec, s) ; break ; default : return 0 ; } k->type = l->type ; return 1 ; }
// // RCWorkspaceCache.h // // Created by Mark Lilback on 12/12/11. // Copyright (c) 2011 . All rights reserved. // #import "_RCWorkspaceCache.h" @interface RCWorkspaceCache : _RCWorkspaceCache //if multiple values are to be set, it best to get properties, set them, and then call setProperties //each call to setProperties serializes a plist @property (nonatomic, strong) NSMutableDictionary *properties; -(id)propertyForKey:(NSString*)key; //removes property if value is nil -(void)setProperty:(id)value forKey:(NSString*)key; -(BOOL)boolPropertyForKey:(NSString*)key; -(void)setBoolProperty:(BOOL)val forKey:(NSString*)key; @end
/*! * DASSL solver library description */ #include "libinfo.h" extern void _start() { _library_ident("DAE solver library"); _library_task("interfaces to generic IVP solver"); _library_task("operations on data for included solvers"); _library_task("DASSL solver backend"); _library_task("RADAU solver backend"); _library_task("MEBDFI solver backend"); _exit(0); }
/* * WARNING: do not edit! * Generated by util/mkbuildinf.pl * * Copyright 2014-2017 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #define PLATFORM "platform: linux-armv4" #define DATE "built on: Fri Sep 13 15:59:17 2019 UTC" /* * Generate compiler_flags as an array of individual characters. This is a * workaround for the situation where CFLAGS gets too long for a C90 string * literal */ static const char compiler_flags[] = { 'c','o','m','p','i','l','e','r',':',' ','.','.','/','c','o','n', 'f','i','g','/','f','a','k','e','_','g','c','c','.','p','l',' ', '-','f','P','I','C',' ','-','p','t','h','r','e','a','d',' ','-', 'W','a',',','-','-','n','o','e','x','e','c','s','t','a','c','k', ' ','-','W','a','l','l',' ','-','O','3',' ','-','D','O','P','E', 'N','S','S','L','_','U','S','E','_','N','O','D','E','L','E','T', 'E',' ','-','D','O','P','E','N','S','S','L','_','P','I','C',' ', '-','D','O','P','E','N','S','S','L','_','C','P','U','I','D','_', 'O','B','J',' ','-','D','O','P','E','N','S','S','L','_','B','N', '_','A','S','M','_','M','O','N','T',' ','-','D','O','P','E','N', 'S','S','L','_','B','N','_','A','S','M','_','G','F','2','m',' ', '-','D','S','H','A','1','_','A','S','M',' ','-','D','S','H','A', '2','5','6','_','A','S','M',' ','-','D','S','H','A','5','1','2', '_','A','S','M',' ','-','D','K','E','C','C','A','K','1','6','0', '0','_','A','S','M',' ','-','D','A','E','S','_','A','S','M',' ', '-','D','B','S','A','E','S','_','A','S','M',' ','-','D','G','H', 'A','S','H','_','A','S','M',' ','-','D','E','C','P','_','N','I', 'S','T','Z','2','5','6','_','A','S','M',' ','-','D','P','O','L', 'Y','1','3','0','5','_','A','S','M',' ','-','D','N','D','E','B', 'U','G','\0' };
enum asmop { ASNOP = 0, ASSTB, ASSTH, ASSTW, ASSTL, ASSTM, ASSTS, ASSTD, ASLDSB, ASLDUB, ASLDSH, ASLDUH, ASLDSW, ASLDUW, ASLDL, ASLDS, ASLDD, ASADDW, ASSUBW, ASMULW, ASMODW, ASUMODW, ASDIVW, ASUDIVW, ASSHLW, ASSHRW, ASUSHRW, ASLTW, ASULTW, ASGTW, ASUGTW, ASLEW, ASULEW, ASGEW, ASUGEW, ASEQW, ASNEW, ASBANDW, ASBORW, ASBXORW, ASADDL, ASSUBL, ASMULL, ASMODL, ASUMODL, ASDIVL, ASUDIVL, ASSHLL, ASSHRL, ASUSHRL, ASLTL, ASULTL, ASGTL, ASUGTL, ASLEL, ASULEL, ASGEL, ASUGEL, ASEQL, ASNEL, ASBANDL, ASBORL, ASBXORL, ASADDS, ASSUBS, ASMULS, ASDIVS, ASLTS, ASGTS, ASLES, ASGES, ASEQS, ASNES, ASADDD, ASSUBD, ASMULD, ASDIVD, ASLTD, ASGTD, ASLED, ASGED, ASEQD, ASNED, ASEXTBW, ASUEXTBW, ASEXTBL, ASUEXTBL, ASEXTHW, ASUEXTHW, ASEXTHL, ASUEXTHL, ASEXTWL, ASUEXTWL, ASSTOL, ASSTOW, ASDTOL, ASDTOW, ASSWTOD, ASSWTOS, ASSLTOD, ASSLTOS, ASEXTS, ASTRUNCD, ASJMP, ASBRANCH, ASRET, ASCALL, ASCALLE, ASCALLEX, ASPAR, ASPARE, ASALLOC, ASFORM, ASCOPYB, ASCOPYH, ASCOPYW, ASCOPYL, ASCOPYS, ASCOPYD, ASVSTAR, ASVARG, };
#include <stdarg.h> #include <stddef.h> #include <stdlib.h> #include <string.h> #include <fcntl.h> #include <unistd.h> #include <errno.h> #include <sys/endian.h> #include <sysexits.h> #include <mpg123.h> #include "audio.h" #include "mp3.h" struct mp3 { mpg123_handle *h; int fd; int first; int rate; int channels; int endian; int octets; int sign; }; struct mp3 * mp3_open(const char *file) { struct mp3 *m = NULL; char magic[3]; long rate; int chan; int enc; if ((m = malloc(sizeof(struct mp3))) == NULL) goto err; m->h = NULL; if ((m->fd = open(file, O_RDONLY)) < 0) goto err; if (read(m->fd, magic, 3) != 3) goto err; if (strncmp(magic, "\xFF\xFB", 2) != 0 && strncmp(magic, "ID3", 3) != 0) goto err; if (lseek(m->fd, -3, SEEK_CUR) == -1) goto err; if (mpg123_init() != MPG123_OK) return NULL; if ((m->h = mpg123_new(NULL, NULL)) == NULL || mpg123_param(m->h, MPG123_ADD_FLAGS, MPG123_QUIET, 0) != MPG123_OK || mpg123_open_fd(m->h, m->fd) != MPG123_OK) goto err; if (mpg123_getformat(m->h, &rate, &chan, &enc) != MPG123_OK || rate > (int)(~0U >> 1)) { mpg123_close(m->h); goto err; } m->first = 1; /* Does mpg123 always output in host byte-order? */ m->endian = BYTE_ORDER == LITTLE_ENDIAN; m->rate = rate; m->sign = !!(enc & MPG123_ENC_SIGNED); if (chan & MPG123_STEREO) m->channels = 2; else /* MPG123_MONO */ m->channels = 1; if (enc & MPG123_ENC_FLOAT) { mpg123_close(m->h); goto err; } if (enc & MPG123_ENC_32) m->octets = 4; else if (enc & MPG123_ENC_24) m->octets = 3; else if (enc & MPG123_ENC_16) m->octets = 2; else /* MPG123_ENC_8 */ m->octets = 1; return m; err: if (m != NULL) { if (m->h != NULL) mpg123_delete(m->h); if (m->fd >= 0) close(m->fd); free(m); } mpg123_exit(); return NULL; } int mp3_copy(struct mp3 *m, void *buf, size_t size, struct audio *out) { size_t r; if (m == NULL || buf == NULL || size == 0 || out == NULL) return EX_USAGE; if (m->first) { /* setup audio output */ m->first = 0; a_setrate(out, m->rate); a_setchan(out, m->channels); a_setend(out, m->endian); a_setbits(out, m->octets << 3); a_setsign(out, m->sign); } if (mpg123_read(m->h, buf, size, &r) != MPG123_OK) return EX_SOFTWARE; if (r == 0) return 1; if (a_write(out, buf, r) != r && errno != EINTR && errno != EAGAIN) return EX_IOERR; return EX_OK; } void mp3_close(struct mp3 *m) { if (m == NULL) return; if (m->fd >= 0) close(m->fd); if (m->h != NULL) { mpg123_close(m->h); mpg123_delete(m->h); } mpg123_exit(); free(m); }
/* Copyright (c) 2016, 2021 Dennis Wölfing * * Permission to use, copy, modify, and/or 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. */ /* libc/src/stdio/printf.c * Print format. */ #include <stdarg.h> #include <stdio.h> int printf(const char* restrict format, ...) { va_list ap; va_start(ap, format); int result = vfprintf(stdout, format, ap); va_end(ap); return result; }
/* Copyright (c) 2019, 2022 Dennis Wölfing * * Permission to use, copy, modify, and/or 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. */ /* libc/src/stdio/__file_write.c * Write data to a file. (called from C89) */ #define write __write #include <unistd.h> #include "FILE.h" size_t __file_write(FILE* file, const unsigned char* p, size_t size) { size_t written = 0; while (written < size) { ssize_t result = write(file->fd, p, size - written); if (result < 0) { file->flags |= FILE_FLAG_ERROR; return written; } written += result; p += result; } return written; }
/* Copyright (c) 2018 Dennis Wölfing * * Permission to use, copy, modify, and/or 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. */ /* kernel/include/dennix/clock.h * System clocks. */ #ifndef _DENNIX_CLOCK_H #define _DENNIX_CLOCK_H #define CLOCK_MONOTONIC 0 #define CLOCK_REALTIME 1 #define CLOCK_PROCESS_CPUTIME_ID 2 #define CLOCK_THREAD_CPUTIME_ID 3 #define TIMER_ABSTIME 1 #endif
// // Constants.h // // #define LANGUAGES_API @"https://api.unfoldingword.org/obs/txt/1/obs-catalog.json" #define SELECTION_BLUE_COLOR [UIColor colorWithRed:76.0/255.0 green:185.0/255.0 blue:224.0/255.0 alpha:1.0] #define TEXT_COLOR_NORMAL [UIColor colorWithRed:32.0/255.0 green:27.0/255.0 blue:22.0/255.0 alpha:1.0] #define BACKGROUND_GRAY [UIColor colorWithRed:42.0/255.0 green:34.0/255.0 blue:26.0/255.0 alpha:1.0] #define BACKGROUND_GREEN [UIColor colorWithRed:170.0/255.0 green:208.0/255.0 blue:0.0/255.0 alpha:1.0] #define TABBAR_COLOR_TRANSPARENT [UIColor colorWithRed:42.0/255.0 green:34.0/255.0 blue:26.0/255.0 alpha:0.7] #define FONT_LIGHT [UIFont fontWithName:@"HelveticaNeue-Light" size:17] #define FONT_NORMAL [UIFont fontWithName:@"HelveticaNeue" size:17] #define FONT_MEDIUM [UIFont fontWithName:@"HelveticaNeue-Medium" size:17] #define LEVEL_1_DESC NSLocalizedString(@"Level 1: internal — Translator (or team) affirms that translation is in line with Statement of Faith and Translation Guidelines.", nil) #define LEVEL_2_DESC NSLocalizedString(@"Level 2: external — Translation is independently checked and confirmed by at least two others not on the translation team.", nil) #define LEVEL_3_DESC NSLocalizedString(@"Level 3: authenticated — Translation is checked and confirmed by leadership of at least one Church network with native speakers of the language.", nil) #define LEVEL_1_IMAGE @"level1Cell" #define LEVEL_2_IMAGE @"level2Cell" #define LEVEL_3_IMAGE @"level3Cell" #define LEVEL_1_REVERSE @"level1" #define LEVEL_2_REVERSE @"level2" #define LEVEL_3_REVERSE @"level3" #define IMAGE_VERIFY_GOOD @"verifyGood" #define IMAGE_VERIFY_FAIL @"verifyFail.png" #define IMAGE_VERIFY_EXPIRE @"verifyExpired.png" // Allows us to track the verse for each part of an attributed string static NSString *const USFM_VERSE_NUMBER = @"USFMVerseNumber"; static NSString *const SignatureFileAppend = @".sig"; // Duplicated in UWConstants.swift static NSString *const FileExtensionUFW = @"ufw"; /// Duplicated in UWConstants.swift // Duplicated in UWConstants.swift static NSString *const BluetoothSend = @"BluetoothSend"; static NSString *const BluetoothReceive = @"BluetoothReceive"; static NSString *const MultiConnectSend = @"MultiConnectSend"; static NSString *const MultiConnectReceive = @"MultiConnectReceive"; static NSString *const iTunesSend = @"iTunesSend"; static NSString *const iTunesReceive = @"iTunesReceive"; static NSString *const IMAGE_DIGLOT = @"diglot";
/* * 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" @class NSString, NSURL; // Not exported @interface _GEORegionalResourceDownload : NSObject { NSString *_name; long long _type; NSURL *_url; NSString *_destinationPath; NSString *_expectedChecksum; } @property(copy, nonatomic) NSString *expectedChecksum; // @synthesize expectedChecksum=_expectedChecksum; @property(copy, nonatomic) NSString *destinationPath; // @synthesize destinationPath=_destinationPath; @property(copy, nonatomic) NSURL *url; // @synthesize url=_url; @property(nonatomic) long long type; // @synthesize type=_type; @property(copy, nonatomic) NSString *name; // @synthesize name=_name; - (void)dealloc; @end
//------------------------------------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. All rights reserved. // // CHeapPtr for VB // //------------------------------------------------------------------------------------------------- #pragma once template <typename T> class VBHeapPtr : public CHeapPtrBase<T, VBAllocator> { public: VBHeapPtr() throw() : CHeapPtrBase<T, VBAllocator>() { } VBHeapPtr(VBHeapPtr<T>& p) throw() : CHeapPtrBase<T, VBAllocator>(p) { } explicit VBHeapPtr(T* p) throw() : CHeapPtrBase<T, VBAllocator>(p) { } explicit VBHeapPtr(size_t elements) { Allocate(elements); } VBHeapPtr<T>& operator=(VBHeapPtr<T>& p) throw() { CHeapPtrBase<T, VBStandardallocator>::operator=(p); return *this; } // Allocate a buffer with the given number of elements. Allocator // will succeed or throw void Allocate(size_t nElements = 1) throw() { SafeInt<size_t> total = nElements; total *= sizeof(T); // Uses VBAllocator::Allocate which will succeed or throw AllocateBytes(total.Value()); } // Reallocate the buffer to hold a given number of elements. Allocator // will succeed or throw void Reallocate(size_t nElements) throw() { SafeInt<size_t> total = nElements; total *= sizeof(T); // Uses VBAllocator::Allocate which will succeed or throw ReallocateBytes(total.Value()); } };
// rd_route.c // Copyright (c) 2014-2015 Dmitry Rodionov // // This software may be modified and distributed under the terms // of the MIT license. See the LICENSE file for details. #include <stdlib.h> // realloc() #include <libgen.h> // basename() #include <assert.h> // assert() #include <stdio.h> // fprintf() #include <dlfcn.h> // dladdr() #include "TargetConditionals.h" #if defined(__i386__) || defined(__x86_64__) #if !(TARGET_IPHONE_SIMULATOR) #include <mach/mach_vm.h> // mach_vm_* #else #include <mach/vm_map.h> // vm_* #define mach_vm_address_t vm_address_t #define mach_vm_size_t vm_size_t #define mach_vm_allocate vm_allocate #define mach_vm_deallocate vm_deallocate #define mach_vm_write vm_write #define mach_vm_remap vm_remap #define mach_vm_protect vm_protect #define NSLookupSymbolInImage(...) ((void)0) #define NSAddressOfSymbol(...) ((void)0) #endif #else #endif #include <mach-o/dyld.h> // _dyld_* #include <mach-o/nlist.h> // nlist/nlist_64 #include <mach/mach_init.h> // mach_task_self() #include "rd_route.h" #define RDErrorLog(format, ...) fprintf(stderr, "%s:%d:\n\terror: "format"\n", \ __FILE__, __LINE__, ##__VA_ARGS__) #if defined(__x86_64__) typedef struct mach_header_64 mach_header_t; typedef struct segment_command_64 segment_command_t; #define LC_SEGMENT_ARCH_INDEPENDENT LC_SEGMENT_64 typedef struct nlist_64 nlist_t; #else typedef struct mach_header mach_header_t; typedef struct segment_command segment_command_t; #define LC_SEGMENT_ARCH_INDEPENDENT LC_SEGMENT typedef struct nlist nlist_t; #endif typedef struct rd_injection { mach_vm_address_t injected_mach_header; mach_vm_address_t target_address; } rd_injection_t; static void* _function_ptr_within_image(const char *function_name, void *macho_image_header, uintptr_t vm_image_slide); void* function_ptr_from_name(const char *function_name) { assert(function_name); for (uint32_t i = 0; i < _dyld_image_count(); i++) { void *header = (void *)_dyld_get_image_header(i); uintptr_t vmaddr_slide = _dyld_get_image_vmaddr_slide(i); void *ptr = _function_ptr_within_image(function_name, header, vmaddr_slide); if (ptr) { return ptr; } } RDErrorLog("Failed to find symbol `%s` in the current address space.", function_name); return NULL; } static void* _function_ptr_within_image(const char *function_name, void *macho_image_header, uintptr_t vmaddr_slide) { assert(function_name); assert(macho_image_header); /** * Try the system NSLookup API to find out the function's pointer withing the specifed header. */ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated" void *pointer_via_NSLookup = ({ NSSymbol symbol = NSLookupSymbolInImage(macho_image_header, function_name, NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR); NSAddressOfSymbol(symbol); }); #pragma clang diagnostic pop if (pointer_via_NSLookup) return pointer_via_NSLookup; return NULL; }
// // STShare.h // Loopy // // Created by David Jedeikin on 10/23/13. // Copyright (c) 2013 ShareThis. All rights reserved. // #import "STAPIClient.h" #import <Foundation/Foundation.h> #import <Social/Social.h> @interface STShareActivityUI : NSObject @property (nonatomic, strong) UIViewController *parentController; @property (nonatomic, strong) STAPIClient *apiClient; - (id)initWithParent:(UIViewController *)parent apiClient:(STAPIClient *)client; - (NSArray *)getDefaultActivities:(NSArray *)activityItems; - (UIActivityViewController *)newActivityViewController:(NSArray *)shareItems withActivities:(NSArray *)activities; - (SLComposeViewController *)newActivityShareController:(id)activityObj; - (void)showActivityViewDialog:(UIActivityViewController *)activityController completion:(void (^)(void))completion; - (void)handleShareDidBegin:(NSNotification *)notification; - (void)handleShareDidComplete:(NSNotification *)notification; @end
// Multiprocessor support // mist32 is not supported multiprocessor #include "types.h" #include "defs.h" #include "param.h" #include "memlayout.h" #include "mmu.h" #include "proc.h" struct cpu cpus[NCPU]; int ismp; int ncpu; void mpinit(void) { ismp = 0; ncpu = 1; lapic = 0; cpus[ncpu].id = ncpu; ncpu++; return; }
// // IGViewController.h // KaifKit // // Created by Francis Chong on 04/15/2015. // Copyright (c) 2014 Francis Chong. All rights reserved. // #import <UIKit/UIKit.h> @interface IGViewController : UIViewController @end
// Copyright (c) 2016-2020 The ZCash developers // Copyright (c) 2020 The PIVX developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. /* See the Zcash protocol specification for more information. https://github.com/zcash/zips/blob/master/protocol/protocol.pdf */ #ifndef ZC_NOTE_ENCRYPTION_H_ #define ZC_NOTE_ENCRYPTION_H_ #include "uint256.h" #include "sapling/address.h" #include "sapling/sapling.h" #include <array> namespace libzcash { // Ciphertext for the recipient to decrypt typedef std::array<unsigned char, ZC_SAPLING_ENCCIPHERTEXT_SIZE> SaplingEncCiphertext; typedef std::array<unsigned char, ZC_SAPLING_ENCPLAINTEXT_SIZE> SaplingEncPlaintext; // Ciphertext for outgoing viewing key to decrypt typedef std::array<unsigned char, ZC_SAPLING_OUTCIPHERTEXT_SIZE> SaplingOutCiphertext; typedef std::array<unsigned char, ZC_SAPLING_OUTPLAINTEXT_SIZE> SaplingOutPlaintext; //! This is not a thread-safe API. class SaplingNoteEncryption { protected: // Ephemeral public key uint256 epk; // Ephemeral secret key uint256 esk; bool already_encrypted_enc; bool already_encrypted_out; SaplingNoteEncryption(uint256 epk, uint256 esk) : epk(epk), esk(esk), already_encrypted_enc(false), already_encrypted_out(false) { } public: static boost::optional<SaplingNoteEncryption> FromDiversifier(diversifier_t d); boost::optional<SaplingEncCiphertext> encrypt_to_recipient( const uint256 &pk_d, const SaplingEncPlaintext &message ); SaplingOutCiphertext encrypt_to_ourselves( const uint256 &ovk, const uint256 &cv, const uint256 &cm, const SaplingOutPlaintext &message ); uint256 get_epk() const { return epk; } uint256 get_esk() const { return esk; } }; // Attempts to decrypt a Sapling note. This will not check that the contents // of the ciphertext are correct. boost::optional<SaplingEncPlaintext> AttemptSaplingEncDecryption( const SaplingEncCiphertext &ciphertext, const uint256 &ivk, const uint256 &epk ); // Attempts to decrypt a Sapling note using outgoing plaintext. // This will not check that the contents of the ciphertext are correct. boost::optional<SaplingEncPlaintext> AttemptSaplingEncDecryption ( const SaplingEncCiphertext &ciphertext, const uint256 &epk, const uint256 &esk, const uint256 &pk_d ); // Attempts to decrypt a Sapling note. This will not check that the contents // of the ciphertext are correct. boost::optional<SaplingOutPlaintext> AttemptSaplingOutDecryption( const SaplingOutCiphertext &ciphertext, const uint256 &ovk, const uint256 &cv, const uint256 &cm, const uint256 &epk ); } #endif /* ZC_NOTE_ENCRYPTION_H_ */
// // LightningSendDownView.h // TNTLoveFreshBee // // Created by apple on 16/10/14. // Copyright © 2016年 LiDan. All rights reserved. // #import <UIKit/UIKit.h> @protocol didLightningSendDownViewCommitDelegate <NSObject> @optional - (void)didLightningSendDownViewCommit; @end @interface LightningSendDownView : UIView @property(weak,nonatomic) id<didLightningSendDownViewCommitDelegate>delegate; @end
// // kmeans.h // VoterMLA // // Created by MD Shihabul Kabir on 12/5/16. // Copyright © 2016 MD Shihabul Kabir. All rights reserved. // #ifndef kmeans_h #define kmeans_h #include "county.h" #include <vector> //K-Means Clustering Namespace namespace KmeansCluster { //Data Structure to help K-Means Clustering class KMeans{ private: //setup three clusters for the clustering and two for last centroids and current centroids std::vector<CountyStruct::County>cluster1,cluster2,cluster3,last,current,all; public: //method find the closest cluster to add void addToClosest(CountyStruct::County&acounty); //method to initialize rand centroids and clusters void initialize(std::vector<CountyStruct::County> counties); //method to get the mean of a cluster std::vector<float> mean(std::vector<CountyStruct::County>&cluster); //method to get centroid closest to mean of cluster CountyStruct::County getCentroid(std::vector<CountyStruct::County>&cluster,std::vector<float> mean); //method to get the centroid of a cluster CountyStruct::County centroid(std::vector<CountyStruct::County>&counties); //method to setup centroids bool setupCentroids(); //method to make the clusters void cluster(); //method to get the distance from a point to rest of cluster float avgDistance(std::vector<CountyStruct::County>&cluster,int index); //method to find distance from cluster from a point float distanceFromCluster(CountyStruct::County&c,std::vector<CountyStruct::County>&cluster); //method to return silhoute value float silh(std::vector<CountyStruct::County>&a,std::vector<CountyStruct::County>&b,int index); //method to print the silhoute for each cluster void printSil(); }; } #endif /* kmeans_h */
#ifndef __GTHREE_VECTOR_KEYFRAME_TRACK_H__ #define __GTHREE_VECTOR_KEYFRAME_TRACK_H__ #if !defined (__GTHREE_H_INSIDE__) && !defined (GTHREE_COMPILATION) #error "Only <gthree/gthree.h> can be included directly." #endif #include <gthree/gthreekeyframetrack.h> G_BEGIN_DECLS #define GTHREE_TYPE_VECTOR_KEYFRAME_TRACK (gthree_vector_keyframe_track_get_type ()) #define GTHREE_VECTOR_KEYFRAME_TRACK(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \ GTHREE_TYPE_VECTOR_KEYFRAME_TRACK, \ GthreeVectorKeyframeTrack)) #define GTHREE_IS_VECTOR_KEYFRAME_TRACK(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \ GTHREE_TYPE_VECTOR_KEYFRAME_TRACK)) #define GTHREE_VECTOR_KEYFRAME_TRACK_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), GTHREE_TYPE_VECTOR_KEYFRAME_TRACK, GthreeVectorKeyframeTrackClass)) typedef struct { GthreeKeyframeTrack parent; } GthreeVectorKeyframeTrack; typedef struct { GthreeKeyframeTrackClass parent_class; } GthreeVectorKeyframeTrackClass; G_DEFINE_AUTOPTR_CLEANUP_FUNC (GthreeVectorKeyframeTrack, g_object_unref) GTHREE_API GType gthree_vector_keyframe_track_get_type (void) G_GNUC_CONST; GTHREE_API GthreeKeyframeTrack *gthree_vector_keyframe_track_new (const char *name, GthreeAttributeArray *times, GthreeAttributeArray *values); G_END_DECLS #endif /* __GTHREE_VECTOR_KEYFRAME_TRACK_H__ */
// make a linked list that has one member // then make 5 nodes - with each node having 1,2,3,4,5 as data // then print them out // then work out how to reverse the list by only changing the pointers // then print again #include <stdio.h> #include <stdlib.h> // Including this header to use malloc struct node { int num; struct node *next; }; struct node *head = NULL; struct node *p = NULL; void insert(int num) { struct node *point = (struct node*) malloc(sizeof(struct node)); point->num = num; point->next = NULL; if(head==NULL) { head = point; head->next = point; return; } p = head; while(p->next != head){ p = p->next; } p->next = point; point->next = head; } void printNum() { struct node *pntr = head; printf("\nhead:"); while(pntr->next != head) { printf(" %d ", pntr->num); pntr = pntr->next; } printf(" %d ", pntr->num); printf("\n"); } int main() { insert(1); insert(2); insert(3); insert(4); insert(5); printNum(); }
#pragma once #include <rikitiki/http/content_types.h> #include <vector> #include <map> #include <array> #include <mxcomp/reflection.h> #ifdef _MSC_VER #define constexpr #endif namespace rikitiki { class ConnContext; struct Response; template <typename T> struct ContentHandler_ { static constexpr std::array<ContentType::t, 1> ContentTypes() { return{ { ContentType::DEFAULT } }; }; }; struct OutProvider { template<typename S, typename T> static auto Make() -> void(*)(ConnContext&, S&) { return [](ConnContext& ctx, S& s) { T t; t << s; ctx << t; }; } }; struct InProvider { template<typename S, typename T> static auto Make() -> void(*)(ConnContext&, S&) { return [](ConnContext& ctx, S& s) { T t; ctx >> t; t >> s; }; } }; template <typename S, typename FProvider, typename... T> struct TypeConversions { typedef TypeConversions<S, FProvider, T...> thisType; typedef TypeConversions<std::vector<S>, FProvider, T...> VectorType; template <typename Th, typename...Tt> struct HandlerAdders { static void Add(thisType* _this){ HandlerAdders<Th>::Add(_this); HandlerAdders<Tt...>::Add(_this); } }; template <typename Th> struct HandlerAdders<Th> { static auto Add(thisType* _this) -> void { for (auto contentType : ContentHandler_<Th>::ContentTypes()){ assert(contentType > ContentType::DEFAULT && contentType < ContentType::MAX && "Invalid content type value in specialized handler"); _this->handlers[contentType] = FProvider::template Make<S, Th>(); } } }; typedef void(*Setter)(ConnContext&, S& s); std::vector<Setter> handlers; TypeConversions() { handlers.resize(ContentType::MAX); HandlerAdders<T...>::Add(this); } static thisType& Instance() { static thisType Instance; return Instance; } }; template<typename T, typename enable = void > struct valid_conversions { }; } #ifdef USE_JSONCPP #include <rikitiki/jsoncpp/jsoncpp> namespace rikitiki { using namespace mxcomp; template<typename T> struct valid_conversions<T, typename std::enable_if< std::is_function <decltype(MetaClass_<T>::fields)>::value >::type > { typedef TypeConversions<T, InProvider, Json::Value> In; typedef TypeConversions<T, OutProvider, Json::Value> Out; }; template <typename T> struct valid_conversions<std::vector<T>, typename std::enable_if< std::is_class<valid_conversions<T> >::value >::type > { typedef typename valid_conversions<T>::In::VectorType In; typedef typename valid_conversions<T>::Out::VectorType Out; }; } #endif
typedef struct { f_t x, y; } vec_t, *vec; //inline f_t cross(vec a, vec b) { return a->x * b->y - a->y * b->x; } //inline vec vsub(vec a, vec b, vec res) { res->x = a->x - b->x; res->y = a->y - b->y; } // Does point c lie on the left side of directed edge a->b? // 1 if left, -1 if right, 0 if on the line int c_left_of_ab(vec a, vec b, vec c) { vec_t tmp1, tmp2; f_t x; vsub(b, a, &tmp1); vsub(c, b, &tmp2); x = cross(&tmp1, &tmp2); return x < 0 ? -1 : x > 0; }
#pragma once #include <boost/uuid/random_generator.hpp> #include <boost/uuid/uuid_io.hpp> #include "util/util.h" #include "util/stl_ext.h" namespace collections { extern boost::optional<std::vector<std::string>> wrap_string(const char *csource, int charsPerLine); class tes_string : public reflection::class_meta_mixin_t<tes_string> { public: tes_string() { metaInfo._className = "JString"; metaInfo.comment = "various string utility methods"; } static object_base * wrap(tes_context& ctx, const char* source, SInt32 charsPerLine) { auto strings = wrap_string(source, charsPerLine); if (!strings) { return nullptr; } return &array::objectWithInitializer([&](array &obj) { for (auto& str : *strings) { obj.u_container().emplace_back(std::move(str)); } }, ctx); } REGISTERF2(wrap, "sourceText charactersPerLine=60", "Breaks source text onto set of lines of almost equal size.\n\ Returns JArray object containing lines.\n\ Accepts ASCII and UTF-8 encoded strings only"); static UInt32 decodeFormStringToFormId(const char* form_string) { return util::to_integral(decodeFormStringToForm(form_string)); } static FormId decodeFormStringToForm(const char* form_string) { return boost::get_optional_value_or(forms::from_string(form_string), FormId::Zero); } static skse::string_ref encodeFormToString(FormId id) { return skse::string_ref{ boost::get_optional_value_or(forms::to_string(id), "") }; } static skse::string_ref encodeFormIdToString(UInt32 id) { return encodeFormToString( util::to_enum<FormId>(id) ); } REGISTERF2_STATELESS(decodeFormStringToFormId, "formString", "FormId|Form <-> \"__formData|<pluginName>|<lowFormId>\"-string converisons"); REGISTERF2_STATELESS(decodeFormStringToForm, "formString", ""); REGISTERF2_STATELESS(encodeFormToString, "value", ""); REGISTERF2_STATELESS(encodeFormIdToString, "formId", ""); private: static boost::uuids::random_generator generateUUID_gen; static util::spinlock generateUUID_lock; public: static std::string generateUUID() { return boost::uuids::to_string( util::perform_while_locked(generateUUID_lock, [](){ return generateUUID_gen(); }) ); } REGISTERF2_STATELESS(generateUUID, "", "Generates random uuid-string like 2e80251a-ab22-4ad8-928c-2d1c9561270e"); }; boost::uuids::random_generator tes_string::generateUUID_gen; util::spinlock tes_string::generateUUID_lock; TES_META_INFO(tes_string); TEST(tes_string, wrap) { tes_context_standalone ctx; auto testData = json_deserializer::json_from_file( util::relative_to_dll_path("test_data/tes_string/string_wrap.json").generic_string().c_str() ); EXPECT_TRUE( json_is_array(testData.get()) ); auto testWrap = [&](const char *string, int linesCount, int charsPerLine) { auto obj = tes_string::wrap(ctx, string, charsPerLine); if (linesCount == -1) { EXPECT_NIL(obj); } else { EXPECT_NOT_NIL(obj); EXPECT_TRUE(obj->s_count() >= linesCount); } }; size_t index = 0; json_t *value = nullptr; json_array_foreach(testData.get(), index, value) { int charsPerLine = -1; json_t *jtext = nullptr; int linesCountMinimum = -1; json_error_t error; int succeed = json_unpack_ex(value, &error, 0, "{s:i, s:o, s:i}", "charsPerLine", &charsPerLine, "text", &jtext, "linesCountMinimum", &linesCountMinimum); EXPECT_TRUE(succeed == 0); testWrap(json_string_value(jtext), linesCountMinimum, charsPerLine); } } TEST(tes_string, generateUUID) { auto uidString = tes_string::generateUUID(); EXPECT_FALSE(uidString.empty()); auto uidString2 = tes_string::generateUUID(); EXPECT_NE(uidString, uidString2); } }
// // UIFont+PongMadness.h // Pong Madness // // Created by Ludovic Landry on 2/27/13. // Copyright (c) 2013 MirageTeam. All rights reserved. // #import <UIKit/UIKit.h> @interface UIFont (PongMadness) + (UIFont *)brothersBoldFontOfSize:(CGFloat)pointSize; + (void)printAvailableFonts; @end
// // #ifndef _Rectangle_h #define _Rectangle_h // Includes #include <Engine/Core/Shape.h> #include <Engine/Core/Vector.h> //============================================================================== namespace ptc { class Ray; class Rectangle : public Shape { public: Rectangle(); Rectangle( const Vector& center, const Vector& right, const Vector& normal, float width, //< in right dir float height ); //< in cross( right, normal ) dir void setIsDoubleSided( bool new_value ); bool getIsDoubleSided() const; IntersectDescr intersect( const Ray& ray ) override; private: Vector center_; Vector right_; Vector up_; Vector normal_; float width_; float height_; bool is_double_sided_; }; } // namespace ptc #endif // Include guard
#ifndef COLLISIONALGORITHMB #define COLLISIONALGORITHMB #include "CollisionAlgorithm.h" class CollisionAlgorithmB : public CollisionAlgorithm { public: CollisionAlgorithmB(); ~CollisionAlgorithmB(); public: Tuple4f computeRayTriangleIntersection(Ray3D *ray, const Tuple3f &p0, const Tuple3f &p1, const Tuple3f &p2); }; #endif
/*! NSURL extension YSCategorys Copyright (c) 2013-2014 YoungShook https://github.com/youngshook/YSCategorys The MIT License (MIT) http://www.opensource.org/licenses/mit-license.php */ #import <Foundation/Foundation.h> @interface NSURL (YSKit) /** Cover query string into NSDictionary */ - (NSDictionary *)ys_queryDictionary; + (NSURL *)ys_appStoreURLforApplicationIdentifier:(NSString *)identifier; + (NSURL *)ys_appStoreReviewURLForApplicationIdentifier:(NSString *)identifier; @end
#pragma config(Sensor, in1, linefollower, sensorLineFollower) #pragma config(Sensor, dgtl5, OutputBeltSonar, sensorSONAR_mm) #pragma config(Motor, port6, WhipCreamMotor, tmotorVex393, openLoop) #pragma config(Motor, port7, InputBeltMotor, tmotorServoContinuousRotation, openLoop) #pragma config(Motor, port8, ElevatorMotor, tmotorServoContinuousRotation, openLoop) #pragma config(Motor, port9, OutputBeltMotor, tmotorServoContinuousRotation, openLoop) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*// /* Project Title: Cookie Maker Team Members: Patrick Kubiak Date: Section: Task Description: Control cookie maker machine Pseudocode: Move input conveior belt set distance Move elevator set distance Move output conveior belt until whip cream Press whip cream Reset whip cream Move output conveior belt to end Reset elevator */ task main() { //Program begins, insert code within curly braces while (true) { //Input Conveior Belt startMotor(InputBeltMotor, 127); wait(2.5); stopMotor(InputBeltMotor); //Elevator startMotor(ElevatorMotor, 127); wait(1.5); stopMotor(ElevatorMotor); //Move Cookie To line follower do { startMotor(OutputBeltMotor, -127); } while(SensorValue(linefollower) > 2900); stopMotor(OutputBeltMotor); //Reset Elevator startMotor(ElevatorMotor, -127); wait(2); stopMotor(ElevatorMotor); //Move Cookie To Whip Cream startMotor(OutputBeltMotor, -127); wait(0.4); stopMotor(OutputBeltMotor); //Whip Cream Press startMotor(WhipCreamMotor, -127); wait(1); stopMotor(WhipCreamMotor); //Whip Cream Reset startMotor(WhipCreamMotor, 127); wait(0.9); stopMotor(WhipCreamMotor); //Output Conveior Belt startMotor(OutputBeltMotor, -127); wait(2); } }
// // YZAlertView.h // AlertViewDemo // // Created by yangyongzheng on 2017/8/17. // Copyright © 2017年 yangyongzheng. All rights reserved. // #import <UIKit/UIKit.h> typedef void(^YYZAlertViewActionHandler)(UIAlertAction *action); NS_CLASS_AVAILABLE_IOS(8_0) @interface YYZAlertView : NSObject + (void)yyz_alertViewWithTitle:(NSString *)title message:(NSString *)message cancelActionTitle:(NSString *)cancelActionTitle; + (void)yyz_alertViewWithTitle:(NSString *)title message:(NSString *)message actionTitle:(NSString *)actionTitle actionHandler:(YYZAlertViewActionHandler)actionHandler; + (void)yyz_alertViewWithTitle:(NSString *)title message:(NSString *)message cancelActionTitle:(NSString *)cancelActionTitle otherActionTitle:(NSString *)otherActionTitle actionHandler:(YYZAlertViewActionHandler)actionHandler; @end
#include <stdio.h> #include "list.h" #define N 10 link reverse(link); int main(void) { int i; link head, x; // Population head = new_link(0); x = head; for (i = 1; i < N; ++i) { x = insert_after(x, new_link(i)); } // Reversal head = reverse(head); // Traversal x = head; do { printf("%i\n", x->item); x = x->next; } while (x != head); return 0; } link reverse(link x) { link t; link y = x; link r = NULL; do { t = y->next; y->next = r; r = y; y = t; } while (y != x); x->next = r; return r; }
/* * Generated by class-dump 3.3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard. */ #import <iWorkImport/TSUProgress.h> @class NSArray, NSObject<OS_dispatch_queue>; // Not exported @interface TSUProgressGroup : TSUProgress { NSArray *mChildren; NSArray *mChildrenProgressObservers; NSObject<OS_dispatch_queue> *mChildrenProgressObserversQueue; } - (void)p_updateChildrenProgressObservers; - (void)removeProgressObserver:(id)arg1; - (id)addProgressObserverWithValueInterval:(double)arg1 queue:(id)arg2 handler:(id)arg3; - (_Bool)isIndeterminate; - (double)maxValue; - (double)value; - (void)dealloc; - (id)initWithChildren:(id)arg1; @end
/** @file safesysstat.h * @brief #include <sys/stat.h> with portability enhancements */ /* Copyright (C) 2007,2012,2017 Olly Betts * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 * USA */ #ifndef XAPIAN_INCLUDED_SAFESYSSTAT_H #define XAPIAN_INCLUDED_SAFESYSSTAT_H #include <sys/stat.h> #include <sys/types.h> #ifdef __WIN32__ // MSVC lacks these POSIX macros and other compilers may too: #ifndef S_ISDIR # define S_ISDIR(ST_MODE) (((ST_MODE) & _S_IFMT) == _S_IFDIR) #endif #ifndef S_ISREG # define S_ISREG(ST_MODE) (((ST_MODE) & _S_IFMT) == _S_IFREG) #endif // On UNIX, mkdir() is prototyped in <sys/stat.h> but on Windows it's in // <direct.h>, so just include that from here to avoid build failures on // MSVC just because of some new use of mkdir(). This also reduces the // number of conditionalised #include statements we need in the sources. #include <direct.h> // Add overloaded version of mkdir which takes an (ignored) mode argument // to allow source code to just specify a mode argument unconditionally. // // The () around mkdir are in case it's defined as a macro. inline int (mkdir)(const char *pathname, mode_t /*mode*/) { return _mkdir(pathname); } #else // These were specified by POSIX.1-1996, so most platforms should have // these by now: #ifndef S_ISDIR # define S_ISDIR(ST_MODE) (((ST_MODE) & S_IFMT) == S_IFDIR) #endif #ifndef S_ISREG # define S_ISREG(ST_MODE) (((ST_MODE) & S_IFMT) == S_IFREG) #endif #endif #endif /* XAPIAN_INCLUDED_SAFESYSSTAT_H */
/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef _INIT_INIT_PARSER_H_ #define _INIT_INIT_PARSER_H_ #include <map> #include <memory> #include <string> #include <vector> class SectionParser { public: virtual ~SectionParser() { } virtual bool ParseSection(const std::vector<std::string>& args, const std::string& filename, int line, std::string* err) = 0; virtual bool ParseLineSection(const std::vector<std::string>& args, int line, std::string* err) = 0; virtual void EndSection() = 0; virtual void EndFile(const std::string& filename) = 0; }; class Parser { public: static Parser& GetInstance(); void DumpState() const; bool ParseConfig(const std::string& path); void AddSectionParser(const std::string& name, std::unique_ptr<SectionParser> parser); void set_is_system_etc_init_loaded(bool loaded) { is_system_etc_init_loaded_ = loaded; } void set_is_vendor_etc_init_loaded(bool loaded) { is_vendor_etc_init_loaded_ = loaded; } void set_is_odm_etc_init_loaded(bool loaded) { is_odm_etc_init_loaded_ = loaded; } bool is_system_etc_init_loaded() { return is_system_etc_init_loaded_; } bool is_vendor_etc_init_loaded() { return is_vendor_etc_init_loaded_; } bool is_odm_etc_init_loaded() { return is_odm_etc_init_loaded_; } private: Parser(); void ParseData(const std::string& filename, const std::string& data); bool ParseConfigFile(const std::string& path); bool ParseConfigDir(const std::string& path); std::map<std::string, std::unique_ptr<SectionParser>> section_parsers_; bool is_system_etc_init_loaded_ = false; bool is_vendor_etc_init_loaded_ = false; bool is_odm_etc_init_loaded_ = false; }; #endif
// // URBSegmentedControl.h // URBSegmentedControlDemo // // Created by Nicholas Shipes on 2/1/13. // Copyright (c) 2013 Urban10 Interactive. All rights reserved. // #import <UIKit/UIKit.h> typedef NS_ENUM(NSUInteger, URBSegmentedControlOrientation) { URBSegmentedControlOrientationHorizontal = 0, URBSegmentedControlOrientationVertical }; typedef NS_ENUM(NSUInteger, URBSegmentViewLayout) { URBSegmentViewLayoutDefault = 0, URBSegmentViewLayoutVertical }; typedef NS_ENUM(NSUInteger, URBSegmentImagePosition) { URBSegmentImagePositionLeft = 0, URBSegmentImagePositionRight }; @interface URBSegmentedControl : UISegmentedControl <UIAppearance> typedef void (^URBSegmentedControlBlock)(NSInteger index, URBSegmentedControl *segmentedControl); /** Layout behavior for the segments (row or columns). */ @property (nonatomic) URBSegmentedControlOrientation layoutOrientation; /** Layout behavior of the segment contents. */ @property (nonatomic) URBSegmentViewLayout segmentViewLayout; /** * Position of the image when placed horizontally next to a segment label. Not used for controls containing only text or images. */ @property (nonatomic, assign) URBSegmentImagePosition imagePosition; /** Block handle called when the selected segment has changed. */ @property (nonatomic, copy) URBSegmentedControlBlock controlEventBlock; /** Background color for the base container view. */ @property (nonatomic, strong) UIColor *baseColor; @property (nonatomic, strong) UIColor *baseGradient; /** Stroke color used around the base container view. */ @property (nonatomic, strong) UIColor *strokeColor; /** Stroke width for the base container view. */ @property (nonatomic, assign) CGFloat strokeWidth; /** Corner radius for the base container view. */ @property (nonatomic) CGFloat cornerRadius; /** Whether or not a gradient should be automatically applied to the base and segment backgrounds based on the defined base colors. */ @property (nonatomic, assign) BOOL showsGradient; /** Padding between the segments and the base container view. */ @property (nonatomic, assign) UIEdgeInsets segmentEdgeInsets; ///---------------------------- /// @name Segment Customization ///---------------------------- @property (nonatomic, strong) UIColor *segmentBackgroundColor UI_APPEARANCE_SELECTOR; @property (nonatomic, strong) UIColor *segmentBackgroundGradient UI_APPEARANCE_SELECTOR; @property (nonatomic, strong) UIColor *imageColor UI_APPEARANCE_SELECTOR; @property (nonatomic, strong) UIColor *selectedImageColor UI_APPEARANCE_SELECTOR; @property (nonatomic, assign) UIEdgeInsets contentEdgeInsets; @property (nonatomic, assign) UIEdgeInsets titleEdgeInsets; @property (nonatomic, assign) UIEdgeInsets imageEdgeInsets; - (id)initWithTitles:(NSArray *)titles; - (id)initWithIcons:(NSArray *)icons; - (id)initWithTitles:(NSArray *)titles icons:(NSArray *)icons; - (void)insertSegmentWithTitle:(NSString *)title image:(UIImage *)image atIndex:(NSUInteger)segment animated:(BOOL)animated; - (void)setSegmentBackgroundColor:(UIColor *)segmentBackgroundColor atIndex:(NSUInteger)segment; - (void)setImageColor:(UIColor *)imageColor forState:(UIControlState)state UI_APPEARANCE_SELECTOR; - (void)setSegmentBackgroundColor:(UIColor *)segmentBackgroundColor UI_APPEARANCE_SELECTOR; - (void)setControlEventBlock:(URBSegmentedControlBlock)controlEventBlock; @end @interface UIImage (URBSegmentedControl) - (UIImage *)imageTintedWithColor:(UIColor *)color; @end
// // AppDelegate.h // DecoratorPattern // // Created by Vito on 13-11-15. // Copyright (c) 2013年 Vito. All rights reserved. // #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
// // bridging-header.h // BitWake // // Created by Niklas Berglund on 2017-07-08. // Copyright © 2017 Niklas Berglund. All rights reserved. // #import "NSMenu+setHasPadding.h"
// // SMActivityEventBuilder.h // SessionMEventsKit // // Copyright © 2018 SessionM. All rights reserved. // #ifndef __SM_ACTIVITY_EVENT_BUILDER__ #define __SM_ACTIVITY_EVENT_BUILDER__ #import "SMEventBuilder.h" #import "SMActivityEvent.h" NS_ASSUME_NONNULL_BEGIN /*! @class SMActivityEventBuilder @abstract Class used for building <code>SMActivityEvent</code> objects that represent a basic activity event performed by the user to make progress towards completing an application-specific campaign. */ @interface SMActivityEventBuilder : SMEventBuilder /*! @abstract Generates an activity event based on the builder's current configuration. @result The generated <code>SMActivityEvent</code> object. */ - (SMActivityEvent *)build; @end NS_ASSUME_NONNULL_END #endif /* __SM_ACTIVITY_EVENT_BUILDER__ */
// // JJProductCell.h // Footprints // // Created by Jinjin on 14/12/3. // Copyright (c) 2014年 JiaJun. All rights reserved. // #import <UIKit/UIKit.h> typedef void(^ExchangeBlock)(GiftProductModel *model); @interface JJProductCell : UITableViewCell @property (weak, nonatomic) IBOutlet UIView *realCotent; @property (weak, nonatomic) IBOutlet UILabel *nameLabel; @property (weak, nonatomic) IBOutlet UILabel *jifenLabel; @property (weak, nonatomic) IBOutlet UIImageView *avatarLabel; @property (weak, nonatomic) IBOutlet UIButton *exchangeBtn; @property (nonatomic,strong) GiftProductModel *model; @property (nonatomic,strong) ExchangeBlock exChangeBlock; @property (weak, nonatomic) IBOutlet UILabel *countLabel; - (IBAction)exchangeBtnDidTap:(id)sender; @end
#ifndef __NV_FACE_MLP_STATIC_H #define __NV_FACE_MLP_STATIC_H #include "nv_core.h" #include "nv_ml.h" #ifdef __cplusplus extern "C" { #endif extern nv_mlp_t nv_face_mlp_dir; extern nv_mlp_t nv_face_mlp_parts; extern nv_mlp_t nv_face_mlp_face_00; extern nv_mlp_t nv_face_mlp_face_01; extern nv_mlp_t nv_face_mlp_face_02; #ifdef __cplusplus } #endif #endif
#ifndef INCLUDED_openfl__legacy_events_KeyboardEvent #define INCLUDED_openfl__legacy_events_KeyboardEvent #ifndef HXCPP_H #include <hxcpp.h> #endif #ifndef INCLUDED_openfl__legacy_events_Event #include <openfl/_legacy/events/Event.h> #endif HX_DECLARE_CLASS3(openfl,_legacy,events,Event) HX_DECLARE_CLASS3(openfl,_legacy,events,KeyboardEvent) namespace openfl{ namespace _legacy{ namespace events{ class HXCPP_CLASS_ATTRIBUTES KeyboardEvent_obj : public ::openfl::_legacy::events::Event_obj{ public: typedef ::openfl::_legacy::events::Event_obj super; typedef KeyboardEvent_obj OBJ_; KeyboardEvent_obj(); Void __construct(::String type,hx::Null< bool > __o_bubbles,hx::Null< bool > __o_cancelable,hx::Null< int > __o_charCodeValue,hx::Null< int > __o_keyCodeValue,hx::Null< int > __o_keyLocationValue,hx::Null< bool > __o_ctrlKeyValue,hx::Null< bool > __o_altKeyValue,hx::Null< bool > __o_shiftKeyValue,hx::Null< bool > __o_controlKeyValue,hx::Null< bool > __o_commandKeyValue); public: inline void *operator new( size_t inSize, bool inContainer=true,const char *inName="openfl._legacy.events.KeyboardEvent") { return hx::Object::operator new(inSize,inContainer,inName); } static hx::ObjectPtr< KeyboardEvent_obj > __new(::String type,hx::Null< bool > __o_bubbles,hx::Null< bool > __o_cancelable,hx::Null< int > __o_charCodeValue,hx::Null< int > __o_keyCodeValue,hx::Null< int > __o_keyLocationValue,hx::Null< bool > __o_ctrlKeyValue,hx::Null< bool > __o_altKeyValue,hx::Null< bool > __o_shiftKeyValue,hx::Null< bool > __o_controlKeyValue,hx::Null< bool > __o_commandKeyValue); static Dynamic __CreateEmpty(); static Dynamic __Create(hx::DynamicArray inArgs); //~KeyboardEvent_obj(); HX_DO_RTTI_ALL; Dynamic __Field(const ::String &inString, hx::PropertyAccess inCallProp); static bool __GetStatic(const ::String &inString, Dynamic &outValue, hx::PropertyAccess inCallProp); Dynamic __SetField(const ::String &inString,const Dynamic &inValue, hx::PropertyAccess inCallProp); static bool __SetStatic(const ::String &inString, Dynamic &ioValue, hx::PropertyAccess inCallProp); void __GetFields(Array< ::String> &outFields); static void __register(); ::String __ToString() const { return HX_HCSTRING("KeyboardEvent","\xd3","\x8d","\x88","\x91"); } static void __boot(); static ::String KEY_DOWN; static ::String KEY_UP; bool altKey; int charCode; bool ctrlKey; bool controlKey; bool commandKey; int keyCode; int keyLocation; bool shiftKey; virtual ::openfl::_legacy::events::Event clone( ); virtual ::String toString( ); }; } // end namespace openfl } // end namespace _legacy } // end namespace events #endif /* INCLUDED_openfl__legacy_events_KeyboardEvent */
#include <stdio.h> #include <unistd.h> #include <fcntl.h> #include <errno.h> #include <assert.h> #include <sys/epoll.h> #include "reactor.h" struct state { reactor_handler input; reactor_handler output; char buffer[4096]; data remaining; }; int fill(struct state *state) { ssize_t n; n = read(0, state->buffer, sizeof state->buffer); if (n == 0) { reactor_delete(&state->input, 0); reactor_delete(&state->output, 1); return -1; } if (n == -1 && errno == EAGAIN) return -1; assert(n > 0); state->remaining = data_construct(state->buffer, n); reactor_modify(&state->input, 0, 0); reactor_modify(&state->output, 1, EPOLLOUT | EPOLLET); return 0; } int flush(struct state *state) { ssize_t n; n = write(1, data_base(state->remaining), data_size(state->remaining)); if (n == -1 && errno == EAGAIN) return -1; assert(n > 0); state->remaining = data_select(state->remaining, n, data_size(state->remaining) - n); if (!data_size(state->remaining)) { reactor_modify(&state->input, 0, EPOLLIN | EPOLLET); reactor_modify(&state->output, 1, 0); } return 0; } void input(reactor_event *event) { struct state *state = event->state; int e; while (!data_size(state->remaining)) { e = fill(state); if (e == -1) break; e = flush(state); if (e == -1) break; } } void output(reactor_event *event) { struct state *state = event->state; int e; while (data_size(state->remaining)) { e = flush(state); if (e == -1) break; } } int main() { struct state state = {0}; fcntl(0, F_SETFL, O_NONBLOCK); fcntl(1, F_SETFL, O_NONBLOCK); reactor_construct(); reactor_handler_construct(&state.input, input, &state); reactor_handler_construct(&state.output, output, &state); reactor_add(&state.input, 0, EPOLLIN); reactor_add(&state.output, 1, EPOLLOUT); reactor_loop(); reactor_destruct(); }
/** * Your Copyright Here * * Appcelerator Titanium is Copyright (c) 2009-2010 by Appcelerator, Inc. * and licensed under the Apache Public License (version 2) */ #import <UIKit/UIKit.h> #import "TiModule.h" @class iPhoneHTTPServerViewController; @class HTTPServer; @interface Com0x82WebserverModule : TiModule { HTTPServer *httpServer; BOOL wasRunning; } @property (nonatomic, assign) NSNumber* disconnectsInBackground; -(id)startServer:(id)args; @end
/* * Generated by class-dump 3.3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard. */ #import <CoreData/NSSQLIntermediate.h> // Not exported @interface NSSQLLimitIntermediate : NSSQLIntermediate { unsigned long long _limit; } - (id)generateSQLStringInContext:(id)arg1; - (id)initWithLimit:(unsigned long long)arg1 inScope:(id)arg2; @end
// // Copyright (C) 2006-2008 Mateusz Loskot // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // #ifndef SOCI_PLATFORM_H_INCLUDED #define SOCI_PLATFORM_H_INCLUDED #if defined(_MSC_VER) || defined(__MINGW32__) #define LL_FMT_FLAGS "I64" #else #define LL_FMT_FLAGS "ll" #endif // Portability hacks for Microsoft Visual C++ compiler #ifdef _MSC_VER #include <stdlib.h> // Define if you have the vsnprintf variants. #if _MSC_VER < 1500 # define vsnprintf _vsnprintf #endif // Define if you have the snprintf variants. #if _MSC_VER < 1900 #define snprintf _snprintf #endif // Define if you have the strtoll and strtoull variants. #if _MSC_VER < 1300 # error "Visual C++ versions prior 1300 don't support _strtoi64 and _strtoui64" #elif _MSC_VER >= 1300 && _MSC_VER < 1800 namespace std { inline long long strtoll(char const* str, char** str_end, int base) { return _strtoi64(str, str_end, base); } inline unsigned long long strtoull(char const* str, char** str_end, int base) { return _strtoui64(str, str_end, base); } } #endif // _MSC_VER < 1800 #endif // _MSC_VER #if defined(__CYGWIN__) || defined(__MINGW32__) #include <stdlib.h> namespace std { using ::strtoll; using ::strtoull; } #endif #endif // SOCI_PLATFORM_H_INCLUDED
// // BABAudioPlaylist.h // Pods // // Created by Bryn Bodayle on May/12/2015. // // #import <Foundation/Foundation.h> @interface BABAudioPlaylist : NSObject + (instancetype)audioPlaylistWithArray:(NSArray *)array; - (instancetype)initWithArray:(NSArray *)array; - (id)objectAtIndexedSubscript:(NSUInteger)idx; - (void)setObject:(id)obj atIndexedSubscript:(NSUInteger)idx; @property (nonatomic, readonly) NSInteger count; @end
/* * Search first occurence of a particular string in a given text [Finite Automata] * Author: Progyan Bhattacharya <[email protected]> * Repo: Design-And-Analysis-of-Algorithm [MIT LICENSE] */ #include "Search.h" static int NextState(int m, char* pattern, int state, int symbol) { if (state < m && pattern[state] == symbol) { return state + 1; } for (int next = state, prev = next - 1, i = 0; next > 0; next--) { if (pattern[prev] == symbol) { for (i = 0; i < prev; i++) { if (pattern[i] != pattern[state - next + 1 + i]) { break; } } if (i == prev) { return next; } } } return 0; } static void GenerateTable(int m, char* pattern, int Table[m][CHAR_MAX]) { for (int state = 0, symbol = 0; symbol < CHAR_MAX || (symbol = 0, ++state) < m; symbol++) { Table[state][symbol] = NextState(m, pattern, state, symbol); } } int Search(int n, char* haystack, int m, char* needle) { int Table[m + 1][CHAR_MAX], state = 0; GenerateTable(m + 1, needle, Table); for (int i = 0; i < n; i++) { state = Table[state][haystack[i]]; if (state == m) { return (i - m + 1); } } return -1; }
/************************ BUBBLE SORT Author:Rhysn Date:2015 *************************/ #include <stdio.h> #include <stdlib.h> typedef int ElemType; void swap(ElemType *left,ElemType *right){ ElemType temp = *left; *left = *right; *right = temp; } void BubbleSort(ElemType *array,int num){ if(num == 1) return; ElemType *left = array,*right = array + 1; int key = num; while(--key){ if(*left > *right) swap(left,right); left++; right++; } BubbleSort(array,--num); } int main(){ int a[14]; int *b=a; int num = 14; srand((unsigned)time(NULL)); while (num--) *b++ = rand()%10; b=a; num=14; while(num--){ printf("%d ",*b++ ); } printf("\n"); BubbleSort(a,14); num = 14; b=a; while(num--){ printf("%d ",*b++ ); } printf("\n"); return 0; }
/**************************************************************** Copyright (C) 2014 All rights reserved. > File Name: < echo_server.c > > Author: < Sean Guo > > Mail: < [email protected] > > Created Time: < 2014/06/19 > > Last Changed: < 2015/11/30 > > Description: echo server for ARM //{{{ int bind(int sockfd, struct sockaddr * my_addr, int addrlen); bind()用来设置给参数sockfd 的socket 一个名称. 此名称由参数my_addr 指向一个sockaddr 结构, 对于不同的socket domain 定义了一个通用的数据结构 struct sockaddr { unsigned short int sa_family; char sa_data[14]; }; 1、sa_family 为调用socket()时的domain 参数, 即AF_xxxx 值. 2、sa_data 最多使用14 个字符长度. 此sockaddr 结构会因使用不同的socket domain 而有不同结构定义, 例如使用AF_INET domain,其socketaddr 结构定义便为 struct socketaddr_in { unsigned short int sin_family; uint16_t sin_port; struct in_addr sin_addr; unsigned char sin_zero[8]; }; struct in_addr { uint32_t s_addr; }; 1、sin_family 即为sa_family 2、sin_port 为使用的port 编号 3、sin_addr. s_addr 为IP 地址 sin_zero 未使用. 参数 addrlen 为sockaddr 的结构长度. 返回值:成功则返回0, 失败返回-1, 错误原因存于errno 中. 错误代码: 1、EBADF 参数sockfd 非合法socket 处理代码. 2、EACCESS 权限不足 3、ENOTSOCK 参数sockfd 为一文件描述词, 非socket. //}}} Usage: ./echo_server ****************************************************************/ //{{{ include files #include <stdio.h> #include <sys/socket.h> #include <sys/wait.h> // waitpid() #include <stdlib.h> // exit(); #include <string.h> // bzero(); #include <netinet/in.h> // struct sockaddr_in; #include <time.h> // time(); #include <arpa/inet.h> // inet_pton(); #include <unistd.h> // write(); #include <errno.h> // errno #include <signal.h> // SIGCHLD //}}} #define MAXLINE 4096 /* max text line length */ #define LISTENQ 1024 /* 2nd argument to listen() , 排队的最大连接数*/ #define LISTEN_PORT 9669 //服务器监听端口 //参数: 已连接的socket描述符. //功能: echo此socket发送的一切数据; //阻塞函数, 直到对方socket关闭. void str_echo(int sockfd); //信号处理函数, 将等待一个子进程的结束。 void sig_child(int signo); int main(int argc, char **argv) //{{{ { int listenfd, connfd; struct sockaddr_in server_addr, client_addr; socklen_t addr_len; char buffer[MAXLINE]; pid_t child_pid; listenfd = socket(AF_INET, SOCK_STREAM, 0); bzero(&server_addr, sizeof(server_addr)); server_addr.sin_family = AF_INET; server_addr.sin_addr.s_addr = htonl(INADDR_ANY); server_addr.sin_port = htons(LISTEN_PORT); // int bind(int sockfd, struct sockaddr * my_addr, int addrlen); // bind()用来设置给参数sockfd 的socket 一个名称. // 此名称由参数my_addr 指向一个sockaddr 结构, 对于不同的socket domain 定义了一个通用的数据结构 bind(listenfd, (struct sockaddr *) &server_addr, sizeof(server_addr)); // int listen(int s, int backlog); // listen()用来监听描述符s 的socket连接请求. // 参数backlog 指定同时能处理的最大连接要求, 如果连接数目达此上限则client 端将收到ECONNREFUSED 的错误. // listen()并未开始接收连接请求, 只设置socket 为listen 模式,真正接收client 端连线的是accept(). // 通常listen()会在socket(), bind()之后调用, 接着才调用accept(). // 成功则返回0, 失败返回-1, 错误原因存于errno // listen()只适用SOCK_STREAM 或SOCK_SEQPACKET 的socket 类型. // 如果socket 为AF_INET 则参数backlog 最大值可设至128. listen(listenfd, LISTENQ); signal(SIGCHLD, sig_child); //为SIGCHLD匹配自定义的函数, 使得处理子进程僵死的问题. //主进程就为一个监听端口, 为每个连接fork一个新的进程. for ( ; ; ) { addr_len = sizeof(client_addr); // int accept(int s, struct sockaddr * addr, int * addrlen); // accept()用来接受描述符s 的socket连接请求. // socket 必需先经bind()、listen()函数处理过, // 当有连接请求进来时, accept()会返回一个新的socket 处理代码, 往后的数据传送与读取就是经由新的socket处理, // 而原来参数s 的socket 能继续使用accept()来接受新的连线要求. // 连线成功时, 参数addr 所指的结构会被系统填入远程主机的地址数据, 参数addrlen 为scokaddr 的结构长度. // 成功则返回新的socket 处理代码, 失败返回-1, 错误原因存于errno 中. connfd = accept(listenfd, (struct sockaddr *) &client_addr, &addr_len); //创建子进程处理客户端请求, 主进程继续监听. child_pid = fork(); if(child_pid < 0) //failed to fork a process. { fprintf(stderr, "error: failed in fork()\n"); exit(1); } else if(child_pid == 0) //the child process. { close(listenfd); //close listenfd in child process. str_echo(connfd); //the task of child process - As a echo server. exit(0); } else // the parent process. close(connfd); //close connfd in parent process. //调用close()只会减少对应socket描述符的引用数, 当引用数为0才会清楚对应的socket. } }//}}} void str_echo(int sockfd) //{{{ { ssize_t n; char buf[1024]; again: while( (n = read(sockfd, buf, 1024)) > 0) //不断从sockfd中读取数据 write(sockfd, buf, n); if(n < 0 && errno == EINTR) //由于信号中断(EINTR)而没有读取到数据时, 返回while循环. goto again; else if( n < 0) //无法读取数据 perror("str_echo: read error"); }//}}} //信号处理函数, 将等待一个子进程的结束。 void sig_child(int signo) //{{{ { pid_t pid; int state; //pid = wait(&state); //等待一个子进程的结束 while( (pid = waitpid(-1, &state, WNOHANG)) > 0) //使用非阻塞的waitpid等待可结束的所有子进程 printf("child pid[%d] terminated.\n", pid); }//}}}
#ifndef BUTTONS_H #define BUTTONS_H #include "FreeRTOS.h" /* hardware button state */ struct button_state_t { /* STATE WRITTEN IN IRQ HANDLER */ /* current button state: 0 (up, released) or 1 (down, pressed) */ int st; /* the cpu-tick time when the current state (up or down) was recorded */ TickType_t tick; /* STATE UPDATED IN OS TASK */ /* the cpu-tick time when the button was last pressed; * used for detecting short and long button clicks in ButtonTask */ TickType_t kdwn_tick; /* the cpu-tick time when the event BTN_LONGCLICK was last sent */ TickType_t longclick_sent_tick; }; /* buttons identification */ #define BTN0 0 #define BTN1 1 #define BTN2 2 /* mask for BTNx */ #define BTNx_M 0xFF /* button event */ #define BTN_DOWN 0x100 #define BTN_UP 0x200 #define BTN_SHORTCLICK 0x400 #define BTN_LONGCLICK 0x800 /* hardware ports and pins */ #define HW_BTN0_Port GPIOB #define HW_BTN1_Port GPIOB #define HW_BTN2_Port GPIOB #define HW_BTN0_Pin GPIO_Pin_5 #define HW_BTN1_Pin GPIO_Pin_6 #define HW_BTN2_Pin GPIO_Pin_7 /* dead time in milliseconds - supress hardware glitches */ #define BUTTON_DEAD_TM 10 /* max short click time in miliseconds */ #define BUTTON_SHORTCLICK_TM 1000 /* repetition time of BTN_LONGCLICK events once long-click is recognized */ #define BUTTON_LONGCLICK_REPE_TM 800 /* current button state */ extern struct button_state_t btnsts[3]; /* IRQ handler for button state change */ void EXTI9_5_IRQHandler(void); /* OS task handling buttons events */ void ButtonsTask(void *pvParameters); #endif
// // GUISlider.h // GUIPlayerView // // Created by Guilherme Araújo on 08/12/14. // Copyright (c) 2014 Guilherme Araújo. All rights reserved. // #import <UIKit/UIKit.h> @interface GUISlider : UISlider - (void)setSecondaryValue:(float)value; - (void)setSecondaryTintColor:(UIColor *)tintColor; @property (nonatomic, retain) NSNumber * thick; @end @interface GUISlider (extra) @property(nonatomic, assign) NSNumber* thickNess; @end
// ------------------------------------------------------------------------------------- // Author: Sourabh S Joshi (cbrghostrider); Copyright - All rights reserved. // For email, run on linux (perl v5.8.5): // perl -e 'print pack "H*","736f75726162682e732e6a6f73686940676d61696c2e636f6d0a"' // ------------------------------------------------------------------------------------- // Author - Sourabh S Joshi #ifndef POKER_HAND_H_ #define POKER_HAND_H_ #include <iostream> #include <array> #include <vector> #include <string> #include <sstream> using std::vector; using std::ostream; using std::pair; class Card { public: enum CardSuit { Clubs, Diamonds, Hearts, Spades, NUM_SUITS }; enum CardVal { Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten, Jack, Queen, King, Ace, NUM_VALS }; Card(CardSuit suit, CardVal val) : suit_(suit), val_(val) {} ~Card() {} //comparison operators only compare on value of card bool operator==(const Card& rhs) const { return (val_ == rhs.val_);} bool operator<(const Card& rhs) const { return (val_ < rhs.val_);} bool operator>(const Card& rhs) const { return (val_ > rhs.val_);} CardVal GetVal() const {return val_;} CardSuit GetSuit() const {return suit_;} friend ostream& operator<<(ostream& os, const Card& cd); private: CardSuit suit_; CardVal val_; }; class Pokerhand { public: enum HandType { PHHighCard, PHPair, PHTwoPair, PHThreeOfAKind, PHStraight, PHFlush, PHFullHouse, PHFourOfAKind, PHStraightFlush, PH_NUM_TYPES }; Pokerhand(std::string istr); virtual ~Pokerhand() {} vector<Card> AllCards() const {return hand_;} vector<Card> TieBreakCards() const {return tiebreak_cards_;} HandType GetType() const {return type_;} std::string GetTypeStr() const; //comparison to compare 2 poker hands bool operator>(const Pokerhand& rhs) const {return (Compare_(rhs) == PH_GT);} bool operator<(const Pokerhand& rhs) const {return (Compare_(rhs) == PH_LT);} bool operator==(const Pokerhand& rhs) const {return (Compare_(rhs) == PH_EQ);} friend ostream& operator<<(ostream& os, const Pokerhand& ph); void ProcessPokerHand(); private: //each of these methods returns a bool, saying whether the poker hand is of that type //also returns a vector of cards in order, so that tie-breakers can be resolved Card* XOfAKind__(unsigned int num); bool XOfAKind_(unsigned int num); bool MNOfAKind_(unsigned int m, unsigned int n); bool HighCard_(); bool Pair_(); bool TwoPair_(); bool ThreeOfAKind_(); bool Straight_(); bool Flush_(); bool FullHouse_(); bool FourOfAKind_(); bool StraightFlush_(); //since C++ STL lacks an ordering type, I am forced to create one enum Ordering { PH_LT, PH_EQ, PH_GT }; Ordering Compare_(const Pokerhand& rhs) const; private: vector<Card> hand_; HandType type_; vector<Card> tiebreak_cards_; }; int PlayPokerHands(vector<std::pair<int, Pokerhand> >& hands); bool DetectCheating(vector<std::pair<int, Pokerhand> >& hands); #endif /* POKER_HAND_H_ */
// // 2016-01-21, jjuiddong // // »ç°¢ÇüÀ» ã´Â´Ù. // #pragma once namespace cvproc { class cDetectRect { public: cDetectRect(); virtual ~cDetectRect(); bool Init(); bool Detect(const cv::Mat &src); void UpdateParam(const cRecognitionEdgeConfig &recogConfig); public: bool m_show; cRectContour m_rect; int m_threshold1; int m_threshold2; int m_minArea; double m_minCos; double m_maxCos; vector<vector<cv::Point> > m_contours; cv::Mat m_gray; cv::Mat m_edges; cv::Mat m_binMat; }; }
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // #import "CDStructures.h" #import <IDEKit/IDENavigableItemDomainProvider.h> @interface IDENavigableItemSymbolsDomainProvider : IDENavigableItemDomainProvider { } + (id)domainObjectForWorkspace:(id)arg1; @end
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // #import "NSObject.h" @class KFContact; @protocol IKFContactExt <NSObject> @optional - (void)onKFContactHeadImgUpdate:(KFContact *)arg1; - (void)onModifyKFContact:(KFContact *)arg1; @end
#ifndef _absnodeaction_h_ #define _absnodeaction_h_ #include "cocos2d.h" using namespace cocos2d; #include <string> #include <iostream> #include <vector> using namespace std; namespace uilib { class TouchNode; enum EaseType { EaseNone, EaseIn, EaseOut, EaseInOut, EaseExponentialIn, EaseExponentialOut, EaseExponentialInOut, EaseSineIn, EaseSineOut, EaseSineInOut, EaseElastic, EaseElasticIn, EaseElasticOut, EaseElasticInOut, EaseBounce, EaseBounceIn, EaseBounceOut, EaseBounceInOut, EaseBackIn, EaseBackOut, EaseBackInOut }; enum MoveInType{ HorizontalRightIn, HorizontalLeftIn, HorizontalBothIn, VerticalTopIn, VerticalBottomIn, VerticalBothin, ScaleIn, ScaleXIn, ScaleYIn, SwayIn, RotateIn, BlinkIn, ReelIn, FireIn, DropScaleIn }; enum MoveOutType{ HorizontalRightOut, HorizontalLeftOut, HorizontalBothOut, VerticalTopOut, VerticalBottomOut, VerticalBothOut, ScaleOut, ScaleXOut, ScaleYOut, SwayOut, RotateOut, BlinkOut, ReelOut, FireOut }; enum RunningEffectType { ShineEffect, SwayEffect, ScaleEffect, AnimEffect }; class BasNodeEffectAction : public CCNode { public: BasNodeEffectAction(); virtual ~BasNodeEffectAction(); virtual void finished(); virtual void doAction(TouchNode *node,bool enable) = 0; inline void setEaseType(EaseType type) { m_easeType = type;} inline EaseType getEaseType() { return m_easeType;} inline void setActionTime(float time) { m_actionTime = time;} inline float getActionTime() { return m_actionTime;} inline void setStartTime(float time) { m_startTime = time;} inline float getStartTime() { return m_startTime;} void setFinishCB(CCNode *listener,SEL_CallFuncN func); inline bool isRunning() { return m_running;} protected: EaseType m_easeType; float m_actionTime; float m_startTime; protected: bool m_running; protected: SEL_CallFuncN m_finishFunc; CCNode *m_listener; }; class BasNodeAction : public CCNode { public: BasNodeAction(); virtual ~BasNodeAction(); virtual void finished(); virtual void doAction(const std::vector<TouchNode*> &nodes) = 0; void setDelayTime(float delay) { m_delayTime = delay;} float getDelayTime() { return m_delayTime;} inline void setEaseType(EaseType type) { m_easeType = type;} inline EaseType getEaseType() { return m_easeType;} inline void setMoveInType(MoveInType type) { m_inType = type;} inline MoveInType getMoveInType() { return m_inType;} inline void setMoveOutType(MoveOutType type) { m_outType = type;} inline MoveOutType getMoveOutType() { return m_outType;} inline void setActionTime(float time) { m_actionTime = time;} inline float getActionTime() { return m_actionTime;} inline void setStartTime(float time) { m_startTime = time;} inline float getStartTime() { return m_startTime;} inline void setRate(float rate) { m_rate = rate;} inline float getRate() { return m_rate;} void setFinishCB(CCNode *listener,SEL_CallFuncN func,CCNode *actionNode = 0); protected: CCActionEase *createEaseAction(); protected: int m_actionRunNum; float m_delayTime; EaseType m_easeType; MoveInType m_inType; MoveOutType m_outType; float m_actionTime; float m_rate; float m_startTime; protected: SEL_CallFuncN m_finishFunc; CCNode *m_listener; CCNode *m_actionNode; }; class UiNodeActionFactory { UiNodeActionFactory(); ~UiNodeActionFactory(); static UiNodeActionFactory *m_instance; public: static UiNodeActionFactory *getInstance(); BasNodeAction *getMoveActionByName(const std::string &name); BasNodeEffectAction *getEffectActionByName(const std::string &name); protected: }; } #endif
// Copyright (c) 2017-2017 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_CONSENSUS_TX_VERIFY_H #define BITCOIN_CONSENSUS_TX_VERIFY_H #include "amount.h" #include <stdint.h> #include <vector> class CBlockIndex; class CCoinsViewCache; class CTransaction; class CValidationState; /** Transaction validation functions */ /** Context-independent validity checks */ bool CheckTransaction(const CTransaction& tx, CValidationState& state); namespace Consensus { /** * Check whether all inputs of this transaction are valid (no double spends and amounts) * This does not modify the UTXO set. This does not check scripts and sigs. * @param[out] txfee Set to the transaction fee if successful. * Preconditions: tx.IsCoinBase() is false. */ bool CheckTxInputs(const CTransaction& tx, CValidationState& state, const CCoinsViewCache& inputs, int nSpendHeight, CAmount& txfee); } // namespace Consensus /** Auxiliary functions for transaction validation (ideally should not be exposed) */ /** * Count ECDSA signature operations the old-fashioned (pre-0.6) way * @return number of sigops this transaction's outputs will produce when spent * @see CTransaction::FetchInputs */ unsigned int GetLegacySigOpCount(const CTransaction& tx); /** * Count ECDSA signature operations in pay-to-script-hash inputs. * * @param[in] mapInputs Map of previous transactions that have outputs we're spending * @return maximum number of sigops required to validate this transaction's inputs * @see CTransaction::FetchInputs */ unsigned int GetP2SHSigOpCount(const CTransaction& tx, const CCoinsViewCache& mapInputs); /** * Count total signature operations for a transaction. * @param[in] tx Transaction for which we are counting sigops * @param[in] inputs Map of previous transactions that have outputs we're spending * @param[out] flags Script verification flags * @return Total signature operation count for a tx */ unsigned int GetTransactionSigOpCount(const CTransaction& tx, const CCoinsViewCache& inputs, int flags); /** * Check if transaction is final and can be included in a block with the * specified height and time. Consensus critical. */ bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64_t nBlockTime); /** * Calculates the block height and previous block's median time past at * which the transaction will be considered final in the context of BIP 68. * Also removes from the vector of input heights any entries which did not * correspond to sequence locked inputs as they do not affect the calculation. */ std::pair<int, int64_t> CalculateSequenceLocks(const CTransaction &tx, int flags, std::vector<int>* prevHeights, const CBlockIndex& block); bool EvaluateSequenceLocks(const CBlockIndex& block, std::pair<int, int64_t> lockPair); /** * Check if transaction is final per BIP 68 sequence numbers and can be included in a block. * Consensus critical. Takes as input a list of heights at which tx's inputs (in order) confirmed. */ bool SequenceLocks(const CTransaction &tx, int flags, std::vector<int>* prevHeights, const CBlockIndex& block); #endif // BITCOIN_CONSENSUS_TX_VERIFY_H
#include <compiler.h> #if defined(CPUCORE_IA32) && defined(SUPPORT_MEMDBG32) #include <common/strres.h> #include <cpucore.h> #include <pccore.h> #include <io/iocore.h> #include <generic/memdbg32.h> #define MEMDBG32_MAXMEM 16 #define MEMDBG32_DATAPERLINE 128 #define MEMDBG32_LEFTMARGIN 8 typedef struct { UINT mode; int width; int height; int bpp; CMNPAL pal[MEMDBG32_PALS]; } MEMDBG32; static MEMDBG32 memdbg32; static const char _mode0[] = "Real Mode"; static const char _mode1[] = "Protected Mode"; static const char _mode2[] = "Virtual86"; static const char *modestr[3] = {_mode0, _mode1, _mode2}; static const RGB32 md32pal[MEMDBG32_PALS] = { RGB32D(0x33, 0x33, 0x33), RGB32D(0x00, 0x00, 0x00), RGB32D(0xff, 0xaa, 0x00), RGB32D(0xff, 0x00, 0x00), RGB32D(0x11, 0x88, 0x11), RGB32D(0x00, 0xff, 0x00), RGB32D(0xff, 0xff, 0xff)}; void memdbg32_initialize(void) { ZeroMemory(&memdbg32, sizeof(memdbg32)); memdbg32.width = (MEMDBG32_BLOCKW * MEMDBG32_DATAPERLINE) + MEMDBG32_LEFTMARGIN; memdbg32.height = (MEMDBG32_BLOCKH * 2 * MEMDBG32_MAXMEM) + 8; } void memdbg32_getsize(int *width, int *height) { if (width) { *width = memdbg32.width; } if (height) { *height = memdbg32.height; } } REG8 memdbg32_process(void) { return(MEMDBG32_FLAGDRAW); } BOOL memdbg32_paint(CMNVRAM *vram, CMNPALCNV cnv, BOOL redraw) { UINT mode; UINT8 use[MEMDBG32_MAXMEM*MEMDBG32_DATAPERLINE*2 + 256]; UINT32 pd[1024]; UINT pdmax; UINT i, j; UINT32 pde; UINT32 pdea; UINT32 pte; char str[4]; mode = 0; if (CPU_STAT_PM) { mode = 1; } if (CPU_STAT_VM86) { mode = 2; } if (memdbg32.mode != mode) { memdbg32.mode = mode; redraw = TRUE; } if ((!redraw) && (!CPU_STAT_PAGING)) { return(FALSE); } if (vram == NULL) { return(FALSE); } if ((memdbg32.bpp != vram->bpp) || (redraw)) { if (cnv == NULL) { return(FALSE); } (*cnv)(memdbg32.pal, md32pal, MEMDBG32_PALS, vram->bpp); memdbg32.bpp = vram->bpp; } cmndraw_fill(vram, 0, 0, memdbg32.width, memdbg32.height, memdbg32.pal[MEMDBG32_PALBDR]); ZeroMemory(use, sizeof(use)); if (CPU_STAT_PAGING) { pdmax = 0; for (i=0; i<1024; i++) { pde = cpu_memoryread_d(CPU_STAT_PDE_BASE + (i * 4)); if (pde & CPU_PDE_PRESENT) { for (j=0; j<pdmax; j++) { if (!((pde ^ pd[j]) & CPU_PDE_BASEADDR_MASK)) { break; } } if (j < pdmax) { pd[j] |= pde & CPU_PDE_ACCESS; } else { pd[pdmax++] = pde; } } } for (i=0; i<pdmax; i++) { pde = pd[i]; pdea = pde & CPU_PDE_BASEADDR_MASK; for (j=0; j<1024; j++) { pte = cpu_memoryread_d(pdea + (j * 4)); if ((pte & CPU_PTE_PRESENT) && (pte < 0x1000000/16*MEMDBG32_MAXMEM/128*MEMDBG32_DATAPERLINE)) { if ((pde & CPU_PDE_ACCESS) && (pte & CPU_PTE_ACCESS)) { use[pte >> 12] = MEMDBG32_PALPAGE1; } else if (!use[pte >> 12]) { use[pte >> 12] = MEMDBG32_PALPAGE0; } } } } } else { FillMemory(use, 256, MEMDBG32_PALREAL); FillMemory(use + (0xfa0000 >> 12), (0x60000 >> 12), MEMDBG32_PALREAL); if ((CPU_STAT_PM) && (pccore.extmem)) { FillMemory(use + 256, MIN(MEMDBG32_DATAPERLINE * 2 * pccore.extmem, sizeof(use) - 256), MEMDBG32_PALPM); } } for (i=0; i<MEMDBG32_MAXMEM*2; i++) { for (j=0; j<MEMDBG32_DATAPERLINE; j++) { cmndraw_fill(vram, MEMDBG32_LEFTMARGIN + j * MEMDBG32_BLOCKW, i * MEMDBG32_BLOCKH, MEMDBG32_BLOCKW - 1, MEMDBG32_BLOCKH - 1, memdbg32.pal[use[(i * MEMDBG32_DATAPERLINE) + j]]); } } for (i=0; i<MEMDBG32_MAXMEM; i++) { SPRINTF(str, "%x", i); cmddraw_text8(vram, 0, i * MEMDBG32_BLOCKH * 2, str, memdbg32.pal[MEMDBG32_PALTXT]); } cmddraw_text8(vram, 0, memdbg32.height - 8, modestr[mode], memdbg32.pal[MEMDBG32_PALTXT]); return(TRUE); } #endif
// // opjlib.h // opjlib // // Created by Rich Stoner on 11/26/13. // Copyright (c) 2013 WholeSlide. All rights reserved. // #import <Foundation/Foundation.h> @interface opjlib : NSObject @end
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QApplication> #include <QMainWindow> #include <QTextEdit> #include <QMenu> #include <QMenuBar> #include <QAction> #include <QDialog> #include <QDesktopWidget> #include <QMdiArea> #include <QMdiSubWindow> #include <QDockWidget> #include <QTreeWidget> #include <QProcess> #include <QTimer> #include <vector> #include <cassert> #include "CodeArea.h" #include "Console.h" #include "FnSelectDialog.h" #include "Outline.h" class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow(); QSize sizeHint() const; void flattenedOutline(FlattenedOutline *outline) const; signals: public slots: void fnSelect(); void toggleSimple(); void openFileDialog(); void saveFile(); void saveFileAsDialog(); void setActiveCodeArea(QMdiSubWindow *area); void runProgram(); void runPythonParser(); void updateConsoleFromProcess(); void updateCodeOutlineFromProcess(int exitCode, QProcess::ExitStatus exitStatus); void jumpToFunction(QTreeWidgetItem* item, int column); private: QMdiArea *mainArea; // process QProcess *programProcess; QProcess *pythonParserProcess; // console Console *console; QDockWidget *consoleDock; // editor CodeArea *activeCodeArea; std::vector<CodeArea*> codeAreas; FnSelectDialog *fnSelectDialog; // code outline QTreeWidget *codeOutline; QDockWidget *codeOutlineDock; std::vector<OutlineClass> outlineClasses; QTreeWidgetItem *functionsHeader; // timer QTimer *parseTimer; // console actions QAction *runProgramAction; // menus QMenu *fileMenu; QMenu *helpMenu; // menu actions QAction *openFileAction; QAction *saveFileAction; QAction *saveFileAsAction; // code actions QAction *fnSelectAction; // ui actions QAction *toggleSimpleAction; bool usingSimple; // project actions QAction *addFileToProjectAction; QAction *removeFileFromProjectAction; // git actions QAction *openGitDialogAction; // program actions QAction *exitProgramAction; // meta QString lastUsedDirectory; }; #endif
#ifdef __OBJC__ #import <UIKit/UIKit.h> #else #ifndef FOUNDATION_EXPORT #if defined(__cplusplus) #define FOUNDATION_EXPORT extern "C" #else #define FOUNDATION_EXPORT extern #endif #endif #endif FOUNDATION_EXPORT double FlowCoreVersionNumber; FOUNDATION_EXPORT const unsigned char FlowCoreVersionString[];
// // CollectionViewCell.h // Timetable // // Created by FuShouqiang on 16/10/18. // Copyright © 2016年 fu. All rights reserved. // #import <UIKit/UIKit.h> //课程表主CollectionView @interface CollectionViewCell : UICollectionViewCell @property (nonatomic, copy) NSString *cellName; @property (nonatomic, copy) NSString *place; @property (nonatomic, assign) NSInteger signNumber; @end
// // VisibleBuildConfig.h // VisibleBuildConfig // // Created by David Li on 11/09/2017. // // #import <Foundation/Foundation.h> #define kVisibleBuildConfigChanged @"kVisibleBuildConfigChanged" @interface VisibleBuildConfig : NSObject //ConfigName is reqired and unique @property(nonatomic, strong) NSString *configName; + (instancetype)sharedInstance; //setup configuration data with plist - (void)setupWithPlist:(NSString *)plistFile; //Fix to use the build config with Release parameter valued YES. If no Release, use the first. - (void)setAsRelease; //Enable left swipe to show build config browser - (void)enableSwipe; //Show build config browser - (void)showConfigBrowser; //Get value with key from the current build config data - (id)configValueForKey:(NSString *)key; @end
// // AppDelegate.h // topController // // Created by 张衡 on 2016/11/18. // Copyright © 2016年 张衡. All rights reserved. // #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
// // BBBClockViewController.h // BBBLayer // // Created by LinBin on 16/7/23. // Copyright © 2016年 LinBin. All rights reserved. // #import <UIKit/UIKit.h> @interface BBBClockViewController : UIViewController @end
// Copyright (c) 2009 Satoshi Nakamoto // Distributed under the MIT/X11 software license, see the accompanying // file license.txt or http://www.opensource.org/licenses/mit-license.php. // // Why base-58 instead of standard base-64 encoding? // - Don't want 0OIl characters that look the same in some fonts and // could be used to create visually identical looking account numbers. // - A string with non-alphanumeric characters is not as easily accepted as an account number. // - E-mail usually won't line-break if there's no punctuation to break at. // - Doubleclicking selects the whole number as one word if it's all alphanumeric. // static const char* pszBase58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; inline string EncodeBase58(const unsigned char* pbegin, const unsigned char* pend) { CAutoBN_CTX pctx; CBigNum bn58 = 58; CBigNum bn0 = 0; // Convert big endian data to little endian // Extra zero at the end make sure bignum will interpret as a positive number vector<unsigned char> vchTmp(pend-pbegin+1, 0); reverse_copy(pbegin, pend, vchTmp.begin()); // Convert little endian data to bignum CBigNum bn; bn.setvch(vchTmp); // Convert bignum to string string str; str.reserve((pend - pbegin) * 138 / 100 + 1); CBigNum dv; CBigNum rem; while (bn > bn0) { if (!BN_div(&dv, &rem, &bn, &bn58, pctx)) throw bignum_error("EncodeBase58 : BN_div failed"); bn = dv; unsigned int c = rem.getulong(); str += pszBase58[c]; } // Leading zeroes encoded as base58 zeros for (const unsigned char* p = pbegin; p < pend && *p == 0; p++) str += pszBase58[0]; // Convert little endian string to big endian reverse(str.begin(), str.end()); return str; } inline string EncodeBase58(const vector<unsigned char>& vch) { return EncodeBase58(&vch[0], &vch[0] + vch.size()); } inline bool DecodeBase58(const char* psz, vector<unsigned char>& vchRet) { CAutoBN_CTX pctx; vchRet.clear(); CBigNum bn58 = 58; CBigNum bn = 0; CBigNum bnChar; while (isspace(*psz)) psz++; // Convert big endian string to bignum for (const char* p = psz; *p; p++) { const char* p1 = strchr(pszBase58, *p); if (p1 == NULL) { while (isspace(*p)) p++; if (*p != '\0') return false; break; } bnChar.setulong(p1 - pszBase58); if (!BN_mul(&bn, &bn, &bn58, pctx)) throw bignum_error("DecodeBase58 : BN_mul failed"); bn += bnChar; } // Get bignum as little endian data vector<unsigned char> vchTmp = bn.getvch(); // Trim off sign byte if present if (vchTmp.size() >= 2 && vchTmp.end()[-1] == 0 && vchTmp.end()[-2] >= 0x80) vchTmp.erase(vchTmp.end()-1); // Restore leading zeros int nLeadingZeros = 0; for (const char* p = psz; *p == pszBase58[0]; p++) nLeadingZeros++; vchRet.assign(nLeadingZeros + vchTmp.size(), 0); // Convert little endian data to big endian reverse_copy(vchTmp.begin(), vchTmp.end(), vchRet.end() - vchTmp.size()); return true; } inline bool DecodeBase58(const string& str, vector<unsigned char>& vchRet) { return DecodeBase58(str.c_str(), vchRet); } inline string EncodeBase58Check(const vector<unsigned char>& vchIn) { // add 4-byte hash check to the end vector<unsigned char> vch(vchIn); uint256 hash = Hash(vch.begin(), vch.end()); vch.insert(vch.end(), (unsigned char*)&hash, (unsigned char*)&hash + 4); return EncodeBase58(vch); } inline bool DecodeBase58Check(const char* psz, vector<unsigned char>& vchRet) { if (!DecodeBase58(psz, vchRet)) return false; if (vchRet.size() < 4) { vchRet.clear(); return false; } uint256 hash = Hash(vchRet.begin(), vchRet.end()-4); if (memcmp(&hash, &vchRet.end()[-4], 4) != 0) { vchRet.clear(); return false; } vchRet.resize(vchRet.size()-4); return true; } inline bool DecodeBase58Check(const string& str, vector<unsigned char>& vchRet) { return DecodeBase58Check(str.c_str(), vchRet); } static const unsigned char ADDRESSVERSION = 0; inline string Hash160ToAddress(uint160 hash160) { // add 1-byte version number to the front vector<unsigned char> vch(1, ADDRESSVERSION); vch.insert(vch.end(), UBEGIN(hash160), UEND(hash160)); return EncodeBase58Check(vch); } inline bool AddressToHash160(const char* psz, uint160& hash160Ret) { vector<unsigned char> vch; if (!DecodeBase58Check(psz, vch)) return false; if (vch.empty()) return false; unsigned char nVersion = vch[0]; if (vch.size() != sizeof(hash160Ret) + 1) return false; memcpy(&hash160Ret, &vch[1], sizeof(hash160Ret)); return (nVersion <= ADDRESSVERSION); } inline bool AddressToHash160(const string& str, uint160& hash160Ret) { return AddressToHash160(str.c_str(), hash160Ret); } inline bool IsValidBitcoinAddress(const char* psz) { uint160 hash160; return AddressToHash160(psz, hash160); } inline bool IsValidBitcoinAddress(const string& str) { return IsValidBitcoinAddress(str.c_str()); } inline string PubKeyToAddress(const vector<unsigned char>& vchPubKey) { return Hash160ToAddress(Hash160(vchPubKey)); }
#include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <sys/wait.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <signal.h> #include <errno.h> #include <sys/stat.h> #include <sys/mman.h> #include <fcntl.h> #include "server.h" #include "rio.h" int writeTo(int fd, char * string) { return write(fd, string, strlen(string)); } void err_dump(int fd, int status, char * err_msg) { char line[LINE_SIZE]; snprintf(line, LINE_SIZE, "HTTP/1.1 %d %s\r\n\r\n", status, err_msg); writeTo(fd, line); snprintf(line, LINE_SIZE, "ERROR: %d\r\n", status); writeTo(fd, line); snprintf(line, LINE_SIZE, "ERROR MESSAGE: %s\r\n\r\n", err_msg); writeTo(fd, line); } void sig_int(int signo) { exit(0); } void sig_child(int signo) { signal(SIGCHLD, sig_child); while (waitpid(-1, NULL, WNOHANG) > 0) ; } void initServer() { /* 忽略 sigpipe 信号 */ signal(SIGPIPE, SIG_IGN); signal(SIGINT, sig_int); signal(SIGCHLD, sig_child); } /* 打开监听 */ int open_listenfd(int port) { int sockfd, res; struct sockaddr_in addr; /* 创建socket */ sockfd = socket(AF_INET, SOCK_STREAM, 0); if (sockfd < 0) { fprintf(stderr, "socket error\n"); exit(1); } printf("创建socket成功\n"); /* 初始化地址 */ addr.sin_family = AF_INET; addr.sin_port = htons(PORT); addr.sin_addr.s_addr = htonl(INADDR_ANY); printf("初始化地址成功\n"); /* 绑定地址 */ res = bind(sockfd, (const struct sockaddr *)&addr, sizeof(addr)); if (res < 0) { fprintf(stderr, "bind error\n"); exit(1); } printf("绑定地址 %s:%d 成功\n", inet_ntoa(addr.sin_addr), PORT); /* 监听 */ res = listen(sockfd, 50); if (res < 0) { fprintf(stderr, "listen error\n"); exit(1); } printf("监听成功\n"); return sockfd; } void handleUri(int fd, const char * uri) { char whole_uri[URI_LEN] = DOCUMENT_ROOT; int ffd; /* 文件描述符 */ struct stat f_statue; char * buf; if (uri[0] == '/') { uri += 1; } strncat(whole_uri, uri, URI_LEN); if (stat(whole_uri, &f_statue) < 0) { err_dump(fd, 404, "Not Found"); return; } if (! S_ISREG(f_statue.st_mode)) { err_dump(fd, 403, "Not Regular File"); return; } if ((ffd = open(whole_uri, O_RDONLY)) < 0) { err_dump(fd, 403, "Forbidden"); return; } buf = (char *)mmap((void *)0, f_statue.st_size, PROT_READ, MAP_PRIVATE, ffd, 0); if (buf == MAP_FAILED) { err_dump(fd, 501, "Mmap Error"); return; } writeTo(fd, "HTTP/1.1 200 OK\r\n\r\n"); writeTo(fd, buf); } void doit(int fd) { char line[LINE_SIZE]; char method[10], uri[URI_LEN], version[10]; rio_t rio; rio_init(&rio, fd); if (rio_readline(&rio, line, LINE_SIZE) <= 0) { err_dump(fd, 400, "Bad Request"); return; } if (sscanf(line, "%s %s %s", method, uri, version) != 3) { err_dump(fd, 400, "Bad Request"); return; } while(rio_readline(&rio, line, LINE_SIZE) > 0) { if (strcmp(line, "\r\n") == 0) { break; } } if (strcmp(method, "GET") != 0) { err_dump(fd, 501, "No Method"); return; } handleUri(fd, uri); } int main() { int fd, sockfd, pid, num; socklen_t client_len; struct sockaddr_in client_addr; char * client_ip; initServer(); sockfd = open_listenfd(PORT); num = 0; /* 等待请求 */ while (1) { while ((fd = accept(sockfd, (struct sockaddr *)&client_addr, &client_len)) < 0) { if (errno != EINTR) { /* 不是被信号处理函数中断 */ fprintf(stderr, "accept error\n"); exit(1); } } ++num; client_ip = inet_ntoa(client_addr.sin_addr); printf("请求 %d: %s\n", num, client_ip); if ((pid = fork()) < 0) { fprintf(stderr, "fork error\n"); exit(1); } else if (pid == 0) { /* child */ close(sockfd); doit(fd); printf("结束 %d: %s\n", num, client_ip); exit(0); } close(fd); } return 0; }
// Copyright slx7R4GDZM // Distributed under the terms of the MIT License. // Refer to the License.txt file for details. #pragma once #include "Common-Things.h" const string BRIGHTNESS_OPTIONS[] = { "BRIGHTNESS 15", "BRIGHTNESS 12", "BRIGHTNESS 7", "BRIGHTNESS 0" }; const string GLOBAL_SCALE_OPTIONS[] = { "GLOBAL SCALE (*2)", "GLOBAL SCALE (*1)", "GLOBAL SCALE (/2)", "GLOBAL SCALE (/4)" }; const string VCTR_OPTIONS[] = { "LOCAL SCALE UP", "LOCAL SCALE DOWN", "LOCAL SCALE (/512)", "LOCAL SCALE (*1)" }; const string LABS_OPTIONS[] = { "GLOBAL SCALE UP", "GLOBAL SCALE DOWN", "GLOBAL SCALE (*1)", "GLOBAL SCALE (/2)" }; const string SVEC_OPTIONS[] = { "LOCAL SCALE UP", "LOCAL SCALE DOWN", "LOCAL SCALE (*2)", "LOCAL SCALE (*16)" }; const string SHIP_CREATOR_OPTIONS[] = { "BRIGHTNESS UP", "BRIGHTNESS DOWN", "BRIGHTNESS 0", "BRIGHTNESS 12" }; ///////////////// const array<string, 5> MAIN_MENU_CHOICES = { "EDIT VECTOR OBJECT", "EDIT TEXT", "EDIT SHIP", "EDIT SHIP THRUST", "TOGGLE VECTORS" }; const array<string, 3> INSTRUCTION_MENU_CHOICES = { "DRAW LONG VECTOR", "LOAD ABSOLUTE", "DRAW SHORT VECTOR" }; const array<string, 5> VECTOR_OBJECT_MENU_CHOICES = { "ADD INSTRUCTION", "REMOVE INSTRUCTION", "SET GLOBAL SCALE", "OUTPUT VECTOR OBJECT", "CLEAR VECTOR OBJECT" }; const array<string, 4> SHIP_MENU_CHOICES = { "ADD INSTRUCTION", "REMOVE INSTRUCTION", "OUTPUT SHIP", "CLEAR SHIP" }; const array<string, 4> THRUST_MENU_CHOICES = { "ADD INSTRUCTION", "REMOVE INSTRUCTION", "OUTPUT SHIP THRUST", "CLEAR SHIP THRUST" }; const array<string, 3> TOGGLE_VECTORS_MENU_CHOICES = { "BOX", "VECTOR OBJECT", "SHIP AND THRUST" }; const string DEFAULT_SETTINGS = R"(# Lines starting with # are ignored by the program #============================================================================== # List of Available Keys #============================================================================== # Escape F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15 Pause # Tilde Num1 Num2 Num3 Num4 Num5 Num6 Num7 Num8 Num9 Num0 Hyphen Equal # Tab Q W E R T Y U I O P LBracket RBracket Backslash Backspace # A S D F G H J K L Semicolon Quote Enter # LShift Z X C V B N M Comma Period Slash RShift # LControl LSystem LAlt Space RAlt RSystem Menu RControl # Insert Home PageUp Divide Multiply Subtract # Delete End PageDown Numpad7 Numpad8 Numpad9 Add # Numpad4 Numpad5 Numpad6 # Up Numpad1 Numpad2 Numpad3 # Left Down Right Numpad0 #============================================================================== # Button Settings #============================================================================== B-Confirm E B-Cancel F B-Up W B-Down S B-Left A B-Right D B-Options Q B-Toggle-Fullscreen F11 B-Exit Escape #============================================================================== # Window Settings #============================================================================== ## Which mode to start the window with # 0 = Normal window (default) # 1 = Borderless window # 2 = Exclusive fullscreen Starting-Window-Mode 0 ## Starting window resolution Starting-X-Resolution 1024 Starting-Y-Resolution 790 ## Starting position for the program window # -1 = Don't set the starting position (default) Start-Window-Position-X -1 Start-Window-Position-Y -1 ## What to do when the window isn't focused # 0 = Pause the program (default) # 1 = Run in background without input # 2 = Run in background with input Inactive-Mode 0 #============================================================================== # Graphics Settings #============================================================================== ## The x:y ratio to crop the image to # < 1 = Crops the image starting with the left and right sides # 1.0 = Scales the image to the lower resolution axis # > 1 = Crops the image starting with the top and bottom (default) Crop-Ratio 1.2962025 ## MSAA toggle and quality setting # 0 = Off # 1 = 2x # 2 = 4x # 3 = 8x (default) MSAA-Quality 3 ## Gamma correction Gamma-Correction 1.0 ## Vertical synchronization # 0 = Disabled (default) # 1 = Enabled V-Sync-Enabled 0 ## Whether to use busy waiting or sleeping to limit FPS # 0 = Use sleeping (default) # 1 = Use busy waiting; this has high CPU usage, but it's consistent Frame-Limit-Mode 0 )";
/** * TatoSSO Single Sign On (SSO) system * * Copyright (C) 2014 Allan SIMON <[email protected]> * See accompanying file COPYING.TXT file for licensing details. * * @category TatoSSO * @author Allan SIMON <[email protected]> * @package Contents * */ #ifndef TATO_SSO_CONTENTS_TOKENS_H #define TATO_SSO_CONTENTS_TOKENS_H #include "cppcms_skel/contents/content.h" #include "contents/forms/external_login.h" //%%%NEXT_CONTENT_FORM_INCLUDE_MARKER%%% namespace tatosso { namespace contents { namespace tokens { /** * @class Tokens * @brief Base content for every action of Tokens controller * @since 31 March 2014 */ struct Tokens : public ::contents::BaseContent { }; /** * @struct CheckToken * @since 31 March 2014 */ struct CheckToken : public Tokens { CheckToken() { } }; /** * @struct ExternalLogin * @since 31 March 2014 */ struct ExternalLogin : public Tokens { forms::tokens::ExternalLogin externalLoginForm; /** * @brief Constructor */ ExternalLogin() { } }; //%%%NEXT_CONTENT_MARKER%%% } // end of namespace tokens } // end of namespace contents } // end of namespace tatosso #endif
#include "udivmodti4.h" __int128 __modti3(__int128 a, __int128 b) { unsigned __int128 r; unsigned __int128 sign = a >> 127; udivmodti4_(a + sign ^ sign, b < 0 ? -b : b, &r); return r + sign ^ sign; }
/* * 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" @class NSMutableDictionary, NSString; // Not exported @interface GQZArchive : NSObject { NSMutableDictionary *mEntries; id <GQZArchiveInputStream> mInput; _Bool mIsEncrypted; NSString *mFilename; } - (id)filename; - (_Bool)isEncrypted; - (id)entryNames; - (id)entryWithName:(id)arg1; - (void)dealloc; - (id)initWithData:(id)arg1 collapseCommonRootDirectory:(_Bool)arg2; - (id)initWithPath:(id)arg1 collapseCommonRootDirectory:(_Bool)arg2; @end
/* * mysplit.c - Another handy routine for testing your tiny shell * * usage: mysplit <n> * Fork a child that spins for <n> seconds in 1-second chunks. */ #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <sys/types.h> #include <sys/wait.h> #include <signal.h> int main(int argc, char **argv) { int i, secs; if (argc != 2) { fprintf(stderr, "Usage: %s <n>\n", argv[0]); exit(0); } secs = atoi(argv[1]); if (fork() == 0) { /* child */ for (i=0; i < secs; i++) sleep(1); exit(0); } /* parent waits for child to terminate */ wait(NULL); exit(0); }
#pragma once #include "interface/types.h" inline uintptr_t get_return_address() { uintptr_t ret; asm volatile("movq 8(%%rbp), %0" : "=r"(ret) : : "memory"); return ret; }
// // UIView+WebCacheOperation.h // SKWebImage // // Created by 侯森魁 on 2019/8/23. // Copyright © 2019 侯森魁. All rights reserved. // #import <UIKit/UIKit.h> #import "SKWebImageCompat.h" #import "SKWebImageManager.h" NS_ASSUME_NONNULL_BEGIN @interface UIView (WebCacheOperation) /** Set the image load operation (storage in a view based dictionary) @param operation <#operation description#> */ - (void)sk_setImageloadOperation:(nullable id)operation forKey:(nullable NSString *)key; /** Cancel all operation for the current UiView and key @param key <#key description#> */ - (void)sk_cancelImageLoadOperationWithKey:(nullable NSString *)key; /** Just remove the operation corresponding to the UIView and key without cancelling them @param key <#key description#> */ - (void)sk_removeImageLoadOperationWithKey:(nullable NSString *)key; @end NS_ASSUME_NONNULL_END
// // ///////////////////////////////////////////////////////////////////////////// // // Copyright 2014 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. // ////////////////////////////////////////////////////////////////////////////// // // // truetypetext.h - General-purpose TrueType functions // // DESCRIPTION: // // This header file contains declarations of general-purpose truetype text // functions provided with the AcUtil library and DLL. // #ifndef _TRUETYPETEXT_H_ #define _TRUETYPETEXT_H_ #define UC_DEGREE_SYMBOL 0x00B0 #define UC_PLUSMINUS_SYMBOL 0x00B1 #define UC_PHI_SYMBOL 0x00D8 // The Character 'phi' (substitute for diameter) #define UC_DIAMETER_SYMBOL 0x2205 // Most fonts do not have this. typedef void (*LineSegmentCallback) (const AcGePoint3d &, const AcGePoint3d &, const void *); struct TextParams { double height; // Text Height double width_scale; // Width Scale Factor double oblique_angle; // Obliquing/Italics Angle double rotation_angle; // Rotation Angle double spacing; // Inter Character Spacing Percent short flags; // Text Generation Flags }; class Scores { private: int m_overline; int m_underline; int m_strikethrough; AcGePoint3d m_position; AcGePoint3d m_over_point[2]; AcGePoint3d m_under_point[2]; AcGePoint3d m_strikethrough_point[2]; AcGePoint3d m_bbox[4]; TextParams const * m_pTextParams; LineSegmentCallback m_pLineSegmentCB; void * m_pAction; AcGiContext * m_pContext; #define ON 1 #define OFF 0 public: Scores(AcGiContext * pContext, TextParams const * pTextParams, LineSegmentCallback pLineSegment, void * pAction); ~Scores () {}; void over_score (const wchar_t* text, int length); void under_score (const wchar_t * text, int length); void strikethrough_score(const wchar_t * text, int length); void close_scores (const wchar_t * text, int length); void draw_vector (AcGePoint3d const & p1, AcGePoint3d const & p2); }; void process_uc_string ( WCHAR * uc_string, int & uc_length, TextParams const * tp, BOOL draw_scores, LineSegmentCallback line_segment = NULL, void * action = NULL); void process_underoverline( const WCHAR * uc_string, int uc_length, TextParams const * tp, LineSegmentCallback line_segment, void * action = NULL); int convert_to_unicode( const char * pMultiByteString, int nMultiByteLength, WCHAR * pUnicodeString, int & nUnicodeLength, bool bInformUser); int convert_to_unicode( UINT iCharset, const char * pMultiByteString, int nMultiByteLength, WCHAR * pUnicodeString, int & nUnicodeLength, bool bInformUser); class TrueTypeUnicodeBuffer { public: TrueTypeUnicodeBuffer(LPCTSTR text, int length, bool raw, int charset) : m_bDynamicBuffer(false), m_bValid(true) { if (length < -1) { m_iLen = -length - 1; m_pBuffer = (LPWSTR)text; return; } if (length != -1) m_iLen = length; else { const size_t nLen = ::wcslen(text); #ifdef ASSERT #define TrueTypeText_Assert ASSERT #elif defined(assert) #define TrueTypeText_Assert assert #elif defined(_ASSERTE) #define TrueTypeText_Assert _ASSERTE #else #define TrueTypeText_Assert(x) #endif TrueTypeText_Assert(nLen < 0x7FFFFFFE); // 2G-1 sanity check TrueTypeText_Assert(nLen == (int)nLen); // 64-bit portability m_iLen = (int)nLen; } if (!raw) { // only need temporary string if converting %% sequences size_t nSize; if (m_iLen + 1 > m_kBufferLen) { m_bDynamicBuffer = true; m_pBuffer = new WCHAR [m_iLen + 1]; nSize = m_iLen + 1; if (!m_pBuffer) { m_bValid = false; return; } } else { m_pBuffer = m_sBuffer; nSize = m_kBufferLen; } _tcsncpy_s(m_pBuffer, nSize, text, m_iLen); m_pBuffer[m_iLen] = 0; } else { // It is okay to cast away constness here -- we only call process_underoverline // which takes a const pointer m_pBuffer = const_cast<wchar_t *>(text); } } ~TrueTypeUnicodeBuffer() { if (m_bDynamicBuffer) delete [] m_pBuffer; } LPWSTR buf() const { return m_pBuffer; } int len() const { return m_iLen; } bool valid() const { return m_bValid; } private: static const int m_kBufferLen = 256; bool m_bValid; LPWSTR m_pBuffer; int m_iLen; bool m_bDynamicBuffer; WCHAR m_sBuffer[m_kBufferLen]; }; #endif // _TRUETYPETEXT_H_
// // SA_DiceEvaluator.h // // Copyright (c) 2016 Said Achmiz. // // This software is licensed under the MIT license. // See the file "LICENSE" for more information. #import <Foundation/Foundation.h> @class SA_DiceBag; @class SA_DiceExpression; /************************************************/ #pragma mark SA_DiceEvaluator class declaration /************************************************/ @interface SA_DiceEvaluator : NSObject /************************/ #pragma mark - Properties /************************/ @property NSUInteger maxDieCount; @property NSUInteger maxDieSize; /****************************/ #pragma mark - Public methods /****************************/ -(SA_DiceExpression *) resultOfExpression:(SA_DiceExpression *)expression; @end
/* database.h Author: Pixel Flash Server database.h contains the class definition for the database class used by the cuCare server to store data persistently */ #ifndef DATABASE_H #define DATABASE_H #include <QtSql> #include <QDebug> class Database { public: Database(); ~Database(); QSqlQuery query(QString query_string); void close(); bool opened(); private: QSqlDatabase db; }; #endif // DATABASE_H
#ifndef ABB_VALUE_H #define ABB_VALUE_H #include <type_traits> #include <tuple> namespace abb { class und_t {}; class pass_t {}; const und_t und; const pass_t pass; template<typename Value> struct is_und : std::is_same<Value, und_t> {}; template<typename Value> struct is_pass : std::is_same<Value, pass_t> {}; template<typename Value> struct is_special : std::integral_constant<bool, is_und<Value>::value || is_pass<Value>::value> {}; template<typename T> class inplace_args; template<typename Ret, typename... Args> class inplace_args<Ret(Args...)> : private std::tuple<Args...> { public: using std::tuple<Args...>::tuple; template<std::size_t Index> typename std::tuple_element<Index, std::tuple<Args...>>::type const& get() const { return std::get<Index>(*this); } }; template<typename Ret = pass_t, typename... Args> inplace_args<Ret(Args &&...)> inplace(Args &&... args) { return inplace_args<Ret(Args &&...)>(std::forward<Args>(args)...); } namespace internal { template<typename Arg> struct normalize_arg { typedef Arg type; }; template<typename Ret, typename... Args> struct normalize_arg<inplace_args<Ret(Args...)>> { static_assert(!is_special<Ret>::value, "Expected inplace_args to contain valid object type"); typedef Ret type; }; template<typename Arg> struct normalize_arg<std::reference_wrapper<Arg>> { typedef Arg & type; }; template<typename Arg> using normalize_arg_t = typename normalize_arg<Arg>::type; template<typename Value> struct normalize_value { typedef void type(normalize_arg_t<Value>); }; template<> struct normalize_value<und_t> { typedef und_t type; }; template<typename Return, typename... Args> struct normalize_value<Return(Args...)> {}; template<typename... Args> struct normalize_value<void(Args...)> { typedef void type(normalize_arg_t<Args>...); }; template<> struct normalize_value<void> { typedef void type(); }; } // namespace internal template<typename Arg> using get_result_t = typename Arg::result; template<typename Arg> using get_reason_t = typename Arg::reason; template<typename Value> using normalize_value_t = typename internal::normalize_value<Value>::type; template<typename Value, typename OtherValue> struct is_value_substitutable : std::integral_constant< bool, std::is_same<Value, OtherValue>::value || std::is_same<OtherValue, und_t>::value > {}; namespace internal { template<typename... Types> struct common_value {}; template<> struct common_value<> { typedef und_t type; }; template<typename Type> struct common_value<Type> { typedef Type type; }; template<typename First, typename Second> struct common_value<First, Second> { typedef typename std::conditional<is_und<First>::value, Second, First>::type type; static_assert(is_value_substitutable<type, Second>::value, "Incompatible types"); }; template<typename First, typename Second, typename... Types> struct common_value<First, Second, Types...> : common_value<typename common_value<First, Second>::type, Types...> {}; } // namespace internal template<typename... Types> using common_value_t = typename internal::common_value<Types...>::type; } // namespace abb #endif // ABB_VALUE_H
//================================================================================================= /*! // \file blazemark/blaze/TDVecSMatMult.h // \brief Header file for the Blaze transpose dense vector/sparse matrix multiplication kernel // // 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 _BLAZEMARK_BLAZE_TDVECSMATMULT_H_ #define _BLAZEMARK_BLAZE_TDVECSMATMULT_H_ //************************************************************************************************* // Includes //************************************************************************************************* #include <blazemark/system/Types.h> namespace blazemark { namespace blaze { //================================================================================================= // // KERNEL FUNCTIONS // //================================================================================================= //************************************************************************************************* /*!\name Blaze kernel functions */ //@{ double tdvecsmatmult( size_t N, size_t F, size_t steps ); //@} //************************************************************************************************* } // namespace blaze } // namespace blazemark #endif
/* * This file is part of the MicroPython project, http://micropython.org/ * * The MIT License (MIT) * * Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2015 Daniel Campora * * 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 MICROPY_INCLUDED_LIB_TIMEUTILS_TIMEUTILS_H #define MICROPY_INCLUDED_LIB_TIMEUTILS_TIMEUTILS_H typedef int64_t mp_time_t; typedef struct _timeutils_struct_time_t { uint16_t tm_year; // i.e. 2014 uint8_t tm_mon; // 1..12 uint8_t tm_mday; // 1..31 uint8_t tm_hour; // 0..23 uint8_t tm_min; // 0..59 uint8_t tm_sec; // 0..59 uint8_t tm_wday; // 0..6 0 = Monday uint16_t tm_yday; // 1..366 } timeutils_struct_time_t; bool timeutils_is_leap_year(mp_uint_t year); mp_uint_t timeutils_days_in_month(mp_uint_t year, mp_uint_t month); mp_uint_t timeutils_year_day(mp_uint_t year, mp_uint_t month, mp_uint_t date); void timeutils_seconds_since_2000_to_struct_time(mp_uint_t t, timeutils_struct_time_t *tm); mp_uint_t timeutils_seconds_since_2000(mp_uint_t year, mp_uint_t month, mp_uint_t date, mp_uint_t hour, mp_uint_t minute, mp_uint_t second); mp_uint_t timeutils_mktime(mp_uint_t year, mp_int_t month, mp_int_t mday, mp_int_t hours, mp_int_t minutes, mp_int_t seconds); void timeutils_seconds_since_epoch_to_struct_time(mp_time_t t, timeutils_struct_time_t *tm); mp_time_t timeutils_seconds_since_epoch(mp_uint_t year, mp_uint_t month, mp_uint_t date, mp_uint_t hour, mp_uint_t minute, mp_uint_t second); mp_time_t timeutils_mktime_epoch(mp_uint_t year, mp_int_t month, mp_int_t mday, mp_int_t hours, mp_int_t minutes, mp_int_t seconds); #endif // MICROPY_INCLUDED_LIB_TIMEUTILS_TIMEUTILS_H
#ifndef CAVALIERI_RULE_TESTER_UTIL_H #define CAVALIERI_RULE_TESTER_UTIL_H #include <vector> #include <common/event.h> #include <external/mock_external.h> typedef std::pair<time_t, Event> mock_index_events_t; std::vector<Event> json_to_events(const std::string json, bool & ok); std::string results(std::vector<mock_index_events_t> index_events, std::vector<external_event_t> external_events); #endif
// BASE64压缩接口 #ifndef _INCLUDE_BASE64_H #define _INCLUDE_BASE64_H #include <stdio.h> #include <stdlib.h> #include "sqlite3.h" // 标准Base64编码表 static char encoding_table[] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/'}; static char* decoding_table = NULL; static int mod_table[] = {0, 2, 1}; unsigned char* base64_encode(unsigned char* data, int input_length, int* output_length); unsigned char* base64_decode(unsigned char* data, int input_length, int* output_length); void build_decoding_table(); void base64_cleanup(); #endif // _INCLUDE_BASE64_H
#ifndef V_Phi_Error_Calculator_h #define V_Phi_Error_Calculator_h #include "Intensity_Moment_Data.h" #include "Cell_Data.h" #include "Fem_Quadrature.h" #include "Input_Reader.h" #include <algorithm> /** @file V_Phi_Error_Calculator.h * @author pmaginot * @brief Base class to implement interface for various measures to assess convergence of phi: L1, L2 , rho normalized L1, rho normalized L2, pointwise convergence check */ class V_Phi_Error_Calculator { public: V_Phi_Error_Calculator( const Fem_Quadrature& fem_quadrature, const Cell_Data& cell_data, const Angular_Quadrature& angular_quadrature); virtual ~V_Phi_Error_Calculator(){} virtual double calculate_phi_error_norm(const Intensity_Moment_Data& phi_new , const Intensity_Moment_Data& phi_old, const int iter) = 0; protected: const int m_n_cell; const int m_n_groups; const int m_n_l_mom; const int m_n_el; }; #endif
// Copyright 2017 The Lynx Authors. All rights reserved. #ifndef LYNX_BASE_THREADING_MESSAGE_PUMP_POSIX_H_ #define LYNX_BASE_THREADING_MESSAGE_PUMP_POSIX_H_ #include "base/task/task.h" #include "base/threading/condition.h" #include "base/threading/message_pump.h" #include "base/timer/timer.h" namespace base { class MessagePumpPosix : public MessagePump { public: MessagePumpPosix(); virtual ~MessagePumpPosix(); virtual void Run(Delegate* delegate); virtual void ScheduleWork(); virtual void ScheduleDelayedWork(Closure* closure, int delayed_time); virtual void ScheduleIntervalWork(Closure* closure, int delayed_time); virtual void Stop(); private: Condition condition_; Timer timer_; bool keep_running_; }; } // namespace base #endif // LYNX_BASE_THREADING_MESSAGE_PUMP_POSIX_H_
#ifndef OPENTISSUE_COLLISION_SDF_SDF_COMPUTE_POINT_SAMPLING_H #define OPENTISSUE_COLLISION_SDF_SDF_COMPUTE_POINT_SAMPLING_H // // OpenTissue Template Library // - A generic toolbox for physics-based modeling and simulation. // Copyright (C) 2008 Department of Computer Science, University of Copenhagen. // // OTTL is licensed under zlib: http://opensource.org/licenses/zlib-license.php // #include <OpenTissue/configuration.h> #include <OpenTissue/core/containers/mesh/mesh.h> #include <boost/cast.hpp> //--- Needed for boost::numerical_cast #include <list> namespace OpenTissue { namespace sdf { /** * Compute Point Sampling. * This function tries to resample a mesh geometry to better fit the * resolution of the corresponding signed distance map. * * @param mesh The surface mesh from which a point sampling is computed. * @param phi The signed distance field corresponding to the specified mesh. * * @param edge_resolution Threshold value, indicating the sampling * resolution along edges. If zero it will be * computed on the fly, to match the resolution * of the signed distance map. * * @param face_sampling Boolean flag indicating wheter face sampling is on or off. * * @param points Upon return this argument holds the computed point sampling. */ template<typename mesh_type,typename grid_type, typename point_container> void compute_point_sampling( mesh_type /*const*/ & mesh , grid_type const & phi , double edge_resolution , bool face_sampling , point_container & points ) { using std::min; using std::max; using std::sqrt; typedef typename mesh_type::vertex_iterator vertex_iterator; typedef typename mesh_type::halfedge_iterator halfedge_iterator; typedef typename mesh_type::face_iterator face_iterator; typedef typename mesh_type::face_type face_type; typedef typename mesh_type::halfedge_type halfedge_type; typedef typename mesh_type::face_halfedge_circulator face_halfedge_circulator; typedef typename std::list<face_type*> face_queue; typedef typename mesh_type::math_types math_types; typedef typename math_types::vector3_type vector3_type; typedef typename math_types::real_type real_type; assert(edge_resolution>=0 || !"compute_point_sampling(): edge resolution was negative"); mesh::clear_vertex_tags( mesh); mesh::clear_halfedge_tags( mesh); mesh::clear_face_tags( mesh); points.clear(); //--- Ignore vertices in flat regions for(vertex_iterator v = mesh.vertex_begin();v!=mesh.vertex_end();++v) { v->m_tag = 1; if(!is_convex( *v ) ) continue; points.push_back( v->m_coord ); } //--- long flat edges are linearly sub-samplet, to help catch edge-face intersections. real_type tmp = boost::numeric_cast<real_type>( edge_resolution ); real_type threshold = max(tmp, sqrt( phi.dx()*phi.dx() + phi.dy()*phi.dy() + phi.dz()*phi.dz() )); for(halfedge_iterator h = mesh.halfedge_begin();h!=mesh.halfedge_end();++h) { if(h->m_tag) continue; h->m_tag = 1; h->get_twin_iterator()->m_tag = 1; if(!is_convex( *h ) ) continue; vector3_type u = h->get_destination_iterator()->m_coord - h->get_origin_iterator()->m_coord; real_type lgth = sqrt(u*u); if(lgth>threshold) { u /= lgth; vector3_type p = h->get_origin_iterator()->m_coord; real_type t = threshold; while(t<lgth) { p += u*threshold; t += threshold; points.push_back( p ); } } } //--- Objects perfectly aligned along flat faces, may penetrate, to //--- avoid this, centroid point of flat regions are added to sample points. if(face_sampling) { vector3_type Ai,ai,ei; real_type area_test = max( phi.dx()*phi.dy(), max(phi.dx()*phi.dz(),phi.dy()*phi.dz())); for(face_iterator face = mesh.face_begin();face!=mesh.face_end();++face) { if(face->m_tag) continue; real_type area = 0; vector3_type centroid = vector3_type(0,0,0); unsigned int size = 0; face_queue Q; Q.push_back( &(*face) ); face->m_tag = 1; while(!Q.empty()) { face_type * cur = Q.front();Q.pop_front(); face_halfedge_circulator h(*cur),hend; for(;h!=hend;++h) { ai = h->get_origin_iterator()->m_coord; ei = h->get_destination_iterator()->m_coord - ai; Ai = ai % ei; area += 0.5*sqrt(Ai*Ai); ++size; centroid += h->get_origin_iterator()->m_coord; if(h->get_twin_iterator()->get_face_handle().is_null()) continue; face_type * neighbor = &(*h->get_twin_iterator()->get_face_iterator()); bool unseen = !neighbor->m_tag; // TODO 2007-02-08: polymesh specific, bad idea bool coplanar = is_planar(*h); if(unseen && coplanar) { neighbor->m_tag = 1; Q.push_back(neighbor); } } } if(size && area > area_test) { centroid /= size; points.push_back( centroid ); } } } } } // namespace sdf } // namespace OpenTissue // OPENTISSUE_COLLISION_SDF_SDF_COMPUTE_POINT_SAMPLING_H #endif
/* This is a managed file. Do not delete this comment. */ #include <include/lifecycle.h> static void echo(lifecycle_Foo this, char* hook) { corto_state s = corto_stateof(this); char *stateStr = corto_ptr_str(&s, corto_state_o, 0); corto_info("callback: %s [%s]", hook, stateStr); free(stateStr); } int16_t lifecycle_Foo_construct( lifecycle_Foo this) { echo(this, "construct"); return 0; } void lifecycle_Foo_define( lifecycle_Foo this) { echo(this, "define"); } void lifecycle_Foo_deinit( lifecycle_Foo this) { echo(this, "deinit"); } void lifecycle_Foo_delete( lifecycle_Foo this) { echo(this, "delete"); } void lifecycle_Foo_destruct( lifecycle_Foo this) { echo(this, "destruct"); } int16_t lifecycle_Foo_init( lifecycle_Foo this) { echo(this, "init"); return 0; } void lifecycle_Foo_update( lifecycle_Foo this) { echo(this, "update"); } int16_t lifecycle_Foo_validate( lifecycle_Foo this) { echo(this, "validate"); return 0; }
// // PCMenuPopView.h // PCMenuPopDemo // // Created by peichuang on 16/6/30. // Copyright © 2016年 peichuang. All rights reserved. // #import <UIKit/UIKit.h> @class PCMenuPopView; @protocol PCMenuPopViewDelegate <NSObject> //返回需要多少个菜单项 - (NSInteger)numberOfitemsInMenuPopView:(PCMenuPopView *)menuPopView; //配置对应菜单button - (void)menuPopView:(PCMenuPopView *)menuPopView configureWithMenuItem:(UIButton *)menuButton index:(NSInteger)index; //配置对应的button的位置 - (CGRect)menuPopView:(PCMenuPopView *)menuPopView rectForMenuItemWithIndex:(NSInteger)index; @end @interface PCMenuPopView : UIView @property (nonatomic, strong) UIButton *closeButton; @property (nonatomic, weak) id<PCMenuPopViewDelegate>delegate; - (void)showInView:(UIView *)view withPopButton:(UIButton *)popButton; - (void)hide; //根据index可以设置默认位置,从右到左的顺序 - (CGRect)defaultItemRectWithSize:(CGSize)size index:(NSInteger)index; @end
// // SR_ForgotPasswordViewController.h // scanreader // // Created by jbmac01 on 16/7/21. // Copyright © 2016年 jb. All rights reserved. // #import <UIKit/UIKit.h> @interface SR_ForgotPasswordViewController : UIViewController @end
// // NYSegmentedControl+CBDSettings.h // SmartMathsMP // // Created by Colas on 11/08/2015. // Copyright (c) 2015 cassiopeia. All rights reserved. // #import "NYSegmentedControl.h" @interface NYSegmentedControl (CBDSettings) - (void)setUpForSegmentColor:(UIColor *)segmentColor titleColor:(UIColor *)titleColor selectedTitleColor:(UIColor *)selectedTitleColor font:(UIFont *)font cornerRadius:(CGFloat)cornerRadius ; @end
// // Created by Kévin POLOSSAT on 14/01/2018. // #ifndef LW_TCP_SERVER_SOCKET_H #define LW_TCP_SERVER_SOCKET_H #include <memory> #include <type_traits> #include "Socket.h" #include "Reactor.h" #include "Buffer.h" #include "Operation.h" #include "SSLSocket.h" namespace lw_network { template<typename Sock = Socket> class ReactiveSocketBase : public Sock { static_assert(std::is_base_of<Socket, Sock>::value, "Socket base should be a derived class of Socket"); public: explicit ReactiveSocketBase(Reactor &reactor) : Sock(), reactor_(reactor) { register_(); } ReactiveSocketBase(Reactor &reactor, Sock socket): Sock(socket), reactor_(reactor) { register_(); } ~ReactiveSocketBase() = default; ReactiveSocketBase(ReactiveSocketBase const &other) = default; ReactiveSocketBase(ReactiveSocketBase &&other) = default; ReactiveSocketBase &operator=(ReactiveSocketBase const &other) { Sock::operator=(other); return *this; } ReactiveSocketBase &operator=(ReactiveSocketBase &&other) { Sock::operator=(other); return *this; } void close() { reactor_.unregisterHandler(this->getImpl(), lw_network::Reactor::read); reactor_.unregisterHandler(this->getImpl(), lw_network::Reactor::write); error_code ec = no_error; Sock::close(ec); } void async_read_some(Buffer b, std::function<void(std::size_t nbyte, error_code ec)> completionHandler); void async_read(Buffer b, std::function<void(std::size_t nbyte, error_code ec)> completionHandler); void async_write_some(Buffer b, std::function<void(std::size_t nbyte, error_code ec)> completionHandler); void async_write(Buffer b, std::function<void(std::size_t nbyte, error_code ec)> completionHandler); private: Reactor &reactor_; private: void register_() { reactor_.registerHandler(this->getImpl(), lw_network::Reactor::read); reactor_.registerHandler(this->getImpl(), lw_network::Reactor::write); } }; using ReactiveSocket = ReactiveSocketBase<>; using SSLReactiveSocket = ReactiveSocketBase<SSLSocket>; // TODO FACTORIZE template<typename T> class ReadOperation : public Operation { public: ReadOperation( ReactiveSocketBase<T> &s, Buffer b, std::function<void(std::size_t nbyte, error_code ec)> completionHandler): s_(s), ec_(no_error), nbyte_(0), b_(std::move(b)), completionHandler_(std::move(completionHandler)) {} bool handle() { nbyte_ = s_.recv(b_, 0, ec_); return b_.exhausted(); } void complete() { completionHandler_(nbyte_, ec_); } private: ReactiveSocketBase<T> &s_; error_code ec_; std::size_t nbyte_; Buffer b_; std::function<void(std::size_t nbyte, error_code ec)> completionHandler_; }; template<typename T> class WriteOperation : public Operation { public: WriteOperation( lw_network::ReactiveSocketBase<T> &s, lw_network::Buffer b, std::function<void(size_t, lw_network::error_code)> completionHandler): s_(s), ec_(no_error), nbyte_(0), b_(std::move(b)), completionHandler_(std::move(completionHandler)) {} bool handle() { nbyte_ = s_.send(b_, 0, ec_); return b_.exhausted(); } void complete() { completionHandler_(nbyte_, ec_); } private: ReactiveSocketBase<T> &s_; error_code ec_; std::size_t nbyte_; Buffer b_; std::function<void(std::size_t nbyte, error_code ec)> completionHandler_; }; template<typename T> class ReadSomeOperation : public Operation { public: ReadSomeOperation( lw_network::ReactiveSocketBase<T> &s, lw_network::Buffer b, std::function<void(size_t, lw_network::error_code)> completionHandler): s_(s), ec_(no_error), nbyte_(0), b_(std::move(b)), completionHandler_(std::move(completionHandler)) { } bool handle() { nbyte_ = s_.recv(b_, 0, ec_); return true; } void complete() { completionHandler_(nbyte_, ec_); } private: ReactiveSocketBase<T> &s_; error_code ec_; std::size_t nbyte_; Buffer b_; std::function<void(std::size_t nbyte, error_code ec)> completionHandler_; }; template<typename T> class WriteSomeOperation : public Operation { public: WriteSomeOperation( lw_network::ReactiveSocketBase<T> &s, lw_network::Buffer b, std::function<void(size_t, lw_network::error_code)> completionHandler): s_(s), ec_(no_error), nbyte_(0), b_(std::move(b)), completionHandler_(std::move(completionHandler)) {} bool handle() { nbyte_ = s_.send(b_, 0, ec_); return true; } void complete() { completionHandler_(nbyte_, ec_); } private: ReactiveSocketBase<T> &s_; error_code ec_; std::size_t nbyte_; Buffer b_; std::function<void(std::size_t nbyte, error_code ec)> completionHandler_; }; } #include "ReactiveSocketBase.icc" #endif //LW_TCP_SERVER_SOCKET_H
//-*-c++-*- /****************************************************************/ /** ** @file errors.h ** @brief Header file for CHILD error-handling routines. ** ** Created Dec. 97 ** $Id: errors.h,v 1.11 2004-01-07 10:53:25 childcvs Exp $ */ /****************************************************************/ #ifndef ERRORS_H #define ERRORS_H #include "../compiler.h" void ReportFatalError( const char *errStr ) ATTRIBUTE_NORETURN; void ReportWarning( const char *errstr ); #endif
// Copyright (c) 2011-2014 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_MACNOTIFICATIONHANDLER_H #define BITCOIN_QT_MACNOTIFICATIONHANDLER_H #include <QObject> /** Macintosh-specific notification handler (supports UserNotificationCenter). */ class MacNotificationHandler : public QObject { Q_OBJECT public: /** shows a macOS 10.8+ UserNotification in the UserNotificationCenter */ void showNotification(const QString &title, const QString &text); /** check if OS can handle UserNotifications */ bool hasUserNotificationCenterSupport(); static MacNotificationHandler *instance(); }; #endif // BITCOIN_QT_MACNOTIFICATIONHANDLER_H
// // DRHMotorUnitData.h // TAFPlotter // // Created by Lee Walsh on 9/01/2014. // Copyright (c) 2014 Lee Walsh. All rights reserved. // #import <Foundation/Foundation.h> @interface DRHMotorUnitData : NSObject <NSCoding>{ NSNumber *unitNumber; NSNumber *unitSet; NSString *unitType; NSNumber *onsetTime; NSNumber *peakTime; NSNumber *endTime; NSNumber *inspTime; NSNumber *onsetFreq; NSNumber *peakFreq; NSNumber *endFreq; NSNumber *tonicFreq; NSNumber *normOnsetTime; NSNumber *normPeakTime; NSNumber *normEndTime; } @property NSNumber *unitNumber; @property NSNumber *unitSet; @property NSString *unitType; @property NSNumber *onsetTime; @property NSNumber *peakTime; @property NSNumber *endTime; @property NSNumber *inspTime; @property NSNumber *onsetFreq; @property NSNumber *peakFreq; @property NSNumber *endFreq; @property NSNumber *tonicFreq; @property NSNumber *normOnsetTime; @property NSNumber *normPeakTime; @property NSNumber *normEndTime; -(DRHMotorUnitData *)initWith:(NSDictionary *)unitData; +(DRHMotorUnitData *)unitWith:(NSDictionary *)unitData; -(DRHMotorUnitData *)initBlank; +(DRHMotorUnitData *)blankUnit; @end
// // NFAnalogClockView+Extension.h // NFAnalogClock // // Created by Neil Francis Hipona on 12/1/16. // Copyright © 2016 Neil Francis Hipona. All rights reserved. // #import "NFAnalogClockView.h" @interface NFAnalogClockView (Extension) - (void)startTime; - (void)stopTime; - (NFTime *)updateClock; @end
/* Aranea * Copyright (c) 2011-2012, Quoc-Viet Nguyen * See LICENSE file for copyright and license details. */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <errno.h> #include <fcntl.h> #include <sys/socket.h> #include <sys/stat.h> #include <aranea/aranea.h> #define CGI_EXT_LEN_ ((int)sizeof(CGI_EXT) - 1) /** Buffer for CGI environment variables */ #define CGI_BUFF g_buff int cgi_hit(const char *name, const int len) { if (len > CGI_EXT_LEN_) { if (memcmp(name + len - CGI_EXT_LEN_, CGI_EXT, CGI_EXT_LEN_) == 0) { return 1; } } return 0; } /** Check if file is executable. * HTTP error code is set to client->response.status_code. */ static int cgi_is_executable(const char *path, struct client_t *client) { struct stat st; if (access(path, X_OK) != 0) { client->response.status_code = HTTP_STATUS_FORBIDDEN; return -1; } if (stat(path, &st) == -1) { A_ERR("stat: %s", strerror(errno)); client->response.status_code = HTTP_STATUS_SERVERERROR; return -1; } if (S_ISDIR(st.st_mode)) { client->response.status_code = HTTP_STATUS_FORBIDDEN; return -1; } return 0; } #define CGI_ADD_ENV_(env, cnt, buf, ...) \ do { \ *env = buf; \ len = sizeof(CGI_BUFF) - (buf - CGI_BUFF); \ if (len > 0) { \ len = snprintf(buf, len, __VA_ARGS__); \ buf += len + 1; /* skip NULL */ \ ++env; \ ++cnt; \ } \ } while (0) /** Generate CGI environment from HTTP request. * Values are saved in g_buff (g_cgienv) */ static int cgi_gen_env(const struct request_t *req, char **env) { int cnt, len; char *buf; cnt = 0; buf = CGI_BUFF; #ifdef CGI_DOCUMENT_ROOT CGI_ADD_ENV_(env, cnt, buf, "DOCUMENT_ROOT=%s", g_config.root); #endif #ifdef CGI_REQUEST_METHOD CGI_ADD_ENV_(env, cnt, buf, "REQUEST_METHOD=%s", req->method); #endif #ifdef CGI_REQUEST_URI CGI_ADD_ENV_(env, cnt, buf, "REQUEST_URI=%s", req->url); #endif if (req->query_string) { CGI_ADD_ENV_(env, cnt, buf, "QUERY_STRING=%s", req->query_string); } if (req->header[HEADER_CONTENTTYPE]) { CGI_ADD_ENV_(env, cnt, buf, "CONTENT_TYPE=%s", req->header[HEADER_CONTENTTYPE]); } if (req->header[HEADER_CONTENTLENGTH]) { CGI_ADD_ENV_(env, cnt, buf, "CONTENT_LENGTH=%s", req->header[HEADER_CONTENTLENGTH]); } #ifdef CGI_HTTP_COOKIE if (req->header[HEADER_COOKIE]) { CGI_ADD_ENV_(env, cnt, buf, "HTTP_COOKIE=%s", req->header[HEADER_COOKIE]); } #endif *env = NULL; return cnt; } #if HAVE_VFORK == 1 # define FORK_() vfork() # define EXIT_(x) _exit(x) #else # define FORK_() fork() # define EXIT_(x) exit(x) #endif /* HAVE_VFORK */ /** Execute file. * HTTP error code is set to client->response.status_code. */ static int cgi_exec(const char *path, struct client_t *client) { char *argv[2]; char *envp[MAX_CGIENV_ITEM]; pid_t pid; int newio; /* set socket back to blocking */ newio = fcntl(client->remote_fd, F_GETFL, NULL); if (newio == -1 || fcntl(client->remote_fd, F_SETFL, newio & (~O_NONBLOCK)) == -1) { A_ERR("fcntl: F_SETFL O_NONBLOCK %s", strerror(errno)); client->response.status_code = HTTP_STATUS_SERVERERROR; return -1; } pid = FORK_(); if (pid < 0) { client->response.status_code = HTTP_STATUS_SERVERERROR; return -1; } if (pid == 0) { /* child */ /* Generate CGI parameters before touching to the buffer */ cgi_gen_env(&client->request, envp); /* Send minimal header */ client->response.status_code = HTTP_STATUS_OK; client->data_length = http_gen_header(&client->response, client->data, sizeof(client->data), 0); if (send(client->remote_fd, client->data, client->data_length, 0) < 0) { EXIT_(1); } /* Tie CGI's stdin to the socket */ if (client->flags & CLIENT_FLAG_POST) { if (dup2(client->remote_fd, STDIN_FILENO) < 0) { EXIT_(1); } } /* Tie CGI's stdout to the socket */ if (dup2(client->remote_fd, STDOUT_FILENO) < 0) { EXIT_(1); } /* close unused FDs */ server_close_fds(); /* No error log */ newio = open("/dev/null", O_WRONLY); if (newio != STDERR_FILENO) { dup2(newio, STDERR_FILENO); close(newio); } /* Execute cgi script */ argv[0] = (char *)path; argv[1] = NULL; execve(path, argv, envp); EXIT_(1); /* exec error */ } /* parent */ client->state = STATE_NONE; /* Remove this client */ return 0; } int cgi_process(struct client_t *client, const char *path) { if (cgi_is_executable(path, client) != 0) { return -1; } if (client->flags & CLIENT_FLAG_HEADERONLY) { client->response.status_code = HTTP_STATUS_OK; client->data_length = http_gen_header(&client->response, client->data, sizeof(client->data), HTTP_FLAG_END); client->state = STATE_SEND_HEADER; return 0; } return cgi_exec(path, client); } /* vim: set ts=4 sw=4 expandtab: */
#include "minunit.h" #include <lcthw/darray_algos.h> #include <stdlib.h> #include <time.h> #include <limits.h> static inline int intcmp(int **a, int **b) { return **a - **b; } static inline int sintcmp(int *a, int *b) { return *a - *b; } int make_random(DArray *array, size_t n) { srand(time(NULL)); size_t i = 0; for(i = 0; i < n; i++) { int *random = DArray_new(array); *random = rand(); check(DArray_push(array, random) == 0, "Inserting random values failed."); } return 0; error: return -1; } int is_sorted(DArray *array, DArray_compare cmp) { int i = 0; for(i = 0; i < DArray_count(array) - 1; i++) { if(cmp(DArray_get(array, i), DArray_get(array, i+1)) > 0) { return 0; } } return 1; } char *run_sort_test(int (*func)(DArray *, DArray_compare), const char *name) { DArray *nums = DArray_create(sizeof(int *), 20); int rc = make_random(nums, 20); mu_assert(rc == 0, "Randomization failed."); mu_assert(!is_sorted(nums, (DArray_compare)sintcmp), "Numbers should start not sorted."); debug("--- Testing %s sorting algorithm", name); rc = func(nums, (DArray_compare)intcmp); mu_assert(rc == 0, "Sort failed."); mu_assert(is_sorted(nums, (DArray_compare)sintcmp), "Sort didn't sort properly."); DArray_clear_destroy(nums); return NULL; } char *test_qsort() { return run_sort_test(DArray_qsort, "qsort"); } char *test_heapsort() { return run_sort_test(DArray_heapsort, "heapsort"); } char *test_mergesort() { return run_sort_test(DArray_mergesort, "mergesort"); } char *speed_sort_test(int (*func)(DArray *, DArray_compare), const char *name) { size_t N = 10000; debug("--- Testing the speed of %s", name); DArray *source = DArray_create(sizeof(void *), N+1); clock_t fastest = LONG_MAX; int rc = make_random(source, N); mu_assert(rc == 0, "Randomizing the source DArray failed."); int i = 0; for(i = 0; i < 25; i++) { DArray *test = DArray_create(sizeof(int *), N+1); rc = DArray_copy(source, test); mu_assert(rc == 0, "Copy failed."); clock_t elapsed = -clock(); rc = func(test, (DArray_compare)intcmp); elapsed += clock(); mu_assert(rc == 0, "Sort failed."); mu_assert(is_sorted(test, (DArray_compare)sintcmp), "Sort didn't sort properly."); if(elapsed < fastest) fastest = elapsed; DArray_destroy(test); } debug("Fastest time for sort: %s, size %zu: %f", name, N, ((float)fastest)/CLOCKS_PER_SEC); DArray_clear_destroy(source); return NULL; } char *test_speed_qsort() { return speed_sort_test(DArray_qsort, "quicksort"); } char *test_speed_mergesort() { return speed_sort_test(DArray_mergesort, "mergesort"); } char *test_speed_heapsort() { return speed_sort_test(DArray_heapsort, "heapsort"); } char *test_cmp() { DArray *fake = DArray_create(sizeof(int), 10); int *num1 = DArray_new(fake); int *num2 = DArray_new(fake); *num1 = 100; *num2 = 20; mu_assert(sintcmp(num1, num2) > 0, "Comparison fails on 100, 20."); *num1 = 50; *num2 = 50; mu_assert(sintcmp(num1, num2) == 0, "Comparison fails on 50, 50."); *num1 = 30; *num2 = 60; mu_assert(sintcmp(num1, num2) < 0, "Comparison fails on 30, 60."); DArray_clear_destroy(fake); return NULL; } char *all_tests() { mu_suite_start(); mu_run_test(test_cmp); mu_run_test(test_qsort); mu_run_test(test_heapsort); mu_run_test(test_mergesort); mu_run_test(test_speed_qsort); mu_run_test(test_speed_mergesort); mu_run_test(test_speed_heapsort); return NULL; } RUN_TESTS(all_tests);
#ifndef GAME_H #define GAME_H #include <array> class Game { public: //Standard Con/Destructors Game(); //Initialize the board. ~Game(); //Not sure if I need this, but it's here in case //Are we playing the game? bool isRunning = true; //The easiest way I could implement stalemate //detection with my limited knowledge. //Is the board completely full, thereby causing a stalemate? bool isStalemate = false; //Board specific variables. static const int MAX_ROWS = 3; //Bounds for our board array static const int MAX_COLS = 3; //Return the bounds of our board. //Useful for, say, only allowing the player //to make a move within board boundaries //when player data is in a different class. int get_max_rows() { return MAX_ROWS; } int get_max_cols() { return MAX_COLS; } //Return our private piece variables for public use. char get_piece_x() { return pieceX; } char get_piece_o() { return pieceO; } //Print the board in its current state void print_board(); //Print our help board. This board does not change. void print_help_board(); //Check for an overlap, IE placing an X on top of an O. //Returns false if there is an overlap. The space is invalid. //Does NOT check for input sanity or bounds!!! This is done //in some other class, likely going to be the player class. bool is_valid_space(int xPosition, int yPosition); //Check for every possible win using piece as the winning piece. //For example, check if O is the winning piece. //Returns true on a win, false otherwise. bool is_victory(char piece); //Allow a different function/class/file/whatever to acces the board. //This is done to allow placement of pieces to the board without //the risk of accidently trashing it. is_valid_space() should always //be called first, and it likely will be called in this function. //Returns false if it cannot place the piece. bool add_new_piece(int xPosition, int yPosition, char piece); //Removes all pieces from the board, re-sets the score (if I chose to //implement scoring) to zero. This is used in preperation for a new game. void reset(); //Simple random number generator, with bounds. int get_random_num(int bound = 0); //Place a piece on the board based on user input. int make_move(int input, char piece); private: //Three win calcualtion functions to make my job easier. //Check for vertical, horizontal, or diagonal wins independently. //Used by is_victory() to simplify win checking even more. bool is_win_vertical(char piece); bool is_win_horizontal(char piece); bool is_win_diagonal(char piece); //char board[MAX_ROWS][MAX_COLS]; //The board itself std::array<std::array<char, MAX_ROWS>, MAX_COLS> board; //The board itself //These make setting up the board/player(s)/etc MUCH easier. char pieceX = 'X'; //The player class assigns these variables to a local var. char pieceO = 'O'; //for example, something like: player.set_piece(game.pieceX); char pieceNeutral = '-'; //The blank or empty piece. //Settings for making a help board. Shows the player which number corresponds //to the tile he/she wants. Below are variables for that. int helpBoard[MAX_ROWS][MAX_COLS]; }; #endif
// // HNBFlowLayoutViewController.h // HNBKitDemo // // Created by 开发 on 2017/7/21. // Copyright © 2017年 开发. All rights reserved. // #import "HNBBaseViewController.h" @interface HNBFlowLayoutViewController : HNBBaseViewController @end
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2016 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 DIGIBYTE_NET_PROCESSING_H #define DIGIBYTE_NET_PROCESSING_H #include "net.h" #include "validationinterface.h" /** Default for -maxorphantx, maximum number of orphan transactions kept in memory */ static const unsigned int DEFAULT_MAX_ORPHAN_TRANSACTIONS = 100; /** Expiration time for orphan transactions in seconds */ static const int64_t ORPHAN_TX_EXPIRE_TIME = 20 * 60; /** Minimum time between orphan transactions expire time checks in seconds */ static const int64_t ORPHAN_TX_EXPIRE_INTERVAL = 5 * 60; /** Default number of orphan+recently-replaced txn to keep around for block reconstruction */ static const unsigned int DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN = 100; /** Register with a network node to receive its signals */ void RegisterNodeSignals(CNodeSignals& nodeSignals); /** Unregister a network node */ void UnregisterNodeSignals(CNodeSignals& nodeSignals); class PeerLogicValidation : public CValidationInterface { private: CConnman* connman; public: PeerLogicValidation(CConnman* connmanIn); virtual void SyncTransaction(const CTransaction& tx, const CBlockIndex* pindex, int nPosInBlock); virtual void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload); virtual void BlockChecked(const CBlock& block, const CValidationState& state); virtual void NewPoWValidBlock(const CBlockIndex *pindex, const std::shared_ptr<const CBlock>& pblock); }; struct CNodeStateStats { int nMisbehavior; int nSyncHeight; int nCommonHeight; std::vector<int> vHeightInFlight; }; /** Get statistics from node state */ bool GetNodeStateStats(NodeId nodeid, CNodeStateStats &stats); /** Increase a node's misbehavior score. */ void Misbehaving(NodeId nodeid, int howmuch); /** Process protocol messages received from a given node */ bool ProcessMessages(CNode* pfrom, CConnman& connman, std::atomic<bool>& interrupt); /** * Send queued protocol messages to be sent to a give node. * * @param[in] pto The node which we are sending messages to. * @param[in] connman The connection manager for that node. * @param[in] interrupt Interrupt condition for processing threads * @return True if there is more work to be done */ bool SendMessages(CNode* pto, CConnman& connman, std::atomic<bool>& interrupt); #endif // DIGIBYTE_NET_PROCESSING_H
/* Copyright (c) 2015 Shaps Mohsenin. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY Shaps Mohsenin `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 Shaps Mohsenin 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. */ @import UIKit; #import "SPXDataView.h" /** * Provides collectionView specific definitions of a dataView */ @interface UITableView (SPXDataViewAdditions) <SPXDataView> /** * Gets/sets the block to execute when the collectionView requests a cell */ @property (nonatomic, copy) UITableViewCell *(^viewForItemAtIndexPathBlock)(UITableView *tableView, id object, NSIndexPath *indexPath); /** * Gets/sets the block to execute when the collectionView requests the cell to be configured */ @property (nonatomic, copy) void (^configureViewForItemAtIndexPathBlock)(UITableView *tableView, UITableViewCell *cell, id object, NSIndexPath *indexPath); /** * Gets/sets the block to execute when the collectionView requests a section header */ @property (nonatomic, copy) NSString *(^titleForHeaderInSectionBlock)(UITableView *tableView, NSUInteger section); /** * Gets/sets the block to execute when the collectionView requests a section footer */ @property (nonatomic, copy) NSString *(^titleForFooterInSectionBlock)(UITableView *tableView, NSUInteger section); /** * Gets/sets the block to execute when the collectionView requests whether or not a cell can be moved */ @property (nonatomic, copy) BOOL (^canMoveItemAtIndexPathBlock)(UITableView *tableView, UITableViewCell *cell, id object, NSIndexPath *indexPath); /** * Gets/sets the block to execute when the collectionView requests whether or not a cell can be edited */ @property (nonatomic, copy) BOOL (^canEditItemAtIndexPathBlock)(UITableView *tableView, UITableViewCell *cell, id object, NSIndexPath *indexPath); /** * Gets/sets the block to execute when the collectionView commits an editing action for a cell */ @property (nonatomic, copy) void (^commitEditingStyleForItemAtIndexPathBlock)(UITableView *tableView, UITableViewCell *cell, id object, NSIndexPath *indexPath); /** * Gets/sets the block to execute when the collectionView moves a cell */ @property (nonatomic, copy) void (^moveItemAtSourceIndexPathToDestinationIndexPathBlock)(UITableView *tableView, NSIndexPath *sourceIndexPath, NSIndexPath *destinationIndexPath); @end
End of preview. Expand in Data Studio

Reactive AI / Beta Code

Code-based pre-training corpus for RxT-Beta models, created from public & open datasets. Includes code in different programming languages. Subsets are divided into short (< ~1024 tokens) and long (> ~1024 tokens) categories.

Original dataset

It's created from codeparrot datasets:

Downloads last month
168